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

Brian Gaeke gaeke at cs.uiuc.edu
Sun May 23 05:06:01 PDT 2004


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.68 -> 1.69

---
Log message:

Move declaration of UnpackTraceFunction to reopt/UnpackTraceFunction.h.
Include it. Prune other excess #includes.

createUnpackTraceFunctionPass() is history.

Give UnpackTraceFunction::runOnMachineFunction() a new doxygen comment.


---
Diffs of the changes:  (+8 -63)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.68 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.69
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.68	Sun May 23 02:57:26 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Sun May 23 05:05:02 2004
@@ -13,16 +13,15 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "reopt/UnpackTraceFunction.h"
 #include "reopt/TraceToFunction.h"
-#include "llvm/CodeGen/MachineFunctionPass.h"
+#include "reopt/MappingInfo.h"
 #include "llvm/CodeGen/MachineFunctionInfo.h"
-#include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Module.h"
 #include "llvm/Argument.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/Support/InstIterator.h"
 #include "Support/Debug.h"
-#include "reopt/MappingInfo.h"
 #include "../../../../lib/Target/SparcV9/RegAlloc/AllocInfo.h"
 #include "../../../../lib/Target/SparcV9/RegAlloc/PhyRegAlloc.h"
 #include "../../../../lib/Target/SparcV9/SparcV9RegInfo.h"
@@ -30,47 +29,6 @@
 
 namespace llvm {
 
-/// This pass inserts copies in two places in the machine
-/// code for TF->TraceFn: first, at the entry basic block to copy the values in
-/// TF->LiveInSet from TF->MatrixFn's registers to TF->TraceFn's registers, and
-/// second, at each exit basic block to copy the values in TF->LiveOutSet from
-/// TF->TraceFn's registers to TF->MatrixFn's registers.
-///
-class UnpackTraceFunction : public MachineFunctionPass {
-  TargetMachine *TM;
-  TraceFunction *TF;
-
-  /// Static stack size of the MachineFunction. Filled in by rewriteProlog ()
-  /// by calling getStaticStackSize (), and then used again by rewriteEpilog ().
-  ///
-  unsigned StaticStackSize;
-
-  /// Total stack size of the MachineFunction, including space for regs
-  /// modified in TraceFn to be saved.
-  ///
-  int TotalStackSize;
-
-  /// Registers clobbered in the trace. Filled in by findRegsUsedInFunction ().
-  ///
-  std::set<unsigned> RegsToRestore;
-  std::set<unsigned> RegsToSave;
-
-  unsigned getStaticStackSize (MachineFunction &MF);
-  unsigned stackOffsetForReg (unsigned R);
-  void findRegsToRestore (MachineFunction &MF);
-  void insertCopyMachineInstrs (AllocInfo &Source, AllocInfo &Target,
-                                MachineBasicBlock &B, const Type *Ty);
-  void insertBranchMachineInstrs (uint64_t Target, MachineBasicBlock &B);
-  const MachineInstr *containsReturnInstr (MachineBasicBlock &B);
-  void rewriteProlog (MachineFunction &MF, MachineBasicBlock &MBB);
-  void rewriteEpilog (MachineFunction &MF, MachineBasicBlock &MBB);
-public:
-  UnpackTraceFunction (TargetMachine *_TM, TraceFunction *_TF) :
-    TM (_TM), TF (_TF) { }
-  const char *getPassName () const { return "Unpack trace function"; }
-  virtual bool runOnMachineFunction (MachineFunction &MF);
-};
-
 /// Structure describing a single live variable copy.
 ///
 struct CopyInfo {
@@ -91,15 +49,6 @@
   return OS;
 }
 
-/// Create a new UnpackTraceFunction pass that will unpack a given
-/// TraceFunction, for which machine code has been generated, into
-/// its matrix function.
-///
-FunctionPass *createUnpackTraceFunctionPass (TargetMachine *TM,
-                                             TraceFunction *TF) {
-  return new UnpackTraceFunction (TM, TF);
-}
-
 // Ripped off from SparcV9PrologEpilogInserter
 unsigned UnpackTraceFunction::getStaticStackSize (MachineFunction &MF) {
   const TargetFrameInfo& frameInfo = MF.getTarget().getFrameInfo();
@@ -571,16 +520,12 @@
   insertBranchMachineInstrs (ReturnAddress, MBB);
 }
 
-/// This method is provided with MF, which is the
-/// machine code for TF->TraceFn.  We modify it (according to the description
-/// of the pass, above) using the information provided along with TF when this
-/// Pass object was created.
-///
-/// Admittedly, that is a pretty lame design, but for now, it means that we can
-/// only deal with one TraceFn and one MatrixFn in any given
-/// UnpackTraceFunction pass. If this stuff gets popular, we can have
-/// TraceFunctionPasses and TraceMachineFunctionPasses, or the Trace stuff can
-/// be an AnalysisPass, or something.
+/// runOnMachineFunction - Prepare MF, which is the machine code for
+/// TF->TraceFn, to be executed using a low-overhead calling convention for
+/// traces. We use the live-variable and return-block information in TF and the
+/// mapping information provided by the SparcV9 backend.  We assume that
+/// someone has called setTraceFunction(TraceFunction *) to set TF to point to
+/// the TraceFunction we are interested in.
 ///
 bool UnpackTraceFunction::runOnMachineFunction (MachineFunction &MF) {
   // Make sure we are looking at the MachineFunction corresponding to the





More information about the llvm-commits mailing list