JuliaLang/julia — pull request #935 by tautologico (2012-06-16 02:55:39+00:00)
Title: Disassemble of LLVM code for a method

This is a slightly improved version of the LLVM disassemble code I wrote in a gist. I don't know if it should be merged as is, but decided to create a pull request to discuss it anyway.

The Julia front-end llvm_dump must be loaded from ldump.jl in extras. The builtin function llvm_dump_lambda returns a Julia string with the LLVM code, given the LambdaStaticData for the method (jl_lambda_info_t on the C side). It compiles (or recompiles) the method if the LLVM functionObject is NULL. I don't know if this has any impact on the whole of code generation.

The code is returned as a Julia string that can then be printed, written to a file, etc. It's still missing some checks (if the function is a builtin, for example, it won't have a LLVM function object), but I hope this is useful as a starting point.