mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-18 18:32:32 +00:00
BrainF example: fixing segfault caused by outdated code with missing MCJIT dependency
Differential Revision: https://reviews.llvm.org/D26280 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289857 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3ed425b164
commit
0eeb59d037
@ -29,6 +29,7 @@
|
||||
#include "llvm/Bitcode/BitcodeWriter.h"
|
||||
#include "llvm/ExecutionEngine/ExecutionEngine.h"
|
||||
#include "llvm/ExecutionEngine/GenericValue.h"
|
||||
#include "llvm/ExecutionEngine/MCJIT.h"
|
||||
#include "llvm/IR/BasicBlock.h"
|
||||
#include "llvm/IR/Constants.h"
|
||||
#include "llvm/IR/DerivedTypes.h"
|
||||
@ -153,10 +154,15 @@ int main(int argc, char **argv) {
|
||||
//Write it out
|
||||
if (JIT) {
|
||||
InitializeNativeTarget();
|
||||
InitializeNativeTargetAsmPrinter();
|
||||
|
||||
outs() << "------- Running JIT -------\n";
|
||||
Module &M = *Mod;
|
||||
ExecutionEngine *ee = EngineBuilder(std::move(Mod)).create();
|
||||
if (!ee) {
|
||||
errs() << "Error: execution engine creation failed.\n";
|
||||
abort();
|
||||
}
|
||||
std::vector<GenericValue> args;
|
||||
Function *brainf_func = M.getFunction("brainf");
|
||||
GenericValue gv = ee->runFunction(brainf_func, args);
|
||||
|
@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS
|
||||
Core
|
||||
ExecutionEngine
|
||||
MC
|
||||
MCJIT
|
||||
Support
|
||||
nativecodegen
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user