C++ IR: Fix calls to non-existent predicates

The last commit introduced calls to two predicates that did not exist. I
created `Instruction.getResultAddress` so it now exists and changed the
other call back to use the predicate that does exist.
This commit is contained in:
Jonas Jensen
2019-07-10 15:18:17 +02:00
parent 6d87c05155
commit 52cfbffb95
4 changed files with 31 additions and 4 deletions

View File

@@ -510,7 +510,7 @@ class Instruction extends Construction::TInstruction {
}
/**
* Returns the operand that holds the memory address to which the instruction stores its
* Gets the operand that holds the memory address to which this instruction stores its
* result, if any. For example, in `m3 = Store r1, r2`, the result of `getResultAddressOperand()`
* is `r1`.
*/
@@ -519,6 +519,15 @@ class Instruction extends Construction::TInstruction {
result.getUse() = this
}
/**
* Gets the instruction that holds the exact memory address to which this instruction stores its
* result, if any. For example, in `m3 = Store r1, r2`, the result of `getResultAddressOperand()`
* is the instruction that defines `r1`.
*/
final Instruction getResultAddress() {
result = getResultAddressOperand().getDef()
}
/**
* Holds if the result of this instruction is precisely modeled in SSA. Always
* holds for a register result. For a memory result, a modeled result is

View File

@@ -21,7 +21,7 @@ private predicate hasResultMemoryAccess(Instruction instr, IRVariable var, Type
private predicate hasOperandMemoryAccess(MemoryOperand operand, IRVariable var, Type type, IntValue startBitOffset,
IntValue endBitOffset) {
resultPointsTo(operand.getAddress().getAnyDef(), var, startBitOffset) and
resultPointsTo(operand.getAddressOperand().getAnyDef(), var, startBitOffset) and
type = operand.getType() and
if exists(operand.getSize()) then
endBitOffset = Ints::add(startBitOffset, Ints::mul(operand.getSize(), 8))

View File

@@ -510,7 +510,7 @@ class Instruction extends Construction::TInstruction {
}
/**
* Returns the operand that holds the memory address to which the instruction stores its
* Gets the operand that holds the memory address to which this instruction stores its
* result, if any. For example, in `m3 = Store r1, r2`, the result of `getResultAddressOperand()`
* is `r1`.
*/
@@ -519,6 +519,15 @@ class Instruction extends Construction::TInstruction {
result.getUse() = this
}
/**
* Gets the instruction that holds the exact memory address to which this instruction stores its
* result, if any. For example, in `m3 = Store r1, r2`, the result of `getResultAddressOperand()`
* is the instruction that defines `r1`.
*/
final Instruction getResultAddress() {
result = getResultAddressOperand().getDef()
}
/**
* Holds if the result of this instruction is precisely modeled in SSA. Always
* holds for a register result. For a memory result, a modeled result is

View File

@@ -510,7 +510,7 @@ class Instruction extends Construction::TInstruction {
}
/**
* Returns the operand that holds the memory address to which the instruction stores its
* Gets the operand that holds the memory address to which this instruction stores its
* result, if any. For example, in `m3 = Store r1, r2`, the result of `getResultAddressOperand()`
* is `r1`.
*/
@@ -519,6 +519,15 @@ class Instruction extends Construction::TInstruction {
result.getUse() = this
}
/**
* Gets the instruction that holds the exact memory address to which this instruction stores its
* result, if any. For example, in `m3 = Store r1, r2`, the result of `getResultAddressOperand()`
* is the instruction that defines `r1`.
*/
final Instruction getResultAddress() {
result = getResultAddressOperand().getDef()
}
/**
* Holds if the result of this instruction is precisely modeled in SSA. Always
* holds for a register result. For a memory result, a modeled result is