28#define DEBUG_TYPE "amdgpu-prepare-agpr-alloc"
32class AMDGPUPrepareAGPRAllocImpl {
66 "AMDGPU Prepare AGPR Alloc",
false,
false)
70char AMDGPUPrepareAGPRAllocLegacy::
ID = 0;
74bool AMDGPUPrepareAGPRAllocLegacy::runOnMachineFunction(
MachineFunction &MF) {
75 if (skipFunction(MF.getFunction()))
79 return AMDGPUPrepareAGPRAllocImpl(ST, MF.getRegInfo()).run(MF);
86 AMDGPUPrepareAGPRAllocImpl(ST, MF.
getRegInfo()).run(MF);
90bool AMDGPUPrepareAGPRAllocImpl::isAV64Imm(
const MachineOperand &MO)
const {
95 if (
MRI.isReserved(AMDGPU::AGPR0))
98 const MCInstrDesc &AVImmPseudo32 =
TII.get(AMDGPU::AV_MOV_B32_IMM_PSEUDO);
99 const MCInstrDesc &AVImmPseudo64 =
TII.get(AMDGPU::AV_MOV_B64_IMM_PSEUDO);
101 bool Changed =
false;
104 if ((
MI.getOpcode() == AMDGPU::V_MOV_B32_e32 &&
105 TII.isInlineConstant(
MI, 1)) ||
106 (
MI.getOpcode() == AMDGPU::V_ACCVGPR_WRITE_B32_e64 &&
107 MI.getOperand(1).isImm())) {
108 MI.setDesc(AVImmPseudo32);
115 if ((
MI.getOpcode() == AMDGPU::V_MOV_B64_e64 ||
116 MI.getOpcode() == AMDGPU::V_MOV_B64_PSEUDO) &&
117 isAV64Imm(
MI.getOperand(1))) {
118 MI.setDesc(AVImmPseudo64);
unsigned const MachineRegisterInfo * MRI
AMDGPU Prepare AGPR Alloc
AMD GCN specific subclass of TargetSubtarget.
const HexagonInstrInfo * TII
#define INITIALIZE_PASS_END(passName, arg, name, cfg, analysis)
#define INITIALIZE_PASS_BEGIN(passName, arg, name, cfg, analysis)
Interface definition for SIRegisterInfo.
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
Describe properties that are true of each instruction in the target description file.
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...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Representation of each machine instruction.
MachineOperand class - Representation of each machine instruction operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate 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...
virtual StringRef getPassName() const
getPassName - Return a nice clean name for a pass.
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.
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.
void initializeAMDGPUPrepareAGPRAllocLegacyPass(PassRegistry &)
char & AMDGPUPrepareAGPRAllocLegacyID