25#define DEBUG_TYPE "processimpdefs"
47class ProcessImplicitDefs {
62char ProcessImplicitDefsLegacy::ID = 0;
66 "Process Implicit Definitions",
false,
false)
68void ProcessImplicitDefsLegacy::getAnalysisUsage(
AnalysisUsage &AU)
const {
74bool ProcessImplicitDefs::canTurnIntoImplicitDef(
MachineInstr *
MI) {
75 if (!
MI->isCopyLike() &&
76 !
MI->isInsertSubreg() &&
77 !
MI->isRegSequence() &&
90 if (
Reg.isVirtual()) {
96 if (!canTurnIntoImplicitDef(UserMI))
99 UserMI->
setDesc(
TII->get(TargetOpcode::IMPLICIT_DEF));
100 WorkList.insert(UserMI);
102 MI->eraseFromParent();
111 for (++UserMI; UserMI != UserE; ++UserMI) {
116 if (!UserReg.
isPhysical() || !
TRI->regsOverlap(Reg, UserReg))
130 MI->eraseFromParent();
136 for (
unsigned i =
MI->getNumOperands() - 1; i; --i)
137 MI->removeOperand(i);
141bool ProcessImplicitDefsLegacy::runOnMachineFunction(
MachineFunction &MF) {
142 return ProcessImplicitDefs().run(MF);
148 if (!ProcessImplicitDefs().
run(MF))
153 .preserve<AAManager>();
160 LLVM_DEBUG(
dbgs() <<
"********** PROCESS IMPLICIT DEFS **********\n"
161 <<
"********** Function: " << MF.
getName() <<
'\n');
163 bool Changed =
false;
168 assert(WorkList.empty() &&
"Inconsistent worklist state");
173 if (
MI.isImplicitDef())
174 WorkList.insert(&
MI);
176 if (WorkList.empty())
180 <<
" implicit defs.\n");
184 do processImplicitDef(WorkList.pop_back_val());
185 while (!WorkList.empty());
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const HexagonInstrInfo * TII
Register const TargetRegisterInfo * TRI
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file implements a set that has insertion order iteration characteristics.
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object.
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
Represents analyses that only rely on functions' control flow.
Instructions::iterator instr_iterator
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.
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.
Representation of each machine instruction.
const MachineBasicBlock * getParent() const
LLVM_ABI void setDesc(const MCInstrDesc &TID)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
static LLVM_ABI PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
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.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
Wrapper class representing virtual and physical registers.
constexpr bool isPhysical() const
Return true if the specified register number is in the physical register namespace.
A SetVector that performs no allocations if smaller than a certain size.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
virtual const TargetInstrInfo * getInstrInfo() const
virtual const TargetRegisterInfo * getRegisterInfo() const =0
Return the target's register 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.
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.
LLVM_ABI void initializeProcessImplicitDefsLegacyPass(PassRegistry &)
LLVM_ABI char & ProcessImplicitDefsID
ProcessImpicitDefs pass - This pass removes IMPLICIT_DEFs.
LLVM_ABI Printable printMBBReference(const MachineBasicBlock &MBB)
Prints a machine basic block reference.