1991-10-24 18:21:48 +01:00
|
|
|
|
/* Generate code from machine description to extract operands from insn as rtl.
|
1999-01-13 11:46:45 +01:00
|
|
|
|
Copyright (C) 1987, 91-93, 97-98, 1999 Free Software Foundation, Inc.
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
This file is part of GNU CC.
|
|
|
|
|
|
|
|
|
|
GNU CC is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
|
|
GNU CC is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GNU CC; see the file COPYING. If not, write to
|
1995-06-15 13:52:21 +02:00
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
|
1992-10-13 05:24:45 +01:00
|
|
|
|
#include "hconfig.h"
|
Cutover various gen*.c files to using system.h:
* Makefile.in (genconfig.o, genflags.o, gencodes.o, genemit.o,
genopinit.o, genrecog.o, genextract.o, genpeep.o, genattr.o,
genattrtab.o, genoutput.o): Depend on system.h.
* genattr.c: Include system.h. Add arguments to various function
prototypes. Remove redundant prototype of read_rtx().
* genattrtab.c: Likewise.
* gencodes.c: Likewise.
* genconfig.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* genflags.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genrecog.c: Likewise.
From-SVN: r18794
1998-03-24 11:16:53 +01:00
|
|
|
|
#include "system.h"
|
1991-10-24 18:21:48 +01:00
|
|
|
|
#include "rtl.h"
|
|
|
|
|
#include "obstack.h"
|
errors.c: New file...
1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.
* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o. Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o. Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.
* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c: Include errors.h. Don't
define or prototype fatal. Set progname at beginning of main.
* genoutput.c: Likewise, and don't define or prototype error
either.
From-SVN: r28925
1999-08-27 09:47:17 +02:00
|
|
|
|
#include "errors.h"
|
1992-04-18 22:23:49 +02:00
|
|
|
|
#include "insn-config.h"
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
static struct obstack obstack;
|
|
|
|
|
struct obstack *rtl_obstack = &obstack;
|
|
|
|
|
|
|
|
|
|
#define obstack_chunk_alloc xmalloc
|
|
|
|
|
#define obstack_chunk_free free
|
|
|
|
|
|
1993-09-06 20:42:55 +02:00
|
|
|
|
/* Names for patterns. Need to allow linking with print-rtl. */
|
|
|
|
|
char **insn_name_ptr;
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* This structure contains all the information needed to describe one
|
|
|
|
|
set of extractions methods. Each method may be used by more than
|
|
|
|
|
one pattern if the operands are in the same place.
|
|
|
|
|
|
|
|
|
|
The string for each operand describes that path to the operand and
|
|
|
|
|
contains `0' through `9' when going into an expression and `a' through
|
|
|
|
|
`z' when going into a vector. We assume here that only the first operand
|
|
|
|
|
of an rtl expression is a vector. genrecog.c makes the same assumption
|
|
|
|
|
(and uses the same representation) and it is currently true. */
|
|
|
|
|
|
|
|
|
|
struct extraction
|
|
|
|
|
{
|
|
|
|
|
int op_count;
|
|
|
|
|
char *oplocs[MAX_RECOG_OPERANDS];
|
|
|
|
|
int dup_count;
|
|
|
|
|
char *duplocs[MAX_DUP_OPERANDS];
|
|
|
|
|
int dupnums[MAX_DUP_OPERANDS];
|
|
|
|
|
struct code_ptr *insns;
|
|
|
|
|
struct extraction *next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Holds a single insn code that use an extraction method. */
|
|
|
|
|
|
|
|
|
|
struct code_ptr
|
|
|
|
|
{
|
|
|
|
|
int insn_code;
|
|
|
|
|
struct code_ptr *next;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct extraction *extractions;
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
/* Number instruction patterns handled, starting at 0 for first one. */
|
|
|
|
|
|
|
|
|
|
static int insn_code_number;
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Records the large operand number in this insn. */
|
|
|
|
|
|
|
|
|
|
static int op_count;
|
|
|
|
|
|
|
|
|
|
/* Records the location of any operands using the string format described
|
|
|
|
|
above. */
|
|
|
|
|
|
|
|
|
|
static char *oplocs[MAX_RECOG_OPERANDS];
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
/* Number the occurrences of MATCH_DUP in each instruction,
|
|
|
|
|
starting at 0 for the first occurrence. */
|
|
|
|
|
|
|
|
|
|
static int dup_count;
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Records the location of any MATCH_DUP operands. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
static char *duplocs[MAX_DUP_OPERANDS];
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Record the operand number of any MATCH_DUPs. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
static int dupnums[MAX_DUP_OPERANDS];
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Record the list of insn_codes for peepholes. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
static struct code_ptr *peepholes;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1998-04-17 01:56:12 +02:00
|
|
|
|
static void gen_insn PROTO ((rtx));
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 08:04:42 +01:00
|
|
|
|
static void walk_rtx PROTO ((rtx, const char *));
|
Cutover various gen*.c files to using system.h:
* Makefile.in (genconfig.o, genflags.o, gencodes.o, genemit.o,
genopinit.o, genrecog.o, genextract.o, genpeep.o, genattr.o,
genattrtab.o, genoutput.o): Depend on system.h.
* genattr.c: Include system.h. Add arguments to various function
prototypes. Remove redundant prototype of read_rtx().
* genattrtab.c: Likewise.
* gencodes.c: Likewise.
* genconfig.c: Likewise.
* genemit.c: Likewise.
* genextract.c: Likewise.
* genflags.c: Likewise.
* genopinit.c: Likewise.
* genoutput.c: Likewise.
* genpeep.c: Likewise.
* genrecog.c: Likewise.
From-SVN: r18794
1998-03-24 11:16:53 +01:00
|
|
|
|
static void print_path PROTO ((char *));
|
errors.c: New file...
1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.
* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o. Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o. Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.
* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c: Include errors.h. Don't
define or prototype fatal. Set progname at beginning of main.
* genoutput.c: Likewise, and don't define or prototype error
either.
From-SVN: r28925
1999-08-27 09:47:17 +02:00
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
static void
|
|
|
|
|
gen_insn (insn)
|
|
|
|
|
rtx insn;
|
|
|
|
|
{
|
|
|
|
|
register int i;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
register struct extraction *p;
|
|
|
|
|
register struct code_ptr *link;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
op_count = 0;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
dup_count = 0;
|
|
|
|
|
|
|
|
|
|
/* No operands seen so far in this pattern. */
|
1999-01-13 11:46:45 +01:00
|
|
|
|
memset (oplocs, 0, sizeof oplocs);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
/* Walk the insn's pattern, remembering at all times the path
|
|
|
|
|
down to the walking point. */
|
|
|
|
|
|
|
|
|
|
if (XVECLEN (insn, 1) == 1)
|
1992-04-18 22:23:49 +02:00
|
|
|
|
walk_rtx (XVECEXP (insn, 1, 0), "");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
else
|
|
|
|
|
for (i = XVECLEN (insn, 1) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
char *path = (char *) alloca (2);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
path[0] = 'a' + i;
|
|
|
|
|
path[1] = 0;
|
|
|
|
|
|
|
|
|
|
walk_rtx (XVECEXP (insn, 1, i), path);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
link = (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
|
|
|
|
|
link->insn_code = insn_code_number;
|
|
|
|
|
|
1996-07-04 00:07:53 +02:00
|
|
|
|
/* See if we find something that already had this extraction method. */
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
|
|
|
|
for (p = extractions; p; p = p->next)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
if (p->op_count != op_count || p->dup_count != dup_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < op_count; i++)
|
|
|
|
|
if (p->oplocs[i] != oplocs[i]
|
|
|
|
|
&& ! (p->oplocs[i] != 0 && oplocs[i] != 0
|
|
|
|
|
&& ! strcmp (p->oplocs[i], oplocs[i])))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i != op_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < dup_count; i++)
|
|
|
|
|
if (p->dupnums[i] != dupnums[i]
|
|
|
|
|
|| strcmp (p->duplocs[i], duplocs[i]))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i != dup_count)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* This extraction is the same as ours. Just link us in. */
|
|
|
|
|
link->next = p->insns;
|
|
|
|
|
p->insns = link;
|
|
|
|
|
return;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Otherwise, make a new extraction method. */
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
p = (struct extraction *) xmalloc (sizeof (struct extraction));
|
|
|
|
|
p->op_count = op_count;
|
|
|
|
|
p->dup_count = dup_count;
|
|
|
|
|
p->next = extractions;
|
|
|
|
|
extractions = p;
|
|
|
|
|
p->insns = link;
|
|
|
|
|
link->next = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < op_count; i++)
|
|
|
|
|
p->oplocs[i] = oplocs[i];
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < dup_count; i++)
|
|
|
|
|
p->dupnums[i] = dupnums[i], p->duplocs[i] = duplocs[i];
|
|
|
|
|
}
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
static void
|
|
|
|
|
walk_rtx (x, path)
|
|
|
|
|
rtx x;
|
genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattr.c (fatal): Qualify a char* with the `const' keyword.
* genattrtab.c (fatal, attr_printf, attr_string, write_attr_set,
write_unit_name, write_eligible_delay, expand_units,
make_length_attrs, write_attr_case, find_attr,
make_internal_attr): Likewise.
* gencheck.c (tree_codes): Likewise.
* gencodes.c (fatal): Likewise.
* genconfig.c (fatal): Likewise.
* genemit.c (fatal): Likewise.
* genextract.c (fatal, walk_rtx, copystr): Likewise.
* genflags.c (fatal): Likewise.
* genopinit.c (fatal, optabs, gen_insn): Likewise.
* genoutput.c (fatal, error, predicates): Likewise.
* genpeep.c (fatal): Likewise.
* genrecog.c (fatal, decision, pred_table, add_to_sequence,
write_tree_1, write_tree, change_state, copystr, indents): Likewise.
From-SVN: r24377
1998-12-19 08:04:42 +01:00
|
|
|
|
const char *path;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
|
|
|
|
register RTX_CODE code;
|
|
|
|
|
register int i;
|
|
|
|
|
register int len;
|
rtl.h (rtx_format): Constify a char*.
* rtl.h (rtx_format): Constify a char*.
* rtl.c (rtx_format): Likewise.
(copy_rtx, copy_most_rtx, read_rtx): Likewise.
(init_rtl): Use accessor macro, not `rtx_format'.
* alias.c (rtx_equal_for_memref_p, find_symbolic_term): Constify a
char*.
* caller-save.c (mark_referenced_regs): Likewise.
* combine.c (subst, make_compound_operation, known_cond,
gen_rtx_combine, update_table_tick, get_last_value_validate,
use_crosses_set_p, mark_used_regs_combine, move_deaths): Likewise.
* cse.c (rtx_cost, mention_regs, canon_hash, exp_equiv_p,
refers_to_p, canon_reg, fold_rtx, cse_process_notes,
count_reg_usage): Likewise.
* emit-rtl.c (gen_rtx, copy_rtx_if_shared, reset_used_flags):
Likewise.
* final.c (leaf_renumber_regs_insn): Likewise.
* flow.c (mark_used_regs, find_use_as_address, dump_flow_info,
dump_edge_info, count_reg_references): Likewise.
* function.c (fixup_var_refs_1, walk_fixup_memory_subreg,
fixup_stack_1, purge_addressof_1, instantiate_virtual_regs_1):
Likewise.
* gcse.c (oprs_unchanged_p, hash_expr_1, expr_equiv_p,
oprs_not_set_p, expr_killed_p, compute_transp, find_used_regs,
add_label_notes): Likewise.
* genattrtab.c (attr_rtx, attr_copy_rtx, encode_units_mask,
clear_struct_flag, count_sub_rtxs, count_alternatives,
compares_alternatives_p, contained_in_p, walk_attr_value,
write_expr_attr_cache): Likewise.
* genconfig.c (walk_insn_part): Likewise.
* genemit.c (max_operand_1, gen_exp): Likewise.
* genextract.c (walk_rtx): Likewise.
* genflags.c (num_operands): Likewise.
* genoutput.c (scan_operands): Likewise.
* genpeep.c (match_rtx): Likewise.
* genrecog.c (add_to_sequence): Likewise.
* haifa-sched.c (may_trap_exp, sched_analyze_2, attach_deaths):
Likewise.
* integrate.c (save_constants, copy_for_inline,
copy_rtx_and_substitute, subst_constants, restore_constants):
Likewise.
* jump.c (mark_jump_label, invert_exp, redirect_exp,
rtx_renumbered_equal_p, rtx_equal_for_thread_p): Likewise.
* local-alloc.c (contains_replace_regs, memref_referenced_p):
Likewise.
* loop.c (record_excess_regs, rtx_equal_for_loop_p,
add_label_notes, replace_call_address, count_nonfixed_reads,
invariant_p, find_single_use_in_loop, find_mem_givs,
find_life_end, maybe_eliminate_biv_1, update_reg_last_use):
Likewise.
* print-rtl.c (reg_names, print_rtx): Likewise.
* recog.c (validate_replace_rtx_1, find_single_use_1): Likewise.
* reg-stack.c (stack_regs_mentioned_p, record_label_references,
record_reg_life_pat, swap_rtx_condition, goto_block_pat,
print_blocks): Likewise.
* regclass.c (fix_register, record_address_regs,
reg_scan_mark_refs): Likewise.
* regmove.c (stable_but_for_p): Likewise.
* reload.c (loc_mentioned_in_p, operands_match_p,
find_reloads_toplevsubst_reg_equivs, find_reloads_address_1,
copy_replacements, refers_to_regno_for_reload_p,
refers_to_mem_for_reload_p, find_inc_amount, regno_clobbered_p,
reload_when_needed_name, reg_class_names, debug_reload_to_stream):
Likewise.
* reload1.c (eliminate_regs, scan_paradoxical_subregs,
delete_address_reloads_1, count_occurrences,
reload_cse_mem_conflict_p, reload_combine_note_use,
add_auto_inc_notes): Likewise.
* resource.c (mark_referenced_resources, mark_set_resources):
Likewise.
* rtlanal.c (rtx_unstable_p, rtx_varies_p, rtx_addr_varies_p,
reg_mentioned_p, regs_set_between_p, modified_between_p,
modified_in_p, refers_to_regno_p, reg_overlap_mentioned_p,
rtx_equal_p, volatile_insn_p, volatile_refs_p, side_effects_p,
may_trap_p, inequality_comparisons_p, replace_rtx, replace_regs,
jmp_uses_reg_or_mem, for_each_rtx, regno_use_in): Likewise.
* sched.c (sched_analyze_2, attach_deaths): Likewise.
* stupid.c (stupid_mark_refs): Likewise.
* unroll.c (remap_split_bivs): Likewise.
* varasm.c (mark_constants): Likewise.
* a29k/a29k.c (uses_local_reg_p): Likewise.
* alpha/alpha.c (summarize_insn): Likewise.
* arm/arm.c (symbol_mentioned_p, label_mentioned_p,
eliminate_lr2ip): Likewise.
* arm/thumb.c (symbol_mentioned_p, label_mentioned_p): Likewise.
* i386/i386.c (symbolic_reference_mentioned_p, copy_all_rtx,
reg_mentioned_in_mem): Likewise.
* ns32k/ns32k.c (global_symbolic_reference_mentioned_p,
symbolic_reference_mentioned_p): Likewise.
* romp/romp.c (unsigned_comparisons_p, hash_rtx): Likewise.
* sh/sh.c (regs_used, mark_use): Likewise.
* vax/vax.c (vax_rtx_cost): Likewise.
From-SVN: r28784
1999-08-21 01:05:25 +02:00
|
|
|
|
register const char *fmt;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
int depth = strlen (path);
|
|
|
|
|
char *newpath;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
if (x == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
code = GET_CODE (x);
|
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
|
|
|
|
case PC:
|
|
|
|
|
case CC0:
|
|
|
|
|
case CONST_INT:
|
|
|
|
|
case SYMBOL_REF:
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case MATCH_OPERAND:
|
|
|
|
|
case MATCH_SCRATCH:
|
1999-01-13 11:46:45 +01:00
|
|
|
|
oplocs[XINT (x, 0)] = xstrdup (path);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
op_count = MAX (op_count, XINT (x, 0) + 1);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MATCH_DUP:
|
1992-08-14 20:43:01 +02:00
|
|
|
|
case MATCH_PAR_DUP:
|
1999-01-13 11:46:45 +01:00
|
|
|
|
duplocs[dup_count] = xstrdup (path);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
dupnums[dup_count] = XINT (x, 0);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
dup_count++;
|
|
|
|
|
break;
|
|
|
|
|
|
1993-09-06 20:42:55 +02:00
|
|
|
|
case MATCH_OP_DUP:
|
1999-01-13 11:46:45 +01:00
|
|
|
|
duplocs[dup_count] = xstrdup (path);
|
1993-09-06 20:42:55 +02:00
|
|
|
|
dupnums[dup_count] = XINT (x, 0);
|
|
|
|
|
dup_count++;
|
|
|
|
|
|
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
|
|
|
|
for (i = XVECLEN (x, 1) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
newpath[depth] = '0' + i;
|
|
|
|
|
walk_rtx (XVECEXP (x, 1, i), newpath);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
case MATCH_OPERATOR:
|
1999-01-13 11:46:45 +01:00
|
|
|
|
oplocs[XINT (x, 0)] = xstrdup (path);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
op_count = MAX (op_count, XINT (x, 0) + 1);
|
|
|
|
|
|
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
newpath[depth] = '0' + i;
|
|
|
|
|
walk_rtx (XVECEXP (x, 2, i), newpath);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case MATCH_PARALLEL:
|
1999-01-13 11:46:45 +01:00
|
|
|
|
oplocs[XINT (x, 0)] = xstrdup (path);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
op_count = MAX (op_count, XINT (x, 0) + 1);
|
|
|
|
|
|
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
for (i = XVECLEN (x, 2) - 1; i >= 0; i--)
|
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
newpath[depth] = 'a' + i;
|
|
|
|
|
walk_rtx (XVECEXP (x, 2, i), newpath);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case ADDRESS:
|
|
|
|
|
walk_rtx (XEXP (x, 0), path);
|
|
|
|
|
return;
|
c-common.c: Include <stdlib.h> and <string.h>/<strings.h>.
* c-common.c: Include <stdlib.h> and <string.h>/<strings.h>.
* calls.c (expand_call): Remove unused variables funtree,
n_regs, and tmpmode.
* dbxout.c, except.c: Include <string.h>/<strings.h>.
* explow.c: (plus_constant_for_output_wide) Removed unused
variable all_constant.
* c-decl.c, genattr.c, genattrtab.c, getconfig.c, genemit.c
genextract.c, genflags.c, genopinit.c genoutput.c, genpeep.c,
genrecog.c, global.c, integrate.c , stupid.c : Include
<stdlib.h>.
* genextract.c: (walk_rtx) Remove unused variable link.
* genrecog.c: (concat) Remove unreferenced static function.
* prefix.c: Include <string.h>/<strings.h>, <stdlib.h>
* stmt.c: Include <stdlib.h>.
(expand_asm_operands): Remove unused variable val1.
(expand_return): Remove unused variable block.
(pushcase): Remove unused variables l and n.
(pushcaserange): Likewise.
* unroll.c (unroll_loop): Remove unused variable temp.
From-SVN: r17766
1998-02-07 23:55:54 +01:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
newpath = (char *) alloca (depth + 2);
|
|
|
|
|
strcpy (newpath, path);
|
|
|
|
|
newpath[depth + 1] = 0;
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
fmt = GET_RTX_FORMAT (code);
|
|
|
|
|
len = GET_RTX_LENGTH (code);
|
|
|
|
|
for (i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
if (fmt[i] == 'e' || fmt[i] == 'u')
|
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
newpath[depth] = '0' + i;
|
|
|
|
|
walk_rtx (XEXP (x, i), newpath);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
else if (fmt[i] == 'E')
|
|
|
|
|
{
|
|
|
|
|
int j;
|
|
|
|
|
for (j = XVECLEN (x, i) - 1; j >= 0; j--)
|
|
|
|
|
{
|
1992-04-20 00:27:26 +02:00
|
|
|
|
newpath[depth] = 'a' + j;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
walk_rtx (XVECEXP (x, i, j), newpath);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Given a PATH, representing a path down the instruction's
|
|
|
|
|
pattern from the root to a certain point, output code to
|
|
|
|
|
evaluate to the rtx at that point. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
print_path (path)
|
1992-04-18 22:23:49 +02:00
|
|
|
|
char *path;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
register int len = strlen (path);
|
|
|
|
|
register int i;
|
|
|
|
|
|
1998-05-22 05:44:58 +02:00
|
|
|
|
if (len == 0)
|
|
|
|
|
{
|
|
|
|
|
/* Don't emit "pat", since we may try to take the address of it,
|
|
|
|
|
which isn't what is intended. */
|
|
|
|
|
printf("PATTERN (insn)");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* We first write out the operations (XEXP or XVECEXP) in reverse
|
|
|
|
|
order, then write "insn", then the indices in forward order. */
|
|
|
|
|
|
|
|
|
|
for (i = len - 1; i >=0 ; i--)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
if (path[i] >= 'a' && path[i] <= 'z')
|
|
|
|
|
printf ("XVECEXP (");
|
|
|
|
|
else if (path[i] >= '0' && path[i] <= '9')
|
|
|
|
|
printf ("XEXP (");
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
1992-05-04 16:04:43 +02:00
|
|
|
|
printf ("pat");
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
if (path[i] >= 'a' && path[i] <= 'z')
|
|
|
|
|
printf (", 0, %d)", path[i] - 'a');
|
|
|
|
|
else if (path[i] >= '0' && path[i] <= '9')
|
|
|
|
|
printf (", %d)", path[i] - '0');
|
|
|
|
|
else
|
|
|
|
|
abort ();
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-27 11:09:17 +01:00
|
|
|
|
PTR
|
1991-10-24 18:21:48 +01:00
|
|
|
|
xmalloc (size)
|
1998-11-27 11:09:17 +01:00
|
|
|
|
size_t size;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1998-11-27 11:09:17 +01:00
|
|
|
|
register PTR val = (PTR) malloc (size);
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
if (val == 0)
|
|
|
|
|
fatal ("virtual memory exhausted");
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
1998-11-27 11:09:17 +01:00
|
|
|
|
PTR
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 18:47:36 +01:00
|
|
|
|
xrealloc (old, size)
|
|
|
|
|
PTR old;
|
1998-11-27 11:09:17 +01:00
|
|
|
|
size_t size;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 18:47:36 +01:00
|
|
|
|
register PTR ptr;
|
cppp.c (xrealloc): Fix typo last change.
* cppp.c (xrealloc): Fix typo last change.
* cppalloc.c, gcc.c, genattr.c, genattrtab.c, gencodes.c: Likewise.
* genconfig.c, genemit.c, genextract.c, genflags.c: Likewise.
* genopinit.c, genoutput.c, genpeep.c, genrecog.c: Likewise.
From-SVN: r24823
1999-01-22 12:52:05 +01:00
|
|
|
|
if (old)
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 18:47:36 +01:00
|
|
|
|
ptr = (PTR) realloc (old, size);
|
|
|
|
|
else
|
|
|
|
|
ptr = (PTR) malloc (size);
|
|
|
|
|
if (!ptr)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
fatal ("virtual memory exhausted");
|
cccp.c (xrealloc): Call malloc given a NULL old pointer.
* cccp.c (xrealloc): Call malloc given a NULL old pointer.
* collect2.c, cppalloc.c, gcc.c, genattr.c, genattrtab.c: Likewise.
* gencodes.c, genconfig.c, genemit.c, genextract.c: Likewise.
* genflags.c, genopinit.c, genoutput.c, genpeep.c: Likewise.
* genrecog.c, mips-tfile.c, protoize.c: Likewise.
From-SVN: r24806
1999-01-21 18:47:36 +01:00
|
|
|
|
return ptr;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
1999-01-13 11:46:45 +01:00
|
|
|
|
char *
|
1999-01-13 12:49:34 +01:00
|
|
|
|
xstrdup (input)
|
1999-01-13 11:46:45 +01:00
|
|
|
|
const char *input;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
{
|
1999-01-13 11:46:45 +01:00
|
|
|
|
register size_t len = strlen (input) + 1;
|
|
|
|
|
register char *output = xmalloc (len);
|
|
|
|
|
memcpy (output, input, len);
|
|
|
|
|
return output;
|
1992-03-07 10:41:00 +01:00
|
|
|
|
}
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
main (argc, argv)
|
|
|
|
|
int argc;
|
|
|
|
|
char **argv;
|
|
|
|
|
{
|
|
|
|
|
rtx desc;
|
|
|
|
|
FILE *infile;
|
|
|
|
|
register int c, i;
|
1992-04-18 22:23:49 +02:00
|
|
|
|
struct extraction *p;
|
|
|
|
|
struct code_ptr *link;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
errors.c: New file...
1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.
* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o. Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o. Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.
* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c: Include errors.h. Don't
define or prototype fatal. Set progname at beginning of main.
* genoutput.c: Likewise, and don't define or prototype error
either.
From-SVN: r28925
1999-08-27 09:47:17 +02:00
|
|
|
|
progname = "genextract";
|
1991-10-24 18:21:48 +01:00
|
|
|
|
obstack_init (rtl_obstack);
|
|
|
|
|
|
|
|
|
|
if (argc <= 1)
|
|
|
|
|
fatal ("No input file name.");
|
|
|
|
|
|
|
|
|
|
infile = fopen (argv[1], "r");
|
|
|
|
|
if (infile == 0)
|
|
|
|
|
{
|
|
|
|
|
perror (argv[1]);
|
|
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Assign sequential codes to all entries in the machine description
|
|
|
|
|
in parallel with the tables in insn-output.c. */
|
|
|
|
|
|
|
|
|
|
insn_code_number = 0;
|
|
|
|
|
|
|
|
|
|
printf ("/* Generated automatically by the program `genextract'\n\
|
|
|
|
|
from the machine description file `md'. */\n\n");
|
|
|
|
|
|
|
|
|
|
printf ("#include \"config.h\"\n");
|
1998-04-02 00:44:48 +02:00
|
|
|
|
printf ("#include \"system.h\"\n");
|
Makefile.in (toplev.o): Depend on $(EXPR_H).
* Makefile.in (toplev.o): Depend on $(EXPR_H).
(insn-extract.o, insn-attrtab.o): Depend on toplev.h.
* gansidecl.h: Define ATTRIBUTE_NORETURN.
* genattrtab.c: Have insn-attrtab.c include toplev.h.
* genextract.c: Have insn-extract.c include toplev.h.
* rtl.h: Don't prototype `fatal_insn_not_found' and `fatal_insn'.
* toplev.c: Include expr.h.
(really_sorry, fancy_abort): Remove prototypes.
(set_target_switch): Add argument in prototype.
(vfatal): Mark prototype with ATTRIBUTE_NORETURN.
(v_really_sorry): Likewise.
(print_version, print_single_switch, print_switch_values): Make
static and add prototype arguments.
(decl_printable_name): Add prototype arguments.
(lang_expand_expr_t): New typedef.
(lang_expand_expr): Declare as a lang_expand_expr_t.
(incomplete_decl_finalize_hook): Add prototype argument.
(decl_name): Mark variable `verbosity' with ATTRIBUTE_UNUSED.
(botch): Likewise for variable `s'.
(rest_of_type_compilation): Mark variables `type' and `toplev'
with ATTRIBUTE_UNUSED if none of DBX_DEBUGGING_INFO,
XCOFF_DEBUGGING_INFO or SDB_DEBUGGING_INFO are defined.
(display_help): Make variable `i' an `unsigned long'.
(main): Remove unused parameter `envp'.
Cast assignment to `lang_expand_expr' to a `lang_expand_expr_t'.
Cast -1 when comparing it with a `size_t'.
* toplev.h (fatal, fatal_io_error, pfatal_with_name): Mark
prototype with ATTRIBUTE_NORETURN.
(fatal_insn_not_found, fatal_insn, really_sorry,
push_float_handler, pop_float_handler): Add prototypes.
(fancy_abort): Mark prototype with ATTRIBUTE_NORETURN.
(do_abort, botch): Add prototypes.
From-SVN: r22293
1998-09-06 07:56:20 +02:00
|
|
|
|
printf ("#include \"rtl.h\"\n");
|
Makefile.in (insn-extract.o): Fix dependencies.
* Makefile.in (insn-extract.o): Fix dependencies.
* genextract.c (main): Generate includes for insn-config.h and
recog.h.
Delete generation of declarations which are now in recog.h.
* genrecog.c (main): Delete generation of definitions which are
now in recog.c.
* local-alloc.c (block_alloc): Use extract_insn and the variables
it sets up instead of looking up values by insn_code.
* recog.c (recog_operand, recog_operand_loc, recog_dup_loc,
recog_dup_num): Define here instead of generating the definition in
genrecog.c.
(recog_n_operands, recog_n_dups, recog_n_alternatives,
recog_operand_mode, recog_constraints, recog_operand_address_p):
New variables.
(extract_insn): New function.
* recog.h (extract_insn): Declare function.
(which_alternative, recog_n_operands, recog_n_dups,
recog_n_alternatives, recog_operand_mode, recog_constraints,
recog_operand_address_p): Declare variables.
* regclass.c (n_occurrences): New static function.
* reload.c (n_occurrences): Delete function.
(find_reloads): Use extract_insn.
* reload.h (n_occurrences): Delete declaration.
From-SVN: r23147
1998-10-17 03:28:57 +02:00
|
|
|
|
printf ("#include \"insn-config.h\"\n");
|
|
|
|
|
printf ("#include \"recog.h\"\n");
|
Makefile.in (toplev.o): Depend on $(EXPR_H).
* Makefile.in (toplev.o): Depend on $(EXPR_H).
(insn-extract.o, insn-attrtab.o): Depend on toplev.h.
* gansidecl.h: Define ATTRIBUTE_NORETURN.
* genattrtab.c: Have insn-attrtab.c include toplev.h.
* genextract.c: Have insn-extract.c include toplev.h.
* rtl.h: Don't prototype `fatal_insn_not_found' and `fatal_insn'.
* toplev.c: Include expr.h.
(really_sorry, fancy_abort): Remove prototypes.
(set_target_switch): Add argument in prototype.
(vfatal): Mark prototype with ATTRIBUTE_NORETURN.
(v_really_sorry): Likewise.
(print_version, print_single_switch, print_switch_values): Make
static and add prototype arguments.
(decl_printable_name): Add prototype arguments.
(lang_expand_expr_t): New typedef.
(lang_expand_expr): Declare as a lang_expand_expr_t.
(incomplete_decl_finalize_hook): Add prototype argument.
(decl_name): Mark variable `verbosity' with ATTRIBUTE_UNUSED.
(botch): Likewise for variable `s'.
(rest_of_type_compilation): Mark variables `type' and `toplev'
with ATTRIBUTE_UNUSED if none of DBX_DEBUGGING_INFO,
XCOFF_DEBUGGING_INFO or SDB_DEBUGGING_INFO are defined.
(display_help): Make variable `i' an `unsigned long'.
(main): Remove unused parameter `envp'.
Cast assignment to `lang_expand_expr' to a `lang_expand_expr_t'.
Cast -1 when comparing it with a `size_t'.
* toplev.h (fatal, fatal_io_error, pfatal_with_name): Mark
prototype with ATTRIBUTE_NORETURN.
(fatal_insn_not_found, fatal_insn, really_sorry,
push_float_handler, pop_float_handler): Add prototypes.
(fancy_abort): Mark prototype with ATTRIBUTE_NORETURN.
(do_abort, botch): Add prototypes.
From-SVN: r22293
1998-09-06 07:56:20 +02:00
|
|
|
|
printf ("#include \"toplev.h\"\n\n");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
/* This variable exists only so it can be the "location"
|
|
|
|
|
of any missing operand whose numbers are skipped by a given pattern. */
|
Warning fixes:
* Makefile.in (c-lang.o): Depend on c-tree.h, c-lex.h and toplev.h.
(c-lex.o): Depend on output.h.
(c-common.o): Likewise.
(stmt.o): Likewise.
(calls.o): Likewise.
(integrate.o): Depend on toplev.h.
(regclass.o): Depend on output.h.
(final.o): Depend on reload.h.
* c-common.c: Include output.h.
(check_format_info): Remove unused variable `integral_format'.
* c-decl.c (print_lang_decl): Mark parameters `file', `node' and
`indent' with ATTRIBUTE_UNUSED.
(print_lang_type): Likewise.
(maybe_build_cleanup): Likewise for parameter `decl'.
(copy_lang_decl): Likewise for parameter `node'.
* c-lang.c: Include c-tree.h, c-lex.h and toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(lookup_interface): Likewise for parameter `arg'.
(is_class_name): Likewise.
(maybe_objc_check_decl): Likewise for parameter `decl'.
(maybe_objc_comptypes): Likewise for parameters `lhs', `rhs' and
`reflexive'.
(maybe_objc_method_name): Likewise for parameter `decl'.
(build_objc_string): Likewise for parameters `len' and `str'.
* c-lex.c: Include output.h.
* c-lex.h (position_after_white_space): Correct typo in prototype.
* c-tree.h (finish_file, c_expand_start_cond, c_expand_start_else,
c_expand_end_cond, init_iterators): Add prototypes.
* caller-save.c (set_reg_live): Mark parameters `reg' and `setter'
with ATTRIBUTE_UNUSED.
* calls.c: Include output.h.
* cccp.c (pipe_closed): Mark parameter `signo' with
ATTRIBUTE_UNUSED.
* combine.c: Move inclusion of expr.h to after insn-config.h.
* iris6.h (ASM_IDENTIFY_GCC, ASM_IDENTIFY_LANGUAGE): Don't define
as empty, rather define as ((void)0).
* sparc.c (sparc_check_64): Add braces around ambiguous `else'.
Add parentheses around assignment used as truth value.
* cplus-dem.c (squangle_mop_up): Change return type to void.
(internal_cplus_demangle): Remove unused parameter `options'.
All callers changed.
(cplus_demangle_opname): Remove function wide variable `int i' and
replace with `size_t i' at each location where it is used.
(cplus_demangle_opname): change type of `i' from int to size_t.
* cppexp.c (right_shift): Mark parameter `pfile' with
ATTRIBUTE_UNUSED.
* cpphash.c (cpp_lookup): Likewise.
(cpp_hash_cleanup): Likewise.
* cpplib.c (parse_name): Add a prototype and make it static.
(null_underflow): Mark parameter `pfile' with ATTRIBUTE_UNUSED.
(null_cleanup): Likewise for parameters `pbuf' and `pfile'.
(macro_cleanup): Likewise for parameter `pfile'.
(file_cleanup): Likewise.
* cpplib.h (cpp_reader_init, cpp_options_init, cpp_start_read,
cpp_read_check_assertion, skip_rest_of_line): Add prototypes.
* crtstuff.c (force_to_data, __CTOR_LIST__, force_to_data,
__DTOR_END__, __FRAME_END__): Mark with ATTRIBUTE_UNUSED.
* cse.c (cse_check_loop_start): Mark parameter `set' with
ATTRIBUTE_UNUSED.
* dbxout.c (flag_minimal_debug, have_used_extensions,
source_label_number): Move inside macro wrapper check against
defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO).
* dwarf2out.c (gen_entry_point_die): Hide prototype and definition.
* except.h (doing_eh): Provide prototype.
* expr.c: Move inclusion of expr.h to after insn-config.h.
* final.c: Include reload.h.
(shorten_branches): Cast the first argument of bzero to char *.
* fix-header.c (cpp_print_containing_files): Mark parameter
`pfile' with ATTRIBUTE_UNUSED.
(cpp_fatal): Likewise.
* flow.c (find_basic_blocks_1): Cast the first argument of bzero
to char *.
* genattrtab.c (make_length_attrs): Change the type of variable
`i' from int to size_t.
(zero_fn): Mark parameter `exp' with ATTRIBUTE_UNUSED.
(one_fn): Likewise.
* genextract.c (main): When generating insn-extract.c, mark
variable `junk' with ATTRIBUTE_UNUSED.
* gengenrtl.c (gencode): When generating genrtl.c, cast the first
argument of bzero to char*.
* integrate.c: Include toplev.h.
* libgcc2.c: Wrap `struct exception_table' and
`find_exception_handler' in macro DWARF2_UNWIND_INFO.
* objc/Make-lang.in (objc-act.o): Depend on toplev.h.
* objc/objc-act.c: Include toplev.h.
(lang_print_xnode): Mark parameters `file', `node' and `indent'
with ATTRIBUTE_UNUSED.
(finish_protocol): Likewise for parameter `protocol'.
* output.h (declare_weak): Add prototype.
(decode_reg_name): Don't wrap with TREE_CODE macro.
(assemble_alias): Add prototype.
* regclass.c: Include output.h.
* reload.h (reloads_conflict): Add prototype.
* rtl.h (print_rtl_single, mark_elimiation, reg_class_subset_p,
output_func_start_profiler): Add prototypes.
* rtlanal.c (reg_set_p_1): Mark parameters `x' and `pat' with
ATTRIBUTE_UNUSED.
* scan-decls.c: Include scan.h.
* scan.h (recognized_function, recognized_extern): Add prototypes.
* stmt.c: Include output.h.
* toplev.c (error_for_asm, warning_for_asm): Remove prototypes.
(output_lang_identify): Hide prototype and definition.
(float_signal): Mark parameter `signo' with ATTRIBUTE_UNUSED.
(pipe_closed): Likewise.
* toplev.h (count_error, strip_off_ending, error_for_asm,
warning_for_asm): Add prototypes.
From-SVN: r19712
1998-05-13 14:40:39 +02:00
|
|
|
|
printf ("static rtx junk ATTRIBUTE_UNUSED;\n");
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
printf ("void\ninsn_extract (insn)\n");
|
|
|
|
|
printf (" rtx insn;\n");
|
|
|
|
|
printf ("{\n");
|
1992-04-11 20:17:54 +02:00
|
|
|
|
printf (" register rtx *ro = recog_operand;\n");
|
|
|
|
|
printf (" register rtx **ro_loc = recog_operand_loc;\n");
|
1992-05-04 16:04:43 +02:00
|
|
|
|
printf (" rtx pat = PATTERN (insn);\n");
|
1998-06-22 07:23:33 +02:00
|
|
|
|
printf (" int i ATTRIBUTE_UNUSED;\n\n");
|
1999-02-26 17:00:08 +01:00
|
|
|
|
printf (" memset (ro, 0, sizeof (*ro) * MAX_RECOG_OPERANDS);\n");
|
|
|
|
|
printf (" memset (ro_loc, 0, sizeof (*ro_loc) * MAX_RECOG_OPERANDS);\n");
|
1992-05-04 16:04:43 +02:00
|
|
|
|
printf (" switch (INSN_CODE (insn))\n");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
printf (" {\n");
|
1992-04-18 22:23:49 +02:00
|
|
|
|
printf (" case -1:\n");
|
|
|
|
|
printf (" fatal_insn_not_found (insn);\n\n");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
|
|
|
|
/* Read the machine description. */
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
c = read_skip_spaces (infile);
|
|
|
|
|
if (c == EOF)
|
|
|
|
|
break;
|
|
|
|
|
ungetc (c, infile);
|
|
|
|
|
|
|
|
|
|
desc = read_rtx (infile);
|
|
|
|
|
if (GET_CODE (desc) == DEFINE_INSN)
|
|
|
|
|
{
|
|
|
|
|
gen_insn (desc);
|
|
|
|
|
++insn_code_number;
|
|
|
|
|
}
|
1992-04-18 22:23:49 +02:00
|
|
|
|
|
|
|
|
|
else if (GET_CODE (desc) == DEFINE_PEEPHOLE)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
struct code_ptr *link
|
|
|
|
|
= (struct code_ptr *) xmalloc (sizeof (struct code_ptr));
|
|
|
|
|
|
|
|
|
|
link->insn_code = insn_code_number;
|
|
|
|
|
link->next = peepholes;
|
|
|
|
|
peepholes = link;
|
1991-10-24 18:21:48 +01:00
|
|
|
|
++insn_code_number;
|
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
else if (GET_CODE (desc) == DEFINE_EXPAND
|
|
|
|
|
|| GET_CODE (desc) == DEFINE_SPLIT)
|
|
|
|
|
++insn_code_number;
|
|
|
|
|
}
|
1991-10-24 18:21:48 +01:00
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* Write out code to handle peepholes and the insn_codes that it should
|
|
|
|
|
be called for. */
|
|
|
|
|
if (peepholes)
|
1991-10-24 18:21:48 +01:00
|
|
|
|
{
|
1992-04-18 22:23:49 +02:00
|
|
|
|
for (link = peepholes; link; link = link->next)
|
|
|
|
|
printf (" case %d:\n", link->insn_code);
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
/* The vector in the insn says how many operands it has.
|
|
|
|
|
And all it contains are operands. In fact, the vector was
|
|
|
|
|
created just for the sake of this function. */
|
1998-02-13 12:17:14 +01:00
|
|
|
|
printf (" for (i = XVECLEN (pat, 0) - 1; i >= 0; i--)\n");
|
1996-11-15 20:12:54 +01:00
|
|
|
|
printf (" ro[i] = XVECEXP (pat, 0, i);\n");
|
1992-04-18 22:23:49 +02:00
|
|
|
|
printf (" break;\n\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Write out all the ways to extract insn operands. */
|
|
|
|
|
for (p = extractions; p; p = p->next)
|
|
|
|
|
{
|
|
|
|
|
for (link = p->insns; link; link = link->next)
|
|
|
|
|
printf (" case %d:\n", link->insn_code);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < p->op_count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (p->oplocs[i] == 0)
|
|
|
|
|
{
|
|
|
|
|
printf (" ro[%d] = const0_rtx;\n", i);
|
1993-04-13 23:19:54 +02:00
|
|
|
|
printf (" ro_loc[%d] = &junk;\n", i);
|
1992-04-18 22:23:49 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
printf (" ro[%d] = *(ro_loc[%d] = &", i, i);
|
|
|
|
|
print_path (p->oplocs[i]);
|
|
|
|
|
printf (");\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < p->dup_count; i++)
|
|
|
|
|
{
|
|
|
|
|
printf (" recog_dup_loc[%d] = &", i);
|
|
|
|
|
print_path (p->duplocs[i]);
|
|
|
|
|
printf (";\n");
|
|
|
|
|
printf (" recog_dup_num[%d] = %d;\n", i, p->dupnums[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf (" break;\n\n");
|
1991-10-24 18:21:48 +01:00
|
|
|
|
}
|
|
|
|
|
|
1992-04-18 22:23:49 +02:00
|
|
|
|
/* This should never be reached. Note that we would also reach this abort
|
|
|
|
|
if we tried to extract something whose INSN_CODE was a DEFINE_EXPAND or
|
|
|
|
|
DEFINE_SPLIT, but that is correct. */
|
|
|
|
|
printf (" default:\n abort ();\n");
|
|
|
|
|
|
1991-10-24 18:21:48 +01:00
|
|
|
|
printf (" }\n}\n");
|
|
|
|
|
|
|
|
|
|
fflush (stdout);
|
|
|
|
|
exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
|
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|