Skip to content

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

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions llvm/include/llvm/Support/DXILABI.h
Original file line number Diff line number Diff line change
@@ -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
63 changes: 0 additions & 63 deletions llvm/include/llvm/Support/DXILOperationCommon.h

This file was deleted.

2 changes: 1 addition & 1 deletion llvm/lib/Target/DirectX/DXILOpBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 19 additions & 1 deletion llvm/utils/TableGen/DXILEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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");
Expand Down