OLD | NEW |
1 //===-- ExecutionEngineBindings.cpp - C bindings for EEs ------------------===// | 1 //===-- ExecutionEngineBindings.cpp - C bindings for EEs ------------------===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file defines the C bindings for the ExecutionEngine library. | 10 // This file defines the C bindings for the ExecutionEngine library. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 *OutError = strdup(Error.c_str()); | 133 *OutError = strdup(Error.c_str()); |
134 return 1; | 134 return 1; |
135 } | 135 } |
136 | 136 |
137 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) { | 137 void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) { |
138 delete unwrap(EE); | 138 delete unwrap(EE); |
139 } | 139 } |
140 | 140 |
141 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) { | 141 void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) { |
142 unwrap(EE)->runStaticConstructorsDestructors(false); | 142 unwrap(EE)->runStaticConstructorsDestructors(false, ExecutionEngine::Lazy); |
143 } | 143 } |
144 | 144 |
145 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) { | 145 void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) { |
146 unwrap(EE)->runStaticConstructorsDestructors(true); | 146 unwrap(EE)->runStaticConstructorsDestructors(true, ExecutionEngine::Lazy); |
147 } | 147 } |
148 | 148 |
149 int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F, | 149 int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F, |
150 unsigned ArgC, const char * const *ArgV, | 150 unsigned ArgC, const char * const *ArgV, |
151 const char * const *EnvP) { | 151 const char * const *EnvP) { |
152 std::vector<std::string> ArgVec; | 152 std::vector<std::string> ArgVec; |
153 for (unsigned I = 0; I != ArgC; ++I) | 153 for (unsigned I = 0; I != ArgC; ++I) |
154 ArgVec.push_back(ArgV[I]); | 154 ArgVec.push_back(ArgV[I]); |
155 ·· | 155 ·· |
156 return unwrap(EE)->runFunctionAsMain(unwrap<Function>(F), ArgVec, EnvP); | 156 return unwrap(EE)->runFunctionAsMain(unwrap<Function>(F), ArgVec, EnvP, |
| 157 ExecutionEngine::Lazy); |
157 } | 158 } |
158 | 159 |
159 LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F, | 160 LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F, |
160 unsigned NumArgs, | 161 unsigned NumArgs, |
161 LLVMGenericValueRef *Args) { | 162 LLVMGenericValueRef *Args) { |
162 std::vector<GenericValue> ArgVec; | 163 std::vector<GenericValue> ArgVec; |
163 ArgVec.reserve(NumArgs); | 164 ArgVec.reserve(NumArgs); |
164 for (unsigned I = 0; I != NumArgs; ++I) | 165 for (unsigned I = 0; I != NumArgs; ++I) |
165 ArgVec.push_back(*unwrap(Args[I])); | 166 ArgVec.push_back(*unwrap(Args[I])); |
166 ·· | 167 ·· |
167 GenericValue *Result = new GenericValue(); | 168 GenericValue *Result = new GenericValue(); |
168 *Result = unwrap(EE)->runFunction(unwrap<Function>(F), ArgVec); | 169 *Result = unwrap(EE)->runFunction(unwrap<Function>(F), ArgVec, |
| 170 ExecutionEngine::Lazy); |
169 return wrap(Result); | 171 return wrap(Result); |
170 } | 172 } |
171 | 173 |
172 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) { | 174 void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) { |
173 unwrap(EE)->freeMachineCodeForFunction(unwrap<Function>(F)); | 175 unwrap(EE)->freeMachineCodeForFunction(unwrap<Function>(F)); |
174 } | 176 } |
175 | 177 |
176 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP){ | 178 void LLVMAddModuleProvider(LLVMExecutionEngineRef EE, LLVMModuleProviderRef MP){ |
177 unwrap(EE)->addModuleProvider(unwrap(MP)); | 179 unwrap(EE)->addModuleProvider(unwrap(MP)); |
178 } | 180 } |
(...skipping 23 matching lines...) Expand all Loading... |
202 LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE) { | 204 LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE) { |
203 return wrap(unwrap(EE)->getTargetData()); | 205 return wrap(unwrap(EE)->getTargetData()); |
204 } | 206 } |
205 | 207 |
206 void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global, | 208 void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global, |
207 void* Addr) { | 209 void* Addr) { |
208 unwrap(EE)->addGlobalMapping(unwrap<GlobalValue>(Global), Addr); | 210 unwrap(EE)->addGlobalMapping(unwrap<GlobalValue>(Global), Addr); |
209 } | 211 } |
210 | 212 |
211 void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global) { | 213 void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global) { |
212 return unwrap(EE)->getPointerToGlobal(unwrap<GlobalValue>(Global)); | 214 return unwrap(EE)->getPointerToGlobal(unwrap<GlobalValue>(Global), |
| 215 ExecutionEngine::Lazy); |
213 } | 216 } |
OLD | NEW |