Skip to content

Commit 0b2daf7

Browse files
committed
C++: filter operands of removed IR instructions
1 parent 6aeec58 commit 0b2daf7

File tree

5 files changed

+30
-35
lines changed

5 files changed

+30
-35
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ private class TStageOperand =
2727
class Operand extends TStageOperand {
2828
Operand() {
2929
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
30-
this = registerOperand(_, _, _)
31-
or
32-
this = nonSSAMemoryOperand(_, _)
33-
or
34-
this = phiOperand(_, _, _, _)
35-
or
36-
this = chiOperand(_, _)
30+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
31+
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
32+
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
33+
this = phiOperand(use, def, predecessorBlock, _)
34+
) or
35+
exists(Instruction use | this = chiOperand(use, _))
3736
}
3837

3938
/** Gets a textual representation of this element. */

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Operand.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ private class TStageOperand =
2727
class Operand extends TStageOperand {
2828
Operand() {
2929
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
30-
this = registerOperand(_, _, _)
31-
or
32-
this = nonSSAMemoryOperand(_, _)
33-
or
34-
this = phiOperand(_, _, _, _)
35-
or
36-
this = chiOperand(_, _)
30+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
31+
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
32+
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
33+
this = phiOperand(use, def, predecessorBlock, _)
34+
) or
35+
exists(Instruction use | this = chiOperand(use, _))
3736
}
3837

3938
/** Gets a textual representation of this element. */

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Operand.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ private class TStageOperand =
2727
class Operand extends TStageOperand {
2828
Operand() {
2929
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
30-
this = registerOperand(_, _, _)
31-
or
32-
this = nonSSAMemoryOperand(_, _)
33-
or
34-
this = phiOperand(_, _, _, _)
35-
or
36-
this = chiOperand(_, _)
30+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
31+
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
32+
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
33+
this = phiOperand(use, def, predecessorBlock, _)
34+
) or
35+
exists(Instruction use | this = chiOperand(use, _))
3736
}
3837

3938
/** Gets a textual representation of this element. */

csharp/ql/src/experimental/ir/implementation/raw/Operand.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ private class TStageOperand =
2727
class Operand extends TStageOperand {
2828
Operand() {
2929
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
30-
this = registerOperand(_, _, _)
31-
or
32-
this = nonSSAMemoryOperand(_, _)
33-
or
34-
this = phiOperand(_, _, _, _)
35-
or
36-
this = chiOperand(_, _)
30+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
31+
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
32+
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
33+
this = phiOperand(use, def, predecessorBlock, _)
34+
) or
35+
exists(Instruction use | this = chiOperand(use, _))
3736
}
3837

3938
/** Gets a textual representation of this element. */

csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Operand.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ private class TStageOperand =
2727
class Operand extends TStageOperand {
2828
Operand() {
2929
// Ensure that the operand does not refer to instructions from earlier stages that are unreachable here
30-
this = registerOperand(_, _, _)
31-
or
32-
this = nonSSAMemoryOperand(_, _)
33-
or
34-
this = phiOperand(_, _, _, _)
35-
or
36-
this = chiOperand(_, _)
30+
exists(Instruction use, Instruction def | this = registerOperand(use, _, def)) or
31+
exists(Instruction use | this = nonSSAMemoryOperand(use, _)) or
32+
exists(Instruction use, Instruction def, IRBlock predecessorBlock |
33+
this = phiOperand(use, def, predecessorBlock, _)
34+
) or
35+
exists(Instruction use | this = chiOperand(use, _))
3736
}
3837

3938
/** Gets a textual representation of this element. */

0 commit comments

Comments
 (0)