size = mono_class_value_size (mono_class_from_mono_type (t), NULL);
- while (size < sizeof (gpointer) && mono_is_power_of_two (size) == -1)
+ while (size < 2 * sizeof (gpointer) && mono_is_power_of_two (size) == -1)
size ++;
return size;
if (LLVMGetTypeKind (stype) == LLVMPointerTypeKind)
return LLVMBuildPtrToInt (ctx->builder, v, dtype, "");
-#ifdef MONO_ARCH_SOFT_FLOAT
- if (stype == LLVMInt32Type () && dtype == LLVMFloatType ())
- return LLVMBuildBitCast (ctx->builder, v, dtype, "");
- if (stype == LLVMInt32Type () && dtype == LLVMDoubleType ())
- return LLVMBuildBitCast (ctx->builder, LLVMBuildZExt (ctx->builder, v, LLVMInt64Type (), ""), dtype, "");
-#endif
+ if (mono_arch_is_soft_float ()) {
+ if (stype == LLVMInt32Type () && dtype == LLVMFloatType ())
+ return LLVMBuildBitCast (ctx->builder, v, dtype, "");
+ if (stype == LLVMInt32Type () && dtype == LLVMDoubleType ())
+ return LLVMBuildBitCast (ctx->builder, LLVMBuildZExt (ctx->builder, v, LLVMInt64Type (), ""), dtype, "");
+ }
if (LLVMGetTypeKind (stype) == LLVMVectorTypeKind && LLVMGetTypeKind (dtype) == LLVMVectorTypeKind)
return LLVMBuildBitCast (ctx->builder, v, dtype, "");
LLVMAddGlobalMapping (ee, callee, target);
}
}
+
+ if (call->method && strstr (call->method->klass->name, "AsyncVoidMethodBuilder"))
+ /* LLVM miscompiles async methods */
+ LLVM_FAILURE (ctx, "#13734");
} else if (calli) {
} else {
MonoJitICallInfo *info = mono_find_jit_icall_by_addr (call->fptr);
values [ins->dreg] = LLVMBuildFPExt (builder, v, LLVMDoubleType (), dname);
break;
case OP_SEXT_I4:
- values [ins->dreg] = LLVMBuildSExt (builder, lhs, LLVMInt64Type (), dname);
+ values [ins->dreg] = LLVMBuildSExt (builder, convert (ctx, lhs, LLVMInt32Type ()), LLVMInt64Type (), dname);
break;
case OP_ZEXT_I4:
- values [ins->dreg] = LLVMBuildZExt (builder, lhs, LLVMInt64Type (), dname);
+ values [ins->dreg] = LLVMBuildZExt (builder, convert (ctx, lhs, LLVMInt32Type ()), LLVMInt64Type (), dname);
break;
case OP_TRUNC_I4:
values [ins->dreg] = LLVMBuildTrunc (builder, lhs, LLVMInt32Type (), dname);
static int count = 0;
count ++;
- if (getenv ("LLVM_COUNT")) {
- if (count == atoi (getenv ("LLVM_COUNT"))) {
+ if (g_getenv ("LLVM_COUNT")) {
+ if (count == atoi (g_getenv ("LLVM_COUNT"))) {
printf ("LAST: %s\n", mono_method_full_name (cfg->method, TRUE));
fflush (stdout);
last = TRUE;
}
- if (count > atoi (getenv ("LLVM_COUNT")))
+ if (count > atoi (g_getenv ("LLVM_COUNT")))
LLVM_FAILURE (ctx, "");
}
}
mark_as_used (module, method);
+ if (cfg->compile_aot) {
+ LLVMValueRef md_args [16];
+ LLVMValueRef md_node;
+ int method_index;
+
+ method_index = mono_aot_get_method_index (cfg->orig_method);
+ md_args [0] = LLVMMDString (method_name, strlen (method_name));
+ md_args [1] = LLVMConstInt (LLVMInt32Type (), method_index, FALSE);
+ md_node = LLVMMDNode (md_args, 2);
+ LLVMAddNamedMetadataOperand (module, "mono.function_indexes", md_node);
+ //LLVMSetMetadata (method, md_kind, LLVMMDNode (&md_arg, 1));
+ }
+
if (cfg->compile_aot) {
/* Don't generate native code, keep the LLVM IR */
if (cfg->compile_aot && cfg->verbose_level)