[PATCH] D137653: [TableGen] More named sub-operands work.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 13 00:03:45 PST 2022


MaskRay added inline comments.


================
Comment at: llvm/lib/Target/ARM/ARMInstrFormats.td:276
   let OperandType = "OPERAND_VPRED_N";
+  let DecoderMethod = "DecodeVpredNOperand";
   let vpred_constraint = "";
----------------
OK. This is to avoid `lib/Target/ARM/ARMInstrCDE.td:530:5: error: DecoderEmitter: operand "vp" uses MIOperandInfo with multiple ops, but doesn't have a custom decoder!`


================
Comment at: llvm/utils/TableGen/DecoderEmitter.cpp:1909
 
+static void DebugDumpRecord(const Record &Rec) {
+  // Dump the record, so we can see what's going on...
----------------



================
Comment at: llvm/utils/TableGen/DecoderEmitter.cpp:2239
 
       // At this point, we can locate the decoder field, but we need to know how
       // to interpret it.  As a first step, require the target to provide
----------------
The comment appears outdated/unclear even before this patch. Could you reword it?


================
Comment at: llvm/utils/TableGen/DecoderEmitter.cpp:2248
+      OperandInfo OpInfo = getOpInfo(OpTypeRec);
+      DagInit *SubOps = OpTypeRec->isSubClassOf("Operand")
+                            ? OpTypeRec->getValueAsDag("MIOperandInfo")
----------------
`OpTypeRec->isSubClassOf("Operand")` is worth a comment.


================
Comment at: llvm/utils/TableGen/DecoderEmitter.cpp:2285
+        if (SubOps->getNumArgs() == 1) {
+          OpInfo = getOpInfo(cast<DefInit>(SubOps->getArg(0))->getDef());
+        }
----------------
Delete braces for the single simple statement


================
Comment at: llvm/utils/TableGen/DecoderEmitter.cpp:2289
+        // decoder. (Otherwise we don't know how to populate them properly...)
+        if (SubOps && SubOps->getNumArgs() > 1) {
+          PrintError(EncodingDef.getLoc(),
----------------



================
Comment at: llvm/utils/TableGen/DecoderEmitter.cpp:2290
+        if (SubOps && SubOps->getNumArgs() > 1) {
+          PrintError(EncodingDef.getLoc(),
+                     "DecoderEmitter: operand \"" + OpName +
----------------
Add a test/TableGen test for this error if it isn't too difficult?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137653/new/

https://reviews.llvm.org/D137653



More information about the llvm-commits mailing list