[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Fri Jan 16 13:18:03 PST 2004
Changes in directory reopt/lib/LightWtProfiling:
UnpackTraceFunction.cpp updated: 1.30 -> 1.31
---
Log message:
Make UnpackTraceFunction require a TargetMachine, because
insertCopyMachineInstrs needs it.
Move insertCopyMachineInstrs into UnpackTraceFunction.
Make everything else static.
---
Diffs of the changes: (+22 -16)
Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.30 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.31
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.30 Fri Jan 16 11:49:46 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Fri Jan 16 13:17:16 2004
@@ -28,26 +28,32 @@
namespace llvm {
class UnpackTraceFunction : public MachineFunctionPass {
+ TargetMachine *TM;
TraceFunction *TF;
+
+ void insertCopyMachineInstrs (AllocInfo &Source, AllocInfo &Target,
+ MachineBasicBlock &B, const Type *Ty);
public:
- UnpackTraceFunction (TraceFunction *_TF) : TF (_TF) { }
+ UnpackTraceFunction (TargetMachine *_TM, TraceFunction *_TF) : TM (_TM),
+ TF (_TF) { }
const char *getPassName () const { return "Unpack trace function"; }
virtual bool runOnMachineFunction (MachineFunction &MF);
};
-MachineFunctionPass *createUnpackTraceFunctionPass (TraceFunction *TF) {
- return new UnpackTraceFunction (TF);
+FunctionPass *createUnpackTraceFunctionPass (TargetMachine *TM,
+ TraceFunction *TF) {
+ return new UnpackTraceFunction (TM, TF);
}
/// Insert the appropriate machine instruction(s) that copies the value in
/// Source to the location specified by Target, at the beginning of B. Note
/// that the current implementation is SPARC-specific.
///
-void insertCopyMachineInstrs (AllocInfo &Source, AllocInfo &Target,
- MachineBasicBlock &B, const Type *Ty) {
- static IntrinsicLowering *IL = new DefaultIntrinsicLowering ();
- SparcTargetMachine TM (IL);
- const TargetRegInfo &TRI = TM.getRegInfo ();
+void UnpackTraceFunction::insertCopyMachineInstrs (AllocInfo &Source,
+ AllocInfo &Target,
+ MachineBasicBlock &B,
+ const Type *Ty) {
+ const TargetRegInfo &TRI = TM->getRegInfo ();
std::vector<MachineInstr *> mvec;
int RegType;
// Guess what kind of reg the register was allocated to.
@@ -93,7 +99,7 @@
/// Emit a branch from the end of B to TargetAddr. Note that the current
/// implementation is SPARC-specific.
///
-void insertBranchMachineInstrs (uint64_t Target, MachineBasicBlock &B) {
+static void insertBranchMachineInstrs (uint64_t Target, MachineBasicBlock &B) {
// If the target is close enough to fit into the 19-bit disp of a "ba"
// instruction, then we really DO get a "ba" instruction. We get the backend
// to calculate the PC-relative address from the absolute address upon
@@ -134,8 +140,8 @@
extern PhyRegAlloc::SavedStateMapTy ExportedFnAllocState;
-unsigned getSavedStateIndexOfInstruction (const Function *F,
- const Instruction *I) {
+static unsigned getSavedStateIndexOfInstruction (const Function *F,
+ const Instruction *I) {
unsigned Key = 0;
for (const_inst_iterator II=inst_begin (F), IE=inst_end (F); II!=IE; ++II) {
if (*II == I) return Key;
@@ -149,8 +155,8 @@
abort ();
}
-unsigned getSavedStateIndexOfOperandInInstruction (Function *F, Value *V,
- unsigned VI) {
+static unsigned getSavedStateIndexOfOperandInInstruction (Function *F, Value *V,
+ unsigned VI) {
// FIXME; not yet implemented
abort ();
}
@@ -160,7 +166,7 @@
/// variable _llvm_regAllocState written out by PhyRegAlloc.cpp during a
/// previous invocation of llc.
///
-AllocInfo getValueAllocStateFromModule (Function *F, Value *V) {
+static AllocInfo getValueAllocStateFromModule (Function *F, Value *V) {
// Figure out the indices (FI, VI, VO) that can be used to look up V, which
// is an operand of some instruction in F, in _llvm_regAllocState:
Instruction *Instr = cast<Instruction> (V);
@@ -190,7 +196,7 @@
/// machine code for the function F, which it finds by searching the global
/// variable ExportedFnAllocState exported by PhyRegAlloc.cpp.
///
-AllocInfo getValueAllocStateFromGlobal (Function *F, Value *V) {
+static AllocInfo getValueAllocStateFromGlobal (Function *F, Value *V) {
Instruction *Instr = cast<Instruction> (V);
// Get the saved PhyRegAlloc state for F out of ExportedFnAllocState:
std::vector<AllocInfo> &FState = ExportedFnAllocState[F];
@@ -217,7 +223,7 @@
/// one, or null otherwise. Note that the current implementation is
/// SPARC-specific.
///
-const MachineInstr *containsReturnInstruction (MachineBasicBlock &B) {
+static const MachineInstr *containsReturnInstruction (MachineBasicBlock &B) {
for (MachineBasicBlock::const_reverse_iterator i = B.rbegin (),
e = B.rend (); i != e; ++i) {
const MachineInstr *MI = *i;
More information about the llvm-commits
mailing list