15#ifndef LLVM_CLANG_LIB_CODEGEN_CGHLSLRUNTIME_H
16#define LLVM_CLANG_LIB_CODEGEN_CGHLSLRUNTIME_H
18#include "llvm/ADT/DenseMap.h"
19#include "llvm/IR/IRBuilder.h"
20#include "llvm/IR/Intrinsics.h"
21#include "llvm/IR/IntrinsicsDirectX.h"
22#include "llvm/IR/IntrinsicsSPIRV.h"
27#include "llvm/ADT/SmallVector.h"
28#include "llvm/ADT/StringRef.h"
29#include "llvm/Frontend/HLSL/HLSLResource.h"
36#define GENERATE_HLSL_INTRINSIC_FUNCTION(FunctionName, IntrinsicPostfix) \
37 llvm::Intrinsic::ID get##FunctionName##Intrinsic() { \
38 llvm::Triple::ArchType Arch = getArch(); \
40 case llvm::Triple::dxil: \
41 return llvm::Intrinsic::dx_##IntrinsicPostfix; \
42 case llvm::Triple::spirv: \
43 return llvm::Intrinsic::spv_##IntrinsicPostfix; \
45 llvm_unreachable("Intrinsic " #IntrinsicPostfix \
46 " not supported by target architecture"); \
65class HLSLVkBindingAttr;
66class HLSLResourceBindingAttr;
70class HLSLPackOffsetAttr;
71class ArraySubscriptExpr;
93 flattened_thread_id_in_group)
125 resource_handlefrombinding)
127 resource_handlefromimplicitbinding)
130 group_memory_barrier_with_group_sync)
163 llvm::TargetExtType *
166 llvm::TargetExtType *LayoutTy);
169 std::optional<LValue>
175 llvm::GlobalVariable *BufGV);
177 llvm::GlobalVariable *GV,
178 HLSLVkBindingAttr *VkBinding);
180 llvm::GlobalVariable *GV,
181 HLSLResourceBindingAttr *RBA);
182 llvm::Triple::ArchType getArch();
184 llvm::DenseMap<const clang::RecordType *, llvm::TargetExtType *> LayoutTypes;
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__ double rsqrt(double __a)
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
llvm::Instruction * getConvergenceToken(llvm::BasicBlock &BB)
void setHLSLEntryAttributes(const FunctionDecl *FD, llvm::Function *Fn)
void addHLSLBufferLayoutType(const RecordType *LayoutStructTy, llvm::TargetExtType *LayoutTy)
void emitEntryFunction(const FunctionDecl *FD, llvm::Function *Fn)
void handleGlobalVarDefinition(const VarDecl *VD, llvm::GlobalVariable *Var)
llvm::TargetExtType * getHLSLBufferLayoutType(const RecordType *LayoutStructTy)
resource_getpointer resource_handlefromimplicitbinding GENERATE_HLSL_INTRINSIC_FUNCTION(GroupMemoryBarrierWithGroupSync, group_memory_barrier_with_group_sync) protected llvm::Value * emitInputSemantic(llvm::IRBuilder<> &B, const ParmVarDecl &D, llvm::Type *Ty)
llvm::Type * convertHLSLSpecificType(const Type *T, SmallVector< int32_t > *Packoffsets=nullptr)
std::optional< LValue > emitResourceArraySubscriptExpr(const ArraySubscriptExpr *E, CodeGenFunction &CGF)
void addBuffer(const HLSLBufferDecl *D)
void generateGlobalCtorDtorCalls()
void setHLSLFunctionAttributes(const FunctionDecl *FD, llvm::Function *Fn)
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.
Represents a function declaration or definition.
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Describes an C or C++ initializer list.
Represents a parameter to a function.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
The base class of the type hierarchy.
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Diagnostic wrappers for TextAPI types for error reporting.
float __ovld __cnfn step(float, float)
Returns 0.0 if x < edge, otherwise it returns 1.0.
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.
float __ovld __cnfn radians(float)
Converts degrees to radians, i.e.
float __ovld __cnfn degrees(float)
Converts radians to degrees, i.e.
int __ovld __cnfn all(char)
Returns 1 if the most significant bit in all components of x is set; otherwise returns 0.
float __ovld __cnfn normalize(float)
Returns a vector in the same direction as p but with a length of 1.
int __ovld __cnfn any(char)
Returns 1 if the most significant bit in any component of x is set; otherwise returns 0.
float4 __ovld __cnfn cross(float4, float4)
Returns the cross product of p0.xyz and p1.xyz.