mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-08 03:18:19 +00:00
[PowerPC] 32-bit ELF PIC support
This adds initial support for PPC32 ELF PIC (Position Independent Code; the -fPIC variety), thus rectifying a long-standing deficiency in the PowerPC backend. Patch by Justin Hibbits! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213427 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -199,7 +199,16 @@ BitVector PPCRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
||||
if (PPCFI->needsFP(MF))
|
||||
Reserved.set(PPC::R31);
|
||||
|
||||
if (hasBasePointer(MF))
|
||||
if (hasBasePointer(MF)) {
|
||||
if (Subtarget.isSVR4ABI() && !Subtarget.isPPC64() &&
|
||||
MF.getTarget().getRelocationModel() == Reloc::PIC_)
|
||||
Reserved.set(PPC::R29);
|
||||
else
|
||||
Reserved.set(PPC::R30);
|
||||
}
|
||||
|
||||
if (Subtarget.isSVR4ABI() && !Subtarget.isPPC64() &&
|
||||
MF.getTarget().getRelocationModel() == Reloc::PIC_)
|
||||
Reserved.set(PPC::R30);
|
||||
|
||||
// Reserve Altivec registers when Altivec is unavailable.
|
||||
@@ -843,7 +852,14 @@ unsigned PPCRegisterInfo::getBaseRegister(const MachineFunction &MF) const {
|
||||
if (!hasBasePointer(MF))
|
||||
return getFrameRegister(MF);
|
||||
|
||||
return Subtarget.isPPC64() ? PPC::X30 : PPC::R30;
|
||||
if (Subtarget.isPPC64())
|
||||
return PPC::X30;
|
||||
|
||||
if (Subtarget.isSVR4ABI() &&
|
||||
MF.getTarget().getRelocationModel() == Reloc::PIC_)
|
||||
return PPC::R29;
|
||||
|
||||
return PPC::R30;
|
||||
}
|
||||
|
||||
bool PPCRegisterInfo::hasBasePointer(const MachineFunction &MF) const {
|
||||
|
||||
Reference in New Issue
Block a user