1998-01-08 16:17:05 -05:00
|
|
|
/* Generate code to allocate RTL structures.
|
1999-04-01 12:06:09 -05:00
|
|
|
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
1998-01-08 16:17:05 -05: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
|
|
|
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
|
|
#include "hconfig.h"
|
More cutover to system.h:
* Makefile.in (cppalloc.o, cpperror.o, cppexp.o, cpphash.o,
cpplib.o, cppmain.o, fix-header.o, gcov.o, gen-protos.o,
gengenrtl.o, halfpic.o, hash.o, scan-decls.o, scan.o): Depend on
system.h.
* cpphash.c: Include config.h.
* cppalloc.c: Include system.h. Add parameters to various
function prototypes.
* cpperror.c: Likewise.
* cppexp.c: Likewise.
* cpphash.c: Likewise.
* cpplib.c: Likewise.
* cppmain.c: Likewise.
* fix-header.c: Likewise.
* gcov.c: Likewise.
* gen-protos.c: Likewise.
* gengenrtl.c: Likewise.
* halfpic.c: Likewise.
* hash.c: Likewise.
* scan-decls.c: Likewise.
* scan.c: Likewise.
From-SVN: r18911
1998-03-30 07:05:54 -05:00
|
|
|
#include "system.h"
|
system.h: Always prototype abort.
1999-04-16 22:44 -0400 Zack Weinberg <zack@rabi.columbia.edu>
* system.h: Always prototype abort. Prototype fatal. Define
abort to call fatal, not fprintf/exit. Define a stub macro
for trim_filename.
* toplev.c: Define DIR_SEPARATOR. (trim_filename): New
function.
* toplev.h: Prototype trim_filename, and #undef system.h's stub.
* gcc.c, genattr.c, genattrtab.c, gencodes.c, genconfig.c,
genemit.c, genextract.c, genflags.c, genopinit.c, genoutput.c,
genpeep.c, genrecog.c: Make fatal non-static.
* gcov.c, gengenrtl.c, protoize.c: #undef abort after
including system.h.
* config/i386/dgux.h, config/m68k/xm-amix.h: Remove stale code
relating to abort.
From-SVN: r26511
1999-04-16 15:52:44 -04:00
|
|
|
#undef abort
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
#define NO_GENRTL_H
|
|
|
|
#include "rtl.h"
|
|
|
|
|
|
|
|
|
|
|
|
struct rtx_definition
|
|
|
|
{
|
|
|
|
const char *enumname, *name, *format;
|
|
|
|
};
|
|
|
|
|
1998-05-12 03:36:02 -04:00
|
|
|
#define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) { STRINGIFY(ENUM), NAME, FORMAT },
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
struct rtx_definition defs[] =
|
|
|
|
{
|
|
|
|
#include "rtl.def" /* rtl expressions are documented here */
|
|
|
|
};
|
|
|
|
|
|
|
|
const char *formats[NUM_RTX_CODE];
|
|
|
|
|
1998-05-21 02:29:55 -04:00
|
|
|
static const char *type_from_format PROTO((int));
|
|
|
|
static const char *accessor_from_format PROTO((int));
|
c-lex.c (is_class_name): Delete declaration.
* c-lex.c (is_class_name): Delete declaration.
(whitespace_cr): Make static and add prototype.
* c-lex.h (make_pointer_declarator, reinit_parse_for_function,
yylex, get_directive_line): Turn declarations into prototypes.
(position_after_whitespace, check_newline, yyerror,, is_class_name,
forget_protocol_qualifiers, remember_protocol_qualifiers): Add
prototypes.
* genattr.c (extend_range, write_upcase, gen_attr, write_units): Add
prototypes.
* gencodes.c (gen_insn): Add prototype.
* genconfig.c (walk_insn, gen_insn, gen_expand, gen_split,
gen_peephole): Add prototypes.
* genflags.c (num_operands, gen_proto, gen_nonproto, gen_insn): Add
prototypes.
* gengenrtl.c (type_from_format, accessor_from_format, special_rtx,
special_format, find_formats, gendecl, genmacro, gendef, genlegend,
genheader, gencode): Add prototypes.
* genopinit.c (gen_insn): Add prototype.
* genoutput.c (output_prologue, output_epilogue, scan_operands,
process_template, validate_insn_alternatives, gen_insn, gen_peephole,
gen_expand, gen_split, n_occurrences): Add prototypes.
* genpeep.c (gen_peephole): Add prototype.
* loop.c (find_and_verify_loops, mark_loop_jump, prescan_loop,
reg_in_basic_block_p, consec_sets_invariant_p, libcall_other_reg,
labels_in_range_p, count_loop_regs_set, note_addr_stored,
loop_reg_used_before_p, scan_loop, replace_call_address,
skip_consec_insns, libcall_benefit, ignore_some_movables,
force_movables, combine_movables, rtx_equal_for_loop_p, move_movables,
strength_reduce, valid_initial_value_p, find_mem_givs, record_biv,
check_final_value, record_giv, update_giv_derive, basic_induction_var,
simplify_giv_expr, general_induction_var, consec_sets_giv,
check_dbra_loop, express_from, combine_givs_p, combine_givs,
product_cheap_p, maybe_eliminate_biv, maybe_eliminate_biv_1,
last_use_this_basic_block, record_initial, update_reg_last_use,
iteration_info, analyze_loop_iterations, insert_bct,
instrument_loop_bct, indirect_jump_in_function_p): Turn declarations
into prototypes.
From-SVN: r19038
1998-04-07 19:47:11 -04:00
|
|
|
static int special_format PROTO((const char *));
|
|
|
|
static int special_rtx PROTO((int));
|
|
|
|
static void find_formats PROTO((void));
|
|
|
|
static void gendecl PROTO((FILE *, const char *));
|
|
|
|
static void genmacro PROTO((FILE *, int));
|
|
|
|
static void gendef PROTO((FILE *, const char *));
|
|
|
|
static void genlegend PROTO((FILE *));
|
|
|
|
static void genheader PROTO((FILE *));
|
|
|
|
static void gencode PROTO((FILE *));
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Decode a format letter into a C type string. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static const char *
|
1998-01-17 15:09:09 -05:00
|
|
|
type_from_format (c)
|
1998-05-21 02:29:55 -04:00
|
|
|
int c;
|
1998-01-08 16:17:05 -05:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case 'i':
|
|
|
|
return "int";
|
|
|
|
case 'w':
|
|
|
|
return "HOST_WIDE_INT";
|
|
|
|
case 's':
|
|
|
|
return "char *";
|
|
|
|
case 'e':
|
|
|
|
case 'u':
|
|
|
|
return "rtx";
|
|
|
|
case 'E':
|
|
|
|
return "rtvec";
|
Makefile.in (HOST_RTL): Add $(HOST_PREFIX)bitmap.o.
* Makefile.in (HOST_RTL): Add $(HOST_PREFIX)bitmap.o.
(rtl.o, emit-rtl.o): Add dependency on bitmap.h.
($(HOST_PREFIX_1)rtl.o): Likewise.
($(HOST_PREFIX_1)bitmap.o): New host object.
* emit-rtl.c (toplevel): Include bitmap.h.
(gen_rtx): Handle 't' and 'b' nodes.
* print-rtl.c (print_rtx): Handle printing NOTE_INSN_LIVE notes.
Print block number for block begin/end notes. Print 't' type
nodes as a pointer. Know that the 3rd argument of live range
start/stop notes is really a range_info rtx. If type is 'b', print
out argument as a bitmap.
* rtl.c: Include bitmap.c.
(copy_rtx): Copy tree nodes as is. Copy bitmaps if type is 'b'.
(note_insn_name): Add NOTE_INSN_RANGE_{START,END}, NOTE_INSN_LIVE.
* rtl.def (RANGE_LIVE): New node to hold live information while we
recalculate the basic blocks.
(RANGE_REG, RANGE_INFO): New rtl types for live range splitting.
(RANGE_VAR): New node, to hold information saved in symbol node for New
communicating live range information to the debug output functions.
* rtl.h (rtunion_def): Add rttree and rtbit fields.
(XBITMAP, XTREE): New accessor macros.
(NOTE_LIVE_INFO): Overload NOTE_SOURCE_FILE for NOTE_INSN_LIVE notes.
(NOTE_RANGE_INFO): Similarly for NOTE_INSN_RANGE_{START,END} notes.
(NOTE_BLOCK_LIVE_RANGE_BLOCK): Define.
(NOTE_INSN_RANGE_START, NOTE_INSN_RANGE_END, NOTE_INSN_LIVE): New notes.
(RANGE_LIVE_{BITMAP,ORIG_BLOCK}): New accessor macros.
(RANGE_REG_{SYMBOL,BLOCK}_NODE, RANGE_VAR_*): New accessor macros.
(RANGE_INFO_*): Likewise.
* sched.c (sched_analyze): Keep live range start/stop notes.
(unlink_other_notes): Likewise.
* haifa-sched.c (sched_analyze): Keep live range start/stop notes.
(unlink_other_notes): Likewise.
* tree.h (BLOCK_LIVE_RANGE_{START,END,VAR_FLAG}): New accessor macros.
(BLOCK_LIVE_RANGE_FLAG): Likewise.
(DECL_LIVE_RANGE_RTL): Likewise.
(struct tree_block): Add live_range_flag, live_range_var_flag,
live_range_start and live_range_end.
(struct tree_decl): Add live_range_rtl field.
* gengenrtl.c (type_from_format): Handle 'b' and 't'.
(accessor_from_format): Likewise.
Co-Authored-By: Jeffrey A Law <law@cygnus.com>
From-SVN: r19727
1998-05-13 17:13:47 -04:00
|
|
|
/* ?!? These should be bitmap and tree respectively, but those types
|
|
|
|
are not available in many of the files which include the output
|
|
|
|
of gengenrtl.
|
|
|
|
|
|
|
|
These are only used in prototypes, so I think we can assume that
|
|
|
|
void * is useable. */
|
|
|
|
case 'b':
|
|
|
|
return "void *";
|
|
|
|
case 't':
|
|
|
|
return "void *";
|
1998-01-08 16:17:05 -05:00
|
|
|
default:
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Decode a format letter into the proper accessor function. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static const char *
|
1998-01-17 15:09:09 -05:00
|
|
|
accessor_from_format (c)
|
1998-05-21 02:29:55 -04:00
|
|
|
int c;
|
1998-01-08 16:17:05 -05:00
|
|
|
{
|
|
|
|
switch (c)
|
|
|
|
{
|
|
|
|
case 'i':
|
|
|
|
return "XINT";
|
|
|
|
case 'w':
|
|
|
|
return "XWINT";
|
|
|
|
case 's':
|
|
|
|
return "XSTR";
|
|
|
|
case 'e':
|
|
|
|
case 'u':
|
|
|
|
return "XEXP";
|
|
|
|
case 'E':
|
|
|
|
return "XVEC";
|
Makefile.in (HOST_RTL): Add $(HOST_PREFIX)bitmap.o.
* Makefile.in (HOST_RTL): Add $(HOST_PREFIX)bitmap.o.
(rtl.o, emit-rtl.o): Add dependency on bitmap.h.
($(HOST_PREFIX_1)rtl.o): Likewise.
($(HOST_PREFIX_1)bitmap.o): New host object.
* emit-rtl.c (toplevel): Include bitmap.h.
(gen_rtx): Handle 't' and 'b' nodes.
* print-rtl.c (print_rtx): Handle printing NOTE_INSN_LIVE notes.
Print block number for block begin/end notes. Print 't' type
nodes as a pointer. Know that the 3rd argument of live range
start/stop notes is really a range_info rtx. If type is 'b', print
out argument as a bitmap.
* rtl.c: Include bitmap.c.
(copy_rtx): Copy tree nodes as is. Copy bitmaps if type is 'b'.
(note_insn_name): Add NOTE_INSN_RANGE_{START,END}, NOTE_INSN_LIVE.
* rtl.def (RANGE_LIVE): New node to hold live information while we
recalculate the basic blocks.
(RANGE_REG, RANGE_INFO): New rtl types for live range splitting.
(RANGE_VAR): New node, to hold information saved in symbol node for New
communicating live range information to the debug output functions.
* rtl.h (rtunion_def): Add rttree and rtbit fields.
(XBITMAP, XTREE): New accessor macros.
(NOTE_LIVE_INFO): Overload NOTE_SOURCE_FILE for NOTE_INSN_LIVE notes.
(NOTE_RANGE_INFO): Similarly for NOTE_INSN_RANGE_{START,END} notes.
(NOTE_BLOCK_LIVE_RANGE_BLOCK): Define.
(NOTE_INSN_RANGE_START, NOTE_INSN_RANGE_END, NOTE_INSN_LIVE): New notes.
(RANGE_LIVE_{BITMAP,ORIG_BLOCK}): New accessor macros.
(RANGE_REG_{SYMBOL,BLOCK}_NODE, RANGE_VAR_*): New accessor macros.
(RANGE_INFO_*): Likewise.
* sched.c (sched_analyze): Keep live range start/stop notes.
(unlink_other_notes): Likewise.
* haifa-sched.c (sched_analyze): Keep live range start/stop notes.
(unlink_other_notes): Likewise.
* tree.h (BLOCK_LIVE_RANGE_{START,END,VAR_FLAG}): New accessor macros.
(BLOCK_LIVE_RANGE_FLAG): Likewise.
(DECL_LIVE_RANGE_RTL): Likewise.
(struct tree_block): Add live_range_flag, live_range_var_flag,
live_range_start and live_range_end.
(struct tree_decl): Add live_range_rtl field.
* gengenrtl.c (type_from_format): Handle 'b' and 't'.
(accessor_from_format): Likewise.
Co-Authored-By: Jeffrey A Law <law@cygnus.com>
From-SVN: r19727
1998-05-13 17:13:47 -04:00
|
|
|
case 'b':
|
|
|
|
return "XBITMAP";
|
|
|
|
case 't':
|
|
|
|
return "XTREE";
|
1998-01-08 16:17:05 -05:00
|
|
|
default:
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Return true if a format character doesn't need normal processing. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static int
|
|
|
|
special_format (fmt)
|
|
|
|
const char *fmt;
|
|
|
|
{
|
|
|
|
return (strchr (fmt, '*') != 0
|
|
|
|
|| strchr (fmt, 'V') != 0
|
|
|
|
|| strchr (fmt, 'S') != 0
|
|
|
|
|| strchr (fmt, 'n') != 0);
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Return true if an rtx requires special processing. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static int
|
|
|
|
special_rtx (idx)
|
|
|
|
int idx;
|
|
|
|
{
|
|
|
|
return (strcmp (defs[idx].enumname, "CONST_INT") == 0
|
1999-04-01 12:06:09 -05:00
|
|
|
|| strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0
|
1998-06-25 11:14:41 -04:00
|
|
|
|| strcmp (defs[idx].enumname, "REG") == 0
|
|
|
|
|| strcmp (defs[idx].enumname, "MEM") == 0);
|
1998-01-08 16:17:05 -05:00
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Fill `formats' with all unique format strings. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
find_formats ()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_RTX_CODE; ++i)
|
|
|
|
{
|
|
|
|
const char **f;
|
|
|
|
|
|
|
|
if (special_format (defs[i].format))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
for (f = formats; *f ; ++f)
|
1999-04-01 12:06:09 -05:00
|
|
|
if (! strcmp (*f, defs[i].format))
|
1998-01-08 16:17:05 -05:00
|
|
|
break;
|
|
|
|
|
|
|
|
if (!*f)
|
|
|
|
*f = defs[i].format;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Emit a prototype for the rtx generator for a format. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
gendecl (f, format)
|
|
|
|
FILE *f;
|
|
|
|
const char *format;
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
fprintf (f, "extern rtx gen_rtx_fmt_%s PROTO((RTX_CODE, enum machine_mode mode",
|
|
|
|
format);
|
|
|
|
for (p = format, i = 0; *p ; ++p)
|
|
|
|
if (*p != '0')
|
|
|
|
fprintf (f, ", %s arg%d", type_from_format (*p), i++);
|
|
|
|
fprintf (f, "));\n");
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Emit a define mapping an rtx code to the generator for its format. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
genmacro (f, idx)
|
|
|
|
FILE *f;
|
|
|
|
int idx;
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
fprintf (f, "#define gen_rtx_%s%s(mode",
|
|
|
|
(special_rtx (idx) ? "raw_" : ""), defs[idx].enumname);
|
|
|
|
|
|
|
|
for (p = defs[idx].format, i = 0; *p ; ++p)
|
|
|
|
if (*p != '0')
|
|
|
|
fprintf (f, ", arg%d", i++);
|
|
|
|
fprintf (f, ") ");
|
|
|
|
|
|
|
|
fprintf (f, "gen_rtx_fmt_%s(%s,(mode)", defs[idx].format, defs[idx].enumname);
|
|
|
|
for (p = defs[idx].format, i = 0; *p ; ++p)
|
|
|
|
if (*p != '0')
|
|
|
|
fprintf (f, ",(arg%d)", i++);
|
|
|
|
fprintf (f, ")\n");
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Emit the implementation for the rtx generator for a format. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
gendef (f, format)
|
|
|
|
FILE *f;
|
|
|
|
const char *format;
|
|
|
|
{
|
|
|
|
const char *p;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
fprintf (f, "rtx\ngen_rtx_fmt_%s (code, mode", format);
|
|
|
|
for (p = format, i = 0; *p ; ++p)
|
|
|
|
if (*p != '0')
|
|
|
|
fprintf (f, ", arg%d", i++);
|
|
|
|
|
|
|
|
fprintf (f, ")\n RTX_CODE code;\n enum machine_mode mode;\n");
|
|
|
|
for (p = format, i = 0; *p ; ++p)
|
|
|
|
if (*p != '0')
|
|
|
|
fprintf (f, " %s arg%d;\n", type_from_format (*p), i++);
|
|
|
|
|
|
|
|
/* See rtx_alloc in rtl.c for comments. */
|
|
|
|
fprintf (f, "{\n");
|
1998-01-13 04:06:31 -05:00
|
|
|
fprintf (f, " rtx rt = obstack_alloc_rtx (sizeof (struct rtx_def) + %d * sizeof (rtunion));\n",
|
|
|
|
(int) strlen (format) - 1);
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
fprintf (f, " PUT_CODE (rt, code);\n");
|
|
|
|
fprintf (f, " PUT_MODE (rt, mode);\n");
|
|
|
|
|
|
|
|
for (p = format, i = j = 0; *p ; ++p, ++i)
|
|
|
|
if (*p != '0')
|
|
|
|
{
|
|
|
|
fprintf (f, " %s (rt, %d) = arg%d;\n",
|
|
|
|
accessor_from_format (*p), i, j++);
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (f, "\n return rt;\n}\n\n");
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Emit the `do not edit' banner. */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
genlegend (f)
|
|
|
|
FILE *f;
|
|
|
|
{
|
1999-04-01 12:06:09 -05:00
|
|
|
fputs ("/* Generated automaticaly by the program `gengenrtl'\n", f);
|
|
|
|
fputs (" from the RTL description file `rtl.def' */\n\n", f);
|
1998-01-08 16:17:05 -05:00
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Emit "genrtl.h". */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
genheader (f)
|
|
|
|
FILE *f;
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
const char **fmt;
|
|
|
|
|
|
|
|
for (fmt = formats; *fmt; ++fmt)
|
|
|
|
gendecl (f, *fmt);
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
fprintf (f, "\n");
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_RTX_CODE; i++)
|
|
|
|
{
|
|
|
|
if (special_format (defs[i].format))
|
|
|
|
continue;
|
|
|
|
genmacro (f, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-01 12:06:09 -05:00
|
|
|
/* Emit "genrtl.c". */
|
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
static void
|
|
|
|
gencode (f)
|
|
|
|
FILE *f;
|
|
|
|
{
|
|
|
|
const char **fmt;
|
|
|
|
|
1998-01-13 04:06:31 -05:00
|
|
|
fputs ("#include \"config.h\"\n", f);
|
1998-05-08 02:51:04 -04:00
|
|
|
fputs ("#include \"system.h\"\n", f);
|
1998-01-13 04:06:31 -05:00
|
|
|
fputs ("#include \"obstack.h\"\n", f);
|
|
|
|
fputs ("#include \"rtl.h\"\n\n", f);
|
|
|
|
fputs ("extern struct obstack *rtl_obstack;\n\n", f);
|
|
|
|
fputs ("static rtx obstack_alloc_rtx PROTO((int length));\n", f);
|
|
|
|
fputs ("static rtx obstack_alloc_rtx (length)\n", f);
|
|
|
|
fputs (" register int length;\n{\n", f);
|
|
|
|
fputs (" rtx rt = (rtx) obstack_alloc (rtl_obstack, length);\n\n", f);
|
1999-04-01 12:06:09 -05:00
|
|
|
fputs (" memset(rt, 0, sizeof(struct rtx_def) - sizeof(rtunion));\n\n", f);
|
1998-01-13 04:06:31 -05:00
|
|
|
fputs (" return rt;\n}\n\n", f);
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
for (fmt = formats; *fmt; ++fmt)
|
|
|
|
gendef (f, *fmt);
|
|
|
|
}
|
|
|
|
|
1998-07-17 11:00:11 -04:00
|
|
|
#if defined(USE_C_ALLOCA)
|
1998-11-27 05:09:17 -05:00
|
|
|
PTR
|
1998-01-17 15:09:09 -05:00
|
|
|
xmalloc (nbytes)
|
1998-11-27 05:09:17 -05:00
|
|
|
size_t nbytes;
|
1998-01-17 15:09:09 -05:00
|
|
|
{
|
1998-11-27 05:09:17 -05:00
|
|
|
register PTR tmp = (PTR) malloc (nbytes);
|
1998-01-17 15:09:09 -05:00
|
|
|
|
|
|
|
if (!tmp)
|
|
|
|
{
|
1998-07-17 11:00:11 -04:00
|
|
|
fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n",
|
|
|
|
nbytes);
|
1998-01-17 15:09:09 -05:00
|
|
|
exit (FATAL_EXIT_CODE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return tmp;
|
|
|
|
}
|
1998-07-17 11:00:11 -04:00
|
|
|
#endif /* USE_C_ALLOCA */
|
1998-01-17 15:09:09 -05:00
|
|
|
|
1998-01-08 16:17:05 -05:00
|
|
|
int
|
|
|
|
main(argc, argv)
|
|
|
|
int argc;
|
|
|
|
char **argv;
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
|
if (argc != 3)
|
|
|
|
exit (1);
|
|
|
|
|
|
|
|
find_formats ();
|
|
|
|
|
|
|
|
f = fopen (argv[1], "w");
|
|
|
|
if (f == NULL)
|
|
|
|
{
|
1999-04-01 12:06:09 -05:00
|
|
|
perror (argv[1]);
|
1998-01-08 16:17:05 -05:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
genlegend (f);
|
|
|
|
genheader (f);
|
1999-04-01 12:06:09 -05:00
|
|
|
fclose (f);
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
f = fopen (argv[2], "w");
|
|
|
|
if (f == NULL)
|
|
|
|
{
|
1999-04-01 12:06:09 -05:00
|
|
|
perror (argv[2]);
|
1998-01-08 16:17:05 -05:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
genlegend (f);
|
|
|
|
gencode (f);
|
1999-04-01 12:06:09 -05:00
|
|
|
fclose (f);
|
1998-01-08 16:17:05 -05:00
|
|
|
|
|
|
|
exit (0);
|
|
|
|
}
|