aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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 d6f5c84..f1ae587 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 01ea609..7c44cc7 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 a2a2f93..27ae1be 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) {