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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 10:48:09 PST 2017


aprantl accepted this revision.
aprantl added inline comments.
This revision is now accepted and ready to land.


================
Comment at: lib/IR/DebugInfoMetadata.cpp:622
+      break;
+    }
     case dwarf::DW_OP_constu:
----------------
I was just going to comment that a better way to implement this would be to add a local variable that keeps track of the stack depth. But I realize that we can't actually do that without introducing something like a DW_LLVM_OP_implicit_location as a placeholder for the location this DIExpression is attached to, or else pass the number of implicit stack elements into isValid (`isValid(unsigned StackDepth)`.

For example:

`!DIExpression(DW_OP_constu 1, DW_OP_swap, DW_OP_xderef)`

is fine when attached to a llvm.dbg.value (with one implicit stack element).
But it would be wrong if attached to a !DIGlobalVariableExpression that is describing a constant (with no implicit stack elements).

This is not necessarily something we need to fix in this patch. It might be nice to add a FIXME about the limitation here.


https://reviews.llvm.org/D29672





More information about the llvm-commits mailing list