rustc: Implement C stack stdcall
This commit is contained in:
parent
9be0dc1250
commit
968b66ad40
|
@ -54,7 +54,8 @@ fn visit_item(e: env, i: @ast::item) {
|
|||
alt i.node {
|
||||
ast::item_native_mod(m) {
|
||||
if m.abi != ast::native_abi_rust && m.abi != ast::native_abi_cdecl &&
|
||||
m.abi != ast::native_abi_c_stack_cdecl {
|
||||
m.abi != ast::native_abi_c_stack_cdecl &&
|
||||
m.abi != ast::native_abi_c_stack_stdcall {
|
||||
ret;
|
||||
}
|
||||
let cstore = e.sess.get_cstore();
|
||||
|
|
|
@ -264,6 +264,7 @@ fn parse_ty(st: @pstate, sd: str_def) -> ty::t {
|
|||
'l' { abi = ast::native_abi_llvm; }
|
||||
's' { abi = ast::native_abi_x86stdcall; }
|
||||
'C' { abi = ast::native_abi_c_stack_cdecl; }
|
||||
'S' { abi = ast::native_abi_c_stack_stdcall; }
|
||||
}
|
||||
let func = parse_ty_fn(st, sd);
|
||||
ret ty::mk_native_fn(st.tcx, abi, func.args, func.ty);
|
||||
|
|
|
@ -148,6 +148,7 @@ fn enc_sty(w: io::writer, cx: @ctxt, st: ty::sty) {
|
|||
native_abi_llvm. { w.write_char('l'); }
|
||||
native_abi_x86stdcall. { w.write_char('s'); }
|
||||
native_abi_c_stack_cdecl. { w.write_char('C'); }
|
||||
native_abi_c_stack_stdcall. { w.write_char('S'); }
|
||||
}
|
||||
enc_ty_fn(w, cx, args, out, return_val, []);
|
||||
}
|
||||
|
|
|
@ -5741,7 +5741,8 @@ pure fn native_abi_requires_pair(abi: ast::native_abi) -> bool {
|
|||
ast::native_abi_rust. | ast::native_abi_cdecl. |
|
||||
ast::native_abi_llvm. | ast::native_abi_rust_intrinsic. |
|
||||
ast::native_abi_x86stdcall. { ret true; }
|
||||
ast::native_abi_c_stack_cdecl. { ret false; }
|
||||
ast::native_abi_c_stack_cdecl. |
|
||||
ast::native_abi_c_stack_stdcall. { ret false; }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5809,6 +5810,13 @@ fn register_native_fn(ccx: @crate_ctxt, sp: span, path: [str], name: str,
|
|||
ccx.item_symbols.insert(id, name);
|
||||
ret;
|
||||
}
|
||||
ast::native_abi_c_stack_stdcall. {
|
||||
let llfn = decl_fn(ccx.llmod, name, lib::llvm::LLVMX86StdcallCallConv,
|
||||
T_fn([], T_int()));
|
||||
ccx.item_ids.insert(id, llfn);
|
||||
ccx.item_symbols.insert(id, name);
|
||||
ret;
|
||||
}
|
||||
}
|
||||
|
||||
let path = path;
|
||||
|
|
|
@ -420,6 +420,7 @@ tag native_abi {
|
|||
native_abi_rust_intrinsic;
|
||||
native_abi_x86stdcall;
|
||||
native_abi_c_stack_cdecl;
|
||||
native_abi_c_stack_stdcall;
|
||||
}
|
||||
|
||||
type native_mod =
|
||||
|
|
|
@ -2014,6 +2014,8 @@ fn parse_item_native_mod(p: parser, attrs: [ast::attribute]) -> @ast::item {
|
|||
abi = ast::native_abi_x86stdcall;
|
||||
} else if str::eq(t, "c-stack-cdecl") {
|
||||
abi = ast::native_abi_c_stack_cdecl;
|
||||
} else if str::eq(t, "c-stack-stdcall") {
|
||||
abi = ast::native_abi_c_stack_stdcall;
|
||||
} else {
|
||||
p.fatal("unsupported abi: " + t);
|
||||
}
|
||||
|
|
|
@ -411,6 +411,9 @@ fn print_item(s: ps, item: @ast::item) {
|
|||
ast::native_abi_c_stack_cdecl. {
|
||||
word_nbsp(s, "\"c-stack-cdecl\"");
|
||||
}
|
||||
ast::native_abi_c_stack_stdcall. {
|
||||
word_nbsp(s, "\"c-stack-stdcall\"");
|
||||
}
|
||||
}
|
||||
word_nbsp(s, "mod");
|
||||
word_nbsp(s, item.ident);
|
||||
|
|
Loading…
Reference in a new issue