[PATCH] D31604: [DebugInfo][X86] Improve X86 Optimize LEAs handling of debug values.

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 26 13:08:43 PDT 2017


andrewng added inline comments.


================
Comment at: lib/Target/X86/X86OptimizeLEAs.cpp:559
+      SmallVector<uint64_t, 8> Elements(OrigElements.size() + 1);
+      Elements[0] = dwarf::DW_OP_stack_value;
+      std::copy(OrigElements.begin(), OrigElements.end(),
----------------
aprantl wrote:
> andrewng wrote:
> > aprantl wrote:
> > > andrewng wrote:
> > > > aprantl wrote:
> > > > > Are you sure you want the DW_OP_stack_value at position 0? Shouldn't it go either at the end of the expression or just before a DW_OP_llvm_fragment operation?
> > > > Yes, I think it needs to be there otherwise any existing operations will be operating on the wrong value.
> > > Sorry, this was a rhetorical question. The DW_OP_stack_value operation always terminates the expression. It *must* come at the end (but before DW_OP_LLVM_fragement). You can factor out the code in Local.cpp from prependDIExpr() and move it into a static member function of DIExpression.
> > Thanks for the clarification. I re-read the spec more carefully and yes, I missed the "terminates the expression" part.
> > 
> > I've had a quick look at prependDIExpr. Could I use the offset to apply my AddrDispShift? Will the backend then sort out the specifics of generating a "correct" DWARF expression?
> > 
> > I think it is somewhat confusing that the DIExpression uses DWARF operations, but isn't strictly the equivalent of a DWARF expression. Or have I misunderstood?
> > I've had a quick look at prependDIExpr. Could I use the offset to apply my AddrDispShift? Will the backend then sort out the specifics of generating a "correct" DWARF expression?
> 
> I think so. Can you give me an example of how you imagine it failing, perhaps I'm not understanding your concern correctly?
> 
> > I think it is somewhat confusing that the DIExpression uses DWARF operations, but isn't strictly the equivalent of a DWARF expression. Or have I misunderstood?
> 
> I recently tried to improve the documentation in LangRef.rst let me know if there are still things missing. The most painful difference that I'm aware of right now is the fact that DW_OP_plus/minus has an implicit operand.
I will experiment with prependDIExpr. It looks like it should do what I need. I'll get back to you if I have any issues.

I've looked at the DIExpression documentation and it looks good to me.


https://reviews.llvm.org/D31604





More information about the llvm-commits mailing list