diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-05-28 02:33:00 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2011-05-28 02:33:00 +0000 |
commit | c9cf9e94ec4daca659e2eb4e30d3f7d7f9b6b067 (patch) | |
tree | 354788c07acff3504cfe0bd1415e7f5f4742c124 /lib/CodeGen/SplitKit.h | |
parent | b2abfa0bf30edf292a27a06e091d03983e644c9b (diff) | |
download | llvm-c9cf9e94ec4daca659e2eb4e30d3f7d7f9b6b067.tar.gz llvm-c9cf9e94ec4daca659e2eb4e30d3f7d7f9b6b067.tar.bz2 llvm-c9cf9e94ec4daca659e2eb4e30d3f7d7f9b6b067.tar.xz |
Create two BlockInfo entries when a live range is discontinuous through a block.
Delete the Kill and Def markers in BlockInfo. They are no longer
necessary when BlockInfo describes a continuous live range.
This only affects the relatively rare kind of basic block where a live
range looks like this:
|---x o---|
Now live range splitting can pretend that it is looking at two blocks:
|---x
o---|
This allows the code to be simplified a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132245 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SplitKit.h')
-rw-r--r-- | lib/CodeGen/SplitKit.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/CodeGen/SplitKit.h b/lib/CodeGen/SplitKit.h index dc27486e73..7174c0b55f 100644 --- a/lib/CodeGen/SplitKit.h +++ b/lib/CodeGen/SplitKit.h @@ -63,17 +63,22 @@ public: /// 1. | o---x | Internal to block. Variable is only live in this block. /// 2. |---x | Live-in, kill. /// 3. | o---| Def, live-out. - /// 4. |---x o---| Live-in, kill, def, live-out. + /// 4. |---x o---| Live-in, kill, def, live-out. Counted by NumGapBlocks. /// 5. |---o---o---| Live-through with uses or defs. - /// 6. |-----------| Live-through without uses. Transparent. + /// 6. |-----------| Live-through without uses. Counted by NumThroughBlocks. + /// + /// Two BlockInfo entries are created for template 4. One for the live-in + /// segment, and one for the live-out segment. These entries look as if the + /// block were split in the middle where the live range isn't live. + /// + /// Live-through blocks without any uses don't get BlockInfo entries. They + /// are simply listed in ThroughBlocks instead. /// struct BlockInfo { MachineBasicBlock *MBB; SlotIndex FirstUse; ///< First instr using current reg. SlotIndex LastUse; ///< Last instr using current reg. - SlotIndex Kill; ///< Interval end point inside block. - SlotIndex Def; ///< Interval start point inside block. - bool LiveThrough; ///< Live in whole block (Templ 5. or 6. above). + bool LiveThrough; ///< Live in whole block (Templ 5. above). bool LiveIn; ///< Current reg is live in. bool LiveOut; ///< Current reg is live out. }; @@ -91,6 +96,10 @@ private: /// UseBlocks - Blocks where CurLI has uses. SmallVector<BlockInfo, 8> UseBlocks; + /// NumGapBlocks - Number of duplicate entries in UseBlocks for blocks where + /// the live range has a gap. + unsigned NumGapBlocks; + /// ThroughBlocks - Block numbers where CurLI is live through without uses. BitVector ThroughBlocks; @@ -160,7 +169,7 @@ public: /// getNumLiveBlocks - Return the number of blocks where CurLI is live. unsigned getNumLiveBlocks() const { - return getUseBlocks().size() + getNumThroughBlocks(); + return getUseBlocks().size() - NumGapBlocks + getNumThroughBlocks(); } /// countLiveBlocks - Return the number of blocks where li is live. This is |