@@ -18,6 +18,7 @@ use context::CodegenCx;
18
18
19
19
use syntax:: ast;
20
20
use rustc:: ty:: layout:: { self , Align , Size } ;
21
+ use rustc_back:: VaListKind ;
21
22
22
23
use std:: ffi:: CString ;
23
24
use std:: fmt;
@@ -297,4 +298,34 @@ impl Type {
297
298
pub fn x86_mmx ( cx : & CodegenCx ) -> Type {
298
299
ty ! ( llvm:: LLVMX86MMXTypeInContext ( cx. llcx) )
299
300
}
301
+
302
+ pub fn va_list ( cx : & CodegenCx , name : & str ) -> Type {
303
+ let int_t = Type :: c_int ( cx) ;
304
+ let voidp_t = Type :: i8p ( cx) ;
305
+ match cx. tcx . sess . target . target . options . va_list_kind {
306
+ VaListKind :: CharPtr => {
307
+ Type :: i8p ( cx)
308
+ } ,
309
+ VaListKind :: VoidPtr => {
310
+ voidp_t
311
+ } ,
312
+ VaListKind :: X86_64Abi => {
313
+ let mut va_list_t = Type :: named_struct ( cx, name) ;
314
+ va_list_t. set_struct_body ( & [ int_t, int_t, voidp_t, voidp_t] , false ) ;
315
+ va_list_t
316
+ } ,
317
+ VaListKind :: AArch64Abi => {
318
+ let mut va_list_t = Type :: named_struct ( cx, name) ;
319
+ va_list_t. set_struct_body ( & [ voidp_t, voidp_t, voidp_t, int_t, int_t] , false ) ;
320
+ va_list_t
321
+ } ,
322
+ VaListKind :: PowerPcAbi => {
323
+ let i8_t = Type :: i8 ( cx) ;
324
+ let i16_t = Type :: i16 ( cx) ;
325
+ let mut va_list_t = Type :: named_struct ( cx, name) ;
326
+ va_list_t. set_struct_body ( & [ i8_t, i8_t, i16_t, voidp_t, voidp_t] , false ) ;
327
+ va_list_t
328
+ } ,
329
+ }
330
+ }
300
331
}
0 commit comments