Fix a ValueTracking rule: RHS means operand 1, not 0. Add a simple
[oota-llvm.git] / lib / ExecutionEngine / ExecutionEngineBindings.cpp
index 20ee78044cf76975146140c14489494aad35bf4d..39bf60121e08bbbb6a83a804e1bd3d20d394e80c 100644 (file)
@@ -78,6 +78,7 @@ double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal) {
     assert(0 && "LLVMGenericValueToFloat supports only float and double.");
     break;
   }
+  return 0; // Not reached
 }
 
 void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal) {
@@ -103,7 +104,7 @@ int LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
                           char **OutError) {
   std::string Error;
   if (ExecutionEngine *Interp =
-      ExecutionEngine::create(unwrap(MP), false, &Error)) {
+      ExecutionEngine::create(unwrap(MP), true, &Error)) {
     *OutInterp = wrap(Interp);
     return 0;
   }
@@ -113,9 +114,11 @@ int LLVMCreateInterpreter(LLVMExecutionEngineRef *OutInterp,
 
 int LLVMCreateJITCompiler(LLVMExecutionEngineRef *OutJIT,
                           LLVMModuleProviderRef MP,
+                          int Fast,
                           char **OutError) {
   std::string Error;
-  if (ExecutionEngine *JIT = ExecutionEngine::createJIT(unwrap(MP), &Error)) {
+  if (ExecutionEngine *JIT = ExecutionEngine::createJIT(unwrap(MP), &Error, 0,
+                                                        Fast != 0)) {
     *OutJIT = wrap(JIT);
     return 0;
   }
@@ -187,3 +190,16 @@ int LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
   }
   return 1;
 }
+
+LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE) {
+  return wrap(unwrap(EE)->getTargetData());
+}
+
+void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
+                          void* Addr) {
+  unwrap(EE)->addGlobalMapping(unwrap<GlobalValue>(Global), Addr);
+}
+
+void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global) {
+  return unwrap(EE)->getPointerToGlobal(unwrap<GlobalValue>(Global));
+}