36 return "NVPTX Proxy Register Instruction Erasure";
46char NVPTXProxyRegErasure::ID = 0;
49 "NVPTX ProxyReg Erasure",
false,
false)
60 switch (
MI.getOpcode()) {
61 case NVPTX::ProxyRegB1:
62 case NVPTX::ProxyRegB16:
63 case NVPTX::ProxyRegB32:
64 case NVPTX::ProxyRegB64: {
65 auto &InOp = *
MI.uses().begin();
66 auto &OutOp = *
MI.defs().begin();
67 assert(InOp.isReg() &&
"ProxyReg input should be a register.");
68 assert(OutOp.isReg() &&
"ProxyReg output should be a register.");
70 Register replacement = InOp.getReg();
72 if (
auto it = RAUWBatch.
find(replacement); it != RAUWBatch.
end())
73 replacement = it->second;
82 if (RemoveList.
empty())
86 for (
auto *
MI : RemoveList) {
87 MI->eraseFromParent();
93 for (
auto &
Op :
MI.uses()) {
96 auto it = RAUWBatch.
find(
Op.getReg());
97 if (it != RAUWBatch.
end())
98 Op.setReg(it->second);
107 return new NVPTXProxyRegErasure();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
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...
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()