Skip to content

Commit 8604d8b

Browse files
kosarevChenyang-L
authored andcommitted
[AMDGPU][AsmParser] Eliminate cvtMtbuf().
Now that we have proper support for optional operands, the standard LLVM machinery can take care of converting parsed instructions to MCInsts. There are likely more cases where the conversion can be done automatically, probably with some additional treatment. The plan is to address them separately. Part of <llvm/llvm-project#62629>. Reviewed By: arsenm, foad Differential Revision: https://reviews.llvm.org/D153565
1 parent 07d180a commit 8604d8b

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,7 +1752,6 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
17521752

17531753
void cvtMubuf(MCInst &Inst, const OperandVector &Operands) { cvtMubufImpl(Inst, Operands, false); }
17541754
void cvtMubufAtomic(MCInst &Inst, const OperandVector &Operands) { cvtMubufImpl(Inst, Operands, true); }
1755-
void cvtMtbuf(MCInst &Inst, const OperandVector &Operands);
17561755

17571756
OperandMatchResultTy parseOModSI(OperandVector &Operands);
17581757

@@ -7780,42 +7779,6 @@ void AMDGPUAsmParser::cvtMubufImpl(MCInst &Inst,
77807779
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySWZ);
77817780
}
77827781

7783-
void AMDGPUAsmParser::cvtMtbuf(MCInst &Inst, const OperandVector &Operands) {
7784-
OptionalImmIndexMap OptionalIdx;
7785-
7786-
for (unsigned i = 1, e = Operands.size(); i != e; ++i) {
7787-
AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[i]);
7788-
7789-
// Add the register arguments
7790-
if (Op.isReg()) {
7791-
Op.addRegOperands(Inst, 1);
7792-
continue;
7793-
}
7794-
7795-
// Handle the case where soffset is an immediate
7796-
if (Op.isImm() && Op.getImmTy() == AMDGPUOperand::ImmTyNone) {
7797-
Op.addImmOperands(Inst, 1);
7798-
continue;
7799-
}
7800-
7801-
// Handle tokens like 'offen' which are sometimes hard-coded into the
7802-
// asm string. There are no MCInst operands for these.
7803-
if (Op.isToken()) {
7804-
continue;
7805-
}
7806-
assert(Op.isImm());
7807-
7808-
// Handle optional arguments
7809-
OptionalIdx[Op.getImmTy()] = i;
7810-
}
7811-
7812-
addOptionalImmOperand(Inst, Operands, OptionalIdx,
7813-
AMDGPUOperand::ImmTyOffset);
7814-
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyFORMAT);
7815-
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTyCPol, 0);
7816-
addOptionalImmOperand(Inst, Operands, OptionalIdx, AMDGPUOperand::ImmTySWZ);
7817-
}
7818-
78197782
//===----------------------------------------------------------------------===//
78207783
// mimg
78217784
//===----------------------------------------------------------------------===//

llvm/lib/Target/AMDGPU/BUFInstructions.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ class MTBUF_Pseudo <string opName, dag outs, dag ins,
110110

111111
Instruction BaseOpcode = !cast<Instruction>(MTBUFGetBaseOpcode<NAME>.ret);
112112
let MTBUF = 1;
113-
let AsmMatchConverter = "cvtMtbuf";
114113
}
115114

116115
class MTBUF_Real <MTBUF_Pseudo ps, string real_name = ps.Mnemonic> :

0 commit comments

Comments
 (0)