19#include "llvm/IR/DerivedTypes.h"
20#include "llvm/IR/GlobalValue.h"
34 assert(
T->isOpenCLSpecificType() &&
"Not an OpenCL specific type!");
37 if (llvm::Type *TransTy =
CGM.getTargetCodeGenInfo().getOpenCLType(
CGM,
T))
47 uint32_t AddrSpc =
CGM.getContext().getTargetAddressSpace(
48 CGM.getContext().getOpenCLTypeAddrSpace(
T));
49 return llvm::PointerType::get(
CGM.getLLVMContext(), AddrSpc);
53 if (llvm::Type *PipeTy =
CGM.getTargetCodeGenInfo().getOpenCLType(
CGM,
T))
63 llvm::Type *&PipeTy) {
73 if (llvm::Type *TransTy =
CGM.getTargetCodeGenInfo().getOpenCLType(
74 CGM,
CGM.getContext().OCLSamplerTy.getTypePtr()))
84 llvm::Type *Int32Ty = llvm::IntegerType::getInt32Ty(
CGM.getLLVMContext());
85 unsigned TypeSize =
CGM.getContext()
88 return llvm::ConstantInt::get(Int32Ty, TypeSize,
false);
94 llvm::Type *Int32Ty = llvm::IntegerType::getInt32Ty(
CGM.getLLVMContext());
95 unsigned TypeSize =
CGM.getContext()
98 return llvm::ConstantInt::get(Int32Ty, TypeSize,
false);
102 assert(
CGM.getLangOpts().OpenCL);
103 return llvm::PointerType::get(
104 CGM.getLLVMContext(),
114 const Expr *Prev =
nullptr;
118 if (
auto DR = dyn_cast<DeclRefExpr>(E)) {
128 llvm::Function *InvokeF,
129 llvm::Value *
Block, llvm::Type *BlockTy) {
132 assert(
Block->getType()->isPointerTy() &&
"Invalid block literal type");
static const BlockExpr * getBlockExpr(const Expr *E)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
virtual llvm::Type * getPipeType(const PipeType *T, StringRef Name, llvm::Type *&PipeTy)
EnqueuedBlockInfo emitOpenCLEnqueuedBlock(CodeGenFunction &CGF, const Expr *E)
llvm::PointerType * getPointerType(const Type *T)
virtual llvm::Value * getPipeElemAlign(const Expr *PipeArg)
llvm::Function * getInvokeFunction(const Expr *E)
void recordBlockInfo(const BlockExpr *E, llvm::Function *InvokeF, llvm::Value *Block, llvm::Type *BlockTy)
Record invoke function and block literal emitted during normal codegen for a block expression.
llvm::PointerType * getGenericVoidPointerType()
llvm::DenseMap< const Expr *, EnqueuedBlockInfo > EnqueuedBlockMap
Maps block expression to block information.
virtual llvm::Type * convertOpenCLSpecificType(const Type *T)
virtual llvm::Value * getPipeElemSize(const Expr *PipeArg)
virtual ~CGOpenCLRuntime()
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...
llvm::Type * getSamplerType(const Type *T)
CodeGenFunction - This class organizes the per-function state that is used while generating LLVM code...
void EmitStaticVarDecl(const VarDecl &D, llvm::GlobalValue::LinkageTypes Linkage)
const TargetCodeGenInfo & getTargetHooks() const
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
virtual llvm::Value * createEnqueuedBlockKernel(CodeGenFunction &CGF, llvm::Function *BlockInvokeFunc, llvm::Type *BlockTy) const
Create an OpenCL kernel for an enqueued block.
This represents one expression.
Expr * IgnoreCasts() LLVM_READONLY
Skip past any casts which might surround this expression until reaching a fixed point.
QualType getElementType() const
const T * castAs() const
Member-template castAs<specific type>.
Represents a variable declaration or definition.
@ Type
The l-value was considered opaque, so the alignment was determined from a type.
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
const FunctionProtoType * T
U cast(CodeGen::Address addr)
Structure for enqueued block information.
llvm::Type * BlockTy
The first argument to enqueued block kernel.
llvm::Value * BlockArg
Enqueued block kernel reference.
llvm::Function * InvokeFunc
llvm::Value * KernelHandle
Block invoke function.