clang 24.0.0git
CGHLSLRuntime.h
Go to the documentation of this file.
1//===----- CGHLSLRuntime.h - Interface to HLSL Runtimes -----*- 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 provides an abstract class for HLSL code generation. Concrete
10// subclasses of this implement code generation for specific HLSL
11// runtime libraries.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_LIB_CODEGEN_CGHLSLRUNTIME_H
16#define LLVM_CLANG_LIB_CODEGEN_CGHLSLRUNTIME_H
17
18#include "Address.h"
19#include "clang/AST/Attr.h"
20#include "clang/AST/Decl.h"
23#include "llvm/ADT/DenseMap.h"
24#include "llvm/ADT/SmallVector.h"
25#include "llvm/ADT/StringRef.h"
26#include "llvm/Frontend/HLSL/HLSLResource.h"
27#include "llvm/Frontend/HLSL/SemanticSignatures.h"
28#include "llvm/IR/IRBuilder.h"
29#include "llvm/IR/Intrinsics.h"
30#include "llvm/IR/IntrinsicsDirectX.h"
31#include "llvm/IR/IntrinsicsSPIRV.h"
32
33#include <optional>
34#include <vector>
35
36// A function generator macro for picking the right intrinsic
37// for the target backend
38#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix) \
39 llvm::Intrinsic::ID get##FunctionName##Intrinsic() { \
40 llvm::Triple::ArchType Arch = getArch(); \
41 switch (Arch) { \
42 case llvm::Triple::dxil: \
43 return llvm::Intrinsic::dx_##IntrinsicPostfix; \
44 case llvm::Triple::spirv: \
45 return llvm::Intrinsic::spv_##IntrinsicPostfix; \
46 default: \
47 llvm_unreachable("Intrinsic " #IntrinsicPostfix \
48 " not supported by target architecture"); \
49 } \
50 }
51
52using ResourceClass = llvm::dxil::ResourceClass;
53
54namespace llvm {
55class GlobalVariable;
56class Function;
57class StructType;
58class Metadata;
59} // namespace llvm
60
61namespace clang {
62class NamedDecl;
63class VarDecl;
64class ParmVarDecl;
65class InitListExpr;
66class HLSLBufferDecl;
68class HLSLVkBindingAttr;
69class HLSLResourceBindingAttr;
70class Type;
71class RecordType;
72class DeclContext;
73class HLSLPackOffsetAttr;
75
76class FunctionDecl;
77
78namespace CodeGen {
79
80class CodeGenModule;
81class CodeGenFunction;
82class LValue;
83class AggValueSlot;
84
87
88public:
89 static const uint32_t Unspecified = ~0U;
90
91 /// Iterates over all declarations in the HLSL buffer and based on the
92 /// packoffset or register(c#) annotations it fills outs the Offsets vector
93 /// with the user-specified layout offsets. The buffer offsets can be
94 /// specified 2 ways: 1. declarations in cbuffer {} block can have a
95 /// packoffset annotation (translates to HLSLPackOffsetAttr) 2. default
96 /// constant buffer declarations at global scope can have register(c#)
97 /// annotations (translates to HLSLResourceBindingAttr with RegisterType::C)
98 /// It is not guaranteed that all declarations in a buffer have an annotation.
99 /// For those where it is not specified a `~0U` value is added to the Offsets
100 /// vector. In the final layout these declarations will be placed at the end
101 /// of the HLSL buffer after all of the elements with specified offset.
102 static CGHLSLOffsetInfo fromDecl(const HLSLBufferDecl &BufDecl);
103
104 /// Comparison function for offsets received from `operator[]` suitable for
105 /// use in a `stable_sort`. This will order implicit bindings after explicit
106 /// offsets.
107 static bool compareOffsets(uint32_t LHS, uint32_t RHS) { return LHS < RHS; }
108
109 /// Get the given offset, or `~0U` if there is no offset for the member.
110 uint32_t operator[](size_t I) const {
111 if (Offsets.empty())
112 return Unspecified;
113 return Offsets[I];
114 }
115
116 bool empty() const { return Offsets.empty(); }
117};
118
120public:
121 //===----------------------------------------------------------------------===//
122 // Start of reserved area for HLSL intrinsic getters.
123 //===----------------------------------------------------------------------===//
124
128 GENERATE_HLSL_INTRINSIC_FUNCTION(FlattenedThreadIdInGroup,
129 flattened_thread_id_in_group)
133 GENERATE_HLSL_INTRINSIC_FUNCTION(Saturate, saturate)
135 GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
136 GENERATE_HLSL_INTRINSIC_FUNCTION(GroupThreadId, thread_id_in_group)
137 GENERATE_HLSL_INTRINSIC_FUNCTION(GroupId, group_id)
141 GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddI8Packed, dot4add_i8packed)
142 GENERATE_HLSL_INTRINSIC_FUNCTION(Dot4AddU8Packed, dot4add_u8packed)
143 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAllEqual, wave_all_equal)
144 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAllTrue, wave_all)
145 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveAnyTrue, wave_any)
146 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveBitOr, wave_reduce_or)
147 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveBitXor, wave_reduce_xor)
148 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveBitAnd, wave_reduce_and)
149 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveMax, wave_reduce_max)
150 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveUMax, wave_reduce_umax)
151 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveMin, wave_reduce_min)
152 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveUMin, wave_reduce_umin)
153 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveActiveCountBits, wave_active_countbits)
154 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveIsFirstLane, wave_is_first_lane)
155 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveGetLaneCount, wave_get_lane_count)
156 GENERATE_HLSL_INTRINSIC_FUNCTION(WaveReadLaneAt, wave_readlane)
157 GENERATE_HLSL_INTRINSIC_FUNCTION(QuadReadAcrossX, quad_read_across_x)
158 GENERATE_HLSL_INTRINSIC_FUNCTION(QuadReadAcrossY, quad_read_across_y)
159 GENERATE_HLSL_INTRINSIC_FUNCTION(QuadReadAcrossDiagonal,
160 quad_read_across_diagonal)
161 GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitUHigh, firstbituhigh)
162 GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitSHigh, firstbitshigh)
163 GENERATE_HLSL_INTRINSIC_FUNCTION(FirstBitLow, firstbitlow)
167
168 GENERATE_HLSL_INTRINSIC_FUNCTION(CreateResourceGetBasePointer,
169 resource_getbasepointer)
170 GENERATE_HLSL_INTRINSIC_FUNCTION(CreateResourceGetPointer,
171 resource_getpointer)
173 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleClamp, resource_sample_clamp)
174 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleBias, resource_samplebias)
175 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleBiasClamp, resource_samplebias_clamp)
176 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleGrad, resource_samplegrad)
177 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleGradClamp, resource_samplegrad_clamp)
178 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleLevel, resource_samplelevel)
179 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleCmp, resource_samplecmp)
180 GENERATE_HLSL_INTRINSIC_FUNCTION(SampleCmpClamp, resource_samplecmp_clamp)
182 resource_samplecmplevelzero)
183 GENERATE_HLSL_INTRINSIC_FUNCTION(Gather, resource_gather)
184 GENERATE_HLSL_INTRINSIC_FUNCTION(GatherCmp, resource_gather_cmp)
185 GENERATE_HLSL_INTRINSIC_FUNCTION(CreateHandleFromBinding,
186 resource_handlefrombinding)
187 GENERATE_HLSL_INTRINSIC_FUNCTION(CreateHandleFromImplicitBinding,
188 resource_handlefromimplicitbinding)
189 GENERATE_HLSL_INTRINSIC_FUNCTION(NonUniformResourceIndex,
190 resource_nonuniformindex)
191 GENERATE_HLSL_INTRINSIC_FUNCTION(BufferUpdateCounter, resource_updatecounter)
192 GENERATE_HLSL_INTRINSIC_FUNCTION(AllMemoryBarrier, all_memory_barrier)
193 GENERATE_HLSL_INTRINSIC_FUNCTION(AllMemoryBarrierWithGroupSync,
194 all_memory_barrier_with_group_sync)
195 GENERATE_HLSL_INTRINSIC_FUNCTION(DeviceMemoryBarrier, device_memory_barrier)
196 GENERATE_HLSL_INTRINSIC_FUNCTION(DeviceMemoryBarrierWithGroupSync,
197 device_memory_barrier_with_group_sync)
198 GENERATE_HLSL_INTRINSIC_FUNCTION(GroupMemoryBarrier, group_memory_barrier)
199 GENERATE_HLSL_INTRINSIC_FUNCTION(GroupMemoryBarrierWithGroupSync,
200 group_memory_barrier_with_group_sync)
201 GENERATE_HLSL_INTRINSIC_FUNCTION(GetDimensionsX, resource_getdimensions_x)
202 GENERATE_HLSL_INTRINSIC_FUNCTION(GetDimensionsXY, resource_getdimensions_xy)
203 GENERATE_HLSL_INTRINSIC_FUNCTION(GetDimensionsLevelsXY,
204 resource_getdimensions_levels_xy)
205 GENERATE_HLSL_INTRINSIC_FUNCTION(LoadLevel, resource_load_level)
206 GENERATE_HLSL_INTRINSIC_FUNCTION(LoadMS, resource_load_ms)
207 GENERATE_HLSL_INTRINSIC_FUNCTION(CalculateLod, resource_calculate_lod)
208 GENERATE_HLSL_INTRINSIC_FUNCTION(CalculateLodUnclamped,
209 resource_calculate_lod_unclamped)
210 GENERATE_HLSL_INTRINSIC_FUNCTION(DdxCoarse, ddx_coarse)
211 GENERATE_HLSL_INTRINSIC_FUNCTION(DdyCoarse, ddy_coarse)
212 GENERATE_HLSL_INTRINSIC_FUNCTION(DdxFine, ddx_fine)
213 GENERATE_HLSL_INTRINSIC_FUNCTION(DdyFine, ddy_fine)
214
215 //===----------------------------------------------------------------------===//
216 // End of reserved area for HLSL intrinsic getters.
217 //===----------------------------------------------------------------------===//
218
219protected:
220 using SemanticSignatures =
221 llvm::SmallVectorImpl<llvm::hlsl::SemanticSignatureElement>;
222
224
225 llvm::Value *emitSystemSemanticLoad(llvm::IRBuilder<> &B,
226 const FunctionDecl *FD, llvm::Type *Type,
227 const clang::DeclaratorDecl *Decl,
228 HLSLAppliedSemanticAttr *Semantic,
229 std::optional<unsigned> Index,
230 SemanticSignatures &Signature);
231
232 void emitSystemSemanticStore(llvm::IRBuilder<> &B, llvm::Value *Source,
233 const clang::DeclaratorDecl *Decl,
234 HLSLAppliedSemanticAttr *Semantic,
235 std::optional<unsigned> Index,
236 SemanticSignatures &Signature);
237
238 llvm::Value *handleScalarSemanticLoad(llvm::IRBuilder<> &B,
239 const FunctionDecl *FD,
240 llvm::Type *Type,
241 const clang::DeclaratorDecl *Decl,
242 HLSLAppliedSemanticAttr *Semantic,
243 SemanticSignatures &Signature);
244
245 void handleScalarSemanticStore(llvm::IRBuilder<> &B, const FunctionDecl *FD,
246 llvm::Value *Source,
247 const clang::DeclaratorDecl *Decl,
248 HLSLAppliedSemanticAttr *Semantic,
249 SemanticSignatures &Signature);
250
251 std::pair<llvm::Value *, specific_attr_iterator<HLSLAppliedSemanticAttr>>
253 llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Type *Type,
254 const clang::DeclaratorDecl *Decl,
255 specific_attr_iterator<HLSLAppliedSemanticAttr> begin,
256 specific_attr_iterator<HLSLAppliedSemanticAttr> end,
257 SemanticSignatures &Signature);
258
259 specific_attr_iterator<HLSLAppliedSemanticAttr> handleStructSemanticStore(
260 llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Value *Source,
261 const clang::DeclaratorDecl *Decl,
262 specific_attr_iterator<HLSLAppliedSemanticAttr> AttrBegin,
263 specific_attr_iterator<HLSLAppliedSemanticAttr> AttrEnd,
264 SemanticSignatures &Signature);
265
266 std::pair<llvm::Value *, specific_attr_iterator<HLSLAppliedSemanticAttr>>
267 handleSemanticLoad(llvm::IRBuilder<> &B, const FunctionDecl *FD,
269 specific_attr_iterator<HLSLAppliedSemanticAttr> begin,
270 specific_attr_iterator<HLSLAppliedSemanticAttr> end,
271 SemanticSignatures &Signature);
272
273 specific_attr_iterator<HLSLAppliedSemanticAttr>
274 handleSemanticStore(llvm::IRBuilder<> &B, const FunctionDecl *FD,
275 llvm::Value *Source, const clang::DeclaratorDecl *Decl,
276 specific_attr_iterator<HLSLAppliedSemanticAttr> AttrBegin,
277 specific_attr_iterator<HLSLAppliedSemanticAttr> AttrEnd,
278 SemanticSignatures &Signature);
279
280public:
282 virtual ~CGHLSLRuntime() {}
283
284 llvm::Type *convertHLSLSpecificType(const Type *T,
285 const CGHLSLOffsetInfo &OffsetInfo);
286 llvm::Type *convertHLSLSpecificType(const Type *T) {
288 }
289
291
292 void addBuffer(const HLSLBufferDecl *D);
294 void finishCodeGen();
295
296 void setHLSLEntryAttributes(const FunctionDecl *FD, llvm::Function *Fn);
297
298 void emitEntryFunction(const FunctionDecl *FD, llvm::Function *Fn);
299 void setHLSLFunctionAttributes(const FunctionDecl *FD, llvm::Function *Fn);
300 void handleGlobalVarDefinition(const VarDecl *VD, llvm::GlobalVariable *Var);
301
302 llvm::Instruction *getConvergenceToken(llvm::BasicBlock &BB);
303
304 llvm::StructType *getHLSLBufferLayoutType(const RecordType *LayoutStructTy);
305 void addHLSLBufferLayoutType(const RecordType *LayoutStructTy,
306 llvm::StructType *LayoutTy);
308
309 std::optional<LValue>
311 CodeGenFunction &CGF);
312
313 bool emitGlobalResourceArray(CodeGenFunction &CGF, const Expr *E,
314 AggValueSlot &DestSlot);
315 std::optional<LValue>
317 const VarDecl *ArrayDecl);
318
319 std::optional<LValue> emitBufferArraySubscriptExpr(
320 const ArraySubscriptExpr *E, CodeGenFunction &CGF,
321 llvm::function_ref<llvm::Value *(bool Promote)> EmitIdxAfterBase);
322
324 CodeGenFunction &CGF);
325
326 bool emitBufferCopy(CodeGenFunction &CGF, const Expr *E, const LValue &SrcLV,
327 AggValueSlot &DestSlot);
328
330 std::optional<LValue> emitResourceMemberExpr(CodeGenFunction &CGF,
331 const MemberExpr *E);
332
333private:
334 void emitBufferGlobalsAndMetadata(const HLSLBufferDecl *BufDecl,
335 llvm::GlobalVariable *BufGV,
336 const CGHLSLOffsetInfo &OffsetInfo);
337 void initializeBufferFromBinding(const HLSLBufferDecl *BufDecl,
338 llvm::GlobalVariable *GV);
339 void initializeBufferFromBinding(const HLSLBufferDecl *BufDecl,
340 llvm::GlobalVariable *GV,
341 HLSLResourceBindingAttr *RBA);
342
343 llvm::Value *emitSPIRVUserSemanticLoad(llvm::IRBuilder<> &B,
344 const FunctionDecl *FD,
345 llvm::Type *Type,
347 HLSLAppliedSemanticAttr *Semantic,
348 std::optional<unsigned> Index);
349 llvm::Value *emitDXILUserSemanticLoad(llvm::IRBuilder<> &B, llvm::Type *Type,
351 HLSLAppliedSemanticAttr *Semantic,
352 std::optional<unsigned> Index,
353 SemanticSignatures &Signature);
354 llvm::Value *emitUserSemanticLoad(llvm::IRBuilder<> &B,
355 const FunctionDecl *FD, llvm::Type *Type,
357 HLSLAppliedSemanticAttr *Semantic,
358 std::optional<unsigned> Index,
359 SemanticSignatures &Signature);
360
361 void emitSPIRVUserSemanticStore(llvm::IRBuilder<> &B, llvm::Value *Source,
363 HLSLAppliedSemanticAttr *Semantic,
364 std::optional<unsigned> Index);
365 void emitDXILUserSemanticStore(llvm::IRBuilder<> &B, llvm::Value *Source,
367 HLSLAppliedSemanticAttr *Semantic,
368 std::optional<unsigned> Index,
369 SemanticSignatures &Signature);
370 void emitUserSemanticStore(llvm::IRBuilder<> &B, llvm::Value *Source,
372 HLSLAppliedSemanticAttr *Semantic,
373 std::optional<unsigned> Index,
374 SemanticSignatures &Signature);
375
376 bool initializeGlobalResourceArray(CodeGenFunction &CGF,
377 const VarDecl *ArrayDecl,
378 AggValueSlot &DestSlot);
379
380 llvm::Triple::ArchType getArch();
381
382 llvm::DenseMap<const clang::RecordType *, llvm::StructType *> LayoutTypes;
383 unsigned SPIRVLastAssignedInputSemanticLocation = 0;
384 unsigned SPIRVLastAssignedOutputSemanticLocation = 0;
385};
386
387} // namespace CodeGen
388} // namespace clang
389
390#endif
Defines enum values for all the target-independent builtin functions.
#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix)
llvm::dxil::ResourceClass ResourceClass
Defines helper utilities for supporting the HLSL runtime environment.
__DEVICE__ bool isnan(float __x)
Test for a NaN.
__DEVICE__ bool isinf(float __x)
Test for infinity value (+ve or -ve) .
__DEVICE__ double rsqrt(double __a)
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2765
An aggregate value slot.
Definition CGValue.h:551
static const uint32_t Unspecified
static bool compareOffsets(uint32_t LHS, uint32_t RHS)
Comparison function for offsets received from operator[] suitable for use in a stable_sort.
static CGHLSLOffsetInfo fromDecl(const HLSLBufferDecl &BufDecl)
Iterates over all declarations in the HLSL buffer and based on the packoffset or register(c#) annotat...
uint32_t operator[](size_t I) const
Get the given offset, or ~0U if there is no offset for the member.
llvm::Instruction * getConvergenceToken(llvm::BasicBlock &BB)
void setHLSLEntryAttributes(const FunctionDecl *FD, llvm::Function *Fn)
specific_attr_iterator< HLSLAppliedSemanticAttr > handleStructSemanticStore(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Value *Source, const clang::DeclaratorDecl *Decl, specific_attr_iterator< HLSLAppliedSemanticAttr > AttrBegin, specific_attr_iterator< HLSLAppliedSemanticAttr > AttrEnd, SemanticSignatures &Signature)
llvm::StructType * getHLSLBufferLayoutType(const RecordType *LayoutStructTy)
llvm::Value * emitSystemSemanticLoad(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Type *Type, const clang::DeclaratorDecl *Decl, HLSLAppliedSemanticAttr *Semantic, std::optional< unsigned > Index, SemanticSignatures &Signature)
void emitEntryFunction(const FunctionDecl *FD, llvm::Function *Fn)
void handleGlobalVarDefinition(const VarDecl *VD, llvm::GlobalVariable *Var)
std::optional< LValue > emitResourceMemberExpr(CodeGenFunction &CGF, const MemberExpr *E)
void emitSystemSemanticStore(llvm::IRBuilder<> &B, llvm::Value *Source, const clang::DeclaratorDecl *Decl, HLSLAppliedSemanticAttr *Semantic, std::optional< unsigned > Index, SemanticSignatures &Signature)
void addHLSLBufferLayoutType(const RecordType *LayoutStructTy, llvm::StructType *LayoutTy)
std::optional< LValue > emitGlobalResourceArrayAsLValue(CodeGenFunction &CGF, const VarDecl *ArrayDecl)
GENERATE_HLSL_INTRINSIC_FUNCTION(FlattenedThreadIdInGroup, flattened_thread_id_in_group) GENERATE_HLSL_INTRINSIC_FUNCTION(QuadReadAcrossDiagonal
llvm::Value * handleScalarSemanticLoad(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Type *Type, const clang::DeclaratorDecl *Decl, HLSLAppliedSemanticAttr *Semantic, SemanticSignatures &Signature)
quad_read_across_diagonal resource_getpointer resource_handlefrombinding resource_nonuniformindex device_memory_barrier_with_group_sync resource_getdimensions_levels_xy GENERATE_HLSL_INTRINSIC_FUNCTION(CalculateLodUnclamped, resource_calculate_lod_unclamped) protected CodeGenModule & CGM
bool emitBufferCopy(CodeGenFunction &CGF, const Expr *E, const LValue &SrcLV, AggValueSlot &DestSlot)
std::pair< llvm::Value *, specific_attr_iterator< HLSLAppliedSemanticAttr > > handleStructSemanticLoad(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Type *Type, const clang::DeclaratorDecl *Decl, specific_attr_iterator< HLSLAppliedSemanticAttr > begin, specific_attr_iterator< HLSLAppliedSemanticAttr > end, SemanticSignatures &Signature)
specific_attr_iterator< HLSLAppliedSemanticAttr > handleSemanticStore(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Value *Source, const clang::DeclaratorDecl *Decl, specific_attr_iterator< HLSLAppliedSemanticAttr > AttrBegin, specific_attr_iterator< HLSLAppliedSemanticAttr > AttrEnd, SemanticSignatures &Signature)
CGHLSLRuntime(CodeGenModule &CGM)
std::optional< LValue > emitBufferArraySubscriptExpr(const ArraySubscriptExpr *E, CodeGenFunction &CGF, llvm::function_ref< llvm::Value *(bool Promote)> EmitIdxAfterBase)
std::optional< LValue > emitResourceArraySubscriptExpr(const ArraySubscriptExpr *E, CodeGenFunction &CGF)
void addRootSignature(const HLSLRootSignatureDecl *D)
LValue emitBufferMemberExpr(CodeGenFunction &CGF, const MemberExpr *E)
llvm::Type * convertHLSLSpecificType(const Type *T)
llvm::Type * convertHLSLSpecificType(const Type *T, const CGHLSLOffsetInfo &OffsetInfo)
RawAddress createBufferMatrixTempAddress(const LValue &LV, CodeGenFunction &CGF)
void addBuffer(const HLSLBufferDecl *D)
bool emitGlobalResourceArray(CodeGenFunction &CGF, const Expr *E, AggValueSlot &DestSlot)
void setHLSLFunctionAttributes(const FunctionDecl *FD, llvm::Function *Fn)
std::pair< llvm::Value *, specific_attr_iterator< HLSLAppliedSemanticAttr > > handleSemanticLoad(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Type *Type, const clang::DeclaratorDecl *Decl, specific_attr_iterator< HLSLAppliedSemanticAttr > begin, specific_attr_iterator< HLSLAppliedSemanticAttr > end, SemanticSignatures &Signature)
void handleScalarSemanticStore(llvm::IRBuilder<> &B, const FunctionDecl *FD, llvm::Value *Source, const clang::DeclaratorDecl *Decl, HLSLAppliedSemanticAttr *Semantic, SemanticSignatures &Signature)
void emitInitListOpaqueValues(CodeGenFunction &CGF, InitListExpr *E)
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
This class organizes the cross-function state that is used while generating LLVM code.
LValue - This represents an lvalue references.
Definition CGValue.h:183
An abstract representation of an aligned address.
Definition Address.h:42
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1466
Represents a ValueDecl that came out of a declarator.
Definition Decl.h:781
This represents one expression.
Definition Expr.h:113
Represents a function declaration or definition.
Definition Decl.h:2059
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition Decl.h:5329
Describes an C or C++ initializer list.
Definition Expr.h:5352
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3408
This represents a decl that may have a name.
Definition Decl.h:275
Represents a parameter to a function.
Definition Decl.h:1820
The base class of the type hierarchy.
Definition TypeBase.h:1879
Represents a variable declaration or definition.
Definition Decl.h:933
specific_attr_iterator - Iterates over a subrange of an AttrVec, only providing attributes that are o...
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
Definition CGValue.h:155
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
Definition CGValue.h:146
Top level wrappers for InstallAPI frontend operations.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
float __ovld __cnfn sign(float)
Returns 1.0 if x > 0, -0.0 if x = -0.0, +0.0 if x = +0.0, or -1.0 if x < 0.
int __ovld __cnfn all(char)
Returns 1 if the most significant bit in all components of x is set; otherwise returns 0.
int __ovld __cnfn any(char)
Returns 1 if the most significant bit in any component of x is set; otherwise returns 0.
__packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 __packed_splat2 __packed_splat4 __packed_splat2 __packed_splat8 __packed_splat4 uint32_t