================
@@ -1196,36 +1196,93 @@ SmallVector<PrototypeDescriptor> 
parsePrototypes(StringRef Prototypes) {
   return PrototypeDescriptors;
 }
 
+#define STRINGIFY(NAME)                                                        
\
+  case NAME:                                                                   
\
+    OS << #NAME;                                                               
\
+    break;
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, enum PolicyScheme PS) {
+  switch (PS) {
+    STRINGIFY(SchemeNone)
+    STRINGIFY(HasPassthruOperand)
+    STRINGIFY(HasPolicyOperand)
+  }
+  return OS;
+}
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, enum RVVRequire Require) {
+  switch (Require) {
+    STRINGIFY(RVV_REQ_RV64)
+    STRINGIFY(RVV_REQ_Zvfhmin)
+    STRINGIFY(RVV_REQ_Xsfvcp)
+    STRINGIFY(RVV_REQ_Xsfvfnrclipxfqf)
+    STRINGIFY(RVV_REQ_Xsfvfwmaccqqq)
+    STRINGIFY(RVV_REQ_Xsfvqmaccdod)
+    STRINGIFY(RVV_REQ_Xsfvqmaccqoq)
+    STRINGIFY(RVV_REQ_Zvbb)
+    STRINGIFY(RVV_REQ_Zvbc)
+    STRINGIFY(RVV_REQ_Zvkb)
+    STRINGIFY(RVV_REQ_Zvkg)
+    STRINGIFY(RVV_REQ_Zvkned)
+    STRINGIFY(RVV_REQ_Zvknha)
+    STRINGIFY(RVV_REQ_Zvknhb)
+    STRINGIFY(RVV_REQ_Zvksed)
+    STRINGIFY(RVV_REQ_Zvksh)
+    STRINGIFY(RVV_REQ_Zvfbfwma)
+    STRINGIFY(RVV_REQ_Zvfbfmin)
+    STRINGIFY(RVV_REQ_Zvfh)
+    STRINGIFY(RVV_REQ_Experimental)
+  default:
+    break;
+  }
+  return OS;
+}
+
+#undef STRINGIFY
+
+llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
+                              const RequiredExtensions &Exts) {
+  OS << "{";
+  const char *Sep = "";
+  for (unsigned I = 0; I < RVV_REQ_NUM; I++) {
+    if (Exts[I]) {
+      OS << Sep << static_cast<RVVRequire>(I);
+      Sep = ", ";
+    }
+  }
----------------
kito-cheng wrote:

There is a small utils class to do that:
```suggestion
  ListSeparator LS;
  for (unsigned I = 0; I < RVV_REQ_NUM; I++) {
    if (Exts[I]) {
      OS << LS << static_cast<RVVRequire>(I);
    }
  }
```

https://github.com/llvm/llvm-project/pull/133710
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to