[clang] [HLSL] Make HLSLAttributedResourceType canonical and add code paths to convert HLSL types to DirectX target types (PR #110327)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 11:22:57 PDT 2024


================
@@ -3753,6 +3754,32 @@ void MicrosoftCXXNameMangler::mangleType(const DependentBitIntType *T,
   Error(Range.getBegin(), "DependentBitInt type") << Range;
 }
 
+void MicrosoftCXXNameMangler::mangleType(const HLSLAttributedResourceType *T,
+                                         Qualifiers, SourceRange Range) {
+  mangleType(T->getWrappedType(), SourceRange(), QMM_Escape);
+  const HLSLAttributedResourceType::Attributes &Attrs = T->getAttrs();
+  // map resource class to HLSL virtual register letter
+  switch (Attrs.ResourceClass) {
+  case llvm::dxil::ResourceClass::UAV:
+    Out << 'u';
+    break;
+  case llvm::dxil::ResourceClass::SRV:
+    Out << 't';
+    break;
+  case llvm::dxil::ResourceClass::CBuffer:
+    Out << 'b';
+    break;
+  case llvm::dxil::ResourceClass::Sampler:
+    Out << 's';
+    break;
+  }
----------------
hekota wrote:

The plan is to switch DirectX to Itanium ABI (llvm/llvm-project#110736). Changing the Microsoft mangling to just typename.

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


More information about the cfe-commits mailing list