aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/CodeGen')
-rw-r--r--include/llvm/CodeGen/LiveInterval.h4
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h37
2 files changed, 31 insertions, 10 deletions
diff --git a/include/llvm/CodeGen/LiveInterval.h b/include/llvm/CodeGen/LiveInterval.h
index 5d9db57..068a15d 100644
--- a/include/llvm/CodeGen/LiveInterval.h
+++ b/include/llvm/CodeGen/LiveInterval.h
@@ -83,7 +83,6 @@ namespace llvm {
unsigned reg; // the register of this interval
unsigned preference; // preferred register to allocate for this interval
float weight; // weight of this interval
- MachineInstr* remat; // definition if the definition rematerializable
Ranges ranges; // the ranges in which this register is live
/// ValueNumberInfo - If the value number definition is undefined (e.g. phi
@@ -101,7 +100,7 @@ namespace llvm {
public:
LiveInterval(unsigned Reg, float Weight)
- : reg(Reg), preference(0), weight(Weight), remat(NULL) {
+ : reg(Reg), preference(0), weight(Weight) {
}
typedef Ranges::iterator iterator;
@@ -128,7 +127,6 @@ namespace llvm {
void swap(LiveInterval& other) {
std::swap(reg, other.reg);
std::swap(weight, other.weight);
- std::swap(remat, other.remat);
std::swap(ranges, other.ranges);
std::swap(ValueNumberInfo, other.ValueNumberInfo);
}
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index 4783df4..8e7a100 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -25,6 +25,8 @@
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/IndexedMap.h"
+#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
namespace llvm {
@@ -41,9 +43,9 @@ namespace llvm {
const TargetInstrInfo* tii_;
LiveVariables* lv_;
- /// MBB2IdxMap - The index of the first instruction in the specified basic
- /// block.
- std::vector<unsigned> MBB2IdxMap;
+ /// MBB2IdxMap - The indexes of the first and last instructions in the
+ /// specified basic block.
+ std::vector<std::pair<unsigned, unsigned> > MBB2IdxMap;
typedef std::map<MachineInstr*, unsigned> Mi2IndexMap;
Mi2IndexMap mi2iMap_;
@@ -56,6 +58,8 @@ namespace llvm {
BitVector allocatableRegs_;
+ std::vector<MachineInstr*> ClonedMIs;
+
public:
static char ID; // Pass identification, replacement for typeid
LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {}
@@ -118,10 +122,19 @@ namespace llvm {
unsigned getMBBStartIdx(MachineBasicBlock *MBB) const {
return getMBBStartIdx(MBB->getNumber());
}
-
unsigned getMBBStartIdx(unsigned MBBNo) const {
assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!");
- return MBB2IdxMap[MBBNo];
+ return MBB2IdxMap[MBBNo].first;
+ }
+
+ /// getMBBEndIdx - Return the store index of the last instruction in the
+ /// specified MachineBasicBlock.
+ unsigned getMBBEndIdx(MachineBasicBlock *MBB) const {
+ return getMBBEndIdx(MBB->getNumber());
+ }
+ unsigned getMBBEndIdx(unsigned MBBNo) const {
+ assert(MBBNo < MBB2IdxMap.size() && "Invalid MBB number!");
+ return MBB2IdxMap[MBBNo].second;
}
/// getInstructionIndex - returns the base index of instr
@@ -155,8 +168,7 @@ namespace llvm {
const std::vector<LiveRange> &LRs);
std::vector<LiveInterval*> addIntervalsForSpills(const LiveInterval& i,
- VirtRegMap& vrm,
- int slot);
+ VirtRegMap& vrm, unsigned reg);
// Interval removal
@@ -225,6 +237,17 @@ namespace llvm {
unsigned MIIdx,
LiveInterval &interval, bool isAlias = false);
+ /// isReMaterializable - Returns true if the definition MI of the specified
+ /// val# of the specified interval is re-materializable.
+ bool isReMaterializable(const LiveInterval &li, unsigned ValNum,
+ MachineInstr *MI);
+
+ /// tryFoldMemoryOperand - Attempts to fold a spill / restore from slot
+ /// to reg into ith operand of specified MI. If it is successul, MI is
+ /// updated with the newly created MI and returns true.
+ bool tryFoldMemoryOperand(MachineInstr* &MI, VirtRegMap &vrm, unsigned index,
+ unsigned i, int slot, unsigned reg);
+
static LiveInterval createInterval(unsigned Reg);
void printRegName(unsigned reg) const;