Skip to content

Commit cf277f0

Browse files
committed
[M68k][NFC] Coalesce render methods in different asm register op class
And assign RegClass (i.e. operand class for all GPR) as the super class of ARegClass and DRegClass. Note that this is a NFC change because actually we already had XRDReg to model either address or data register operands (as well as test coverage for it). The new super class syntax added here is just making the relations between three RegClass-es more explicit.
1 parent 1a18bb9 commit cf277f0

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

llvm/lib/Target/M68k/AsmParser/M68kAsmParser.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,6 @@ class M68kOperand : public MCParsedAsmOperand {
153153
bool isDReg() const;
154154
unsigned getReg() const override;
155155
void addRegOperands(MCInst &Inst, unsigned N) const;
156-
void addARegOperands(MCInst &Inst, unsigned N) const {
157-
addRegOperands(Inst, N);
158-
}
159-
void addDRegOperands(MCInst &Inst, unsigned N) const {
160-
addRegOperands(Inst, N);
161-
}
162156

163157
static std::unique_ptr<M68kOperand> createMemOp(M68kMemOp MemOp, SMLoc Start,
164158
SMLoc End);

llvm/lib/Target/M68k/M68kInstrInfo.td

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,10 @@ def MxRegClass : MxOpClass<"Reg">;
176176
// both ADD32dd and ADD32dr has {MCK_RegClass, MCK_RegClass} for
177177
// their operands, which makes AsmParser unable to pick the correct
178178
// one in a deterministic way.
179-
def MxARegClass : MxOpClass<"AReg">;
180-
def MxDRegClass : MxOpClass<"DReg">;
179+
let RenderMethod = "addRegOperands", SuperClasses = [MxRegClass] in {
180+
def MxARegClass : MxOpClass<"AReg">;
181+
def MxDRegClass : MxOpClass<"DReg">;
182+
}
181183

182184
class MxOperand<ValueType vt, MxSize size, string letter, RegisterClass rc, dag pat = (null_frag)> {
183185
ValueType VT = vt;

0 commit comments

Comments
 (0)