LLVM 24.0.0git
SemanticSignatures.h
Go to the documentation of this file.
1//===- SemanticSignatures.h - HLSL Semantic Signature helper objects ------===//
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/// \file This file contains structure definitions of HLSL Semantic Signature
10/// objects.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_FRONTEND_HLSL_SEMANTICSIGNATURES_H
15#define LLVM_FRONTEND_HLSL_SEMANTICSIGNATURES_H
16
18#include "llvm/ADT/StringRef.h"
22#include "llvm/Support/Error.h"
23#include <cstdint>
24
25namespace llvm {
26
27class LLVMContext;
28class MDNode;
29
30namespace hlsl {
31
32// Definitions of the in-memory data layout structures
33
34// Sentinel values denoting that an element is unallocated
35static constexpr uint32_t UnallocatedRow = ~0U;
36static constexpr uint8_t UnallocatedCol = 0xFF;
37
38// Models a single packed range of signature rows with its semantic name and
39// indices, register placement, component masks, and stage-specific attributes.
47 dxbc::PSV::InterpolationMode::Undefined;
55
56 bool isAllocated() const {
58 }
59
61 if (!isAllocated())
62 return 0;
63 return static_cast<uint8_t>(((1U << Cols) - 1U) << StartCol);
64 }
65
67
69 return static_cast<uint8_t>(~UsageMask & getDeclaredMask());
70 }
71
72 dxbc::SigMinPrecision getMinPrecision(bool UseMinPrecision) const {
73 if (!UseMinPrecision)
74 return dxbc::SigMinPrecision::Default;
75 switch (CompType) {
77 return dxbc::SigMinPrecision::Float16;
79 return dxbc::SigMinPrecision::SInt16;
81 return dxbc::SigMinPrecision::UInt16;
82 default:
83 return dxbc::SigMinPrecision::Default;
84 }
85 }
86
87 // Parse a signature element from its metadata representation
89 fromMetadata(const MDNode *Node);
90
91 // Build the metadata representation of this signature element
93};
94
95} // namespace hlsl
96} // namespace llvm
97
98#endif // LLVM_FRONTEND_HLSL_SEMANTICSIGNATURES_H
#define LLVM_ABI
Definition Compiler.h:215
This file defines the SmallVector class.
Tagged union holding either a T or a Error.
Definition Error.h:485
This is an important class for using LLVM in a threaded context.
Definition LLVMContext.h:68
Metadata node.
Definition Metadata.h:1069
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Represent a constant reference to a string, i.e.
Definition StringRef.h:56
ElementType
The element type of an SRV or UAV resource.
Definition DXILABI.h:68
static constexpr uint32_t UnallocatedRow
static constexpr uint8_t UnallocatedCol
This is an optimization pass for GlobalISel generic memory operations.
dxbc::SigMinPrecision getMinPrecision(bool UseMinPrecision) const
static LLVM_ABI Expected< SemanticSignatureElement > fromMetadata(const MDNode *Node)
dxbc::PSV::InterpolationMode InterpMode
LLVM_ABI MDNode * toMetadata(LLVMContext &Ctx) const