C++: remove abstract classes in IR

This commit is contained in:
Robert Marsh
2018-09-18 14:09:56 -07:00
parent 755e21d355
commit 4c94144089
4 changed files with 42 additions and 14 deletions

View File

@@ -46,21 +46,31 @@ class GuardCondition extends Expr {
* being short-circuited) then it will only control blocks dominated by the
* true (for `&&`) or false (for `||`) branch.
*/
abstract cached predicate controls(BasicBlock controlled, boolean testIsTrue);
cached predicate controls(BasicBlock controlled, boolean testIsTrue) {
none()
}
/** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */
abstract cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue);
cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) {
none()
}
/** Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`.
If `isLessThan = false` then this implies `left >= right + k`. */
abstract cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan);
cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) {
none()
}
/** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */
abstract cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue);
cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) {
none()
}
/** Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`.
If `areEqual = false` then this implies `left != right + k`. */
abstract cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual);
cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual) {
none()
}
}
/**

View File

@@ -980,7 +980,9 @@ class RelationalInstruction extends CompareInstruction {
* if the overall instruction evaluates to `true`; for example on
* `x <= 20` this is the `20`, and on `y > 0` it is `y`.
*/
abstract Instruction getGreaterOperand();
Instruction getGreaterOperand() {
none()
}
/**
* Gets the operand on the "lesser" (or "lesser-or-equal") side
@@ -988,11 +990,15 @@ class RelationalInstruction extends CompareInstruction {
* if the overall instruction evaluates to `true`; for example on
* `x <= 20` this is `x`, and on `y > 0` it is the `0`.
*/
abstract Instruction getLesserOperand();
Instruction getLesserOperand() {
none()
}
/**
* Holds if this relational instruction is strict (is not an "or-equal" instruction).
*/
abstract predicate isStrict();
predicate isStrict() {
none()
}
}
class CompareLTInstruction extends RelationalInstruction {

View File

@@ -980,7 +980,9 @@ class RelationalInstruction extends CompareInstruction {
* if the overall instruction evaluates to `true`; for example on
* `x <= 20` this is the `20`, and on `y > 0` it is `y`.
*/
abstract Instruction getGreaterOperand();
Instruction getGreaterOperand() {
none()
}
/**
* Gets the operand on the "lesser" (or "lesser-or-equal") side
@@ -988,11 +990,15 @@ class RelationalInstruction extends CompareInstruction {
* if the overall instruction evaluates to `true`; for example on
* `x <= 20` this is `x`, and on `y > 0` it is the `0`.
*/
abstract Instruction getLesserOperand();
Instruction getLesserOperand() {
none()
}
/**
* Holds if this relational instruction is strict (is not an "or-equal" instruction).
*/
abstract predicate isStrict();
predicate isStrict() {
none()
}
}
class CompareLTInstruction extends RelationalInstruction {

View File

@@ -980,7 +980,9 @@ class RelationalInstruction extends CompareInstruction {
* if the overall instruction evaluates to `true`; for example on
* `x <= 20` this is the `20`, and on `y > 0` it is `y`.
*/
abstract Instruction getGreaterOperand();
Instruction getGreaterOperand() {
none()
}
/**
* Gets the operand on the "lesser" (or "lesser-or-equal") side
@@ -988,11 +990,15 @@ class RelationalInstruction extends CompareInstruction {
* if the overall instruction evaluates to `true`; for example on
* `x <= 20` this is `x`, and on `y > 0` it is the `0`.
*/
abstract Instruction getLesserOperand();
Instruction getLesserOperand() {
none()
}
/**
* Holds if this relational instruction is strict (is not an "or-equal" instruction).
*/
abstract predicate isStrict();
predicate isStrict() {
none()
}
}
class CompareLTInstruction extends RelationalInstruction {