Mercurial > hg > CbC > CbC_gcc
comparison gcc/cselib.h @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* Common subexpression elimination for GNU compiler. | 1 /* Common subexpression elimination for GNU compiler. |
2 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, | 2 Copyright (C) 1987-2017 Free Software Foundation, Inc. |
3 1998, 1999, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 | |
4 Free Software Foundation, Inc. | |
5 | 3 |
6 This file is part of GCC. | 4 This file is part of GCC. |
7 | 5 |
8 GCC is free software; you can redistribute it and/or modify it under | 6 GCC is free software; you can redistribute it and/or modify it under |
9 the terms of the GNU General Public License as published by the Free | 7 the terms of the GNU General Public License as published by the Free |
17 | 15 |
18 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
19 along with GCC; see the file COPYING3. If not see | 17 along with GCC; see the file COPYING3. If not see |
20 <http://www.gnu.org/licenses/>. */ | 18 <http://www.gnu.org/licenses/>. */ |
21 | 19 |
20 #ifndef GCC_CSELIB_H | |
21 #define GCC_CSELIB_H | |
22 | |
22 /* Describe a value. */ | 23 /* Describe a value. */ |
23 typedef struct cselib_val_struct { | 24 struct cselib_val |
25 { | |
24 /* The hash value. */ | 26 /* The hash value. */ |
25 unsigned int hash; | 27 unsigned int hash; |
26 | 28 |
27 /* A unique id assigned to values. */ | 29 /* A unique id assigned to values. */ |
28 int uid; | 30 int uid; |
36 | 38 |
37 /* If this value is used as an address, points to a list of values that | 39 /* If this value is used as an address, points to a list of values that |
38 use it as an address in a MEM. */ | 40 use it as an address in a MEM. */ |
39 struct elt_list *addr_list; | 41 struct elt_list *addr_list; |
40 | 42 |
41 struct cselib_val_struct *next_containing_mem; | 43 struct cselib_val *next_containing_mem; |
42 } cselib_val; | 44 }; |
43 | 45 |
44 /* A list of rtl expressions that hold the same value. */ | 46 /* A list of rtl expressions that hold the same value. */ |
45 struct elt_loc_list { | 47 struct elt_loc_list { |
46 /* Next element in the list. */ | 48 /* Next element in the list. */ |
47 struct elt_loc_list *next; | 49 struct elt_loc_list *next; |
48 /* An rtl expression that holds the value. */ | 50 /* An rtl expression that holds the value. */ |
49 rtx loc; | 51 rtx loc; |
50 /* The insn that made the equivalence. */ | 52 /* The insn that made the equivalence. */ |
51 rtx setting_insn; | 53 rtx_insn *setting_insn; |
52 }; | 54 }; |
53 | 55 |
54 /* Describe a single set that is part of an insn. */ | 56 /* Describe a single set that is part of an insn. */ |
55 struct cselib_set | 57 struct cselib_set |
56 { | 58 { |
65 CSELIB_RECORD_MEMORY = 1, | 67 CSELIB_RECORD_MEMORY = 1, |
66 CSELIB_PRESERVE_CONSTANTS = 2 | 68 CSELIB_PRESERVE_CONSTANTS = 2 |
67 }; | 69 }; |
68 | 70 |
69 extern void (*cselib_discard_hook) (cselib_val *); | 71 extern void (*cselib_discard_hook) (cselib_val *); |
70 extern void (*cselib_record_sets_hook) (rtx insn, struct cselib_set *sets, | 72 extern void (*cselib_record_sets_hook) (rtx_insn *insn, struct cselib_set *sets, |
71 int n_sets); | 73 int n_sets); |
72 | 74 |
73 extern cselib_val *cselib_lookup (rtx, enum machine_mode, | 75 extern cselib_val *cselib_lookup (rtx, machine_mode, |
74 int, enum machine_mode); | 76 int, machine_mode); |
75 extern cselib_val *cselib_lookup_from_insn (rtx, enum machine_mode, | 77 extern cselib_val *cselib_lookup_from_insn (rtx, machine_mode, |
76 int, enum machine_mode, rtx); | 78 int, machine_mode, rtx_insn *); |
77 extern void cselib_init (int); | 79 extern void cselib_init (int); |
78 extern void cselib_clear_table (void); | 80 extern void cselib_clear_table (void); |
79 extern void cselib_finish (void); | 81 extern void cselib_finish (void); |
80 extern void cselib_process_insn (rtx); | 82 extern void cselib_process_insn (rtx_insn *); |
81 extern enum machine_mode cselib_reg_set_mode (const_rtx); | 83 extern bool fp_setter_insn (rtx_insn *); |
82 extern int rtx_equal_for_cselib_p (rtx, rtx); | 84 extern machine_mode cselib_reg_set_mode (const_rtx); |
85 extern int rtx_equal_for_cselib_1 (rtx, rtx, machine_mode, int); | |
83 extern int references_value_p (const_rtx, int); | 86 extern int references_value_p (const_rtx, int); |
84 extern rtx cselib_expand_value_rtx (rtx, bitmap, int); | 87 extern rtx cselib_expand_value_rtx (rtx, bitmap, int); |
85 typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *); | 88 typedef rtx (*cselib_expand_callback)(rtx, bitmap, int, void *); |
86 extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int, | 89 extern rtx cselib_expand_value_rtx_cb (rtx, bitmap, int, |
87 cselib_expand_callback, void *); | 90 cselib_expand_callback, void *); |
88 extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int, | 91 extern bool cselib_dummy_expand_value_rtx_cb (rtx, bitmap, int, |
89 cselib_expand_callback, void *); | 92 cselib_expand_callback, void *); |
90 extern rtx cselib_subst_to_values (rtx, enum machine_mode); | 93 extern rtx cselib_subst_to_values (rtx, machine_mode); |
94 extern rtx cselib_subst_to_values_from_insn (rtx, machine_mode, rtx_insn *); | |
91 extern void cselib_invalidate_rtx (rtx); | 95 extern void cselib_invalidate_rtx (rtx); |
92 | 96 |
93 extern void cselib_reset_table (unsigned int); | 97 extern void cselib_reset_table (unsigned int); |
94 extern unsigned int cselib_get_next_uid (void); | 98 extern unsigned int cselib_get_next_uid (void); |
95 extern void cselib_preserve_value (cselib_val *); | 99 extern void cselib_preserve_value (cselib_val *); |
96 extern bool cselib_preserved_value_p (cselib_val *); | 100 extern bool cselib_preserved_value_p (cselib_val *); |
97 extern void cselib_preserve_only_values (void); | 101 extern void cselib_preserve_only_values (void); |
98 extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int); | 102 extern void cselib_preserve_cfa_base_value (cselib_val *, unsigned int); |
103 extern void cselib_add_permanent_equiv (cselib_val *, rtx, rtx_insn *); | |
104 extern bool cselib_have_permanent_equivalences (void); | |
105 extern void cselib_set_value_sp_based (cselib_val *); | |
106 extern bool cselib_sp_based_value_p (cselib_val *); | |
99 | 107 |
100 extern void dump_cselib_table (FILE *); | 108 extern void dump_cselib_table (FILE *); |
109 | |
110 /* Return the canonical value for VAL, following the equivalence chain | |
111 towards the earliest (== lowest uid) equivalent value. */ | |
112 | |
113 static inline cselib_val * | |
114 canonical_cselib_val (cselib_val *val) | |
115 { | |
116 cselib_val *canon; | |
117 | |
118 if (!val->locs || val->locs->next | |
119 || !val->locs->loc || GET_CODE (val->locs->loc) != VALUE | |
120 || val->uid < CSELIB_VAL_PTR (val->locs->loc)->uid) | |
121 return val; | |
122 | |
123 canon = CSELIB_VAL_PTR (val->locs->loc); | |
124 gcc_checking_assert (canonical_cselib_val (canon) == canon); | |
125 return canon; | |
126 } | |
127 | |
128 /* Return nonzero if we can prove that X and Y contain the same value, taking | |
129 our gathered information into account. */ | |
130 | |
131 static inline int | |
132 rtx_equal_for_cselib_p (rtx x, rtx y) | |
133 { | |
134 if (x == y) | |
135 return 1; | |
136 | |
137 return rtx_equal_for_cselib_1 (x, y, VOIDmode, 0); | |
138 } | |
139 | |
140 #endif /* GCC_CSELIB_H */ |