[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp

Misha Brukman brukman at cs.uiuc.edu
Thu Aug 19 14:34:15 PDT 2004



Changes in directory llvm/lib/Target/PowerPC:

PPC64ISelSimple.cpp updated: 1.9 -> 1.10
---
Log message:

On 64-bit PowerPC, pointers are 8 bytes, so parameter area offset is 48, not 24


---
Diffs of the changes:  (+10 -7)

Index: llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp
diff -u llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.9 llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.10
--- llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp:1.9	Thu Aug 19 13:49:58 2004
+++ llvm/lib/Target/PowerPC/PPC64ISelSimple.cpp	Thu Aug 19 16:34:05 2004
@@ -93,8 +93,11 @@
     // 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 @@
 /// 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 @@
                   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 @@
       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[] = { 






More information about the llvm-commits mailing list