Skip to content

Commit c101674

Browse files
author
Dave Bartolomeo
committed
C++: Remove instructionOrigin()
This noopt predicate is no longer necessary. It's equivalent to `instruction = TRawInstruction(element, tag)`, which is already materialized and has a more favorable column order anyway.
1 parent e85cc0b commit c101674

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ InstructionTag getInstructionTag(Instruction instruction) {
2222
instruction = TRawInstruction(_, result)
2323
}
2424

25-
pragma[noinline]
26-
private predicate instructionOrigin(
27-
Instruction instruction, TranslatedElement element, InstructionTag tag
28-
) {
29-
element = getInstructionTranslatedElement(instruction) and
30-
tag = getInstructionTag(instruction)
31-
}
32-
3325
/**
3426
* Provides the portion of the parameterized IR interface that is used to construct the initial
3527
* "raw" stage of the IR. The other stages of the IR do not expose these predicates.
@@ -79,8 +71,7 @@ module Raw {
7971
cached
8072
TIRVariable getInstructionVariable(Instruction instruction) {
8173
exists(TranslatedElement element, InstructionTag tag |
82-
element = getInstructionTranslatedElement(instruction) and
83-
tag = getInstructionTag(instruction) and
74+
instruction = TRawInstruction(element, tag) and
8475
(
8576
result = element.getInstructionVariable(tag) or
8677
result.(IRStringLiteral).getAST() = element.getInstructionStringLiteral(tag)
@@ -91,7 +82,7 @@ module Raw {
9182
cached
9283
Field getInstructionField(Instruction instruction) {
9384
exists(TranslatedElement element, InstructionTag tag |
94-
instructionOrigin(instruction, element, tag) and
85+
instruction = TRawInstruction(element, tag) and
9586
result = element.getInstructionField(tag)
9687
)
9788
}
@@ -113,7 +104,7 @@ module Raw {
113104
cached
114105
int getInstructionIndex(Instruction instruction) {
115106
exists(TranslatedElement element, InstructionTag tag |
116-
instructionOrigin(instruction, element, tag) and
107+
instruction = TRawInstruction(element, tag) and
117108
result = element.getInstructionIndex(tag)
118109
)
119110
}
@@ -141,7 +132,7 @@ module Raw {
141132
cached
142133
int getInstructionElementSize(Instruction instruction) {
143134
exists(TranslatedElement element, InstructionTag tag |
144-
instructionOrigin(instruction, element, tag) and
135+
instruction = TRawInstruction(element, tag) and
145136
result = element.getInstructionElementSize(tag)
146137
)
147138
}
@@ -355,14 +346,14 @@ Locatable getInstructionAST(TStageInstruction instr) {
355346

356347
CppType getInstructionResultType(TStageInstruction instr) {
357348
exists(TranslatedElement element, InstructionTag tag |
358-
instructionOrigin(instr, element, tag) and
349+
instr = TRawInstruction(element, tag) and
359350
element.hasInstruction(_, tag, result)
360351
)
361352
}
362353

363354
Opcode getInstructionOpcode(TStageInstruction instr) {
364355
exists(TranslatedElement element, InstructionTag tag |
365-
instructionOrigin(instr, element, tag) and
356+
instr = TRawInstruction(element, tag) and
366357
element.hasInstruction(result, tag, _)
367358
)
368359
}
@@ -373,7 +364,7 @@ IRFunctionBase getInstructionEnclosingIRFunction(TStageInstruction instr) {
373364

374365
Instruction getPrimaryInstructionForSideEffect(SideEffectInstruction instruction) {
375366
exists(TranslatedElement element, InstructionTag tag |
376-
instructionOrigin(instruction, element, tag) and
367+
instruction = TRawInstruction(element, tag) and
377368
result = element.getPrimaryInstructionForSideEffect(tag)
378369
)
379370
}

0 commit comments

Comments
 (0)