<div dir="ltr">Hi Adrian,<br><br>Thanks for taking a look at this issue - it's certainly something we'll need.<br><br>It might be easier to review if you posted to Phabricator? (Chandler should really look at the SROA parts of this and strongly prefers Phab - and looking at this there's a few first-blush comments I'd like to make that'd be much easier in that format)</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 3, 2014 at 10:45 AM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Debug info: Support fragmented variables.<br>
<br>
Currently, LLVM cannot represent locations for aggregate variables that<br>
are fragmented across multiple Values. This situation arises, e.g.,<br>
during SROA, or even as part of the x86_64 calling convention when a struct<br>
is passed by value. This patch adds the functionality to emit<br>
DWARF location expressions using DW_OP(_bit)_piece to express partial<br>
values.<br>
<br>
This is implemented by adding a new operation type OpPiece to complex<br>
DIVariables which accepts an offset and a size.<br>
<br>
The canonical example would be something like this:<br>
<br>
> typedef struct { long int a; int b;} S;<br>
><br>
> int foo(S s) {<br>
>         return s.b;<br>
> }<br>
<br>
which at -O1 is now codegen’d into:<br>
<br>
> ; Function Attrs: nounwind readnone ssp uwtable<br>
> define i32 @foo(i64 %s.coerce0, i32 %s.coerce1) #0 {<br>
> entry:<br>
>   tail call void @llvm.dbg.value(metadata !{i64 %s.coerce0}, i64 0, metadata !20)<br>
>   tail call void @llvm.dbg.value(metadata !{i32 %s.coerce1}, i64 0, metadata !21)<br>
>   ret i32 %s.coerce1, !dbg !24<br>
> }<br>
<br>
<br>
with this patch we'd emit the following DWARF:<br>
><br>
> 0x00000047:         TAG_formal_parameter [3]<br>
>                      AT_name( "s" )<br>
>                      AT_decl_file( "struct.c" )<br>
>                      AT_decl_line( 3 )<br>
>                      AT_type( {0x00000069} ( S ) )<br>
>                      AT_location( 0x00000000<br>
>                         0x0000000000000000 - 0x0000000000000008: rdi, piece 0x00000008<br>
>                         0x0000000000000000 - 0x0000000000000006: rsi, bit-piece 32 64<br>
>                         0x0000000000000006 - 0x0000000000000008: rax, bit-piece 32 64  )<br>
><br>
><br>
<br>
<br>
cheers,<br>
adrian<br>
<br>
<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>