[llvm] [NFC] Allow fragment expressions in extractIfOffset (PR #69006)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 21:17:35 PDT 2023


felipepiovezan wrote:

> > FWIW, if someone wants to hoist DW_OP_LLVM_fragment into two optional fields in DIExpression, I'd support that too.
> 
> It would require a larger rewrite, but conceptually it'd make more sense to move fragment info into `DILocalVariable` (or create a subclass `DILocalVariableFragment`). `DW_OP_LLVM_fragment` is weird in that it's the only operator in a DIExpression that tells us about the variable whose value we are describing, rather than describing the value itself or how it should be interpreted (implicit/address/register). This _is_ part of Scott's rewrite, but I think it would be fine to implement in current LLVM - that patch is very large and could take some time to land, and furthermore introducing this change now would reduce the conceptual diff size for that patch.

Do we have an RFC for these ideas? I'd love to read/help. I often find these bits of logic in DIExpression quite difficult to work with. For example, besides what you describe with fragments, the idea that OP_entry_value has to be the first operand of an expr, and yet internally we have a vector of OPs instead of having a _field_ indicating the entry value. Or anything  that has special handling in `appendOpsToArg`. These invariants are difficult to maintain with the current impl.

https://github.com/llvm/llvm-project/pull/69006


More information about the llvm-commits mailing list