@@ -27,7 +27,7 @@ use middle::ty::FnSig;
27
27
use middle:: ty;
28
28
use std:: cmp;
29
29
use std:: libc:: c_uint;
30
- use syntax:: abi:: { Cdecl , Aapcs , C , AbiSet , Win64 } ;
30
+ use syntax:: abi:: { Cdecl , Aapcs , C , Win64 , Abi } ;
31
31
use syntax:: abi:: { RustIntrinsic , Rust , Stdcall , Fastcall , System } ;
32
32
use syntax:: codemap:: Span ;
33
33
use syntax:: parse:: token:: { InternedString , special_idents} ;
@@ -73,10 +73,10 @@ struct LlvmSignature {
73
73
// Calls to external functions
74
74
75
75
pub fn llvm_calling_convention ( ccx : & CrateContext ,
76
- abis : AbiSet ) -> Option < CallConv > {
76
+ abi : Abi ) -> Option < CallConv > {
77
77
let os = ccx. sess ( ) . targ_cfg . os ;
78
78
let arch = ccx. sess ( ) . targ_cfg . arch ;
79
- abis . for_target ( os, arch) . map ( |abi| {
79
+ abi . for_target ( os, arch) . map ( |abi| {
80
80
match abi {
81
81
RustIntrinsic => {
82
82
// Intrinsics are emitted by monomorphic fn
@@ -180,27 +180,27 @@ pub fn register_static(ccx: &CrateContext,
180
180
}
181
181
}
182
182
183
- pub fn register_foreign_item_fn ( ccx : & CrateContext , abis : AbiSet ,
183
+ pub fn register_foreign_item_fn ( ccx : & CrateContext , abi : Abi ,
184
184
foreign_item : & ast:: ForeignItem ) -> ValueRef {
185
185
/*!
186
186
* Registers a foreign function found in a library.
187
187
* Just adds a LLVM global.
188
188
*/
189
189
190
- debug ! ( "register_foreign_item_fn(abis ={}, \
190
+ debug ! ( "register_foreign_item_fn(abi ={}, \
191
191
path={}, \
192
192
foreign_item.id={})",
193
- abis . repr( ccx. tcx( ) ) ,
193
+ abi . repr( ccx. tcx( ) ) ,
194
194
ccx. tcx. map. path_to_str( foreign_item. id) ,
195
195
foreign_item. id) ;
196
196
197
- let cc = match llvm_calling_convention ( ccx, abis ) {
197
+ let cc = match llvm_calling_convention ( ccx, abi ) {
198
198
Some ( cc) => cc,
199
199
None => {
200
200
ccx. sess ( ) . span_fatal ( foreign_item. span ,
201
201
format ! ( "ABI `{}` has no suitable calling convention \
202
202
for target architecture",
203
- abis . user_string( ccx. tcx( ) ) ) ) ;
203
+ abi . user_string( ccx. tcx( ) ) ) ) ;
204
204
}
205
205
} ;
206
206
@@ -263,8 +263,8 @@ pub fn trans_native_call<'a>(
263
263
ccx. tn. val_to_str( llfn) ,
264
264
ccx. tn. val_to_str( llretptr) ) ;
265
265
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 ( ) ) ,
268
268
_ => ccx. sess ( ) . bug ( "trans_native_call called on non-function type" )
269
269
} ;
270
270
let llsig = foreign_signature ( ccx, & fn_sig, passed_arg_tys. as_slice ( ) ) ;
@@ -354,14 +354,14 @@ pub fn trans_native_call<'a>(
354
354
llargs_foreign. push ( llarg_foreign) ;
355
355
}
356
356
357
- let cc = match llvm_calling_convention ( ccx, fn_abis ) {
357
+ let cc = match llvm_calling_convention ( ccx, fn_abi ) {
358
358
Some ( cc) => cc,
359
359
None => {
360
360
// FIXME(#8357) We really ought to report a span here
361
361
ccx. sess ( ) . fatal (
362
362
format ! ( "ABI string `{}` has no suitable ABI \
363
363
for target architecture",
364
- fn_abis . user_string( ccx. tcx( ) ) ) ) ;
364
+ fn_abi . user_string( ccx. tcx( ) ) ) ) ;
365
365
}
366
366
} ;
367
367
@@ -435,9 +435,9 @@ pub fn trans_foreign_mod(ccx: &CrateContext, foreign_mod: &ast::ForeignMod) {
435
435
for & foreign_item in foreign_mod. items . iter ( ) {
436
436
match foreign_item. node {
437
437
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) ; }
441
441
}
442
442
}
443
443
_ => { }
@@ -486,7 +486,7 @@ pub fn register_rust_fn_with_foreign_abi(ccx: &CrateContext,
486
486
let t = ty:: node_id_to_type ( ccx. tcx ( ) , node_id) ;
487
487
let ( cconv, output) = match ty:: get ( t) . sty {
488
488
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 ) ;
490
490
( c. unwrap_or ( lib:: llvm:: CCallConv ) , fn_ty. sig . output )
491
491
}
492
492
_ => 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,
534
534
// normal Rust function. This will be the type of the wrappee fn.
535
535
let f = match ty:: get ( t) . sty {
536
536
ty:: ty_bare_fn( ref f) => {
537
- assert ! ( !f . abis . is_rust ( ) && !f . abis . is_intrinsic ( ) ) ;
537
+ assert ! ( f . abi != Rust && f . abi != RustIntrinsic ) ;
538
538
f
539
539
}
540
540
_ => {
0 commit comments