OSDN Git Service

PR c/42312
[pf3gnuchains/gcc-fork.git] / gcc / cselib.h
1 /* Common subexpression elimination for GNU compiler.
2    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
3    1999, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
11
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3.  If not see
19 <http://www.gnu.org/licenses/>.  */
20
21 /* Describe a value.  */
22 typedef struct GTY(()) cselib_val_struct {
23   /* The hash value.  */
24   unsigned int value;
25
26   /* A VALUE rtx that points back to this structure.  */
27   rtx val_rtx;
28
29   /* All rtl expressions that hold this value at the current time during a
30      scan.  */
31   struct elt_loc_list *locs;
32
33   /* If this value is used as an address, points to a list of values that
34      use it as an address in a MEM.  */
35   struct elt_list *addr_list;
36
37   struct cselib_val_struct *next_containing_mem;
38 } cselib_val;
39
40 /* A list of rtl expressions that hold the same value.  */
41 struct GTY(()) elt_loc_list {
42   /* Next element in the list.  */
43   struct elt_loc_list *next;
44   /* An rtl expression that holds the value.  */
45   rtx loc;
46   /* The insn that made the equivalence.  */
47   rtx setting_insn;
48 };
49
50 /* A list of cselib_val structures.  */
51 struct GTY(()) elt_list {
52   struct elt_list *next;
53   cselib_val *elt;
54 };
55
56 /* Describe a single set that is part of an insn.  */
57 struct cselib_set
58 {
59   rtx src;
60   rtx dest;
61   cselib_val *src_elt;
62   cselib_val *dest_addr_elt;
63 };
64
65 extern void (*cselib_discard_hook) (cselib_val *);
66 extern void (*cselib_record_sets_hook) (rtx insn, struct cselib_set *sets,
67                                         int n_sets);
68
69 extern cselib_val *cselib_lookup (rtx, enum machine_mode, int);
70 extern void cselib_init (bool record_memory);
71 extern void cselib_clear_table (void);
72 extern void cselib_finish (void);
73 extern void cselib_process_insn (rtx);
74 extern enum machine_mode cselib_reg_set_mode (const_rtx);
75 extern int rtx_equal_for_cselib_p (rtx, rtx);
76 extern int references_value_p (const_rtx, int);
77 extern rtx cselib_expand_value_rtx (rtx, bitmap, int);
78 typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *);
79 extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int,
80                                        cselib_expand_callback, void*);
81 extern rtx cselib_subst_to_values (rtx);
82 extern void cselib_invalidate_rtx (rtx);
83
84 extern void cselib_reset_table_with_next_value (unsigned int);
85 extern unsigned int cselib_get_next_unknown_value (void);
86 extern void cselib_preserve_value (cselib_val *);
87 extern bool cselib_preserved_value_p (cselib_val *);
88 extern void cselib_preserve_only_values (bool);
89
90 extern void dump_cselib_table (FILE *);