Lines Matching +full:block +full:- +full:copy

1 //===- SplitKit.h - Toolkit for splitting live ranges -----------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
48 /// Determines the latest safe point in a block in which we can insert a split,
54 /// Last legal insert point in each basic block in the current function.
94 /// SplitAnalysis - Analyze a LiveInterval, looking for live range splitting
105 /// live. Such a block will look like one of these templates:
107 /// 1. | o---x | Internal to block. Variable is only live in this block.
108 /// 2. |---x | Live-in, kill.
109 /// 3. | o---| Def, live-out.
110 /// 4. |---x o---| Live-in, kill, def, live-out. Counted by NumGapBlocks.
111 /// 5. |---o---o---| Live-through with uses or defs.
112 /// 6. |-----------| Live-through without uses. Counted by NumThroughBlocks.
114 /// Two BlockInfo entries are created for template 4. One for the live-in
115 /// segment, and one for the live-out segment. These entries look as if the
116 /// block were split in the middle where the live range isn't live.
118 /// Live-through blocks without any uses don't get BlockInfo entries. They
125 SlotIndex FirstDef; ///< First non-phi valno->def, or SlotIndex().
129 /// isOneInstr - Returns true when this BlockInfo describes a single
149 /// UseBlocks - Blocks where CurLI has uses.
152 /// NumGapBlocks - Number of duplicate entries in UseBlocks for blocks where
156 /// ThroughBlocks - Block numbers where CurLI is live through without uses.
159 /// NumThroughBlocks - Number of live-through blocks.
162 /// LooksLikeLoopIV - The variable defines what looks like it could be a loop
169 /// calcLiveBlockInfo - Compute per-block information about CurLI.
176 /// analyze - set CurLI to the specified interval, and analyze how it may be
180 /// clear - clear all data structures so SplitAnalysis is ready to analyze a
184 /// getParent - Return the last analyzed interval.
187 /// isOriginalEndpoint - Return true if the original live range was killed or
188 /// (re-)defined at Idx. Idx should be the 'def' slot for a normal kill/def,
189 /// and 'use' for an early-clobber def.
194 /// getUseSlots - Return an array of SlotIndexes of instructions using CurLI.
198 /// getUseBlocks - Return an array of BlockInfo objects for the basic blocks
202 /// getNumThroughBlocks - Return the number of through blocks.
205 /// isThroughBlock - Return true if CurLI is live through MBB without uses.
208 /// getThroughBlocks - Return the set of through blocks.
211 /// getNumLiveBlocks - Return the number of blocks where CurLI is live.
213 return getUseBlocks().size() - NumGapBlocks + getNumThroughBlocks();
218 /// countLiveBlocks - Return the number of blocks where li is live. This is
225 /// shouldSplitSingleBlock - Returns true if it would help to create a local
231 /// @param BI The block to be isolated.
252 /// SplitEditor - Edit machine code and LiveIntervals for live range
255 /// - Create a SplitEditor from a SplitAnalysis.
256 /// - Start a new live interval with openIntv.
257 /// - Mark the places where the new interval is entered using enterIntv*
258 /// - Mark the ranges where the new interval is used with useIntv*
259 /// - Mark the places where the interval is exited with exitIntv*.
260 /// - Finish the current interval with closeIntv and repeat from 2.
261 /// - Rewrite instructions with finish().
275 /// ComplementSpillMode - Select how the complement live range should be
282 /// SM_Partition(Default) - Try to create the complement interval so it
285 /// PHI-defs. Only segments marked with overlapIntv will be overlapping.
288 /// SM_Size - Overlap intervals to minimize the number of inserted COPY
290 /// common dominator, so only one COPY is required per value in the
291 /// complement interval. This also means that no extra PHI-defs need to be
295 /// SM_Speed - Overlap intervals to minimize the expected execution
297 /// the complement interval may get some extra PHI-defs.
302 /// Edit - The current parent register and new intervals created.
319 /// RegAssign - Map of the assigned register indexes.
327 /// Values - keep track of the mapping from parent values to values in the new
328 /// intervals. Given a pair (RegIdx, ParentVNI->id), Values contains:
330 /// 1. No entry - the value is not mapped to Edit.get(RegIdx).
331 /// 2. (Null, false) - the value is mapped to multiple values in
341 /// LICalc - Cache for computing live ranges and SSA update. Each instance
342 /// can only handle non-overlapping live ranges, so use a separate
346 /// getLICalc - Return the LICalc to use for RegIdx. In spill mode, the
361 /// defValue - define a value in RegIdx from ParentVNI at Idx.
362 /// Idx does not have to be ParentVNI->def, but it must be contained within
365 /// (or an inserted copy), or it may be coming from the original interval.
372 /// forceRecompute - Force the live range of ParentVNI in RegIdx to be
375 /// They could have rematerialized, or back-copies may have been moved.
382 /// defFromParent - Define Reg from ParentVNI at UseIdx using either
383 /// rematerialization or a COPY from parent. Return the new value.
388 /// removeBackCopies - Remove the copy instructions that defines the values
392 /// getShallowDominator - Returns the least busy dominator of MBB that is
401 /// Hoist back-copies to the complement interval. It tries to hoist all
402 /// the back-copies to one BB if it is beneficial, or else simply remove
406 /// transferValues - Transfer values to the new ranges.
411 /// PHI def at the beginning of block @p B. Extend the range @p LR of
414 /// via <def,read-undef> in other subranges for the same register.
419 /// extendPHIKillRanges - Extend the ranges of all values killed by original
423 /// rewriteAssigned - Rewrite all uses of Edit.getReg() to assigned registers.
426 /// deleteRematVictims - Delete defs that are dead after rematerializing.
429 /// Add a copy instruction copying \p FromReg to \p ToReg before
450 /// reset - Prepare for a new split.
458 /// currentIntv - Return the current interval index.
461 /// selectIntv - Select a previously opened interval index.
464 /// enterIntvBefore - Enter the open interval before the instruction at Idx.
465 /// If the parent interval is not live before Idx, a COPY is not inserted.
469 /// enterIntvAfter - Enter the open interval after the instruction at Idx.
473 /// enterIntvAtEnd - Enter the open interval at the end of MBB.
474 /// Use the open interval from the inserted copy to the MBB end.
478 /// useIntv - indicate that all instructions in MBB should use OpenLI.
481 /// useIntv - indicate that all instructions in range should use OpenLI.
484 /// leaveIntvAfter - Leave the open interval after the instruction at Idx.
488 /// leaveIntvBefore - Leave the open interval before the instruction at Idx.
492 /// leaveIntvAtTop - Leave the interval at the top of MBB.
493 /// Add liveness from the MBB top to the copy.
497 /// overlapIntv - Indicate that all instructions in range should use the open
498 /// interval if End does not have tied-def usage of the register and in this
505 /// should be in the same basic block. The parent interval must have the same
510 /// finish - after all the new live ranges have been created, compute the
517 /// dump - print the current interval mapping to dbgs().
520 // ===--- High level methods ---===
522 /// splitSingleBlock - Split CurLI into a separate live interval around the
523 /// uses in a single block. This is intended to be used as part of a larger
527 /// splitLiveThroughBlock - Split CurLI in the given block such that it
528 /// enters the block in IntvIn and leaves it in IntvOut. There may be uses in
529 /// the block, but they will be ignored when placing split points.
531 /// @param MBBNum Block number.
532 /// @param IntvIn Interval index entering the block.
534 /// @param IntvOut Interval index leaving the block.
540 /// splitRegInBlock - Split CurLI in the given block such that it enters the
541 /// block in IntvIn and leaves it on the stack (or not at all). Split points
545 /// @param BI Block descriptor.
546 /// @param IntvIn Interval index entering the block. Not 0.
551 /// splitRegOutBlock - Split CurLI in the given block such that it enters the
552 /// block on the stack (or isn't live-in at all) and leaves it in IntvOut.
557 /// @param BI Block descriptor.
558 /// @param IntvOut Interval index leaving the block.