18 #include "llvm/IR/DerivedTypes.h"
19 #include "llvm/IR/GlobalValue.h"
22 using namespace clang;
23 using namespace CodeGen;
34 "Not an OpenCL specific type!");
39 switch (cast<BuiltinType>(T)->
getKind()) {
41 llvm_unreachable(
"Unexpected opencl builtin type!");
43 case BuiltinType::OCLImage1d:
45 Ctx,
"opencl.image1d_t"), ImgAddrSpc);
46 case BuiltinType::OCLImage1dArray:
48 Ctx,
"opencl.image1d_array_t"), ImgAddrSpc);
49 case BuiltinType::OCLImage1dBuffer:
51 Ctx,
"opencl.image1d_buffer_t"), ImgAddrSpc);
52 case BuiltinType::OCLImage2d:
54 Ctx,
"opencl.image2d_t"), ImgAddrSpc);
55 case BuiltinType::OCLImage2dArray:
57 Ctx,
"opencl.image2d_array_t"), ImgAddrSpc);
58 case BuiltinType::OCLImage2dDepth:
59 return llvm::PointerType::get(
61 case BuiltinType::OCLImage2dArrayDepth:
62 return llvm::PointerType::get(
65 case BuiltinType::OCLImage2dMSAA:
66 return llvm::PointerType::get(
68 case BuiltinType::OCLImage2dArrayMSAA:
69 return llvm::PointerType::get(
72 case BuiltinType::OCLImage2dMSAADepth:
73 return llvm::PointerType::get(
76 case BuiltinType::OCLImage2dArrayMSAADepth:
77 return llvm::PointerType::get(
80 case BuiltinType::OCLImage3d:
82 Ctx,
"opencl.image3d_t"), ImgAddrSpc);
83 case BuiltinType::OCLSampler:
84 return llvm::IntegerType::get(Ctx, 32);
85 case BuiltinType::OCLEvent:
87 Ctx,
"opencl.event_t"), 0);
88 case BuiltinType::OCLClkEvent:
89 return llvm::PointerType::get(
91 case BuiltinType::OCLQueue:
92 return llvm::PointerType::get(
94 case BuiltinType::OCLNDRange:
95 return llvm::PointerType::get(
97 case BuiltinType::OCLReserveID:
98 return llvm::PointerType::get(
105 uint32_t PipeAddrSpc =
void EmitStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
llvm::LLVMContext & getLLVMContext()
The base class of the type hierarchy.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool isOpenCLSpecificType() const
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
virtual ~CGOpenCLRuntime()
virtual llvm::Type * convertOpenCLSpecificType(const Type *T)
virtual void EmitWorkGroupLocalVarDecl(CodeGenFunction &CGF, const VarDecl &D)
Emit the IR required for a work-group-local variable declaration, and add an entry to CGF's LocalDecl...
ASTContext & getContext() const
The l-value was considered opaque, so the alignment was determined from a type.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
virtual llvm::Type * getPipeType()
static Decl::Kind getKind(const Decl *D)
unsigned getTargetAddressSpace(QualType T) const