25#define DEBUG_TYPE "loongarch-dead-register-definitions"
26#define LoongArch_DEAD_REG_DEF_NAME "LoongArch Dead register definitions"
28STATISTIC(NumDeadDefsReplaced,
"Number of dead definitions replaced");
37 void getAnalysisUsage(AnalysisUsage &AU)
const override {
51char LoongArchDeadRegisterDefinitionsLegacy::ID = 0;
56 return new LoongArchDeadRegisterDefinitionsLegacy();
62 LLVM_DEBUG(
dbgs() <<
"***** LoongArchDeadRegisterDefinitions *****\n");
64 bool MadeChange =
false;
69 if (!
Desc.mayLoad() && !
Desc.mayStore() &&
70 !
Desc.hasUnmodeledSideEffects())
72 for (
int I = 0,
E =
Desc.getNumDefs();
I !=
E; ++
I) {
77 if (
MI.isRegTiedToUseOperand(
I)) {
87 if (!(RC && RC->
contains(LoongArch::R0))) {
96 ++NumDeadDefsReplaced;
105bool LoongArchDeadRegisterDefinitionsLegacy::runOnMachineFunction(
110 MF, getAnalysis<LiveIntervalsWrapperPass>().getLIS());
121 .preserve<LiveIntervalsAnalysis>()
123 .preserve<LiveDebugVariablesAnalysis>()
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const HexagonInstrInfo * TII
#define LoongArch_DEAD_REG_DEF_NAME
static bool runDeadRegisterDefinitions(MachineFunction &MF, LiveIntervals &LIS)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the 'Statistic' class, which is designed to be an easy way to expose various metric...
#define STATISTIC(VARNAME, DESC)
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
AnalysisUsage & addRequired()
AnalysisUsage & addPreserved()
Add the specified Pass class to the set of analyses preserved by this pass.
LLVM_ABI void setPreservesCFG()
This function should be called by the pass, iff they do not:
Represents analyses that only rely on functions' control flow.
FunctionPass class - This class is used to implement most global optimizations.
bool hasInterval(Register Reg) const
void removeInterval(Register Reg)
Interval removal.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Describe properties that are true of each instruction in the target description file.
bool contains(MCRegister Reg) const
contains - Return true if the specified register is included in this register class.
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.
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Function & getFunction()
Return the LLVM function that this machine code represents.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
bool isReg() const
isReg - Tests if this is a MO_Register operand.
LLVM_ABI void setReg(Register Reg)
Change the register this operand corresponds to.
bool isEarlyClobber() const
Register getReg() const
getReg - Returns the register number.
A set of analyses that are preserved following a run of a transformation pass.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
PreservedAnalyses & preserveSet()
Mark an analysis set as preserved.
Wrapper class representing virtual and physical registers.
TargetInstrInfo - Interface to description of machine instruction set.
virtual const TargetInstrInfo * getInstrInfo() const
Pass manager infrastructure for declaring and invalidating analyses.
This is an optimization pass for GlobalISel generic memory operations.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
FunctionPass * createLoongArchDeadRegisterDefinitionsLegacyPass()
MCRegisterClass TargetRegisterClass