clang: lib/CodeGen/CGOpenCLRuntime.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
19#include "llvm/IR/DerivedTypes.h"
20#include "llvm/IR/GlobalValue.h"
22
23using namespace clang;
24using namespace CodeGen;
25
27
31}
32
35
36
38 return TransTy;
39
42
44}
45
50}
51
54 return PipeTy;
55
56 if (T->isReadOnly())
58 else
60}
61
63 llvm::Type *&PipeTy) {
64 if (!PipeTy)
66 return PipeTy;
67}
68
72
76 else
79}
80
83
84 llvm::Type *Int32Ty = llvm::IntegerType::getInt32Ty(CGM.getLLVMContext());
88 return llvm::ConstantInt::get(Int32Ty, TypeSize, false);
89}
90
93
94 llvm::Type *Int32Ty = llvm::IntegerType::getInt32Ty(CGM.getLLVMContext());
98 return llvm::ConstantInt::get(Int32Ty, TypeSize, false);
99}
100
103 return llvm::PointerType::get(
106}
107
108
109
110
111
112
114 const Expr *Prev = nullptr;
115 while(!isa(E) && E != Prev) {
116 Prev = E;
118 if (auto DR = dyn_cast(E)) {
119 E = cast(DR->getDecl())->getInit();
120 }
121 }
122 return cast(E);
123}
124
125
126
128 llvm::Function *InvokeF,
129 llvm::Value *Block, llvm::Type *BlockTy) {
130 assert(.contains(E) && "Block expression emitted twice");
131 assert(isallvm::Function(InvokeF) && "Invalid invoke function");
132 assert(Block->getType()->isPointerTy() && "Invalid block literal type");
137}
138
141}
142
146
147
148
150
152
153
156 }
157
160
161
164}
static const BlockExpr * getBlockExpr(const Expr *E)
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
unsigned getTargetAddressSpace(LangAS AS) const
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
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,...
const LangOptions & getLangOpts() const
ASTContext & getContext() const
const TargetCodeGenInfo & getTargetCodeGenInfo()
llvm::LLVMContext & getLLVMContext()
virtual llvm::Type * getOpenCLType(CodeGenModule &CGM, const Type *T) const
Return an LLVM type that corresponds to an OpenCL 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
The base class of the type hierarchy.
const T * castAs() const
Member-template castAs.
bool isOpenCLSpecificType() const
Represents a variable declaration or definition.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T
Structure for enqueued block information.