diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /examples/BrainF | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'examples/BrainF')
-rw-r--r-- | examples/BrainF/BrainFDriver.cpp | 21 | ||||
-rw-r--r-- | examples/BrainF/CMakeLists.txt | 2 | ||||
-rw-r--r-- | examples/BrainF/Makefile | 2 |
3 files changed, 12 insertions, 13 deletions
diff --git a/examples/BrainF/BrainFDriver.cpp b/examples/BrainF/BrainFDriver.cpp index e2de6bc..99c8ff3 100644 --- a/examples/BrainF/BrainFDriver.cpp +++ b/examples/BrainF/BrainFDriver.cpp @@ -26,8 +26,8 @@ #include "BrainF.h" #include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" -#include "llvm/ExecutionEngine/JIT.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Verifier.h" #include "llvm/Support/CommandLine.h" @@ -107,9 +107,8 @@ int main(int argc, char **argv) { OutputFilename = base+".bc"; } if (OutputFilename != "-") { - std::string ErrInfo; - out = new raw_fd_ostream(OutputFilename.c_str(), ErrInfo, - sys::fs::F_None); + std::error_code EC; + out = new raw_fd_ostream(OutputFilename, EC, sys::fs::F_None); } } @@ -125,13 +124,13 @@ int main(int argc, char **argv) { //Read the BrainF program BrainF bf; - Module *mod = bf.parse(in, 65536, cf, Context); //64 KiB + std::unique_ptr<Module> Mod(bf.parse(in, 65536, cf, Context)); // 64 KiB if (in != &std::cin) delete in; - addMainFunction(mod); + addMainFunction(Mod.get()); //Verify generated code - if (verifyModule(*mod)) { + if (verifyModule(*Mod)) { errs() << "Error: module failed verification. This shouldn't happen.\n"; abort(); } @@ -141,18 +140,18 @@ int main(int argc, char **argv) { InitializeNativeTarget(); outs() << "------- Running JIT -------\n"; - ExecutionEngine *ee = EngineBuilder(mod).create(); + Module &M = *Mod; + ExecutionEngine *ee = EngineBuilder(std::move(Mod)).create(); std::vector<GenericValue> args; - Function *brainf_func = mod->getFunction("brainf"); + Function *brainf_func = M.getFunction("brainf"); GenericValue gv = ee->runFunction(brainf_func, args); } else { - WriteBitcodeToFile(mod, *out); + WriteBitcodeToFile(Mod.get(), *out); } //Clean up if (out != &outs()) delete out; - delete mod; llvm_shutdown(); diff --git a/examples/BrainF/CMakeLists.txt b/examples/BrainF/CMakeLists.txt index 025d093..cf1cf1b 100644 --- a/examples/BrainF/CMakeLists.txt +++ b/examples/BrainF/CMakeLists.txt @@ -2,7 +2,7 @@ set(LLVM_LINK_COMPONENTS BitWriter Core ExecutionEngine - JIT + MC Support nativecodegen ) diff --git a/examples/BrainF/Makefile b/examples/BrainF/Makefile index 2c3e066..3e36e07 100644 --- a/examples/BrainF/Makefile +++ b/examples/BrainF/Makefile @@ -10,6 +10,6 @@ LEVEL = ../.. TOOLNAME = BrainF EXAMPLE_TOOL = 1 -LINK_COMPONENTS := jit bitwriter nativecodegen interpreter +LINK_COMPONENTS := mcjit bitwriter nativecodegen interpreter include $(LEVEL)/Makefile.common |