|
| 1 | +#ifndef CPPAD_CG_LLVM9_0_INCLUDED |
| 2 | +#define CPPAD_CG_LLVM9_0_INCLUDED |
| 3 | +/* -------------------------------------------------------------------------- |
| 4 | + * CppADCodeGen: C++ Algorithmic Differentiation with Source Code Generation: |
| 5 | + * Copyright (C) 2019 Joao Leal |
| 6 | + * |
| 7 | + * CppADCodeGen is distributed under multiple licenses: |
| 8 | + * |
| 9 | + * - Eclipse Public License Version 1.0 (EPL1), and |
| 10 | + * - GNU General Public License Version 3 (GPL3). |
| 11 | + * |
| 12 | + * EPL1 terms and conditions can be found in the file "epl-v10.txt", while |
| 13 | + * terms and conditions for the GPL3 can be found in the file "gpl3.txt". |
| 14 | + * ---------------------------------------------------------------------------- |
| 15 | + * Author: Joao Leal |
| 16 | + */ |
| 17 | + |
| 18 | +/** |
| 19 | + * LLVM requires the use of it own flags which can make it difficult to compile |
| 20 | + * libraries not using NDEBUG often required by LLVM. |
| 21 | + * The define LLVM_CPPFLAG_NDEBUG can be used to apply NDEBUG only to LLVM |
| 22 | + * headers. |
| 23 | + */ |
| 24 | +#ifdef LLVM_WITH_NDEBUG |
| 25 | + |
| 26 | +// save the original NDEBUG definition |
| 27 | +#ifdef NDEBUG |
| 28 | +#define _OUTER_NDEBUG_DEFINED |
| 29 | +#endif |
| 30 | + |
| 31 | +#if LLVM_WITH_NDEBUG == 1 |
| 32 | +#define NDEBUG |
| 33 | +#else |
| 34 | +#undef NDEBUG |
| 35 | +#endif |
| 36 | + |
| 37 | +#endif |
| 38 | + |
| 39 | +#include <clang/CodeGen/CodeGenAction.h> |
| 40 | +#include <clang/Basic/DiagnosticOptions.h> |
| 41 | +#include <clang/Basic/TargetInfo.h> |
| 42 | +#include <clang/Basic/SourceManager.h> |
| 43 | +#include <clang/Frontend/CompilerInstance.h> |
| 44 | +#include <clang/Frontend/CompilerInvocation.h> |
| 45 | +#include <clang/Frontend/FrontendDiagnostic.h> |
| 46 | +#include <clang/Frontend/TextDiagnosticPrinter.h> |
| 47 | +#include <clang/Frontend/Utils.h> |
| 48 | +#include <clang/Parse/ParseAST.h> |
| 49 | +#include <clang/Lex/Preprocessor.h> |
| 50 | +#include <clang/Lex/PreprocessorOptions.h> |
| 51 | + |
| 52 | +#include <llvm/Analysis/Passes.h> |
| 53 | +#include <llvm/IR/Verifier.h> |
| 54 | +#include <llvm/ExecutionEngine/ExecutionEngine.h> |
| 55 | +#include <llvm/ExecutionEngine/SectionMemoryManager.h> |
| 56 | +//#include <llvm/ExecutionEngine/JIT.h> |
| 57 | +#include <llvm/IR/LegacyPassManager.h> |
| 58 | +#include <llvm/IR/Module.h> |
| 59 | +#include <llvm/IR/LLVMContext.h> |
| 60 | +#include <llvm/Pass.h> |
| 61 | +#include <llvm/Transforms/IPO/PassManagerBuilder.h> |
| 62 | +#include <llvm/Bitcode/BitcodeReader.h> |
| 63 | +#include <llvm/Bitcode/BitcodeWriter.h> |
| 64 | +#include <llvm/Support/ManagedStatic.h> |
| 65 | +#include <llvm/Support/MemoryBuffer.h> |
| 66 | +#include <llvm/Support/TargetSelect.h> |
| 67 | +#include <llvm/Support/raw_os_ostream.h> |
| 68 | +//#include <llvm/Support/system_error.h> |
| 69 | +#include <llvm/Linker/Linker.h> |
| 70 | +#include <llvm/Support/Program.h> |
| 71 | + |
| 72 | +#ifdef LLVM_WITH_NDEBUG |
| 73 | + |
| 74 | +// recover the original NDEBUG |
| 75 | +#ifdef _OUTER_NDEBUG_DEFINED |
| 76 | +#define NDEBUG |
| 77 | +#else |
| 78 | +#undef NDEBUG |
| 79 | +#endif |
| 80 | + |
| 81 | +// no need for this anymore |
| 82 | +#undef _OUTER_NDEBUG_DEFINED |
| 83 | + |
| 84 | +#endif |
| 85 | + |
| 86 | +#include <cppad/cg/model/compiler/clang_compiler.hpp> |
| 87 | +#include <cppad/cg/model/llvm/llvm_model_library.hpp> |
| 88 | +#include <cppad/cg/model/llvm/llvm_model.hpp> |
| 89 | +#include <cppad/cg/model/llvm/v5_0/llvm_model_library_impl.hpp> // yes, this is from version 5.0 |
| 90 | +#include <cppad/cg/model/llvm/v9_0/llvm_model_library_processor.hpp> |
| 91 | + |
| 92 | +#endif |
0 commit comments