[LLVMdev] request for help writing a register allocator
Török Edwin
edwintorok at gmail.com
Thu Oct 22 03:21:32 PDT 2009
On 2009-10-22 06:02, Susan Horwitz wrote:
> but I don't understand how the code gets generated, so this isn't very
> helpful. Is there a way for me to look at the machine instructions before
> register allocation?
>
>
You can run llc with -debug which shows debug information from all
codegen phases.
You can also use -debug-only=<name> to debug only a specific codegen pass.
I see output like this, where I think that instead of LINEAR SCAN your
allocator will be run:
********** MACHINEINSTRS **********
entry:
20 MOV32mr <fi#1>, 1, %reg0, 0, %reg0, %EDI<kill>
28 %reg1026<def> = MOV32rm <fi#1>, 1, %reg0, 0, %reg0
36 MOV32mr <fi#0>, 1, %reg0, 0, %reg0, %reg1026<kill>
44 %EAX<def> = MOV32rm <fi#0>, 1, %reg0, 0, %reg0
64 RET %EAX<imp-usekill>
********** LINEAR SCAN **********
********** Function: foo
fixed intervals:
%reg14,inf = [0,6:0)[6,14:1)[14,22:2) 0@?-(6) 1@? 2@? -> DI
%reg2,inf = [46,54:1)[54,66:0) 0 at 54-(66) 1@? -> AL
%reg23,inf = [0,22:0) 0@?-(22) -> EDI
%reg1,inf = [46,54:1)[54,66:0) 0 at 54-(66) 1@? -> AH
%reg15,inf = [0,6:0)[6,14:1)[14,22:2) 0@?-(6) 1@? 2@? -> DIL
%reg3,inf = [46,54:1)[54,66:0) 0 at 54-(66) 1@? -> AX
%reg19,inf = [46,66:0) 0 at 46-(66) -> EAX
*** CURRENT ***: %reg1026,inf = [30,38:0) 0 at 30-(38)
processing active intervals:
processing inactive intervals:
allocating current interval: EAX
active intervals:
%reg1026,inf = [30,38:0) 0 at 30-(38) -> EAX
inactive intervals:
interval %reg1026,inf = [30,38:0) 0 at 30-(38) expired
********** REGISTER MAP **********
[reg1026 -> EAX]
**** Local spiller rewriting function 'foo':
**** Machine Instrs (NOTE! Does not include spills and reloads!) ****
# Machine code for foo():
<fi#0>: size is 4 bytes, alignment is 4 bytes, at location [SP+8]
<fi#1>: size is 4 bytes, alignment is 4 bytes, at location [SP+8]
Live Ins: EDI in VR#1025
Live Outs: EAX
....
Best regards
--Edwin
More information about the llvm-dev
mailing list