Browse Source

Move HLSLDefaultRowMajor to LangOptions. (#5098)

This is for use the information in Sema.
Xiang Li 2 years ago
parent
commit
3ef0ccc76d

+ 2 - 0
tools/clang/include/clang/Basic/LangOptions.h

@@ -161,6 +161,8 @@ public:
   bool EnableFXCCompatMode = false;
   bool EnableFXCCompatMode = false;
   bool EnablePayloadAccessQualifiers = false;
   bool EnablePayloadAccessQualifiers = false;
   bool DumpImplicitTopLevelDecls = true;
   bool DumpImplicitTopLevelDecls = true;
+  /// Whether use row major as default matrix major.
+  bool HLSLDefaultRowMajor = false;
   // HLSL Change Ends
   // HLSL Change Ends
 
 
   bool SPIRV = false;  // SPIRV Change
   bool SPIRV = false;  // SPIRV Change

+ 0 - 2
tools/clang/include/clang/Frontend/CodeGenOptions.h

@@ -184,8 +184,6 @@ public:
   bool HLSLAllowPreserveValues = false;
   bool HLSLAllowPreserveValues = false;
   /// Whether we fail compilation if loop fails to unroll
   /// Whether we fail compilation if loop fails to unroll
   bool HLSLOnlyWarnOnUnrollFail = false;
   bool HLSLOnlyWarnOnUnrollFail = false;
-  /// Whether use row major as default matrix major.
-  bool HLSLDefaultRowMajor = false;
   /// Whether use legacy cbuffer load.
   /// Whether use legacy cbuffer load.
   bool HLSLNotUseLegacyCBufLoad = false;
   bool HLSLNotUseLegacyCBufLoad = false;
   /// Whether use legacy resource reservation.
   /// Whether use legacy resource reservation.

+ 1 - 1
tools/clang/lib/CodeGen/CGHLSLMS.cpp

@@ -378,7 +378,6 @@ CGMSHLSLRuntime::CGMSHLSLRuntime(CodeGenModule &CGM)
   // Set Option.
   // Set Option.
   HLOptions opts;
   HLOptions opts;
   opts.bIEEEStrict = CGM.getCodeGenOpts().UnsafeFPMath;
   opts.bIEEEStrict = CGM.getCodeGenOpts().UnsafeFPMath;
-  opts.bDefaultRowMajor = CGM.getCodeGenOpts().HLSLDefaultRowMajor;
   opts.bDisableOptimizations = CGM.getCodeGenOpts().DisableLLVMOpts;
   opts.bDisableOptimizations = CGM.getCodeGenOpts().DisableLLVMOpts;
   opts.bLegacyCBufferLoad = !CGM.getCodeGenOpts().HLSLNotUseLegacyCBufLoad;
   opts.bLegacyCBufferLoad = !CGM.getCodeGenOpts().HLSLNotUseLegacyCBufLoad;
   opts.bAllResourcesBound = CGM.getCodeGenOpts().HLSLAllResourcesBound;
   opts.bAllResourcesBound = CGM.getCodeGenOpts().HLSLAllResourcesBound;
@@ -387,6 +386,7 @@ CGMSHLSLRuntime::CGMSHLSLRuntime(CodeGenModule &CGM)
   opts.bLegacyResourceReservation = CGM.getCodeGenOpts().HLSLLegacyResourceReservation;
   opts.bLegacyResourceReservation = CGM.getCodeGenOpts().HLSLLegacyResourceReservation;
   opts.bForceZeroStoreLifetimes = CGM.getCodeGenOpts().HLSLForceZeroStoreLifetimes;
   opts.bForceZeroStoreLifetimes = CGM.getCodeGenOpts().HLSLForceZeroStoreLifetimes;
 
 
+  opts.bDefaultRowMajor = CGM.getLangOpts().HLSLDefaultRowMajor;
   opts.bUseMinPrecision = CGM.getLangOpts().UseMinPrecision;
   opts.bUseMinPrecision = CGM.getLangOpts().UseMinPrecision;
   opts.bDX9CompatMode = CGM.getLangOpts().EnableDX9CompatMode;
   opts.bDX9CompatMode = CGM.getLangOpts().EnableDX9CompatMode;
   opts.bFXCCompatMode = CGM.getLangOpts().EnableFXCCompatMode;
   opts.bFXCCompatMode = CGM.getLangOpts().EnableFXCCompatMode;

+ 1 - 1
tools/clang/tools/dxcompiler/dxcompilerobj.cpp

@@ -1504,6 +1504,7 @@ public:
     // allows us to dump implicit AST nodes in the debugger.
     // allows us to dump implicit AST nodes in the debugger.
     compiler.getLangOpts().DumpImplicitTopLevelDecls =
     compiler.getLangOpts().DumpImplicitTopLevelDecls =
         Opts.AstDumpImplicit || !Opts.AstDump;
         Opts.AstDumpImplicit || !Opts.AstDump;
+    compiler.getLangOpts().HLSLDefaultRowMajor = Opts.DefaultRowMajor;
 
 
 // SPIRV change starts
 // SPIRV change starts
 #ifdef ENABLE_SPIRV_CODEGEN
 #ifdef ENABLE_SPIRV_CODEGEN
@@ -1549,7 +1550,6 @@ public:
     compiler.getCodeGenOpts().HLSLIgnoreOptSemDefs = Opts.IgnoreOptSemDefs;
     compiler.getCodeGenOpts().HLSLIgnoreOptSemDefs = Opts.IgnoreOptSemDefs;
     compiler.getCodeGenOpts().HLSLIgnoreSemDefs = Opts.IgnoreSemDefs;
     compiler.getCodeGenOpts().HLSLIgnoreSemDefs = Opts.IgnoreSemDefs;
     compiler.getCodeGenOpts().HLSLOverrideSemDefs = Opts.OverrideSemDefs;
     compiler.getCodeGenOpts().HLSLOverrideSemDefs = Opts.OverrideSemDefs;
-    compiler.getCodeGenOpts().HLSLDefaultRowMajor = Opts.DefaultRowMajor;
     compiler.getCodeGenOpts().HLSLPreferControlFlow = Opts.PreferFlowControl;
     compiler.getCodeGenOpts().HLSLPreferControlFlow = Opts.PreferFlowControl;
     compiler.getCodeGenOpts().HLSLAvoidControlFlow = Opts.AvoidFlowControl;
     compiler.getCodeGenOpts().HLSLAvoidControlFlow = Opts.AvoidFlowControl;
     compiler.getCodeGenOpts().HLSLNotUseLegacyCBufLoad = Opts.NotUseLegacyCBufLoad;
     compiler.getCodeGenOpts().HLSLNotUseLegacyCBufLoad = Opts.NotUseLegacyCBufLoad;