[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelPattern.cpp AlphaRegisterInfo.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Thu Jul 7 12:53:09 PDT 2005



Changes in directory llvm/lib/Target/Alpha:

AlphaISelPattern.cpp updated: 1.147 -> 1.148
AlphaRegisterInfo.cpp updated: 1.23 -> 1.24
---
Log message:

clean up prolouge and epilouge

---
Diffs of the changes:  (+39 -28)

 AlphaISelPattern.cpp  |   16 +++++++++++++--
 AlphaRegisterInfo.cpp |   51 ++++++++++++++++++++++++--------------------------
 2 files changed, 39 insertions(+), 28 deletions(-)


Index: llvm/lib/Target/Alpha/AlphaISelPattern.cpp
diff -u llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.147 llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.148
--- llvm/lib/Target/Alpha/AlphaISelPattern.cpp:1.147	Tue Jul  5 14:58:53 2005
+++ llvm/lib/Target/Alpha/AlphaISelPattern.cpp	Thu Jul  7 14:52:58 2005
@@ -94,10 +94,10 @@
       setOperationAction(ISD::EXTLOAD, MVT::i1,  Promote);
       setOperationAction(ISD::EXTLOAD, MVT::f32, Expand);
  
-      setOperationAction(ISD::ZEXTLOAD, MVT::i1,  Expand);
+      setOperationAction(ISD::ZEXTLOAD, MVT::i1,  Promote);
       setOperationAction(ISD::ZEXTLOAD, MVT::i32, Expand);
 
-      setOperationAction(ISD::SEXTLOAD, MVT::i1,  Expand);
+      setOperationAction(ISD::SEXTLOAD, MVT::i1,  Promote);
       setOperationAction(ISD::SEXTLOAD, MVT::i8,  Expand);
       setOperationAction(ISD::SEXTLOAD, MVT::i16, Expand);
 
@@ -613,6 +613,7 @@
       ++i;
     offset = i;
   } else if (const Instruction* I = dyn_cast<Instruction>(v)) {
+    assert(dyn_cast<PointerType>(I->getType()));
     type = 3;
     const BasicBlock* bb = I->getParent();
     const Function* F = bb->getParent();
@@ -627,6 +628,13 @@
     for(BasicBlock::const_iterator ii = bb->begin(); &*ii != I; ++ii)
       ++i;
     offset = i;
+  } else if (const Constant* C = dyn_cast<Constant>(v)) {
+    //Don't know how to look these up yet
+    type = 0;
+    fun = 0;
+    offset = 0;
+  } else {
+    assert(0 && "Error in value marking");
   }
   //type = 4: register spilling
   //type = 5: global address loading or constant loading
@@ -1407,6 +1415,10 @@
         BuildMI(BB, Alpha::BSR, 1, Alpha::R26)
           .addGlobalAddress(GASD->getGlobal(),true);
       } else {
+        //Must always reread relocation table before a call
+        if (GASD)
+          ExprMap.erase(N.getOperand(1));
+
         //no need to restore GP as we are doing an indirect call
         Tmp1 = SelectExpr(N.getOperand(1));
         BuildMI(BB, Alpha::BIS, 2, Alpha::R27).addReg(Tmp1).addReg(Tmp1);


Index: llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp
diff -u llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.23 llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.24
--- llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp:1.23	Fri Jul  1 14:12:13 2005
+++ llvm/lib/Target/Alpha/AlphaRegisterInfo.cpp	Thu Jul  7 14:52:58 2005
@@ -224,15 +224,12 @@
   MachineBasicBlock &MBB = MF.front();   // Prolog goes in entry BB
   MachineBasicBlock::iterator MBBI = MBB.begin();
   MachineFrameInfo *MFI = MF.getFrameInfo();
-  MachineInstr *MI;
   bool FP = hasFP(MF);
 
   //handle GOP offset
-  MI = BuildMI(Alpha::LDGP, 0);
-  MBB.insert(MBBI, MI);
+  BuildMI(MBB, MBBI, Alpha::LDGP, 0);
   //evil const_cast until MO stuff setup to handle const
-  MI = BuildMI(Alpha::ALTENT, 1).addGlobalAddress(const_cast<Function*>(MF.getFunction()), true);
-  MBB.insert(MBBI, MI);
+  BuildMI(MBB, MBBI, Alpha::ALTENT, 1).addGlobalAddress(const_cast<Function*>(MF.getFunction()), true);
 
   // Get the number of bytes to allocate from the FrameInfo
   long NumBytes = MFI->getStackSize();
@@ -259,13 +256,13 @@
   // adjust stack pointer: r30 -= numbytes
   NumBytes = -NumBytes;
   if (NumBytes >= IMM_LOW) {
-    MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes).addReg(Alpha::R30);
-    MBB.insert(MBBI, MI);
+    BuildMI(MBB, MBBI, Alpha::LDA, 2, Alpha::R30).addImm(NumBytes)
+      .addReg(Alpha::R30);
   } else if (getUpper16(NumBytes) >= IMM_LOW) {
-    MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(getUpper16(NumBytes)).addReg(Alpha::R30);
-    MBB.insert(MBBI, MI);
-    MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(getLower16(NumBytes)).addReg(Alpha::R30);
-    MBB.insert(MBBI, MI);
+    BuildMI(MBB, MBBI, Alpha::LDAH, 2, Alpha::R30).addImm(getUpper16(NumBytes))
+      .addReg(Alpha::R30);
+    BuildMI(MBB, MBBI, Alpha::LDA, 2, Alpha::R30).addImm(getLower16(NumBytes))
+      .addReg(Alpha::R30);
   } else {
     std::cerr << "Too big a stack frame at " << NumBytes << "\n";
     abort();
@@ -274,11 +271,12 @@
   //now if we need to, save the old FP and set the new
   if (FP)
   {
-    MI=BuildMI(Alpha::STQ, 3).addReg(Alpha::R15).addImm(0).addReg(Alpha::R30);
-    MBB.insert(MBBI, MI);
+    if (EnableAlphaLSMark)
+      BuildMI(MBB, MBBI, Alpha::MEMLABEL, 4).addImm(4).addImm(0).addImm(1)
+        .addImm(getUID());
+    BuildMI(MBB, MBBI, Alpha::STQ, 3).addReg(Alpha::R15).addImm(0).addReg(Alpha::R30);
     //this must be the last instr in the prolog
-    MI=BuildMI(Alpha::BIS, 2, Alpha::R15).addReg(Alpha::R30).addReg(Alpha::R30);
-    MBB.insert(MBBI, MI);
+    BuildMI(MBB, MBBI, Alpha::BIS, 2, Alpha::R15).addReg(Alpha::R30).addReg(Alpha::R30);
   }
 
 }
@@ -287,7 +285,6 @@
                                      MachineBasicBlock &MBB) const {
   const MachineFrameInfo *MFI = MF.getFrameInfo();
   MachineBasicBlock::iterator MBBI = prior(MBB.end());
-  MachineInstr *MI;
   assert((MBBI->getOpcode() == Alpha::RET)
          && "Can only insert epilog into returning blocks");
 
@@ -300,23 +297,25 @@
   if (FP)
   {
     //copy the FP into the SP (discards allocas)
-    MI=BuildMI(Alpha::BIS, 2, Alpha::R30).addReg(Alpha::R15).addReg(Alpha::R15);
-    MBB.insert(MBBI, MI);
+    BuildMI(MBB, MBBI, Alpha::BIS, 2, Alpha::R30).addReg(Alpha::R15)
+      .addReg(Alpha::R15);
     //restore the FP
-    MI=BuildMI(Alpha::LDQ, 2, Alpha::R15).addImm(0).addReg(Alpha::R15);
-    MBB.insert(MBBI, MI);
+    if (EnableAlphaLSMark)
+      BuildMI(MBB, MBBI, Alpha::MEMLABEL, 4).addImm(4).addImm(0).addImm(2)
+        .addImm(getUID());
+    BuildMI(MBB, MBBI, Alpha::LDQ, 2, Alpha::R15).addImm(0).addReg(Alpha::R15);
   }
 
    if (NumBytes != 0)
      {
        if (NumBytes <= IMM_HIGH) {
-         MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(NumBytes).addReg(Alpha::R30);
-         MBB.insert(MBBI, MI);
+         BuildMI(MBB, MBBI, Alpha::LDA, 2, Alpha::R30).addImm(NumBytes)
+           .addReg(Alpha::R30);
        } else if (getUpper16(NumBytes) <= IMM_HIGH) {
-         MI=BuildMI(Alpha::LDAH, 2, Alpha::R30).addImm(getUpper16(NumBytes)).addReg(Alpha::R30);
-         MBB.insert(MBBI, MI);
-         MI=BuildMI(Alpha::LDA, 2, Alpha::R30).addImm(getLower16(NumBytes)).addReg(Alpha::R30);
-         MBB.insert(MBBI, MI);
+         BuildMI(MBB, MBBI, Alpha::LDAH, 2, Alpha::R30)
+           .addImm(getUpper16(NumBytes)).addReg(Alpha::R30);
+         BuildMI(MBB, MBBI, Alpha::LDA, 2, Alpha::R30)
+           .addImm(getLower16(NumBytes)).addReg(Alpha::R30);
        } else {
          std::cerr << "Too big a stack frame at " << NumBytes << "\n";
          abort();






More information about the llvm-commits mailing list