[LLVMdev] View variable-register map

Frits van Bommel fvbommel at gmail.com
Sat Jan 22 01:01:58 PST 2011


On Sat, Jan 22, 2011 at 6:12 AM, Vijayaraghavan Murali
<m.vijay at nus.edu.sg> wrote:
>
> Thank you Frits! I noticed the following lines in the dwarf output (run with
> -O2):
>
>    .uleb128    40              # Offset
>    .byte   134                     # DW_CFA_offset + Reg (6)
>    .uleb128    4               # Offset
>    .byte   135                     # DW_CFA_offset + Reg (7)
>    .uleb128    3               # Offset
>    .byte   131                     # DW_CFA_offset + Reg (3)
>
> I think this is the closest to some sort of register "mapping", that I
> *think* changes wrt to the live intervals in the program. But there is no
> information about variables to which the registers are mapped.

There should be an encoding of variable names somewhere. I don't
really know how to read debug info myself though, so I'm not sure
where exactly.
There's probably some library that can help though. A quick bit of
googling points to libdwarf:
<http://reality.sgiweb.org/davea/dwarf.html>

> Actually, it's fine because I don't necessarily need the variable-register
> map. Even the number of registers used would suffice, which I can obtain
> from the above. But, can you just confirm if this is the result of register
> allocation and that the "Reg (#)" lines represent the different registers
> used?

Like I said, I don't really know how to read DWARF. But maybe someone
else on this list can enlighten you?




More information about the llvm-dev mailing list