[LLVMdev] problem trying to write an LLVM register-allocation pass

Susan Horwitz horwitz at cs.wisc.edu
Thu Nov 29 15:49:39 PST 2012


I have a new problem: Register RBP is used in a function foo.  (I am not 
allocating RBP to any virtual register, the instances of RBP in function 
foo are in the machine code when my register allocator starts.)

Function foo calls function bar.  Register RBP is not saved across the 
call, though it is live after the call.  Function bar includes a virtual 
register.  The code that I'm using to find the registers available to be 
allocated to that virtual register includes EBP in that available-preg 
set.  This is a disaster, since writing into EBP clobbers RBP.

I tried to add code to save all live physical registers across calls, 
but I don't know how to get the appropriate TargetRegisterClass (needed 
to call CreateSpillStackObject).

Is there a different way to save/restore RBP across calls?  Or a way to 
get its TargetRegisterClass?

Susan



More information about the llvm-dev mailing list