31 #define DEBUG_TYPE "r600mergeclause" 38 case R600::CF_ALU_PUSH_BEFORE:
57 void cleanPotentialDisabledCFAlu(
MachineInstr &CFAlu)
const;
77 "R600 Clause Merge",
false,
false)
81 char R600ClauseMergePass::
ID = 0;
88 .getOperand(
TII->getOperandIdx(
MI.getOpcode(), R600::OpName::COUNT))
92 bool R600ClauseMergePass::isCFAluEnabled(
const MachineInstr &
MI)
const {
99 void R600ClauseMergePass::cleanPotentialDisabledCFAlu(
101 int CntIdx =
TII->getOperandIdx(R600::CF_ALU, R600::OpName::COUNT);
105 while (I != E && !isCFAlu(*I))
110 if (isCFAluEnabled(MI))
117 bool R600ClauseMergePass::mergeIfPossible(
MachineInstr &RootCFAlu,
119 assert(isCFAlu(RootCFAlu) && isCFAlu(LatrCFAlu));
120 int CntIdx =
TII->getOperandIdx(R600::CF_ALU, R600::OpName::COUNT);
121 unsigned RootInstCount = getCFAluSize(RootCFAlu),
122 LaterInstCount = getCFAluSize(LatrCFAlu);
123 unsigned CumuledInsts = RootInstCount + LaterInstCount;
124 if (CumuledInsts >=
TII->getMaxAlusPerClause()) {
128 if (RootCFAlu.
getOpcode() == R600::CF_ALU_PUSH_BEFORE)
132 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_MODE0);
134 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_BANK0);
136 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_ADDR0);
148 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_MODE1);
150 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_BANK1);
152 TII->getOperandIdx(R600::CF_ALU, R600::OpName::KCACHE_ADDR1);
197 if ((!TII->canBeConsideredALU(MI) && !isCFAlu(MI)) ||
202 cleanPotentialDisabledCFAlu(MI);
204 if (LatestCFAlu !=
E && mergeIfPossible(*LatestCFAlu, MI)) {
215 StringRef R600ClauseMergePass::getPassName()
const {
216 return "R600 Merge Clause Markers Pass";
220 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