Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DirectX] Rename DXILOperationCommon.h to DXILABI.h. NFC #78224

Conversation

bogner
Copy link
Contributor

@bogner bogner commented Jan 16, 2024

This is a good place to put all of the ABI-sensitive DXIL values that
we'll need in both reading and writing contexts.

Created using spr 1.3.5-bogner
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 16, 2024

@llvm/pr-subscribers-backend-directx

@llvm/pr-subscribers-llvm-support

Author: Justin Bogner (bogner)

Changes

This is a good place to put all of the ABI-sensitive DXIL values that
we'll need in both reading and writing contexts.


Full diff: https://github.com/llvm/llvm-project/pull/78224.diff

4 Files Affected:

  • (added) llvm/include/llvm/Support/DXILABI.h (+45)
  • (removed) llvm/include/llvm/Support/DXILOperationCommon.h (-63)
  • (modified) llvm/lib/Target/DirectX/DXILOpBuilder.cpp (+1-1)
  • (modified) llvm/utils/TableGen/DXILEmitter.cpp (+19-1)
diff --git a/llvm/include/llvm/Support/DXILABI.h b/llvm/include/llvm/Support/DXILABI.h
new file mode 100644
index 00000000000000..e2a8fbad16bb3f
--- /dev/null
+++ b/llvm/include/llvm/Support/DXILABI.h
@@ -0,0 +1,45 @@
+//===-- DXILABI.h - ABI Sensitive Values for DXIL ---------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains definitions of various constants and enums that are
+// required to remain stable as per the DXIL format's requirements.
+//
+// Documentation for DXIL can be found in
+// https://github.com/Microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_DXILABI_H
+#define LLVM_SUPPORT_DXILABI_H
+
+#include "llvm/ADT/StringSwitch.h"
+
+namespace llvm {
+namespace dxil {
+
+enum class ParameterKind : uint8_t {
+  INVALID = 0,
+  VOID,
+  HALF,
+  FLOAT,
+  DOUBLE,
+  I1,
+  I8,
+  I16,
+  I32,
+  I64,
+  OVERLOAD,
+  CBUFFER_RET,
+  RESOURCE_RET,
+  DXIL_HANDLE,
+};
+
+} // namespace dxil
+} // namespace llvm
+
+#endif // LLVM_SUPPORT_DXILABI_H
diff --git a/llvm/include/llvm/Support/DXILOperationCommon.h b/llvm/include/llvm/Support/DXILOperationCommon.h
deleted file mode 100644
index 134f92710b6264..00000000000000
--- a/llvm/include/llvm/Support/DXILOperationCommon.h
+++ /dev/null
@@ -1,63 +0,0 @@
-//===-- DXILOperationCommon.h - DXIL Operation ------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-//
-// This file is created to share common definitions used by both the
-// DXILOpBuilder and the table
-//  generator.
-// Documentation for DXIL can be found in
-// https://github.com/Microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_DXILOPERATIONCOMMON_H
-#define LLVM_SUPPORT_DXILOPERATIONCOMMON_H
-
-#include "llvm/ADT/StringSwitch.h"
-
-namespace llvm {
-namespace dxil {
-
-enum class ParameterKind : uint8_t {
-  INVALID = 0,
-  VOID,
-  HALF,
-  FLOAT,
-  DOUBLE,
-  I1,
-  I8,
-  I16,
-  I32,
-  I64,
-  OVERLOAD,
-  CBUFFER_RET,
-  RESOURCE_RET,
-  DXIL_HANDLE,
-};
-
-inline ParameterKind parameterTypeNameToKind(StringRef Name) {
-  return StringSwitch<ParameterKind>(Name)
-      .Case("void", ParameterKind::VOID)
-      .Case("half", ParameterKind::HALF)
-      .Case("float", ParameterKind::FLOAT)
-      .Case("double", ParameterKind::DOUBLE)
-      .Case("i1", ParameterKind::I1)
-      .Case("i8", ParameterKind::I8)
-      .Case("i16", ParameterKind::I16)
-      .Case("i32", ParameterKind::I32)
-      .Case("i64", ParameterKind::I64)
-      .Case("$o", ParameterKind::OVERLOAD)
-      .Case("dx.types.Handle", ParameterKind::DXIL_HANDLE)
-      .Case("dx.types.CBufRet", ParameterKind::CBUFFER_RET)
-      .Case("dx.types.ResRet", ParameterKind::RESOURCE_RET)
-      .Default(ParameterKind::INVALID);
-}
-
-} // namespace dxil
-} // namespace llvm
-
-#endif
diff --git a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
index 59fe6d45757aad..42180a865b72e3 100644
--- a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
@@ -13,7 +13,7 @@
 #include "DXILConstants.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/Module.h"
-#include "llvm/Support/DXILOperationCommon.h"
+#include "llvm/Support/DXILABI.h"
 #include "llvm/Support/ErrorHandling.h"
 
 using namespace llvm;
diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp
index a199463961be41..ddc7cfb8134470 100644
--- a/llvm/utils/TableGen/DXILEmitter.cpp
+++ b/llvm/utils/TableGen/DXILEmitter.cpp
@@ -16,7 +16,7 @@
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/DXILOperationCommon.h"
+#include "llvm/Support/DXILABI.h"
 #include "llvm/TableGen/Record.h"
 #include "llvm/TableGen/TableGenBackend.h"
 
@@ -103,6 +103,24 @@ struct DXILOperationData {
 };
 } // end anonymous namespace
 
+static ParameterKind parameterTypeNameToKind(StringRef Name) {
+  return StringSwitch<ParameterKind>(Name)
+      .Case("void", ParameterKind::VOID)
+      .Case("half", ParameterKind::HALF)
+      .Case("float", ParameterKind::FLOAT)
+      .Case("double", ParameterKind::DOUBLE)
+      .Case("i1", ParameterKind::I1)
+      .Case("i8", ParameterKind::I8)
+      .Case("i16", ParameterKind::I16)
+      .Case("i32", ParameterKind::I32)
+      .Case("i64", ParameterKind::I64)
+      .Case("$o", ParameterKind::OVERLOAD)
+      .Case("dx.types.Handle", ParameterKind::DXIL_HANDLE)
+      .Case("dx.types.CBufRet", ParameterKind::CBUFFER_RET)
+      .Case("dx.types.ResRet", ParameterKind::RESOURCE_RET)
+      .Default(ParameterKind::INVALID);
+}
+
 DXILParam::DXILParam(const Record *R) {
   Name = R->getValueAsString("name");
   Pos = R->getValueAsInt("pos");

Created using spr 1.3.5-bogner
@bogner bogner merged commit db6bf92 into main Jan 29, 2024
3 of 4 checks passed
@bogner bogner deleted the users/bogner/sprdirectx-rename-dxiloperationcommonh-to-dxilabih-nfc branch January 29, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants