Mercurial > hg > CbC > CbC_llvm
diff lib/CodeGen/LiveRangeCalc.h @ 121:803732b1fca8
LLVM 5.0
author | kono |
---|---|
date | Fri, 27 Oct 2017 17:07:41 +0900 |
parents | 1172e4bd9c6f |
children | c2174574ed3a |
line wrap: on
line diff
--- a/lib/CodeGen/LiveRangeCalc.h Fri Nov 25 19:14:25 2016 +0900 +++ b/lib/CodeGen/LiveRangeCalc.h Fri Oct 27 17:07:41 2017 +0900 @@ -1,4 +1,4 @@ -//===---- LiveRangeCalc.h - Calculate live ranges ---------------*- C++ -*-===// +//===- LiveRangeCalc.h - Calculate live ranges ------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -24,29 +24,37 @@ #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/IndexedMap.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/CodeGen/LiveInterval.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/CodeGen/SlotIndexes.h" +#include "llvm/MC/LaneBitmask.h" +#include <utility> namespace llvm { -/// Forward declarations for MachineDominators.h: +template <class NodeT> class DomTreeNodeBase; class MachineDominatorTree; -template <class NodeT> class DomTreeNodeBase; -typedef DomTreeNodeBase<MachineBasicBlock> MachineDomTreeNode; +class MachineFunction; +class MachineRegisterInfo; + +using MachineDomTreeNode = DomTreeNodeBase<MachineBasicBlock>; class LiveRangeCalc { - const MachineFunction *MF; - const MachineRegisterInfo *MRI; - SlotIndexes *Indexes; - MachineDominatorTree *DomTree; - VNInfo::Allocator *Alloc; + const MachineFunction *MF = nullptr; + const MachineRegisterInfo *MRI = nullptr; + SlotIndexes *Indexes = nullptr; + MachineDominatorTree *DomTree = nullptr; + VNInfo::Allocator *Alloc = nullptr; /// LiveOutPair - A value and the block that defined it. The domtree node is /// redundant, it can be computed as: MDT[Indexes.getMBBFromIndex(VNI->def)]. - typedef std::pair<VNInfo*, MachineDomTreeNode*> LiveOutPair; + using LiveOutPair = std::pair<VNInfo *, MachineDomTreeNode *>; /// LiveOutMap - Map basic blocks to the value leaving the block. - typedef IndexedMap<LiveOutPair, MBB2NumberFunctor> LiveOutMap; + using LiveOutMap = IndexedMap<LiveOutPair, MBB2NumberFunctor>; /// Bit vector of active entries in LiveOut, also used as a visited set by /// findReachingDefs. One entry per basic block, indexed by block number. @@ -65,7 +73,8 @@ /// registers do not overlap), but the defined/undefined information must /// be kept separate for each individual range. /// By convention, EntryInfoMap[&LR] = { Defined, Undefined }. - std::map<LiveRange*,std::pair<BitVector,BitVector>> EntryInfoMap; + using EntryInfoMap = DenseMap<LiveRange *, std::pair<BitVector, BitVector>>; + EntryInfoMap EntryInfos; /// Map each basic block where a live range is live out to the live-out value /// and its defining block. @@ -103,10 +112,10 @@ SlotIndex Kill; // Live-in value filled in by updateSSA once it is known. - VNInfo *Value; + VNInfo *Value = nullptr; LiveInBlock(LiveRange &LR, MachineDomTreeNode *node, SlotIndex kill) - : LR(LR), DomNode(node), Kill(kill), Value(nullptr) {} + : LR(LR), DomNode(node), Kill(kill) {} }; /// LiveIn - Work list of blocks where the live-in value has yet to be @@ -160,7 +169,8 @@ /// all uses must be jointly dominated by the definitions from @p LR /// together with definitions of other lanes where @p LR becomes undefined /// (via <def,read-undef> operands). - /// If @p LR is a main range, the @p LaneMask should be set to ~0. + /// If @p LR is a main range, the @p LaneMask should be set to ~0, i.e. + /// LaneBitmask::getAll(). void extendToUses(LiveRange &LR, unsigned Reg, LaneBitmask LaneMask, LiveInterval *LI = nullptr); @@ -168,8 +178,7 @@ void resetLiveOutMap(); public: - LiveRangeCalc() : MF(nullptr), MRI(nullptr), Indexes(nullptr), - DomTree(nullptr), Alloc(nullptr) {} + LiveRangeCalc() = default; //===--------------------------------------------------------------------===// // High-level interface. @@ -183,10 +192,8 @@ /// that may overlap a previously computed live range, and before the first /// live range in a function. If live ranges are not known to be /// non-overlapping, call reset before each. - void reset(const MachineFunction *MF, - SlotIndexes*, - MachineDominatorTree*, - VNInfo::Allocator*); + void reset(const MachineFunction *mf, SlotIndexes *SI, + MachineDominatorTree *MDT, VNInfo::Allocator *VNIA); //===--------------------------------------------------------------------===// // Mid-level interface. @@ -215,7 +222,7 @@ /// All uses must be jointly dominated by existing liveness. PHI-defs are /// inserted as needed to preserve SSA form. void extendToUses(LiveRange &LR, unsigned PhysReg) { - extendToUses(LR, PhysReg, ~0u); + extendToUses(LR, PhysReg, LaneBitmask::getAll()); } /// Calculates liveness for the register specified in live interval @p LI. @@ -279,4 +286,4 @@ } // end namespace llvm -#endif +#endif // LLVM_LIB_CODEGEN_LIVERANGECALC_H