Crate mir_sys

Source
Expand description

§MIR project bindings for Rust

This is the low-level binding that only exposes raw C types and functions, and handles compilation and linking of C code.

See mir-rs crate for high-level ergonomic APIs.

§Source

The source code of mir C library is bundled in this package. Since upstream lacks some API/features that are necessary for Rust integration, we use a forked version of mir.

The fork can be seen at this repo, and the current revision is based on upstream version v1.0.0.

⚠️ The API/ABI is NOT compatible with upstream mir library.

§Features

⚠️ Warning: Currently, due to lack of support of bindgen, extern functions may still be generated even with corresponding feature disabled. Be careful to avoid using them when disabling features, or you may encounter link errors.

  • default: Implies io, scan, interp, gen.

  • io: De/serialization of MIR memory representation into/from bytes. If disabled, C macro MIR_NO_IO is set for compilation.

    Guarded APIs:

    • MIR_write{,_module}{,_with_func}
    • MIR_read{,_with_func}
  • scan: Parsing of MIR textual representation. If disabled, C macro MIR_NO_SCAN is set for compilation.

    Guarded API:

    • MIR_scan_string
  • interp: Enables MIR interpreter. If disabled, C macro MIR_NO_INTERP is set for compilation.

    Guarded APIs:

    • MIR_interp*
  • gen: MIR native code generator. If disabled, mir-gen.c will not be compiled.

    Guarded APIs:

    • MIR_gen*
    • MIR_set_*_gen_interface
  • gen-debug: Debug logging in MIR native code generator. It implies gen. If disabled, C macro MIR_NO_GEN_DEBUG is set for compilation.

    Guarded APIs:

    • MIR_gen_set_debug_{file,level}
  • assert: Debug assertions. If disabled, C macro NDEBUG is set for compilation. It is implicitly enabled when debug_assertions is on (eg. in dev profile).

Structs§

DLIST_LINK_MIR_insn_t
DLIST_LINK_MIR_item_t
DLIST_LINK_MIR_module_t
DLIST_MIR_insn_t
DLIST_MIR_item_t
DLIST_MIR_module_t
MIR_bss
MIR_context
MIR_data
MIR_expr_data
MIR_func
MIR_insn
MIR_item
MIR_lref_data
MIR_mem_t
MIR_module
MIR_op_tLittle-endian
MIR_proto
MIR_ref_data
MIR_str
MIR_var
VARR_MIR_var_t

Constants§

MIR_ADD
MIR_ADDO
MIR_ADDOS
MIR_ADDR
MIR_ADDR8
MIR_ADDR16
MI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_bss_item
MIR_call_op_error
MIR_ctx_change_error
MIR_data_item
MIR_export_item
MIR_expr_data_item
MIR_finish_error
MIR_forward_item
MIR_func_error
MIR_func_item
MIR_hard_reg_error
MIR_import_export_error
MIR_import_item
MIR_invalid_insn_error
MIR_lref_data_item
MIR_nested_func_error
MIR_nested_module_error
MIR_no_error
MIR_no_func_error
MIR_no_module_error
MIR_op_mode_error
MIR_ops_num_error
MIR_out_op_error
MIR_proto_item
MIR_ref_data_item
MIR_reg_type_error
MIR_repeated_decl_error
MIR_reserved_name_error
MIR_ret_error
MIR_syntax_error
MIR_undeclared_func_reg_error
MIR_undeclared_op_ref_error
MIR_unique_reg_error
MIR_unspec_op_error
MIR_vararg_func_error
MIR_wrong_lref_error
MIR_wrong_param_value_error
MIR_wrong_type_error

Functions§

MIR_alias
MIR_alias_name
MIR_append_insn
MIR_change_module_ctx
MIR_copy_insn
MIR_finish
MIR_finish_func
MIR_finish_module
MIR_gengen
MIR_gen_finishgen
MIR_gen_initgen
MIR_gen_set_debug_filegen
MIR_gen_set_debug_levelgen
MIR_gen_set_optimize_levelgen
MIR_get_error_func
MIR_get_func_redef_permission_p
MIR_get_global_item
MIR_get_item_func
MIR_get_module_list
MIR_init
MIR_insert_insn_after
MIR_insert_insn_before
MIR_insn_name
MIR_insn_nops
MIR_insn_op_mode
MIR_interp
MIR_interp_arr
MIR_item_name
MIR_link
MIR_load_external
MIR_load_module
MIR_new_alias_mem_op
MIR_new_bss
MIR_new_call_insn
MIR_new_data
MIR_new_double_op
MIR_new_export
MIR_new_expr_data
MIR_new_float_op
MIR_new_forward
MIR_new_func
MIR_new_func_arr
MIR_new_func_reg
MIR_new_global_func_reg
MIR_new_import
MIR_new_insn
MIR_new_insn_arr
MIR_new_int_op
MIR_new_jcall_insn
MIR_new_label
MIR_new_label_op
MIR_new_ldouble_op
MIR_new_lref_data
MIR_new_mem_op
MIR_new_module
MIR_new_proto
MIR_new_proto_arr
MIR_new_ref_data
MIR_new_ref_op
MIR_new_reg_op
MIR_new_ret_insn
MIR_new_str_op
MIR_new_string_data
MIR_new_uint_op
MIR_new_vararg_func
MIR_new_vararg_func_arr
MIR_new_vararg_proto
MIR_new_vararg_proto_arr
MIR_op_eq_p
MIR_op_hash_step
MIR_output
MIR_output_insn
MIR_output_item
MIR_output_module
MIR_output_op
MIR_output_str
MIR_prepend_insn
MIR_read
MIR_read_with_func
MIR_reg
MIR_reg_hard_reg_name
MIR_reg_name
MIR_reg_type
MIR_remove_insn
MIR_reverse_branch_code
MIR_scan_string
MIR_set_error_func
MIR_set_func_redef_permission
MIR_set_gen_interfacegen
MIR_set_interp_interface
MIR_set_lazy_bb_gen_interfacegen
MIR_set_lazy_gen_interfacegen
MIR_type_str
MIR_write
MIR_write_module
MIR_write_module_with_func
MIR_write_with_func
_MIR_get_api_version
_MIR_init

Type Aliases§

MIR_alias_t
MIR_bss_t
MIR_context_t
MIR_data_t
MIR_disp_t
MIR_error_func_t
MIR_error_type
MIR_error_type_t
MIR_expr_data_t
MIR_func_t
MIR_insn_code_t
MIR_insn_code_t_u32
MIR_insn_t
MIR_item_t
MIR_item_type_t
MIR_label_t
MIR_lref_data_t
MIR_module_t
MIR_name_t
MIR_op_mode_t
MIR_op_mode_t_u8
MIR_proto_t
MIR_ref_data_t
MIR_reg_t
MIR_scale_t
MIR_str_t
MIR_type_t
MIR_type_t_u8
MIR_var_t
htab_hash_t

Unions§

MIR_data__bindgen_ty_1
MIR_imm_t
MIR_item__bindgen_ty_1
MIR_op_t__u
MIR_val_t