class InstrRefBasedLDV
Declaration
class InstrRefBasedLDV : public LDVImpl { /* full declaration omitted */ };
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:777
Inherits from: LDVImpl
Member Variables
- private llvm::MachineDominatorTree* DomTree
- private const llvm::TargetRegisterInfo* TRI
- private const llvm::MachineRegisterInfo* MRI
- private const llvm::TargetInstrInfo* TII
- private const llvm::TargetFrameLowering* TFI
- private const llvm::MachineFrameInfo* MFI
- private llvm::BitVector CalleeSavedRegs
- private llvm::LexicalScopes LS
- private llvm::TargetPassConfig* TPC
- private const llvm::DIExpression* EmptyExpr
- private LiveDebugValues::MLocTracker* MTracker = nullptr
- Object to track machine locations as we step through a block. Could probably be a field rather than a pointer, as it's always used.
- private unsigned int CurBB
- Number of the current block LiveDebugValues is stepping through.
- private unsigned int CurInst
- Number of the current instruction LiveDebugValues is evaluating.
- private LiveDebugValues::VLocTracker* VTracker = nullptr
- Variable tracker -- listens to DBG_VALUEs occurring as InstrRefBasedImpl steps through a block. Reads the values at each location from the MLocTracker object.
- private TransferTracker* TTracker = nullptr
- Tracker for transfers, listens to DBG_VALUEs and transfers of values between locations during stepping, creates new DBG_VALUEs when values move location.
- private SmallPtrSet<llvm::MachineBasicBlock*, 16> ArtificialBlocks
- Blocks which are artificial, i.e. blocks which exclusively contain instructions without DebugLocs, or with line 0 locations.
- private DenseMap<unsigned int, llvm::MachineBasicBlock*> OrderToBB
- private DenseMap<const llvm::MachineBasicBlock*, unsigned int> BBToOrder
- private DenseMap<unsigned int, unsigned int> BBNumToRPO
- private std::map<uint64_t, InstAndNum> DebugInstrNumToInstr
- Map from debug instruction number to the MachineInstr labelled with that number, and its location within the function. Used to transform instruction numbers in DBG_INSTR_REFs into machine value numbers.
- private SmallVector<LiveDebugValues::InstrRefBasedLDV:: DebugPHIRecord, 32> DebugPHINumToValue
- Map from instruction numbers defined by DBG_PHIs to a record of what that DBG_PHI read and where. Populated and edited during the machine value location problem -- we use LLVMs SSA Updater to fix changes by optimizations that destroy PHI instructions.
- private LiveDebugValues::OverlapMap OverlapFragments
- private LiveDebugValues::InstrRefBasedLDV::VarToFragments SeenFragments
- private DenseMap<llvm::MachineInstr*, Optional<LiveDebugValues::ValueIDNum>> SeenDbgPHIs
- Mapping of DBG_INSTR_REF instructions to their values, for those DBG_INSTR_REFs that call resolveDbgPHIs. These variable references solve a mini SSA problem caused by DBG_PHIs being cloned, this collection caches the result.
- private bool AdjustsStackInCalls = false
- True if we need to examine call instructions for stack clobbers. We normally assume that they don't clobber SP, but stack probes on Windows do.
- private llvm::StringRef StackProbeSymbolName
- If AdjustsStackInCalls is true, this holds the name of the target's stack probe function, which is the function we expect will alter the stack pointer.
Method Overview
- private void BlockPHIPlacement(const SmallPtrSetImpl<llvm::MachineBasicBlock *> & AllBlocks, const SmallPtrSetImpl<llvm::MachineBasicBlock *> & DefBlocks, SmallVectorImpl<llvm::MachineBasicBlock *> & PHIBlocks)
- private bool ExtendRanges(llvm::MachineFunction & MF, llvm::MachineDominatorTree * DomTree, llvm::TargetPassConfig * TPC, unsigned int InputBBLimit, unsigned int InputDbgValLimit)
- public InstrRefBasedLDV()
- private void accumulateFragmentMap(llvm::MachineInstr & MI)
- private void buildMLocValueMap(llvm::MachineFunction & MF, LiveDebugValues::FuncValueTable & MInLocs, LiveDebugValues::FuncValueTable & MOutLocs, SmallVectorImpl<LiveDebugValues::InstrRefBasedLDV::MLocTransferMap> & MLocTransfer)
- private void buildVLocValueMap(const llvm::DILocation * DILoc, const SmallSet<llvm::DebugVariable, 4> & VarsWeCareAbout, SmallPtrSetImpl<llvm::MachineBasicBlock *> & AssignBlocks, LiveDebugValues::InstrRefBasedLDV::LiveInsT & Output, LiveDebugValues::FuncValueTable & MOutLocs, LiveDebugValues::FuncValueTable & MInLocs, SmallVectorImpl<LiveDebugValues::VLocTracker> & AllTheVLocs)
- private bool depthFirstVLocAndEmit(unsigned int MaxNumBlocks, const LiveDebugValues::InstrRefBasedLDV::ScopeToDILocT & ScopeToDILocation, const LiveDebugValues::InstrRefBasedLDV::ScopeToVarsT & ScopeToVars, LiveDebugValues::InstrRefBasedLDV::ScopeToAssignBlocksT & ScopeToBlocks, LiveDebugValues::InstrRefBasedLDV::LiveInsT & Output, LiveDebugValues::FuncValueTable & MOutLocs, LiveDebugValues::FuncValueTable & MInLocs, SmallVectorImpl<LiveDebugValues::VLocTracker> & AllTheVLocs, llvm::MachineFunction & MF, DenseMap<llvm::DebugVariable, unsigned int> & AllVarsNumbering, const llvm::TargetPassConfig & TPC)
- public void dump_mloc_transfer(const LiveDebugValues::InstrRefBasedLDV::MLocTransferMap & mloc_transfer) const
- private bool emitTransfers(DenseMap<llvm::DebugVariable, unsigned int> & AllVarsNumbering)
- private Optional<LiveDebugValues::SpillLocationNo> extractSpillBaseRegAndOffset(const llvm::MachineInstr & MI)
- public Optional<LiveDebugValues::LocIdx> findLocationForMemOperand(const llvm::MachineInstr & MI)
- private void findStackIndexInterference(SmallVectorImpl<unsigned int> & Slots)
- private void getBlocksForScope(const llvm::DILocation * DILoc, SmallPtrSetImpl<const llvm::MachineBasicBlock *> & Output, const SmallPtrSetImpl<llvm::MachineBasicBlock *> & AssignBlocks)
- public bool hasFoldedStackStore(const llvm::MachineInstr & MI)
- private void initialSetup(llvm::MachineFunction & MF)
- public bool isCalleeSaved(LiveDebugValues::LocIdx L) const
- private bool isLocationSpill(const llvm::MachineInstr & MI, llvm::MachineFunction * MF, unsigned int & Reg)
- private Optional<LiveDebugValues::SpillLocationNo> isRestoreInstruction(const llvm::MachineInstr & MI, llvm::MachineFunction * MF, unsigned int & Reg)
- private Optional<LiveDebugValues::SpillLocationNo> isSpillInstruction(const llvm::MachineInstr & MI, llvm::MachineFunction * MF)
- private void makeDepthFirstEjectionMap(SmallVectorImpl<unsigned int> & EjectionMap, const LiveDebugValues::InstrRefBasedLDV::ScopeToDILocT & ScopeToDILocation, LiveDebugValues::InstrRefBasedLDV::ScopeToAssignBlocksT & AssignBlocks)
- private bool mlocJoin(llvm::MachineBasicBlock & MBB, SmallPtrSet<const llvm::MachineBasicBlock *, 16> & Visited, LiveDebugValues::FuncValueTable & OutLocs, LiveDebugValues::ValueTable & InLocs)
- private void performCopy(llvm::Register Src, llvm::Register Dst)
- private Optional<LiveDebugValues::ValueIDNum> pickVPHILoc(const llvm::MachineBasicBlock & MBB, const llvm::DebugVariable & Var, const LiveDebugValues::InstrRefBasedLDV::LiveIdxT & LiveOuts, LiveDebugValues::FuncValueTable & MOutLocs, const SmallVectorImpl<const llvm::MachineBasicBlock *> & BlockOrders)
- private void placeMLocPHIs(llvm::MachineFunction & MF, SmallPtrSetImpl<llvm::MachineBasicBlock *> & AllBlocks, LiveDebugValues::FuncValueTable & MInLocs, SmallVectorImpl<LiveDebugValues::InstrRefBasedLDV::MLocTransferMap> & MLocTransfer)
- private void placePHIsForSingleVarDefinition(const SmallPtrSetImpl<llvm::MachineBasicBlock *> & InScopeBlocks, llvm::MachineBasicBlock * MBB, SmallVectorImpl<LiveDebugValues::VLocTracker> & AllTheVLocs, const llvm::DebugVariable & Var, LiveDebugValues::InstrRefBasedLDV::LiveInsT & Output)
- private void process(llvm::MachineInstr & MI, const LiveDebugValues::ValueTable * MLiveOuts, const LiveDebugValues::ValueTable * MLiveIns)
- private void produceMLocTransferFunction(llvm::MachineFunction & MF, SmallVectorImpl<LiveDebugValues::InstrRefBasedLDV::MLocTransferMap> & MLocTransfer, unsigned int MaxNumBlocks)
- private Optional<LiveDebugValues::ValueIDNum> resolveDbgPHIs(llvm::MachineFunction & MF, const LiveDebugValues::ValueTable * MLiveOuts, const LiveDebugValues::ValueTable * MLiveIns, llvm::MachineInstr & Here, uint64_t InstrNum)
- private Optional<LiveDebugValues::ValueIDNum> resolveDbgPHIsImpl(llvm::MachineFunction & MF, const LiveDebugValues::ValueTable * MLiveOuts, const LiveDebugValues::ValueTable * MLiveIns, llvm::MachineInstr & Here, uint64_t InstrNum)
- private bool transferDebugInstrRef(llvm::MachineInstr & MI, const LiveDebugValues::ValueTable * MLiveOuts, const LiveDebugValues::ValueTable * MLiveIns)
- private bool transferDebugPHI(llvm::MachineInstr & MI)
- private bool transferDebugValue(const llvm::MachineInstr & MI)
- private bool transferRegisterCopy(llvm::MachineInstr & MI)
- private void transferRegisterDef(llvm::MachineInstr & MI)
- private bool transferSpillOrRestoreInst(llvm::MachineInstr & MI)
- private bool vlocJoin(llvm::MachineBasicBlock & MBB, LiveDebugValues::InstrRefBasedLDV::LiveIdxT & VLOCOutLocs, SmallPtrSet<const llvm::MachineBasicBlock *, 8> & BlocksToExplore, LiveDebugValues::DbgValue & LiveIn)
Inherited from LDVImpl:
Methods
¶void BlockPHIPlacement(
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& AllBlocks,
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& DefBlocks,
SmallVectorImpl<llvm::MachineBasicBlock*>&
PHIBlocks)
void BlockPHIPlacement(
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& AllBlocks,
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& DefBlocks,
SmallVectorImpl<llvm::MachineBasicBlock*>&
PHIBlocks)
Description
Calculate the iterated-dominance-frontier for a set of defs, using the existing LLVM facilities for this. Works for a single "value" or machine/variable location.\p AllBlocks Set of blocks where we might consume the value.\p DefBlocks Set of blocks where the value/location is defined.\p PHIBlocks Output set of blocks where PHIs must be placed.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1031
Parameters
- const SmallPtrSetImpl<llvm::MachineBasicBlock*>& AllBlocks
- const SmallPtrSetImpl<llvm::MachineBasicBlock*>& DefBlocks
- SmallVectorImpl<llvm::MachineBasicBlock*>& PHIBlocks
¶bool ExtendRanges(
llvm::MachineFunction& MF,
llvm::MachineDominatorTree* DomTree,
llvm::TargetPassConfig* TPC,
unsigned int InputBBLimit,
unsigned int InputDbgValLimit)
bool ExtendRanges(
llvm::MachineFunction& MF,
llvm::MachineDominatorTree* DomTree,
llvm::TargetPassConfig* TPC,
unsigned int InputBBLimit,
unsigned int InputDbgValLimit)
Description
Calculate the liveness information for the given machine function and extend ranges across basic blocks.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1129
Parameters
- llvm::MachineFunction& MF
- llvm::MachineDominatorTree* DomTree
- llvm::TargetPassConfig* TPC
- unsigned int InputBBLimit
- unsigned int InputDbgValLimit
¶InstrRefBasedLDV()
InstrRefBasedLDV()
Description
Default construct and initialize the pass.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1135
¶void accumulateFragmentMap(llvm::MachineInstr& MI)
void accumulateFragmentMap(llvm::MachineInstr& MI)
Description
Accumulate a mapping between each DILocalVariable fragment and other fragments of that DILocalVariable which overlap. This reduces work during the data-flow stage from "Find any overlapping fragments" to "Check if the known-to-overlap fragments are present".
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:967
Parameters
- llvm::MachineInstr& MI
- A previously unprocessed debug instruction to analyze for fragment usage.
¶void buildMLocValueMap(
llvm::MachineFunction& MF,
LiveDebugValues::FuncValueTable& MInLocs,
LiveDebugValues::FuncValueTable& MOutLocs,
SmallVectorImpl<
LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap>& MLocTransfer)
void buildMLocValueMap(
llvm::MachineFunction& MF,
LiveDebugValues::FuncValueTable& MInLocs,
LiveDebugValues::FuncValueTable& MOutLocs,
SmallVectorImpl<
LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap>& MLocTransfer)
Description
Solve the machine value location dataflow problem. Takes as input the transfer functions in \p MLocTransfer. Writes the output live-in and live-out arrays to the (initialized to zero) multidimensional arrays in\p MInLocs and \p MOutLocs. The outer dimension is indexed by block number, the inner by LocIdx.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1001
Parameters
- llvm::MachineFunction& MF
- LiveDebugValues::FuncValueTable& MInLocs
- LiveDebugValues::FuncValueTable& MOutLocs
- SmallVectorImpl< LiveDebugValues::InstrRefBasedLDV:: MLocTransferMap>& MLocTransfer
¶void buildVLocValueMap(
const llvm::DILocation* DILoc,
const SmallSet<llvm::DebugVariable, 4>&
VarsWeCareAbout,
SmallPtrSetImpl<llvm::MachineBasicBlock*>&
AssignBlocks,
LiveDebugValues::InstrRefBasedLDV::LiveInsT&
Output,
LiveDebugValues::FuncValueTable& MOutLocs,
LiveDebugValues::FuncValueTable& MInLocs,
SmallVectorImpl<LiveDebugValues::VLocTracker>&
AllTheVLocs)
void buildVLocValueMap(
const llvm::DILocation* DILoc,
const SmallSet<llvm::DebugVariable, 4>&
VarsWeCareAbout,
SmallPtrSetImpl<llvm::MachineBasicBlock*>&
AssignBlocks,
LiveDebugValues::InstrRefBasedLDV::LiveInsT&
Output,
LiveDebugValues::FuncValueTable& MOutLocs,
LiveDebugValues::FuncValueTable& MInLocs,
SmallVectorImpl<LiveDebugValues::VLocTracker>&
AllTheVLocs)
Description
Solve the variable value dataflow problem, for a single lexical scope. Uses the algorithm from the file comment to resolve control flow joins using PHI placement and value propagation. Reads the locations of machine values from the \p MInLocs and \p MOutLocs arrays (see buildMLocValueMap) and reads the variable values transfer function from \p AllTheVlocs. Live-in and Live-out variable values are stored locally, with the live-ins permanently stored to \p Output once a fixedpoint is reached.\p VarsWeCareAbout contains a collection of the variables in \p Scope that we should be tracking.\p AssignBlocks contains the set of blocks that aren't in \p DILoc's scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks locations through.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1071
Parameters
- const llvm::DILocation* DILoc
- const SmallSet<llvm::DebugVariable, 4>& VarsWeCareAbout
- SmallPtrSetImpl<llvm::MachineBasicBlock*>& AssignBlocks
- LiveDebugValues::InstrRefBasedLDV::LiveInsT& Output
- LiveDebugValues::FuncValueTable& MOutLocs
- LiveDebugValues::FuncValueTable& MInLocs
- SmallVectorImpl<LiveDebugValues::VLocTracker>& AllTheVLocs
¶bool depthFirstVLocAndEmit(
unsigned int MaxNumBlocks,
const LiveDebugValues::InstrRefBasedLDV::
ScopeToDILocT& ScopeToDILocation,
const LiveDebugValues::InstrRefBasedLDV::
ScopeToVarsT& ScopeToVars,
LiveDebugValues::InstrRefBasedLDV::
ScopeToAssignBlocksT& ScopeToBlocks,
LiveDebugValues::InstrRefBasedLDV::LiveInsT&
Output,
LiveDebugValues::FuncValueTable& MOutLocs,
LiveDebugValues::FuncValueTable& MInLocs,
SmallVectorImpl<LiveDebugValues::VLocTracker>&
AllTheVLocs,
llvm::MachineFunction& MF,
DenseMap<llvm::DebugVariable, unsigned int>&
AllVarsNumbering,
const llvm::TargetPassConfig& TPC)
bool depthFirstVLocAndEmit(
unsigned int MaxNumBlocks,
const LiveDebugValues::InstrRefBasedLDV::
ScopeToDILocT& ScopeToDILocation,
const LiveDebugValues::InstrRefBasedLDV::
ScopeToVarsT& ScopeToVars,
LiveDebugValues::InstrRefBasedLDV::
ScopeToAssignBlocksT& ScopeToBlocks,
LiveDebugValues::InstrRefBasedLDV::LiveInsT&
Output,
LiveDebugValues::FuncValueTable& MOutLocs,
LiveDebugValues::FuncValueTable& MInLocs,
SmallVectorImpl<LiveDebugValues::VLocTracker>&
AllTheVLocs,
llvm::MachineFunction& MF,
DenseMap<llvm::DebugVariable, unsigned int>&
AllVarsNumbering,
const llvm::TargetPassConfig& TPC)
Description
When determining per-block variable values and emitting to DBG_VALUEs, this function explores by lexical scope depth. Doing so means that per block information can be fully computed before exploration finishes, allowing us to emit it and free data structures earlier than otherwise. It's also good for locality.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1121
Parameters
- unsigned int MaxNumBlocks
- const LiveDebugValues::InstrRefBasedLDV:: ScopeToDILocT& ScopeToDILocation
- const LiveDebugValues::InstrRefBasedLDV:: ScopeToVarsT& ScopeToVars
- LiveDebugValues::InstrRefBasedLDV:: ScopeToAssignBlocksT& ScopeToBlocks
- LiveDebugValues::InstrRefBasedLDV::LiveInsT& Output
- LiveDebugValues::FuncValueTable& MOutLocs
- LiveDebugValues::FuncValueTable& MInLocs
- SmallVectorImpl<LiveDebugValues::VLocTracker>& AllTheVLocs
- llvm::MachineFunction& MF
- DenseMap<llvm::DebugVariable, unsigned int>& AllVarsNumbering
- const llvm::TargetPassConfig& TPC
¶void dump_mloc_transfer(
const LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap& mloc_transfer) const
void dump_mloc_transfer(
const LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap& mloc_transfer) const
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1138
Parameters
- const LiveDebugValues::InstrRefBasedLDV:: MLocTransferMap& mloc_transfer
¶bool emitTransfers(
DenseMap<llvm::DebugVariable, unsigned int>&
AllVarsNumbering)
bool emitTransfers(
DenseMap<llvm::DebugVariable, unsigned int>&
AllVarsNumbering)
Description
Take collections of DBG_VALUE instructions stored in TTracker, and install them into their output blocks. Preserves a stable order of DBG_VALUEs produced (which would otherwise cause nondeterminism) through the AllVarsNumbering order.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1101
Parameters
- DenseMap<llvm::DebugVariable, unsigned int>& AllVarsNumbering
¶Optional<LiveDebugValues::SpillLocationNo>
extractSpillBaseRegAndOffset(
const llvm::MachineInstr& MI)
Optional<LiveDebugValues::SpillLocationNo>
extractSpillBaseRegAndOffset(
const llvm::MachineInstr& MI)
Description
Given a spill instruction, extract the spill slot information, ensure it's tracked, and return the spill number.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:932
Parameters
- const llvm::MachineInstr& MI
¶Optional<LiveDebugValues::LocIdx>
findLocationForMemOperand(
const llvm::MachineInstr& MI)
Optional<LiveDebugValues::LocIdx>
findLocationForMemOperand(
const llvm::MachineInstr& MI)
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1155
Parameters
- const llvm::MachineInstr& MI
¶void findStackIndexInterference(
SmallVectorImpl<unsigned int>& Slots)
void findStackIndexInterference(
SmallVectorImpl<unsigned int>& Slots)
Description
Examine the stack indexes (i.e. offsets within the stack) to find the basic units of interference -- like reg units, but for the stack.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1007
Parameters
- SmallVectorImpl<unsigned int>& Slots
¶void getBlocksForScope(
const llvm::DILocation* DILoc,
SmallPtrSetImpl<
const llvm::MachineBasicBlock*>& Output,
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& AssignBlocks)
void getBlocksForScope(
const llvm::DILocation* DILoc,
SmallPtrSetImpl<
const llvm::MachineBasicBlock*>& Output,
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& AssignBlocks)
Description
Produce a set of blocks that are in the current lexical scope. This means those blocks that contain instructions "in" the scope, blocks where assignments to variables in scope occur, and artificial blocks that are successors to any of the earlier blocks. See https://llvm.org/PR48091 for more commentry on what "in scope" means.\p DILoc A location in the scope that we're fetching blocks for.\p Output Set to put in-scope-blocks into.\p AssignBlocks Blocks known to contain assignments of variables in scope.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1055
Parameters
- const llvm::DILocation* DILoc
- SmallPtrSetImpl<const llvm::MachineBasicBlock*>& Output
- const SmallPtrSetImpl<llvm::MachineBasicBlock*>& AssignBlocks
¶bool hasFoldedStackStore(
const llvm::MachineInstr& MI)
bool hasFoldedStackStore(
const llvm::MachineInstr& MI)
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1142
Parameters
- const llvm::MachineInstr& MI
¶void initialSetup(llvm::MachineFunction& MF)
void initialSetup(llvm::MachineFunction& MF)
Description
Boilerplate computation of some initial sets, artifical blocks and RPOT block ordering.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1105
Parameters
¶bool isCalleeSaved(
LiveDebugValues::LocIdx L) const
bool isCalleeSaved(
LiveDebugValues::LocIdx L) const
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1140
Parameters
¶bool isLocationSpill(const llvm::MachineInstr& MI,
llvm::MachineFunction* MF,
unsigned int& Reg)
bool isLocationSpill(const llvm::MachineInstr& MI,
llvm::MachineFunction* MF,
unsigned int& Reg)
Description
Decide if @MIis a spill instruction and return true if it is. We use 2 criteria to make this decision: - Is this instruction a store to a spill slot? - Is there a register operand that is both used and killed? TODO: Store optimization can fold spills into other stores (including other spills). We do not handle this yet (more than one memory operand).
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:921
Parameters
- const llvm::MachineInstr& MI
- llvm::MachineFunction* MF
- unsigned int& Reg
¶Optional<LiveDebugValues::SpillLocationNo>
isRestoreInstruction(const llvm::MachineInstr& MI,
llvm::MachineFunction* MF,
unsigned int& Reg)
Optional<LiveDebugValues::SpillLocationNo>
isRestoreInstruction(const llvm::MachineInstr& MI,
llvm::MachineFunction* MF,
unsigned int& Reg)
Description
If a given instruction is identified as a spill, return the spill slot and set \p Reg to the spilled register.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:926
Parameters
- const llvm::MachineInstr& MI
- llvm::MachineFunction* MF
- unsigned int& Reg
¶Optional<LiveDebugValues::SpillLocationNo>
isSpillInstruction(const llvm::MachineInstr& MI,
llvm::MachineFunction* MF)
Optional<LiveDebugValues::SpillLocationNo>
isSpillInstruction(const llvm::MachineInstr& MI,
llvm::MachineFunction* MF)
Description
Tests whether this instruction is a spill to a stack slot.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:912
Parameters
- const llvm::MachineInstr& MI
- llvm::MachineFunction* MF
¶void makeDepthFirstEjectionMap(
SmallVectorImpl<unsigned int>& EjectionMap,
const LiveDebugValues::InstrRefBasedLDV::
ScopeToDILocT& ScopeToDILocation,
LiveDebugValues::InstrRefBasedLDV::
ScopeToAssignBlocksT& AssignBlocks)
void makeDepthFirstEjectionMap(
SmallVectorImpl<unsigned int>& EjectionMap,
const LiveDebugValues::InstrRefBasedLDV::
ScopeToDILocT& ScopeToDILocation,
LiveDebugValues::InstrRefBasedLDV::
ScopeToAssignBlocksT& AssignBlocks)
Description
Produce a map of the last lexical scope that uses a block, using the scopes DFSOut number. Mapping is block-number to DFSOut.\p EjectionMap Pre-allocated vector in which to install the built ma.\p ScopeToDILocation Mapping of LexicalScopes to their DILocations.\p AssignBlocks Map of blocks where assignments happen for a scope.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1112
Parameters
- SmallVectorImpl<unsigned int>& EjectionMap
- const LiveDebugValues::InstrRefBasedLDV:: ScopeToDILocT& ScopeToDILocation
- LiveDebugValues::InstrRefBasedLDV:: ScopeToAssignBlocksT& AssignBlocks
¶bool mlocJoin(
llvm::MachineBasicBlock& MBB,
SmallPtrSet<const llvm::MachineBasicBlock*,
16>& Visited,
LiveDebugValues::FuncValueTable& OutLocs,
LiveDebugValues::ValueTable& InLocs)
bool mlocJoin(
llvm::MachineBasicBlock& MBB,
SmallPtrSet<const llvm::MachineBasicBlock*,
16>& Visited,
LiveDebugValues::FuncValueTable& OutLocs,
LiveDebugValues::ValueTable& InLocs)
Description
Perform a control flow join (lattice value meet) of the values in machine locations at \p MBB. Follows the algorithm described in the file-comment, reading live-outs of predecessors from \p OutLocs, the current live ins from \p InLocs, and assigning the newly computed live ins back into\p InLocs.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1042
Parameters
- llvm::MachineBasicBlock& MBB
- SmallPtrSet<const llvm::MachineBasicBlock*, 16>& Visited
- LiveDebugValues::FuncValueTable& OutLocs
- LiveDebugValues::ValueTable& InLocs
Returns
two bools -- the first indicates whether a change was made, the second whether a lattice downgrade occurred. If the latter is true, revisiting this block is necessary.
¶void performCopy(llvm::Register Src,
llvm::Register Dst)
void performCopy(llvm::Register Src,
llvm::Register Dst)
Description
Copy one location to the other, accounting for movement of subregisters too.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:965
Parameters
- llvm::Register Src
- llvm::Register Dst
¶Optional<LiveDebugValues::ValueIDNum> pickVPHILoc(
const llvm::MachineBasicBlock& MBB,
const llvm::DebugVariable& Var,
const LiveDebugValues::InstrRefBasedLDV::
LiveIdxT& LiveOuts,
LiveDebugValues::FuncValueTable& MOutLocs,
const SmallVectorImpl<
const llvm::MachineBasicBlock*>&
BlockOrders)
Optional<LiveDebugValues::ValueIDNum> pickVPHILoc(
const llvm::MachineBasicBlock& MBB,
const llvm::DebugVariable& Var,
const LiveDebugValues::InstrRefBasedLDV::
LiveIdxT& LiveOuts,
LiveDebugValues::FuncValueTable& MOutLocs,
const SmallVectorImpl<
const llvm::MachineBasicBlock*>&
BlockOrders)
Description
For the given block and live-outs feeding into it, try to find a machine location where all the variable values join together.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1093
Parameters
- const llvm::MachineBasicBlock& MBB
- const llvm::DebugVariable& Var
- const LiveDebugValues::InstrRefBasedLDV::LiveIdxT& LiveOuts
- LiveDebugValues::FuncValueTable& MOutLocs
- const SmallVectorImpl< const llvm::MachineBasicBlock*>& BlockOrders
Returns
Value ID of a machine PHI if an appropriate one is available.
¶void placeMLocPHIs(
llvm::MachineFunction& MF,
SmallPtrSetImpl<llvm::MachineBasicBlock*>&
AllBlocks,
LiveDebugValues::FuncValueTable& MInLocs,
SmallVectorImpl<
LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap>& MLocTransfer)
void placeMLocPHIs(
llvm::MachineFunction& MF,
SmallPtrSetImpl<llvm::MachineBasicBlock*>&
AllBlocks,
LiveDebugValues::FuncValueTable& MInLocs,
SmallVectorImpl<
LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap>& MLocTransfer)
Description
Install PHI values into the live-in array for each block, according to the IDF of each register.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1011
Parameters
- llvm::MachineFunction& MF
- SmallPtrSetImpl<llvm::MachineBasicBlock*>& AllBlocks
- LiveDebugValues::FuncValueTable& MInLocs
- SmallVectorImpl< LiveDebugValues::InstrRefBasedLDV:: MLocTransferMap>& MLocTransfer
¶void placePHIsForSingleVarDefinition(
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& InScopeBlocks,
llvm::MachineBasicBlock* MBB,
SmallVectorImpl<LiveDebugValues::VLocTracker>&
AllTheVLocs,
const llvm::DebugVariable& Var,
LiveDebugValues::InstrRefBasedLDV::LiveInsT&
Output)
void placePHIsForSingleVarDefinition(
const SmallPtrSetImpl<
llvm::MachineBasicBlock*>& InScopeBlocks,
llvm::MachineBasicBlock* MBB,
SmallVectorImpl<LiveDebugValues::VLocTracker>&
AllTheVLocs,
const llvm::DebugVariable& Var,
LiveDebugValues::InstrRefBasedLDV::LiveInsT&
Output)
Description
Propagate variable values to blocks in the common case where there's only one value assigned to the variable. This function has better performance as it doesn't have to find the dominance frontier between different assignments.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1020
Parameters
- const SmallPtrSetImpl<llvm::MachineBasicBlock*>& InScopeBlocks
- llvm::MachineBasicBlock* MBB
- SmallVectorImpl<LiveDebugValues::VLocTracker>& AllTheVLocs
- const llvm::DebugVariable& Var
- LiveDebugValues::InstrRefBasedLDV::LiveInsT& Output
¶void process(
llvm::MachineInstr& MI,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns)
void process(
llvm::MachineInstr& MI,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns)
Description
Observe a single instruction while stepping through a block.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:935
Parameters
- llvm::MachineInstr& MI
- const LiveDebugValues::ValueTable* MLiveOuts
- const LiveDebugValues::ValueTable* MLiveIns
¶void produceMLocTransferFunction(
llvm::MachineFunction& MF,
SmallVectorImpl<
LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap>& MLocTransfer,
unsigned int MaxNumBlocks)
void produceMLocTransferFunction(
llvm::MachineFunction& MF,
SmallVectorImpl<
LiveDebugValues::InstrRefBasedLDV::
MLocTransferMap>& MLocTransfer,
unsigned int MaxNumBlocks)
Description
Step through the function, recording register definitions and movements in an MLocTracker. Convert the observations into a per-block transfer function in \p MLocTransfer, suitable for using with the machine value location dataflow problem.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:992
Parameters
- llvm::MachineFunction& MF
- SmallVectorImpl< LiveDebugValues::InstrRefBasedLDV:: MLocTransferMap>& MLocTransfer
- unsigned int MaxNumBlocks
¶Optional<LiveDebugValues::ValueIDNum>
resolveDbgPHIs(
llvm::MachineFunction& MF,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns,
llvm::MachineInstr& Here,
uint64_t InstrNum)
Optional<LiveDebugValues::ValueIDNum>
resolveDbgPHIs(
llvm::MachineFunction& MF,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns,
llvm::MachineInstr& Here,
uint64_t InstrNum)
Description
Determine the machine value number referred to by (potentially several) DBG_PHI instructions. Block duplication and tail folding can duplicate DBG_PHIs, shifting the position where values in registers merge, and forming another mini-ssa problem to solve.\p Here the position of a DBG_INSTR_REF seeking a machine value number\p InstrNum Debug instruction number defined by DBG_PHI instructions.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:976
Parameters
- llvm::MachineFunction& MF
- const LiveDebugValues::ValueTable* MLiveOuts
- const LiveDebugValues::ValueTable* MLiveIns
- llvm::MachineInstr& Here
- uint64_t InstrNum
Returns
The machine value number at position Here, or None.
¶Optional<LiveDebugValues::ValueIDNum>
resolveDbgPHIsImpl(
llvm::MachineFunction& MF,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns,
llvm::MachineInstr& Here,
uint64_t InstrNum)
Optional<LiveDebugValues::ValueIDNum>
resolveDbgPHIsImpl(
llvm::MachineFunction& MF,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns,
llvm::MachineInstr& Here,
uint64_t InstrNum)
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:981
Parameters
- llvm::MachineFunction& MF
- const LiveDebugValues::ValueTable* MLiveOuts
- const LiveDebugValues::ValueTable* MLiveIns
- llvm::MachineInstr& Here
- uint64_t InstrNum
¶bool transferDebugInstrRef(
llvm::MachineInstr& MI,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns)
bool transferDebugInstrRef(
llvm::MachineInstr& MI,
const LiveDebugValues::ValueTable* MLiveOuts,
const LiveDebugValues::ValueTable* MLiveIns)
Description
Examines whether \p MI is a DBG_INSTR_REF and notifies trackers.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:944
Parameters
- llvm::MachineInstr& MI
- const LiveDebugValues::ValueTable* MLiveOuts
- const LiveDebugValues::ValueTable* MLiveIns
Returns
true if MI was recognized and processed.
¶bool transferDebugPHI(llvm::MachineInstr& MI)
bool transferDebugPHI(llvm::MachineInstr& MI)
Description
Stores value-information about where this PHI occurred, and what instruction number is associated with it.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:950
Parameters
Returns
true if MI was recognized and processed.
¶bool transferDebugValue(
const llvm::MachineInstr& MI)
bool transferDebugValue(
const llvm::MachineInstr& MI)
Description
Examines whether \p MI is a DBG_VALUE and notifies trackers.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:940
Parameters
- const llvm::MachineInstr& MI
Returns
true if MI was recognized and processed.
¶bool transferRegisterCopy(llvm::MachineInstr& MI)
bool transferRegisterCopy(llvm::MachineInstr& MI)
Description
Examines whether \p MI is copy instruction, and notifies trackers.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:954
Parameters
Returns
true if MI was recognized and processed.
¶void transferRegisterDef(llvm::MachineInstr& MI)
void transferRegisterDef(llvm::MachineInstr& MI)
Description
Examines \p MI for any registers that it defines, and notifies trackers.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:961
Parameters
¶bool transferSpillOrRestoreInst(
llvm::MachineInstr& MI)
bool transferSpillOrRestoreInst(
llvm::MachineInstr& MI)
Description
Examines whether \p MI is stack spill or restore instruction, and notifies trackers.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:958
Parameters
Returns
true if MI was recognized and processed.
¶bool vlocJoin(
llvm::MachineBasicBlock& MBB,
LiveDebugValues::InstrRefBasedLDV::LiveIdxT&
VLOCOutLocs,
SmallPtrSet<const llvm::MachineBasicBlock*,
8>& BlocksToExplore,
LiveDebugValues::DbgValue& LiveIn)
bool vlocJoin(
llvm::MachineBasicBlock& MBB,
LiveDebugValues::InstrRefBasedLDV::LiveIdxT&
VLOCOutLocs,
SmallPtrSet<const llvm::MachineBasicBlock*,
8>& BlocksToExplore,
LiveDebugValues::DbgValue& LiveIn)
Description
Attempt to eliminate un-necessary PHIs on entry to a block. Examines the live-in values coming from predecessors live-outs, and replaces any PHIs already present in this blocks live-ins with a live-through value if the PHI isn't needed.\p LiveIn Old live-in value, overwritten with new one if live-in changes.
Declared at: llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.h:1085
Parameters
- llvm::MachineBasicBlock& MBB
- LiveDebugValues::InstrRefBasedLDV::LiveIdxT& VLOCOutLocs
- SmallPtrSet<const llvm::MachineBasicBlock*, 8>& BlocksToExplore
- LiveDebugValues::DbgValue& LiveIn
Returns
true if any live-ins change value, either from value propagation or PHI elimination.