Mercurial > hg > CbC > CbC_llvm
comparison llvm/examples/OrcV2Examples/OrcV2CBindingsRemovableCode/OrcV2CBindingsRemovableCode.c @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
6 // | 6 // |
7 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
8 | 8 |
9 #include "llvm-c/Core.h" | 9 #include "llvm-c/Core.h" |
10 #include "llvm-c/Error.h" | 10 #include "llvm-c/Error.h" |
11 #include "llvm-c/Initialization.h" | |
12 #include "llvm-c/LLJIT.h" | 11 #include "llvm-c/LLJIT.h" |
13 #include "llvm-c/Support.h" | 12 #include "llvm-c/Support.h" |
14 #include "llvm-c/Target.h" | 13 #include "llvm-c/Target.h" |
15 | 14 |
16 #include <stdio.h> | 15 #include <stdio.h> |
53 LLVMValueRef Result = LLVMBuildAdd(Builder, SumArg0, SumArg1, "result"); | 52 LLVMValueRef Result = LLVMBuildAdd(Builder, SumArg0, SumArg1, "result"); |
54 | 53 |
55 // - Build the return instruction. | 54 // - Build the return instruction. |
56 LLVMBuildRet(Builder, Result); | 55 LLVMBuildRet(Builder, Result); |
57 | 56 |
57 // - Free the builder. | |
58 LLVMDisposeBuilder(Builder); | |
59 | |
58 // Our demo module is now complete. Wrap it and our ThreadSafeContext in a | 60 // Our demo module is now complete. Wrap it and our ThreadSafeContext in a |
59 // ThreadSafeModule. | 61 // ThreadSafeModule. |
60 LLVMOrcThreadSafeModuleRef TSM = LLVMOrcCreateNewThreadSafeModule(M, TSCtx); | 62 LLVMOrcThreadSafeModuleRef TSM = LLVMOrcCreateNewThreadSafeModule(M, TSCtx); |
61 | 63 |
62 // Dispose of our local ThreadSafeContext value. The underlying LLVMContext | 64 // Dispose of our local ThreadSafeContext value. The underlying LLVMContext |
65 | 67 |
66 // Return the result. | 68 // Return the result. |
67 return TSM; | 69 return TSM; |
68 } | 70 } |
69 | 71 |
70 int main(int argc, char *argv[]) { | 72 int main(int argc, const char *argv[]) { |
71 | 73 |
72 int MainResult = 0; | 74 int MainResult = 0; |
73 | 75 |
74 // Parse command line arguments and initialize LLVM Core. | 76 // Parse command line arguments and initialize LLVM Core. |
75 LLVMParseCommandLineOptions(argc, (const char **)argv, ""); | 77 LLVMParseCommandLineOptions(argc, argv, ""); |
76 LLVMInitializeCore(LLVMGetGlobalPassRegistry()); | |
77 | 78 |
78 // Initialize native target codegen and asm printer. | 79 // Initialize native target codegen and asm printer. |
79 LLVMInitializeNativeTarget(); | 80 LLVMInitializeNativeTarget(); |
80 LLVMInitializeNativeAsmPrinter(); | 81 LLVMInitializeNativeAsmPrinter(); |
81 | 82 |