[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp

Brian Gaeke gaeke at cs.uiuc.edu
Mon Aug 30 12:56:53 PDT 2004



Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.109 -> 1.110
---
Log message:

Sort includes.
If we can guess that a pair of single-fp registers is being used to hold a
double-fp value, then use the fp double save/restore instructions instead of
the fp single save/restore instructions on it.


---
Diffs of the changes:  (+26 -15)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.109 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.110
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.109	Wed Aug 25 13:43:18 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Mon Aug 30 14:56:43 2004
@@ -13,22 +13,22 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "reopt/UnpackTraceFunction.h"
-#include "reopt/TraceToFunction.h"
-#include "reopt/MappingInfo.h"
-#include "../../../../lib/Target/SparcV9/MachineFunctionInfo.h"
 #include "../../../../lib/Target/SparcV9/MachineCodeForInstruction.h"
-#include "llvm/Support/CFG.h"
-#include "llvm/Module.h"
-#include "llvm/Instructions.h"
-#include "llvm/Assembly/Writer.h"
-#include "Support/StringExtras.h"                   // for utostr()
-#include "Support/Debug.h"
+#include "../../../../lib/Target/SparcV9/MachineFunctionInfo.h"
 #include "../../../../lib/Target/SparcV9/RegAlloc/AllocInfo.h"
+#include "../../../../lib/Target/SparcV9/SparcV9BurgISel.h"
 #include "../../../../lib/Target/SparcV9/SparcV9RegInfo.h"
 #include "../../../../lib/Target/SparcV9/SparcV9TargetMachine.h"
 #include "../../../../lib/Target/SparcV9/SparcV9TmpInstr.h"
-#include "../../../../lib/Target/SparcV9/SparcV9BurgISel.h"
+#include "Support/Debug.h"
+#include "Support/StringExtras.h"                   // for utostr()
+#include "llvm/Assembly/Writer.h"
+#include "llvm/Instructions.h"
+#include "llvm/Module.h"
+#include "llvm/Support/CFG.h"
+#include "reopt/MappingInfo.h"
+#include "reopt/TraceToFunction.h"
+#include "reopt/UnpackTraceFunction.h"
 
 namespace llvm {
 
@@ -192,6 +192,17 @@
   std::cerr << " in TraceFn\n";
 }
 
+unsigned UnpackTraceFunction::getRealRegType (unsigned R) const {
+  const SparcV9RegInfo &TRI = *TM->getRegInfo ();
+  unsigned rawRegType = TRI.getRegType (R);
+  if ((rawRegType == SparcV9RegInfo::FPSingleRegType)
+      && (R % 2 == 0)
+      && (RegsToSave.find (R+1) == RegsToSave.end ()))
+    return SparcV9RegInfo::FPDoubleRegType;
+  else
+    return rawRegType;
+}
+
 MachineBasicBlock::iterator
 UnpackTraceFunction::rewriteProlog (MachineBasicBlock &EntryBB) {
   // UTF prolog: start out by clearing SAVE and stack-load instructions out
@@ -221,7 +232,7 @@
     mvec.clear ();
     unsigned R = *i;
     DEBUG (std::cerr << "rewriteProlog: Saving " << RegStr (R) << "\n");
-    TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (R), TRI.getRegType (R),
+    TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (R), getRealRegType (R),
                      g2);
     for (std::vector<MachineInstr *>::iterator vi = mvec.begin (),
            ve = mvec.end (); vi != ve; ++vi)
@@ -250,7 +261,7 @@
     else if (Target.AllocState == AllocInfo::Spilled)
       // We'll save the value first in a register and then on TraceFn's stack
       R = SparcV9::g3;
-    unsigned RegType = TRI.getRegType (R);
+    unsigned RegType = getRealRegType (R);
     if (Source.AllocState == AllocInfo::Allocated)
       // Copy live-in value from where we saved its reg. on TraceFn's stack
       TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (Source.Placement), R,
@@ -377,7 +388,7 @@
   // in a register in the TraceFn.
   if (Source.AllocState == AllocInfo::Allocated)
     R = Source.Placement;
-  RegType = TRI.getRegType (R);
+  RegType = getRealRegType (R);
   if (Source.AllocState == AllocInfo::NotAllocated) {
     assert (liveOutValue && isa<Constant> (liveOutTraceValue)
             && "Non-allocated live-out value in TraceFn must be constant");
@@ -584,7 +595,7 @@
     mvec.clear ();
     unsigned R = *i;
     DEBUG (std::cerr << "rewriteEpilog: Reloading " << RegStr (R) << "\n");
-    TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (R), R, TRI.getRegType (R),
+    TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (R), R, getRealRegType (R),
                      g2);
     for (std::vector<MachineInstr *>::iterator vi = mvec.begin (),
            ve = mvec.end (); vi != ve; ++vi)






More information about the llvm-commits mailing list