55 switch (U.getOpcode()) {
59 case NVPTX::LDV_i16_v2:
60 case NVPTX::LDV_i16_v4:
61 case NVPTX::LDV_i32_v2:
62 case NVPTX::LDV_i32_v4:
63 case NVPTX::LDV_i64_v2:
64 case NVPTX::LDV_i64_v4: {
68 case NVPTX::cvta_local_32:
69 case NVPTX::cvta_local_64:
70 case NVPTX::cvta_to_local_32:
71 case NVPTX::cvta_to_local_64: {
93 RemoveList.
append(MaybeRemoveList);
100 unsigned Opc = LI->getOpcode();
101 int Idx = getNamedOperandIdx(
Opc, NVPTX::OpName::addr);
102 assert(Idx != -1 &&
"no addr operand");
103 LI->getOperand(Idx).ChangeToES(ParamSymbol->
getSymbolName());
105 Idx = getNamedOperandIdx(
Opc, NVPTX::OpName::addsp);
106 assert(Idx != -1 &&
"no addsp operand");
109 Idx = getNamedOperandIdx(
Opc, NVPTX::OpName::evictionAndPrefetchHint);
110 assert(Idx != -1 &&
"no evictionAndPrefetchHint operand");
111 LI->getOperand(Idx).ChangeToImmediate(0);
113 Idx = getNamedOperandIdx(
Opc, NVPTX::OpName::policy);
114 assert(Idx != -1 &&
"no policy operand");
121 if (PolicyDef && PolicyDef->
isDead(MRI))
133 if (
MI.getOpcode() == NVPTX::MOV32_PARAM ||
134 MI.getOpcode() == NVPTX::MOV64_PARAM)
137 for (
auto *
MI : RemoveList)
138 MI->eraseFromParent();
150 NVPTXForwardParamsLegacyPass() : MachineFunctionPass(ID) {}
152 bool runOnMachineFunction(MachineFunction &MF)
override {
156 void getAnalysisUsage(AnalysisUsage &AU)
const override {
162char NVPTXForwardParamsLegacyPass::ID = 0;
165 "NVPTX Forward Params",
false,
false)
168 return new NVPTXForwardParamsLegacyPass();
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static bool forwardDeviceParams(MachineFunction &MF)
static bool traverseMoveUse(MachineInstr &U, const MachineRegisterInfo &MRI, SmallVectorImpl< MachineInstr * > &RemoveList, SmallVectorImpl< MachineInstr * > &LoadInsts)
static bool eliminateMove(MachineInstr &Mov, const MachineRegisterInfo &MRI, SmallVectorImpl< MachineInstr * > &RemoveList)
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
Represents analyses that only rely on functions' control flow.
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.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Representation of each machine instruction.
mop_iterator operands_begin()
mop_range uses()
Returns all operands which may be register uses.
LLVM_ABI bool isDead(const MachineRegisterInfo &MRI, LiveRegUnits *LivePhysRegs=nullptr) const
Check whether an MI is dead.
MachineOperand class - Representation of each machine instruction operand.
bool isSymbol() const
isSymbol - Tests if this is a MO_ExternalSymbol operand.
LLVM_ABI void ChangeToRegister(Register Reg, bool isDef, bool isImp=false, bool isKill=false, bool isDead=false, bool isUndef=false, bool isDebug=false)
ChangeToRegister - Replace this operand with a new register operand of the specified value.
const char * getSymbolName() const
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
LLVM_ABI MachineInstr * getVRegDef(Register Reg) const
getVRegDef - Return the machine instr that defines the specified virtual register or null if none is ...
iterator_range< use_instr_iterator > use_instructions(Register Reg) const
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
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.
constexpr bool isValid() const
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)
Make a range that does early increment to allow mutation of the underlying range without disrupting i...
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
LLVM_ABI PreservedAnalyses getMachineFunctionPassPreservedAnalyses()
Returns the minimum set of Analyses that all machine function passes must preserve.
MachineFunctionPass * createNVPTXForwardParamsLegacyPass()