[clang] [NFC][HLSL] Cleanup TargetInfo handling (PR #90694)

Chris B via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 18:54:14 PDT 2024


================
@@ -406,6 +406,16 @@ void TargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) {
     LongDoubleAlign = 64;
   }
 
+  // HLSL explicitly defines the sizes and formats of some data types, and we
+  // need to conform to those regardless of what architecture you are targeting.
+  if (Opts.HLSL) {
+    LongWidth = LongAlign = 64;
+    if (!Opts.NativeHalfType) {
+      HalfFormat = &llvm::APFloat::IEEEsingle();
+      HalfWidth = HalfAlign = 32;
----------------
llvm-beanz wrote:

Just as a note, we don't actually use this value anywhere in the HLSL code generation paths (yet), which is why it wasn't causing problems that we overrode the format returned by the AST context, but didn't override these values.

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


More information about the cfe-commits mailing list