mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
Refactor some code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44010 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -32,6 +32,7 @@ namespace llvm {
|
||||
|
||||
class LiveVariables;
|
||||
class MRegisterInfo;
|
||||
class SSARegMap;
|
||||
class TargetInstrInfo;
|
||||
class TargetRegisterClass;
|
||||
class VirtRegMap;
|
||||
@@ -102,6 +103,10 @@ namespace llvm {
|
||||
return getBaseIndex(index) + InstrSlots::STORE;
|
||||
}
|
||||
|
||||
static float getSpillWeight(const MachineOperand &mop, unsigned loopDepth) {
|
||||
return (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);
|
||||
}
|
||||
|
||||
typedef Reg2IntervalMap::iterator iterator;
|
||||
typedef Reg2IntervalMap::const_iterator const_iterator;
|
||||
const_iterator begin() const { return r2iMap_.begin(); }
|
||||
@@ -182,9 +187,6 @@ namespace llvm {
|
||||
return I->second;
|
||||
}
|
||||
|
||||
std::vector<LiveInterval*> addIntervalsForSpills(const LiveInterval& i,
|
||||
VirtRegMap& vrm, unsigned reg);
|
||||
|
||||
// Interval removal
|
||||
|
||||
void removeInterval(unsigned Reg) {
|
||||
@@ -223,6 +225,11 @@ namespace llvm {
|
||||
if (O) print(*O, M);
|
||||
}
|
||||
|
||||
/// addIntervalsForSpills - Create new intervals for spilled defs / uses of
|
||||
/// the given interval.
|
||||
std::vector<LiveInterval*>
|
||||
addIntervalsForSpills(const LiveInterval& i, VirtRegMap& vrm);
|
||||
|
||||
private:
|
||||
/// computeIntervals - Compute live intervals.
|
||||
void computeIntervals();
|
||||
@@ -267,6 +274,23 @@ namespace llvm {
|
||||
MachineInstr *DefMI, unsigned index, unsigned i,
|
||||
bool isSS, int slot, unsigned reg);
|
||||
|
||||
/// rewriteInstructionForSpills, rewriteInstructionsForSpills - Helper functions
|
||||
/// for addIntervalsForSpills to rewrite uses / defs for the given live range.
|
||||
void rewriteInstructionForSpills(const LiveInterval &li,
|
||||
unsigned id, unsigned index, unsigned end, MachineInstr *MI,
|
||||
MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot,
|
||||
bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete,
|
||||
VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc,
|
||||
SmallVector<int, 4> &ReMatIds,
|
||||
std::vector<LiveInterval*> &NewLIs);
|
||||
void rewriteInstructionsForSpills(const LiveInterval &li,
|
||||
LiveInterval::Ranges::const_iterator &I,
|
||||
MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot,
|
||||
bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete,
|
||||
VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc,
|
||||
SmallVector<int, 4> &ReMatIds,
|
||||
std::vector<LiveInterval*> &NewLIs);
|
||||
|
||||
static LiveInterval createInterval(unsigned Reg);
|
||||
|
||||
void printRegName(unsigned reg) const;
|
||||
|
Reference in New Issue
Block a user