42 return "NVPTX Proxy Register Instruction Erasure";
52char NVPTXProxyRegErasure::ID = 0;
55 "NVPTX ProxyReg Erasure",
false,
false)
66 switch (
MI.getOpcode()) {
67 case NVPTX::ProxyRegI1:
68 case NVPTX::ProxyRegI16:
69 case NVPTX::ProxyRegI32:
70 case NVPTX::ProxyRegI64:
71 case NVPTX::ProxyRegF32:
72 case NVPTX::ProxyRegF64: {
73 auto &InOp = *
MI.uses().begin();
74 auto &OutOp = *
MI.defs().begin();
75 assert(InOp.isReg() &&
"ProxyReg input should be a register.");
76 assert(OutOp.isReg() &&
"ProxyReg output should be a register.");
78 Register replacement = InOp.getReg();
80 if (
auto it = RAUWBatch.
find(replacement); it != RAUWBatch.
end())
81 replacement = it->second;
90 if (RemoveList.
empty())
94 for (
auto *
MI : RemoveList) {
95 MI->eraseFromParent();
100 for (
auto &
MI : BB) {
101 for (
auto &
Op :
MI.uses()) {
104 auto it = RAUWBatch.
find(
Op.getReg());
105 if (it != RAUWBatch.
end())
106 Op.setReg(it->second);
115 return new NVPTXProxyRegErasure();
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Represent the analysis usage information of a pass.
This class represents an Operation in the Expression.
iterator find(const_arg_type_t< KeyT > Val)
std::pair< iterator, bool > try_emplace(KeyT &&Key, Ts &&...Args)
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...
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
Wrapper class representing virtual and physical registers.
void push_back(const T &Elt)
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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
MachineFunctionPass * createNVPTXProxyRegErasurePass()
void initializeNVPTXProxyRegErasurePass(PassRegistry &)