]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/CodeGen/CGOpenCLRuntime.h
Import libxo-0.8.0:
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / CodeGen / CGOpenCLRuntime.h
1 //===----- CGOpenCLRuntime.h - Interface to OpenCL Runtimes -----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This provides an abstract class for OpenCL code generation.  Concrete
11 // subclasses of this implement code generation for specific OpenCL
12 // runtime libraries.
13 //
14 //===----------------------------------------------------------------------===//
15
16 #ifndef LLVM_CLANG_LIB_CODEGEN_CGOPENCLRUNTIME_H
17 #define LLVM_CLANG_LIB_CODEGEN_CGOPENCLRUNTIME_H
18
19 #include "clang/AST/Type.h"
20 #include "llvm/IR/Type.h"
21 #include "llvm/IR/Value.h"
22
23 namespace clang {
24
25 class VarDecl;
26
27 namespace CodeGen {
28
29 class CodeGenFunction;
30 class CodeGenModule;
31
32 class CGOpenCLRuntime {
33 protected:
34   CodeGenModule &CGM;
35   llvm::Type *PipeTy;
36   llvm::PointerType *SamplerTy;
37
38 public:
39   CGOpenCLRuntime(CodeGenModule &CGM) : CGM(CGM), PipeTy(nullptr),
40     SamplerTy(nullptr) {}
41   virtual ~CGOpenCLRuntime();
42
43   /// Emit the IR required for a work-group-local variable declaration, and add
44   /// an entry to CGF's LocalDeclMap for D.  The base class does this using
45   /// CodeGenFunction::EmitStaticVarDecl to emit an internal global for D.
46   virtual void EmitWorkGroupLocalVarDecl(CodeGenFunction &CGF,
47                                          const VarDecl &D);
48
49   virtual llvm::Type *convertOpenCLSpecificType(const Type *T);
50
51   virtual llvm::Type *getPipeType();
52
53   llvm::PointerType *getSamplerType();
54
55   // \brief Returnes a value which indicates the size in bytes of the pipe
56   // element.
57   virtual llvm::Value *getPipeElemSize(const Expr *PipeArg);
58
59   // \brief Returnes a value which indicates the alignment in bytes of the pipe
60   // element.
61   virtual llvm::Value *getPipeElemAlign(const Expr *PipeArg);
62 };
63
64 }
65 }
66
67 #endif