[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Thu Nov 6 13:52:03 PST 2003
Changes in directory reopt/lib/LightWtProfiling:
UnpackTraceFunction.cpp updated: 1.14 -> 1.15
---
Log message:
Get TargetRegInfo to cough up the frame pointer, stack pointer regs.
Pass them to addGetPointerToStackValInstrs().
---
Diffs of the changes: (+11 -7)
Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.14 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.15
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.14 Thu Nov 6 13:40:35 2003
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Thu Nov 6 13:51:06 2003
@@ -20,8 +20,10 @@
#include "Support/Debug.h"
void addGetPointerToStackValInstrs (std::vector<MachineInstr *> &mvec,
- AllocInfo &Source, unsigned SrcReg) {
+ AllocInfo &Source, unsigned SrcReg,
+ unsigned FramePtrReg) {
// Let OFFSET be the offset of the value from %fp
+ mvec.push_back (BuildMI (V9::ADDi, 3).addReg (FramePtrReg)); // FIXME
// construct add %fp, <OFFSET>, <DESTREG>
}
@@ -37,35 +39,37 @@
const TargetRegInfo &TRI = TM.getRegInfo ();
std::vector<MachineInstr *> mvec;
unsigned SrcReg = 31337, TargReg = 31337;
- int Offset = -1, RegType = -1;
+ int Offset = -1, RegType = -1; // FIXME: How do we set these correctly?
if (Source.AllocState == AllocInfo::Allocated)
SrcReg = Source.Placement;
if (Target.AllocState == AllocInfo::Allocated)
TargReg = Target.Placement;
+ const unsigned FramePtrReg = TRI.getFramePointer ();
+ const unsigned StackPtrReg = TRI.getStackPointer ();
if (Source.AllocState == AllocInfo::Spilled
&& Target.AllocState == AllocInfo::Allocated) {
// Emit instructions to construct pointer to Source into SrcReg
- addGetPointerToStackValInstrs (mvec, Source, SrcReg);
+ addGetPointerToStackValInstrs (mvec, Source, SrcReg, FramePtrReg);
// Emit load instruction from stack loc. Source into register Target
TRI.cpMem2RegMI (mvec, SrcReg, Offset, TargReg, RegType);
- } else if (Source.AllocState == AllocInfo::Allocated\
+ } else if (Source.AllocState == AllocInfo::Allocated
&& Target.AllocState == AllocInfo::Allocated) {
// Emit move instruction from register Source to register Target
TRI.cpReg2RegMI (mvec, Source.Placement, Target.Placement, RegType);
} else if (Source.AllocState == AllocInfo::Allocated
&& Target.AllocState == AllocInfo::Spilled) {
// Emit instructions to construct pointer to Target into TargReg
- addGetPointerToStackValInstrs (mvec, Target, TargReg);
+ addGetPointerToStackValInstrs (mvec, Target, TargReg, FramePtrReg);
// Emit store instruction from register Source to stack loc. Target
TRI.cpReg2MemMI (mvec, Source.Placement, TargReg, Offset, RegType);
} else if (Source.AllocState == AllocInfo::Spilled
&& Target.AllocState == AllocInfo::Spilled) {
// Emit instructions to construct pointer to Source into SrcReg
- addGetPointerToStackValInstrs (mvec, Source, SrcReg);
+ addGetPointerToStackValInstrs (mvec, Source, SrcReg, FramePtrReg);
// Emit load instruction from address in SrcReg into register SrcReg
TRI.cpMem2RegMI (mvec, SrcReg, Offset, SrcReg, RegType);
// Emit instructions to construct pointer to Target into TargReg
- addGetPointerToStackValInstrs (mvec, Target, TargReg);
+ addGetPointerToStackValInstrs (mvec, Target, TargReg, FramePtrReg);
// Emit store instruction from register SrcReg to stack loc. Target
TRI.cpReg2MemMI (mvec, SrcReg, TargReg, Offset, RegType);
}
More information about the llvm-commits
mailing list