@@ -27,7 +27,7 @@ use middle::ty::FnSig;
2727use middle:: ty;
2828use std:: cmp;
2929use std:: libc:: c_uint;
30- use syntax:: abi:: { Cdecl , Aapcs , C , AbiSet , Win64 } ;
30+ use syntax:: abi:: { Cdecl , Aapcs , C , Win64 , Abi } ;
3131use syntax:: abi:: { RustIntrinsic , Rust , Stdcall , Fastcall , System } ;
3232use syntax:: codemap:: Span ;
3333use syntax:: parse:: token:: { InternedString , special_idents} ;
@@ -73,10 +73,10 @@ struct LlvmSignature {
7373// Calls to external functions
7474
7575pub fn llvm_calling_convention ( ccx : & CrateContext ,
76- abis : AbiSet ) -> Option < CallConv > {
76+ abi : Abi ) -> Option < CallConv > {
7777 let os = ccx. sess ( ) . targ_cfg . os ;
7878 let arch = ccx. sess ( ) . targ_cfg . arch ;
79- abis . for_target ( os, arch) . map ( |abi| {
79+ abi . for_target ( os, arch) . map ( |abi| {
8080 match abi {
8181 RustIntrinsic => {
8282 // Intrinsics are emitted by monomorphic fn
@@ -180,27 +180,27 @@ pub fn register_static(ccx: &CrateContext,
180180 }
181181}
182182
183- pub fn register_foreign_item_fn ( ccx : & CrateContext , abis : AbiSet ,
183+ pub fn register_foreign_item_fn ( ccx : & CrateContext , abi : Abi ,
184184 foreign_item : & ast:: ForeignItem ) -> ValueRef {
185185 /*!
186186 * Registers a foreign function found in a library.
187187 * Just adds a LLVM global.
188188 */
189189
190- debug ! ( "register_foreign_item_fn(abis ={}, \
190+ debug ! ( "register_foreign_item_fn(abi ={}, \
191191 path={}, \
192192 foreign_item.id={})",
193- abis . repr( ccx. tcx( ) ) ,
193+ abi . repr( ccx. tcx( ) ) ,
194194 ccx. tcx. map. path_to_str( foreign_item. id) ,
195195 foreign_item. id) ;
196196
197- let cc = match llvm_calling_convention ( ccx, abis ) {
197+ let cc = match llvm_calling_convention ( ccx, abi ) {
198198 Some ( cc) => cc,
199199 None => {
200200 ccx. sess ( ) . span_fatal ( foreign_item. span ,
201201 format ! ( "ABI `{}` has no suitable calling convention \
202202 for target architecture",
203- abis . user_string( ccx. tcx( ) ) ) ) ;
203+ abi . user_string( ccx. tcx( ) ) ) ) ;
204204 }
205205 } ;
206206
@@ -263,8 +263,8 @@ pub fn trans_native_call<'a>(
263263 ccx. tn. val_to_str( llfn) ,
264264 ccx. tn. val_to_str( llretptr) ) ;
265265
266- let ( fn_abis , fn_sig) = match ty:: get ( callee_ty) . sty {
267- ty:: ty_bare_fn( ref fn_ty) => ( fn_ty. abis , fn_ty. sig . clone ( ) ) ,
266+ let ( fn_abi , fn_sig) = match ty:: get ( callee_ty) . sty {
267+ ty:: ty_bare_fn( ref fn_ty) => ( fn_ty. abi , fn_ty. sig . clone ( ) ) ,
268268 _ => ccx. sess ( ) . bug ( "trans_native_call called on non-function type" )
269269 } ;
270270 let llsig = foreign_signature ( ccx, & fn_sig, passed_arg_tys. as_slice ( ) ) ;
@@ -354,14 +354,14 @@ pub fn trans_native_call<'a>(
354354 llargs_foreign. push ( llarg_foreign) ;
355355 }
356356
357- let cc = match llvm_calling_convention ( ccx, fn_abis ) {
357+ let cc = match llvm_calling_convention ( ccx, fn_abi ) {
358358 Some ( cc) => cc,
359359 None => {
360360 // FIXME(#8357) We really ought to report a span here
361361 ccx. sess ( ) . fatal (
362362 format ! ( "ABI string `{}` has no suitable ABI \
363363 for target architecture",
364- fn_abis . user_string( ccx. tcx( ) ) ) ) ;
364+ fn_abi . user_string( ccx. tcx( ) ) ) ) ;
365365 }
366366 } ;
367367
@@ -435,9 +435,9 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) {
435435 for & foreign_item in foreign_mod. items . iter ( ) {
436436 match foreign_item. node {
437437 ast:: ForeignItemFn ( ..) => {
438- let abis = foreign_mod. abis ;
439- if ! ( abis . is_rust ( ) || abis . is_intrinsic ( ) ) {
440- register_foreign_item_fn ( ccx, abis , foreign_item) ;
438+ match foreign_mod. abi {
439+ Rust | RustIntrinsic => { }
440+ abi => { register_foreign_item_fn ( ccx, abi , foreign_item) ; }
441441 }
442442 }
443443 _ => { }
@@ -486,7 +486,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
486486 let t = ty:: node_id_to_type ( ccx. tcx ( ) , node_id) ;
487487 let ( cconv, output) = match ty:: get ( t) . sty {
488488 ty:: ty_bare_fn( ref fn_ty) => {
489- let c = llvm_calling_convention ( ccx, fn_ty. abis ) ;
489+ let c = llvm_calling_convention ( ccx, fn_ty. abi ) ;
490490 ( c. unwrap_or ( lib:: llvm:: CCallConv ) , fn_ty. sig . output )
491491 }
492492 _ => fail ! ( "expected bare fn in register_rust_fn_with_foreign_abi" )
@@ -534,7 +534,7 @@ pub fn trans_rust_fn_with_foreign_abi(ccx: &CrateContext,
534534 // normal Rust function. This will be the type of the wrappee fn.
535535 let f = match ty:: get ( t) . sty {
536536 ty:: ty_bare_fn( ref f) => {
537- assert ! ( !f . abis . is_rust ( ) && !f . abis . is_intrinsic ( ) ) ;
537+ assert ! ( f . abi != Rust && f . abi != RustIntrinsic ) ;
538538 f
539539 }
540540 _ => {
0 commit comments