Commit f837a861 by Michael Meissner

Add prototype support.

From-SVN: r1785
parent e83d45c4
...@@ -39,18 +39,100 @@ char *xmalloc (); ...@@ -39,18 +39,100 @@ char *xmalloc ();
static void fatal (); static void fatal ();
void fancy_abort (); void fancy_abort ();
/* Names for patterns. Need to allow linking with print-rtl. */
char **insn_name_ptr;
/* Obstacks to remember normal, and call insns. */
static struct obstack call_obstack, normal_obstack;
/* Max size of names encountered. */
static int max_id_len;
/* Count the number of match_operand's found. */
static int
num_operands (x)
rtx x;
{
int count = 0;
int i, j;
enum rtx_code code = GET_CODE (x);
char *format_ptr = GET_RTX_FORMAT (code);
if (code == MATCH_OPERAND)
return 1;
if (code == MATCH_OPERATOR)
count++;
for (i = 0; i < GET_RTX_LENGTH (code); i++)
{
switch (*format_ptr++)
{
case 'u':
case 'e':
count += num_operands (XEXP (x, i));
break;
case 'E':
if (XVEC (x, i) != NULL)
for (j = 0; j < XVECLEN (x, i); j++)
count += num_operands (XVECEXP (x, i, j));
break;
}
}
return count;
}
/* Print out prototype information for a function. */
static void
gen_proto (insn)
rtx insn;
{
int num = num_operands (insn);
printf ("extern rtx gen_%-*s PROTO((", max_id_len, XSTR (insn, 0));
if (num == 0)
printf ("void");
else
{
while (num-- > 1)
printf ("rtx, ");
printf ("rtx");
}
printf ("));\n");
}
/* Print out a function declaration without a prototype. */
static void
gen_nonproto (insn)
rtx insn;
{
printf ("extern rtx gen_%s ();\n", XSTR (insn, 0));
}
static void static void
gen_insn (insn) gen_insn (insn)
rtx insn; rtx insn;
{ {
char *name = XSTR (insn, 0);
char *p; char *p;
struct obstack *obstack_ptr;
int len;
/* Don't mention instructions whose names are the null string. /* Don't mention instructions whose names are the null string.
They are in the machine description just to be recognized. */ They are in the machine description just to be recognized. */
if (strlen (XSTR (insn, 0)) == 0) len = strlen (name);
if (len == 0)
return; return;
printf ("#define HAVE_%s ", XSTR (insn, 0)); if (len > max_id_len)
max_id_len = len;
printf ("#define HAVE_%s ", name);
if (strlen (XSTR (insn, 2)) == 0) if (strlen (XSTR (insn, 2)) == 0)
printf ("1\n"); printf ("1\n");
else else
...@@ -68,7 +150,16 @@ gen_insn (insn) ...@@ -68,7 +150,16 @@ gen_insn (insn)
printf (")\n"); printf (")\n");
} }
printf ("extern rtx gen_%s ();\n", XSTR (insn, 0)); /* Save the current insn, so that we can later put out appropriate
prototypes. At present, most md files have the wrong number of
arguments for call and call_value, ignoring the extra arguments
that are passed for some machines, so by default, turn off the
prototype. */
obstack_ptr = (!strcmp (name, "call") || !strcmp (name, "call_value"))
? &call_obstack : &normal_obstack;
obstack_grow (obstack_ptr, &insn, sizeof (rtx));
} }
char * char *
...@@ -119,10 +210,16 @@ main (argc, argv) ...@@ -119,10 +210,16 @@ main (argc, argv)
char **argv; char **argv;
{ {
rtx desc; rtx desc;
rtx dummy;
rtx *call_insns;
rtx *normal_insns;
rtx *insn_ptr;
FILE *infile; FILE *infile;
register int c; register int c;
obstack_init (rtl_obstack); obstack_init (rtl_obstack);
obstack_init (&call_obstack);
obstack_init (&normal_obstack);
if (argc <= 1) if (argc <= 1)
fatal ("No input file name."); fatal ("No input file name.");
...@@ -153,6 +250,36 @@ from the machine description file `md'. */\n\n"); ...@@ -153,6 +250,36 @@ from the machine description file `md'. */\n\n");
gen_insn (desc); gen_insn (desc);
} }
/* Print out the prototypes now. */
dummy = (rtx)0;
obstack_grow (&call_obstack, &dummy, sizeof (rtx));
call_insns = (rtx *) obstack_finish (&call_obstack);
obstack_grow (&normal_obstack, &dummy, sizeof (rtx));
normal_insns = (rtx *) obstack_finish (&normal_obstack);
printf ("\n#ifndef NO_MD_PROTOTYPES\n");
for (insn_ptr = normal_insns; *insn_ptr; insn_ptr++)
gen_proto (*insn_ptr);
printf ("\n#ifdef MD_CALL_PROTOTYPES\n");
for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
gen_proto (*insn_ptr);
printf ("\n#else /* !MD_CALL_PROTOTYPES */\n");
for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
gen_nonproto (*insn_ptr);
printf ("#endif /* !MD_CALL_PROTOTYPES */\n");
printf ("\n#else /* NO_MD_PROTOTYPES */\n");
for (insn_ptr = normal_insns; *insn_ptr; insn_ptr++)
gen_nonproto (*insn_ptr);
for (insn_ptr = call_insns; *insn_ptr; insn_ptr++)
gen_nonproto (*insn_ptr);
printf ("#endif /* NO_MD_PROTOTYPES */\n");
fflush (stdout); fflush (stdout);
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
/* NOTREACHED */ /* NOTREACHED */
......
...@@ -131,6 +131,15 @@ typedef struct rtx_def ...@@ -131,6 +131,15 @@ typedef struct rtx_def
rtunion fld[1]; rtunion fld[1];
} *rtx; } *rtx;
/* Add prototype support. */
#ifndef PROTO
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define PROTO(ARGS) ARGS
#else
#define PROTO(ARGS) ()
#endif
#endif
#define NULL_RTX (rtx) 0 #define NULL_RTX (rtx) 0
/* Define a generic NULL if one hasn't already been defined. */ /* Define a generic NULL if one hasn't already been defined. */
...@@ -139,8 +148,16 @@ typedef struct rtx_def ...@@ -139,8 +148,16 @@ typedef struct rtx_def
#define NULL 0 #define NULL 0
#endif #endif
#ifndef GENERIC_PTR
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define GENERIC_PTR void *
#else
#define GENERIC_PTR char *
#endif
#endif
#ifndef NULL_PTR #ifndef NULL_PTR
#define NULL_PTR (char *) NULL #define NULL_PTR ((GENERIC_PTR)0)
#endif #endif
/* Define macros to access the `code' field of the rtx. */ /* Define macros to access the `code' field of the rtx. */
...@@ -568,118 +585,146 @@ extern char *note_insn_name[]; ...@@ -568,118 +585,146 @@ extern char *note_insn_name[];
#define plus_constant_for_output(X,C) \ #define plus_constant_for_output(X,C) \
plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C)) plus_constant_for_output_wide (X, (HOST_WIDE_INT) (C))
extern rtx plus_constant_wide (), plus_constant_for_output_wide (); extern rtx plus_constant_wide PROTO((rtx, HOST_WIDE_INT));
extern rtx plus_constant_for_output_wide PROTO((rtx, HOST_WIDE_INT));
#define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (N)) #define GEN_INT(N) gen_rtx (CONST_INT, VOIDmode, (N))
extern rtx gen_rtx (); #if 0
/* We cannot define prototypes for the variable argument functions,
since they have not been ANSI-fied, and an ANSI compiler would
complain when compiling the definition of these functions. */
extern char *xmalloc (); extern rtx gen_rtx PROTO((enum rtx_code, enum machine_mode, ...));
extern char *xrealloc (); extern rtvec gen_rtvec PROTO((int, ...));
extern char *oballoc ();
extern char *permalloc (); #else
extern void free (); extern rtx gen_rtx ();
extern rtx rtx_alloc ();
extern rtvec rtvec_alloc ();
extern rtx find_reg_note ();
extern rtx find_regno_note ();
extern HOST_WIDE_INT get_integer_term ();
extern rtx get_related_value ();
extern rtx single_set ();
extern rtx find_last_value ();
extern rtx copy_rtx ();
extern rtx copy_rtx_if_shared ();
extern rtx copy_most_rtx ();
extern rtx replace_rtx ();
extern rtvec gen_rtvec (); extern rtvec gen_rtvec ();
extern rtvec gen_rtvec_v (); #endif
#ifdef BUFSIZ /* stdio.h has been included */
extern rtx read_rtx PROTO((FILE *));
#else
extern rtx read_rtx (); extern rtx read_rtx ();
extern rtx gen_reg_rtx (); #endif
extern rtx gen_label_rtx ();
extern rtx gen_inline_header_rtx (); #if 0
extern rtx gen_lowpart_common (); /* At present, don't prototype xrealloc, since all of the callers don't
extern rtx gen_lowpart (); cast their pointers to char *, and all of the xrealloc's don't use
extern rtx gen_lowpart_if_possible (); void * yet. */
extern rtx operand_subword (); extern char *xrealloc PROTO((void *, unsigned));
extern rtx operand_subword_force (); #else
extern int subreg_lowpart_p (); extern char *xrealloc ();
extern rtx make_safe_from (); #endif
extern rtx memory_address ();
extern rtx get_insns (); extern char *xmalloc PROTO((unsigned));
extern rtx get_last_insn (); extern char *oballoc PROTO((int));
extern rtx get_last_insn_anywhere (); extern char *permalloc PROTO((int));
extern void start_sequence (); extern void free PROTO((void *));
extern void push_to_sequence (); extern rtx rtx_alloc PROTO((RTX_CODE));
extern void end_sequence (); extern rtvec rtvec_alloc PROTO((int));
extern rtx gen_sequence (); extern rtx find_reg_note PROTO((rtx, enum reg_note, rtx));
extern rtx expand_expr (); extern rtx find_regno_note PROTO((rtx, enum reg_note, int));
extern rtx output_constant_def (); extern HOST_WIDE_INT get_integer_term PROTO((rtx));
extern rtx immed_real_const (); extern rtx get_related_value PROTO((rtx));
extern rtx immed_real_const_1 (); extern rtx single_set PROTO((rtx));
extern rtx immed_double_const (); extern rtx find_last_value PROTO((rtx, rtx *, rtx));
extern rtx force_const_mem (); extern rtx copy_rtx PROTO((rtx));
extern rtx get_pool_constant (); extern rtx copy_rtx_if_shared PROTO((rtx));
extern enum machine_mode get_pool_mode (); extern rtx copy_most_rtx PROTO((rtx, rtx));
extern int get_pool_offset (); extern rtx replace_rtx PROTO((rtx, rtx, rtx));
extern rtx get_parm_real_loc (); extern rtvec gen_rtvec_v PROTO((int, rtx *));
extern rtx assign_stack_local (); extern rtx gen_reg_rtx PROTO((enum machine_mode));
extern rtx assign_stack_temp (); extern rtx gen_label_rtx PROTO((void));
extern rtx protect_from_queue (); extern rtx gen_inline_header_rtx PROTO((rtx, rtx, int, int, int, int, int, int, rtx, int, int, rtvec, rtx));
extern void emit_queue (); extern rtx gen_lowpart_common PROTO((enum machine_mode, rtx));
extern rtx emit_move_insn (); extern rtx gen_lowpart PROTO((enum machine_mode, rtx));
extern rtx emit_insn_before (); extern rtx gen_lowpart_if_possible PROTO((enum machine_mode, rtx));
extern rtx emit_jump_insn_before (); extern rtx operand_subword PROTO((rtx, int, int, enum machine_mode));
extern rtx emit_call_insn_before (); extern rtx operand_subword_force PROTO((rtx, int, enum machine_mode));
extern rtx emit_barrier_before (); extern int subreg_lowpart_p PROTO((rtx));
extern rtx emit_note_before (); extern rtx make_safe_from PROTO((rtx, rtx));
extern rtx emit_insn_after (); extern rtx memory_address PROTO((enum machine_mode, rtx));
extern rtx emit_jump_insn_after (); extern rtx get_insns PROTO((void));
extern rtx emit_barrier_after (); extern rtx get_last_insn PROTO((void));
extern rtx emit_label_after (); extern rtx get_last_insn_anywhere PROTO((void));
extern rtx emit_note_after (); extern void start_sequence PROTO((void));
extern rtx emit_line_note_after (); extern void push_to_sequence PROTO((rtx));
extern rtx emit_insn (); extern void end_sequence PROTO((void));
extern rtx emit_insns (); extern rtx gen_sequence PROTO((void));
extern rtx emit_insns_before (); extern rtx immed_double_const PROTO((HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode));
extern rtx emit_jump_insn (); extern rtx force_const_mem PROTO((enum machine_mode, rtx));
extern rtx emit_call_insn (); extern rtx force_reg PROTO((enum machine_mode, rtx));
extern rtx emit_label (); extern rtx get_pool_constant PROTO((rtx));
extern rtx emit_barrier (); extern enum machine_mode get_pool_mode PROTO((rtx));
extern rtx emit_line_note (); extern int get_pool_offset PROTO((rtx));
extern rtx emit_note (); extern rtx assign_stack_local PROTO((enum machine_mode, int, int));
extern rtx emit_line_note_force (); extern rtx assign_stack_temp PROTO((enum machine_mode, int, int));
extern rtx make_insn_raw (); extern rtx protect_from_queue PROTO((rtx, int));
extern rtx previous_insn (); extern void emit_queue PROTO((void));
extern rtx next_insn (); extern rtx emit_move_insn PROTO((rtx, rtx));
extern rtx prev_nonnote_insn (); extern rtx emit_insn_before PROTO((rtx, rtx));
extern rtx next_nonnote_insn (); extern rtx emit_jump_insn_before PROTO((rtx, rtx));
extern rtx prev_real_insn (); extern rtx emit_call_insn_before PROTO((rtx, rtx));
extern rtx next_real_insn (); extern rtx emit_barrier_before PROTO((rtx));
extern rtx prev_active_insn (); extern rtx emit_note_before PROTO((int, rtx));
extern rtx next_active_insn (); extern rtx emit_insn_after PROTO((rtx, rtx));
extern rtx prev_label (); extern rtx emit_jump_insn_after PROTO((rtx, rtx));
extern rtx next_label (); extern rtx emit_barrier_after PROTO((rtx));
extern rtx next_cc0_user (); extern rtx emit_label_after PROTO((rtx, rtx));
extern rtx prev_cc0_setter (); extern rtx emit_note_after PROTO((int, rtx));
extern rtx reg_set_last (); extern rtx emit_line_note_after PROTO((char *, int, rtx));
extern rtx next_nondeleted_insn (); extern rtx emit_insn PROTO((rtx));
extern enum rtx_code reverse_condition (); extern rtx emit_insns PROTO((rtx));
extern enum rtx_code swap_condition (); extern rtx emit_insns_before PROTO((rtx, rtx));
extern enum rtx_code unsigned_condition (); extern rtx emit_jump_insn PROTO((rtx));
extern enum rtx_code signed_condition (); extern rtx emit_call_insn PROTO((rtx));
extern rtx find_equiv_reg (); extern rtx emit_label PROTO((rtx));
extern rtx squeeze_notes (); extern rtx emit_barrier PROTO((void));
extern rtx delete_insn (); extern rtx emit_line_note PROTO((char *, int));
extern void delete_jump (); extern rtx emit_note PROTO((char *, int));
extern rtx get_label_before (); extern rtx emit_line_note_force PROTO((char *, int));
extern rtx get_label_after (); extern rtx make_insn_raw PROTO((rtx));
extern rtx follow_jumps (); extern rtx previous_insn PROTO((rtx));
extern rtx adj_offsettable_operand (); extern rtx next_insn PROTO((rtx));
extern rtx try_split (); extern rtx prev_nonnote_insn PROTO((rtx));
extern rtx split_insns (); extern rtx next_nonnote_insn PROTO((rtx));
extern rtx simplify_unary_operation (), simplify_binary_operation (); extern rtx prev_real_insn PROTO((rtx));
extern rtx simplify_ternary_operation (), simplify_relational_operation (); extern rtx next_real_insn PROTO((rtx));
extern rtx nonlocal_label_rtx_list (); extern rtx prev_active_insn PROTO((rtx));
extern rtx next_active_insn PROTO((rtx));
extern rtx prev_label PROTO((rtx));
extern rtx next_label PROTO((rtx));
extern rtx next_cc0_user PROTO((rtx));
extern rtx prev_cc0_setter PROTO((rtx));
extern rtx reg_set_last PROTO((rtx, rtx));
extern rtx next_nondeleted_insn PROTO((rtx));
extern enum rtx_code reverse_condition PROTO((enum rtx_code));
extern enum rtx_code swap_condition PROTO((enum rtx_code));
extern enum rtx_code unsigned_condition PROTO((enum rtx_code));
extern enum rtx_code signed_condition PROTO((enum rtx_code));
extern rtx find_equiv_reg PROTO((rtx, rtx, enum reg_class, int, short *, int, enum machine_mode));
extern rtx squeeze_notes PROTO((rtx, rtx));
extern rtx delete_insn PROTO((rtx));
extern void delete_jump PROTO((rtx));
extern rtx get_label_before PROTO((rtx));
extern rtx get_label_after PROTO((rtx));
extern rtx follow_jumps PROTO((rtx));
extern rtx adj_offsettable_operand PROTO((rtx, int));
extern rtx try_split PROTO((rtx, rtx, int));
extern rtx split_insns PROTO((rtx, rtx));
extern rtx simplify_unary_operation PROTO((enum rtx_code, enum machine_mode, rtx, enum machine_mode));
extern rtx simplify_binary_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
extern rtx simplify_ternary_operation PROTO((enum rtx_code, enum machine_mode, enum machine_mode, rtx, rtx, rtx));
extern rtx simplify_relational_operation PROTO((enum rtx_code, enum machine_mode, rtx, rtx));
extern rtx nonlocal_label_rtx_list PROTO((void));
extern rtx gen_move_insn PROTO((rtx, rtx));
extern rtx gen_jump PROTO((rtx));
extern rtx gen_beq PROTO((rtx));
extern rtx gen_bge PROTO((rtx));
extern rtx gen_ble PROTO((rtx));
extern rtx eliminate_constant_term PROTO((rtx, rtx *));
/* Maximum number of parallel sets and clobbers in any insn in this fn. /* Maximum number of parallel sets and clobbers in any insn in this fn.
Always at least 3, since the combiner could put that many togetherm Always at least 3, since the combiner could put that many togetherm
...@@ -687,16 +732,13 @@ extern rtx nonlocal_label_rtx_list (); ...@@ -687,16 +732,13 @@ extern rtx nonlocal_label_rtx_list ();
extern int max_parallel; extern int max_parallel;
extern int asm_noperands (); extern int asm_noperands PROTO((rtx));
extern char *decode_asm_operands (); extern char *decode_asm_operands PROTO((rtx, rtx *, rtx **, char **, enum machine_mode *));
#ifdef BITS_PER_WORD extern enum reg_class reg_preferred_class PROTO((int));
/* Conditional is to detect when config.h has been included. */ extern enum reg_class reg_alternate_class PROTO((int));
extern enum reg_class reg_preferred_class ();
extern enum reg_class reg_alternate_class ();
#endif
extern rtx get_first_nonparm_insn (); extern rtx get_first_nonparm_insn PROTO((void));
/* Standard pieces of rtx, to be substituted directly into things. */ /* Standard pieces of rtx, to be substituted directly into things. */
extern rtx pc_rtx; extern rtx pc_rtx;
...@@ -773,8 +815,27 @@ extern rtx virtual_outgoing_args_rtx; ...@@ -773,8 +815,27 @@ extern rtx virtual_outgoing_args_rtx;
#define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3) #define LAST_VIRTUAL_REGISTER ((FIRST_VIRTUAL_REGISTER) + 3)
extern rtx find_next_ref (); extern rtx find_next_ref PROTO((rtx, rtx));
extern rtx *find_single_use (); extern rtx *find_single_use PROTO((rtx, rtx, rtx *));
/* It is hard to write the prototype for expand_expr, since it needs
expr.h to be included for the enumeration. */
extern rtx expand_expr ();
extern rtx immed_real_const_1();
#ifdef TREE_CODE
/* rtl.h and tree.h were included. */
extern rtx output_constant_def PROTO((tree));
extern rtx immed_real_const PROTO((tree));
extern rtx immed_real_const_1 PROTO((REAL_VALUE_TYPE, enum machine_mode));
extern tree make_tree PROTO((tree, rtx));
#else
extern rtx output_constant_def ();
extern rtx immed_real_const ();
extern rtx immed_real_const_1 ();
#endif
/* Define a default value for STORE_FLAG_VALUE. */ /* Define a default value for STORE_FLAG_VALUE. */
......
...@@ -115,18 +115,6 @@ enum built_in_function ...@@ -115,18 +115,6 @@ enum built_in_function
typedef union tree_node *tree; typedef union tree_node *tree;
#define NULL_TREE (tree) NULL
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
#ifndef NULL_PTR
#define NULL_PTR (char *) NULL
#endif
/* Every kind of tree node starts with this structure, /* Every kind of tree node starts with this structure,
so all nodes have these fields. so all nodes have these fields.
...@@ -929,6 +917,36 @@ union tree_node ...@@ -929,6 +917,36 @@ union tree_node
struct tree_block block; struct tree_block block;
}; };
/* Add prototype support. */
#ifndef PROTO
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define PROTO(ARGS) ARGS
#else
#define PROTO(ARGS) ()
#endif
#endif
#define NULL_TREE (tree) NULL
/* Define a generic NULL if one hasn't already been defined. */
#ifndef NULL
#define NULL 0
#endif
#ifndef GENERIC_PTR
#if defined (USE_PROTOTYPES) ? USE_PROTOTYPES : defined (__STDC__)
#define GENERIC_PTR void *
#else
#define GENERIC_PTR char *
#endif
#endif
#ifndef NULL_PTR
#define NULL_PTR ((GENERIC_PTR)0)
#endif
/* Format for global names of constructor and destructor functions. */ /* Format for global names of constructor and destructor functions. */
#ifndef NO_DOLLAR_IN_LABEL #ifndef NO_DOLLAR_IN_LABEL
#define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_$I$%s" #define CONSTRUCTOR_NAME_FORMAT "_GLOBAL_$I$%s"
...@@ -945,77 +963,106 @@ union tree_node ...@@ -945,77 +963,106 @@ union tree_node
#define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N)) #define floor_log2(N) floor_log2_wide ((HOST_WIDE_INT) (N))
#endif #endif
extern char *oballoc (); #if 0
extern char *permalloc (); /* At present, don't prototype xrealloc, since all of the callers don't
extern char *savealloc (); cast their pointers to char *, and all of the xrealloc's don't use
extern char *xmalloc (); void * yet. */
extern char *xrealloc PROTO((void *, unsigned));
#else
extern char *xrealloc (); extern char *xrealloc ();
extern void free (); #endif
extern char *oballoc PROTO((int));
extern char *permalloc PROTO((int));
extern char *savealloc PROTO((int));
extern char *xmalloc PROTO((unsigned));
extern void free PROTO((void *));
/* Lowest level primitive for allocating a node. /* Lowest level primitive for allocating a node.
The TREE_CODE is the only argument. Contents are initialized The TREE_CODE is the only argument. Contents are initialized
to zero except for a few of the common fields. */ to zero except for a few of the common fields. */
extern tree make_node (); extern tree make_node PROTO((enum tree_code));
/* Make a copy of a node, with all the same contents except /* Make a copy of a node, with all the same contents except
for TREE_PERMANENT. (The copy is permanent for TREE_PERMANENT. (The copy is permanent
iff nodes being made now are permanent.) */ iff nodes being made now are permanent.) */
extern tree copy_node (); extern tree copy_node PROTO((tree));
/* Make a copy of a chain of TREE_LIST nodes. */ /* Make a copy of a chain of TREE_LIST nodes. */
extern tree copy_list (); extern tree copy_list PROTO((tree));
/* Make a TREE_VEC. */ /* Make a TREE_VEC. */
extern tree make_tree_vec (); extern tree make_tree_vec PROTO((int));
/* Return the (unique) IDENTIFIER_NODE node for a given name. /* Return the (unique) IDENTIFIER_NODE node for a given name.
The name is supplied as a char *. */ The name is supplied as a char *. */
extern tree get_identifier (); extern tree get_identifier PROTO((char *));
/* Construct various types of nodes. */ /* Construct various types of nodes. */
#define build_int_2(LO,HI) \ #define build_int_2(LO,HI) \
build_int_2_wide ((HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI)) build_int_2_wide ((HOST_WIDE_INT) (LO), (HOST_WIDE_INT) (HI))
extern tree build_int_2_wide (); #if 0
extern tree build_real (); /* We cannot define prototypes for the variable argument functions,
extern tree build_real_from_string (); since they have not been ANSI-fied, and an ANSI compiler would
extern tree build_real_from_int_cst (); complain when compiling the definition of these functions. */
extern tree build_complex ();
extern tree build_string (); extern tree build PROTO((enum tree_code, tree, ...));
extern tree build (), build1 (); extern tree build_nt PROTO((enum tree_code, ...));
extern tree build_nt (), build_parse_node (); extern tree build_parse_node PROTO((enum tree_code, ...));
extern tree build_tree_list (), build_decl_list (); #else
extern tree build_op_identifier (); extern tree build ();
extern tree build_decl (); extern tree build_nt ();
extern tree build_block (); extern tree build_parse_node ();
#endif
extern tree build_int_2_wide PROTO((HOST_WIDE_INT, HOST_WIDE_INT));
extern tree build_real PROTO((tree, REAL_VALUE_TYPE));
extern tree build_real_from_int_cst PROTO((tree, tree));
extern tree build_complex PROTO((tree, tree));
extern tree build_string PROTO((int, char *));
extern tree build1 PROTO((enum tree_code, tree, tree));
extern tree build_tree_list PROTO((tree, tree));
extern tree build_decl_list PROTO((tree, tree));
extern tree build_decl PROTO((enum tree_code, tree, tree));
extern tree build_block PROTO((tree, tree, tree, tree, tree));
/* Construct various nodes representing data types. */ /* Construct various nodes representing data types. */
extern tree make_signed_type (); extern tree make_signed_type PROTO((int));
extern tree make_unsigned_type (); extern tree make_unsigned_type PROTO((int));
extern tree signed_or_unsigned_type (); extern tree signed_or_unsigned_type PROTO((int, tree));
extern void fixup_unsigned_type (); extern void fixup_unsigned_type PROTO((tree));
extern tree build_pointer_type (); extern tree build_pointer_type PROTO((tree));
extern tree build_reference_type (); extern tree build_reference_type PROTO((tree));
extern tree build_index_type (), build_index_2_type (); extern tree build_index_type PROTO((tree));
extern tree build_array_type (); extern tree build_index_2_type PROTO((tree, tree));
extern tree build_function_type (); extern tree build_array_type PROTO((tree, tree));
extern tree build_method_type (); extern tree build_function_type PROTO((tree, tree));
extern tree build_offset_type (); extern tree build_method_type PROTO((tree, tree));
extern tree build_complex_type (); extern tree build_offset_type PROTO((tree, tree));
extern tree array_type_nelts (); extern tree build_complex_type PROTO((tree));
extern tree array_type_nelts PROTO((tree));
/* Construct expressions, performing type checking. */
/* Construct expressions, performing type checking.
GCC and G++ use different calling sequences for build_binary_op,
and build_indirect_ref, so don't include a prototype here. */
extern tree build_binary_op (); extern tree build_binary_op ();
extern tree build_indirect_ref (); extern tree build_indirect_ref ();
extern tree build_unary_op (); extern tree build_unary_op PROTO((enum tree_code, tree, int));
/* From expmed.c. Since rtl.h is included after tree.h, we can't
put the prototype here. Rtl.h does declare the prototype if
tree.h had been included. */
extern tree make_tree ();
/* Given a type node TYPE, and CONSTP and VOLATILEP, return a type /* Given a type node TYPE, and CONSTP and VOLATILEP, return a type
for the same kind of data as TYPE describes. for the same kind of data as TYPE describes.
...@@ -1024,25 +1071,25 @@ extern tree build_unary_op (); ...@@ -1024,25 +1071,25 @@ extern tree build_unary_op ();
so that duplicate variants are never made. so that duplicate variants are never made.
Only main variants should ever appear as types of expressions. */ Only main variants should ever appear as types of expressions. */
extern tree build_type_variant (); extern tree build_type_variant PROTO((tree, int, int));
/* Make a copy of a type node. */ /* Make a copy of a type node. */
extern tree build_type_copy (); extern tree build_type_copy PROTO((tree));
/* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT, /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
TYPE_ALIGN and TYPE_MODE fields. TYPE_ALIGN and TYPE_MODE fields.
If called more than once on one node, does nothing except If called more than once on one node, does nothing except
for the first time. */ for the first time. */
extern void layout_type (); extern void layout_type PROTO((tree));
/* Given a hashcode and a ..._TYPE node (for which the hashcode was made), /* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
return a canonicalized ..._TYPE node, so that duplicates are not made. return a canonicalized ..._TYPE node, so that duplicates are not made.
How the hash code is computed is up to the caller, as long as any two How the hash code is computed is up to the caller, as long as any two
callers that could hash identical-looking type nodes agree. */ callers that could hash identical-looking type nodes agree. */
extern tree type_hash_canon (); extern tree type_hash_canon PROTO((int, tree));
/* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node, /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
...@@ -1052,7 +1099,7 @@ extern tree type_hash_canon (); ...@@ -1052,7 +1099,7 @@ extern tree type_hash_canon ();
be starting at (in bits). Zero means it can be assumed aligned be starting at (in bits). Zero means it can be assumed aligned
on any boundary that may be needed. */ on any boundary that may be needed. */
extern void layout_decl (); extern void layout_decl PROTO((tree, unsigned));
/* Fold constants as much as possible in an expression. /* Fold constants as much as possible in an expression.
Returns the simplified expression. Returns the simplified expression.
...@@ -1060,20 +1107,19 @@ extern void layout_decl (); ...@@ -1060,20 +1107,19 @@ extern void layout_decl ();
if the argument itself cannot be simplified, its if the argument itself cannot be simplified, its
subexpressions are not changed. */ subexpressions are not changed. */
extern tree fold (); extern tree fold PROTO((tree));
/* Return an expr equal to X but certainly not valid as an lvalue. */ /* Return an expr equal to X but certainly not valid as an lvalue. */
extern tree non_lvalue (); extern tree non_lvalue PROTO((tree));
extern tree convert (); extern tree convert PROTO((tree, tree));
extern tree size_in_bytes (); extern tree size_in_bytes PROTO((tree));
extern int int_size_in_bytes (); extern int int_size_in_bytes PROTO((tree));
extern tree size_binop (); extern tree size_binop PROTO((enum tree_code, tree, tree));
extern tree size_int (); extern tree size_int PROTO((unsigned));
extern tree round_up (); extern tree round_up PROTO((tree, int));
extern tree get_pending_sizes (); extern tree get_pending_sizes PROTO((void));
extern tree get_permanent_types (), get_temporary_types ();
/* Type for sizes of data-type. */ /* Type for sizes of data-type. */
...@@ -1083,70 +1129,62 @@ extern tree sizetype; ...@@ -1083,70 +1129,62 @@ extern tree sizetype;
by making the last node in X point to Y. by making the last node in X point to Y.
Returns X, except if X is 0 returns Y. */ Returns X, except if X is 0 returns Y. */
extern tree chainon (); extern tree chainon PROTO((tree, tree));
/* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */ /* Make a new TREE_LIST node from specified PURPOSE, VALUE and CHAIN. */
extern tree tree_cons (), perm_tree_cons (), temp_tree_cons (); extern tree tree_cons PROTO((tree, tree, tree));
extern tree saveable_tree_cons (), decl_tree_cons (); extern tree perm_tree_cons PROTO((tree, tree, tree));
extern tree temp_tree_cons PROTO((tree, tree, tree));
extern tree saveable_tree_cons PROTO((tree, tree, tree));
extern tree decl_tree_cons PROTO((tree, tree, tree));
/* Return the last tree node in a chain. */ /* Return the last tree node in a chain. */
extern tree tree_last (); extern tree tree_last PROTO((tree));
/* Reverse the order of elements in a chain, and return the new head. */ /* Reverse the order of elements in a chain, and return the new head. */
extern tree nreverse (); extern tree nreverse PROTO((tree));
/* Make a copy of a chain of tree nodes. */
extern tree copy_chain ();
/* Returns the length of a chain of nodes /* Returns the length of a chain of nodes
(number of chain pointers to follow before reaching a null pointer). */ (number of chain pointers to follow before reaching a null pointer). */
extern int list_length (); extern int list_length PROTO((tree));
/* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */ /* integer_zerop (tree x) is nonzero if X is an integer constant of value 0 */
extern int integer_zerop (); extern int integer_zerop PROTO((tree));
/* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */ /* integer_onep (tree x) is nonzero if X is an integer constant of value 1 */
extern int integer_onep (); extern int integer_onep PROTO((tree));
/* integer_all_onesp (tree x) is nonzero if X is an integer constant /* integer_all_onesp (tree x) is nonzero if X is an integer constant
all of whose significant bits are 1. */ all of whose significant bits are 1. */
extern int integer_all_onesp (); extern int integer_all_onesp PROTO((tree));
/* integer_pow2p (tree x) is nonzero is X is an integer constant with /* integer_pow2p (tree x) is nonzero is X is an integer constant with
exactly one bit 1. */ exactly one bit 1. */
extern int integer_pow2p (); extern int integer_pow2p PROTO((tree));
/* type_unsigned_p (tree x) is nonzero if the type X is an unsigned type
(all of its possible values are >= 0).
If X is a pointer type, the value is 1.
If X is a real type, the value is 0. */
extern int type_unsigned_p ();
/* staticp (tree x) is nonzero if X is a reference to data allocated /* staticp (tree x) is nonzero if X is a reference to data allocated
at a fixed address in memory. */ at a fixed address in memory. */
extern int staticp (); extern int staticp PROTO((tree));
/* Gets an error if argument X is not an lvalue. /* Gets an error if argument X is not an lvalue.
Also returns 1 if X is an lvalue, 0 if not. */ Also returns 1 if X is an lvalue, 0 if not. */
extern int lvalue_or_else (); extern int lvalue_or_else PROTO((tree, char *));
/* save_expr (EXP) returns an expression equivalent to EXP /* save_expr (EXP) returns an expression equivalent to EXP
but it can be used multiple times within context CTX but it can be used multiple times within context CTX
and only evaluate EXP once. */ and only evaluate EXP once. */
extern tree save_expr (); extern tree save_expr PROTO((tree));
/* variable_size (EXP) is like save_expr (EXP) except that it /* variable_size (EXP) is like save_expr (EXP) except that it
is for the special case of something that is part of a is for the special case of something that is part of a
...@@ -1154,86 +1192,82 @@ extern tree save_expr (); ...@@ -1154,86 +1192,82 @@ extern tree save_expr ();
to compute the value at the right time when the data type to compute the value at the right time when the data type
belongs to a function parameter. */ belongs to a function parameter. */
extern tree variable_size (); extern tree variable_size PROTO((tree));
/* stabilize_reference (EXP) returns an reference equivalent to EXP /* stabilize_reference (EXP) returns an reference equivalent to EXP
but it can be used multiple times but it can be used multiple times
and only evaluate the subexpressions once. */ and only evaluate the subexpressions once. */
extern tree stabilize_reference (); extern tree stabilize_reference PROTO((tree));
/* Return EXP, stripped of any conversions to wider types /* Return EXP, stripped of any conversions to wider types
in such a way that the result of converting to type FOR_TYPE in such a way that the result of converting to type FOR_TYPE
is the same as if EXP were converted to FOR_TYPE. is the same as if EXP were converted to FOR_TYPE.
If FOR_TYPE is 0, it signifies EXP's type. */ If FOR_TYPE is 0, it signifies EXP's type. */
extern tree get_unwidened (); extern tree get_unwidened PROTO((tree, tree));
/* Return OP or a simpler expression for a narrower value /* Return OP or a simpler expression for a narrower value
which can be sign-extended or zero-extended to give back OP. which can be sign-extended or zero-extended to give back OP.
Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended Store in *UNSIGNEDP_PTR either 1 if the value should be zero-extended
or 0 if the value should be sign-extended. */ or 0 if the value should be sign-extended. */
extern tree get_narrower (); extern tree get_narrower PROTO((tree, int *));
/* Given MODE and UNSIGNEDP, return a suitable type-tree /* Given MODE and UNSIGNEDP, return a suitable type-tree
with that mode. with that mode.
The definition of this resides in language-specific code The definition of this resides in language-specific code
as the repertoire of available types may vary. */ as the repertoire of available types may vary. */
extern tree type_for_mode (); extern tree type_for_mode PROTO((enum machine_mode, int));
/* Given PRECISION and UNSIGNEDP, return a suitable type-tree /* Given PRECISION and UNSIGNEDP, return a suitable type-tree
for an integer type with at least that precision. for an integer type with at least that precision.
The definition of this resides in language-specific code The definition of this resides in language-specific code
as the repertoire of available types may vary. */ as the repertoire of available types may vary. */
extern tree type_for_size (); extern tree type_for_size PROTO((unsigned, int));
/* Given an integer type T, return a type like T but unsigned. /* Given an integer type T, return a type like T but unsigned.
If T is unsigned, the value is T. If T is unsigned, the value is T.
The definition of this resides in language-specific code The definition of this resides in language-specific code
as the repertoire of available types may vary. */ as the repertoire of available types may vary. */
extern tree unsigned_type (); extern tree unsigned_type PROTO((tree));
/* Given an integer type T, return a type like T but signed. /* Given an integer type T, return a type like T but signed.
If T is signed, the value is T. If T is signed, the value is T.
The definition of this resides in language-specific code The definition of this resides in language-specific code
as the repertoire of available types may vary. */ as the repertoire of available types may vary. */
extern tree signed_type (); extern tree signed_type PROTO((tree));
/* This function must be defined in the language-specific files. /* This function must be defined in the language-specific files.
expand_expr calls it to build the cleanup-expression for a TARGET_EXPR. expand_expr calls it to build the cleanup-expression for a TARGET_EXPR.
This is defined in a language-specific file. */ This is defined in a language-specific file. */
extern tree maybe_build_cleanup (); extern tree maybe_build_cleanup PROTO((tree));
/* Return the floating type node for a given floating machine mode. */
extern tree get_floating_type ();
/* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF, /* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF,
look for nested component-refs or array-refs at constant positions look for nested component-refs or array-refs at constant positions
and find the ultimate containing object, which is returned. */ and find the ultimate containing object, which is returned. */
extern tree get_inner_reference (); extern tree get_inner_reference PROTO((tree, int *, int *, tree *, enum machine_mode *, int *, int *));
/* Return the FUNCTION_DECL which provides this _DECL with its context, /* Return the FUNCTION_DECL which provides this _DECL with its context,
or zero if none. */ or zero if none. */
extern tree decl_function_context (); extern tree decl_function_context PROTO((tree));
/* Return the RECORD_TYPE or UNION_TYPE which provides this _DECL /* Return the RECORD_TYPE or UNION_TYPE which provides this _DECL
with its context, or zero if none. */ with its context, or zero if none. */
extern tree decl_type_context (); extern tree decl_type_context PROTO((tree));
/* Given the FUNCTION_DECL for the current function, /* Given the FUNCTION_DECL for the current function,
return zero if it is ok for this function to be inline. return zero if it is ok for this function to be inline.
Otherwise return a warning message with a single %s Otherwise return a warning message with a single %s
for the function's name. */ for the function's name. */
extern char *function_cannot_inline_p (); extern char *function_cannot_inline_p PROTO((tree));
/* Declare commonly used variables for tree structure. */ /* Declare commonly used variables for tree structure. */
...@@ -1303,75 +1337,77 @@ extern int all_types_permanent; ...@@ -1303,75 +1337,77 @@ extern int all_types_permanent;
extern char *(*decl_printable_name) (); extern char *(*decl_printable_name) ();
/* In expmed.c */
extern tree make_tree ();
/* In stmt.c */ /* In stmt.c */
extern tree expand_start_stmt_expr (); extern tree expand_start_stmt_expr PROTO((void));
extern tree expand_end_stmt_expr (); extern tree expand_end_stmt_expr PROTO((tree));
extern void expand_expr_stmt (), clear_last_expr (); extern void expand_expr_stmt PROTO((tree));
extern void expand_label (), expand_goto (), expand_asm (); extern void clear_last_expr PROTO((void));
extern void expand_start_cond (), expand_end_cond (); extern void expand_label PROTO((tree));
extern void expand_start_else (), expand_start_elseif (); extern void expand_goto PROTO((tree));
extern struct nesting *expand_start_loop (); extern void expand_asm PROTO((tree));
extern struct nesting *expand_start_loop_continue_elsewhere (); extern void expand_start_cond PROTO((tree, int));
extern void expand_loop_continue_here (); extern void expand_end_cond PROTO((void));
extern void expand_end_loop (); extern void expand_start_else PROTO((void));
extern int expand_continue_loop (); extern void expand_start_elseif PROTO((tree));
extern int expand_exit_loop (), expand_exit_loop_if_false (); extern struct nesting *expand_start_loop PROTO((int));
extern int expand_exit_something (); extern struct nesting *expand_start_loop_continue_elsewhere PROTO((int));
extern void expand_loop_continue_here PROTO((void));
extern void expand_start_delayed_expr (); extern void expand_end_loop PROTO((void));
extern tree expand_end_delayed_expr (); extern int expand_continue_loop PROTO((struct nesting *));
extern void expand_emit_delayed_expr (); extern int expand_exit_loop PROTO((struct nesting *));
extern int expand_exit_loop_if_false PROTO((struct nesting *, tree));
extern void expand_null_return (), expand_return (); extern int expand_exit_something PROTO((void));
extern void expand_start_bindings (), expand_end_bindings ();
extern tree last_cleanup_this_contour (); extern void expand_null_return PROTO((void));
extern void expand_start_case (), expand_end_case (); extern void expand_return PROTO((tree));
extern int pushcase (), pushcase_range (); extern void expand_start_bindings PROTO((int));
extern void expand_start_function (), expand_end_function (); extern void expand_end_bindings PROTO((tree, int, int));
extern tree last_cleanup_this_contour PROTO((void));
extern void expand_start_case PROTO((int, tree, tree, char *));
extern void expand_end_case PROTO((tree));
extern int pushcase PROTO((tree, tree, tree *));
extern int pushcase_range PROTO((tree, tree, tree, tree *));
/* In fold-const.c */ /* In fold-const.c */
extern tree invert_truthvalue (); extern tree invert_truthvalue PROTO((tree));
/* The language front-end must define these functions. */ /* The language front-end must define these functions. */
/* Function of no arguments for initializing lexical scanning. */ /* Function of no arguments for initializing lexical scanning. */
extern void init_lex (); extern void init_lex PROTO((void));
/* Function of no arguments for initializing the symbol table. */ /* Function of no arguments for initializing the symbol table. */
extern void init_decl_processing (); extern void init_decl_processing PROTO((void));
/* Functions called with no arguments at the beginning and end or processing /* Functions called with no arguments at the beginning and end or processing
the input source file. */ the input source file. */
extern void lang_init (); extern void lang_init PROTO((void));
extern void lang_finish (); extern void lang_finish PROTO((void));
/* Function called with no arguments to parse and compile the input. */ /* Function called with no arguments to parse and compile the input. */
extern int yyparse (); extern int yyparse PROTO((void));
/* Function called with option as argument /* Function called with option as argument
to decode options starting with -f or -W or +. to decode options starting with -f or -W or +.
It should return nonzero if it handles the option. */ It should return nonzero if it handles the option. */
extern int lang_decode_option (); extern int lang_decode_option PROTO((char *));
/* Functions for processing symbol declarations. */ /* Functions for processing symbol declarations. */
/* Function to enter a new lexical scope. /* Function to enter a new lexical scope.
Takes one argument: always zero when called from outside the front end. */ Takes one argument: always zero when called from outside the front end. */
extern void pushlevel (); extern void pushlevel PROTO((int));
/* Function to exit a lexical scope. It returns a BINDING for that scope. /* Function to exit a lexical scope. It returns a BINDING for that scope.
Takes three arguments: Takes three arguments:
KEEP -- nonzero if there were declarations in this scope. KEEP -- nonzero if there were declarations in this scope.
REVERSE -- reverse the order of decls before returning them. REVERSE -- reverse the order of decls before returning them.
FUNCTIONBODY -- nonzero if this level is the body of a function. */ FUNCTIONBODY -- nonzero if this level is the body of a function. */
extern tree poplevel (); extern tree poplevel PROTO((int, int, int));
/* Function to add a decl to the current scope level. /* Function to add a decl to the current scope level.
Takes one argument, a decl to add. Takes one argument, a decl to add.
Returns that decl, or, if the same symbol is already declared, may Returns that decl, or, if the same symbol is already declared, may
return a different decl for that name. */ return a different decl for that name. */
extern tree pushdecl (); extern tree pushdecl PROTO((tree));
/* Function to return the chain of decls so far in the current scope level. */ /* Function to return the chain of decls so far in the current scope level. */
extern tree getdecls (); extern tree getdecls PROTO((void));
/* Function to return the chain of structure tags in the current scope level. */ /* Function to return the chain of structure tags in the current scope level. */
extern tree gettags (); extern tree gettags PROTO((void));
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