}
void
+mono_llvm_add_string_metadata (LLVMValueRef insref, const char* label, const char* text)
+{
+ auto ins = unwrap<Instruction> (insref);
+ auto &ctx = ins->getContext ();
+ ins->setMetadata (label, MDNode::get (ctx, MDString::get (ctx, text)));
+}
+
+void
mono_llvm_set_implicit_branch (LLVMBuilderRef builder, LLVMValueRef branch)
{
auto b = unwrap (builder);
mono_llvm_build_weighted_branch (LLVMBuilderRef builder, LLVMValueRef cond, LLVMBasicBlockRef t, LLVMBasicBlockRef f, uint32_t t_weight, uint32_t f_weight);
void
+mono_llvm_add_string_metadata (LLVMValueRef insref, const char* label, const char* text);
+
+void
mono_llvm_set_implicit_branch (LLVMBuilderRef builder, LLVMValueRef branch);
void
static int tramp_index;
char *name;
- name = g_strdup_printf ("tramp_%d", tramp_index);
+ name = g_strdup_printf ("[tramp_%d] %s", tramp_index, mono_method_full_name (call->method, TRUE));
tramp_index ++;
/*
if (ins->opcode != OP_TAILCALL && ins->opcode != OP_TAILCALL_MEMBASE && LLVMGetInstructionOpcode (lcall) == LLVMCall)
mono_llvm_set_call_notailcall (lcall);
+ // Add original method name we are currently emitting as a custom string metadata (the only way to leave comments in LLVM IR)
+ if (mono_debug_enabled () && call && call->method)
+ mono_llvm_add_string_metadata (lcall, "managed_name", mono_method_full_name (call->method, TRUE));
+
// As per the LLVM docs, a function has a noalias return value if and only if
// it is an allocation function. This is an allocation function.
if (call->method && call->method->wrapper_type == MONO_WRAPPER_ALLOC)