19 #include "llvm/IR/DerivedTypes.h"
20 #include "llvm/IR/GlobalValue.h"
23 using namespace clang;
24 using namespace CodeGen;
35 "Not an OpenCL specific type!");
40 switch (cast<BuiltinType>(T)->getKind()) {
42 llvm_unreachable(
"Unexpected opencl builtin type!");
44 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
45 case BuiltinType::Id: \
46 return llvm::PointerType::get( \
47 llvm::StructType::create(Ctx, "opencl." #ImgType "_" #Suffix "_t"), \
49 #include "clang/Basic/OpenCLImageTypes.def"
50 case BuiltinType::OCLSampler:
52 case BuiltinType::OCLEvent:
54 Ctx,
"opencl.event_t"), 0);
55 case BuiltinType::OCLClkEvent:
56 return llvm::PointerType::get(
58 case BuiltinType::OCLQueue:
59 return llvm::PointerType::get(
61 case BuiltinType::OCLReserveID:
62 return llvm::PointerType::get(
69 uint32_t PipeAddrSpc =
94 return llvm::ConstantInt::get(Int32Ty, TypeSize,
false);
104 return llvm::ConstantInt::get(Int32Ty, TypeSize,
false);
void EmitStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
llvm::LLVMContext & getLLVMContext()
The base class of the type hierarchy.
virtual llvm::Value * getPipeElemAlign(const Expr *PipeArg)
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()
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
virtual llvm::Type * convertOpenCLSpecificType(const Type *T)
const TargetInfo & getTarget() const
Expr - This represents one expression.
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
virtual llvm::Value * getPipeElemSize(const Expr *PipeArg)
llvm::PointerType * SamplerTy
The l-value was considered opaque, so the alignment was determined from a type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
virtual LangAS::ID getOpenCLImageAddrSpace() const
Get OpenCL image type address space.
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
const T * getAs() const
Member-template getAs<specific type>'.
llvm::PointerType * getSamplerType()
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
virtual llvm::Type * getPipeType()
unsigned getTargetAddressSpace(QualType T) const
QualType getElementType() const