X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;ds=sidebyside;f=gcc%2Fgenemit.c;h=79db84e7b30d4b129a5dfd70bf0d4f49dd784d42;hb=4266946e4489968a311f38add4dda93b0d6802c1;hp=c31b1fb1909824891e65681081a6cdd7c45e1372;hpb=96f57e365c008c4825c9c88e90db818ec4c99aad;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/genemit.c b/gcc/genemit.c index c31b1fb1909..79db84e7b30 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -1,6 +1,6 @@ /* Generate code from machine description to emit insns as rtl. Copyright (C) 1987, 1988, 1991, 1994, 1995, 1997, 1998, 1999, 2000, 2001, - 2003, 2004 Free Software Foundation, Inc. + 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GCC. @@ -16,8 +16,8 @@ for more details. You should have received a copy of the GNU General Public License along with GCC; see the file COPYING. If not, write to the Free -Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. */ +Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ #include "bconfig.h" @@ -260,7 +260,7 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used) case CONST_DOUBLE: /* These shouldn't be written in MD files. Instead, the appropriate routines in varasm.c should be called. */ - abort (); + gcc_unreachable (); default: break; @@ -277,25 +277,36 @@ gen_exp (rtx x, enum rtx_code subroutine_type, char *used) if (fmt[i] == '0') break; printf (",\n\t"); - if (fmt[i] == 'e' || fmt[i] == 'u') - gen_exp (XEXP (x, i), subroutine_type, used); - else if (fmt[i] == 'i') - printf ("%u", XINT (x, i)); - else if (fmt[i] == 's') - printf ("\"%s\"", XSTR (x, i)); - else if (fmt[i] == 'E') + switch (fmt[i]) { - int j; - printf ("gen_rtvec (%d", XVECLEN (x, i)); - for (j = 0; j < XVECLEN (x, i); j++) - { - printf (",\n\t\t"); - gen_exp (XVECEXP (x, i, j), subroutine_type, used); - } - printf (")"); + case 'e': case 'u': + gen_exp (XEXP (x, i), subroutine_type, used); + break; + + case 'i': + printf ("%u", XINT (x, i)); + break; + + case 's': + printf ("\"%s\"", XSTR (x, i)); + break; + + case 'E': + { + int j; + printf ("gen_rtvec (%d", XVECLEN (x, i)); + for (j = 0; j < XVECLEN (x, i); j++) + { + printf (",\n\t\t"); + gen_exp (XVECEXP (x, i, j), subroutine_type, used); + } + printf (")"); + break; + } + + default: + gcc_unreachable (); } - else - abort (); } printf (")"); } @@ -321,7 +332,7 @@ gen_insn (rtx insn, int lineno) if (GET_CODE (XVECEXP (insn, 1, i)) != CLOBBER) break; - if (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) == REG) + if (REG_P (XEXP (XVECEXP (insn, 1, i), 0))) has_hard_reg = 1; else if (GET_CODE (XEXP (XVECEXP (insn, 1, i), 0)) != MATCH_SCRATCH) break; @@ -330,7 +341,7 @@ gen_insn (rtx insn, int lineno) if (i != XVECLEN (insn, 1) - 1) { struct clobber_pat *p; - struct clobber_ent *link = xmalloc (sizeof (struct clobber_ent)); + struct clobber_ent *link = XNEW (struct clobber_ent); int j; link->code_number = insn_code_number; @@ -355,7 +366,7 @@ gen_insn (rtx insn, int lineno) if (! (GET_MODE (old) == GET_MODE (new) && ((GET_CODE (old) == MATCH_SCRATCH && GET_CODE (new) == MATCH_SCRATCH) - || (GET_CODE (old) == REG && GET_CODE (new) == REG + || (REG_P (old) && REG_P (new) && REGNO (old) == REGNO (new))))) break; } @@ -366,7 +377,7 @@ gen_insn (rtx insn, int lineno) if (p == 0) { - p = xmalloc (sizeof (struct clobber_pat)); + p = XNEW (struct clobber_pat); p->insns = 0; p->pattern = insn; @@ -498,6 +509,7 @@ gen_expand (rtx expand) /* Output the special code to be executed before the sequence is generated. */ + print_rtx_ptr_loc (XSTR (expand, 3)); printf ("%s\n", XSTR (expand, 3)); /* Output code to copy the arguments back out of `operands' @@ -536,7 +548,7 @@ gen_expand (rtx expand) || (GET_CODE (next) == PARALLEL && GET_CODE (XVECEXP (next, 0, 0)) == CALL)) printf (" emit_call_insn ("); - else if (GET_CODE (next) == CODE_LABEL) + else if (LABEL_P (next)) printf (" emit_label ("); else if (GET_CODE (next) == MATCH_OPERAND || GET_CODE (next) == MATCH_DUP @@ -587,7 +599,7 @@ gen_split (rtx split) max_operand_vec (split, 2); operands = MAX (max_opno, MAX (max_dup_opno, max_scratch_opno)) + 1; unused = (operands == 0 ? " ATTRIBUTE_UNUSED" : ""); - used = xcalloc (1, operands); + used = XCNEWVEC (char, operands); /* Output the prototype, function name and argument declarations. */ if (GET_CODE (split) == DEFINE_PEEPHOLE2) @@ -619,7 +631,10 @@ gen_split (rtx split) before the actual construction. */ if (XSTR (split, 3)) - printf ("%s\n", XSTR (split, 3)); + { + print_rtx_ptr_loc (XSTR (split, 3)); + printf ("%s\n", XSTR (split, 3)); + } /* Output code to copy the arguments back out of `operands' */ for (i = 0; i < operands; i++) @@ -646,7 +661,7 @@ gen_split (rtx split) || (GET_CODE (next) == PARALLEL && GET_CODE (XVECEXP (next, 0, 0)) == CALL)) printf (" emit_call_insn ("); - else if (GET_CODE (next) == CODE_LABEL) + else if (LABEL_P (next)) printf (" emit_label ("); else if (GET_CODE (next) == MATCH_OPERAND || GET_CODE (next) == MATCH_OPERATOR @@ -707,7 +722,7 @@ output_add_clobbers (void) } printf (" default:\n"); - printf (" abort ();\n"); + printf (" gcc_unreachable ();\n"); printf (" }\n"); printf ("}\n"); } @@ -745,7 +760,7 @@ output_added_clobbers_hard_reg_p (void) } printf (" default:\n"); - printf (" abort ();\n"); + printf (" gcc_unreachable ();\n"); printf (" }\n"); printf ("}\n"); } @@ -799,9 +814,6 @@ main (int argc, char **argv) progname = "genemit"; - if (argc <= 1) - fatal ("no input file name"); - if (init_md_reader_args (argc, argv) != SUCCESS_EXIT_CODE) return (FATAL_EXIT_CODE); @@ -832,7 +844,9 @@ from the machine description file `md'. */\n\n"); printf ("#include \"resource.h\"\n"); printf ("#include \"reload.h\"\n"); printf ("#include \"toplev.h\"\n"); + printf ("#include \"tm-constrs.h\"\n"); printf ("#include \"ggc.h\"\n\n"); + printf ("#include \"basic-block.h\"\n\n"); printf ("#define FAIL return (end_sequence (), _val)\n"); printf ("#define DONE return (_val = get_insns (), end_sequence (), _val)\n\n"); @@ -881,10 +895,3 @@ from the machine description file `md'. */\n\n"); fflush (stdout); return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); } - -/* Define this so we can link with print-rtl.o to get debug_rtx function. */ -const char * -get_insn_name (int code ATTRIBUTE_UNUSED) -{ - return NULL; -}