003 File Manager
Current Path:
/usr/src/contrib/llvm-project/llvm/include/llvm/CodeGen
usr
/
src
/
contrib
/
llvm-project
/
llvm
/
include
/
llvm
/
CodeGen
/
📁
..
📄
AccelTable.h
(13.54 KB)
📄
Analysis.h
(6.04 KB)
📄
AntiDepBreaker.h
(3.78 KB)
📄
AsmPrinter.h
(27.35 KB)
📄
AsmPrinterHandler.h
(2.6 KB)
📄
AtomicExpandUtils.h
(2.49 KB)
📄
BasicTTIImpl.h
(73.64 KB)
📄
BuiltinGCs.h
(1008 B)
📄
CSEConfigBase.h
(1.09 KB)
📄
CalcSpillWeights.h
(4.69 KB)
📄
CallingConvLower.h
(21 KB)
📄
CommandFlags.h
(3.65 KB)
📄
CostTable.h
(1.87 KB)
📄
DAGCombine.h
(606 B)
📄
DFAPacketizer.h
(7.47 KB)
📄
DIE.h
(32.19 KB)
📄
DIEValue.def
(1.4 KB)
📄
DbgEntityHistoryCalculator.h
(4.37 KB)
📄
DebugHandlerBase.h
(4.68 KB)
📄
DwarfStringPoolEntry.h
(2.18 KB)
📄
EdgeBundles.h
(2.13 KB)
📄
ExecutionDomainFix.h
(7.72 KB)
📄
ExpandReductions.h
(726 B)
📄
FastISel.h
(22.87 KB)
📄
FaultMaps.h
(6.66 KB)
📄
FunctionLoweringInfo.h
(9.68 KB)
📄
GCMetadata.h
(7.24 KB)
📄
GCMetadataPrinter.h
(2.46 KB)
📄
GCStrategy.h
(5.25 KB)
📁
GlobalISel
📄
ISDOpcodes.h
(52.75 KB)
📄
IndirectThunks.h
(3.85 KB)
📄
IntrinsicLowering.h
(1.67 KB)
📄
LatencyPriorityQueue.h
(3.09 KB)
📄
LazyMachineBlockFrequencyInfo.h
(2.82 KB)
📄
LexicalScopes.h
(10.06 KB)
📄
LinkAllAsmWriterComponents.h
(1.34 KB)
📄
LinkAllCodegenComponents.h
(2.18 KB)
📄
LiveInterval.h
(37.24 KB)
📄
LiveIntervalCalc.h
(2.91 KB)
📄
LiveIntervalUnion.h
(6.93 KB)
📄
LiveIntervals.h
(19.86 KB)
📄
LivePhysRegs.h
(7.51 KB)
📄
LiveRangeCalc.h
(11.49 KB)
📄
LiveRangeEdit.h
(10.45 KB)
📄
LiveRegMatrix.h
(6.18 KB)
📄
LiveRegUnits.h
(6.24 KB)
📄
LiveStacks.h
(3.35 KB)
📄
LiveVariables.h
(12.98 KB)
📄
LoopTraversal.h
(4.38 KB)
📄
LowLevelType.h
(1.28 KB)
📄
MBFIWrapper.h
(1.58 KB)
📄
MIRFormatter.h
(3.13 KB)
📁
MIRParser
📄
MIRPrinter.h
(1.73 KB)
📄
MIRYamlMapping.h
(23.95 KB)
📄
MachORelocation.h
(2.19 KB)
📄
MachineBasicBlock.h
(42.95 KB)
📄
MachineBlockFrequencyInfo.h
(3.21 KB)
📄
MachineBranchProbabilityInfo.h
(2.69 KB)
📄
MachineCombinerPattern.h
(3.5 KB)
📄
MachineConstantPool.h
(5.25 KB)
📄
MachineDominanceFrontier.h
(2.93 KB)
📄
MachineDominators.h
(9.59 KB)
📄
MachineFrameInfo.h
(34.84 KB)
📄
MachineFunction.h
(42.94 KB)
📄
MachineFunctionPass.h
(2.93 KB)
📄
MachineInstr.h
(73.72 KB)
📄
MachineInstrBuilder.h
(22.84 KB)
📄
MachineInstrBundle.h
(10.16 KB)
📄
MachineInstrBundleIterator.h
(10.92 KB)
📄
MachineJumpTableInfo.h
(4.66 KB)
📄
MachineLoopInfo.h
(7.3 KB)
📄
MachineLoopUtils.h
(1.74 KB)
📄
MachineMemOperand.h
(12.69 KB)
📄
MachineModuleInfo.h
(9.88 KB)
📄
MachineModuleInfoImpls.h
(3.36 KB)
📄
MachineOperand.h
(37.64 KB)
📄
MachineOptimizationRemarkEmitter.h
(8.99 KB)
📄
MachineOutliner.h
(8.04 KB)
📄
MachinePassRegistry.h
(6.1 KB)
📄
MachinePipeliner.h
(21.17 KB)
📄
MachinePostDominators.h
(2.93 KB)
📄
MachineRegionInfo.h
(5.93 KB)
📄
MachineRegisterInfo.h
(46.75 KB)
📄
MachineSSAUpdater.h
(4.37 KB)
📄
MachineScheduler.h
(36.6 KB)
📄
MachineSizeOpts.h
(1.86 KB)
📄
MachineTraceMetrics.h
(17.17 KB)
📄
MacroFusion.h
(1.96 KB)
📄
ModuloSchedule.h
(15.8 KB)
📄
NonRelocatableStringpool.h
(2.9 KB)
📁
PBQP
📄
PBQPRAConstraint.h
(1.83 KB)
📄
ParallelCG.h
(1.66 KB)
📄
Passes.h
(18.96 KB)
📄
PreISelIntrinsicLowering.h
(944 B)
📄
PseudoSourceValue.h
(6.21 KB)
📄
RDFGraph.h
(33.73 KB)
📄
RDFLiveness.h
(5.01 KB)
📄
RDFRegisters.h
(6.51 KB)
📄
ReachingDefAnalysis.h
(10.68 KB)
📄
RegAllocPBQP.h
(16.47 KB)
📄
RegAllocRegistry.h
(2.27 KB)
📄
Register.h
(5.61 KB)
📄
RegisterClassInfo.h
(4.86 KB)
📄
RegisterPressure.h
(21.04 KB)
📄
RegisterScavenging.h
(8.73 KB)
📄
RegisterUsageInfo.h
(2.3 KB)
📄
ResourcePriorityQueue.h
(4.19 KB)
📄
RuntimeLibcalls.h
(3.05 KB)
📄
SDNodeProperties.td
(1.57 KB)
📄
ScheduleDAG.h
(28.92 KB)
📄
ScheduleDAGInstrs.h
(15.49 KB)
📄
ScheduleDAGMutation.h
(1021 B)
📄
ScheduleDFS.h
(5.79 KB)
📄
ScheduleHazardRecognizer.h
(4.65 KB)
📄
SchedulerRegistry.h
(4.27 KB)
📄
ScoreboardHazardRecognizer.h
(3.7 KB)
📄
SelectionDAG.h
(89.12 KB)
📄
SelectionDAGAddressAnalysis.h
(3.58 KB)
📄
SelectionDAGISel.h
(13.48 KB)
📄
SelectionDAGNodes.h
(91.77 KB)
📄
SelectionDAGTargetInfo.h
(7.99 KB)
📄
SlotIndexes.h
(24.12 KB)
📄
Spiller.h
(1.16 KB)
📄
StackMaps.h
(11.45 KB)
📄
StackProtector.h
(4.1 KB)
📄
SwiftErrorValueTracking.h
(3.87 KB)
📄
SwitchLoweringUtils.h
(9.51 KB)
📄
TailDuplicator.h
(5.54 KB)
📄
TargetCallingConv.h
(8.26 KB)
📄
TargetFrameLowering.h
(19.21 KB)
📄
TargetInstrInfo.h
(84.48 KB)
📄
TargetLowering.h
(194.17 KB)
📄
TargetLoweringObjectFileImpl.h
(11.63 KB)
📄
TargetOpcodes.h
(1.37 KB)
📄
TargetPassConfig.h
(17.9 KB)
📄
TargetRegisterInfo.h
(48.65 KB)
📄
TargetSchedule.h
(7.75 KB)
📄
TargetSubtargetInfo.h
(12.53 KB)
📄
UnreachableBlockElim.h
(1.39 KB)
📄
ValueTypes.h
(17.2 KB)
📄
ValueTypes.td
(11.42 KB)
📄
VirtRegMap.h
(6.37 KB)
📄
WasmEHFuncInfo.h
(1.92 KB)
📄
WinEHFuncInfo.h
(4.01 KB)
Editing: LiveRangeCalc.h
//===- LiveRangeCalc.h - Calculate live ranges -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // The LiveRangeCalc class can be used to implement the computation of // live ranges from scratch. // It caches information about values in the CFG to speed up repeated // operations on the same live range. The cache can be shared by // non-overlapping live ranges. SplitKit uses that when computing the live // range of split products. // // A low-level interface is available to clients that know where a variable is // live, but don't know which value it has as every point. LiveRangeCalc will // propagate values down the dominator tree, and even insert PHI-defs where // needed. SplitKit uses this faster interface when possible. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_CODEGEN_LIVERANGECALC_H #define LLVM_LIB_CODEGEN_LIVERANGECALC_H #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 { template <class NodeT> class DomTreeNodeBase; class MachineDominatorTree; class MachineFunction; class MachineRegisterInfo; using MachineDomTreeNode = DomTreeNodeBase<MachineBasicBlock>; class LiveRangeCalc { 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)]. using LiveOutPair = std::pair<VNInfo *, MachineDomTreeNode *>; /// LiveOutMap - Map basic blocks to the value leaving the block. 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. /// This is kept as a separate bit vector because it can be cleared quickly /// when switching live ranges. BitVector Seen; /// Map LiveRange to sets of blocks (represented by bit vectors) that /// in the live range are defined on entry and undefined on entry. /// A block is defined on entry if there is a path from at least one of /// the defs in the live range to the entry of the block, and conversely, /// a block is undefined on entry, if there is no such path (i.e. no /// definition reaches the entry of the block). A single LiveRangeCalc /// object is used to track live-out information for multiple registers /// in live range splitting (which is ok, since the live ranges of these /// registers do not overlap), but the defined/undefined information must /// be kept separate for each individual range. /// By convention, EntryInfoMap[&LR] = { Defined, Undefined }. 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. /// /// For every basic block, MBB, one of these conditions shall be true: /// /// 1. !Seen.count(MBB->getNumber()) /// Blocks without a Seen bit are ignored. /// 2. LiveOut[MBB].second.getNode() == MBB /// The live-out value is defined in MBB. /// 3. forall P in preds(MBB): LiveOut[P] == LiveOut[MBB] /// The live-out value passses through MBB. All predecessors must carry /// the same value. /// /// The domtree node may be null, it can be computed. /// /// The map can be shared by multiple live ranges as long as no two are /// live-out of the same block. LiveOutMap Map; /// LiveInBlock - Information about a basic block where a live range is known /// to be live-in, but the value has not yet been determined. struct LiveInBlock { // The live range set that is live-in to this block. The algorithms can // handle multiple non-overlapping live ranges simultaneously. LiveRange &LR; // DomNode - Dominator tree node for the block. // Cleared when the final value has been determined and LI has been updated. MachineDomTreeNode *DomNode; // Position in block where the live-in range ends, or SlotIndex() if the // range passes through the block. When the final value has been // determined, the range from the block start to Kill will be added to LI. SlotIndex Kill; // Live-in value filled in by updateSSA once it is known. VNInfo *Value = nullptr; LiveInBlock(LiveRange &LR, MachineDomTreeNode *node, SlotIndex kill) : LR(LR), DomNode(node), Kill(kill) {} }; /// LiveIn - Work list of blocks where the live-in value has yet to be /// determined. This list is typically computed by findReachingDefs() and /// used as a work list by updateSSA(). The low-level interface may also be /// used to add entries directly. SmallVector<LiveInBlock, 16> LiveIn; /// Check if the entry to block @p MBB can be reached by any of the defs /// in @p LR. Return true if none of the defs reach the entry to @p MBB. bool isDefOnEntry(LiveRange &LR, ArrayRef<SlotIndex> Undefs, MachineBasicBlock &MBB, BitVector &DefOnEntry, BitVector &UndefOnEntry); /// Find the set of defs that can reach @p Kill. @p Kill must belong to /// @p UseMBB. /// /// If exactly one def can reach @p UseMBB, and the def dominates @p Kill, /// all paths from the def to @p UseMBB are added to @p LR, and the function /// returns true. /// /// If multiple values can reach @p UseMBB, the blocks that need @p LR to be /// live in are added to the LiveIn array, and the function returns false. /// /// The array @p Undef provides the locations where the range @p LR becomes /// undefined by <def,read-undef> operands on other subranges. If @p Undef /// is non-empty and @p Kill is jointly dominated only by the entries of /// @p Undef, the function returns false. /// /// PhysReg, when set, is used to verify live-in lists on basic blocks. bool findReachingDefs(LiveRange &LR, MachineBasicBlock &UseMBB, SlotIndex Use, unsigned PhysReg, ArrayRef<SlotIndex> Undefs); /// updateSSA - Compute the values that will be live in to all requested /// blocks in LiveIn. Create PHI-def values as required to preserve SSA form. /// /// Every live-in block must be jointly dominated by the added live-out /// blocks. No values are read from the live ranges. void updateSSA(); /// Transfer information from the LiveIn vector to the live ranges and update /// the given @p LiveOuts. void updateFromLiveIns(); protected: /// Some getters to expose in a read-only way some private fields to /// subclasses. const MachineFunction *getMachineFunction() { return MF; } const MachineRegisterInfo *getRegInfo() const { return MRI; } SlotIndexes *getIndexes() { return Indexes; } MachineDominatorTree *getDomTree() { return DomTree; } VNInfo::Allocator *getVNAlloc() { return Alloc; } /// Reset Map and Seen fields. void resetLiveOutMap(); public: LiveRangeCalc() = default; //===--------------------------------------------------------------------===// // High-level interface. //===--------------------------------------------------------------------===// // // Calculate live ranges from scratch. // /// reset - Prepare caches for a new set of non-overlapping live ranges. The /// caches must be reset before attempting calculations with a live range /// 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 *SI, MachineDominatorTree *MDT, VNInfo::Allocator *VNIA); //===--------------------------------------------------------------------===// // Mid-level interface. //===--------------------------------------------------------------------===// // // Modify existing live ranges. // /// Extend the live range of @p LR to reach @p Use. /// /// The existing values in @p LR must be live so they jointly dominate @p Use. /// If @p Use is not dominated by a single existing value, PHI-defs are /// inserted as required to preserve SSA form. /// /// PhysReg, when set, is used to verify live-in lists on basic blocks. void extend(LiveRange &LR, SlotIndex Use, unsigned PhysReg, ArrayRef<SlotIndex> Undefs); //===--------------------------------------------------------------------===// // Low-level interface. //===--------------------------------------------------------------------===// // // These functions can be used to compute live ranges where the live-in and // live-out blocks are already known, but the SSA value in each block is // unknown. // // After calling reset(), add known live-out values and known live-in blocks. // Then call calculateValues() to compute the actual value that is // live-in to each block, and add liveness to the live ranges. // /// setLiveOutValue - Indicate that VNI is live out from MBB. The /// calculateValues() function will not add liveness for MBB, the caller /// should take care of that. /// /// VNI may be null only if MBB is a live-through block also passed to /// addLiveInBlock(). void setLiveOutValue(MachineBasicBlock *MBB, VNInfo *VNI) { Seen.set(MBB->getNumber()); Map[MBB] = LiveOutPair(VNI, nullptr); } /// addLiveInBlock - Add a block with an unknown live-in value. This /// function can only be called once per basic block. Once the live-in value /// has been determined, calculateValues() will add liveness to LI. /// /// @param LR The live range that is live-in to the block. /// @param DomNode The domtree node for the block. /// @param Kill Index in block where LI is killed. If the value is /// live-through, set Kill = SLotIndex() and also call /// setLiveOutValue(MBB, 0). void addLiveInBlock(LiveRange &LR, MachineDomTreeNode *DomNode, SlotIndex Kill = SlotIndex()) { LiveIn.push_back(LiveInBlock(LR, DomNode, Kill)); } /// calculateValues - Calculate the value that will be live-in to each block /// added with addLiveInBlock. Add PHI-def values as needed to preserve SSA /// form. Add liveness to all live-in blocks up to the Kill point, or the /// whole block for live-through blocks. /// /// Every predecessor of a live-in block must have been given a value with /// setLiveOutValue, the value may be null for live-trough blocks. void calculateValues(); /// A diagnostic function to check if the end of the block @p MBB is /// jointly dominated by the blocks corresponding to the slot indices /// in @p Defs. This function is mainly for use in self-verification /// checks. LLVM_ATTRIBUTE_UNUSED static bool isJointlyDominated(const MachineBasicBlock *MBB, ArrayRef<SlotIndex> Defs, const SlotIndexes &Indexes); }; } // end namespace llvm #endif // LLVM_LIB_CODEGEN_LIVERANGECALC_H
Upload File
Create Folder