|
1 | 1 | private import IR |
2 | 2 | import cpp |
3 | 3 |
|
| 4 | +private string getAdditionalInstructionProperty(Instruction instr, string key) { |
| 5 | + exists(IRPropertyProvider provider | |
| 6 | + result = provider.getInstructionProperty(instr, key) |
| 7 | + ) |
| 8 | +} |
| 9 | + |
| 10 | +private string getAdditionalBlockProperty(IRBlock block, string key) { |
| 11 | + exists(IRPropertyProvider provider | |
| 12 | + result = provider.getBlockProperty(block, key) |
| 13 | + ) |
| 14 | +} |
| 15 | + |
4 | 16 | private newtype TPrintableIRNode = |
5 | 17 | TPrintableFunctionIR(FunctionIR funcIR) or |
6 | 18 | TPrintableIRBlock(IRBlock block) or |
@@ -135,6 +147,11 @@ class PrintableIRBlock extends PrintableIRNode, TPrintableIRBlock { |
135 | 147 | result.getFunctionIR() = block.getFunctionIR() |
136 | 148 | } |
137 | 149 |
|
| 150 | + override string getProperty(string key) { |
| 151 | + result = PrintableIRNode.super.getProperty(key) or |
| 152 | + result = getAdditionalBlockProperty(block, key) |
| 153 | + } |
| 154 | + |
138 | 155 | final IRBlock getBlock() { |
139 | 156 | result = block |
140 | 157 | } |
@@ -185,6 +202,11 @@ class PrintableInstruction extends PrintableIRNode, TPrintableInstruction { |
185 | 202 | final Instruction getInstruction() { |
186 | 203 | result = instr |
187 | 204 | } |
| 205 | + |
| 206 | + override string getProperty(string key) { |
| 207 | + result = PrintableIRNode.super.getProperty(key) or |
| 208 | + result = getAdditionalInstructionProperty(instr, key) |
| 209 | + } |
188 | 210 | } |
189 | 211 |
|
190 | 212 | private predicate columnWidths(IRBlock block, int resultWidth, int operationWidth) { |
|
0 commit comments