Пример #1
0
/* string -> ExecutionEngine.t -> llvalue option */
CAMLprim value llvm_ee_find_function(value Name, LLVMExecutionEngineRef EE) {
  CAMLparam1(Name);
  CAMLlocal1(Option);
  LLVMValueRef Found;
  if (LLVMFindFunction(EE, String_val(Name), &Found))
    CAMLreturn(Val_unit);
  Option = alloc(1, 0);
  Field(Option, 0) = Val_op(Found);
  CAMLreturn(Option);
}
Пример #2
0
Файл: jit.c Проект: a4a881d4/nvc
void jit_bind_fn(const char *name, void *ptr)
{
   if (using_jit) {
      LLVMValueRef fn;
      if (LLVMFindFunction(exec_engine, name, &fn))
         return;

      LLVMAddGlobalMapping(exec_engine, fn, ptr);
   }
}
Пример #3
0
Файл: jit.c Проект: a4a881d4/nvc
void *jit_fun_ptr(const char *name, bool required)
{
   if (using_jit) {
      LLVMValueRef fn;
      if (LLVMFindFunction(exec_engine, name, &fn)) {
         if (required)
            fatal("cannot find function %s", name);
         else
            return NULL;
      }

      return LLVMGetPointerToGlobal(exec_engine, fn);
   }
   else
      return jit_var_ptr(name, required);
}
Пример #4
0
SWIGEXPORT jint JNICALL Java_org_jllvm_bindings_ExecutionEngineJNI_LLVMFindFunction(JNIEnv *jenv, jclass jcls, jlong jarg1, jstring jarg2, jlong jarg3) {
  jint jresult = 0 ;
  LLVMExecutionEngineRef arg1 = (LLVMExecutionEngineRef) 0 ;
  char *arg2 = (char *) 0 ;
  LLVMValueRef *arg3 = (LLVMValueRef *) 0 ;
  LLVMBool result;
  
  (void)jenv;
  (void)jcls;
  arg1 = *(LLVMExecutionEngineRef *)&jarg1; 
  arg2 = 0;
  if (jarg2) {
    arg2 = (char *)(*jenv)->GetStringUTFChars(jenv, jarg2, 0);
    if (!arg2) return 0;
  }
  arg3 = *(LLVMValueRef **)&jarg3; 
  result = (LLVMBool)LLVMFindFunction(arg1,(char const *)arg2,arg3);
  jresult = (jint)result; 
  if (arg2) (*jenv)->ReleaseStringUTFChars(jenv, jarg2, (const char *)arg2);
  return jresult;
}