33#define DEBUG_TYPE "wasm-optimize-live-intervals"
38 return "WebAssembly Optimize Live Intervals";
54 MachineFunctionProperties::Property::TracksLiveness);
65char WebAssemblyOptimizeLiveIntervals::ID = 0;
67 "Optimize LiveIntervals for WebAssembly",
false,
false)
70 return new WebAssemblyOptimizeLiveIntervals();
73bool WebAssemblyOptimizeLiveIntervals::runOnMachineFunction(
75 LLVM_DEBUG(
dbgs() <<
"********** Optimize LiveIntervals **********\n"
76 "********** Function: "
80 auto &LIS = getAnalysis<LiveIntervalsWrapperPass>().getLIS();
85 assert(
MRI.tracksLiveness() &&
"OptimizeLiveIntervals expects liveness");
89 for (
unsigned I = 0, E =
MRI.getNumVirtRegs();
I < E; ++
I) {
93 if (
MRI.reg_nodbg_empty(Reg))
96 LIS.splitSeparateComponents(LIS.getInterval(Reg), SplitLIs);
97 if (Reg ==
TRI.getFrameRegister(MF) && SplitLIs.
size() > 0) {
105 SplitLIs.
back()->reg());
115 if (
MI.isImplicitDef() &&
MI.getOperand(0).isDead()) {
117 LIS.removeVRegDefAt(LI, LIS.getInstructionIndex(
MI).getRegSlot());
118 LIS.RemoveMachineInstrFromMaps(
MI);
119 MI.eraseFromParent();
unsigned const MachineRegisterInfo * MRI
unsigned const TargetRegisterInfo * TRI
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file declares WebAssembly-specific per-machine-function information.
This file declares the WebAssembly-specific subclass of TargetSubtarget.
This file contains the entry points for global functions defined in the LLVM WebAssembly back-end.
Represent the analysis usage information of a pass.
AnalysisUsage & addPreservedID(const void *ID)
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
void setPreservesCFG()
This function should be called by the pass, iff they do not:
FunctionPass class - This class is used to implement most global optimizations.
LiveInterval - This class represents the liveness of a register, or stack slot.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
virtual bool runOnMachineFunction(MachineFunction &MF)=0
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
virtual MachineFunctionProperties getRequiredProperties() const
Properties which a MachineFunction may have at a given point in time.
MachineFunctionProperties & set(Property P)
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
StringRef getName() const
getName - Return the name of the corresponding LLVM function.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const MachineBasicBlock & front() const
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Wrapper class representing virtual and physical registers.
static Register index2VirtReg(unsigned Index)
Convert a 0-based index to a virtual register number.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
This class is derived from MachineFunctionInfo and contains private WebAssembly-specific information ...
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Reg
All possible values of the reg field in the ModR/M byte.
This is an optimization pass for GlobalISel generic memory operations.
char & MachineDominatorsID
MachineDominators - This pass is a machine dominators analysis pass.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionPass * createWebAssemblyOptimizeLiveIntervals()
char & LiveVariablesID
LiveVariables pass - This pass computes the set of blocks in which each variable is life and sets mac...