cselib.h revision 169690
1300906Sasomers/* Common subexpression elimination for GNU compiler.
2300906Sasomers   Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3300906Sasomers   1999, 2003, 2004, 2005 Free Software Foundation, Inc.
4300906Sasomers
5300906SasomersThis file is part of GCC.
6300906Sasomers
7300906SasomersGCC is free software; you can redistribute it and/or modify it under
8300906Sasomersthe terms of the GNU General Public License as published by the Free
9300906SasomersSoftware Foundation; either version 2, or (at your option) any later
10300906Sasomersversion.
11300906Sasomers
12300906SasomersGCC is distributed in the hope that it will be useful, but WITHOUT ANY
13300906SasomersWARRANTY; without even the implied warranty of MERCHANTABILITY or
14300906SasomersFITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15300906Sasomersfor more details.
16300906Sasomers
17300906SasomersYou should have received a copy of the GNU General Public License
18300906Sasomersalong with GCC; see the file COPYING.  If not, write to the Free
19300906SasomersSoftware Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20300906Sasomers02110-1301, USA.  */
21300906Sasomers
22300906Sasomers/* Describe a value.  */
23300906Sasomerstypedef struct cselib_val_struct GTY(())
24300906Sasomers{
25300906Sasomers  /* The hash value.  */
26300906Sasomers  unsigned int value;
27300906Sasomers  union cselib_val_u
28300906Sasomers  {
29300906Sasomers    /* A VALUE rtx that points back to this structure.  */
30300906Sasomers    rtx GTY ((tag ("1"))) val_rtx;
31300906Sasomers    /* Used to keep a list of free cselib_val structures.  */
32300906Sasomers    struct cselib_val_struct * GTY ((skip)) next_free;
33300906Sasomers  } GTY ((desc ("1"))) u;
34300906Sasomers
35300906Sasomers  /* All rtl expressions that hold this value at the current time during a
36300906Sasomers     scan.  */
37300906Sasomers  struct elt_loc_list *locs;
38300906Sasomers  /* If this value is used as an address, points to a list of values that
39300906Sasomers     use it as an address in a MEM.  */
40300906Sasomers  struct elt_list *addr_list;
41300906Sasomers
42300906Sasomers  struct cselib_val_struct *next_containing_mem;
43300906Sasomers} cselib_val;
44300906Sasomers
45300906Sasomers/* A list of rtl expressions that hold the same value.  */
46300906Sasomersstruct elt_loc_list GTY(())
47300906Sasomers{
48300906Sasomers  /* Next element in the list.  */
49300906Sasomers  struct elt_loc_list *next;
50300906Sasomers  /* An rtl expression that holds the value.  */
51300906Sasomers  rtx loc;
52300906Sasomers  /* The insn that made the equivalence.  */
53300906Sasomers  rtx setting_insn;
54300906Sasomers  /* True when setting insn is inside libcall.  */
55300906Sasomers  bool in_libcall;
56300906Sasomers};
57300906Sasomers
58300906Sasomers/* A list of cselib_val structures.  */
59300906Sasomersstruct elt_list GTY(())
60300906Sasomers{
61300906Sasomers  struct elt_list *next;
62300906Sasomers  cselib_val *elt;
63300906Sasomers};
64300906Sasomers
65300906Sasomersextern cselib_val *cselib_lookup (rtx, enum machine_mode, int);
66300906Sasomersextern void cselib_init (bool record_memory);
67300906Sasomersextern void cselib_clear_table (void);
68300906Sasomersextern void cselib_finish (void);
69300906Sasomersextern void cselib_process_insn (rtx);
70300906Sasomersextern enum machine_mode cselib_reg_set_mode (rtx);
71300906Sasomersextern int rtx_equal_for_cselib_p (rtx, rtx);
72300906Sasomersextern int references_value_p (rtx, int);
73300906Sasomersextern rtx cselib_subst_to_values (rtx);
74300906Sasomersextern void cselib_invalidate_rtx (rtx);
75300906Sasomers