diff --git a/src/codegen.cpp b/src/codegen.cpp index 9ec32746850f2..89e4785597823 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -7447,6 +7447,14 @@ static jl_llvm_functions_t declarations.functionObject = needsparams ? "jl_fptr_sparam" : "jl_fptr_args"; } + if (ctx.emission_context.debug_level >= 2 && lam->def.method && jl_is_method(lam->def.method) && lam->specTypes != (jl_value_t*)jl_emptytuple_type) { + ios_t sigbuf; + ios_mem(&sigbuf, 0); + jl_static_show_func_sig((JL_STREAM*) &sigbuf, (jl_value_t*)lam->specTypes); + f->addFnAttr("julia.fsig", StringRef(sigbuf.buf, sigbuf.size)); + ios_close(&sigbuf); + } + AttrBuilder FnAttrs(ctx.builder.getContext(), f->getAttributes().getFnAttrs()); AttrBuilder RetAttrs(ctx.builder.getContext(), f->getAttributes().getRetAttrs()); diff --git a/src/disasm.cpp b/src/disasm.cpp index 9414c0a2a065d..886cb8e43844a 100644 --- a/src/disasm.cpp +++ b/src/disasm.cpp @@ -363,6 +363,10 @@ class LineNumberAnnotatedWriter : public AssemblyAnnotationWriter { void LineNumberAnnotatedWriter::emitFunctionAnnot( const Function *F, formatted_raw_ostream &Out) { + if (F->hasFnAttribute("julia.fsig")) { + auto sig = F->getFnAttribute("julia.fsig").getValueAsString(); + Out << "; Function Signature: " << sig << "\n"; + } InstrLoc = nullptr; DISubprogram *FuncLoc = F->getSubprogram(); if (!FuncLoc) {