X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FSplitKit.h;h=e371a4dd176e88e5c312bf722d68378eac872b73;hb=c249e4855883d7b799db61edc839cbfaff50ae81;hp=05de1505236ca8976540967cc8350d392db0a812;hpb=4670353a21fbc6e8159a129cda965f256e73a451;p=oota-llvm.git diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h index 05de1505236..e371a4dd176 100644 --- a/lib/CodeGen/SplitKit.h +++ b/lib/CodeGen/SplitKit.h @@ -12,7 +12,9 @@ // //===----------------------------------------------------------------------===// +#include "llvm/ADT/BitVector.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/IndexedMap.h" #include "llvm/ADT/IntervalMap.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/SlotIndexes.h" @@ -71,6 +73,8 @@ public: /// struct BlockInfo { MachineBasicBlock *MBB; + SlotIndex Start; ///< Beginining of block. + SlotIndex Stop; ///< End of block. SlotIndex FirstUse; ///< First instr using current reg. SlotIndex LastUse; ///< Last instr using current reg. SlotIndex Kill; ///< Interval end point inside block. @@ -99,7 +103,7 @@ private: void analyzeUses(); /// calcLiveBlockInfo - Compute per-block information about CurLI. - void calcLiveBlockInfo(); + bool calcLiveBlockInfo(); /// canAnalyzeBranch - Return true if MBB ends in a branch that can be /// analyzed. @@ -165,7 +169,7 @@ class SplitEditor { const TargetRegisterInfo &TRI; /// Edit - The current parent register and new intervals created. - LiveRangeEdit &Edit; + LiveRangeEdit *Edit; /// Index into Edit of the currently open interval. /// The index 0 is used for the complement, so the first interval started by @@ -196,7 +200,7 @@ class SplitEditor { ValueMap Values; typedef std::pair LiveOutPair; - typedef DenseMap LiveOutMap; + typedef IndexedMap LiveOutMap; // LiveOutCache - Map each basic block where a new register is live out to the // live-out value and its defining block. @@ -215,6 +219,10 @@ class SplitEditor { // by all the new registers because at most one is live out of each block. LiveOutMap LiveOutCache; + // LiveOutSeen - Indexed by MBB->getNumber(), a bit is set for each valid + // entry in LiveOutCache. + BitVector LiveOutSeen; + /// defValue - define a value in RegIdx from ParentVNI at Idx. /// Idx does not have to be ParentVNI->def, but it must be contained within /// ParentVNI's live range in ParentLI. The new value is added to the value @@ -257,21 +265,17 @@ class SplitEditor { /// rewriteAssigned - Rewrite all uses of Edit.getReg() to assigned registers. void rewriteAssigned(bool ExtendRanges); - /// rewriteComponents - Rewrite all uses of Intv[0] according to the eq - /// classes in ConEQ. - /// This must be done when Intvs[0] is styill live at all uses, before calling - /// ConEq.Distribute(). - void rewriteComponents(const SmallVectorImpl &Intvs, - const ConnectedVNInfoEqClasses &ConEq); + /// deleteRematVictims - Delete defs that are dead after rematerializing. + void deleteRematVictims(); public: /// Create a new SplitEditor for editing the LiveInterval analyzed by SA. /// Newly created intervals will be appended to newIntervals. SplitEditor(SplitAnalysis &SA, LiveIntervals&, VirtRegMap&, - MachineDominatorTree&, LiveRangeEdit&); + MachineDominatorTree&); - /// getAnalysis - Get the corresponding analysis. - SplitAnalysis &getAnalysis() { return SA; } + /// reset - Prepare for a new split. + void reset(LiveRangeEdit&); /// Create a new virtual register and live interval. void openIntv();