Skip to content

Commit eed0894

Browse files
C++: Add operand labels for more operand tags
I kept forgetting which operand on a Chi instruction was which, so I added dump labels. I added labels for the function target of a `Call`, for positional arguments, and for address operands as well.
1 parent a7f3160 commit eed0894

File tree

5 files changed

+1387
-1367
lines changed

5 files changed

+1387
-1367
lines changed

cpp/ql/src/semmle/code/cpp/ir/internal/OperandTag.qll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ class AddressOperandTag extends RegisterOperandTag, TAddressOperand {
7878
override final int getSortOrder() {
7979
result = 0
8080
}
81+
82+
override final string getLabel() {
83+
result = "&:"
84+
}
8185
}
8286

8387
AddressOperandTag addressOperand() {
@@ -247,6 +251,10 @@ class CallTargetOperandTag extends RegisterOperandTag, TCallTargetOperand {
247251
override final int getSortOrder() {
248252
result = 10
249253
}
254+
255+
override final string getLabel() {
256+
result = "func:"
257+
}
250258
}
251259

252260
CallTargetOperandTag callTargetOperand() {
@@ -306,6 +314,10 @@ class PositionalArgumentOperandTag extends ArgumentOperandTag,
306314
result = 12 + argIndex
307315
}
308316

317+
override final string getLabel() {
318+
result = argIndex.toString() + ":"
319+
}
320+
309321
final int getArgIndex() {
310322
result = argIndex
311323
}
@@ -323,6 +335,10 @@ class ChiTotalOperandTag extends MemoryOperandTag, TChiTotalOperand {
323335
override final int getSortOrder() {
324336
result = 13
325337
}
338+
339+
override final string getLabel() {
340+
result = "total:"
341+
}
326342
}
327343

328344
ChiTotalOperandTag chiTotalOperand() {
@@ -337,6 +353,10 @@ class ChiPartialOperandTag extends MemoryOperandTag, TChiPartialOperand {
337353
override final int getSortOrder() {
338354
result = 14
339355
}
356+
357+
override final string getLabel() {
358+
result = "partial:"
359+
}
340360
}
341361

342362
ChiPartialOperandTag chiPartialOperand() {

0 commit comments

Comments
 (0)