[Lldb-commits] [PATCH] D61183: PostfixExpression: Introduce CFANode

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 29 04:07:34 PDT 2019

labath added a comment.

In D61183#1480948 <https://reviews.llvm.org/D61183#1480948>, @clayborg wrote:

> FYI: for all DWARF expressions found in EH frame stuff, they expect the CFA address to be pushed onto the stack prior to executing the expression. Do we just want to follow suit with the these expressions and avoid the extra needed node?

That is exactly what I am doing, and that's why I need D61018 <https://reviews.llvm.org/D61018> for this to work, because right now we actually *aren't* pushing the cfa value to the dwarf stack.

However, I still need some kind of a  node in the expression AST, so that the DWARF generator knows that it should insert a reference to the initial value.

Now theoretically, the dwarf codegen could be made smarter and try to optimize the generated expression. So for instance for an expression like ".cfa 8 +" it could be made to generate "DW_OP_lit8, DW_OP_plus" instead of the current "DW_OP_pick 0, DW_OP_uconst 8, DW_OP_plus". However, I don't see a need for that now, particularly, as this expression can be completely optimized away by using the "isCFAPlusOffset" mode of the UnwindPlan (which is something I plan to look at).

However, this got me thinking about the name of the special node, and I concluded that a better name would be the "InitialValueNode", reflecting it's usage instead of what it is supposed to contain. That way, it can be used in other situations where an initial value is present on the dwarf stack, and the name CFANode can remain free for the cases where one has to emit an explicit opcode (DW_OP_call_frame_cfa) in order to retrieve it.



More information about the lldb-commits mailing list