aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMisha Brukman <brukman+llvm@gmail.com>2004-08-19 21:34:05 +0000
committerMisha Brukman <brukman+llvm@gmail.com>2004-08-19 21:34:05 +0000
commit4debafbea461a756481eacf72d3372a55ff1d8af (patch)
tree0b946d00f2098ec7ec1cad7c2d915342f18c695b
parentcbabe7f06e2c54425367fac7825cda31c7d07b61 (diff)
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
-rw-r--r--lib/Target/PowerPC/PPC64ISelSimple.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Target/PowerPC/PPC64ISelSimple.cpp b/lib/Target/PowerPC/PPC64ISelSimple.cpp
index 72593a23f5..f80c569d32 100644
--- a/lib/Target/PowerPC/PPC64ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC64ISelSimple.cpp
@@ -93,8 +93,11 @@ namespace {
// FrameIndex for the alloca.
std::map<AllocaInst*, unsigned> AllocaMap;
+ // Target configuration data
+ const unsigned ParameterSaveAreaOffset;
+
ISel(TargetMachine &tm) : TM(reinterpret_cast<PPC64TargetMachine&>(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<ValueRecord> &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[] = {