LLVM 22.0.0git
CBuffer.h
Go to the documentation of this file.
1//===- CBuffer.h - HLSL constant buffer handling ----------------*- 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/// \file This file contains utilities to work with constant buffers in HLSL.
10///
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_FRONTEND_HLSL_CBUFFER_H
14#define LLVM_FRONTEND_HLSL_CBUFFER_H
15
17#include "llvm/IR/DataLayout.h"
19#include <optional>
20
21namespace llvm {
22class Module;
23class GlobalVariable;
24class NamedMDNode;
25
26namespace hlsl {
27
30 size_t Offset;
31
33};
34
38
40};
41
43 NamedMDNode *MD;
45
46 CBufferMetadata(NamedMDNode *MD) : MD(MD) {}
47
48public:
49 static std::optional<CBufferMetadata> get(Module &M);
50
52 iterator begin() { return Mappings.begin(); }
53 iterator end() { return Mappings.end(); }
54
55 void eraseFromModule();
56};
57
59 ArrayType *Ty);
60
61} // namespace hlsl
62} // namespace llvm
63
64#endif // LLVM_FRONTEND_HLSL_CBUFFER_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Machine Check Debug Module
This file defines the SmallVector class.
Class for arbitrary precision integers.
Definition: APInt.h:78
Class to represent array types.
Definition: DerivedTypes.h:398
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
A tuple of MDNodes.
Definition: Metadata.h:1753
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1197
static std::optional< CBufferMetadata > get(Module &M)
Definition: CBuffer.cpp:34
APInt translateCBufArrayOffset(const DataLayout &DL, APInt Offset, ArrayType *Ty)
Definition: CBuffer.cpp:66
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
@ Offset
Definition: DWP.cpp:477
GlobalVariable * Handle
Definition: CBuffer.h:36
SmallVector< CBufferMember > Members
Definition: CBuffer.h:37
CBufferMapping(GlobalVariable *Handle)
Definition: CBuffer.h:39
GlobalVariable * GV
Definition: CBuffer.h:29
CBufferMember(GlobalVariable *GV, size_t Offset)
Definition: CBuffer.h:32