https://github.com/bogner updated https://github.com/llvm/llvm-project/pull/78224
>From 698fb909b55b9134b23da7ec1c87c75375f950b4 Mon Sep 17 00:00:00 2001 From: Justin Bogner <m...@justinbogner.com> Date: Mon, 15 Jan 2024 18:32:54 -0800 Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?= =?UTF-8?q?l=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.5-bogner --- llvm/include/llvm/Support/DXILABI.h | 45 +++++++++++++ .../llvm/Support/DXILOperationCommon.h | 63 ------------------- llvm/lib/Target/DirectX/DXILOpBuilder.cpp | 2 +- llvm/utils/TableGen/DXILEmitter.cpp | 20 +++++- 4 files changed, 65 insertions(+), 65 deletions(-) create mode 100644 llvm/include/llvm/Support/DXILABI.h delete mode 100644 llvm/include/llvm/Support/DXILOperationCommon.h 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"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits