LLVM 22.0.0git
DXContainerPSVInfo.h
Go to the documentation of this file.
1//===- llvm/MC/DXContainerPSVInfo.h - DXContainer PSVInfo -*- 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#ifndef LLVM_MC_DXCONTAINERPSVINFO_H
10#define LLVM_MC_DXCONTAINERPSVINFO_H
11
12#include "llvm/ADT/ArrayRef.h"
14#include "llvm/ADT/StringRef.h"
18
19#include <array>
20#include <stdint.h>
21
22namespace llvm {
23
24class raw_ostream;
25
26namespace mcdxbc {
27
41
42// This data structure is a helper for reading and writing PSV RuntimeInfo data.
43// It is implemented in the BinaryFormat library so that it can be used by both
44// the MC layer and Object tools.
45// This structure is used to represent the extracted data in an inspectable and
46// modifiable format, and can be used to serialize the data back into valid PSV
47// RuntimeInfo.
49 PSVRuntimeInfo() : DXConStrTabBuilder(StringTableBuilder::DXContainer) {
50 memset((void *)&BaseData, 0, sizeof(dxbc::PSV::v3::RuntimeInfo));
51 }
52 bool IsFinalized = false;
58
59 // TODO: Make this interface user-friendly.
60 // The interface here is bad, and we'll want to change this in the future. We
61 // probably will want to build out these mask vectors as vectors of bools and
62 // have this utility object convert them to the bit masks. I don't want to
63 // over-engineer this API now since we don't know what the data coming in to
64 // feed it will look like, so I kept it extremely simple for the immediate use
65 // case.
66 std::array<SmallVector<uint32_t>, 4> OutputVectorMasks;
68 std::array<SmallVector<uint32_t>, 4> InputOutputMap;
72
73 // Serialize PSVInfo into the provided raw_ostream. The version field
74 // specifies the data version to encode, the default value specifies encoding
75 // the highest supported version.
76 void write(raw_ostream &OS,
77 uint32_t Version = std::numeric_limits<uint32_t>::max()) const;
78
80
81private:
82 SmallVector<uint32_t, 64> IndexBuffer;
84 StringTableBuilder DXConStrTabBuilder;
85};
86
87class Signature {
88 struct Parameter {
89 uint32_t Stream;
90 StringRef Name;
91 uint32_t Index;
92 dxbc::D3DSystemValue SystemValue;
95 uint8_t Mask;
96 uint8_t ExclusiveMask;
97 dxbc::SigMinPrecision MinPrecision;
98 };
99
101
102public:
103 void addParam(uint32_t Stream, StringRef Name, uint32_t Index,
104 dxbc::D3DSystemValue SystemValue,
106 uint8_t Mask, uint8_t ExclusiveMask,
107 dxbc::SigMinPrecision MinPrecision) {
108 Params.push_back(Parameter{Stream, Name, Index, SystemValue, CompType,
109 Register, Mask, ExclusiveMask, MinPrecision});
110 }
111
112 void write(raw_ostream &OS);
113};
114
115} // namespace mcdxbc
116} // namespace llvm
117
118#endif // LLVM_MC_DXCONTAINERPSVINFO_H
arc branch finalize
This file defines the SmallVector class.
Wrapper class representing virtual and physical registers.
Definition Register.h:20
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Utility for building string tables with deduplicated suffixes.
void addParam(uint32_t Stream, StringRef Name, uint32_t Index, dxbc::D3DSystemValue SystemValue, dxbc::SigComponentType CompType, uint32_t Register, uint8_t Mask, uint8_t ExclusiveMask, dxbc::SigMinPrecision MinPrecision)
void write(raw_ostream &OS)
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition raw_ostream.h:53
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Definition InstrProf.h:302
dxbc::PSV::v3::RuntimeInfo BaseData
SmallVector< uint32_t > PatchOrPrimMasks
SmallVector< uint32_t > PatchOutputMap
SmallVector< dxbc::PSV::v2::ResourceBindInfo > Resources
SmallVector< PSVSignatureElement > InputElements
SmallVector< uint32_t > InputPatchMap
SmallVector< PSVSignatureElement > OutputElements
SmallVector< PSVSignatureElement > PatchOrPrimElements
void write(raw_ostream &OS, uint32_t Version=std::numeric_limits< uint32_t >::max()) const
std::array< SmallVector< uint32_t >, 4 > OutputVectorMasks
std::array< SmallVector< uint32_t >, 4 > InputOutputMap
dxbc::PSV::InterpolationMode Mode