Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line | 
|---|---|---|---|
| 14 | pmbaty | 1 | //===-- DXILOperationCommon.h - DXIL Operation ------------------*- C++ -*-===// | 
| 2 | // | ||
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| 4 | // See https://llvm.org/LICENSE.txt for license information. | ||
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| 6 | // | ||
| 7 | //===----------------------------------------------------------------------===// | ||
| 8 | // | ||
| 9 | // This file is created to share common definitions used by both the | ||
| 10 | // DXILOpBuilder and the table | ||
| 11 | //  generator. | ||
| 12 | // Documentation for DXIL can be found in | ||
| 13 | // https://github.com/Microsoft/DirectXShaderCompiler/blob/main/docs/DXIL.rst. | ||
| 14 | // | ||
| 15 | //===----------------------------------------------------------------------===// | ||
| 16 | |||
| 17 | #ifndef LLVM_SUPPORT_DXILOPERATIONCOMMON_H | ||
| 18 | #define LLVM_SUPPORT_DXILOPERATIONCOMMON_H | ||
| 19 | |||
| 20 | #include "llvm/ADT/StringSwitch.h" | ||
| 21 | |||
| 22 | namespace llvm { | ||
| 23 | namespace dxil { | ||
| 24 | |||
| 25 | enum class ParameterKind : uint8_t { | ||
| 26 | INVALID = 0, | ||
| 27 | VOID, | ||
| 28 | HALF, | ||
| 29 | FLOAT, | ||
| 30 | DOUBLE, | ||
| 31 | I1, | ||
| 32 | I8, | ||
| 33 | I16, | ||
| 34 | I32, | ||
| 35 | I64, | ||
| 36 | OVERLOAD, | ||
| 37 | CBUFFER_RET, | ||
| 38 | RESOURCE_RET, | ||
| 39 | DXIL_HANDLE, | ||
| 40 | }; | ||
| 41 | |||
| 42 | inline ParameterKind parameterTypeNameToKind(StringRef Name) { | ||
| 43 | return StringSwitch<ParameterKind>(Name) | ||
| 44 | .Case("void", ParameterKind::VOID) | ||
| 45 | .Case("half", ParameterKind::HALF) | ||
| 46 | .Case("float", ParameterKind::FLOAT) | ||
| 47 | .Case("double", ParameterKind::DOUBLE) | ||
| 48 | .Case("i1", ParameterKind::I1) | ||
| 49 | .Case("i8", ParameterKind::I8) | ||
| 50 | .Case("i16", ParameterKind::I16) | ||
| 51 | .Case("i32", ParameterKind::I32) | ||
| 52 | .Case("i64", ParameterKind::I64) | ||
| 53 | .Case("$o", ParameterKind::OVERLOAD) | ||
| 54 | .Case("dx.types.Handle", ParameterKind::DXIL_HANDLE) | ||
| 55 | .Case("dx.types.CBufRet", ParameterKind::CBUFFER_RET) | ||
| 56 | .Case("dx.types.ResRet", ParameterKind::RESOURCE_RET) | ||
| 57 | .Default(ParameterKind::INVALID); | ||
| 58 | } | ||
| 59 | |||
| 60 | } // namespace dxil | ||
| 61 | } // namespace llvm | ||
| 62 | |||
| 63 | #endif |