aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2009-06-02 16:53:25 +0000
committerLang Hames <lhames@gmail.com>2009-06-02 16:53:25 +0000
commitf41538d1b54f55e8900394929b50f7ce3e61125f (patch)
treec0c221c0825be930b71daca46db85593a9186a5b /include/llvm/CodeGen
parent874ae251c317788391f9c3f113957802d390a063 (diff)
Update to in-place spilling framework. Includes live interval scaling and trivial rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72729 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/LiveInterval.h24
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h23
-rw-r--r--include/llvm/CodeGen/LiveStackAnalysis.h2
3 files changed, 39 insertions, 10 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index d6f5c8484e..f1ae587ac1 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -113,6 +113,26 @@ namespace llvm {
VNInfoList valnos; // value#'s
public:
+
+ struct InstrSlots {
+ enum {
+ LOAD = 0,
+ USE = 1,
+ DEF = 2,
+ STORE = 3,
+ NUM = 4
+ };
+
+ static unsigned scale(unsigned slot, unsigned factor) {
+ unsigned index = slot / NUM,
+ offset = slot % NUM;
+ assert(index <= ~0U / (factor * NUM) &&
+ "Rescaled interval would overflow");
+ return index * NUM * factor + offset;
+ }
+
+ };
+
LiveInterval(unsigned Reg, float Weight, bool IsSS = false)
: reg(Reg), weight(Weight), preference(0) {
if (IsSS)
@@ -414,6 +434,10 @@ namespace llvm {
/// Also remove the value# from value# list.
void removeValNo(VNInfo *ValNo);
+ /// scaleNumbering - Renumber VNI and ranges to provide gaps for new
+ /// instructions.
+ void scaleNumbering(unsigned factor);
+
/// getSize - Returns the sum of sizes of all the LiveRange's.
///
unsigned getSize() const;
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 01ea6092e8..7c44cc7dbf 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -92,20 +92,12 @@ namespace llvm {
std::vector<MachineInstr*> ClonedMIs;
+ typedef LiveInterval::InstrSlots InstrSlots;
+
public:
static char ID; // Pass identification, replacement for typeid
LiveIntervals() : MachineFunctionPass(&ID) {}
- struct InstrSlots {
- enum {
- LOAD = 0,
- USE = 1,
- DEF = 2,
- STORE = 3,
- NUM = 4
- };
- };
-
static unsigned getBaseIndex(unsigned index) {
return index - (index % InstrSlots::NUM);
}
@@ -226,6 +218,13 @@ namespace llvm {
return getInstructionFromIndex(Index) == 0;
}
+ /// hasGapAfterInstr - Return true if the successive instruction slot,
+ /// i.e. Index + InstrSlots::Num, is not occupied.
+ bool hasGapAfterInstr(unsigned Index) {
+ Index = getBaseIndex(Index + InstrSlots::NUM);
+ return getInstructionFromIndex(Index) == 0;
+ }
+
/// findGapBeforeInstr - Find an empty instruction slot before the
/// specified index. If "Furthest" is true, find one that's furthest
/// away from the index (but before any index that's occupied).
@@ -394,6 +393,10 @@ namespace llvm {
/// computeNumbering - Compute the index numbering.
void computeNumbering();
+ /// scaleNumbering - Rescale interval numbers to introduce gaps for new
+ /// instructions
+ void scaleNumbering(int factor);
+
/// intervalIsInOneMBB - Returns true if the specified interval is entirely
/// within a single basic block.
bool intervalIsInOneMBB(const LiveInterval &li) const;
diff --git a/include/llvm/CodeGen/LiveStackAnalysis.h b/include/llvm/CodeGen/LiveStackAnalysis.h
index a2a2f93df3..27ae1be7f9 100644
--- a/include/llvm/CodeGen/LiveStackAnalysis.h
+++ b/include/llvm/CodeGen/LiveStackAnalysis.h
@@ -48,6 +48,8 @@ namespace llvm {
iterator begin() { return S2IMap.begin(); }
iterator end() { return S2IMap.end(); }
+ void scaleNumbering(int factor);
+
unsigned getNumIntervals() const { return (unsigned)S2IMap.size(); }
LiveInterval &getOrCreateInterval(int Slot, const TargetRegisterClass *RC) {