Skip to content

Commit 7eef27b

Browse files
tromeygithub-actions[bot]
authored andcommitted
Automerge: Allow DW_OP_rot, DW_OP_neg, and DW_OP_abs in DIExpression (#160757)
The Ada front end can emit somewhat complicated DWARF expressions for the offset of a field. While working in this area I found that I needed DW_OP_rot (to implement a branch-free computation -- it looked more difficult to add support for branching); and DW_OP_neg and DW_OP_abs (just basic functionality).
2 parents f20b622 + 296fddc commit 7eef27b

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfExpression.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,15 @@ bool DwarfExpression::addExpression(
618618
case dwarf::DW_OP_dup:
619619
case dwarf::DW_OP_push_object_address:
620620
case dwarf::DW_OP_over:
621+
case dwarf::DW_OP_rot:
621622
case dwarf::DW_OP_eq:
622623
case dwarf::DW_OP_ne:
623624
case dwarf::DW_OP_gt:
624625
case dwarf::DW_OP_ge:
625626
case dwarf::DW_OP_lt:
626627
case dwarf::DW_OP_le:
628+
case dwarf::DW_OP_neg:
629+
case dwarf::DW_OP_abs:
627630
emitOp(OpNum);
628631
break;
629632
case dwarf::DW_OP_deref:

llvm/lib/IR/DebugInfoMetadata.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,13 +1768,16 @@ bool DIExpression::isValid() const {
17681768
case dwarf::DW_OP_bregx:
17691769
case dwarf::DW_OP_push_object_address:
17701770
case dwarf::DW_OP_over:
1771+
case dwarf::DW_OP_rot:
17711772
case dwarf::DW_OP_consts:
17721773
case dwarf::DW_OP_eq:
17731774
case dwarf::DW_OP_ne:
17741775
case dwarf::DW_OP_gt:
17751776
case dwarf::DW_OP_ge:
17761777
case dwarf::DW_OP_lt:
17771778
case dwarf::DW_OP_le:
1779+
case dwarf::DW_OP_neg:
1780+
case dwarf::DW_OP_abs:
17781781
break;
17791782
}
17801783
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
;; This test checks the validity of DWARF operators DW_OP_rot, DW_OP_neg, and DW_OP_abs.
2+
3+
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
4+
5+
; CHECK: !DIExpression(DW_OP_push_object_address, DW_OP_lit0, DW_OP_lit0, DW_OP_neg, DW_OP_abs, DW_OP_rot, DW_OP_rot, DW_OP_rot, DW_OP_plus, DW_OP_plus)
6+
7+
; ModuleID = 'DW_OP_rot_neg_abs.adb'
8+
source_filename = "/dir/DW_OP_rot_neg_abs.ll"
9+
10+
!named = !{!DIExpression(DW_OP_push_object_address, DW_OP_lit0, DW_OP_lit0, DW_OP_neg, DW_OP_abs, DW_OP_rot, DW_OP_rot, DW_OP_rot, DW_OP_plus, DW_OP_plus)}

0 commit comments

Comments
 (0)