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