llvm.org GIT mirror llvm / 42fc558
Make Kaleidoscope not link against the interpreter, since that didn't work anyway (Interpreter::getPointerToFunction doesn't return a callable pointer), and improve the error message when an ExecutionEngine can't be created. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95896 91177308-0d34-0410-b5e6-96231b3b80d8 Jeffrey Yasskin 9 years ago
12 changed file(s) with 53 addition(s) and 21 deletion(s). Raw diff Collapse all Expand all
484484
485485

                  
                
486486 # Compile
487 g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit interpreter native` -O3 -o toy
487 g++ -g toy.cpp `llvm-config --cppflags --ldflags --libs core jit native` -O3 -o toy
488488 # Run
489489 ./toy
490490
501501

                  
                
502502 #include "llvm/DerivedTypes.h"
503503 #include "llvm/ExecutionEngine/ExecutionEngine.h"
504 #include "llvm/ExecutionEngine/Interpreter.h"
505504 #include "llvm/ExecutionEngine/JIT.h"
506505 #include "llvm/LLVMContext.h"
507506 #include "llvm/Module.h"
10741073 TheModule = new Module("my cool jit", Context);
10751074
10761075 // Create the JIT. This takes ownership of the module.
1077 TheExecutionEngine = EngineBuilder(TheModule).create();
1076 std::string ErrStr;
1077 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
1078 if (!TheExecutionEngine) {
1079 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
1080 exit(1);
1081 }
10781082
10791083 FunctionPassManager OurFPM(TheModule);
10801084
901901

                  
                
902902 #include "llvm/DerivedTypes.h"
903903 #include "llvm/ExecutionEngine/ExecutionEngine.h"
904 #include "llvm/ExecutionEngine/Interpreter.h"
905904 #include "llvm/ExecutionEngine/JIT.h"
906905 #include "llvm/LLVMContext.h"
907906 #include "llvm/Module.h"
17191718 TheModule = new Module("my cool jit", Context);
17201719
17211720 // Create the JIT. This takes ownership of the module.
1722 TheExecutionEngine = EngineBuilder(TheModule).create();
1721 std::string ErrStr;
1722 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
1723 if (!TheExecutionEngine) {
1724 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
1725 exit(1);
1726 }
17231727
17241728 FunctionPassManager OurFPM(TheModule);
17251729
820820

                  
                
821821 #include "llvm/DerivedTypes.h"
822822 #include "llvm/ExecutionEngine/ExecutionEngine.h"
823 #include "llvm/ExecutionEngine/Interpreter.h"
824823 #include "llvm/ExecutionEngine/JIT.h"
825824 #include "llvm/LLVMContext.h"
826825 #include "llvm/Module.h"
17561755 TheModule = new Module("my cool jit", Context);
17571756
17581757 // Create the JIT. This takes ownership of the module.
1759 TheExecutionEngine = EngineBuilder(TheModule).create();
1758 std::string ErrStr;
1759 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
1760 if (!TheExecutionEngine) {
1761 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
1762 exit(1);
1763 }
17601764
17611765 FunctionPassManager OurFPM(TheModule);
17621766
10031003

                  
                
10041004 #include "llvm/DerivedTypes.h"
10051005 #include "llvm/ExecutionEngine/ExecutionEngine.h"
1006 #include "llvm/ExecutionEngine/Interpreter.h"
10071006 #include "llvm/ExecutionEngine/JIT.h"
10081007 #include "llvm/LLVMContext.h"
10091008 #include "llvm/Module.h"
21042103 TheModule = new Module("my cool jit", Context);
21052104
21062105 // Create the JIT. This takes ownership of the module.
2107 TheExecutionEngine = EngineBuilder(TheModule).create();
2106 std::string ErrStr;
2107 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
2108 if (!TheExecutionEngine) {
2109 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
2110 exit(1);
2111 }
21082112
21092113 FunctionPassManager OurFPM(TheModule);
21102114
99 TOOLNAME = Kaleidoscope-Ch4
1010 EXAMPLE_TOOL = 1
1111
12 LINK_COMPONENTS := core jit interpreter native
12 LINK_COMPONENTS := core jit native
1313
1414 include $(LEVEL)/Makefile.common
0 #include "llvm/DerivedTypes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/Interpreter.h"
32 #include "llvm/ExecutionEngine/JIT.h"
43 #include "llvm/LLVMContext.h"
54 #include "llvm/Module.h"
572571 TheModule = new Module("my cool jit", Context);
573572
574573 // Create the JIT. This takes ownership of the module.
575 TheExecutionEngine = EngineBuilder(TheModule).create();
574 std::string ErrStr;
575 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
576 if (!TheExecutionEngine) {
577 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
578 exit(1);
579 }
576580
577581 FunctionPassManager OurFPM(TheModule);
578582
99 TOOLNAME = Kaleidoscope-Ch5
1010 EXAMPLE_TOOL = 1
1111
12 LINK_COMPONENTS := core jit interpreter native
12 LINK_COMPONENTS := core jit native
1313
1414 include $(LEVEL)/Makefile.common
0 #include "llvm/DerivedTypes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/Interpreter.h"
32 #include "llvm/ExecutionEngine/JIT.h"
43 #include "llvm/LLVMContext.h"
54 #include "llvm/Module.h"
817816 TheModule = new Module("my cool jit", Context);
818817
819818 // Create the JIT. This takes ownership of the module.
820 TheExecutionEngine = EngineBuilder(TheModule).create();
819 std::string ErrStr;
820 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
821 if (!TheExecutionEngine) {
822 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
823 exit(1);
824 }
821825
822826 FunctionPassManager OurFPM(TheModule);
823827
99 TOOLNAME = Kaleidoscope-Ch6
1010 EXAMPLE_TOOL = 1
1111
12 LINK_COMPONENTS := core jit interpreter native
12 LINK_COMPONENTS := core jit native
1313
1414 include $(LEVEL)/Makefile.common
0 #include "llvm/DerivedTypes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/Interpreter.h"
32 #include "llvm/ExecutionEngine/JIT.h"
43 #include "llvm/LLVMContext.h"
54 #include "llvm/Module.h"
935934 TheModule = new Module("my cool jit", Context);
936935
937936 // Create the JIT. This takes ownership of the module.
938 TheExecutionEngine = EngineBuilder(TheModule).create();
937 std::string ErrStr;
938 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
939 if (!TheExecutionEngine) {
940 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
941 exit(1);
942 }
939943
940944 FunctionPassManager OurFPM(TheModule);
941945
1010 EXAMPLE_TOOL = 1
1111 REQUIRES_RTTI := 1
1212
13 LINK_COMPONENTS := core jit interpreter native
13 LINK_COMPONENTS := core jit native
1414
1515 include $(LEVEL)/Makefile.common
0 #include "llvm/DerivedTypes.h"
11 #include "llvm/ExecutionEngine/ExecutionEngine.h"
2 #include "llvm/ExecutionEngine/Interpreter.h"
32 #include "llvm/ExecutionEngine/JIT.h"
43 #include "llvm/LLVMContext.h"
54 #include "llvm/Module.h"
10991098 TheModule = new Module("my cool jit", Context);
11001099
11011100 // Create the JIT. This takes ownership of the module.
1102 TheExecutionEngine = EngineBuilder(TheModule).create();
1101 std::string ErrStr;
1102 TheExecutionEngine = EngineBuilder(TheModule).setErrorStr(&ErrStr).create();
1103 if (!TheExecutionEngine) {
1104 fprintf(stderr, "Could not create ExecutionEngine: %s\n", ErrStr.c_str());
1105 exit(1);
1106 }
11031107
11041108 FunctionPassManager OurFPM(TheModule);
11051109