Add intrinsic calling convention.
This commit is contained in:
parent
c483808e0f
commit
72c6c60d80
@ -4525,10 +4525,12 @@ let trans_visitor
|
||||
[| Asm.WORD (word_ty_mach, Asm.IMM 0L) |]))
|
||||
in
|
||||
|
||||
let trans_required_fn (fnid:node_id) (blockid:node_id) : unit =
|
||||
let trans_real_required_fn
|
||||
(fnid:node_id)
|
||||
(blockid:node_id) : unit =
|
||||
let (ilib, conv) = Hashtbl.find cx.ctxt_required_items fnid in
|
||||
trans_frame_entry fnid;
|
||||
emit (Il.Enter (Hashtbl.find cx.ctxt_block_fixups blockid));
|
||||
let (ilib, conv) = Hashtbl.find cx.ctxt_required_items fnid in
|
||||
let lib_num =
|
||||
htab_search_or_add cx.ctxt_required_lib_num ilib
|
||||
(fun _ -> Hashtbl.length cx.ctxt_required_lib_num)
|
||||
@ -4655,6 +4657,12 @@ let trans_visitor
|
||||
"Trans.required_rust_fn on unexpected form of require library"
|
||||
in
|
||||
|
||||
let trans_required_fn (fnid:node_id) (blockid:node_id) : unit =
|
||||
if fn_is_intrinsic cx fnid
|
||||
then ()
|
||||
else trans_real_required_fn fnid blockid
|
||||
in
|
||||
|
||||
let trans_tag
|
||||
(n:Ast.ident)
|
||||
(tagid:node_id)
|
||||
|
@ -225,6 +225,28 @@ let iter_rec_slots
|
||||
(Array.map snd entries) f curr_iso
|
||||
;;
|
||||
|
||||
let intrinsic_name (cx:ctxt) (fnid:node_id) : string =
|
||||
match Hashtbl.find cx.ctxt_all_item_names fnid with
|
||||
Ast.NAME_base (Ast.BASE_ident id) -> id
|
||||
| Ast.NAME_base (Ast.BASE_app (id, _)) -> id
|
||||
| Ast.NAME_ext (_, Ast.COMP_ident id) -> id
|
||||
| Ast.NAME_ext (_, Ast.COMP_app (id, _)) -> id
|
||||
| _ -> err (Some fnid) "unexpected name for intrinsic fn"
|
||||
;;
|
||||
|
||||
let fn_is_intrinsic (cx:ctxt) (fnid:node_id) : bool =
|
||||
let (_, conv) = Hashtbl.find cx.ctxt_required_items fnid in
|
||||
conv = CONV_intrinsic
|
||||
;;
|
||||
|
||||
let lval_is_intrinsic (cx:ctxt) (lval:Ast.lval) : bool =
|
||||
let item = lval_item cx lval in
|
||||
match item.node.Ast.decl_item with
|
||||
Ast.MOD_ITEM_fn _
|
||||
when Hashtbl.mem cx.ctxt_required_items item.id ->
|
||||
fn_is_intrinsic cx item.id
|
||||
| _ -> false
|
||||
;;
|
||||
|
||||
|
||||
|
||||
|
@ -105,6 +105,7 @@ type ty_param_idx = int
|
||||
type nabi_conv =
|
||||
CONV_rust
|
||||
| CONV_cdecl
|
||||
| CONV_intrinsic
|
||||
;;
|
||||
|
||||
type nabi = { nabi_indirect: bool;
|
||||
@ -115,6 +116,7 @@ let string_to_conv (a:string) : nabi_conv option =
|
||||
match a with
|
||||
"cdecl" -> Some CONV_cdecl
|
||||
| "rust" -> Some CONV_rust
|
||||
| "intrinsic" -> Some CONV_intrinsic
|
||||
| _ -> None
|
||||
|
||||
(* FIXME: remove this when native items go away. *)
|
||||
|
Loading…
Reference in New Issue
Block a user