[M68k][NFC] Coalesce render methods in different asm register op class
authorMin-Yih Hsu <minyihh@uci.edu>
Sun, 8 Aug 2021 22:41:03 +0000 (15:41 -0700)
committerMin-Yih Hsu <minyihh@uci.edu>
Mon, 9 Aug 2021 07:07:19 +0000 (00:07 -0700)
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.

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

index e9ce389..bde44d4 100644 (file)
@@ -153,12 +153,6 @@ public:
   bool isDReg() const;
   unsigned getReg() const override;
   void addRegOperands(MCInst &Inst, unsigned N) const;
-  void addARegOperands(MCInst &Inst, unsigned N) const {
-    addRegOperands(Inst, N);
-  }
-  void addDRegOperands(MCInst &Inst, unsigned N) const {
-    addRegOperands(Inst, N);
-  }
 
   static std::unique_ptr<M68kOperand> createMemOp(M68kMemOp MemOp, SMLoc Start,
                                                   SMLoc End);
index e465f25..3825c24 100644 (file)
@@ -176,8 +176,10 @@ def MxRegClass : MxOpClass<"Reg">;
 // both ADD32dd and ADD32dr has {MCK_RegClass, MCK_RegClass} for
 // their operands, which makes AsmParser unable to pick the correct
 // one in a deterministic way.
-def MxARegClass : MxOpClass<"AReg">;
-def MxDRegClass : MxOpClass<"DReg">;
+let RenderMethod = "addRegOperands", SuperClasses = [MxRegClass] in {
+  def MxARegClass : MxOpClass<"AReg">;
+  def MxDRegClass : MxOpClass<"DReg">;
+}
 
 class MxOperand<ValueType vt, MxSize size, string letter, RegisterClass rc, dag pat = (null_frag)> {
   ValueType VT = vt;