Mercurial > octave-nkf
comparison libinterp/corefcn/pt-jit.cc @ 18840:4a4edf0f2077 nkf-ready
fix LLVM 3.4 build (bug #41061)
* configure.ac: Call new functions OCTAVE_LLVM_RAW_FD_OSTREAM_API and
OCTAVE_LLVM_LEGACY_PASSMANAGER_API, check for Verifier.h header file
* m4/acinclude.m4 (OCTAVE_LLVM_RAW_FD_OSTREAM_API): New function to
detect correct raw_fd_ostream API
* m4/acinclude.m4 (OCTAVE_LLVM_LEGACY_PASSMANAGER_API): New function
to detect legacy passmanager API
* libinterp/corefcn/jit-util.h: Use legacy passmanager namespace if
necessary
* libinterp/corefcn/pt-jit.h (class tree_jit): Use legacy passmanager
class if necessary
* libinterp/corefcn/pt-jit.cc: Include appropriate header files
* libinterp/corefcn/pt-jit.cc (tree_jit::initialize): Use legacy
passmanager if necessary
* libinterp/corefcn/pt-jit.cc (tree_jit::optimize): Use correct API
* libinterp/corefcn/jit-typeinfo.cc: Include appropriate header file
author | Stefan Mahr <dac922@gmx.de> |
---|---|
date | Sun, 11 May 2014 02:28:33 +0200 |
parents | fe0e34be5576 |
children | 770c0d79341b |
comparison
equal
deleted
inserted
replaced
18839:3af93835be56 | 18840:4a4edf0f2077 |
---|---|
48 | 48 |
49 static int Vjit_failure_count = 0; | 49 static int Vjit_failure_count = 0; |
50 | 50 |
51 #include <llvm/Analysis/CallGraph.h> | 51 #include <llvm/Analysis/CallGraph.h> |
52 #include <llvm/Analysis/Passes.h> | 52 #include <llvm/Analysis/Passes.h> |
53 | |
54 #ifdef HAVE_LLVM_IR_VERIFIER_H | |
55 #include <llvm/IR/Verifier.h> | |
56 #else | |
53 #include <llvm/Analysis/Verifier.h> | 57 #include <llvm/Analysis/Verifier.h> |
58 #endif | |
59 | |
54 #include <llvm/Bitcode/ReaderWriter.h> | 60 #include <llvm/Bitcode/ReaderWriter.h> |
55 #include <llvm/ExecutionEngine/ExecutionEngine.h> | 61 #include <llvm/ExecutionEngine/ExecutionEngine.h> |
56 #include <llvm/ExecutionEngine/JIT.h> | 62 #include <llvm/ExecutionEngine/JIT.h> |
63 | |
64 #ifdef LEGACY_PASSMANAGER | |
65 #include <llvm/IR/LegacyPassManager.h> | |
66 #else | |
57 #include <llvm/PassManager.h> | 67 #include <llvm/PassManager.h> |
68 #endif | |
58 | 69 |
59 #ifdef HAVE_LLVM_IR_FUNCTION_H | 70 #ifdef HAVE_LLVM_IR_FUNCTION_H |
60 #include <llvm/IR/LLVMContext.h> | 71 #include <llvm/IR/LLVMContext.h> |
61 #include <llvm/IR/Module.h> | 72 #include <llvm/IR/Module.h> |
62 #else | 73 #else |
2051 engine = llvm::ExecutionEngine::createJIT (module); | 2062 engine = llvm::ExecutionEngine::createJIT (module); |
2052 | 2063 |
2053 if (! engine) | 2064 if (! engine) |
2054 return false; | 2065 return false; |
2055 | 2066 |
2067 #ifdef LEGACY_PASSMANAGER | |
2068 module_pass_manager = new llvm::legacy::PassManager (); | |
2069 pass_manager = new llvm::legacy::FunctionPassManager (module); | |
2070 #else | |
2056 module_pass_manager = new llvm::PassManager (); | 2071 module_pass_manager = new llvm::PassManager (); |
2072 pass_manager = new llvm::FunctionPassManager (module); | |
2073 #endif | |
2057 module_pass_manager->add (llvm::createAlwaysInlinerPass ()); | 2074 module_pass_manager->add (llvm::createAlwaysInlinerPass ()); |
2058 | 2075 |
2059 pass_manager = new llvm::FunctionPassManager (module); | |
2060 #ifdef HAVE_LLVM_DATALAYOUT | 2076 #ifdef HAVE_LLVM_DATALAYOUT |
2061 pass_manager->add (new llvm::DataLayout (*engine->getDataLayout ())); | 2077 pass_manager->add (new llvm::DataLayout (*engine->getDataLayout ())); |
2062 #else | 2078 #else |
2063 pass_manager->add (new llvm::TargetData (*engine->getTargetData ())); | 2079 pass_manager->add (new llvm::TargetData (*engine->getTargetData ())); |
2064 #endif | 2080 #endif |
2169 pass_manager->run (*fn); | 2185 pass_manager->run (*fn); |
2170 | 2186 |
2171 if (Vdebug_jit) | 2187 if (Vdebug_jit) |
2172 { | 2188 { |
2173 std::string error; | 2189 std::string error; |
2190 #ifdef RAW_FD_OSTREAM_ARG_IS_LLVM_SYS_FS | |
2191 llvm::raw_fd_ostream fout ("test.bc", error, | |
2192 llvm::sys::fs::F_Binary); | |
2193 #else | |
2174 llvm::raw_fd_ostream fout ("test.bc", error, | 2194 llvm::raw_fd_ostream fout ("test.bc", error, |
2175 llvm::raw_fd_ostream::F_Binary); | 2195 llvm::raw_fd_ostream::F_Binary); |
2196 #endif | |
2176 llvm::WriteBitcodeToFile (module, fout); | 2197 llvm::WriteBitcodeToFile (module, fout); |
2177 } | 2198 } |
2178 } | 2199 } |
2179 | 2200 |
2180 // -------------------- jit_function_info -------------------- | 2201 // -------------------- jit_function_info -------------------- |