|
1 |
| -//===- LiveRangeCalc.h - Calculate live ranges ------------------*- C++ -*-===// |
| 1 | +//===- LiveRangeCalc.h - Calculate live ranges -----------------*- C++ -*-===// |
2 | 2 | //
|
3 | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
4 | 4 | // See https://llvm.org/LICENSE.txt for license information.
|
5 | 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
6 | 6 | //
|
7 | 7 | //===----------------------------------------------------------------------===//
|
8 | 8 | //
|
9 |
| -// The LiveRangeCalc class can be used to compute live ranges from scratch. It |
10 |
| -// caches information about values in the CFG to speed up repeated operations |
11 |
| -// on the same live range. The cache can be shared by non-overlapping live |
12 |
| -// ranges. SplitKit uses that when computing the live range of split products. |
| 9 | +// The LiveRangeCalc class can be used to implement the computation of |
| 10 | +// live ranges from scratch. |
| 11 | +// It caches information about values in the CFG to speed up repeated |
| 12 | +// operations on the same live range. The cache can be shared by |
| 13 | +// non-overlapping live ranges. SplitKit uses that when computing the live |
| 14 | +// range of split products. |
13 | 15 | //
|
14 | 16 | // A low-level interface is available to clients that know where a variable is
|
15 | 17 | // live, but don't know which value it has as every point. LiveRangeCalc will
|
16 | 18 | // propagate values down the dominator tree, and even insert PHI-defs where
|
17 |
| -// needed. SplitKit uses this faster interface when possible. |
| 19 | +// needed. SplitKit uses this faster interface when possible. |
18 | 20 | //
|
19 | 21 | //===----------------------------------------------------------------------===//
|
20 | 22 |
|
@@ -159,18 +161,14 @@ class LiveRangeCalc {
|
159 | 161 | /// the given @p LiveOuts.
|
160 | 162 | void updateFromLiveIns();
|
161 | 163 |
|
162 |
| - /// Extend the live range of @p LR to reach all uses of Reg. |
163 |
| - /// |
164 |
| - /// If @p LR is a main range, or if @p LI is null, then all uses must be |
165 |
| - /// jointly dominated by the definitions from @p LR. If @p LR is a subrange |
166 |
| - /// of the live interval @p LI, corresponding to lane mask @p LaneMask, |
167 |
| - /// all uses must be jointly dominated by the definitions from @p LR |
168 |
| - /// together with definitions of other lanes where @p LR becomes undefined |
169 |
| - /// (via <def,read-undef> operands). |
170 |
| - /// If @p LR is a main range, the @p LaneMask should be set to ~0, i.e. |
171 |
| - /// LaneBitmask::getAll(). |
172 |
| - void extendToUses(LiveRange &LR, unsigned Reg, LaneBitmask LaneMask, |
173 |
| - LiveInterval *LI = nullptr); |
| 164 | +protected: |
| 165 | + /// Some getters to expose in a read-only way some private fields to |
| 166 | + /// subclasses. |
| 167 | + const MachineFunction *getMachineFunction() { return MF; } |
| 168 | + const MachineRegisterInfo *getRegInfo() const { return MRI; } |
| 169 | + SlotIndexes *getIndexes() { return Indexes; } |
| 170 | + MachineDominatorTree *getDomTree() { return DomTree; } |
| 171 | + VNInfo::Allocator *getVNAlloc() { return Alloc; } |
174 | 172 |
|
175 | 173 | /// Reset Map and Seen fields.
|
176 | 174 | void resetLiveOutMap();
|
@@ -210,29 +208,6 @@ class LiveRangeCalc {
|
210 | 208 | void extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg,
|
211 | 209 | ArrayRef<SlotIndex> Undefs);
|
212 | 210 |
|
213 |
| - /// createDeadDefs - Create a dead def in LI for every def operand of Reg. |
214 |
| - /// Each instruction defining Reg gets a new VNInfo with a corresponding |
215 |
| - /// minimal live range. |
216 |
| - void createDeadDefs(LiveRange &LR, unsigned Reg); |
217 |
| - |
218 |
| - /// Extend the live range of @p LR to reach all uses of Reg. |
219 |
| - /// |
220 |
| - /// All uses must be jointly dominated by existing liveness. PHI-defs are |
221 |
| - /// inserted as needed to preserve SSA form. |
222 |
| - void extendToUses(LiveRange &LR, unsigned PhysReg) { |
223 |
| - extendToUses(LR, PhysReg, LaneBitmask::getAll()); |
224 |
| - } |
225 |
| - |
226 |
| - /// Calculates liveness for the register specified in live interval @p LI. |
227 |
| - /// Creates subregister live ranges as needed if subreg liveness tracking is |
228 |
| - /// enabled. |
229 |
| - void calculate(LiveInterval &LI, bool TrackSubRegs); |
230 |
| - |
231 |
| - /// For live interval \p LI with correct SubRanges construct matching |
232 |
| - /// information for the main live range. Expects the main live range to not |
233 |
| - /// have any segments or value numbers. |
234 |
| - void constructMainRangeFromSubranges(LiveInterval &LI); |
235 |
| - |
236 | 211 | //===--------------------------------------------------------------------===//
|
237 | 212 | // Low-level interface.
|
238 | 213 | //===--------------------------------------------------------------------===//
|
|
0 commit comments