diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-01 23:14:53 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-03-01 23:14:53 +0000 |
commit | 670ccd18ae1ecec3b3c92885d5b64b21859001c4 (patch) | |
tree | 0008dadd9bf57ba9a590ab3ce4fe71b04463de9d /lib/CodeGen/SplitKit.h | |
parent | 3afab9c57e1afb0b7a4a9fe25a74117461bc0e69 (diff) | |
download | llvm-670ccd18ae1ecec3b3c92885d5b64b21859001c4.tar.gz llvm-670ccd18ae1ecec3b3c92885d5b64b21859001c4.tar.bz2 llvm-670ccd18ae1ecec3b3c92885d5b64b21859001c4.tar.xz |
Move the value map from LiveIntervalMap to SplitEditor.
The value map is currently not used, all values are 'complex mapped' and
LiveIntervalMap::mapValue is used to dig them out.
This is the first step in a series changes leading to the removal of
LiveIntervalMap. Its data structures can be shared among all the live intervals
created by a split, so it is wasteful to create a copy for each.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126800 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SplitKit.h')
-rw-r--r-- | lib/CodeGen/SplitKit.h | 51 |
1 files changed, 23 insertions, 28 deletions
diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h index a57aa1a01f..ae69aecc37 100644 --- a/lib/CodeGen/SplitKit.h +++ b/lib/CodeGen/SplitKit.h @@ -162,14 +162,6 @@ class LiveIntervalMap { // The child interval's values are fully contained inside ParentLI values. LiveInterval *LI; - typedef DenseMap<const VNInfo*, VNInfo*> ValueMap; - - // Map ParentLI values to simple values in LI that are defined at the same - // SlotIndex, or NULL for ParentLI values that have complex LI defs. - // Note there is a difference between values mapping to NULL (complex), and - // values not present (unknown/unmapped). - ValueMap Values; - typedef std::pair<VNInfo*, MachineDomTreeNode*> LiveOutPair; typedef DenseMap<MachineBasicBlock*,LiveOutPair> LiveOutMap; @@ -203,12 +195,6 @@ public: /// getLI - return the current live interval. LiveInterval *getLI() const { return LI; } - /// defValue - define a value in LI from the ParentLI value VNI and Idx. - /// Idx does not have to be ParentVNI->def, but it must be contained within - /// ParentVNI's live range in ParentLI. - /// Return the new LI value. - VNInfo *defValue(const VNInfo *ParentVNI, SlotIndex Idx); - /// mapValue - map ParentVNI to the corresponding LI value at Idx. It is /// assumed that ParentVNI is live at Idx. /// If ParentVNI has not been defined by defValue, it is assumed that @@ -225,20 +211,6 @@ public: // Idx. Return the found VNInfo, or NULL. VNInfo *extendTo(const MachineBasicBlock *MBB, SlotIndex Idx); - /// isMapped - Return true is ParentVNI is a known mapped value. It may be a - /// simple 1-1 mapping or a complex mapping to later defs. - bool isMapped(const VNInfo *ParentVNI) const { - return Values.count(ParentVNI); - } - - /// isComplexMapped - Return true if ParentVNI has received new definitions - /// with defValue. - bool isComplexMapped(const VNInfo *ParentVNI) const; - - /// markComplexMapped - Mark ParentVNI as complex mapped regardless of the - /// number of definitions. - void markComplexMapped(const VNInfo *ParentVNI) { Values[ParentVNI] = 0; } - // addSimpleRange - Add a simple range from ParentLI to LI. // ParentVNI must be live in the [Start;End) interval. void addSimpleRange(SlotIndex Start, SlotIndex End, const VNInfo *ParentVNI); @@ -292,6 +264,29 @@ class SplitEditor { /// LIMappers - One LiveIntervalMap or each interval in Edit. SmallVector<LiveIntervalMap, 4> LIMappers; + typedef DenseMap<std::pair<unsigned, unsigned>, VNInfo*> ValueMap; + + /// Values - keep track of the mapping from parent values to values in the new + /// intervals. Given a pair (RegIdx, ParentVNI->id), Values contains: + /// + /// 1. No entry - the value is not mapped to Edit.get(RegIdx). + /// 2. Null - the value is mapped to multiple values in Edit.get(RegIdx). + /// Each value is represented by a minimal live range at its def. + /// 3. A non-null VNInfo - the value is mapped to a single new value. + /// The new value has no live ranges anywhere. + ValueMap Values; + + /// 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 + /// map. + /// Return the new LI value. + VNInfo *defValue(unsigned RegIdx, const VNInfo *ParentVNI, SlotIndex Idx); + + /// markComplexMapped - Mark ParentVNI as complex mapped in RegIdx regardless + /// of the number of defs. + void markComplexMapped(unsigned RegIdx, const VNInfo *ParentVNI); + /// defFromParent - Define Reg from ParentVNI at UseIdx using either /// rematerialization or a COPY from parent. Return the new value. VNInfo *defFromParent(unsigned RegIdx, |