Skip to content

Commit 73d2e09

Browse files
author
Dave Bartolomeo
committed
C++:/C# Remove opcode from TRawInstruction
1 parent 978275c commit 73d2e09

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/internal/TInstruction.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ private import Imports::Opcode
1515
cached
1616
newtype TInstruction =
1717
TRawInstruction(
18-
Opcode opcode, IRConstruction::Raw::InstructionTag1 tag1,
18+
IRConstruction::Raw::InstructionTag1 tag1,
1919
IRConstruction::Raw::InstructionTag2 tag2
2020
) {
21-
IRConstruction::Raw::hasInstruction(opcode, tag1, tag2)
21+
IRConstruction::Raw::hasInstruction(tag1, tag2)
2222
} or
2323
TUnaliasedSSAPhiInstruction(
2424
TRawInstruction blockStartInstr,

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ private import TranslatedStmt
1515
private import TranslatedFunction
1616

1717
TranslatedElement getInstructionTranslatedElement(Instruction instruction) {
18-
instruction = TRawInstruction(_, result, _)
18+
instruction = TRawInstruction(result, _)
1919
}
2020

2121
InstructionTag getInstructionTag(Instruction instruction) {
22-
instruction = TRawInstruction(_, _, result)
22+
instruction = TRawInstruction(_, result)
2323
}
2424

2525
pragma[noinline]
@@ -44,8 +44,8 @@ module Raw {
4444
predicate functionHasIR(Function func) { exists(getTranslatedFunction(func)) }
4545

4646
cached
47-
predicate hasInstruction(Opcode opcode, TranslatedElement element, InstructionTag tag) {
48-
element.hasInstruction(opcode, tag, _)
47+
predicate hasInstruction(TranslatedElement element, InstructionTag tag) {
48+
element.hasInstruction(_, tag, _)
4949
}
5050

5151
cached
@@ -379,7 +379,10 @@ private module Cached {
379379

380380
cached
381381
Opcode getInstructionOpcode(TStageInstruction instr) {
382-
instr = TRawInstruction(result, _, _)
382+
exists(TranslatedElement element, InstructionTag tag |
383+
instructionOrigin(instr, element, tag) and
384+
element.hasInstruction(result, tag, _)
385+
)
383386
}
384387

385388
cached

csharp/ql/src/experimental/ir/implementation/internal/TInstruction.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ private import Imports::Opcode
1515
cached
1616
newtype TInstruction =
1717
TRawInstruction(
18-
Opcode opcode, IRConstruction::Raw::InstructionTag1 tag1,
18+
IRConstruction::Raw::InstructionTag1 tag1,
1919
IRConstruction::Raw::InstructionTag2 tag2
2020
) {
21-
IRConstruction::Raw::hasInstruction(opcode, tag1, tag2)
21+
IRConstruction::Raw::hasInstruction(tag1, tag2)
2222
} or
2323
TUnaliasedSSAPhiInstruction(
2424
TRawInstruction blockStartInstr,

0 commit comments

Comments
 (0)