Commit d3707adb by Richard Henderson Committed by Richard Henderson

builtins.c (expand_builtin_saveregs): Remove static, remove exp and ignore…

builtins.c (expand_builtin_saveregs): Remove static, remove exp and ignore arguments, bail if no EXPAND_BUILTIN_SAVEREGS.

        * builtins.c (expand_builtin_saveregs): Remove static, remove exp
        and ignore arguments, bail if no EXPAND_BUILTIN_SAVEREGS.
        (expand_builtin_next_arg): Accept ARGLIST not EXP.
        (stabilize_va_list): New function.
        (std_expand_builtin_va_start): New function.
        (expand_builtin_va_start): New function.
        (get_varargs_alias_set): New function.
        (std_expand_builtin_va_arg): New function.
        (expand_builtin_va_arg): New function.
        (expand_builtin_va_end): New function.
        (expand_builtin_va_copy): New function.
        (expand_builtin): Call them.
        * c-common.c (c_common_nodes_and_builtins): Build __builtin_va_list,
        __builtin_{varargs_start,stdarg_start,end,copy}.
        (build_va_arg): New function.
        * c-common.h (CTI_PTR_TYPE, ptr_type_node): Delete.
        (build_va_arg): Declare.
        * c-decl.c (ptr_type_node, va_list_type_node): New.
        * c-parse.gperf (__builtin_va_arg): New.
        * c-parse.in (VA_ARG): New token.
        (unary_expr): Recognize it.
        * expr.c (expand_expr): Expand VA_ARG_EXPR.
        * expr.h (std_expand_builtin_va_start): Declare.
        (std_expand_builtin_va_arg): Declare.
        (expand_builtin_va_arg): Declare.
        (get_varargs_alias_set): Declare.
        * tree.def (VA_ARG_EXPR): New.
        * tree.h (BUILT_IN_VARARGS_START): New.
        (BUILT_IN_STDARG_START, BUILT_IN_VA_END): New.
        (ptr_type_node, va_list_type_node): Declare.
        * tm.texi (EXPAND_BUILTIN_SAVEREGS): Kill unused ARGLIST argument.
        * m32r.h (EXPAND_BUILTIN_SAVEREGS): Likewise.
        * m88k.h, m88k.c: Likewise.
        * mn10300.h, mn10300.c: Likewise.
        * pa.h, pa.c: Likewise.
        * rs6000.h, rs6000.c: Likewise.
        * sh.h, sh.c: Likewise.
        * sparc.h, sparc.c: Likewise.

        * emit-rtl.c (operand_subword): Copy alias set.
        (change_address): Likewise.

From-SVN: r28243
parent 4a4b0aa3
Sun Jul 25 18:15:39 1999 Richard Henderson <rth@cygnus.com>
* builtins.c (expand_builtin_saveregs): Remove static, remove exp
and ignore arguments, bail if no EXPAND_BUILTIN_SAVEREGS.
(expand_builtin_next_arg): Accept ARGLIST not EXP.
(stabilize_va_list): New function.
(std_expand_builtin_va_start): New function.
(expand_builtin_va_start): New function.
(get_varargs_alias_set): New function.
(std_expand_builtin_va_arg): New function.
(expand_builtin_va_arg): New function.
(expand_builtin_va_end): New function.
(expand_builtin_va_copy): New function.
(expand_builtin): Call them.
* c-common.c (c_common_nodes_and_builtins): Build __builtin_va_list,
__builtin_{varargs_start,stdarg_start,end,copy}.
(build_va_arg): New function.
* c-common.h (CTI_PTR_TYPE, ptr_type_node): Delete.
(build_va_arg): Declare.
* c-decl.c (ptr_type_node, va_list_type_node): New.
* c-parse.gperf (__builtin_va_arg): New.
* c-parse.in (VA_ARG): New token.
(unary_expr): Recognize it.
* expr.c (expand_expr): Expand VA_ARG_EXPR.
* expr.h (std_expand_builtin_va_start): Declare.
(std_expand_builtin_va_arg): Declare.
(expand_builtin_va_arg): Declare.
(get_varargs_alias_set): Declare.
* tree.def (VA_ARG_EXPR): New.
* tree.h (BUILT_IN_VARARGS_START): New.
(BUILT_IN_STDARG_START, BUILT_IN_VA_END): New.
(ptr_type_node, va_list_type_node): Declare.
* tm.texi (EXPAND_BUILTIN_SAVEREGS): Kill unused ARGLIST argument.
* m32r.h (EXPAND_BUILTIN_SAVEREGS): Likewise.
* m88k.h, m88k.c: Likewise.
* mn10300.h, mn10300.c: Likewise.
* pa.h, pa.c: Likewise.
* rs6000.h, rs6000.c: Likewise.
* sh.h, sh.c: Likewise.
* sparc.h, sparc.c: Likewise.
* emit-rtl.c (operand_subword): Copy alias set.
(change_address): Likewise.
Sun Jul 25 15:04:37 1999 Jeffrey A Law (law@cygnus.com)
* pa.c (compute_frame_size): Scan all the used callee saved registers,
......
......@@ -3434,6 +3434,16 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
tree long_ftype_long;
/* Either char* or void*. */
tree traditional_ptr_type_node;
tree va_list_ptr_type_node;
#ifdef BUILD_VA_LIST_TYPE
BUILD_VA_LIST_TYPE(va_list_type_node);
#else
va_list_type_node = ptr_type_node;
#endif
pushdecl (build_decl (TYPE_DECL, get_identifier ("__builtin_va_list"),
va_list_type_node));
va_list_ptr_type_node = build_pointer_type (va_list_type_node);
endlink = void_list_node;
int_endlink = tree_cons (NULL_TREE, integer_type_node, endlink);
......@@ -3608,6 +3618,37 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
builtin_function ("__builtin_return", void_ftype_ptr,
BUILT_IN_RETURN, NULL_PTR);
/* Support for varargs.h and stdarg.h. */
builtin_function ("__builtin_varargs_start",
build_function_type (void_type_node,
tree_cons (NULL_TREE,
va_list_ptr_type_node,
endlink)),
BUILT_IN_VARARGS_START, NULL_PTR);
builtin_function ("__builtin_stdarg_start",
build_function_type (void_type_node,
tree_cons (NULL_TREE,
va_list_ptr_type_node,
NULL_TREE)),
BUILT_IN_STDARG_START, NULL_PTR);
builtin_function ("__builtin_va_end",
build_function_type (void_type_node,
tree_cons (NULL_TREE,
va_list_type_node,
endlink)),
BUILT_IN_VA_END, NULL_PTR);
builtin_function ("__builtin_va_copy",
build_function_type (void_type_node,
tree_cons (NULL_TREE,
va_list_ptr_type_node,
tree_cons (NULL_TREE,
va_list_type_node,
endlink))),
BUILT_IN_VA_COPY, NULL_PTR);
/* Currently under experimentation. */
builtin_function ("__builtin_memcpy", memcpy_ftype, BUILT_IN_MEMCPY,
"memcpy");
......@@ -3712,3 +3753,10 @@ c_common_nodes_and_builtins (cplus_mode, no_builtins, no_nonansi_builtins)
NULL_PTR);
#endif
}
tree
build_va_arg (expr, type)
tree expr, type;
{
return build1 (VA_ARG_EXPR, type, expr);
}
......@@ -63,7 +63,6 @@ enum c_tree_index
CTI_STRING_TYPE,
CTI_CONST_STRING_TYPE,
CTI_PTR_TYPE,
CTI_CONST_PTR_TYPE,
CTI_PTRDIFF_TYPE,
......@@ -126,7 +125,6 @@ extern tree c_global_trees[CTI_MAX];
#define boolean_true_node c_global_trees[CTI_BOOLEAN_TRUE]
#define boolean_false_node c_global_trees[CTI_BOOLEAN_FALSE]
#define ptr_type_node c_global_trees[CTI_PTR_TYPE]
#define const_ptr_type_node c_global_trees[CTI_CONST_PTR_TYPE]
#define ptrdiff_type_node c_global_trees[CTI_PTRDIFF_TYPE]
......@@ -190,3 +188,5 @@ extern tree builtin_function PROTO((const char *, tree, enum built_in_function
/* Build tree nodes and builtin functions common to both C and C++ language
frontends. */
extern void c_common_nodes_and_builtins PROTO((int, int, int));
extern tree build_va_arg PROTO((tree, tree));
......@@ -119,6 +119,12 @@ tree char_type_node;
tree integer_type_node;
tree unsigned_type_node;
/* These can't be part of the above array, since they are declared
individially in tree.h and used by the target routines. */
tree ptr_type_node;
tree va_list_type_node;
/* Two expressions that are constants with value zero.
The first is of type `int', the second of type `void *'. */
......
/* C code produced by gperf version 2.7.1 (19981006 egcs) */
/* Command-line: gperf -L C -F , 0, 0 -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$ ./c-parse.gperf */
/* C code produced by gperf version 2.7 */
/* Command-line: gperf -L C -F , 0, 0 -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$ ../../../egcs/gcc/c-parse.gperf */
/* Command-line: gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
struct resword { const char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 83
#define TOTAL_KEYWORDS 84
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 20
#define MIN_HASH_VALUE 8
#define MAX_HASH_VALUE 141
/* maximum key range = 134, duplicates = 0 */
#define MAX_HASH_VALUE 173
/* maximum key range = 166, duplicates = 0 */
#ifdef __GNUC__
__inline
......@@ -20,32 +20,32 @@ hash (str, len)
{
static unsigned char asso_values[] =
{
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 35, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 1, 142, 90, 1, 28,
40, 6, 1, 24, 3, 13, 142, 36, 60, 14,
49, 3, 6, 142, 19, 8, 1, 50, 33, 11,
2, 23, 4, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142, 142, 142, 142, 142,
142, 142, 142, 142, 142, 142
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 35, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 1, 174, 97, 19, 28,
40, 6, 1, 53, 3, 13, 174, 5, 67, 18,
49, 3, 6, 174, 19, 8, 1, 4, 33, 2,
2, 23, 4, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
174, 174, 174, 174, 174, 174
};
register int hval = len;
......@@ -83,16 +83,16 @@ static struct resword wordlist[] =
{"__imag__", IMAGPART, NORID},
{"else", ELSE, NORID},
{"__inline__", SCSPEC, RID_INLINE},
{"byref", TYPE_QUAL, RID_BYREF},
{"while", WHILE, NORID},
{"__iterator__", SCSPEC, RID_ITERATOR},
{"__inline", SCSPEC, RID_INLINE},
{"__real__", REALPART, NORID},
{"switch", SWITCH, NORID},
{"__restrict", TYPE_QUAL, RID_RESTRICT},
{"goto", GOTO, NORID},
{"enum", ENUM, NORID},
{"__restrict__", TYPE_QUAL, RID_RESTRICT},
{"struct", STRUCT, NORID},
{"while", WHILE, NORID},
{"break", BREAK, NORID},
{"restrict", TYPE_QUAL, RID_RESTRICT},
{"__const", TYPE_QUAL, RID_CONST},
{"oneway", TYPE_QUAL, RID_ONEWAY},
......@@ -101,20 +101,21 @@ static struct resword wordlist[] =
{"__complex__", TYPESPEC, RID_COMPLEX},
{"for", FOR, NORID},
{"__iterator", SCSPEC, RID_ITERATOR},
{"__imag", IMAGPART, NORID},
{"byref", TYPE_QUAL, RID_BYREF},
{"do", DO, NORID},
{"case", CASE, NORID},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"break", BREAK, NORID},
{"", 0, 0},
{"default", DEFAULT, NORID},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@defs", DEFS, NORID},
{"id", OBJECTNAME, RID_ID},
{"", 0, 0},
{"double", TYPESPEC, RID_DOUBLE},
{"__signed", TYPESPEC, RID_SIGNED},
{"bycopy", TYPE_QUAL, RID_BYCOPY},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{"goto", GOTO, NORID},
{"extern", SCSPEC, RID_EXTERN},
{"", 0, 0},
{"in", TYPE_QUAL, RID_IN},
......@@ -123,53 +124,59 @@ static struct resword wordlist[] =
{"", 0, 0},
{"@private", PRIVATE, NORID},
{"@selector", SELECTOR, NORID},
{"register", SCSPEC, RID_REGISTER},
{"__label__", LABEL, NORID},
{"", 0, 0}, {"", 0, 0},
{"enum", ENUM, NORID},
{"", 0, 0},
{"union", UNION, NORID},
{"", 0, 0},
{"__imag", IMAGPART, NORID},
{"@public", PUBLIC, NORID},
{"return", RETURN, NORID},
{"", 0, 0}, {"", 0, 0},
{"signed", TYPESPEC, RID_SIGNED},
{"bycopy", TYPE_QUAL, RID_BYCOPY},
{"", 0, 0},
{"__label__", LABEL, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"const", TYPE_QUAL, RID_CONST},
{"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"__builtin_va_arg", VA_ARG, NORID},
{"void", TYPESPEC, RID_VOID},
{"continue", CONTINUE, NORID},
{"inline", SCSPEC, RID_INLINE},
{"__real", REALPART, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"void", TYPESPEC, RID_VOID},
{"continue", CONTINUE, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@encode", ENCODE, NORID},
{"", 0, 0},
{"register", SCSPEC, RID_REGISTER},
{"@interface", INTERFACE, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@protected", PROTECTED, NORID},
{"auto", SCSPEC, RID_AUTO},
{"__asm__", ASM_KEYWORD, NORID},
{"@interface", INTERFACE, NORID},
{"signed", TYPESPEC, RID_SIGNED},
{"__alignof", ALIGNOF, NORID},
{"double", TYPESPEC, RID_DOUBLE},
{"", 0, 0},
{"__alignof__", ALIGNOF, NORID},
{"@protected", PROTECTED, NORID},
{"", 0, 0},
{"__attribute__", ATTRIBUTE, NORID},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{"", 0, 0},
{"volatile", TYPE_QUAL, RID_VOLATILE},
{"__attribute", ATTRIBUTE, NORID},
{"@class", CLASS, NORID},
{"__asm", ASM_KEYWORD, NORID},
{"", 0, 0}, {"", 0, 0},
{"@implementation", IMPLEMENTATION, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"union", UNION, NORID},
{"", 0, 0}, {"", 0, 0},
{"@public", PUBLIC, NORID},
{"asm", ASM_KEYWORD, NORID},
{"__asm", ASM_KEYWORD, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@end", END, NORID},
{"", 0, 0},
{"@protocol", PROTOCOL, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"@end", END, NORID},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"asm", ASM_KEYWORD, NORID},
{"", 0, 0}, {"", 0, 0},
{"static", SCSPEC, RID_STATIC},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"long", TYPESPEC, RID_LONG},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"char", TYPESPEC, RID_CHAR}
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"char", TYPESPEC, RID_CHAR},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0}, {"", 0, 0},
{"long", TYPESPEC, RID_LONG}
};
#ifdef __GNUC__
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,6 +21,7 @@ __asm, ASM_KEYWORD, NORID
__asm__, ASM_KEYWORD, NORID
__attribute, ATTRIBUTE, NORID
__attribute__, ATTRIBUTE, NORID
__builtin_va_arg, VA_ARG, NORID
__complex, TYPESPEC, RID_COMPLEX
__complex__, TYPESPEC, RID_COMPLEX
__const, TYPE_QUAL, RID_CONST
......
typedef union {long itype; tree ttype; enum tree_code code;
char *filename; int lineno; int ends_in_label; } YYSTYPE;
#define IDENTIFIER 258
#define TYPENAME 259
#define SCSPEC 260
#define TYPESPEC 261
#define TYPE_QUAL 262
#define CONSTANT 263
#define STRING 264
#define ELLIPSIS 265
#define SIZEOF 266
#define ENUM 267
#define STRUCT 268
#define UNION 269
#define IF 270
#define ELSE 271
#define WHILE 272
#define DO 273
#define FOR 274
#define SWITCH 275
#define CASE 276
#define DEFAULT 277
#define BREAK 278
#define CONTINUE 279
#define RETURN 280
#define GOTO 281
#define ASM_KEYWORD 282
#define TYPEOF 283
#define ALIGNOF 284
#define ATTRIBUTE 285
#define EXTENSION 286
#define LABEL 287
#define REALPART 288
#define IMAGPART 289
#define IDENTIFIER 257
#define TYPENAME 258
#define SCSPEC 259
#define TYPESPEC 260
#define TYPE_QUAL 261
#define CONSTANT 262
#define STRING 263
#define ELLIPSIS 264
#define SIZEOF 265
#define ENUM 266
#define STRUCT 267
#define UNION 268
#define IF 269
#define ELSE 270
#define WHILE 271
#define DO 272
#define FOR 273
#define SWITCH 274
#define CASE 275
#define DEFAULT 276
#define BREAK 277
#define CONTINUE 278
#define RETURN 279
#define GOTO 280
#define ASM_KEYWORD 281
#define TYPEOF 282
#define ALIGNOF 283
#define ATTRIBUTE 284
#define EXTENSION 285
#define LABEL 286
#define REALPART 287
#define IMAGPART 288
#define VA_ARG 289
#define ASSIGN 290
#define OROR 291
#define ANDAND 292
......
......@@ -136,7 +136,7 @@ end ifc
%token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
%token ATTRIBUTE EXTENSION LABEL
%token REALPART IMAGPART
%token REALPART IMAGPART VA_ARG
/* Add precedence rules to solve dangling else s/r conflict */
%nonassoc IF
......@@ -500,6 +500,8 @@ unary_expr:
{ $$ = build_unary_op (REALPART_EXPR, $2, 0); }
| IMAGPART cast_expr %prec UNARY
{ $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
| VA_ARG '(' expr_no_commas ',' typename ')'
{ $$ = build_va_arg ($3, groktypename ($5)); }
;
sizeof:
......
......@@ -124,7 +124,7 @@ char *language_string = "GNU C";
%token SIZEOF ENUM STRUCT UNION IF ELSE WHILE DO FOR SWITCH CASE DEFAULT
%token BREAK CONTINUE RETURN GOTO ASM_KEYWORD TYPEOF ALIGNOF
%token ATTRIBUTE EXTENSION LABEL
%token REALPART IMAGPART
%token REALPART IMAGPART VA_ARG
/* Add precedence rules to solve dangling else s/r conflict */
%nonassoc IF
......@@ -455,6 +455,8 @@ unary_expr:
{ $$ = build_unary_op (REALPART_EXPR, $2, 0); }
| IMAGPART cast_expr %prec UNARY
{ $$ = build_unary_op (IMAGPART_EXPR, $2, 0); }
| VA_ARG '(' expr_no_commas ',' typename ')'
{ $$ = build_va_arg ($3, groktypename ($5)); }
;
sizeof:
......
......@@ -1296,6 +1296,7 @@ operand_subword (op, i, validate_address, mode)
MEM_COPY_ATTRIBUTES (new, op);
RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (op);
MEM_ALIAS_SET (new) = MEM_ALIAS_SET (op);
return new;
}
......@@ -1598,6 +1599,7 @@ change_address (memref, mode, addr)
new = gen_rtx_MEM (mode, addr);
RTX_UNCHANGING_P (new) = RTX_UNCHANGING_P (memref);
MEM_COPY_ATTRIBUTES (new, memref);
MEM_ALIAS_SET (new) = MEM_ALIAS_SET (memref);
return new;
}
......
......@@ -8240,6 +8240,9 @@ expand_expr (exp, target, tmode, modifier)
return const0_rtx;
}
case VA_ARG_EXPR:
return expand_builtin_va_arg (TREE_OPERAND (exp, 0), type);
default:
return (*lang_expand_expr) (exp, original_target, tmode, modifier);
}
......
......@@ -738,9 +738,14 @@ extern rtx gen_cond_trap PROTO((enum rtx_code, rtx, rtx, rtx));
/* Functions from builtins.c: */
#ifdef TREE_CODE
extern rtx expand_builtin PROTO((tree, rtx, rtx, enum machine_mode, int));
extern void std_expand_builtin_va_start PROTO((int, tree, rtx));
extern rtx std_expand_builtin_va_arg PROTO((tree, tree));
extern rtx expand_builtin_va_arg PROTO((tree, tree));
#endif
extern rtx expand_builtin_setjmp PROTO((rtx, rtx, rtx, rtx));
extern rtx expand_builtin_saveregs PROTO((void));
extern int get_varargs_alias_set PROTO((void));
/* Functions from expr.c: */
......
......@@ -3734,19 +3734,13 @@ These machine description macros help implement varargs:
@table @code
@findex EXPAND_BUILTIN_SAVEREGS
@item EXPAND_BUILTIN_SAVEREGS (@var{args})
@item EXPAND_BUILTIN_SAVEREGS ()
If defined, is a C expression that produces the machine-specific code
for a call to @code{__builtin_saveregs}. This code will be moved to the
very beginning of the function, before any parameter access are made.
The return value of this function should be an RTX that contains the
value to use as the return of @code{__builtin_saveregs}.
The argument @var{args} is a @code{tree_list} containing the arguments
that were passed to @code{__builtin_saveregs}.
If this macro is not defined, the compiler will output an ordinary
call to the library function @samp{__builtin_saveregs}.
@findex SETUP_INCOMING_VARARGS
@item SETUP_INCOMING_VARARGS (@var{args_so_far}, @var{mode}, @var{type}, @var{pretend_args_size}, @var{second_time})
This macro offers an alternative to using @code{__builtin_saveregs} and
......
......@@ -701,6 +701,9 @@ DEFTREECODE (PREINCREMENT_EXPR, "preincrement_expr", 'e', 2)
DEFTREECODE (POSTDECREMENT_EXPR, "postdecrement_expr", 'e', 2)
DEFTREECODE (POSTINCREMENT_EXPR, "postincrement_expr", 'e', 2)
/* Used to implement `va_arg'. */
DEFTREECODE (VA_ARG_EXPR, "va_arg_expr", 'e', 1)
/* Evaluate operand 1. If and only if an exception is thrown during
the evaluation of operand 1, evaluate operand 2.
......
......@@ -117,6 +117,11 @@ enum built_in_function
BUILT_IN_EXTRACT_RETURN_ADDR,
BUILT_IN_EH_RETURN,
BUILT_IN_VARARGS_START,
BUILT_IN_STDARG_START,
BUILT_IN_VA_END,
BUILT_IN_VA_COPY,
/* C++ extensions */
BUILT_IN_NEW,
BUILT_IN_VEC_NEW,
......@@ -1854,6 +1859,11 @@ extern tree unsigned_type_node;
/* The type node for the ordinary character type. */
extern tree char_type_node;
extern tree ptr_type_node;
/* Type `va_list'. Used by va_start, va_arg, etc. */
extern tree va_list_type_node;
/* Points to the name of the input file from which the current input
being parsed originally came (before it went into cpp). */
extern char *input_filename;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment