[llvm] [DirectX][NFC] Change specification of overload types and attribute in DXIL.td (PR #81184)

S. Bharadwaj Yadavalli via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 09:37:08 PST 2024


================
@@ -267,38 +296,51 @@ static void emitDXILIntrinsicMap(std::vector<DXILOperationDesc> &Ops,
   OS << "\n";
 }
 
-static std::string emitDXILOperationFnAttr(StringRef FnAttr) {
-  return StringSwitch<std::string>(FnAttr)
-      .Case("rn", "Attribute::ReadNone")
-      .Case("ro", "Attribute::ReadOnly")
+// Convert operation attribute string to Attribute enum
+//
+// @param Attr string reference
+// @return std::string Attribute enum string
+static std::string emitDXILOperationAttr(StringRef Attr) {
+  return StringSwitch<std::string>(Attr)
----------------
bharadwajy wrote:

> I see this is just following the existing code, but should we add some error handling for unexpected attributes here?

Specification of an attribute that is not an `EnumAttr` will be flagged by `tblgen` even before the `DXILEmitter` backend is invoked. So, additional checks here are not necessary.

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


More information about the llvm-commits mailing list