55 case R600::INTERP_PAIR_XY:
56 case R600::INTERP_PAIR_ZW:
57 case R600::INTERP_VEC_LOAD:
75 unsigned NumLiteral = 0;
80 if (MO.
isReg() && MO.
getReg() == R600::ALU_LITERAL_X)
83 return 1 + NumLiteral;
93 case R600::INTERP_PAIR_XY:
94 case R600::INTERP_PAIR_ZW:
95 case R600::INTERP_VEC_LOAD:
108 case R600::IMPLICIT_DEF:
115 std::pair<unsigned, unsigned> getAccessedBankLine(
unsigned Sel)
const {
119 return std::pair<unsigned, unsigned>(
120 ((Sel >> 2) - 512) >> 12,
126 ((((Sel >> 2) - 512) & 4095) >> 5) << 1);
131 std::vector<std::pair<unsigned, unsigned>> &CachedConsts,
132 bool UpdateInstr =
true)
const {
133 std::vector<std::pair<unsigned, unsigned>> UsedKCache;
142 "Can't assign Const");
143 for (
unsigned i = 0, n = Consts.
size(); i < n; ++i) {
144 if (Consts[i].
first->getReg() != R600::ALU_CONST)
146 unsigned Sel = Consts[i].second;
147 unsigned Chan = Sel & 3,
Index = ((Sel >> 2) - 512) & 31;
148 unsigned KCacheIndex = Index * 4 + Chan;
149 const std::pair<unsigned, unsigned> &BankLine = getAccessedBankLine(Sel);
150 if (CachedConsts.empty()) {
151 CachedConsts.push_back(BankLine);
152 UsedKCache.push_back(std::pair<unsigned, unsigned>(0, KCacheIndex));
155 if (CachedConsts[0] == BankLine) {
156 UsedKCache.push_back(std::pair<unsigned, unsigned>(0, KCacheIndex));
159 if (CachedConsts.size() == 1) {
160 CachedConsts.push_back(BankLine);
161 UsedKCache.push_back(std::pair<unsigned, unsigned>(1, KCacheIndex));
164 if (CachedConsts[1] == BankLine) {
165 UsedKCache.push_back(std::pair<unsigned, unsigned>(1, KCacheIndex));
174 for (
unsigned i = 0, j = 0, n = Consts.
size(); i < n; ++i) {
175 if (Consts[i].
first->getReg() != R600::ALU_CONST)
177 switch(UsedKCache[j].
first) {
179 Consts[i].first->setReg(
180 R600::R600_KC0RegClass.getRegister(UsedKCache[j].
second));
183 Consts[i].first->setReg(
184 R600::R600_KC1RegClass.getRegister(UsedKCache[j].second));
194 bool canClauseLocalKillFitInClause(
195 unsigned AluInstCount,
196 std::vector<std::pair<unsigned, unsigned>> KCacheBanks,
202 MOI = Def->operands_begin(),
203 MOE = Def->operands_end(); MOI != MOE; ++MOI) {
204 if (!MOI->isReg() || !MOI->isDef() ||
210 unsigned LastUseCount = 0;
212 AluInstCount += OccupiedDwords(*UseI);
214 if (!SubstituteKCacheBank(*UseI, KCacheBanks,
false))
229 if (UseI->readsRegister(MOI->getReg(), &
TRI))
230 LastUseCount = AluInstCount;
233 if (UseI != Def && UseI->killsRegister(MOI->getReg(), &
TRI))
246 std::vector<std::pair<unsigned, unsigned>> KCacheBanks;
247 bool PushBeforeModifier =
false;
248 unsigned AluInstCount = 0;
250 if (IsTrivialInst(*I))
256 if (I->getOpcode() == R600::PRED_X) {
263 if (AluInstCount > 0)
266 PushBeforeModifier =
true;
284 if (!canClauseLocalKillFitInClause(AluInstCount, KCacheBanks, I,
E))
287 if (!SubstituteKCacheBank(*I, KCacheBanks))
289 AluInstCount += OccupiedDwords(*I);
291 unsigned Opcode = PushBeforeModifier ?
292 R600::CF_ALU_PUSH_BEFORE : R600::CF_ALU;
299 .
addImm(KCacheBanks.empty()?0:KCacheBanks[0].first)
300 .addImm((KCacheBanks.size() < 2)?0:KCacheBanks[1].first)
301 .
addImm(KCacheBanks.empty()?0:2)
302 .addImm((KCacheBanks.size() < 2)?0:2)
303 .
addImm(KCacheBanks.empty()?0:KCacheBanks[0].second)
304 .addImm((KCacheBanks.size() < 2)?0:KCacheBanks[1].
second)
325 if (I != MBB.
end() && I->getOpcode() == R600::CF_ALU)
329 auto next = MakeALUClause(MBB, I);
340 return "R600 Emit Clause Markers Pass";
349 "R600 Emit Clause Markters",
false,
false)
354 return new R600EmitClauseMarkers();
mop_iterator operands_end()
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
AMDGPU specific subclass of TargetSubtarget.
This class represents lattice values for constants.
Interface definition for R600InstrInfo.
void initializeR600EmitClauseMarkersPass(PassRegistry &)
unsigned getReg() const
getReg - Returns the register number.
unsigned const TargetRegisterInfo * TRI
Interface definition for R600RegisterInfo.
R600 Emit Clause Markters
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
const HexagonInstrInfo * TII
INITIALIZE_PASS_BEGIN(R600EmitClauseMarkers, "emitclausemarkers", "R600 Emit Clause Markters", false, false) INITIALIZE_PASS_END(R600EmitClauseMarkers
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
MachineOperand & getFlagOp(MachineInstr &MI, unsigned SrcIdx=0, unsigned Flag=0) const
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
unsigned getMaxAlusPerClause() const
bool mustBeLastInClause(unsigned Opcode) const
MachineInstrBuilder BuildMI(MachineFunction &MF, const DebugLoc &DL, const MCInstrDesc &MCID)
Builder interface. Specify how to create the initial instruction itself.
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")
DebugLoc findDebugLoc(instr_iterator MBBI)
Find the next valid DebugLoc starting at MBBI, skipping any DBG_VALUE and DBG_LABEL instructions...
const R600InstrInfo * getInstrInfo() const override
FunctionPass class - This class is used to implement most global optimizations.
const R600RegisterInfo & getRegisterInfo() const
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool isVector(const MachineInstr &MI) const
Vector instructions are instructions that must fill all instruction slots within an instruction group...
Iterator for intrusive lists based on ilist_node.
bool isPhysRegLiveAcrossClauses(unsigned Reg) const
MachineOperand class - Representation of each machine instruction operand.
FunctionPass * createR600EmitClauseMarkers()
bool isALUInstr(unsigned Opcode) const
bool isLDSRetInstr(unsigned Opcode) const
Provides AMDGPU specific target descriptions.
Representation of each machine instruction.
const MachineInstrBuilder & addImm(int64_t Val) const
Add a new immediate operand.
bool isReductionOp(unsigned opcode) const
SmallVector< std::pair< MachineOperand *, int64_t >, 3 > getSrcs(MachineInstr &MI) const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
mop_iterator operands_begin()
StringRef - Represent a constant reference to a string, i.e.
PassRegistry - This class manages the registration and intitialization of the pass subsystem as appli...
bool isCubeOp(unsigned opcode) const