Skip to content

Commit eac3b06

Browse files
author
Dave Bartolomeo
committed
C#: Fix up C# IR construction to latest interface
1 parent 73d2e09 commit eac3b06

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ private import TInstruction
99
module SSA {
1010
class MemoryLocation = boolean;
1111

12-
predicate hasPhiInstruction(
13-
IRFunctionBase irFunc, TRawInstruction blockStartInstr, MemoryLocation memoryLocation
14-
) {
12+
predicate hasPhiInstruction(TRawInstruction blockStartInstr, MemoryLocation memoryLocation) {
1513
none()
1614
}
1715

18-
predicate hasChiInstruction(IRFunctionBase irFunc, TRawInstruction primaryInstruction) { none() }
16+
predicate hasChiInstruction(TRawInstruction primaryInstruction) { none() }
1917

2018
predicate hasUnreachedInstruction(IRFunctionBase irFunc) { none() }
2119
}

csharp/ql/src/experimental/ir/implementation/raw/internal/IRConstruction.qll

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ private import experimental.ir.Util
1717
private import experimental.ir.internal.IRCSharpLanguage as Language
1818

1919
TranslatedElement getInstructionTranslatedElement(Instruction instruction) {
20-
instruction = TRawInstruction(_, _, _, result, _)
20+
instruction = TRawInstruction(result, _)
2121
}
2222

2323
InstructionTag getInstructionTag(Instruction instruction) {
24-
instruction = TRawInstruction(_, _, _, _, result)
24+
instruction = TRawInstruction(_, result)
2525
}
2626

2727
pragma[noinline]
@@ -51,13 +51,8 @@ module Raw {
5151
}
5252

5353
cached
54-
predicate hasInstruction(
55-
Callable callable, Opcode opcode, Language::AST ast, TranslatedElement element,
56-
InstructionTag tag
57-
) {
58-
element.hasInstruction(opcode, tag, _) and
59-
ast = element.getAST() and
60-
callable = element.getFunction()
54+
predicate hasInstruction(TranslatedElement element, InstructionTag tag) {
55+
element.hasInstruction(_, tag, _)
6156
}
6257

6358
cached
@@ -173,11 +168,16 @@ import Cached
173168
cached
174169
private module Cached {
175170
cached
176-
Opcode getInstructionOpcode(TRawInstruction instr) { instr = TRawInstruction(_, result, _, _, _) }
171+
Opcode getInstructionOpcode(TRawInstruction instr) {
172+
exists(TranslatedElement element, InstructionTag tag |
173+
instructionOrigin(instr, element, tag) and
174+
element.hasInstruction(result, tag, _)
175+
)
176+
}
177177

178178
cached
179179
IRFunctionBase getInstructionEnclosingIRFunction(TRawInstruction instr) {
180-
instr = TRawInstruction(result, _, _, _, _)
180+
result.getFunction() = getInstructionTranslatedElement(instr).getFunction()
181181
}
182182

183183
cached

0 commit comments

Comments
 (0)