[llvm-commits] CVS: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
Brian Gaeke
gaeke at cs.uiuc.edu
Wed Jul 28 11:00:53 PDT 2004
Changes in directory reopt/lib/LightWtProfiling:
UnpackTraceFunction.cpp updated: 1.104 -> 1.105
---
Log message:
Tighten up the sequence that saves registers when we see a call instr.
Don't save g registers around calls.
---
Diffs of the changes: (+22 -64)
Index: reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp
diff -u reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.104 reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.105
--- reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp:1.104 Tue Jul 27 13:35:05 2004
+++ reopt/lib/LightWtProfiling/UnpackTraceFunction.cpp Wed Jul 28 13:00:42 2004
@@ -78,69 +78,14 @@
///
void UnpackTraceFunction::findRegsToSave (MachineFunction &MF) {
const SparcV9RegInfo &TRI = *TM->getRegInfo ();
- bool intCCRegSeen = false, floatCCRegSeen = false;
+ bool intCCRegSeen = false, floatCCRegSeen = false, callSeen = false;
RegsToSave.clear ();
for (MachineFunction::iterator fi = MF.begin (), fe = MF.end ();
fi != fe; ++fi)
for (MachineBasicBlock::iterator bi = fi->begin (), be = fi->end ();
bi != be; ++bi) {
- if (bi->getOpcode () == V9::CALL) {
- RegsToSave.insert (SparcV9::o0);
- RegsToSave.insert (SparcV9::o1);
- RegsToSave.insert (SparcV9::o2);
- RegsToSave.insert (SparcV9::o3);
- RegsToSave.insert (SparcV9::o4);
- RegsToSave.insert (SparcV9::o5);
- RegsToSave.insert (SparcV9::o7);
- RegsToSave.insert (SparcV9::f0);
- RegsToSave.insert (SparcV9::f1);
- RegsToSave.insert (SparcV9::f2);
- RegsToSave.insert (SparcV9::f3);
- RegsToSave.insert (SparcV9::f4);
- RegsToSave.insert (SparcV9::f5);
- RegsToSave.insert (SparcV9::f6);
- RegsToSave.insert (SparcV9::f7);
- RegsToSave.insert (SparcV9::f8);
- RegsToSave.insert (SparcV9::f9);
- RegsToSave.insert (SparcV9::f10);
- RegsToSave.insert (SparcV9::f11);
- RegsToSave.insert (SparcV9::f12);
- RegsToSave.insert (SparcV9::f13);
- RegsToSave.insert (SparcV9::f14);
- RegsToSave.insert (SparcV9::f15);
- RegsToSave.insert (SparcV9::f16);
- RegsToSave.insert (SparcV9::f17);
- RegsToSave.insert (SparcV9::f18);
- RegsToSave.insert (SparcV9::f19);
- RegsToSave.insert (SparcV9::f20);
- RegsToSave.insert (SparcV9::f21);
- RegsToSave.insert (SparcV9::f22);
- RegsToSave.insert (SparcV9::f23);
- RegsToSave.insert (SparcV9::f24);
- RegsToSave.insert (SparcV9::f25);
- RegsToSave.insert (SparcV9::f26);
- RegsToSave.insert (SparcV9::f27);
- RegsToSave.insert (SparcV9::f28);
- RegsToSave.insert (SparcV9::f29);
- RegsToSave.insert (SparcV9::f30);
- RegsToSave.insert (SparcV9::f31);
- RegsToSave.insert (SparcV9::f32);
- RegsToSave.insert (SparcV9::f34);
- RegsToSave.insert (SparcV9::f36);
- RegsToSave.insert (SparcV9::f38);
- RegsToSave.insert (SparcV9::f40);
- RegsToSave.insert (SparcV9::f42);
- RegsToSave.insert (SparcV9::f44);
- RegsToSave.insert (SparcV9::f46);
- RegsToSave.insert (SparcV9::f48);
- RegsToSave.insert (SparcV9::f50);
- RegsToSave.insert (SparcV9::f52);
- RegsToSave.insert (SparcV9::f54);
- RegsToSave.insert (SparcV9::f56);
- RegsToSave.insert (SparcV9::f58);
- RegsToSave.insert (SparcV9::f60);
- RegsToSave.insert (SparcV9::f62);
- }
+ if (bi->getOpcode () == V9::CALL)
+ callSeen = true;
for (unsigned oi = 0, oe = bi->getNumOperands (); oi != oe; ++oi) {
const MachineOperand &MO = bi->getOperand (oi);
if (MO.isDef ()) {
@@ -157,6 +102,25 @@
}
}
}
+
+ if (callSeen) {
+ static const unsigned CallerSavedRegs[] = { SparcV9::o0, SparcV9::o1,
+ SparcV9::o2, SparcV9::o3, SparcV9::o4, SparcV9::o5, SparcV9::o7,
+ SparcV9::g2, SparcV9::g3, SparcV9::g4, SparcV9::g5,
+ SparcV9::f0, SparcV9::f1, SparcV9::f2, SparcV9::f3, SparcV9::f4,
+ SparcV9::f5, SparcV9::f6, SparcV9::f7, SparcV9::f8, SparcV9::f9,
+ SparcV9::f10, SparcV9::f11, SparcV9::f12, SparcV9::f13, SparcV9::f14,
+ SparcV9::f15, SparcV9::f16, SparcV9::f17, SparcV9::f18, SparcV9::f19,
+ SparcV9::f20, SparcV9::f21, SparcV9::f22, SparcV9::f23, SparcV9::f24,
+ SparcV9::f25, SparcV9::f26, SparcV9::f27, SparcV9::f28, SparcV9::f29,
+ SparcV9::f30, SparcV9::f31, SparcV9::f32, SparcV9::f34, SparcV9::f36,
+ SparcV9::f38, SparcV9::f40, SparcV9::f42, SparcV9::f44, SparcV9::f46,
+ SparcV9::f48, SparcV9::f50, SparcV9::f52, SparcV9::f54, SparcV9::f56,
+ SparcV9::f58, SparcV9::f60, SparcV9::f62 };
+ RegsToSave.insert (CallerSavedRegs, CallerSavedRegs +
+ sizeof (CallerSavedRegs) / sizeof (CallerSavedRegs[0]));
+ }
+
RegsToSave.insert (MatrixFP);
// Deal with some sparc lunacy: If any of the floatcc regs are used, then we
@@ -671,9 +635,6 @@
mvec.push_back (BuildMI (V9::ORr, 3).addMReg (TraceFP).addZImm (0)
.addMReg (MatrixFP, MachineOperand::Def));
unsigned R;
- R = SparcV9::g2; TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (R), TRI.getRegType (R), g2);
- R = SparcV9::g3; TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (R), TRI.getRegType (R), g2);
- R = SparcV9::g4; TRI.cpReg2MemMI (mvec, R, sp, stackOffsetForReg (R), TRI.getRegType (R), g2);
// Insert all the instrs into the MBB after the call instruction.
for (std::vector<MachineInstr *>::iterator ei = mvec.begin (),
ee = mvec.end (); ei != ee; ++ei) {
@@ -688,9 +649,6 @@
TRI.getRegType (MatrixFP), g2);
TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (TraceFP), TraceFP,
TRI.getRegType (TraceFP), g2);
- R = SparcV9::g2; TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (R), R, TRI.getRegType (R), g2);
- R = SparcV9::g3; TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (R), R, TRI.getRegType (R), g2);
- R = SparcV9::g4; TRI.cpMem2RegMI (mvec, sp, stackOffsetForReg (R), R, TRI.getRegType (R), g2);
// Insert all the instrs into the MBB after the call instruction.
for (std::vector<MachineInstr *>::iterator ei = mvec.begin (),
ee = mvec.end (); ei != ee; ++ei) {
More information about the llvm-commits
mailing list