From 4debafbea461a756481eacf72d3372a55ff1d8af Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Thu, 19 Aug 2004 21:34:05 +0000 Subject: [PATCH] On 64-bit PowerPC, pointers are 8 bytes, so parameter area offset is 48, not 24 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15928 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/PowerPC/PPC64ISelSimple.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Target/PowerPC/PPC64ISelSimple.cpp b/lib/Target/PowerPC/PPC64ISelSimple.cpp index 72593a23f5d..f80c569d328 100644 --- a/lib/Target/PowerPC/PPC64ISelSimple.cpp +++ b/lib/Target/PowerPC/PPC64ISelSimple.cpp @@ -93,8 +93,11 @@ namespace { // FrameIndex for the alloca. std::map AllocaMap; + // Target configuration data + const unsigned ParameterSaveAreaOffset; + ISel(TargetMachine &tm) : TM(reinterpret_cast(tm)), - F(0), BB(0) {} + F(0), BB(0), ParameterSaveAreaOffset(24) {} bool doInitialization(Module &M) { // Add external functions that we may call @@ -585,7 +588,7 @@ void ISel::copyConstantToRegister(MachineBasicBlock *MBB, /// LoadArgumentsToVirtualRegs - Load all of the arguments to this function from /// the stack into virtual registers. void ISel::LoadArgumentsToVirtualRegs(Function &Fn) { - unsigned ArgOffset = 24; + unsigned ArgOffset = ParameterSaveAreaOffset; unsigned GPR_remaining = 8; unsigned FPR_remaining = 13; unsigned GPR_idx = 0, FPR_idx = 0; @@ -1269,8 +1272,8 @@ void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, const std::vector &Args, bool isVarArg) { // Count how many bytes are to be pushed on the stack, including the linkage // area, and parameter passing area. - unsigned NumBytes = 24; - unsigned ArgOffset = 24; + unsigned NumBytes = ParameterSaveAreaOffset; + unsigned ArgOffset = ParameterSaveAreaOffset; if (!Args.empty()) { for (unsigned i = 0, e = Args.size(); i != e; ++i) @@ -1287,16 +1290,16 @@ void ISel::doCall(const ValueRecord &Ret, MachineInstr *CallMI, default: assert(0 && "Unknown class!"); } - // Just to be safe, we'll always reserve the full 32 bytes worth of + // Just to be safe, we'll always reserve the full 64 bytes worth of // argument passing space in case any called code gets funky on us. - if (NumBytes < 24 + 32) NumBytes = 24 + 32; + if (NumBytes < ParameterSaveAreaOffset + 64) + NumBytes = ParameterSaveAreaOffset + 64; // Adjust the stack pointer for the new arguments... // These functions are automatically eliminated by the prolog/epilog pass BuildMI(BB, PPC::ADJCALLSTACKDOWN, 1).addImm(NumBytes); // Arguments go on the stack in reverse order, as specified by the ABI. - // Offset to the paramater area on the stack is 24. int GPR_remaining = 8, FPR_remaining = 13; unsigned GPR_idx = 0, FPR_idx = 0; static const unsigned GPR[] = { -- 2.11.0