[PATCH] D92013: [DebugInfo] Don't use DW_OP_implicit_value for fragments

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 18 09:52:51 PST 2020


aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Thanks, Pavel! My aspiration for DwarfExpression.cpp was to eventually add some backtracking capability to it to choose the optimal (=shortest) sequence of instructions for each expression. So far we haven't done this, because local decisions were usually sufficient, and more importantly, streaming the output limited our flexibility. If we give DwarfExpression a one-step look-ahead buffer, we could implement addConstantFP() as pushing two alternatives to the buffer:

   [Ops=[DW_OP_const ...], Constraints=[AnyAllowed], // alternative 1
    Ops= [DW_OP_implicit_value, ...], Constraints=[NextMustBeOpPiece] // alternative 2
  ]

The next time DwarfExpression wants to push an operation to the buffer, it first checks the constraints and picks the one that is compatible. And of course someone could have some computer science fun with generalizing this to an arbitrarily-large buffer guaranteeing an optimal sequence while not having exponential runtime.

I'm fine with this patch as it solves our problem in the short term but I also wanted to point out a route towards solving this properly.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92013/new/

https://reviews.llvm.org/D92013



More information about the llvm-commits mailing list