Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,42 +128,10 @@ module SemanticExprConfig {

int getBasicBlockUniqueId(BasicBlock block) { idOf(block.getFirstInstruction().getAst(), result) }

newtype TSsaVariable =
TSsaInstruction(IR::Instruction instr) { instr.hasMemoryResult() } or
TSsaOperand(IR::Operand op) { op.isDefinitionInexact() }
class SsaVariable extends IR::Instruction {
SsaVariable() { this.hasMemoryResult() }

class SsaVariable extends TSsaVariable {
string toString() { none() }

Location getLocation() { none() }

IR::Instruction asInstruction() { none() }

IR::Operand asOperand() { none() }
}

class SsaInstructionVariable extends SsaVariable, TSsaInstruction {
IR::Instruction instr;

SsaInstructionVariable() { this = TSsaInstruction(instr) }

final override string toString() { result = instr.toString() }

final override Location getLocation() { result = instr.getLocation() }

final override IR::Instruction asInstruction() { result = instr }
}

class SsaOperand extends SsaVariable, TSsaOperand {
IR::Operand op;

SsaOperand() { this = TSsaOperand(op) }

final override string toString() { result = op.toString() }

final override Location getLocation() { result = op.getLocation() }

final override IR::Operand asOperand() { result = op }
IR::Instruction asInstruction() { result = this }
}

predicate explicitUpdate(SsaVariable v, Expr sourceExpr) {
Expand All @@ -180,9 +148,7 @@ module SemanticExprConfig {

SsaVariable getAPhiInput(SsaVariable v) {
exists(IR::PhiInstruction instr | v.asInstruction() = instr |
result.asInstruction() = instr.getAnInput()
or
result.asOperand() = instr.getAnInputOperand()
result.asInstruction() = instr.getAnInputOperand().getAnyDef()
)
}

Expand All @@ -192,11 +158,7 @@ module SemanticExprConfig {
result = getSemanticType(v.asInstruction().getResultIRType())
}

BasicBlock getSsaVariableBasicBlock(SsaVariable v) {
result = v.asInstruction().getBlock()
or
result = v.asOperand().getUse().getBlock()
}
BasicBlock getSsaVariableBasicBlock(SsaVariable v) { result = v.asInstruction().getBlock() }

private newtype TReadPosition =
TReadPositionBlock(IR::IRBlock block) or
Expand Down Expand Up @@ -263,11 +225,7 @@ module SemanticExprConfig {
pos = TReadPositionPhiInputEdge(operand.getPredecessorBlock(), operand.getUse().getBlock())
|
phi.asInstruction() = operand.getUse() and
(
input.asInstruction() = operand.getDef()
or
input.asOperand() = operand
)
input.asInstruction() = operand.getAnyDef()
)
}

Expand Down