[llvm-commits] [llvm] r160002 - in /llvm/trunk: include/llvm/CodeGen/MachineFrameInfo.h lib/Target/X86/X86FrameLowering.cpp lib/Target/X86/X86RegisterInfo.cpp lib/Target/X86/X86RegisterInfo.h test/CodeGen/X86/alloca-align-rounding-32.ll test/Code

Jim Grosbach grosbach at apple.com
Tue Jul 31 11:25:24 PDT 2012


On Jul 31, 2012, at 10:21 AM, Chad Rosier <mcrosier at apple.com> wrote:

> 
> On Jul 31, 2012, at 10:07 AM, Anton Korobeynikov wrote:
> 
>>> Yes, this change is definitely the problem.  I used EBX as the base pointer
>>> because it appeared to work with all the calling conventions, but it can be
>>> changed in X86RegisterInfo.cpp.  If there is callee-saved register that
>>> isn't used by any ABI, then that would be the ideal choice.  Otherwise, I
>>> think the solution would be to probe the subtarget and ask for the base
>>> pointer register.  If that sounds reasonable I'll start working on a patch.
>> gcc uses ecx here. However, the best solution is to ask register
>> scavenger for free register.
> 
> Based on a discussion with Jakob, I don't think asking the register scavenger for a free register will work.  A scavenged register is only guaranteed live at a particular point in the code, but the base pointer needs to be live across the entire function.

Correct. I investigated using the scavenger for this problem on ARM and rejected the idea for that exact reason.

Theoretically, the base pointer could be rematerialized when needed, but that would still not require the scavenger, but just marking it is IsRematerializable. That remat would not be cheap, however, so it's very likely better to just keep it live across the whole function as you're doing.

-Jim

> 
>> I think extreme case here is PIC + regparm(3) o x86-32.
>> 
>> -- 
>> With best regards, Anton Korobeynikov
>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list