12#include "TargetInfo.h"
14#include "llvm/ADT/SmallVector.h"
15#include "llvm/IR/DerivedTypes.h"
16#include "llvm/IR/Type.h"
37llvm::Type *DirectXTargetCodeGenInfo::getHLSLType(
40 auto *ResType = dyn_cast<HLSLAttributedResourceType>(Ty);
47 case llvm::dxil::ResourceClass::UAV:
48 case llvm::dxil::ResourceClass::SRV: {
50 QualType ContainedTy = ResType->getContainedType();
58 ResAttrs.
RawBuffer ?
"dx.RawBuffer" :
"dx.TypedBuffer";
60 llvm::dxil::ResourceClass::UAV,
65 ElemType = cast<clang::VectorType>(ElemType)
71 return llvm::TargetExtType::get(Ctx, TypeName, {ElemType}, Ints);
73 case llvm::dxil::ResourceClass::CBuffer: {
74 QualType ContainedTy = ResType->getContainedType();
78 llvm::Type *BufferLayoutTy =
85 return llvm::TargetExtType::get(Ctx,
"dx.CBuffer", {BufferLayoutTy});
87 case llvm::dxil::ResourceClass::Sampler:
88 llvm_unreachable(
"dx.Sampler handles are not implemented yet");
91 llvm_unreachable(
"Unknown llvm::dxil::ResourceClass enum");
96std::unique_ptr<TargetCodeGenInfo>
98 return std::make_unique<DirectXTargetCodeGenInfo>(CGM.
getTypes());
C Language Family Type Representation.
This class organizes the cross-function state that is used while generating LLVM code.
CodeGenTypes & getTypes()
llvm::LLVMContext & getLLVMContext()
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
llvm::Type * ConvertTypeForMem(QualType T)
ConvertTypeForMem - Convert type T into a llvm::Type.
DefaultABIInfo - The default implementation for ABI specific details.
llvm::TargetExtType * createLayoutType(const RecordType *StructType, const llvm::SmallVector< int32_t > *Packoffsets=nullptr)
TargetCodeGenInfo - This class organizes various target-specific codegeneration issues,...
virtual llvm::Type * getHLSLType(CodeGenModule &CGM, const Type *T, const SmallVector< int32_t > *Packoffsets=nullptr) const
Return an LLVM type that corresponds to a HLSL type.
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
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.
bool isStructureType() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isVectorType() const
const T * castAsCanonical() const
Return this type's canonical type cast to the specified type.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
std::unique_ptr< TargetCodeGenInfo > createDirectXTargetCodeGenInfo(CodeGenModule &CGM)
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
llvm::dxil::ResourceClass ResourceClass