13464ebd5Sriastradh/**************************************************************************
23464ebd5Sriastradh *
33464ebd5Sriastradh * Copyright 2010 VMware, Inc.
43464ebd5Sriastradh * All Rights Reserved.
53464ebd5Sriastradh *
63464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a
73464ebd5Sriastradh * copy of this software and associated documentation files (the
83464ebd5Sriastradh * "Software"), to deal in the Software without restriction, including
93464ebd5Sriastradh * without limitation the rights to use, copy, modify, merge, publish,
103464ebd5Sriastradh * distribute, sub license, and/or sell copies of the Software, and to
113464ebd5Sriastradh * permit persons to whom the Software is furnished to do so, subject to
123464ebd5Sriastradh * the following conditions:
133464ebd5Sriastradh *
143464ebd5Sriastradh * The above copyright notice and this permission notice (including the
153464ebd5Sriastradh * next paragraph) shall be included in all copies or substantial portions
163464ebd5Sriastradh * of the Software.
173464ebd5Sriastradh *
183464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
193464ebd5Sriastradh * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
203464ebd5Sriastradh * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
213464ebd5Sriastradh * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
223464ebd5Sriastradh * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
233464ebd5Sriastradh * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
243464ebd5Sriastradh * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
253464ebd5Sriastradh *
263464ebd5Sriastradh **************************************************************************/
273464ebd5Sriastradh
283464ebd5Sriastradh/**
293464ebd5Sriastradh * @file
303464ebd5Sriastradh * Wrapper for LLVM header file #includes.
313464ebd5Sriastradh */
323464ebd5Sriastradh
333464ebd5Sriastradh
343464ebd5Sriastradh#ifndef LP_BLD_H
353464ebd5Sriastradh#define LP_BLD_H
363464ebd5Sriastradh
373464ebd5Sriastradh
383464ebd5Sriastradh/**
393464ebd5Sriastradh * @file
403464ebd5Sriastradh * LLVM IR building helpers interfaces.
413464ebd5Sriastradh *
423464ebd5Sriastradh * We use LLVM-C bindings for now. They are not documented, but follow the C++
433464ebd5Sriastradh * interfaces very closely, and appear to be complete enough for code
443464ebd5Sriastradh * genration. See
453464ebd5Sriastradh * http://npcontemplation.blogspot.com/2008/06/secret-of-llvm-c-bindings.html
463464ebd5Sriastradh * for a standalone example.
473464ebd5Sriastradh */
483464ebd5Sriastradh
497ec681f3Smrg#include <llvm/Config/llvm-config.h>
503464ebd5Sriastradh
517ec681f3Smrg#include <llvm-c/Core.h>
523464ebd5Sriastradh
533464ebd5Sriastradh
543464ebd5Sriastradh
553464ebd5Sriastradh/**
563464ebd5Sriastradh * Redefine these LLVM entrypoints as invalid macros to make sure we
573464ebd5Sriastradh * don't accidentally use them.  We need to use the functions which
583464ebd5Sriastradh * take an explicit LLVMContextRef parameter.
593464ebd5Sriastradh */
603464ebd5Sriastradh#define LLVMInt1Type ILLEGAL_LLVM_FUNCTION
613464ebd5Sriastradh#define LLVMInt8Type ILLEGAL_LLVM_FUNCTION
623464ebd5Sriastradh#define LLVMInt16Type ILLEGAL_LLVM_FUNCTION
633464ebd5Sriastradh#define LLVMInt32Type ILLEGAL_LLVM_FUNCTION
643464ebd5Sriastradh#define LLVMInt64Type ILLEGAL_LLVM_FUNCTION
653464ebd5Sriastradh#define LLVMIntType ILLEGAL_LLVM_FUNCTION
663464ebd5Sriastradh#define LLVMFloatType ILLEGAL_LLVM_FUNCTION
673464ebd5Sriastradh#define LLVMDoubleType ILLEGAL_LLVM_FUNCTION
683464ebd5Sriastradh#define LLVMX86FP80Type ILLEGAL_LLVM_FUNCTION
693464ebd5Sriastradh#define LLVMFP128Type ILLEGAL_LLVM_FUNCTION
703464ebd5Sriastradh#define LLVMPPCFP128Type ILLEGAL_LLVM_FUNCTION
713464ebd5Sriastradh#define LLVMStructType ILLEGAL_LLVM_FUNCTION
723464ebd5Sriastradh#define LLVMVoidType ILLEGAL_LLVM_FUNCTION
733464ebd5Sriastradh#define LLVMLabelType ILLEGAL_LLVM_FUNCTION
743464ebd5Sriastradh#define LLVMOpaqueType ILLEGAL_LLVM_FUNCTION
753464ebd5Sriastradh#define LLVMUnionType ILLEGAL_LLVM_FUNCTION
763464ebd5Sriastradh#define LLVMMDString ILLEGAL_LLVM_FUNCTION
773464ebd5Sriastradh#define LLVMMDNode ILLEGAL_LLVM_FUNCTION
783464ebd5Sriastradh#define LLVMConstString ILLEGAL_LLVM_FUNCTION
793464ebd5Sriastradh#define LLVMConstStruct ILLEGAL_LLVM_FUNCTION
803464ebd5Sriastradh#define LLVMAppendBasicBlock ILLEGAL_LLVM_FUNCTION
813464ebd5Sriastradh#define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
823464ebd5Sriastradh#define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
833464ebd5Sriastradh
847ec681f3Smrg#if LLVM_VERSION_MAJOR >= 8
857ec681f3Smrg#define GALLIVM_HAVE_CORO 1
867ec681f3Smrg#else
877ec681f3Smrg#define GALLIVM_HAVE_CORO 0
8801e04c3fSmrg#endif
8901e04c3fSmrg
903464ebd5Sriastradh#endif /* LP_BLD_H */
91