34 bool NonePrinted =
true;
65 std::optional<unsigned int>
OpIdx, int64_t Imm)
const {
67 switch (
MI.getOpcode()) {
68 case AMDGPU::S_WAITCNT_DEPCTR:
69 printSWaitAluImm(Imm, OS);
71 case AMDGPU::S_DELAY_ALU:
73 printSDelayAluImm(Imm, OS);
90 case AMDGPU::S_WAITCNT_DEPCTR:
91 return parseSWaitAluImmMnemonic(
OpIdx, Imm, Src, ErrorCallback);
92 case AMDGPU::S_DELAY_ALU:
93 return parseSDelayAluImmMnemonic(
OpIdx, Imm, Src, ErrorCallback);
100void AMDGPUMIRFormatter::printSDelayAluImm(int64_t Imm,
105 constexpr int64_t
None = 0;
106 constexpr int64_t Same = 0;
115 OS <<
"VALU_DEP_" << Id;
117 OS <<
"TRANS32_DEP_" << Id - 4;
119 OS <<
"SALU_CYCLE_" << Id - 8;
127 if (Skip == Same && Id1 ==
None)
137 OS <<
"SKIP_" << Skip - 1;
143bool AMDGPUMIRFormatter::parseSWaitAluImmMnemonic(
147 if (!Src.consumeInteger(10, Imm))
156 return ErrorCallback(Src.begin(),
"expected prefix");
158 return ErrorCallback(Src.begin(),
"expected <CounterName>_<CounterNum>");
165 while (!Src.empty()) {
170 return ErrorCallback(Src.begin(),
"expected <CounterName>_<CounterNum>");
173 StringRef
Name = Src.substr(0, DelimIdx);
176 [[maybe_unused]]
bool ConsumeName = Src.consume_front(Name);
177 assert(ConsumeName &&
"Expected name");
178 [[maybe_unused]]
bool ConsumeDelim = Src.consume_front(
SWaitAluDelim);
179 assert(ConsumeDelim &&
"Expected delimiter");
188 if (Src.consumeInteger(10, Num) || Num < 0)
189 return ErrorCallback(NumPos,
190 "expected non-negative integer counter number");
215 return ErrorCallback(NamePos,
"invalid counter name");
219 return ErrorCallback(NumPos,
"counter value too large");
226bool AMDGPUMIRFormatter::parseSDelayAluImmMnemonic(
233 bool Expected = Src.consume_front(
".id0_");
235 return ErrorCallback(Src.begin(),
"Expected .id0_");
237 auto ExpectInt = [&](StringRef &Src, int64_t
Offset) -> int64_t {
239 if (!Src.consumeInteger(10, Dep))
245 auto DecodeDelay = [&](StringRef &Src) -> int64_t {
246 if (Src.consume_front(
"NONE"))
248 if (Src.consume_front(
"VALU_DEP_"))
249 return ExpectInt(Src, 0);
250 if (Src.consume_front(
"TRANS32_DEP_"))
251 return ExpectInt(Src, 4);
252 if (Src.consume_front(
"SALU_CYCLE_"))
253 return ExpectInt(Src, 8);
258 int64_t Delay0 = DecodeDelay(Src);
262 return ErrorCallback(Src.begin(),
"Could not decode delay0");
270 if (Src.begin() == Src.end())
273 Expected = Src.consume_front(
"_skip_");
275 return ErrorCallback(Src.begin(),
"Expected _skip_");
278 if (Src.consume_front(
"SAME")) {
280 }
else if (Src.consume_front(
"NEXT")) {
282 }
else if (Src.consume_front(
"SKIP_")) {
283 if (Src.consumeInteger(10, Skip)) {
284 return ErrorCallback(Src.begin(),
"Expected integer Skip value");
288 ErrorCallback(Src.begin(),
"Unexpected Skip Value");
291 Expected = Src.consume_front(
"_id1_");
293 return ErrorCallback(Src.begin(),
"Expected _id1_");
295 Delay1 = DecodeDelay(Src);
297 return ErrorCallback(Src.begin(),
"Could not decode delay1");
309 if (Src ==
"GWSResource") {
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineInstr unsigned OpIdx
A helper class to return the specified delimiter string after the first invocation of operator String...
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Representation of each machine instruction.
Special value supplied for machine level alias analysis.
This class keeps track of the SPI_SP_INPUT_ADDR config register, which tells the hardware which inter...
const AMDGPUGWSResourcePseudoSourceValue * getGWSPSV(const AMDGPUTargetMachine &TM)
A wrapper around a string literal that serves as a proxy for constructing global tables of StringRefs...
StringRef - Represent a constant reference to a string, i.e.
static constexpr size_t npos
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned decodeFieldVaVcc(unsigned Encoded)
unsigned encodeFieldVaVcc(unsigned Encoded, unsigned VaVcc)
unsigned decodeFieldHoldCnt(unsigned Encoded, const IsaVersion &Version)
unsigned getVaVccBitMask()
unsigned encodeFieldHoldCnt(unsigned Encoded, unsigned HoldCnt, const IsaVersion &Version)
unsigned getVmVsrcBitMask()
unsigned encodeFieldVaSsrc(unsigned Encoded, unsigned VaSsrc)
unsigned encodeFieldVaVdst(unsigned Encoded, unsigned VaVdst)
unsigned decodeFieldSaSdst(unsigned Encoded)
unsigned getHoldCntBitMask(const IsaVersion &Version)
unsigned decodeFieldVaSdst(unsigned Encoded)
unsigned getVaVdstBitMask()
unsigned getVaSsrcBitMask()
unsigned encodeFieldVmVsrc(unsigned Encoded, unsigned VmVsrc)
unsigned getVaSdstBitMask()
unsigned decodeFieldVaSsrc(unsigned Encoded)
unsigned encodeFieldSaSdst(unsigned Encoded, unsigned SaSdst)
unsigned decodeFieldVaVdst(unsigned Encoded)
unsigned getSaSdstBitMask()
int getDefaultDepCtrEncoding(const MCSubtargetInfo &STI)
unsigned decodeFieldVmVsrc(unsigned Encoded)
unsigned encodeFieldVaSdst(unsigned Encoded, unsigned VaSdst)
LLVM_ABI IsaVersion getIsaVersion(StringRef GPU)
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Version