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
: Impliesio
,scan
,interp
,gen
. -
io
: De/serialization of MIR memory representation into/from bytes. If disabled, C macroMIR_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 macroMIR_NO_SCAN
is set for compilation.Guarded API:
MIR_scan_string
-
interp
: Enables MIR interpreter. If disabled, C macroMIR_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 impliesgen
. If disabled, C macroMIR_NO_GEN_DEBUG
is set for compilation.Guarded APIs:
MIR_gen_set_debug_{file,level}
-
assert
: Debug assertions. If disabled, C macroNDEBUG
is set for compilation. It is implicitly enabled whendebug_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_ t Little-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 - MIR_
ADDR32 - MIR_
ADDS - MIR_
ALLOCA - MIR_AND
- MIR_
ANDS - MIR_
API_ VERSION - MIR_
BEND - MIR_BEQ
- MIR_
BEQS - MIR_BF
- MIR_BFS
- MIR_BGE
- MIR_
BGES - MIR_BGT
- MIR_
BGTS - MIR_BLE
- MIR_
BLES - MIR_
BLK_ NUM - MIR_BLT
- MIR_
BLTS - MIR_BNE
- MIR_
BNES - MIR_BNO
- MIR_BO
- MIR_
BSTART - MIR_BT
- MIR_BTS
- MIR_
CALL - MIR_D2F
- MIR_D2I
- MIR_
D2LD - MIR_
DADD - MIR_
DBEQ - MIR_
DBGE - MIR_
DBGT - MIR_
DBLE - MIR_
DBLT - MIR_
DBNE - MIR_
DDIV - MIR_DEQ
- MIR_DGE
- MIR_DGT
- MIR_DIV
- MIR_
DIVS - MIR_DLE
- MIR_DLT
- MIR_
DMOV - MIR_
DMUL - MIR_DNE
- MIR_
DNEG - MIR_
DSUB - MIR_EQ
- MIR_EQS
- MIR_
EXT8 - MIR_
EXT16 - MIR_
EXT32 - MIR_F2D
- MIR_F2I
- MIR_
F2LD - MIR_
FADD - MIR_
FBEQ - MIR_
FBGE - MIR_
FBGT - MIR_
FBLE - MIR_
FBLT - MIR_
FBNE - MIR_
FDIV - MIR_FEQ
- MIR_FGE
- MIR_FGT
- MIR_FLE
- MIR_FLT
- MIR_
FMOV - MIR_
FMUL - MIR_FNE
- MIR_
FNEG - MIR_
FSUB - MIR_GE
- MIR_GES
- MIR_GT
- MIR_GTS
- MIR_I2D
- MIR_I2F
- MIR_
I2LD - MIR_
INLINE - MIR_
INSN_ BOUND - MIR_
INVALID_ INSN - MIR_
JCALL - MIR_JMP
- MIR_
JMPI - MIR_
JRET - MIR_
LABEL - MIR_
LADDR - MIR_
LD2D - MIR_
LD2F - MIR_
LD2I - MIR_
LDADD - MIR_
LDBEQ - MIR_
LDBGE - MIR_
LDBGT - MIR_
LDBLE - MIR_
LDBLT - MIR_
LDBNE - MIR_
LDDIV - MIR_
LDEQ - MIR_
LDGE - MIR_
LDGT - MIR_
LDLE - MIR_
LDLT - MIR_
LDMOV - MIR_
LDMUL - MIR_
LDNE - MIR_
LDNEG - MIR_
LDSUB - MIR_LE
- MIR_LES
- MIR_LSH
- MIR_
LSHS - MIR_LT
- MIR_LTS
- MIR_
MAX_ REG_ NUM - MIR_
MAX_ SCALE - MIR_MOD
- MIR_
MODS - MIR_MOV
- MIR_MUL
- MIR_
MULO - MIR_
MULOS - MIR_
MULS - MIR_NE
- MIR_NEG
- MIR_
NEGS - MIR_NES
- MIR_
NON_ VAR - MIR_
NO_ IO - MIR_
NO_ SCAN - MIR_
OP_ BOUND - MIR_
OP_ DOUBLE - MIR_
OP_ FLOAT - MIR_
OP_ INT - MIR_
OP_ LABEL - MIR_
OP_ LDOUBLE - MIR_
OP_ MEM - MIR_
OP_ REF - MIR_
OP_ REG - MIR_
OP_ STR - MIR_
OP_ UINT - MIR_
OP_ UNDEF - MIR_
OP_ VAR - MIR_
OP_ VAR_ MEM - MIR_OR
- MIR_ORS
- MIR_PHI
- MIR_
PRBEQ - MIR_
PRBNE - MIR_
PRSET - MIR_
PTR32 - MIR_
PTR64 - MIR_RET
- MIR_RSH
- MIR_
RSHS - MIR_SUB
- MIR_
SUBO - MIR_
SUBOS - MIR_
SUBS - MIR_
SWITCH - MIR_
T_ BLK - MIR_
T_ BOUND - MIR_T_D
- MIR_T_F
- MIR_
T_ I8 - MIR_
T_ I16 - MIR_
T_ I32 - MIR_
T_ I64 - MIR_
T_ LD - MIR_T_P
- MIR_
T_ RBLK - MIR_
T_ U8 - MIR_
T_ U16 - MIR_
T_ U32 - MIR_
T_ U64 - MIR_
T_ UNDEF - MIR_
UBGE - MIR_
UBGES - MIR_
UBGT - MIR_
UBGTS - MIR_
UBLE - MIR_
UBLES - MIR_
UBLT - MIR_
UBLTS - MIR_
UBNO - MIR_UBO
- MIR_
UDIV - MIR_
UDIVS - MIR_
UEXT8 - MIR_
UEXT16 - MIR_
UEXT32 - MIR_UGE
- MIR_
UGES - MIR_UGT
- MIR_
UGTS - MIR_
UI2D - MIR_
UI2F - MIR_
UI2LD - MIR_ULE
- MIR_
ULES - MIR_ULT
- MIR_
ULTS - MIR_
UMOD - MIR_
UMODS - MIR_
UMULO - MIR_
UMULOS - MIR_
UNSPEC - MIR_
URSH - MIR_
URSHS - MIR_USE
- MIR_
VA_ ARG - MIR_
VA_ BLOCK_ ARG - MIR_
VA_ END - MIR_
VA_ START - MIR_XOR
- MIR_
XORS - MIR_
alloc_ error - MIR_
binary_ io_ error - MIR_
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_gen⚠
gen
- MIR_
gen_ ⚠finish gen
- MIR_
gen_ ⚠init gen
- MIR_
gen_ ⚠set_ debug_ file gen
- MIR_
gen_ ⚠set_ debug_ level gen
- MIR_
gen_ ⚠set_ optimize_ level gen
- 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_ interface gen
- MIR_
set_ ⚠interp_ interface - MIR_
set_ ⚠lazy_ bb_ gen_ interface gen
- MIR_
set_ ⚠lazy_ gen_ interface gen
- 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