[PATCH] D95016: [Clang][RISCV] Add custom TableGen backend for riscv-vector intrinsics.

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 08:51:50 PST 2021


craig.topper added inline comments.


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:678
+    else
+      OS << ", Ops[" << Twine(static_cast<unsigned>(Idx)) << "]->getType()";
+  }
----------------
We don't need Twine here


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:684
+  if (hasVL())
+    OS << ", Ops[" + utostr(getNumOperand() - 1) + "]->getType()";
+  OS << "};\n";
----------------
Replace + with << and drop utostr


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:691
+  if (getNumOperand() > 0) {
+    OS << "op" << Twine(CTypeOrder[0]);
+    for (unsigned i = 1; i < CTypeOrder.size(); ++i)
----------------
Drop Twine


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:693
+    for (unsigned i = 1; i < CTypeOrder.size(); ++i)
+      OS << ", op" << Twine(CTypeOrder[i]);
+  }
----------------
Drop Twine


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:700
+    for (unsigned i = 1; i < InputTypes.size(); ++i)
+      OS << ", (" << InputTypes[i]->getTypeStr() + ")(op" << Twine(i) << ")";
+  }
----------------
Drop Twine


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:710
+  if (getNumOperand() > 0) {
+    OS << InputTypes[CTypeOrder[0]]->getTypeStr() + " op0";
+    for (unsigned i = 1; i < CTypeOrder.size(); ++i)
----------------
Replace + with <<


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:713
+      OS << ", " << InputTypes[CTypeOrder[i]]->getTypeStr() << " op"
+         << Twine(i);
+  }
----------------
Drop Twine


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:789
+    auto T = computeType('h', Log2LMUL, "v");
+    // first.
+    if (T.hasValue())
----------------
This comment looks incomplete


================
Comment at: clang/utils/TableGen/RISCVVEmitter.cpp:872
+      PrevDef->emitCodeGenSwitchBody(OS);
+      OS << "break;\n";
+    }
----------------
Should we sink the printing of break; into emitCodeGenSwitchBody so its not repeated after the other call to emitCodeGenSwitchBody?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95016



More information about the cfe-commits mailing list