aboutsummaryrefslogtreecommitdiff
path: root/gcc/genrecog.c
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2003-06-01 15:59:10 +0000
committerAndreas Jaeger <aj@suse.de>2003-06-01 15:59:10 +0000
commitfa49f5262888562ffe883c06d1dd5d29f6ba8716 (patch)
tree1ed2af1b719c9ea42b10268e89af837f6cc20554 /gcc/genrecog.c
parent39194e7808d441a92ba2f992c0b3191e9878b4c4 (diff)
* genrecog.c: Use ISO C90 prototypes.
(nodes_identical): Correct declaration to match prototype. (maybe_both_true): Likewise. (merge_trees): Likewise. * genpeep.c (gen_peephole): Remove #if 0 code. Use ISO C90 prototypes. * genattrtab.c (copy_rtx_unchanging): Remove #if 0'ed code. Remove #if 0'ed function simplify_by_alternatives. (optimize_attrs): Remove #if 0'ed code. Remove ^L. Use ISO C90 prototypes. (make_canonical): Remove #if 0'ed code. (convert_const_symbol_ref): Remove #if 0'ed function. * gen-protos.c (main): Check for argument. * rtl.h: Use ISO C90 prototypes for functions from lists.c. * params.h: Use ISO C90 prototypes. * params.c: Likewise. * intl.c: Likewise. * intl.h: Likewise. * lists.c: Likewise. * errors.c: Likewise. * errors.h: Likewise. * gencodes.c: Likewise. * genpreds.c: Likewise. * genattr.c: Likewise. * gen-protos.c: Likewise. * genflags.c: Likewise * genconditions.c: Likewise. * genautomata.c: Likewise. * gencheck.c: Likewise. * genconfig.c: Likewise. * genconstants.c: Likewise. * genemit.c: Likewise. * genextract.c: Likewise. * gengenrtl.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genopinit.c: Likewise. * genoutput.c: Likewise. * gensupport.c: Likewise. * gensupport.h: Likewise. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@67296 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genrecog.c')
-rw-r--r--gcc/genrecog.c269
1 files changed, 99 insertions, 170 deletions
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index e1dc9b205ba..f6f733fe299 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -1,6 +1,6 @@
/* Generate code from machine description to recognize rtl as insns.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1997, 1998,
- 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of GCC.
@@ -229,96 +229,94 @@ static const char *const special_mode_pred_table[] = {
#define NUM_SPECIAL_MODE_PREDS ARRAY_SIZE (special_mode_pred_table)
static struct decision *new_decision
- PARAMS ((const char *, struct decision_head *));
+ (const char *, struct decision_head *);
static struct decision_test *new_decision_test
- PARAMS ((enum decision_type, struct decision_test ***));
+ (enum decision_type, struct decision_test ***);
static rtx find_operand
- PARAMS ((rtx, int));
+ (rtx, int);
static rtx find_matching_operand
- PARAMS ((rtx, int));
+ (rtx, int);
static void validate_pattern
- PARAMS ((rtx, rtx, rtx, int));
+ (rtx, rtx, rtx, int);
static struct decision *add_to_sequence
- PARAMS ((rtx, struct decision_head *, const char *, enum routine_type, int));
+ (rtx, struct decision_head *, const char *, enum routine_type, int);
static int maybe_both_true_2
- PARAMS ((struct decision_test *, struct decision_test *));
+ (struct decision_test *, struct decision_test *);
static int maybe_both_true_1
- PARAMS ((struct decision_test *, struct decision_test *));
+ (struct decision_test *, struct decision_test *);
static int maybe_both_true
- PARAMS ((struct decision *, struct decision *, int));
+ (struct decision *, struct decision *, int);
static int nodes_identical_1
- PARAMS ((struct decision_test *, struct decision_test *));
+ (struct decision_test *, struct decision_test *);
static int nodes_identical
- PARAMS ((struct decision *, struct decision *));
+ (struct decision *, struct decision *);
static void merge_accept_insn
- PARAMS ((struct decision *, struct decision *));
+ (struct decision *, struct decision *);
static void merge_trees
- PARAMS ((struct decision_head *, struct decision_head *));
+ (struct decision_head *, struct decision_head *);
static void factor_tests
- PARAMS ((struct decision_head *));
+ (struct decision_head *);
static void simplify_tests
- PARAMS ((struct decision_head *));
+ (struct decision_head *);
static int break_out_subroutines
- PARAMS ((struct decision_head *, int));
+ (struct decision_head *, int);
static void find_afterward
- PARAMS ((struct decision_head *, struct decision *));
+ (struct decision_head *, struct decision *);
static void change_state
- PARAMS ((const char *, const char *, struct decision *, const char *));
+ (const char *, const char *, struct decision *, const char *);
static void print_code
- PARAMS ((enum rtx_code));
+ (enum rtx_code);
static void write_afterward
- PARAMS ((struct decision *, struct decision *, const char *));
+ (struct decision *, struct decision *, const char *);
static struct decision *write_switch
- PARAMS ((struct decision *, int));
+ (struct decision *, int);
static void write_cond
- PARAMS ((struct decision_test *, int, enum routine_type));
+ (struct decision_test *, int, enum routine_type);
static void write_action
- PARAMS ((struct decision *, struct decision_test *, int, int,
- struct decision *, enum routine_type));
+ (struct decision *, struct decision_test *, int, int,
+ struct decision *, enum routine_type);
static int is_unconditional
- PARAMS ((struct decision_test *, enum routine_type));
+ (struct decision_test *, enum routine_type);
static int write_node
- PARAMS ((struct decision *, int, enum routine_type));
+ (struct decision *, int, enum routine_type);
static void write_tree_1
- PARAMS ((struct decision_head *, int, enum routine_type));
+ (struct decision_head *, int, enum routine_type);
static void write_tree
- PARAMS ((struct decision_head *, const char *, enum routine_type, int));
+ (struct decision_head *, const char *, enum routine_type, int);
static void write_subroutine
- PARAMS ((struct decision_head *, enum routine_type));
+ (struct decision_head *, enum routine_type);
static void write_subroutines
- PARAMS ((struct decision_head *, enum routine_type));
+ (struct decision_head *, enum routine_type);
static void write_header
- PARAMS ((void));
+ (void);
static struct decision_head make_insn_sequence
- PARAMS ((rtx, enum routine_type));
+ (rtx, enum routine_type);
static void process_tree
- PARAMS ((struct decision_head *, enum routine_type));
+ (struct decision_head *, enum routine_type);
static void record_insn_name
- PARAMS ((int, const char *));
+ (int, const char *);
static void debug_decision_0
- PARAMS ((struct decision *, int, int));
+ (struct decision *, int, int);
static void debug_decision_1
- PARAMS ((struct decision *, int));
+ (struct decision *, int);
static void debug_decision_2
- PARAMS ((struct decision_test *));
+ (struct decision_test *);
extern void debug_decision
- PARAMS ((struct decision *));
+ (struct decision *);
extern void debug_decision_list
- PARAMS ((struct decision *));
+ (struct decision *);
/* Create a new node in sequence after LAST. */
static struct decision *
-new_decision (position, last)
- const char *position;
- struct decision_head *last;
+new_decision (const char *position, struct decision_head *last)
{
struct decision *new
= (struct decision *) xmalloc (sizeof (struct decision));
@@ -335,9 +333,7 @@ new_decision (position, last)
/* Create a new test and link it in at PLACE. */
static struct decision_test *
-new_decision_test (type, pplace)
- enum decision_type type;
- struct decision_test ***pplace;
+new_decision_test (enum decision_type type, struct decision_test ***pplace)
{
struct decision_test **place = *pplace;
struct decision_test *test;
@@ -356,9 +352,7 @@ new_decision_test (type, pplace)
/* Search for and return operand N. */
static rtx
-find_operand (pattern, n)
- rtx pattern;
- int n;
+find_operand (rtx pattern, int n)
{
const char *fmt;
RTX_CODE code;
@@ -411,9 +405,7 @@ find_operand (pattern, n)
constraint for operand N. */
static rtx
-find_matching_operand (pattern, n)
- rtx pattern;
- int n;
+find_matching_operand (rtx pattern, int n)
{
const char *fmt;
RTX_CODE code;
@@ -466,11 +458,7 @@ find_matching_operand (pattern, n)
'+' within a context that requires in-out constraints. */
static void
-validate_pattern (pattern, insn, set, set_code)
- rtx pattern;
- rtx insn;
- rtx set;
- int set_code;
+validate_pattern (rtx pattern, rtx insn, rtx set, int set_code)
{
const char *fmt;
RTX_CODE code;
@@ -553,7 +541,7 @@ validate_pattern (pattern, insn, set, set_code)
{
const char constraints0 = XSTR (pattern, 2)[0];
- /* In DEFINE_EXPAND, DEFINE_SPLIT, and DEFINE_PEEPHOLE2, we
+ /* In DEFINE_EXPAND, DEFINE_SPLIT, and DEFINE_PEEPHOLE2, we
don't use the MATCH_OPERAND constraint, only the predicate.
This is confusing to folks doing new ports, so help them
not make the mistake. */
@@ -566,7 +554,7 @@ validate_pattern (pattern, insn, set, set_code)
"warning: constraints not supported in %s",
rtx_name[GET_CODE (insn)]);
}
-
+
/* A MATCH_OPERAND that is a SET should have an output reload. */
else if (set && constraints0)
{
@@ -590,7 +578,7 @@ validate_pattern (pattern, insn, set, set_code)
else if (constraints0 != '=' && constraints0 != '+')
{
message_with_line (pattern_lineno,
- "operand %d missing output reload",
+ "operand %d missing output reload",
XINT (pattern, 0));
error_count++;
}
@@ -767,12 +755,8 @@ validate_pattern (pattern, insn, set, set_code)
A pointer to the final node in the chain is returned. */
static struct decision *
-add_to_sequence (pattern, last, position, insn_type, top)
- rtx pattern;
- struct decision_head *last;
- const char *position;
- enum routine_type insn_type;
- int top;
+add_to_sequence (rtx pattern, struct decision_head *last, const char *position,
+ enum routine_type insn_type, int top)
{
RTX_CODE code;
struct decision *this, *sub;
@@ -1062,8 +1046,7 @@ add_to_sequence (pattern, last, position, insn_type, top)
Returns > 0 for "definitely both true" and < 0 for "maybe both true". */
static int
-maybe_both_true_2 (d1, d2)
- struct decision_test *d1, *d2;
+maybe_both_true_2 (struct decision_test *d1, struct decision_test *d2)
{
if (d1->type == d2->type)
{
@@ -1173,8 +1156,7 @@ maybe_both_true_2 (d1, d2)
Returns > 0 for "definitely both true" and < 0 for "maybe both true". */
static int
-maybe_both_true_1 (d1, d2)
- struct decision_test *d1, *d2;
+maybe_both_true_1 (struct decision_test *d1, struct decision_test *d2)
{
struct decision_test *t1, *t2;
@@ -1208,9 +1190,8 @@ maybe_both_true_1 (d1, d2)
recursively descend. */
static int
-maybe_both_true (d1, d2, toplevel)
- struct decision *d1, *d2;
- int toplevel;
+maybe_both_true (struct decision *d1, struct decision *d2,
+ int toplevel)
{
struct decision *p1, *p2;
int cmp;
@@ -1277,8 +1258,7 @@ maybe_both_true (d1, d2, toplevel)
/* A subroutine of nodes_identical. Examine two tests for equivalence. */
static int
-nodes_identical_1 (d1, d2)
- struct decision_test *d1, *d2;
+nodes_identical_1 (struct decision_test *d1, struct decision_test *d2)
{
switch (d1->type)
{
@@ -1325,8 +1305,7 @@ nodes_identical_1 (d1, d2)
consider different orderings on the tests. */
static int
-nodes_identical (d1, d2)
- struct decision *d1, *d2;
+nodes_identical (struct decision *d1, struct decision *d2)
{
struct decision_test *t1, *t2;
@@ -1362,8 +1341,7 @@ nodes_identical (d1, d2)
source machine description. */
static void
-merge_accept_insn (oldd, addd)
- struct decision *oldd, *addd;
+merge_accept_insn (struct decision *oldd, struct decision *addd)
{
struct decision_test *old, *add;
@@ -1407,8 +1385,7 @@ merge_accept_insn (oldd, addd)
/* Merge two decision trees OLDH and ADDH, modifying OLDH destructively. */
static void
-merge_trees (oldh, addh)
- struct decision_head *oldh, *addh;
+merge_trees (struct decision_head *oldh, struct decision_head *addh)
{
struct decision *next, *add;
@@ -1492,8 +1469,7 @@ merge_trees (oldh, addh)
(depending on the test type) to emit switch statements later. */
static void
-factor_tests (head)
- struct decision_head *head;
+factor_tests (struct decision_head *head)
{
struct decision *first, *next;
@@ -1578,8 +1554,7 @@ factor_tests (head)
predicates, remove them. */
static void
-simplify_tests (head)
- struct decision_head *head;
+simplify_tests (struct decision_head *head)
{
struct decision *tree;
@@ -1616,9 +1591,7 @@ simplify_tests (head)
that is generated. */
static int
-break_out_subroutines (head, initial)
- struct decision_head *head;
- int initial;
+break_out_subroutines (struct decision_head *head, int initial)
{
int size = 0;
struct decision *sub;
@@ -1638,9 +1611,7 @@ break_out_subroutines (head, initial)
when p is true. */
static void
-find_afterward (head, real_afterward)
- struct decision_head *head;
- struct decision *real_afterward;
+find_afterward (struct decision_head *head, struct decision *real_afterward)
{
struct decision *p, *q, *afterward;
@@ -1687,11 +1658,8 @@ find_afterward (head, real_afterward)
match multiple insns and we try to step past the end of the stream. */
static void
-change_state (oldpos, newpos, afterward, indent)
- const char *oldpos;
- const char *newpos;
- struct decision *afterward;
- const char *indent;
+change_state (const char *oldpos, const char *newpos,
+ struct decision *afterward, const char *indent)
{
int odepth = strlen (oldpos);
int ndepth = strlen (newpos);
@@ -1748,8 +1716,7 @@ change_state (oldpos, newpos, afterward, indent)
the name. */
static void
-print_code (code)
- enum rtx_code code;
+print_code (enum rtx_code code)
{
const char *p;
for (p = GET_RTX_NAME (code); *p; p++)
@@ -1759,10 +1726,8 @@ print_code (code)
/* Emit code to cross an afterward link -- change state and branch. */
static void
-write_afterward (start, afterward, indent)
- struct decision *start;
- struct decision *afterward;
- const char *indent;
+write_afterward (struct decision *start, struct decision *afterward,
+ const char *indent)
{
if (!afterward || start->subroutine_number > 0)
printf("%sgoto ret0;\n", indent);
@@ -1777,9 +1742,7 @@ write_afterward (start, afterward, indent)
nodes at START. Return the first node yet untested. */
static struct decision *
-write_switch (start, depth)
- struct decision *start;
- int depth;
+write_switch (struct decision *start, int depth)
{
struct decision *p = start;
enum decision_type type = p->tests->type;
@@ -1976,10 +1939,8 @@ write_switch (start, depth)
/* Emit code for one test. */
static void
-write_cond (p, depth, subroutine_type)
- struct decision_test *p;
- int depth;
- enum routine_type subroutine_type;
+write_cond (struct decision_test *p, int depth,
+ enum routine_type subroutine_type)
{
switch (p->type)
{
@@ -2051,12 +2012,9 @@ write_cond (p, depth, subroutine_type)
perform a state change. For the `accept' tests we must do more work. */
static void
-write_action (p, test, depth, uncond, success, subroutine_type)
- struct decision *p;
- struct decision_test *test;
- int depth, uncond;
- struct decision *success;
- enum routine_type subroutine_type;
+write_action (struct decision *p, struct decision_test *test,
+ int depth, int uncond, struct decision *success,
+ enum routine_type subroutine_type)
{
const char *indent;
int want_close = 0;
@@ -2142,9 +2100,7 @@ write_action (p, test, depth, uncond, success, subroutine_type)
/* ??? is_unconditional is a stupid name for a tri-state function. */
static int
-is_unconditional (t, subroutine_type)
- struct decision_test *t;
- enum routine_type subroutine_type;
+is_unconditional (struct decision_test *t, enum routine_type subroutine_type)
{
if (t->type == DT_accept_op)
return 1;
@@ -2171,10 +2127,8 @@ is_unconditional (t, subroutine_type)
Return true if there is no fallthru path. */
static int
-write_node (p, depth, subroutine_type)
- struct decision *p;
- int depth;
- enum routine_type subroutine_type;
+write_node (struct decision *p, int depth,
+ enum routine_type subroutine_type)
{
struct decision_test *test, *last_test;
int uncond;
@@ -2210,10 +2164,8 @@ write_node (p, depth, subroutine_type)
/* Emit code for all of the sibling nodes of HEAD. */
static void
-write_tree_1 (head, depth, subroutine_type)
- struct decision_head *head;
- int depth;
- enum routine_type subroutine_type;
+write_tree_1 (struct decision_head *head, int depth,
+ enum routine_type subroutine_type)
{
struct decision *p, *next;
int uncond = 0;
@@ -2246,11 +2198,8 @@ write_tree_1 (head, depth, subroutine_type)
position at the node that branched to this node. */
static void
-write_tree (head, prevpos, type, initial)
- struct decision_head *head;
- const char *prevpos;
- enum routine_type type;
- int initial;
+write_tree (struct decision_head *head, const char *prevpos,
+ enum routine_type type, int initial)
{
struct decision *p = head->first;
@@ -2306,9 +2255,7 @@ write_tree (head, prevpos, type, initial)
node TREE. */
static void
-write_subroutine (head, type)
- struct decision_head *head;
- enum routine_type type;
+write_subroutine (struct decision_head *head, enum routine_type type)
{
int subfunction = head->first ? head->first->subroutine_number : 0;
const char *s_or_e;
@@ -2327,7 +2274,7 @@ write_subroutine (head, type)
switch (type)
{
case RECOG:
- printf ("%sint recog%s PARAMS ((rtx, rtx, int *));\n", s_or_e, extension);
+ printf ("%sint recog%s (rtx, rtx, int *);\n", s_or_e, extension);
printf ("%sint\n\
recog%s (x0, insn, pnum_clobbers)\n\
rtx x0 ATTRIBUTE_UNUSED;\n\
@@ -2335,14 +2282,14 @@ recog%s (x0, insn, pnum_clobbers)\n\
int *pnum_clobbers ATTRIBUTE_UNUSED;\n", s_or_e, extension);
break;
case SPLIT:
- printf ("%srtx split%s PARAMS ((rtx, rtx));\n", s_or_e, extension);
+ printf ("%srtx split%s (rtx, rtx);\n", s_or_e, extension);
printf ("%srtx\n\
split%s (x0, insn)\n\
rtx x0 ATTRIBUTE_UNUSED;\n\
rtx insn ATTRIBUTE_UNUSED;\n", s_or_e, extension);
break;
case PEEPHOLE2:
- printf ("%srtx peephole2%s PARAMS ((rtx, rtx, int *));\n",
+ printf ("%srtx peephole2%s (rtx, rtx, int *);\n",
s_or_e, extension);
printf ("%srtx\n\
peephole2%s (x0, insn, _pmatch_len)\n\
@@ -2373,9 +2320,7 @@ peephole2%s (x0, insn, _pmatch_len)\n\
subroutines, but did not write them out. Do so now. */
static void
-write_subroutines (head, type)
- struct decision_head *head;
- enum routine_type type;
+write_subroutines (struct decision_head *head, enum routine_type type)
{
struct decision *p;
@@ -2390,7 +2335,7 @@ write_subroutines (head, type)
/* Begin the output file. */
static void
-write_header ()
+write_header (void)
{
puts ("\
/* Generated automatically by the program `genrecog' from the target\n\
@@ -2452,9 +2397,7 @@ write_header ()
TYPE says what type of routine we are recognizing (RECOG or SPLIT). */
static struct decision_head
-make_insn_sequence (insn, type)
- rtx insn;
- enum routine_type type;
+make_insn_sequence (rtx insn, enum routine_type type)
{
rtx x;
const char *c_test = XSTR (insn, type == RECOG ? 2 : 1);
@@ -2609,12 +2552,12 @@ make_insn_sequence (insn, type)
case SPLIT:
/* Define the subroutine we will call below and emit in genemit. */
- printf ("extern rtx gen_split_%d PARAMS ((rtx *));\n", next_insn_code);
+ printf ("extern rtx gen_split_%d (rtx *);\n", next_insn_code);
break;
case PEEPHOLE2:
/* Define the subroutine we will call below and emit in genemit. */
- printf ("extern rtx gen_peephole2_%d PARAMS ((rtx, rtx *));\n",
+ printf ("extern rtx gen_peephole2_%d (rtx, rtx *);\n",
next_insn_code);
break;
}
@@ -2623,9 +2566,7 @@ make_insn_sequence (insn, type)
}
static void
-process_tree (head, subroutine_type)
- struct decision_head *head;
- enum routine_type subroutine_type;
+process_tree (struct decision_head *head, enum routine_type subroutine_type)
{
if (head->first == NULL)
{
@@ -2652,12 +2593,10 @@ process_tree (head, subroutine_type)
write_subroutine (head, subroutine_type);
}
-extern int main PARAMS ((int, char **));
+extern int main (int, char **);
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
rtx desc;
struct decision_head recog_tree, split_tree, peephole2_tree, h;
@@ -2721,8 +2660,7 @@ main (argc, argv)
/* Define this so we can link with print-rtl.o to get debug_rtx function. */
const char *
-get_insn_name (code)
- int code;
+get_insn_name (int code)
{
if (code < insn_name_ptr_size)
return insn_name_ptr[code];
@@ -2731,9 +2669,7 @@ get_insn_name (code)
}
static void
-record_insn_name (code, name)
- int code;
- const char *name;
+record_insn_name (int code, const char *name)
{
static const char *last_real_name = "insn";
static int last_real_code = 0;
@@ -2765,8 +2701,7 @@ record_insn_name (code, name)
}
static void
-debug_decision_2 (test)
- struct decision_test *test;
+debug_decision_2 (struct decision_test *test)
{
switch (test->type)
{
@@ -2823,9 +2758,7 @@ debug_decision_2 (test)
}
static void
-debug_decision_1 (d, indent)
- struct decision *d;
- int indent;
+debug_decision_1 (struct decision *d, int indent)
{
int i;
struct decision_test *test;
@@ -2858,9 +2791,7 @@ debug_decision_1 (d, indent)
}
static void
-debug_decision_0 (d, indent, maxdepth)
- struct decision *d;
- int indent, maxdepth;
+debug_decision_0 (struct decision *d, int indent, int maxdepth)
{
struct decision *n;
int i;
@@ -2881,15 +2812,13 @@ debug_decision_0 (d, indent, maxdepth)
}
void
-debug_decision (d)
- struct decision *d;
+debug_decision (struct decision *d)
{
debug_decision_0 (d, 0, 1000000);
}
void
-debug_decision_list (d)
- struct decision *d;
+debug_decision_list (struct decision *d)
{
while (d)
{