33 #define DEBUG_TYPE "wasm-optimize-live-intervals" 38 return "WebAssembly Optimize Live Intervals";
62 "Optimize LiveIntervals for WebAssembly",
false,
false)
65 return new WebAssemblyOptimizeLiveIntervals();
68 bool WebAssemblyOptimizeLiveIntervals::runOnMachineFunction(
70 LLVM_DEBUG(
dbgs() <<
"********** Optimize LiveIntervals **********\n" 71 "********** Function: " 80 assert(MRI.tracksLiveness() &&
"OptimizeLiveIntervals expects liveness");
84 for (
unsigned i = 0, e = MRI.getNumVirtRegs(); i < e; ++i) {
86 if (MRI.reg_nodbg_empty(Reg))
97 for (
auto MII = MF.
begin()->begin(), MIE = MF.
begin()->end(); MII != MIE;) {
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void RemoveMachineInstrFromMaps(MachineInstr &MI)
This class represents lattice values for constants.
static unsigned index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
LiveInterval - This class represents the liveness of a register, or stack slot.
unsigned getReg() const
getReg - Returns the register number.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end...
AnalysisUsage & addRequired()
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
INITIALIZE_PASS(WebAssemblyOptimizeLiveIntervals, DEBUG_TYPE, "Optimize LiveIntervals for WebAssembly", false, false) FunctionPass *llvm
SlotIndex getRegSlot(bool EC=false) const
Returns the register use/def slot in the current instruction for a normal or early-clobber def...
AnalysisUsage & addPreservedID(const void *ID)
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...
unsigned const MachineRegisterInfo * MRI
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
void splitSeparateComponents(LiveInterval &LI, SmallVectorImpl< LiveInterval *> &SplitLIs)
Split separate components in LiveInterval LI into separate intervals.
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
bool isImplicitDef() const
This file declares the WebAssembly-specific subclass of TargetSubtarget.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void setPreservesCFG()
This function should be called by the pass, iff they do not:
LiveInterval & getInterval(unsigned Reg)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
SlotIndex getInstructionIndex(const MachineInstr &Instr) const
Returns the base index of the given instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers, including vreg register classes, use/def chains for registers, etc.
Representation of each machine instruction.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
FunctionPass * createWebAssemblyOptimizeLiveIntervals()
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
const MachineOperand & getOperand(unsigned i) const
void removeVRegDefAt(LiveInterval &LI, SlotIndex Pos)
Remove value number and related live segments of LI and its subranges that start at position Pos...