32 #define DEBUG_TYPE "wasm-optimize-live-intervals" 37 return "WebAssembly Optimize Live Intervals";
61 "Optimize LiveIntervals for WebAssembly",
false,
false)
64 return new WebAssemblyOptimizeLiveIntervals();
67 bool WebAssemblyOptimizeLiveIntervals::runOnMachineFunction(
69 LLVM_DEBUG(
dbgs() <<
"********** Optimize LiveIntervals **********\n" 70 "********** Function: " 74 auto &LIS = getAnalysis<LiveIntervals>();
79 assert(MRI.tracksLiveness() &&
"OptimizeLiveIntervals expects liveness");
83 for (
unsigned I = 0,
E = MRI.getNumVirtRegs();
I <
E; ++
I) {
85 if (MRI.reg_nodbg_empty(Reg))
88 LIS.splitSeparateComponents(LIS.getInterval(Reg), SplitLIs);
96 for (
auto MII = MF.
begin()->begin(), MIE = MF.
begin()->end(); MII != MIE;) {
100 LIS.removeVRegDefAt(LI, LIS.getInstructionIndex(*MI).getRegSlot());
101 LIS.RemoveMachineInstrFromMaps(*MI);
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
This class represents lattice values for constants.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
LiveInterval - This class represents the liveness of a register, or stack slot.
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
static unsigned index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
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
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.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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:
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
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.
Register getReg() const
getReg - Returns the register number.
const MachineOperand & getOperand(unsigned i) const