cselib.h revision 169689
11558Srgrimes/* Common subexpression elimination for GNU compiler.
21558Srgrimes   Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
31558Srgrimes   1999, 2003, 2004, 2005 Free Software Foundation, Inc.
41558Srgrimes
51558SrgrimesThis file is part of GCC.
61558Srgrimes
71558SrgrimesGCC is free software; you can redistribute it and/or modify it under
81558Srgrimesthe terms of the GNU General Public License as published by the Free
91558SrgrimesSoftware Foundation; either version 2, or (at your option) any later
101558Srgrimesversion.
111558Srgrimes
121558SrgrimesGCC is distributed in the hope that it will be useful, but WITHOUT ANY
131558SrgrimesWARRANTY; without even the implied warranty of MERCHANTABILITY or
141558SrgrimesFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
151558Srgrimesfor more details.
161558Srgrimes
171558SrgrimesYou should have received a copy of the GNU General Public License
181558Srgrimesalong with GCC; see the file COPYING.  If not, write to the Free
191558SrgrimesSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
201558Srgrimes02110-1301, USA.  */
211558Srgrimes
221558Srgrimes/* Describe a value.  */
231558Srgrimestypedef struct cselib_val_struct GTY(())
241558Srgrimes{
251558Srgrimes  /* The hash value.  */
261558Srgrimes  unsigned int value;
271558Srgrimes  union cselib_val_u
281558Srgrimes  {
291558Srgrimes    /* A VALUE rtx that points back to this structure.  */
30114589Sobrien    rtx GTY ((tag ("1"))) val_rtx;
311558Srgrimes    /* Used to keep a list of free cselib_val structures.  */
327585Sbde    struct cselib_val_struct * GTY ((skip)) next_free;
331558Srgrimes  } GTY ((desc ("1"))) u;
341558Srgrimes
351558Srgrimes  /* All rtl expressions that hold this value at the current time during a
361558Srgrimes     scan.  */
371558Srgrimes  struct elt_loc_list *locs;
3841477Sjulian  /* If this value is used as an address, points to a list of values that
39114589Sobrien     use it as an address in a MEM.  */
4041477Sjulian  struct elt_list *addr_list;
4193103Smarkm
4293103Smarkm  struct cselib_val_struct *next_containing_mem;
4393103Smarkm} cselib_val;
441558Srgrimes
4575557Smckusick/* A list of rtl expressions that hold the same value.  */
461558Srgrimesstruct elt_loc_list GTY(())
4740918Smjacob{
48217769Smckusick  /* Next element in the list.  */
4986514Siedowse  struct elt_loc_list *next;
50172236Srodrigc  /* An rtl expression that holds the value.  */
5198542Smckusick  rtx loc;
5223675Speter  /* The insn that made the equivalence.  */
531558Srgrimes  rtx setting_insn;
541558Srgrimes  /* True when setting insn is inside libcall.  */
5523675Speter  bool in_libcall;
5623675Speter};
5755725Speter
581558Srgrimes/* A list of cselib_val structures.  */
59120901Smckusickstruct elt_list GTY(())
60172236Srodrigc{
6155725Speter  struct elt_list *next;
62101037Smux  cselib_val *elt;
6386514Siedowse};
64217769Smckusick
6523675Speterextern cselib_val *cselib_lookup (rtx, enum machine_mode, int);
661558Srgrimesextern void cselib_init (bool record_memory);
671558Srgrimesextern void cselib_clear_table (void);
68260178Sscottlextern void cselib_finish (void);
69260178Sscottlextern void cselib_process_insn (rtx);
7092839Simpextern enum machine_mode cselib_reg_set_mode (rtx);
71100935Sphkextern int rtx_equal_for_cselib_p (rtx, rtx);
7292839Simpextern int references_value_p (rtx, int);
73171800Spjdextern rtx cselib_subst_to_values (rtx);
7492839Simpextern void cselib_invalidate_rtx (rtx);
7523675Speter