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

Brian Gaeke gaeke at cs.uiuc.edu
Thu Nov 6 13:41:01 PST 2003


Changes in directory reopt/lib/LightWtProfiling:

UnpackTraceFunction.cpp updated: 1.13 -> 1.14

---
Log message:

Mess around with insertCopyMachineInstrs.
Update comment in insertBranchMachineInstrs.


---
Diffs of the changes:  (+11 -9)

Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.13 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.14
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.13	Thu Nov  6 12:56:48 2003
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp	Thu Nov  6 13:40:35 2003
@@ -36,8 +36,12 @@
   UltraSparc TM;
   const TargetRegInfo &TRI = TM.getRegInfo ();
   std::vector<MachineInstr *> mvec;
-  unsigned SrcReg, TargReg;
-  int Offset, RegType;
+  unsigned SrcReg = 31337, TargReg = 31337;
+  int Offset = -1, RegType = -1;
+  if (Source.AllocState == AllocInfo::Allocated)
+    SrcReg = Source.Placement;
+  if (Target.AllocState == AllocInfo::Allocated)
+    TargReg = Target.Placement;
   if (Source.AllocState == AllocInfo::Spilled
       && Target.AllocState == AllocInfo::Allocated) {
     // Emit instructions to construct pointer to Source into SrcReg
@@ -83,16 +87,14 @@
 void insertBranchMachineInstrs (uint64_t Target, MachineBasicBlock &B) {
   DEBUG(std::cerr << "Emitting a jump to 0x" << std::hex << Target << "\n");
 
-  // FIXME: How do we know where this branch is going to end up in
-  // memory? For now, let's take a wild guess by saying it's at the
-  // beginning of the trace cache. Once we have a TraceCache
-  // MachineCodeEmitter, we should be able to ask it for
-  // getCurrentPCValue() for a much closer value (but not exactly
-  // right; we'll have to really fix this later.)
+  // FIXME: A "near jump" (Branch Always instruction) will get the
+  // WRONG address by this method, because the binary value of the
+  // instruction depends on the exact displacement from the branch
+  // source. Near jumps are disabled for now.
   const int64_t Addr = (int64_t)(intptr_t)dummyFunction2;
 
   int64_t BranchTarget = (Target-Addr) >> 2;
-  if (BranchTarget >= (1 << 19) || BranchTarget <= -(1 << 19)) {
+  if (1 || (BranchTarget >= (1 << 19) || BranchTarget <= -(1 << 19))) {
     /// FAR JUMP
     static const unsigned 
       o6 = SparcIntRegClass::o6, g0 = SparcIntRegClass::g0,





More information about the llvm-commits mailing list