@@ -18,6 +18,7 @@ use context::CodegenCx;
1818
1919use syntax:: ast;
2020use rustc:: ty:: layout:: { self , Align , Size } ;
21+ use rustc_back:: VaListKind ;
2122
2223use std:: ffi:: CString ;
2324use std:: fmt;
@@ -297,4 +298,34 @@ impl Type {
297298 pub fn x86_mmx ( cx : & CodegenCx ) -> Type {
298299 ty ! ( llvm:: LLVMX86MMXTypeInContext ( cx. llcx) )
299300 }
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+ }
300331}
0 commit comments