code_llvm

..  code_llvm(f, types)

Prints the LLVM bitcodes generated for running the method matching the given generic function and type signature to :const:`STDOUT`.

All metadata and dbg.* calls are removed from the printed bitcode. Use code_llvm_raw for the full IR.

Examples

In Julia, the code_llvm function is used to print the LLVM bitcodes generated for running a method that matches the given generic function and type signature. It prints the bitcodes to STDOUT (standard output). It is important to note that all metadata and dbg.* calls are removed from the printed bitcode. For the full IR, you can use the code_llvm_raw function.

Usage example:

julia> function add_numbers(x::Int, y::Int)
           return x + y
       end
add_numbers (generic function with 1 method)

julia> code_llvm(add_numbers, (Int, Int))
define i64 @"julia_add_numbers#373"(i64, i64) {
top:
  %2 = add i64 %1, %0
  ret i64 %2
}

In this example, the code_llvm function is used to print the LLVM bitcodes for the add_numbers function with arguments of type Int and Int.

Please note that the example provided above is a simplified representation of the LLVM bitcodes and may vary depending on your Julia version and system configuration.

See Also

assert, backtrace, code_llvm, code_lowered, code_native, code_typed, code_warntype, :@which, compilecache, current_module, eval, finalize, finalizer, fullname, function_module, function_name, include_dependency, InterruptException, invoke, isconst, isdefined, isgeneric, methodswith, method_exists, module_name, module_parent, require, subtypes, unsafe_load, workspace, __precompile__,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: