30 #define DEBUG_TYPE "r600mergeclause" 37 case R600::CF_ALU_PUSH_BEFORE:
56 void cleanPotentialDisabledCFAlu(
MachineInstr &CFAlu)
const;
76 "R600 Clause Merge",
false,
false)
80 char R600ClauseMergePass::
ID = 0;
87 .getOperand(
TII->getOperandIdx(
MI.getOpcode(), R600::OpName::COUNT))
91 bool R600ClauseMergePass::isCFAluEnabled(
const MachineInstr &
MI)
const {
98 void R600ClauseMergePass::cleanPotentialDisabledCFAlu(
100 int CntIdx =
TII->getOperandIdx(R600::CF_ALU, R600::OpName::COUNT);
104 while (I != E && !isCFAlu(*I))
109 if (isCFAluEnabled(MI))
116 bool R600ClauseMergePass::mergeIfPossible(
MachineInstr &RootCFAlu,
118 assert(isCFAlu(RootCFAlu) && isCFAlu(LatrCFAlu));
119 int CntIdx =
TII->getOperandIdx(R600::CF_ALU, R600::OpName::COUNT);
120 unsigned RootInstCount = getCFAluSize(RootCFAlu),
121 LaterInstCount = getCFAluSize(LatrCFAlu);
122 unsigned CumuledInsts = RootInstCount + LaterInstCount;
123 if (CumuledInsts >=
TII->getMaxAlusPerClause()) {
127 if (RootCFAlu.
getOpcode() == R600::CF_ALU_PUSH_BEFORE)
131 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_MODE0);
133 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_BANK0);
135 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_ADDR0);
147 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_MODE1);
149 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_BANK1);
151 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_ADDR1);
196 if ((!TII->canBeConsideredALU(MI) && !isCFAlu(MI)) ||
201 cleanPotentialDisabledCFAlu(MI);
203 if (LatestCFAlu !=
E && mergeIfPossible(*LatestCFAlu, MI)) {
214 StringRef R600ClauseMergePass::getPassName()
const {
215 return "R600 Merge Clause Markers Pass";
219 return new R600ClauseMergePass();
AMDGPU specific subclass of TargetSubtarget.
This class represents lattice values for constants.
Interface definition for R600InstrInfo.
Interface definition for R600RegisterInfo.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
INITIALIZE_PASS_BEGIN(R600ClauseMergePass, DEBUG_TYPE, "R600 Clause Merge", false, false) INITIALIZE_PASS_END(R600ClauseMergePass
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
const R600InstrInfo * getInstrInfo() const override
void setImm(int64_t immVal)
FunctionPass class - This class is used to implement most global optimizations.
FunctionPass * createR600ClauseMergePass()
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
Iterator for intrusive lists based on ilist_node.
void setDesc(const MCInstrDesc &tid)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one...
const Function & getFunction() const
Return the LLVM function that this machine code represents.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
const MachineBasicBlock * getParent() const
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
StringRef - Represent a constant reference to a string, i.e.
const MachineOperand & getOperand(unsigned i) const
char & R600ClauseMergePassID