1 /**************************************************************************
2  *
3  * Copyright 2010 VMware, Inc.
4  * All Rights Reserved.
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the
8  * "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sub license, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice (including the
15  * next paragraph) shall be included in all copies or substantial portions
16  * of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21  * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25  *
26  **************************************************************************/
27 
28 /**
29  * @file
30  * Wrapper for LLVM header file #includes.
31  */
32 
33 
34 #ifndef LP_BLD_H
35 #define LP_BLD_H
36 
37 
38 /**
39  * @file
40  * LLVM IR building helpers interfaces.
41  *
42  * We use LLVM-C bindings for now. They are not documented, but follow the C++
43  * interfaces very closely, and appear to be complete enough for code
44  * genration. See
45  * http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
46  * for a standalone example.
47  */
48 
49 #include <llvm/Config/llvm-config.h>
50 
51 #include <llvm-c/Core.h>
52 
53 
54 
55 /**
56  * Redefine these LLVM entrypoints as invalid macros to make sure we
57  * don't accidentally use them.  We need to use the functions which
58  * take an explicit LLVMContextRef parameter.
59  */
60 #define LLVMInt1Type ILLEGAL_LLVM_FUNCTION
61 #define LLVMInt8Type ILLEGAL_LLVM_FUNCTION
62 #define LLVMInt16Type ILLEGAL_LLVM_FUNCTION
63 #define LLVMInt32Type ILLEGAL_LLVM_FUNCTION
64 #define LLVMInt64Type ILLEGAL_LLVM_FUNCTION
65 #define LLVMIntType ILLEGAL_LLVM_FUNCTION
66 #define LLVMFloatType ILLEGAL_LLVM_FUNCTION
67 #define LLVMDoubleType ILLEGAL_LLVM_FUNCTION
68 #define LLVMX86FP80Type ILLEGAL_LLVM_FUNCTION
69 #define LLVMFP128Type ILLEGAL_LLVM_FUNCTION
70 #define LLVMPPCFP128Type ILLEGAL_LLVM_FUNCTION
71 #define LLVMStructType ILLEGAL_LLVM_FUNCTION
72 #define LLVMVoidType ILLEGAL_LLVM_FUNCTION
73 #define LLVMLabelType ILLEGAL_LLVM_FUNCTION
74 #define LLVMOpaqueType ILLEGAL_LLVM_FUNCTION
75 #define LLVMUnionType ILLEGAL_LLVM_FUNCTION
76 #define LLVMMDString ILLEGAL_LLVM_FUNCTION
77 #define LLVMMDNode ILLEGAL_LLVM_FUNCTION
78 #define LLVMConstString ILLEGAL_LLVM_FUNCTION
79 #define LLVMConstStruct ILLEGAL_LLVM_FUNCTION
80 #define LLVMAppendBasicBlock ILLEGAL_LLVM_FUNCTION
81 #define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
82 #define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
83 
84 #if LLVM_VERSION_MAJOR >= 8
85 #define GALLIVM_HAVE_CORO 1
86 #else
87 #define GALLIVM_HAVE_CORO 0
88 #endif
89 
90 #endif /* LP_BLD_H */
91