[PATCH] D29672: [DebugInfo] Make legal and emit DW_OP_swap and DW_OP_xderef

Konstantin Zhuravlyov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 7 12:20:45 PST 2017


kzhuravl created this revision.
Herald added a subscriber: wdng.

https://reviews.llvm.org/D29672

Files:
  docs/LangRef.rst
  lib/CodeGen/AsmPrinter/DwarfExpression.cpp
  lib/IR/DebugInfoMetadata.cpp


Index: lib/IR/DebugInfoMetadata.cpp
===================================================================
--- lib/IR/DebugInfoMetadata.cpp
+++ lib/IR/DebugInfoMetadata.cpp
@@ -618,6 +618,8 @@
     case dwarf::DW_OP_plus:
     case dwarf::DW_OP_minus:
     case dwarf::DW_OP_deref:
+    case dwarf::DW_OP_swap:
+    case dwarf::DW_OP_xderef:
       break;
     }
   }
Index: lib/CodeGen/AsmPrinter/DwarfExpression.cpp
===================================================================
--- lib/CodeGen/AsmPrinter/DwarfExpression.cpp
+++ lib/CodeGen/AsmPrinter/DwarfExpression.cpp
@@ -273,6 +273,12 @@
     case dwarf::DW_OP_stack_value:
       AddStackValue();
       break;
+    case dwarf::DW_OP_swap:
+      EmitOp(dwarf::DW_OP_swap);
+      break;
+    case dwarf::DW_OP_xderef:
+      EmitOp(dwarf::DW_OP_xderef);
+      break;
     default:
       llvm_unreachable("unhandled opcode found in expression");
     }
Index: docs/LangRef.rst
===================================================================
--- docs/LangRef.rst
+++ docs/LangRef.rst
@@ -4372,13 +4372,18 @@
 - ``DW_OP_plus, 93`` adds ``93`` to the working expression.
 - ``DW_OP_bit_piece, 16, 8`` specifies the offset and size (``16`` and ``8``
   here, respectively) of the variable piece from the working expression.
+- ``DW_OP_swap`` swaps top two stack entries.
+- ``DW_OP_xderef`` provides extended dereference mechanism. The entry at the top
+  of the stack is treated as an address. The second stack entry is treated as an
+  address space identifier.
 
 .. code-block:: text
 
     !0 = !DIExpression(DW_OP_deref)
     !1 = !DIExpression(DW_OP_plus, 3)
     !2 = !DIExpression(DW_OP_bit_piece, 3, 7)
     !3 = !DIExpression(DW_OP_deref, DW_OP_plus, 3, DW_OP_bit_piece, 3, 7)
+    !4 = !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef)
 
 DIObjCProperty
 """"""""""""""


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29672.87497.patch
Type: text/x-patch
Size: 1852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170207/f1660f85/attachment.bin>


More information about the llvm-commits mailing list