47 return "NVPTX Proxy Register Instruction Erasure";
65 INITIALIZE_PASS(NVPTXProxyRegErasure,
"nvptx-proxyreg-erasure",
"NVPTX ProxyReg Erasure",
false,
false)
72 switch (
MI.getOpcode()) {
73 case NVPTX::ProxyRegI1:
74 case NVPTX::ProxyRegI16:
75 case NVPTX::ProxyRegI32:
76 case NVPTX::ProxyRegI64:
77 case NVPTX::ProxyRegF16:
78 case NVPTX::ProxyRegF16x2:
79 case NVPTX::ProxyRegF32:
80 case NVPTX::ProxyRegF64:
81 replaceMachineInstructionUsage(MF,
MI);
88 for (
auto *
MI : RemoveList) {
89 MI->eraseFromParent();
92 return !RemoveList.empty();
95 void NVPTXProxyRegErasure::replaceMachineInstructionUsage(
MachineFunction &MF,
97 auto &InOp = *MI.
uses().begin();
98 auto &OutOp = *MI.
defs().begin();
100 assert(InOp.isReg() &&
"ProxyReg input operand should be a register.");
101 assert(OutOp.isReg() &&
"ProxyReg output operand should be a register.");
103 for (
auto &BB : MF) {
105 replaceRegisterUsage(
I, OutOp, InOp);
110 void NVPTXProxyRegErasure::replaceRegisterUsage(
MachineInstr &Instr,
113 for (
auto &
Op : Instr.
uses()) {
114 if (
Op.isReg() &&
Op.getReg() == From.
getReg()) {
121 return new NVPTXProxyRegErasure();
MachineFunctionPass * createNVPTXProxyRegErasurePass()
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents lattice values for constants.
iterator_range< mop_iterator > uses()
Returns a range that includes all operands that are register uses.
void push_back(const T &Elt)
unsigned getReg() const
getReg - Returns the register number.
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.
Represent the analysis usage information of a pass.
iterator_range< mop_iterator > defs()
Returns a range over all explicit operands that are register definitions.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
BlockVerifier::State From
MachineOperand class - Representation of each machine instruction operand.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
void initializeNVPTXProxyRegErasurePass(PassRegistry &)
Representation of each machine instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...