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