search for: diexpression

Displaying 20 results from an estimated 134 matches for "diexpression".

2020 Feb 21
4
[RFC] Allowing debug intrinsics to reference multiple SSA Values
...y where the singular value is modeled as being already on the stack, if I understand it correctly?)? If it's decided that the best approach is to introduce something like DW_OP_LLVM_register - might be worth migrating to that first (basically adding DW_OP_LLVM_register(0) at the start of every DIExpression) and then expanding it from unary to n-ary support Putting the register values initially on the stack reduces the verbosity, though it could complicate successive salvages of variadic DIExpressions - if any value other than the last needs salvaging, then you have to use DWARF stack operations to mo...
2017 Sep 06
4
RFC: Introduce DW_OP_LLVM_memory to describe variables in memory with dbg.value
...eady, but talking it through for > myself/maybe others will find this useful: > > So since we don't have DW_OP_regN for LLVM registers, we could sort of > assume the implicit first value on the stack is a pseudo-OP_regN of the > LLVM SSA register. > Yep, that's how we use DIExpressions in both IR and MIR: The LHS of the dbg.value and DBG_VALUE instructions are a register-like value that gets pushed onto the expression stack. The DWARF asmprinter does some expression folding to clean things up, but that's the model. > To support that, all existing uses would need no chan...
2020 Aug 25
3
[Debuginfo] Changing llvm.dbg.value and DBG_VALUE to support multiple location operands
...It may be better however to simply replace the existing DBG_VALUE behaviour entirely instead, and so I'm looking for any comments on this change before pushing ahead with it. There are a few differences between the MIR instructions: Old: DBG_VALUE %x, $noreg, !DILocalVariable("x"), !DIExpression() New: DBG_VALUE !DILocalVariable("x"), !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_stack_value), %x 1) The "location" operand is moved to the end, as the instruction is now variadic such that every operand after the DIExpression is a location operand. 2) The second operand which cu...
2020 Sep 16
2
[Debuginfo] Changing llvm.dbg.value and DBG_VALUE to support multiple location operands
...e", DW_OP_stack_value means "this should never be an l-value". Because of this, an expression ending with DW_OP_LLVM_direct can be emitted as an l-value in any case where the value of the preceding expression is equal to an l-value. So for example: DBG_VALUE $rsp, !"x", !DIExpression(DW_OP_LLVM_direct) => DW_OP_reg7 RSP DBG_VALUE $rsp, !"x", !DIExpression(DW_OP_deref, DW_OP_LLVM_direct) => DW_OP_breg7 RSP+0 DBG_VALUE $rsp, !"x", !DIExpression(DW_OP_plus_uconst, 4, DW_OP_LLVM_direct) => DW_OP_breg7 RSP+4, DW_OP_stack_value Your point about the s...
2019 Nov 19
2
DW_OP_implicit_pointer design/implementation in general
...g.values are the latter. This would also avoid putting > DW_OP_implicit_pointer into expressions in the IR, pre-isel at least. > On that particular point, I would like to see is a generalization of dbg.value: Currently llvm.dbg.value binds an SSA value (including constants and undef) and a DIExpression to a DILocalVariable at a position in the instruction stream. That first SSA value argument is an implicit first element in the DIExpression. A more general form would be a more printf-like signature: llvm.dbg.value(DILocalVariable, DIExpression, ...) for example llvm.dbg.value_new(DILocalVaria...
2018 Nov 01
4
Fwd: RFC: Adding debug information to LLVM to support Fortran
...DW_TAG_string_type: DW_AT_name: “character(5)” DW_AT_byte_size: 5 CHARACTER types can also have deferred length. This is supported in the new metadata as follows. !22 = !DIStringType(name: “character(*)!1”, size: 32, stringLength: !23, stringLengthExpression: !DIExpression()) !23 = !DILocalVariable(scope: !3, arg: 4, file: !4, type: !5, flags: DIFlagArtificial) This will generate the following DWARF information. DW_TAG_string_type: DW_AT_name: character(*)!1 DW_AT_string_length: 0x9b (location list) DW_AT_byte_size: 4 2.2 Fortran Array Types...
2017 Sep 07
2
RFC: Introduce DW_OP_LLVM_memory to describe variables in memory with dbg.value
...will find this useful: >>> >>> So since we don't have DW_OP_regN for LLVM registers, we could sort of >>> assume the implicit first value on the stack is a pseudo-OP_regN of the >>> LLVM SSA register. >>> >> >> Yep, that's how we use DIExpressions in both IR and MIR: The LHS of the >> dbg.value and DBG_VALUE instructions are a register-like value that gets >> pushed onto the expression stack. The DWARF asmprinter does some expression >> folding to clean things up, but that's the model. >> >> >>> To...
2020 Sep 10
2
LSR breaks debug info
...low in the pre-LSR dump the pointer 'p' is desribed by dbg.value both before and after it is incremented. In the post-LSR setting these dbg.value are now referring to undef so the debug-info for 'p' is effectively lost. It is interesting to note that after LSR one dbg.value has its DIExpression adjusted to add the value three but it is still referring to undef. As I understand it this is the work of salvageDebugInfo. When LSR has created the new induction variable expression and starts deleting the old one salvaging will kick in. When %add.ptr is deleted it will adjust the dbg.value use o...
2020 Jul 08
2
Defining the DIExpression operator DW_OP_LLVM_arg
...same effect can be achieved by implicitly pushing all operands of a DBG_VALUE to the stack, followed by a combination of DW_OP_dup, DW_OP_pick, DW_OP_swap, DW_OP_rot, and DW_OP_over. However, the resulting expressions can get very long and unwieldy and it is easier to generate efficient DWARF from DIExpressions that explicitly refer to arguments. DW_OP_LLVM_argN has the advantage of using less memory, at the cost of limiting the number of arguments to a hardcoded value. > > > > I'd also add that since `DW_OP_pick N` picks the Nth argument from the top of the stack rather than the bottom,...
2020 Jul 08
2
Defining the DIExpression operator DW_OP_LLVM_arg
...same effect can be achieved by implicitly pushing all operands of a DBG_VALUE to the stack, followed by a combination of DW_OP_dup, DW_OP_pick, DW_OP_swap, DW_OP_rot, and DW_OP_over. However, the resulting expressions can get very long and unwieldy and it is easier to generate efficient DWARF from DIExpressions that explicitly refer to arguments. DW_OP_LLVM_argN has the advantage of using less memory, at the cost of limiting the number of arguments to a hardcoded value. > >>> > >>> I'd also add that since `DW_OP_pick N` picks the Nth argument from the top of the stack rather t...
2020 Feb 20
3
[RFC] Allowing debug intrinsics to reference multiple SSA Values
...s at the moment is that each intrinsic can only reference a single SSA value; a numeric constant may be represented within the expression itself, allowing for binary operators with a constant operand to be salvaged: %c = add i32 %a, 4 llvm.dbg.value(metadata i32 %c, DILocalVariable("x"), DIExpression()) ; Salvage... llvm.dbg.value(metadata i32 %a, DILocalVariable("x"), DIExpression(DW_OP_constu, 4, DW_OP_plus)) This proposal is to allow multiple SSA value references within a debug intrinsic, allowing binary operators with non-constant operands to be salvaged. This is a long-awaited f...
2018 Nov 23
2
is this a bug in an optimization pass?
...%Bar], align 4 %x = alloca %Bar, align 4 %for_index = alloca i64, align 8 %0 = bitcast [10 x %Bar]* %array to i8*, !dbg !60 call void @llvm.memset.p0i8.i64(i8* align 4 %0, i8 -86, i64 80, i1 false), !dbg !60 call void @llvm.dbg.declare(metadata [10 x %Bar]* %array, metadata !45, metadata !DIExpression()), !dbg !60 store i64 0, i64* %for_index, align 8, !dbg !61 call void @llvm.dbg.declare(metadata i64* %for_index, metadata !55, metadata !DIExpression()), !dbg !63 br label %ForCond, !dbg !61 ForCond: ; preds = %Else, %Entry %1 = load i64, i64* %fo...
2020 Oct 06
2
[Debuginfo] Changing llvm.dbg.value and DBG_VALUE to support multiple location operands
...very often. Although that edge case is likely to be very rare, the _direct operator itself will appear very frequently, as it would be used for every DBG_VALUE that represents a register location. This allows us to represent register locations in a way that doesn't rely on flags outside of the DIExpression, doesn't require changes to be made to the flag/DIExpression if the register is RAUWd by a constant or other value, and has a clear definition that doesn't clash with anything in the DWARF spec. Supporting the no-op DIExpression reduction is unlikely to have a huge impact in itself, but hav...
2019 Nov 20
2
DW_OP_implicit_pointer design/implementation in general
...t also opens possibility of extension below is explanation. Since dbg.value currently represents (VAR=VALUE), the new intrinsic dbg.deref_value will represent de-referenced value (*VAR = VAL) - Below represents ptr=null call void @llvm.dbg.value(metadata i32* null, metadata !21, metadata !DIExpression()) - And below represents *ptr=var call void @llvm.dbg.deref.value(metadata !16, metadata !21, metadata !DIExpression(DW_OP_LLVM_implicit_pointer, DW_OP_LLVM_arg0, 0)) - And below represents *ptr=arr[1] call void @llvm.dbg.deref.value(metadata !16, metadata !21, metadata !DIExpr...
2016 Jan 05
2
Proposal for multi location debug info support in LLVM IR
...going to be somewhat verbose for partial updates of > SROA’ed aggregates as in the following example: > > // struct s { int i, j }; > // void foo(struct s) { s.j = 0; ... } > > define void @foo(i32 %i, i32 %j) { > %token = call llvm.dbg.value(token %undef, %i, !Struct, > !DIExpression(DW_OP_bit_piece(0, 32))) > call llvm.dbg.value(token %token, %j, !Struct, > !DIExpression(DW_OP_bit_piece(32, 32))) > ... > > ; have to repeat %i here: > %tok2 = call llvm.dbg.value(token %undef, %i, !Struct, > !DIExpression(DW_OP_bit_piece(0, 32))) >...
2020 Feb 25
2
[RFC] Allowing debug intrinsics to reference multiple SSA Values
>As the person who has advocated for DW_OP_LLVM_arg(N) before, my main motivation was to resolve the ambiguity of constant DIExpressions: As a worst-case example: > >dbg.value(%undef, !DILocalVariable(x), DIExpression(DW_OP_constu, 42)) > >Is this undefined, or constant 42? > >But if we make dbg.value fully variadic with all parameters pushed to the stack ahead of time, we can distinguish between > >dbg.valu...
2020 Sep 02
2
[Debuginfo] Changing llvm.dbg.value and DBG_VALUE to support multiple location operands
...xample, a constant value. I think we want something like DW_OP_deref instead, at least for r-values. For l-values (=variables a debugger could write to) we would need to have a discriminator that declares the DBG_VALUE as a memory location (cf. DWARF5 chapter 2.6). This is a tricky one. Right now, DIExpressions sort-of mimic DWARF, but with differences that aren't always immediately clear. The reason why I chose DW_OP_stack_value for the direct-value-case instead of using DW_OP_deref for the indirect-value-case is that it is more like actual DWARF: a DWARF expression is either empty, a register, a me...
2020 Sep 15
2
[Debuginfo] Changing llvm.dbg.value and DBG_VALUE to support multiple location operands
...en to by the debugger, an r-value cannot. A memory location and a register location are both l-values, while implicit locations (stack value/implicit pointer) are r-values. Directness on the other hand, I've been using to mean "the variable's value is equal to the value computed by the DIExpression". Applied to a DWARF expression this description would only refer to a stack value. LLVM's DIExpressions are different however, because we don't have DW_OP_reg or DW_OP_breg: we simply refer to the register and use context to determine which it should be. The best example of this is fr...
2018 Mar 22
2
Question about debug information for global variables
...ible to access these logical variables >> inside the debugger as if they are normal global variables. >> >> My idea was to create the debug information for each of these logical >> variables by using DIBuilder::createGlobalVariableExpression called >> GVE and provide a DIExpression called DIE that should basically take >> the value of the global variable GVE is added to, i.e. the value of >> BaseAddress, and add a constant offset corresponding to the logical >> variable. This should be the address of the logical variable. >> >> So, the DIExpressi...
2020 Sep 11
2
[Debuginfo] Changing llvm.dbg.value and DBG_VALUE to support multiple location operands
...ore general terms, I think that the IR/MIR debug value instructions should only care about how the variable's value can be computed. Whether the result of that computation is an lvalue is unimportant within LLVM itself as far as I can tell, and is redundant when it can be computed from just the DIExpression and location operands. >As stated above, I don't think we can trivially determine this, because (at least for dbg.values) this info was lost already in LLVM IR. Unless we say the dbg.declare / dbg.value distinction is what determines lvalues vs. rvalues. With the proposed operator, it woul...