[llvm] [ValueTypes][NFC] Generate EVT::getTypeForEVT from GenVT.inc (PR #96608)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 16:13:57 PDT 2024


================
@@ -27,6 +27,47 @@ class VTEmitter {
   void run(raw_ostream &OS);
 };
 
+static void VTtoGetLLVMTyString(raw_ostream &OS, const Record *VT) {
+  bool IsVector = VT->getValueAsBit("isVector");
+  if (IsVector)
+    OS << (VT->getValueAsBit("isScalable") ? "Scalable" : "Fixed")
+       << "VectorType::get(";
+
+  auto OutputVT = IsVector ? VT->getValueAsDef("ElementType") : VT;
+  int64_t OutputVTSize = OutputVT->getValueAsInt("Size");
+
+  if (OutputVT->getValueAsBit("isFP")) {
+    StringRef FloatTy = "";
----------------
topperc wrote:

You don't need to initialize this. It will default to a nullptr with size 0 which is the same as an empty string as far a StringRef is concerned.

https://github.com/llvm/llvm-project/pull/96608


More information about the llvm-commits mailing list