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-c/Core.h>
50
51
52/** Ensure HAVE_LLVM is set to avoid #ifdef HAVE_LLVM everywhere */
53#ifndef HAVE_LLVM
54#error "HAVE_LLVM should be set with LLVM's version number, e.g. (0x0207 for 2.7)"
55#endif
56
57
58/**
59 * Redefine these LLVM entrypoints as invalid macros to make sure we
60 * don't accidentally use them.  We need to use the functions which
61 * take an explicit LLVMContextRef parameter.
62 */
63#define LLVMInt1Type ILLEGAL_LLVM_FUNCTION
64#define LLVMInt8Type ILLEGAL_LLVM_FUNCTION
65#define LLVMInt16Type ILLEGAL_LLVM_FUNCTION
66#define LLVMInt32Type ILLEGAL_LLVM_FUNCTION
67#define LLVMInt64Type ILLEGAL_LLVM_FUNCTION
68#define LLVMIntType ILLEGAL_LLVM_FUNCTION
69#define LLVMFloatType ILLEGAL_LLVM_FUNCTION
70#define LLVMDoubleType ILLEGAL_LLVM_FUNCTION
71#define LLVMX86FP80Type ILLEGAL_LLVM_FUNCTION
72#define LLVMFP128Type ILLEGAL_LLVM_FUNCTION
73#define LLVMPPCFP128Type ILLEGAL_LLVM_FUNCTION
74#define LLVMStructType ILLEGAL_LLVM_FUNCTION
75#define LLVMVoidType ILLEGAL_LLVM_FUNCTION
76#define LLVMLabelType ILLEGAL_LLVM_FUNCTION
77#define LLVMOpaqueType ILLEGAL_LLVM_FUNCTION
78#define LLVMUnionType ILLEGAL_LLVM_FUNCTION
79#define LLVMMDString ILLEGAL_LLVM_FUNCTION
80#define LLVMMDNode ILLEGAL_LLVM_FUNCTION
81#define LLVMConstString ILLEGAL_LLVM_FUNCTION
82#define LLVMConstStruct ILLEGAL_LLVM_FUNCTION
83#define LLVMAppendBasicBlock ILLEGAL_LLVM_FUNCTION
84#define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
85#define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
86
87#endif /* LP_BLD_H */
88