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.
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?
Thank you once again!
Vijay
On 01/21/2011 10:03 PM, Frits van Bommel wrote:> On Fri, Jan 21, 2011 at 2:48 PM, Vijayaraghavan Murali
> <m.vijay at nus.edu.sg> wrote:
>> I just wish to know if other than manually comparing the llc generated
>> code with the source program, is there any other way of knowing which
>> variables in the program are mapped to which registers? I was not able
>> to find any suitable option for the same, so I'm wondering if there
is a
>> workaround.
>
> Isn't this exactly one of the things debug information is for?
> You'd need to compile with -g and somehow read the DWARF information
> generated. As a bonus, this should work with gcc output too.
>
> You'd still be comparing llc output with the source code[1], but you
> no longer need to do it manually :).
>
>
> [1]: Or the clang AST, I suppose.