comparison gcc/recog.c @ 63:b7f97abdc517 gcc-4.6-20100522

update gcc from gcc-4.5.0 to gcc-4.6
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 24 May 2010 12:47:05 +0900
parents 77e2b8dfacca
children f6334be47118
comparison
equal deleted inserted replaced
56:3c8a44c06a95 63:b7f97abdc517
1 /* Subroutines used by or related to instruction recognition. 1 /* Subroutines used by or related to instruction recognition.
2 Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998 2 Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998
3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 3 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc. 4 Free Software Foundation, Inc.
5 5
6 This file is part of GCC. 6 This file is part of GCC.
7 7
8 GCC is free software; you can redistribute it and/or modify it under 8 GCC is free software; you can redistribute it and/or modify it under
33 #include "regs.h" 33 #include "regs.h"
34 #include "addresses.h" 34 #include "addresses.h"
35 #include "expr.h" 35 #include "expr.h"
36 #include "function.h" 36 #include "function.h"
37 #include "flags.h" 37 #include "flags.h"
38 #include "real.h"
39 #include "toplev.h" 38 #include "toplev.h"
40 #include "basic-block.h" 39 #include "basic-block.h"
41 #include "output.h" 40 #include "output.h"
42 #include "reload.h" 41 #include "reload.h"
43 #include "target.h" 42 #include "target.h"
785 validate_replace_rtx_1 (where, from, to, insn, false); 784 validate_replace_rtx_1 (where, from, to, insn, false);
786 return apply_change_group (); 785 return apply_change_group ();
787 786
788 } 787 }
789 788
790 /* Try replacing every occurrence of FROM in INSN with TO. */ 789 /* Try replacing every occurrence of FROM in INSN with TO. This also
790 will replace in REG_EQUAL and REG_EQUIV notes. */
791 791
792 void 792 void
793 validate_replace_rtx_group (rtx from, rtx to, rtx insn) 793 validate_replace_rtx_group (rtx from, rtx to, rtx insn)
794 { 794 {
795 rtx note;
795 validate_replace_rtx_1 (&PATTERN (insn), from, to, insn, true); 796 validate_replace_rtx_1 (&PATTERN (insn), from, to, insn, true);
797 for (note = REG_NOTES (insn); note; note = XEXP (note, 1))
798 if (REG_NOTE_KIND (note) == REG_EQUAL
799 || REG_NOTE_KIND (note) == REG_EQUIV)
800 validate_replace_rtx_1 (&XEXP (note, 0), from, to, insn, true);
796 } 801 }
797 802
798 /* Function called by note_uses to replace used subexpressions. */ 803 /* Function called by note_uses to replace used subexpressions. */
799 struct validate_replace_src_data 804 struct validate_replace_src_data
800 { 805 {
1970 on the mode of the memory reference it is used in. 1975 on the mode of the memory reference it is used in.
1971 1976
1972 Autoincrement addressing is a typical example of mode-dependence 1977 Autoincrement addressing is a typical example of mode-dependence
1973 because the amount of the increment depends on the mode. */ 1978 because the amount of the increment depends on the mode. */
1974 1979
1975 int 1980 bool
1976 mode_dependent_address_p (rtx addr) 1981 mode_dependent_address_p (rtx addr)
1977 { 1982 {
1978 /* Auto-increment addressing with anything other than post_modify 1983 /* Auto-increment addressing with anything other than post_modify
1979 or pre_modify always introduces a mode dependency. Catch such 1984 or pre_modify always introduces a mode dependency. Catch such
1980 cases now instead of deferring to the target. */ 1985 cases now instead of deferring to the target. */
1981 if (GET_CODE (addr) == PRE_INC 1986 if (GET_CODE (addr) == PRE_INC
1982 || GET_CODE (addr) == POST_INC 1987 || GET_CODE (addr) == POST_INC
1983 || GET_CODE (addr) == PRE_DEC 1988 || GET_CODE (addr) == PRE_DEC
1984 || GET_CODE (addr) == POST_DEC) 1989 || GET_CODE (addr) == POST_DEC)
1985 return 1; 1990 return true;
1986 1991
1987 GO_IF_MODE_DEPENDENT_ADDRESS (addr, win); 1992 return targetm.mode_dependent_address_p (addr);
1988 return 0;
1989 /* Label `win' might (not) be used via GO_IF_MODE_DEPENDENT_ADDRESS. */
1990 win: ATTRIBUTE_UNUSED_LABEL
1991 return 1;
1992 } 1993 }
1993 1994
1994 /* Like extract_insn, but save insn extracted and don't extract again, when 1995 /* Like extract_insn, but save insn extracted and don't extract again, when
1995 called again for the same insn expecting that recog_data still contain the 1996 called again for the same insn expecting that recog_data still contain the
1996 valid information. This is used primary by gen_attr infrastructure that 1997 valid information. This is used primary by gen_attr infrastructure that
2074 /* Now get the operand values and constraints out of the insn. */ 2075 /* Now get the operand values and constraints out of the insn. */
2075 decode_asm_operands (body, recog_data.operand, 2076 decode_asm_operands (body, recog_data.operand,
2076 recog_data.operand_loc, 2077 recog_data.operand_loc,
2077 recog_data.constraints, 2078 recog_data.constraints,
2078 recog_data.operand_mode, NULL); 2079 recog_data.operand_mode, NULL);
2080 memset (recog_data.is_operator, 0, sizeof recog_data.is_operator);
2079 if (noperands > 0) 2081 if (noperands > 0)
2080 { 2082 {
2081 const char *p = recog_data.constraints[0]; 2083 const char *p = recog_data.constraints[0];
2082 recog_data.n_alternatives = 1; 2084 recog_data.n_alternatives = 1;
2083 while (*p) 2085 while (*p)
2103 insn_extract (insn); 2105 insn_extract (insn);
2104 2106
2105 for (i = 0; i < noperands; i++) 2107 for (i = 0; i < noperands; i++)
2106 { 2108 {
2107 recog_data.constraints[i] = insn_data[icode].operand[i].constraint; 2109 recog_data.constraints[i] = insn_data[icode].operand[i].constraint;
2110 recog_data.is_operator[i] = insn_data[icode].operand[i].is_operator;
2108 recog_data.operand_mode[i] = insn_data[icode].operand[i].mode; 2111 recog_data.operand_mode[i] = insn_data[icode].operand[i].mode;
2109 /* VOIDmode match_operands gets mode from their real operand. */ 2112 /* VOIDmode match_operands gets mode from their real operand. */
2110 if (recog_data.operand_mode[i] == VOIDmode) 2113 if (recog_data.operand_mode[i] == VOIDmode)
2111 recog_data.operand_mode[i] = GET_MODE (recog_data.operand[i]); 2114 recog_data.operand_mode[i] = GET_MODE (recog_data.operand[i]);
2112 } 2115 }