llvm.org GIT mirror llvm / 72878a5
Fix the JIT code for the Kaleidoscope tutorial. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223670 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 4 years ago
4 changed file(s) with 36 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
0 #include "llvm/Analysis/Passes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/MCJIT.h"
3 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
24 #include "llvm/IR/DataLayout.h"
35 #include "llvm/IR/DerivedTypes.h"
46 #include "llvm/IR/IRBuilder.h"
511513 // Evaluate a top-level expression into an anonymous function.
512514 if (FunctionAST *F = ParseTopLevelExpr()) {
513515 if (Function *LF = F->Codegen()) {
516 TheExecutionEngine->finalizeObject();
514517 // JIT the function, returning a function pointer.
515518 void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
516519
556559
557560 int main() {
558561 InitializeNativeTarget();
562 InitializeNativeTargetAsmPrinter();
563 InitializeNativeTargetAsmParser();
559564 LLVMContext &Context = getGlobalContext();
560565
561566 // Install standard binary operators.
575580
576581 // Create the JIT. This takes ownership of the module.
577582 std::string ErrStr;
578 TheExecutionEngine =
579 EngineBuilder(std::move(Owner)).setErrorStr(&ErrStr).create();
583 TheExecutionEngine = EngineBuilder(std::move(Owner))
584 .setErrorStr(&ErrStr)
585 .setMCJITMemoryManager(new SectionMemoryManager())
586 .create();
580587 if (!TheExecutionEngine) {
581588 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
582589 exit(1);
0 #include "llvm/Analysis/Passes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/MCJIT.h"
3 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
24 #include "llvm/IR/DataLayout.h"
35 #include "llvm/IR/DerivedTypes.h"
46 #include "llvm/IR/IRBuilder.h"
756758 // Evaluate a top-level expression into an anonymous function.
757759 if (FunctionAST *F = ParseTopLevelExpr()) {
758760 if (Function *LF = F->Codegen()) {
761 TheExecutionEngine->finalizeObject();
759762 // JIT the function, returning a function pointer.
760763 void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
761764
801804
802805 int main() {
803806 InitializeNativeTarget();
807 InitializeNativeTargetAsmPrinter();
808 InitializeNativeTargetAsmParser();
804809 LLVMContext &Context = getGlobalContext();
805810
806811 // Install standard binary operators.
820825
821826 // Create the JIT. This takes ownership of the module.
822827 std::string ErrStr;
823 TheExecutionEngine =
824 EngineBuilder(std::move(Owner)).setErrorStr(&ErrStr).create();
828 TheExecutionEngine = EngineBuilder(std::move(Owner))
829 .setErrorStr(&ErrStr)
830 .setMCJITMemoryManager(new SectionMemoryManager())
831 .create();
825832 if (!TheExecutionEngine) {
826833 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
827834 exit(1);
0 #include "llvm/Analysis/Passes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/MCJIT.h"
3 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
24 #include "llvm/IR/DataLayout.h"
35 #include "llvm/IR/DerivedTypes.h"
46 #include "llvm/IR/IRBuilder.h"
867869 // Evaluate a top-level expression into an anonymous function.
868870 if (FunctionAST *F = ParseTopLevelExpr()) {
869871 if (Function *LF = F->Codegen()) {
872 TheExecutionEngine->finalizeObject();
870873 // JIT the function, returning a function pointer.
871874 void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
872875
919922
920923 int main() {
921924 InitializeNativeTarget();
925 InitializeNativeTargetAsmPrinter();
926 InitializeNativeTargetAsmParser();
922927 LLVMContext &Context = getGlobalContext();
923928
924929 // Install standard binary operators.
938943
939944 // Create the JIT. This takes ownership of the module.
940945 std::string ErrStr;
941 TheExecutionEngine =
942 EngineBuilder(std::move(Owner)).setErrorStr(&ErrStr).create();
946 TheExecutionEngine = EngineBuilder(std::move(Owner))
947 .setErrorStr(&ErrStr)
948 .setMCJITMemoryManager(new SectionMemoryManager())
949 .create();
943950 if (!TheExecutionEngine) {
944951 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
945952 exit(1);
0 #include "llvm/Analysis/Passes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/MCJIT.h"
3 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
24 #include "llvm/IR/DataLayout.h"
35 #include "llvm/IR/DerivedTypes.h"
46 #include "llvm/IR/IRBuilder.h"
10301032 // Evaluate a top-level expression into an anonymous function.
10311033 if (FunctionAST *F = ParseTopLevelExpr()) {
10321034 if (Function *LF = F->Codegen()) {
1035 TheExecutionEngine->finalizeObject();
10331036 // JIT the function, returning a function pointer.
10341037 void *FPtr = TheExecutionEngine->getPointerToFunction(LF);
10351038
10821085
10831086 int main() {
10841087 InitializeNativeTarget();
1088 InitializeNativeTargetAsmPrinter();
1089 InitializeNativeTargetAsmParser();
10851090 LLVMContext &Context = getGlobalContext();
10861091
10871092 // Install standard binary operators.
11021107
11031108 // Create the JIT. This takes ownership of the module.
11041109 std::string ErrStr;
1105 TheExecutionEngine =
1106 EngineBuilder(std::move(Owner)).setErrorStr(&ErrStr).create();
1110 TheExecutionEngine = EngineBuilder(std::move(Owner))
1111 .setErrorStr(&ErrStr)
1112 .setMCJITMemoryManager(new SectionMemoryManager())
1113 .create();
11071114 if (!TheExecutionEngine) {
11081115 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
11091116 exit(1);