1 /* Common subexpression elimination library for GNU compiler.
2 Copyright (C) 1987-2022 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
22 #include "coretypes.h"
34 #include "function-abi.h"
36 /* A list of cselib_val structures. */
39 struct elt_list
*next
;
43 static bool cselib_record_memory
;
44 static bool cselib_preserve_constants
;
45 static bool cselib_any_perm_equivs
;
46 static inline void promote_debug_loc (struct elt_loc_list
*l
);
47 static struct elt_list
*new_elt_list (struct elt_list
*, cselib_val
*);
48 static void new_elt_loc_list (cselib_val
*, rtx
);
49 static void unchain_one_value (cselib_val
*);
50 static void unchain_one_elt_list (struct elt_list
**);
51 static void unchain_one_elt_loc_list (struct elt_loc_list
**);
52 static void remove_useless_values (void);
53 static unsigned int cselib_hash_rtx (rtx
, int, machine_mode
);
54 static cselib_val
*new_cselib_val (unsigned int, machine_mode
, rtx
);
55 static void add_mem_for_addr (cselib_val
*, cselib_val
*, rtx
);
56 static cselib_val
*cselib_lookup_mem (rtx
, int);
57 static void cselib_invalidate_regno (unsigned int, machine_mode
);
58 static void cselib_invalidate_mem (rtx
);
59 static void cselib_record_set (rtx
, cselib_val
*, cselib_val
*);
60 static void cselib_record_sets (rtx_insn
*);
61 static rtx
autoinc_split (rtx
, rtx
*, machine_mode
);
63 #define PRESERVED_VALUE_P(RTX) \
64 (RTL_FLAG_CHECK1 ("PRESERVED_VALUE_P", (RTX), VALUE)->unchanging)
66 #define SP_BASED_VALUE_P(RTX) \
67 (RTL_FLAG_CHECK1 ("SP_BASED_VALUE_P", (RTX), VALUE)->jump)
69 #define SP_DERIVED_VALUE_P(RTX) \
70 (RTL_FLAG_CHECK1 ("SP_DERIVED_VALUE_P", (RTX), VALUE)->call)
72 struct expand_value_data
75 cselib_expand_callback callback
;
80 static rtx
cselib_expand_value_rtx_1 (rtx
, struct expand_value_data
*, int);
82 /* There are three ways in which cselib can look up an rtx:
83 - for a REG, the reg_values table (which is indexed by regno) is used
84 - for a MEM, we recursively look up its address and then follow the
85 addr_list of that value
86 - for everything else, we compute a hash value and go through the hash
87 table. Since different rtx's can still have the same hash value,
88 this involves walking the table entries for a given value and comparing
89 the locations of the entries with the rtx we are looking up. */
91 struct cselib_hasher
: nofree_ptr_hash
<cselib_val
>
94 /* The rtx value and its mode (needed separately for constant
98 /* The mode of the contaning MEM, if any, otherwise VOIDmode. */
101 typedef key
*compare_type
;
102 static inline hashval_t
hash (const cselib_val
*);
103 static inline bool equal (const cselib_val
*, const key
*);
106 /* The hash function for our hash table. The value is always computed with
107 cselib_hash_rtx when adding an element; this function just extracts the
108 hash value from a cselib_val structure. */
111 cselib_hasher::hash (const cselib_val
*v
)
116 /* The equality test for our hash table. The first argument V is a table
117 element (i.e. a cselib_val), while the second arg X is an rtx. We know
118 that all callers of htab_find_slot_with_hash will wrap CONST_INTs into a
119 CONST of an appropriate mode. */
122 cselib_hasher::equal (const cselib_val
*v
, const key
*x_arg
)
124 struct elt_loc_list
*l
;
126 machine_mode mode
= x_arg
->mode
;
127 machine_mode memmode
= x_arg
->memmode
;
129 if (mode
!= GET_MODE (v
->val_rtx
))
132 if (GET_CODE (x
) == VALUE
)
133 return x
== v
->val_rtx
;
135 if (SP_DERIVED_VALUE_P (v
->val_rtx
) && GET_MODE (x
) == Pmode
)
138 if (autoinc_split (x
, &xoff
, memmode
) == v
->val_rtx
&& xoff
== NULL_RTX
)
142 /* We don't guarantee that distinct rtx's have different hash values,
143 so we need to do a comparison. */
144 for (l
= v
->locs
; l
; l
= l
->next
)
145 if (rtx_equal_for_cselib_1 (l
->loc
, x
, memmode
, 0))
147 promote_debug_loc (l
);
154 /* A table that enables us to look up elts by their value. */
155 static hash_table
<cselib_hasher
> *cselib_hash_table
;
157 /* A table to hold preserved values. */
158 static hash_table
<cselib_hasher
> *cselib_preserved_hash_table
;
160 /* This is a global so we don't have to pass this through every function.
161 It is used in new_elt_loc_list to set SETTING_INSN. */
162 static rtx_insn
*cselib_current_insn
;
164 /* The unique id that the next create value will take. */
165 static unsigned int next_uid
;
167 /* The number of registers we had when the varrays were last resized. */
168 static unsigned int cselib_nregs
;
170 /* Count values without known locations, or with only locations that
171 wouldn't have been known except for debug insns. Whenever this
172 grows too big, we remove these useless values from the table.
174 Counting values with only debug values is a bit tricky. We don't
175 want to increment n_useless_values when we create a value for a
176 debug insn, for this would get n_useless_values out of sync, but we
177 want increment it if all locs in the list that were ever referenced
178 in nondebug insns are removed from the list.
180 In the general case, once we do that, we'd have to stop accepting
181 nondebug expressions in the loc list, to avoid having two values
182 equivalent that, without debug insns, would have been made into
183 separate values. However, because debug insns never introduce
184 equivalences themselves (no assignments), the only means for
185 growing loc lists is through nondebug assignments. If the locs
186 also happen to be referenced in debug insns, it will work just fine.
188 A consequence of this is that there's at most one debug-only loc in
189 each loc list. If we keep it in the first entry, testing whether
190 we have a debug-only loc list takes O(1).
192 Furthermore, since any additional entry in a loc list containing a
193 debug loc would have to come from an assignment (nondebug) that
194 references both the initial debug loc and the newly-equivalent loc,
195 the initial debug loc would be promoted to a nondebug loc, and the
196 loc list would not contain debug locs any more.
198 So the only case we have to be careful with in order to keep
199 n_useless_values in sync between debug and nondebug compilations is
200 to avoid incrementing n_useless_values when removing the single loc
201 from a value that turns out to not appear outside debug values. We
202 increment n_useless_debug_values instead, and leave such values
203 alone until, for other reasons, we garbage-collect useless
205 static int n_useless_values
;
206 static int n_useless_debug_values
;
208 /* Count values whose locs have been taken exclusively from debug
209 insns for the entire life of the value. */
210 static int n_debug_values
;
212 /* Number of useless values before we remove them from the hash table. */
213 #define MAX_USELESS_VALUES 32
215 /* This table maps from register number to values. It does not
216 contain pointers to cselib_val structures, but rather elt_lists.
217 The purpose is to be able to refer to the same register in
218 different modes. The first element of the list defines the mode in
219 which the register was set; if the mode is unknown or the value is
220 no longer valid in that mode, ELT will be NULL for the first
222 static struct elt_list
**reg_values
;
223 static unsigned int reg_values_size
;
224 #define REG_VALUES(i) reg_values[i]
226 /* The largest number of hard regs used by any entry added to the
227 REG_VALUES table. Cleared on each cselib_clear_table() invocation. */
228 static unsigned int max_value_regs
;
230 /* Here the set of indices I with REG_VALUES(I) != 0 is saved. This is used
231 in cselib_clear_table() for fast emptying. */
232 static unsigned int *used_regs
;
233 static unsigned int n_used_regs
;
235 /* We pass this to cselib_invalidate_mem to invalidate all of
236 memory for a non-const call instruction. */
237 static GTY(()) rtx callmem
;
239 /* Set by discard_useless_locs if it deleted the last location of any
241 static int values_became_useless
;
243 /* Used as stop element of the containing_mem list so we can check
244 presence in the list by checking the next pointer. */
245 static cselib_val dummy_val
;
247 /* If non-NULL, value of the eliminated arg_pointer_rtx or frame_pointer_rtx
248 that is constant through the whole function and should never be
250 static cselib_val
*cfa_base_preserved_val
;
251 static unsigned int cfa_base_preserved_regno
= INVALID_REGNUM
;
253 /* Used to list all values that contain memory reference.
254 May or may not contain the useless values - the list is compacted
255 each time memory is invalidated. */
256 static cselib_val
*first_containing_mem
= &dummy_val
;
258 static object_allocator
<elt_list
> elt_list_pool ("elt_list");
259 static object_allocator
<elt_loc_list
> elt_loc_list_pool ("elt_loc_list");
260 static object_allocator
<cselib_val
> cselib_val_pool ("cselib_val_list");
262 static pool_allocator
value_pool ("value", RTX_CODE_SIZE (VALUE
));
264 /* If nonnull, cselib will call this function before freeing useless
265 VALUEs. A VALUE is deemed useless if its "locs" field is null. */
266 void (*cselib_discard_hook
) (cselib_val
*);
268 /* If nonnull, cselib will call this function before recording sets or
269 even clobbering outputs of INSN. All the recorded sets will be
270 represented in the array sets[n_sets]. new_val_min can be used to
271 tell whether values present in sets are introduced by this
273 void (*cselib_record_sets_hook
) (rtx_insn
*insn
, struct cselib_set
*sets
,
278 /* Allocate a struct elt_list and fill in its two elements with the
281 static inline struct elt_list
*
282 new_elt_list (struct elt_list
*next
, cselib_val
*elt
)
284 elt_list
*el
= elt_list_pool
.allocate ();
290 /* Allocate a struct elt_loc_list with LOC and prepend it to VAL's loc
294 new_elt_loc_list (cselib_val
*val
, rtx loc
)
296 struct elt_loc_list
*el
, *next
= val
->locs
;
298 gcc_checking_assert (!next
|| !next
->setting_insn
299 || !DEBUG_INSN_P (next
->setting_insn
)
300 || cselib_current_insn
== next
->setting_insn
);
302 /* If we're creating the first loc in a debug insn context, we've
303 just created a debug value. Count it. */
304 if (!next
&& cselib_current_insn
&& DEBUG_INSN_P (cselib_current_insn
))
307 val
= canonical_cselib_val (val
);
310 if (GET_CODE (loc
) == VALUE
)
312 loc
= canonical_cselib_val (CSELIB_VAL_PTR (loc
))->val_rtx
;
314 gcc_checking_assert (PRESERVED_VALUE_P (loc
)
315 == PRESERVED_VALUE_P (val
->val_rtx
));
317 if (val
->val_rtx
== loc
)
319 else if (val
->uid
> CSELIB_VAL_PTR (loc
)->uid
)
321 /* Reverse the insertion. */
322 new_elt_loc_list (CSELIB_VAL_PTR (loc
), val
->val_rtx
);
326 gcc_checking_assert (val
->uid
< CSELIB_VAL_PTR (loc
)->uid
);
328 if (CSELIB_VAL_PTR (loc
)->locs
)
330 /* Bring all locs from LOC to VAL. */
331 for (el
= CSELIB_VAL_PTR (loc
)->locs
; el
->next
; el
= el
->next
)
333 /* Adjust values that have LOC as canonical so that VAL
334 becomes their canonical. */
335 if (el
->loc
&& GET_CODE (el
->loc
) == VALUE
)
337 gcc_checking_assert (CSELIB_VAL_PTR (el
->loc
)->locs
->loc
339 CSELIB_VAL_PTR (el
->loc
)->locs
->loc
= val
->val_rtx
;
342 el
->next
= val
->locs
;
343 next
= val
->locs
= CSELIB_VAL_PTR (loc
)->locs
;
346 if (CSELIB_VAL_PTR (loc
)->addr_list
)
348 /* Bring in addr_list into canonical node. */
349 struct elt_list
*last
= CSELIB_VAL_PTR (loc
)->addr_list
;
352 last
->next
= val
->addr_list
;
353 val
->addr_list
= CSELIB_VAL_PTR (loc
)->addr_list
;
354 CSELIB_VAL_PTR (loc
)->addr_list
= NULL
;
357 if (CSELIB_VAL_PTR (loc
)->next_containing_mem
!= NULL
358 && val
->next_containing_mem
== NULL
)
360 /* Add VAL to the containing_mem list after LOC. LOC will
361 be removed when we notice it doesn't contain any
363 val
->next_containing_mem
= CSELIB_VAL_PTR (loc
)->next_containing_mem
;
364 CSELIB_VAL_PTR (loc
)->next_containing_mem
= val
;
367 /* Chain LOC back to VAL. */
368 el
= elt_loc_list_pool
.allocate ();
369 el
->loc
= val
->val_rtx
;
370 el
->setting_insn
= cselib_current_insn
;
372 CSELIB_VAL_PTR (loc
)->locs
= el
;
375 el
= elt_loc_list_pool
.allocate ();
377 el
->setting_insn
= cselib_current_insn
;
382 /* Promote loc L to a nondebug cselib_current_insn if L is marked as
383 originating from a debug insn, maintaining the debug values
387 promote_debug_loc (struct elt_loc_list
*l
)
389 if (l
&& l
->setting_insn
&& DEBUG_INSN_P (l
->setting_insn
)
390 && (!cselib_current_insn
|| !DEBUG_INSN_P (cselib_current_insn
)))
393 l
->setting_insn
= cselib_current_insn
;
394 if (cselib_preserve_constants
&& l
->next
)
396 gcc_assert (l
->next
->setting_insn
397 && DEBUG_INSN_P (l
->next
->setting_insn
)
399 l
->next
->setting_insn
= cselib_current_insn
;
402 gcc_assert (!l
->next
);
406 /* The elt_list at *PL is no longer needed. Unchain it and free its
410 unchain_one_elt_list (struct elt_list
**pl
)
412 struct elt_list
*l
= *pl
;
415 elt_list_pool
.remove (l
);
418 /* Likewise for elt_loc_lists. */
421 unchain_one_elt_loc_list (struct elt_loc_list
**pl
)
423 struct elt_loc_list
*l
= *pl
;
426 elt_loc_list_pool
.remove (l
);
429 /* Likewise for cselib_vals. This also frees the addr_list associated with
433 unchain_one_value (cselib_val
*v
)
436 unchain_one_elt_list (&v
->addr_list
);
438 cselib_val_pool
.remove (v
);
441 /* Remove all entries from the hash table. Also used during
445 cselib_clear_table (void)
447 cselib_reset_table (1);
450 /* Return TRUE if V is a constant, a function invariant or a VALUE
451 equivalence; FALSE otherwise. */
454 invariant_or_equiv_p (cselib_val
*v
)
456 struct elt_loc_list
*l
;
458 if (v
== cfa_base_preserved_val
)
461 /* Keep VALUE equivalences around. */
462 for (l
= v
->locs
; l
; l
= l
->next
)
463 if (GET_CODE (l
->loc
) == VALUE
)
467 && v
->locs
->next
== NULL
)
469 if (CONSTANT_P (v
->locs
->loc
)
470 && (GET_CODE (v
->locs
->loc
) != CONST
471 || !references_value_p (v
->locs
->loc
, 0)))
473 /* Although a debug expr may be bound to different expressions,
474 we can preserve it as if it was constant, to get unification
475 and proper merging within var-tracking. */
476 if (GET_CODE (v
->locs
->loc
) == DEBUG_EXPR
477 || GET_CODE (v
->locs
->loc
) == DEBUG_IMPLICIT_PTR
478 || GET_CODE (v
->locs
->loc
) == ENTRY_VALUE
479 || GET_CODE (v
->locs
->loc
) == DEBUG_PARAMETER_REF
)
482 /* (plus (value V) (const_int C)) is invariant iff V is invariant. */
483 if (GET_CODE (v
->locs
->loc
) == PLUS
484 && CONST_INT_P (XEXP (v
->locs
->loc
, 1))
485 && GET_CODE (XEXP (v
->locs
->loc
, 0)) == VALUE
486 && invariant_or_equiv_p (CSELIB_VAL_PTR (XEXP (v
->locs
->loc
, 0))))
493 /* Remove from hash table all VALUEs except constants, function
494 invariants and VALUE equivalences. */
497 preserve_constants_and_equivs (cselib_val
**x
, void *info ATTRIBUTE_UNUSED
)
501 if (invariant_or_equiv_p (v
))
503 cselib_hasher::key lookup
= {
504 GET_MODE (v
->val_rtx
), v
->val_rtx
, VOIDmode
507 = cselib_preserved_hash_table
->find_slot_with_hash (&lookup
,
513 cselib_hash_table
->clear_slot (x
);
518 /* Remove all entries from the hash table, arranging for the next
519 value to be numbered NUM. */
522 cselib_reset_table (unsigned int num
)
528 if (cfa_base_preserved_val
)
530 unsigned int regno
= cfa_base_preserved_regno
;
531 unsigned int new_used_regs
= 0;
532 for (i
= 0; i
< n_used_regs
; i
++)
533 if (used_regs
[i
] == regno
)
539 REG_VALUES (used_regs
[i
]) = 0;
540 gcc_assert (new_used_regs
== 1);
541 n_used_regs
= new_used_regs
;
542 used_regs
[0] = regno
;
544 = hard_regno_nregs (regno
,
545 GET_MODE (cfa_base_preserved_val
->locs
->loc
));
547 /* If cfa_base is sp + const_int, need to preserve also the
548 SP_DERIVED_VALUE_P value. */
549 for (struct elt_loc_list
*l
= cfa_base_preserved_val
->locs
;
551 if (GET_CODE (l
->loc
) == PLUS
552 && GET_CODE (XEXP (l
->loc
, 0)) == VALUE
553 && SP_DERIVED_VALUE_P (XEXP (l
->loc
, 0))
554 && CONST_INT_P (XEXP (l
->loc
, 1)))
556 if (! invariant_or_equiv_p (CSELIB_VAL_PTR (XEXP (l
->loc
, 0))))
558 rtx val
= cfa_base_preserved_val
->val_rtx
;
559 rtx_insn
*save_cselib_current_insn
= cselib_current_insn
;
560 cselib_current_insn
= l
->setting_insn
;
561 new_elt_loc_list (CSELIB_VAL_PTR (XEXP (l
->loc
, 0)),
562 plus_constant (Pmode
, val
,
563 -UINTVAL (XEXP (l
->loc
, 1))));
564 cselib_current_insn
= save_cselib_current_insn
;
571 for (i
= 0; i
< n_used_regs
; i
++)
572 REG_VALUES (used_regs
[i
]) = 0;
576 if (cselib_preserve_constants
)
577 cselib_hash_table
->traverse
<void *, preserve_constants_and_equivs
> (NULL
);
580 cselib_hash_table
->empty ();
581 gcc_checking_assert (!cselib_any_perm_equivs
);
584 n_useless_values
= 0;
585 n_useless_debug_values
= 0;
590 first_containing_mem
= &dummy_val
;
593 /* Return the number of the next value that will be generated. */
596 cselib_get_next_uid (void)
601 /* Search for X, whose hashcode is HASH, in CSELIB_HASH_TABLE,
602 INSERTing if requested. When X is part of the address of a MEM,
603 MEMMODE should specify the mode of the MEM. */
606 cselib_find_slot (machine_mode mode
, rtx x
, hashval_t hash
,
607 enum insert_option insert
, machine_mode memmode
)
609 cselib_val
**slot
= NULL
;
610 cselib_hasher::key lookup
= { mode
, x
, memmode
};
611 if (cselib_preserve_constants
)
612 slot
= cselib_preserved_hash_table
->find_slot_with_hash (&lookup
, hash
,
615 slot
= cselib_hash_table
->find_slot_with_hash (&lookup
, hash
, insert
);
619 /* Return true if X contains a VALUE rtx. If ONLY_USELESS is set, we
620 only return true for values which point to a cselib_val whose value
621 element has been set to zero, which implies the cselib_val will be
625 references_value_p (const_rtx x
, int only_useless
)
627 const enum rtx_code code
= GET_CODE (x
);
628 const char *fmt
= GET_RTX_FORMAT (code
);
631 if (GET_CODE (x
) == VALUE
633 || (CSELIB_VAL_PTR (x
)->locs
== 0 && !PRESERVED_VALUE_P (x
))))
636 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
638 if (fmt
[i
] == 'e' && references_value_p (XEXP (x
, i
), only_useless
))
640 else if (fmt
[i
] == 'E')
641 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
642 if (references_value_p (XVECEXP (x
, i
, j
), only_useless
))
649 /* Return true if V is a useless VALUE and can be discarded as such. */
652 cselib_useless_value_p (cselib_val
*v
)
655 && !PRESERVED_VALUE_P (v
->val_rtx
)
656 && !SP_DERIVED_VALUE_P (v
->val_rtx
));
659 /* For all locations found in X, delete locations that reference useless
660 values (i.e. values without any location). Called through
664 discard_useless_locs (cselib_val
**x
, void *info ATTRIBUTE_UNUSED
)
667 struct elt_loc_list
**p
= &v
->locs
;
668 bool had_locs
= v
->locs
!= NULL
;
669 rtx_insn
*setting_insn
= v
->locs
? v
->locs
->setting_insn
: NULL
;
673 if (references_value_p ((*p
)->loc
, 1))
674 unchain_one_elt_loc_list (p
);
679 if (had_locs
&& cselib_useless_value_p (v
))
681 if (setting_insn
&& DEBUG_INSN_P (setting_insn
))
682 n_useless_debug_values
++;
685 values_became_useless
= 1;
690 /* If X is a value with no locations, remove it from the hashtable. */
693 discard_useless_values (cselib_val
**x
, void *info ATTRIBUTE_UNUSED
)
697 if (v
->locs
== 0 && cselib_useless_value_p (v
))
699 if (cselib_discard_hook
)
700 cselib_discard_hook (v
);
702 CSELIB_VAL_PTR (v
->val_rtx
) = NULL
;
703 cselib_hash_table
->clear_slot (x
);
704 unchain_one_value (v
);
711 /* Clean out useless values (i.e. those which no longer have locations
712 associated with them) from the hash table. */
715 remove_useless_values (void)
719 /* First pass: eliminate locations that reference the value. That in
720 turn can make more values useless. */
723 values_became_useless
= 0;
724 cselib_hash_table
->traverse
<void *, discard_useless_locs
> (NULL
);
726 while (values_became_useless
);
728 /* Second pass: actually remove the values. */
730 p
= &first_containing_mem
;
731 for (v
= *p
; v
!= &dummy_val
; v
= v
->next_containing_mem
)
732 if (v
->locs
&& v
== canonical_cselib_val (v
))
735 p
= &(*p
)->next_containing_mem
;
739 n_useless_values
+= n_useless_debug_values
;
740 n_debug_values
-= n_useless_debug_values
;
741 n_useless_debug_values
= 0;
743 cselib_hash_table
->traverse
<void *, discard_useless_values
> (NULL
);
745 gcc_assert (!n_useless_values
);
748 /* Arrange for a value to not be removed from the hash table even if
749 it becomes useless. */
752 cselib_preserve_value (cselib_val
*v
)
754 PRESERVED_VALUE_P (v
->val_rtx
) = 1;
757 /* Test whether a value is preserved. */
760 cselib_preserved_value_p (cselib_val
*v
)
762 return PRESERVED_VALUE_P (v
->val_rtx
);
765 /* Arrange for a REG value to be assumed constant through the whole function,
766 never invalidated and preserved across cselib_reset_table calls. */
769 cselib_preserve_cfa_base_value (cselib_val
*v
, unsigned int regno
)
771 if (cselib_preserve_constants
773 && REG_P (v
->locs
->loc
))
775 cfa_base_preserved_val
= v
;
776 cfa_base_preserved_regno
= regno
;
780 /* Clean all non-constant expressions in the hash table, but retain
784 cselib_preserve_only_values (void)
788 for (i
= 0; i
< FIRST_PSEUDO_REGISTER
; i
++)
789 cselib_invalidate_regno (i
, reg_raw_mode
[i
]);
791 cselib_invalidate_mem (callmem
);
793 remove_useless_values ();
795 gcc_assert (first_containing_mem
== &dummy_val
);
798 /* Arrange for a value to be marked as based on stack pointer
799 for find_base_term purposes. */
802 cselib_set_value_sp_based (cselib_val
*v
)
804 SP_BASED_VALUE_P (v
->val_rtx
) = 1;
807 /* Test whether a value is based on stack pointer for
808 find_base_term purposes. */
811 cselib_sp_based_value_p (cselib_val
*v
)
813 return SP_BASED_VALUE_P (v
->val_rtx
);
816 /* Return the mode in which a register was last set. If X is not a
817 register, return its mode. If the mode in which the register was
818 set is not known, or the value was already clobbered, return
822 cselib_reg_set_mode (const_rtx x
)
827 if (REG_VALUES (REGNO (x
)) == NULL
828 || REG_VALUES (REGNO (x
))->elt
== NULL
)
831 return GET_MODE (REG_VALUES (REGNO (x
))->elt
->val_rtx
);
834 /* If x is a PLUS or an autoinc operation, expand the operation,
835 storing the offset, if any, in *OFF. */
838 autoinc_split (rtx x
, rtx
*off
, machine_mode memmode
)
840 switch (GET_CODE (x
))
848 if (memmode
== VOIDmode
)
851 *off
= gen_int_mode (-GET_MODE_SIZE (memmode
), GET_MODE (x
));
856 if (memmode
== VOIDmode
)
859 *off
= gen_int_mode (GET_MODE_SIZE (memmode
), GET_MODE (x
));
877 if (GET_MODE (x
) == Pmode
878 && (REG_P (x
) || MEM_P (x
) || GET_CODE (x
) == VALUE
)
879 && (*off
== NULL_RTX
|| CONST_INT_P (*off
)))
882 if (GET_CODE (x
) == VALUE
)
883 e
= CSELIB_VAL_PTR (x
);
885 e
= cselib_lookup (x
, GET_MODE (x
), 0, memmode
);
888 if (SP_DERIVED_VALUE_P (e
->val_rtx
)
889 && (*off
== NULL_RTX
|| *off
== const0_rtx
))
894 for (struct elt_loc_list
*l
= e
->locs
; l
; l
= l
->next
)
895 if (GET_CODE (l
->loc
) == PLUS
896 && GET_CODE (XEXP (l
->loc
, 0)) == VALUE
897 && SP_DERIVED_VALUE_P (XEXP (l
->loc
, 0))
898 && CONST_INT_P (XEXP (l
->loc
, 1)))
900 if (*off
== NULL_RTX
)
901 *off
= XEXP (l
->loc
, 1);
903 *off
= plus_constant (Pmode
, *off
,
904 INTVAL (XEXP (l
->loc
, 1)));
905 if (*off
== const0_rtx
)
907 return XEXP (l
->loc
, 0);
914 /* Return nonzero if we can prove that X and Y contain the same value,
915 taking our gathered information into account. MEMMODE holds the
916 mode of the enclosing MEM, if any, as required to deal with autoinc
917 addressing modes. If X and Y are not (known to be) part of
918 addresses, MEMMODE should be VOIDmode. */
921 rtx_equal_for_cselib_1 (rtx x
, rtx y
, machine_mode memmode
, int depth
)
927 if (REG_P (x
) || MEM_P (x
))
929 cselib_val
*e
= cselib_lookup (x
, GET_MODE (x
), 0, memmode
);
935 if (REG_P (y
) || MEM_P (y
))
937 cselib_val
*e
= cselib_lookup (y
, GET_MODE (y
), 0, memmode
);
946 if (GET_CODE (x
) == VALUE
)
948 cselib_val
*e
= canonical_cselib_val (CSELIB_VAL_PTR (x
));
949 struct elt_loc_list
*l
;
951 if (GET_CODE (y
) == VALUE
)
952 return e
== canonical_cselib_val (CSELIB_VAL_PTR (y
));
954 if ((SP_DERIVED_VALUE_P (x
)
955 || SP_DERIVED_VALUE_P (e
->val_rtx
))
956 && GET_MODE (y
) == Pmode
)
959 rtx yr
= autoinc_split (y
, &yoff
, memmode
);
960 if ((yr
== x
|| yr
== e
->val_rtx
) && yoff
== NULL_RTX
)
967 for (l
= e
->locs
; l
; l
= l
->next
)
971 /* Avoid infinite recursion. We know we have the canonical
972 value, so we can just skip any values in the equivalence
974 if (REG_P (t
) || MEM_P (t
) || GET_CODE (t
) == VALUE
)
976 else if (rtx_equal_for_cselib_1 (t
, y
, memmode
, depth
+ 1))
982 else if (GET_CODE (y
) == VALUE
)
984 cselib_val
*e
= canonical_cselib_val (CSELIB_VAL_PTR (y
));
985 struct elt_loc_list
*l
;
987 if ((SP_DERIVED_VALUE_P (y
)
988 || SP_DERIVED_VALUE_P (e
->val_rtx
))
989 && GET_MODE (x
) == Pmode
)
992 rtx xr
= autoinc_split (x
, &xoff
, memmode
);
993 if ((xr
== y
|| xr
== e
->val_rtx
) && xoff
== NULL_RTX
)
1000 for (l
= e
->locs
; l
; l
= l
->next
)
1004 if (REG_P (t
) || MEM_P (t
) || GET_CODE (t
) == VALUE
)
1006 else if (rtx_equal_for_cselib_1 (x
, t
, memmode
, depth
+ 1))
1013 if (GET_MODE (x
) != GET_MODE (y
))
1016 if (GET_CODE (x
) != GET_CODE (y
)
1017 || (GET_CODE (x
) == PLUS
1018 && GET_MODE (x
) == Pmode
1019 && CONST_INT_P (XEXP (x
, 1))
1020 && CONST_INT_P (XEXP (y
, 1))))
1022 rtx xorig
= x
, yorig
= y
;
1023 rtx xoff
= NULL
, yoff
= NULL
;
1025 x
= autoinc_split (x
, &xoff
, memmode
);
1026 y
= autoinc_split (y
, &yoff
, memmode
);
1028 /* Don't recurse if nothing changed. */
1029 if (x
!= xorig
|| y
!= yorig
)
1034 if (xoff
&& !rtx_equal_for_cselib_1 (xoff
, yoff
, memmode
, depth
))
1037 return rtx_equal_for_cselib_1 (x
, y
, memmode
, depth
);
1040 if (GET_CODE (xorig
) != GET_CODE (yorig
))
1044 /* These won't be handled correctly by the code below. */
1045 switch (GET_CODE (x
))
1052 if (!same_vector_encodings_p (x
, y
))
1056 case DEBUG_IMPLICIT_PTR
:
1057 return DEBUG_IMPLICIT_PTR_DECL (x
)
1058 == DEBUG_IMPLICIT_PTR_DECL (y
);
1060 case DEBUG_PARAMETER_REF
:
1061 return DEBUG_PARAMETER_REF_DECL (x
)
1062 == DEBUG_PARAMETER_REF_DECL (y
);
1065 /* ENTRY_VALUEs are function invariant, it is thus undesirable to
1066 use rtx_equal_for_cselib_1 to compare the operands. */
1067 return rtx_equal_p (ENTRY_VALUE_EXP (x
), ENTRY_VALUE_EXP (y
));
1070 return label_ref_label (x
) == label_ref_label (y
);
1073 return REGNO (x
) == REGNO (y
);
1076 /* We have to compare any autoinc operations in the addresses
1077 using this MEM's mode. */
1078 return rtx_equal_for_cselib_1 (XEXP (x
, 0), XEXP (y
, 0), GET_MODE (x
),
1085 code
= GET_CODE (x
);
1086 fmt
= GET_RTX_FORMAT (code
);
1088 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
1095 if (XWINT (x
, i
) != XWINT (y
, i
))
1101 if (XINT (x
, i
) != XINT (y
, i
))
1106 if (maybe_ne (SUBREG_BYTE (x
), SUBREG_BYTE (y
)))
1112 /* Two vectors must have the same length. */
1113 if (XVECLEN (x
, i
) != XVECLEN (y
, i
))
1116 /* And the corresponding elements must match. */
1117 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
1118 if (! rtx_equal_for_cselib_1 (XVECEXP (x
, i
, j
),
1119 XVECEXP (y
, i
, j
), memmode
, depth
))
1125 && targetm
.commutative_p (x
, UNKNOWN
)
1126 && rtx_equal_for_cselib_1 (XEXP (x
, 1), XEXP (y
, 0), memmode
,
1128 && rtx_equal_for_cselib_1 (XEXP (x
, 0), XEXP (y
, 1), memmode
,
1131 if (! rtx_equal_for_cselib_1 (XEXP (x
, i
), XEXP (y
, i
), memmode
,
1138 if (strcmp (XSTR (x
, i
), XSTR (y
, i
)))
1143 /* These are just backpointers, so they don't matter. */
1150 /* It is believed that rtx's at this level will never
1151 contain anything but integers and other rtx's,
1152 except for within LABEL_REFs and SYMBOL_REFs. */
1160 /* Helper function for cselib_hash_rtx. Arguments like for cselib_hash_rtx,
1161 except that it hashes (plus:P x c). */
1164 cselib_hash_plus_const_int (rtx x
, HOST_WIDE_INT c
, int create
,
1165 machine_mode memmode
)
1167 cselib_val
*e
= cselib_lookup (x
, GET_MODE (x
), create
, memmode
);
1171 if (! SP_DERIVED_VALUE_P (e
->val_rtx
))
1172 for (struct elt_loc_list
*l
= e
->locs
; l
; l
= l
->next
)
1173 if (GET_CODE (l
->loc
) == PLUS
1174 && GET_CODE (XEXP (l
->loc
, 0)) == VALUE
1175 && SP_DERIVED_VALUE_P (XEXP (l
->loc
, 0))
1176 && CONST_INT_P (XEXP (l
->loc
, 1)))
1178 e
= CSELIB_VAL_PTR (XEXP (l
->loc
, 0));
1179 c
= trunc_int_for_mode (c
+ UINTVAL (XEXP (l
->loc
, 1)), Pmode
);
1185 unsigned hash
= (unsigned) PLUS
+ (unsigned) GET_MODE (x
);
1187 unsigned int tem_hash
= (unsigned) CONST_INT
+ (unsigned) VOIDmode
;
1188 tem_hash
+= ((unsigned) CONST_INT
<< 7) + (unsigned HOST_WIDE_INT
) c
;
1190 tem_hash
= (unsigned int) CONST_INT
;
1192 return hash
? hash
: 1 + (unsigned int) PLUS
;
1195 /* Hash an rtx. Return 0 if we couldn't hash the rtx.
1196 For registers and memory locations, we look up their cselib_val structure
1197 and return its VALUE element.
1198 Possible reasons for return 0 are: the object is volatile, or we couldn't
1199 find a register or memory location in the table and CREATE is zero. If
1200 CREATE is nonzero, table elts are created for regs and mem.
1201 N.B. this hash function returns the same hash value for RTXes that
1202 differ only in the order of operands, thus it is suitable for comparisons
1203 that take commutativity into account.
1204 If we wanted to also support associative rules, we'd have to use a different
1205 strategy to avoid returning spurious 0, e.g. return ~(~0U >> 1) .
1206 MEMMODE indicates the mode of an enclosing MEM, and it's only
1207 used to compute autoinc values.
1208 We used to have a MODE argument for hashing for CONST_INTs, but that
1209 didn't make sense, since it caused spurious hash differences between
1210 (set (reg:SI 1) (const_int))
1211 (plus:SI (reg:SI 2) (reg:SI 1))
1213 (plus:SI (reg:SI 2) (const_int))
1214 If the mode is important in any context, it must be checked specifically
1215 in a comparison anyway, since relying on hash differences is unsafe. */
1218 cselib_hash_rtx (rtx x
, int create
, machine_mode memmode
)
1225 unsigned int hash
= 0;
1227 code
= GET_CODE (x
);
1228 hash
+= (unsigned) code
+ (unsigned) GET_MODE (x
);
1233 e
= CSELIB_VAL_PTR (x
);
1238 e
= cselib_lookup (x
, GET_MODE (x
), create
, memmode
);
1245 hash
+= ((unsigned) DEBUG_EXPR
<< 7)
1246 + DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x
));
1247 return hash
? hash
: (unsigned int) DEBUG_EXPR
;
1249 case DEBUG_IMPLICIT_PTR
:
1250 hash
+= ((unsigned) DEBUG_IMPLICIT_PTR
<< 7)
1251 + DECL_UID (DEBUG_IMPLICIT_PTR_DECL (x
));
1252 return hash
? hash
: (unsigned int) DEBUG_IMPLICIT_PTR
;
1254 case DEBUG_PARAMETER_REF
:
1255 hash
+= ((unsigned) DEBUG_PARAMETER_REF
<< 7)
1256 + DECL_UID (DEBUG_PARAMETER_REF_DECL (x
));
1257 return hash
? hash
: (unsigned int) DEBUG_PARAMETER_REF
;
1260 /* ENTRY_VALUEs are function invariant, thus try to avoid
1261 recursing on argument if ENTRY_VALUE is one of the
1262 forms emitted by expand_debug_expr, otherwise
1263 ENTRY_VALUE hash would depend on the current value
1264 in some register or memory. */
1265 if (REG_P (ENTRY_VALUE_EXP (x
)))
1266 hash
+= (unsigned int) REG
1267 + (unsigned int) GET_MODE (ENTRY_VALUE_EXP (x
))
1268 + (unsigned int) REGNO (ENTRY_VALUE_EXP (x
));
1269 else if (MEM_P (ENTRY_VALUE_EXP (x
))
1270 && REG_P (XEXP (ENTRY_VALUE_EXP (x
), 0)))
1271 hash
+= (unsigned int) MEM
1272 + (unsigned int) GET_MODE (XEXP (ENTRY_VALUE_EXP (x
), 0))
1273 + (unsigned int) REGNO (XEXP (ENTRY_VALUE_EXP (x
), 0));
1275 hash
+= cselib_hash_rtx (ENTRY_VALUE_EXP (x
), create
, memmode
);
1276 return hash
? hash
: (unsigned int) ENTRY_VALUE
;
1279 hash
+= ((unsigned) CONST_INT
<< 7) + UINTVAL (x
);
1280 return hash
? hash
: (unsigned int) CONST_INT
;
1282 case CONST_WIDE_INT
:
1283 for (i
= 0; i
< CONST_WIDE_INT_NUNITS (x
); i
++)
1284 hash
+= CONST_WIDE_INT_ELT (x
, i
);
1287 case CONST_POLY_INT
:
1291 for (unsigned int i
= 0; i
< NUM_POLY_INT_COEFFS
; ++i
)
1292 h
.add_wide_int (CONST_POLY_INT_COEFFS (x
)[i
]);
1297 /* This is like the general case, except that it only counts
1298 the integers representing the constant. */
1299 hash
+= (unsigned) code
+ (unsigned) GET_MODE (x
);
1300 if (TARGET_SUPPORTS_WIDE_INT
== 0 && GET_MODE (x
) == VOIDmode
)
1301 hash
+= ((unsigned) CONST_DOUBLE_LOW (x
)
1302 + (unsigned) CONST_DOUBLE_HIGH (x
));
1304 hash
+= real_hash (CONST_DOUBLE_REAL_VALUE (x
));
1305 return hash
? hash
: (unsigned int) CONST_DOUBLE
;
1308 hash
+= (unsigned int) code
+ (unsigned int) GET_MODE (x
);
1309 hash
+= fixed_hash (CONST_FIXED_VALUE (x
));
1310 return hash
? hash
: (unsigned int) CONST_FIXED
;
1317 units
= const_vector_encoded_nelts (x
);
1319 for (i
= 0; i
< units
; ++i
)
1321 elt
= CONST_VECTOR_ENCODED_ELT (x
, i
);
1322 hash
+= cselib_hash_rtx (elt
, 0, memmode
);
1328 /* Assume there is only one rtx object for any given label. */
1330 /* We don't hash on the address of the CODE_LABEL to avoid bootstrap
1331 differences and differences between each stage's debugging dumps. */
1332 hash
+= (((unsigned int) LABEL_REF
<< 7)
1333 + CODE_LABEL_NUMBER (label_ref_label (x
)));
1334 return hash
? hash
: (unsigned int) LABEL_REF
;
1338 /* Don't hash on the symbol's address to avoid bootstrap differences.
1339 Different hash values may cause expressions to be recorded in
1340 different orders and thus different registers to be used in the
1341 final assembler. This also avoids differences in the dump files
1342 between various stages. */
1344 const unsigned char *p
= (const unsigned char *) XSTR (x
, 0);
1347 h
+= (h
<< 7) + *p
++; /* ??? revisit */
1349 hash
+= ((unsigned int) SYMBOL_REF
<< 7) + h
;
1350 return hash
? hash
: (unsigned int) SYMBOL_REF
;
1355 /* We can't compute these without knowing the MEM mode. */
1356 gcc_assert (memmode
!= VOIDmode
);
1357 offset
= GET_MODE_SIZE (memmode
);
1358 if (code
== PRE_DEC
)
1360 /* Adjust the hash so that (mem:MEMMODE (pre_* (reg))) hashes
1361 like (mem:MEMMODE (plus (reg) (const_int I))). */
1362 if (GET_MODE (x
) == Pmode
1363 && (REG_P (XEXP (x
, 0))
1364 || MEM_P (XEXP (x
, 0))
1365 || GET_CODE (XEXP (x
, 0)) == VALUE
))
1368 if (offset
.is_constant (&c
))
1369 return cselib_hash_plus_const_int (XEXP (x
, 0),
1370 trunc_int_for_mode (c
, Pmode
),
1373 hash
= ((unsigned) PLUS
+ (unsigned) GET_MODE (x
)
1374 + cselib_hash_rtx (XEXP (x
, 0), create
, memmode
)
1375 + cselib_hash_rtx (gen_int_mode (offset
, GET_MODE (x
)),
1377 return hash
? hash
: 1 + (unsigned) PLUS
;
1380 gcc_assert (memmode
!= VOIDmode
);
1381 return cselib_hash_rtx (XEXP (x
, 1), create
, memmode
);
1386 gcc_assert (memmode
!= VOIDmode
);
1387 return cselib_hash_rtx (XEXP (x
, 0), create
, memmode
);
1391 case UNSPEC_VOLATILE
:
1395 if (MEM_VOLATILE_P (x
))
1401 if (GET_MODE (x
) == Pmode
1402 && (REG_P (XEXP (x
, 0))
1403 || MEM_P (XEXP (x
, 0))
1404 || GET_CODE (XEXP (x
, 0)) == VALUE
)
1405 && CONST_INT_P (XEXP (x
, 1)))
1406 return cselib_hash_plus_const_int (XEXP (x
, 0), INTVAL (XEXP (x
, 1)),
1414 i
= GET_RTX_LENGTH (code
) - 1;
1415 fmt
= GET_RTX_FORMAT (code
);
1422 rtx tem
= XEXP (x
, i
);
1423 unsigned int tem_hash
= cselib_hash_rtx (tem
, create
, memmode
);
1432 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
1434 unsigned int tem_hash
1435 = cselib_hash_rtx (XVECEXP (x
, i
, j
), create
, memmode
);
1446 const unsigned char *p
= (const unsigned char *) XSTR (x
, i
);
1455 hash
+= XINT (x
, i
);
1459 hash
+= constant_lower_bound (SUBREG_BYTE (x
));
1472 return hash
? hash
: 1 + (unsigned int) GET_CODE (x
);
1475 /* Create a new value structure for VALUE and initialize it. The mode of the
1478 static inline cselib_val
*
1479 new_cselib_val (unsigned int hash
, machine_mode mode
, rtx x
)
1481 cselib_val
*e
= cselib_val_pool
.allocate ();
1484 gcc_assert (next_uid
);
1487 e
->uid
= next_uid
++;
1488 /* We use an alloc pool to allocate this RTL construct because it
1489 accounts for about 8% of the overall memory usage. We know
1490 precisely when we can have VALUE RTXen (when cselib is active)
1491 so we don't need to put them in garbage collected memory.
1492 ??? Why should a VALUE be an RTX in the first place? */
1493 e
->val_rtx
= (rtx_def
*) value_pool
.allocate ();
1494 memset (e
->val_rtx
, 0, RTX_HDR_SIZE
);
1495 PUT_CODE (e
->val_rtx
, VALUE
);
1496 PUT_MODE (e
->val_rtx
, mode
);
1497 CSELIB_VAL_PTR (e
->val_rtx
) = e
;
1500 e
->next_containing_mem
= 0;
1502 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
1504 fprintf (dump_file
, "cselib value %u:%u ", e
->uid
, hash
);
1505 if (flag_dump_noaddr
|| flag_dump_unnumbered
)
1506 fputs ("# ", dump_file
);
1508 fprintf (dump_file
, "%p ", (void*)e
);
1509 print_rtl_single (dump_file
, x
);
1510 fputc ('\n', dump_file
);
1516 /* ADDR_ELT is a value that is used as address. MEM_ELT is the value that
1517 contains the data at this address. X is a MEM that represents the
1518 value. Update the two value structures to represent this situation. */
1521 add_mem_for_addr (cselib_val
*addr_elt
, cselib_val
*mem_elt
, rtx x
)
1523 addr_elt
= canonical_cselib_val (addr_elt
);
1524 mem_elt
= canonical_cselib_val (mem_elt
);
1526 /* Avoid duplicates. */
1527 addr_space_t as
= MEM_ADDR_SPACE (x
);
1528 for (elt_loc_list
*l
= mem_elt
->locs
; l
; l
= l
->next
)
1530 && CSELIB_VAL_PTR (XEXP (l
->loc
, 0)) == addr_elt
1531 && MEM_ADDR_SPACE (l
->loc
) == as
)
1533 promote_debug_loc (l
);
1537 addr_elt
->addr_list
= new_elt_list (addr_elt
->addr_list
, mem_elt
);
1538 new_elt_loc_list (mem_elt
,
1539 replace_equiv_address_nv (x
, addr_elt
->val_rtx
));
1540 if (mem_elt
->next_containing_mem
== NULL
)
1542 mem_elt
->next_containing_mem
= first_containing_mem
;
1543 first_containing_mem
= mem_elt
;
1547 /* Subroutine of cselib_lookup. Return a value for X, which is a MEM rtx.
1548 If CREATE, make a new one if we haven't seen it before. */
1551 cselib_lookup_mem (rtx x
, int create
)
1553 machine_mode mode
= GET_MODE (x
);
1554 machine_mode addr_mode
;
1557 cselib_val
*mem_elt
;
1559 if (MEM_VOLATILE_P (x
) || mode
== BLKmode
1560 || !cselib_record_memory
1561 || (FLOAT_MODE_P (mode
) && flag_float_store
))
1564 addr_mode
= GET_MODE (XEXP (x
, 0));
1565 if (addr_mode
== VOIDmode
)
1568 /* Look up the value for the address. */
1569 addr
= cselib_lookup (XEXP (x
, 0), addr_mode
, create
, mode
);
1572 addr
= canonical_cselib_val (addr
);
1574 /* Find a value that describes a value of our mode at that address. */
1575 addr_space_t as
= MEM_ADDR_SPACE (x
);
1576 for (elt_list
*l
= addr
->addr_list
; l
; l
= l
->next
)
1577 if (GET_MODE (l
->elt
->val_rtx
) == mode
)
1579 for (elt_loc_list
*l2
= l
->elt
->locs
; l2
; l2
= l2
->next
)
1580 if (MEM_P (l2
->loc
) && MEM_ADDR_SPACE (l2
->loc
) == as
)
1582 promote_debug_loc (l
->elt
->locs
);
1590 mem_elt
= new_cselib_val (next_uid
, mode
, x
);
1591 add_mem_for_addr (addr
, mem_elt
, x
);
1592 slot
= cselib_find_slot (mode
, x
, mem_elt
->hash
, INSERT
, VOIDmode
);
1597 /* Search through the possible substitutions in P. We prefer a non reg
1598 substitution because this allows us to expand the tree further. If
1599 we find, just a reg, take the lowest regno. There may be several
1600 non-reg results, we just take the first one because they will all
1601 expand to the same place. */
1604 expand_loc (struct elt_loc_list
*p
, struct expand_value_data
*evd
,
1607 rtx reg_result
= NULL
;
1608 unsigned int regno
= UINT_MAX
;
1609 struct elt_loc_list
*p_in
= p
;
1611 for (; p
; p
= p
->next
)
1613 /* Return these right away to avoid returning stack pointer based
1614 expressions for frame pointer and vice versa, which is something
1615 that would confuse DSE. See the comment in cselib_expand_value_rtx_1
1616 for more details. */
1618 && (REGNO (p
->loc
) == STACK_POINTER_REGNUM
1619 || REGNO (p
->loc
) == FRAME_POINTER_REGNUM
1620 || REGNO (p
->loc
) == HARD_FRAME_POINTER_REGNUM
1621 || REGNO (p
->loc
) == cfa_base_preserved_regno
))
1623 /* Avoid infinite recursion trying to expand a reg into a
1625 if ((REG_P (p
->loc
))
1626 && (REGNO (p
->loc
) < regno
)
1627 && !bitmap_bit_p (evd
->regs_active
, REGNO (p
->loc
)))
1629 reg_result
= p
->loc
;
1630 regno
= REGNO (p
->loc
);
1632 /* Avoid infinite recursion and do not try to expand the
1634 else if (GET_CODE (p
->loc
) == VALUE
1635 && CSELIB_VAL_PTR (p
->loc
)->locs
== p_in
)
1637 else if (!REG_P (p
->loc
))
1640 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
1642 print_inline_rtx (dump_file
, p
->loc
, 0);
1643 fprintf (dump_file
, "\n");
1645 if (GET_CODE (p
->loc
) == LO_SUM
1646 && GET_CODE (XEXP (p
->loc
, 1)) == SYMBOL_REF
1648 && (note
= find_reg_note (p
->setting_insn
, REG_EQUAL
, NULL_RTX
))
1649 && XEXP (note
, 0) == XEXP (p
->loc
, 1))
1650 return XEXP (p
->loc
, 1);
1651 result
= cselib_expand_value_rtx_1 (p
->loc
, evd
, max_depth
- 1);
1658 if (regno
!= UINT_MAX
)
1661 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
1662 fprintf (dump_file
, "r%d\n", regno
);
1664 result
= cselib_expand_value_rtx_1 (reg_result
, evd
, max_depth
- 1);
1669 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
1673 print_inline_rtx (dump_file
, reg_result
, 0);
1674 fprintf (dump_file
, "\n");
1677 fprintf (dump_file
, "NULL\n");
1683 /* Forward substitute and expand an expression out to its roots.
1684 This is the opposite of common subexpression. Because local value
1685 numbering is such a weak optimization, the expanded expression is
1686 pretty much unique (not from a pointer equals point of view but
1687 from a tree shape point of view.
1689 This function returns NULL if the expansion fails. The expansion
1690 will fail if there is no value number for one of the operands or if
1691 one of the operands has been overwritten between the current insn
1692 and the beginning of the basic block. For instance x has no
1698 REGS_ACTIVE is a scratch bitmap that should be clear when passing in.
1699 It is clear on return. */
1702 cselib_expand_value_rtx (rtx orig
, bitmap regs_active
, int max_depth
)
1704 struct expand_value_data evd
;
1706 evd
.regs_active
= regs_active
;
1707 evd
.callback
= NULL
;
1708 evd
.callback_arg
= NULL
;
1711 return cselib_expand_value_rtx_1 (orig
, &evd
, max_depth
);
1714 /* Same as cselib_expand_value_rtx, but using a callback to try to
1715 resolve some expressions. The CB function should return ORIG if it
1716 can't or does not want to deal with a certain RTX. Any other
1717 return value, including NULL, will be used as the expansion for
1718 VALUE, without any further changes. */
1721 cselib_expand_value_rtx_cb (rtx orig
, bitmap regs_active
, int max_depth
,
1722 cselib_expand_callback cb
, void *data
)
1724 struct expand_value_data evd
;
1726 evd
.regs_active
= regs_active
;
1728 evd
.callback_arg
= data
;
1731 return cselib_expand_value_rtx_1 (orig
, &evd
, max_depth
);
1734 /* Similar to cselib_expand_value_rtx_cb, but no rtxs are actually copied
1735 or simplified. Useful to find out whether cselib_expand_value_rtx_cb
1736 would return NULL or non-NULL, without allocating new rtx. */
1739 cselib_dummy_expand_value_rtx_cb (rtx orig
, bitmap regs_active
, int max_depth
,
1740 cselib_expand_callback cb
, void *data
)
1742 struct expand_value_data evd
;
1744 evd
.regs_active
= regs_active
;
1746 evd
.callback_arg
= data
;
1749 return cselib_expand_value_rtx_1 (orig
, &evd
, max_depth
) != NULL
;
1752 /* Internal implementation of cselib_expand_value_rtx and
1753 cselib_expand_value_rtx_cb. */
1756 cselib_expand_value_rtx_1 (rtx orig
, struct expand_value_data
*evd
,
1762 const char *format_ptr
;
1765 code
= GET_CODE (orig
);
1767 /* For the context of dse, if we end up expand into a huge tree, we
1768 will not have a useful address, so we might as well just give up
1777 struct elt_list
*l
= REG_VALUES (REGNO (orig
));
1779 if (l
&& l
->elt
== NULL
)
1781 for (; l
; l
= l
->next
)
1782 if (GET_MODE (l
->elt
->val_rtx
) == GET_MODE (orig
))
1785 unsigned regno
= REGNO (orig
);
1787 /* The only thing that we are not willing to do (this
1788 is requirement of dse and if others potential uses
1789 need this function we should add a parm to control
1790 it) is that we will not substitute the
1791 STACK_POINTER_REGNUM, FRAME_POINTER or the
1794 These expansions confuses the code that notices that
1795 stores into the frame go dead at the end of the
1796 function and that the frame is not effected by calls
1797 to subroutines. If you allow the
1798 STACK_POINTER_REGNUM substitution, then dse will
1799 think that parameter pushing also goes dead which is
1800 wrong. If you allow the FRAME_POINTER or the
1801 HARD_FRAME_POINTER then you lose the opportunity to
1802 make the frame assumptions. */
1803 if (regno
== STACK_POINTER_REGNUM
1804 || regno
== FRAME_POINTER_REGNUM
1805 || regno
== HARD_FRAME_POINTER_REGNUM
1806 || regno
== cfa_base_preserved_regno
)
1809 bitmap_set_bit (evd
->regs_active
, regno
);
1811 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
1812 fprintf (dump_file
, "expanding: r%d into: ", regno
);
1814 result
= expand_loc (l
->elt
->locs
, evd
, max_depth
);
1815 bitmap_clear_bit (evd
->regs_active
, regno
);
1830 /* SCRATCH must be shared because they represent distinct values. */
1833 if (REG_P (XEXP (orig
, 0)) && HARD_REGISTER_NUM_P (REGNO (XEXP (orig
, 0))))
1838 if (shared_const_p (orig
))
1848 subreg
= evd
->callback (orig
, evd
->regs_active
, max_depth
,
1854 subreg
= cselib_expand_value_rtx_1 (SUBREG_REG (orig
), evd
,
1858 scopy
= simplify_gen_subreg (GET_MODE (orig
), subreg
,
1859 GET_MODE (SUBREG_REG (orig
)),
1860 SUBREG_BYTE (orig
));
1862 || (GET_CODE (scopy
) == SUBREG
1863 && !REG_P (SUBREG_REG (scopy
))
1864 && !MEM_P (SUBREG_REG (scopy
))))
1874 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
1876 fputs ("\nexpanding ", dump_file
);
1877 print_rtl_single (dump_file
, orig
);
1878 fputs (" into...", dump_file
);
1883 result
= evd
->callback (orig
, evd
->regs_active
, max_depth
,
1890 result
= expand_loc (CSELIB_VAL_PTR (orig
)->locs
, evd
, max_depth
);
1896 return evd
->callback (orig
, evd
->regs_active
, max_depth
,
1904 /* Copy the various flags, fields, and other information. We assume
1905 that all fields need copying, and then clear the fields that should
1906 not be copied. That is the sensible default behavior, and forces
1907 us to explicitly document why we are *not* copying a flag. */
1911 copy
= shallow_copy_rtx (orig
);
1913 format_ptr
= GET_RTX_FORMAT (code
);
1915 for (i
= 0; i
< GET_RTX_LENGTH (code
); i
++)
1916 switch (*format_ptr
++)
1919 if (XEXP (orig
, i
) != NULL
)
1921 rtx result
= cselib_expand_value_rtx_1 (XEXP (orig
, i
), evd
,
1926 XEXP (copy
, i
) = result
;
1932 if (XVEC (orig
, i
) != NULL
)
1935 XVEC (copy
, i
) = rtvec_alloc (XVECLEN (orig
, i
));
1936 for (j
= 0; j
< XVECLEN (orig
, i
); j
++)
1938 rtx result
= cselib_expand_value_rtx_1 (XVECEXP (orig
, i
, j
),
1939 evd
, max_depth
- 1);
1943 XVECEXP (copy
, i
, j
) = result
;
1957 /* These are left unchanged. */
1967 mode
= GET_MODE (copy
);
1968 /* If an operand has been simplified into CONST_INT, which doesn't
1969 have a mode and the mode isn't derivable from whole rtx's mode,
1970 try simplify_*_operation first with mode from original's operand
1971 and as a fallback wrap CONST_INT into gen_rtx_CONST. */
1973 switch (GET_RTX_CLASS (code
))
1976 if (CONST_INT_P (XEXP (copy
, 0))
1977 && GET_MODE (XEXP (orig
, 0)) != VOIDmode
)
1979 scopy
= simplify_unary_operation (code
, mode
, XEXP (copy
, 0),
1980 GET_MODE (XEXP (orig
, 0)));
1985 case RTX_COMM_ARITH
:
1987 /* These expressions can derive operand modes from the whole rtx's mode. */
1990 case RTX_BITFIELD_OPS
:
1991 if (CONST_INT_P (XEXP (copy
, 0))
1992 && GET_MODE (XEXP (orig
, 0)) != VOIDmode
)
1994 scopy
= simplify_ternary_operation (code
, mode
,
1995 GET_MODE (XEXP (orig
, 0)),
1996 XEXP (copy
, 0), XEXP (copy
, 1),
2003 case RTX_COMM_COMPARE
:
2004 if (CONST_INT_P (XEXP (copy
, 0))
2005 && GET_MODE (XEXP (copy
, 1)) == VOIDmode
2006 && (GET_MODE (XEXP (orig
, 0)) != VOIDmode
2007 || GET_MODE (XEXP (orig
, 1)) != VOIDmode
))
2009 scopy
= simplify_relational_operation (code
, mode
,
2010 (GET_MODE (XEXP (orig
, 0))
2012 ? GET_MODE (XEXP (orig
, 0))
2013 : GET_MODE (XEXP (orig
, 1)),
2023 scopy
= simplify_rtx (copy
);
2029 /* Walk rtx X and replace all occurrences of REG and MEM subexpressions
2030 with VALUE expressions. This way, it becomes independent of changes
2031 to registers and memory.
2032 X isn't actually modified; if modifications are needed, new rtl is
2033 allocated. However, the return value can share rtl with X.
2034 If X is within a MEM, MEMMODE must be the mode of the MEM. */
2037 cselib_subst_to_values (rtx x
, machine_mode memmode
)
2039 enum rtx_code code
= GET_CODE (x
);
2040 const char *fmt
= GET_RTX_FORMAT (code
);
2050 l
= REG_VALUES (REGNO (x
));
2051 if (l
&& l
->elt
== NULL
)
2053 for (; l
; l
= l
->next
)
2054 if (GET_MODE (l
->elt
->val_rtx
) == GET_MODE (x
))
2055 return l
->elt
->val_rtx
;
2060 e
= cselib_lookup_mem (x
, 0);
2061 /* This used to happen for autoincrements, but we deal with them
2062 properly now. Remove the if stmt for the next release. */
2065 /* Assign a value that doesn't match any other. */
2066 e
= new_cselib_val (next_uid
, GET_MODE (x
), x
);
2071 e
= cselib_lookup (x
, GET_MODE (x
), 0, memmode
);
2081 gcc_assert (memmode
!= VOIDmode
);
2082 offset
= GET_MODE_SIZE (memmode
);
2083 if (code
== PRE_DEC
)
2085 return cselib_subst_to_values (plus_constant (GET_MODE (x
),
2086 XEXP (x
, 0), offset
),
2090 gcc_assert (memmode
!= VOIDmode
);
2091 return cselib_subst_to_values (XEXP (x
, 1), memmode
);
2096 gcc_assert (memmode
!= VOIDmode
);
2097 return cselib_subst_to_values (XEXP (x
, 0), memmode
);
2100 if (GET_MODE (x
) == Pmode
&& CONST_INT_P (XEXP (x
, 1)))
2102 rtx t
= cselib_subst_to_values (XEXP (x
, 0), memmode
);
2103 if (GET_CODE (t
) == VALUE
)
2105 if (SP_DERIVED_VALUE_P (t
) && XEXP (x
, 1) == const0_rtx
)
2107 for (struct elt_loc_list
*l
= CSELIB_VAL_PTR (t
)->locs
;
2109 if (GET_CODE (l
->loc
) == PLUS
2110 && GET_CODE (XEXP (l
->loc
, 0)) == VALUE
2111 && SP_DERIVED_VALUE_P (XEXP (l
->loc
, 0))
2112 && CONST_INT_P (XEXP (l
->loc
, 1)))
2113 return plus_constant (Pmode
, l
->loc
, INTVAL (XEXP (x
, 1)));
2115 if (t
!= XEXP (x
, 0))
2117 copy
= shallow_copy_rtx (x
);
2127 for (i
= GET_RTX_LENGTH (code
) - 1; i
>= 0; i
--)
2131 rtx t
= cselib_subst_to_values (XEXP (x
, i
), memmode
);
2133 if (t
!= XEXP (x
, i
))
2136 copy
= shallow_copy_rtx (x
);
2140 else if (fmt
[i
] == 'E')
2144 for (j
= 0; j
< XVECLEN (x
, i
); j
++)
2146 rtx t
= cselib_subst_to_values (XVECEXP (x
, i
, j
), memmode
);
2148 if (t
!= XVECEXP (x
, i
, j
))
2150 if (XVEC (x
, i
) == XVEC (copy
, i
))
2153 copy
= shallow_copy_rtx (x
);
2154 XVEC (copy
, i
) = shallow_copy_rtvec (XVEC (x
, i
));
2156 XVECEXP (copy
, i
, j
) = t
;
2165 /* Wrapper for cselib_subst_to_values, that indicates X is in INSN. */
2168 cselib_subst_to_values_from_insn (rtx x
, machine_mode memmode
, rtx_insn
*insn
)
2171 gcc_assert (!cselib_current_insn
);
2172 cselib_current_insn
= insn
;
2173 ret
= cselib_subst_to_values (x
, memmode
);
2174 cselib_current_insn
= NULL
;
2178 /* Look up the rtl expression X in our tables and return the value it
2179 has. If CREATE is zero, we return NULL if we don't know the value.
2180 Otherwise, we create a new one if possible, using mode MODE if X
2181 doesn't have a mode (i.e. because it's a constant). When X is part
2182 of an address, MEMMODE should be the mode of the enclosing MEM if
2183 we're tracking autoinc expressions. */
2186 cselib_lookup_1 (rtx x
, machine_mode mode
,
2187 int create
, machine_mode memmode
)
2191 unsigned int hashval
;
2193 if (GET_MODE (x
) != VOIDmode
)
2194 mode
= GET_MODE (x
);
2196 if (GET_CODE (x
) == VALUE
)
2197 return CSELIB_VAL_PTR (x
);
2202 unsigned int i
= REGNO (x
);
2205 if (l
&& l
->elt
== NULL
)
2207 for (; l
; l
= l
->next
)
2208 if (mode
== GET_MODE (l
->elt
->val_rtx
))
2210 promote_debug_loc (l
->elt
->locs
);
2217 if (i
< FIRST_PSEUDO_REGISTER
)
2219 unsigned int n
= hard_regno_nregs (i
, mode
);
2221 if (n
> max_value_regs
)
2225 e
= new_cselib_val (next_uid
, GET_MODE (x
), x
);
2226 if (GET_MODE (x
) == Pmode
&& x
== stack_pointer_rtx
)
2227 SP_DERIVED_VALUE_P (e
->val_rtx
) = 1;
2228 new_elt_loc_list (e
, x
);
2230 scalar_int_mode int_mode
;
2231 if (REG_VALUES (i
) == 0)
2233 /* Maintain the invariant that the first entry of
2234 REG_VALUES, if present, must be the value used to set the
2235 register, or NULL. */
2236 used_regs
[n_used_regs
++] = i
;
2237 REG_VALUES (i
) = new_elt_list (REG_VALUES (i
), NULL
);
2239 else if (cselib_preserve_constants
2240 && is_int_mode (mode
, &int_mode
))
2242 /* During var-tracking, try harder to find equivalences
2243 for SUBREGs. If a setter sets say a DImode register
2244 and user uses that register only in SImode, add a lowpart
2246 struct elt_list
*lwider
= NULL
;
2247 scalar_int_mode lmode
;
2249 if (l
&& l
->elt
== NULL
)
2251 for (; l
; l
= l
->next
)
2252 if (is_int_mode (GET_MODE (l
->elt
->val_rtx
), &lmode
)
2253 && GET_MODE_SIZE (lmode
) > GET_MODE_SIZE (int_mode
)
2255 || partial_subreg_p (lmode
,
2256 GET_MODE (lwider
->elt
->val_rtx
))))
2258 struct elt_loc_list
*el
;
2259 if (i
< FIRST_PSEUDO_REGISTER
2260 && hard_regno_nregs (i
, lmode
) != 1)
2262 for (el
= l
->elt
->locs
; el
; el
= el
->next
)
2263 if (!REG_P (el
->loc
))
2270 rtx sub
= lowpart_subreg (int_mode
, lwider
->elt
->val_rtx
,
2271 GET_MODE (lwider
->elt
->val_rtx
));
2273 new_elt_loc_list (e
, sub
);
2276 REG_VALUES (i
)->next
= new_elt_list (REG_VALUES (i
)->next
, e
);
2277 slot
= cselib_find_slot (mode
, x
, e
->hash
, INSERT
, memmode
);
2283 return cselib_lookup_mem (x
, create
);
2285 hashval
= cselib_hash_rtx (x
, create
, memmode
);
2286 /* Can't even create if hashing is not possible. */
2290 slot
= cselib_find_slot (mode
, x
, hashval
,
2291 create
? INSERT
: NO_INSERT
, memmode
);
2295 e
= (cselib_val
*) *slot
;
2299 e
= new_cselib_val (hashval
, mode
, x
);
2301 /* We have to fill the slot before calling cselib_subst_to_values:
2302 the hash table is inconsistent until we do so, and
2303 cselib_subst_to_values will need to do lookups. */
2305 rtx v
= cselib_subst_to_values (x
, memmode
);
2307 /* If cselib_preserve_constants, we might get a SP_DERIVED_VALUE_P
2308 VALUE that isn't in the hash tables anymore. */
2309 if (GET_CODE (v
) == VALUE
&& SP_DERIVED_VALUE_P (v
) && PRESERVED_VALUE_P (v
))
2310 PRESERVED_VALUE_P (e
->val_rtx
) = 1;
2312 new_elt_loc_list (e
, v
);
2316 /* Wrapper for cselib_lookup, that indicates X is in INSN. */
2319 cselib_lookup_from_insn (rtx x
, machine_mode mode
,
2320 int create
, machine_mode memmode
, rtx_insn
*insn
)
2324 gcc_assert (!cselib_current_insn
);
2325 cselib_current_insn
= insn
;
2327 ret
= cselib_lookup (x
, mode
, create
, memmode
);
2329 cselib_current_insn
= NULL
;
2334 /* Wrapper for cselib_lookup_1, that logs the lookup result and
2335 maintains invariants related with debug insns. */
2338 cselib_lookup (rtx x
, machine_mode mode
,
2339 int create
, machine_mode memmode
)
2341 cselib_val
*ret
= cselib_lookup_1 (x
, mode
, create
, memmode
);
2343 /* ??? Should we return NULL if we're not to create an entry, the
2344 found loc is a debug loc and cselib_current_insn is not DEBUG?
2345 If so, we should also avoid converting val to non-DEBUG; probably
2346 easiest setting cselib_current_insn to NULL before the call
2349 if (dump_file
&& (dump_flags
& TDF_CSELIB
))
2351 fputs ("cselib lookup ", dump_file
);
2352 print_inline_rtx (dump_file
, x
, 2);
2353 fprintf (dump_file
, " => %u:%u\n",
2355 ret
? ret
->hash
: 0);
2361 /* Invalidate the value at *L, which is part of REG_VALUES (REGNO). */
2364 cselib_invalidate_regno_val (unsigned int regno
, struct elt_list
**l
)
2366 cselib_val
*v
= (*l
)->elt
;
2367 if (*l
== REG_VALUES (regno
))
2369 /* Maintain the invariant that the first entry of
2370 REG_VALUES, if present, must be the value used to set
2371 the register, or NULL. This is also nice because
2372 then we won't push the same regno onto user_regs
2378 unchain_one_elt_list (l
);
2380 v
= canonical_cselib_val (v
);
2382 bool had_locs
= v
->locs
!= NULL
;
2383 rtx_insn
*setting_insn
= v
->locs
? v
->locs
->setting_insn
: NULL
;
2385 /* Now, we clear the mapping from value to reg. It must exist, so
2386 this code will crash intentionally if it doesn't. */
2387 for (elt_loc_list
**p
= &v
->locs
; ; p
= &(*p
)->next
)
2391 if (REG_P (x
) && REGNO (x
) == regno
)
2393 unchain_one_elt_loc_list (p
);
2398 if (had_locs
&& cselib_useless_value_p (v
))
2400 if (setting_insn
&& DEBUG_INSN_P (setting_insn
))
2401 n_useless_debug_values
++;
2407 /* Invalidate any entries in reg_values that overlap REGNO. This is called
2408 if REGNO is changing. MODE is the mode of the assignment to REGNO, which
2409 is used to determine how many hard registers are being changed. If MODE
2410 is VOIDmode, then only REGNO is being changed; this is used when
2411 invalidating call clobbered registers across a call. */
2414 cselib_invalidate_regno (unsigned int regno
, machine_mode mode
)
2416 unsigned int endregno
;
2419 /* If we see pseudos after reload, something is _wrong_. */
2420 gcc_assert (!reload_completed
|| regno
< FIRST_PSEUDO_REGISTER
2421 || reg_renumber
[regno
] < 0);
2423 /* Determine the range of registers that must be invalidated. For
2424 pseudos, only REGNO is affected. For hard regs, we must take MODE
2425 into account, and we must also invalidate lower register numbers
2426 if they contain values that overlap REGNO. */
2427 if (regno
< FIRST_PSEUDO_REGISTER
)
2429 gcc_assert (mode
!= VOIDmode
);
2431 if (regno
< max_value_regs
)
2434 i
= regno
- max_value_regs
;
2436 endregno
= end_hard_regno (mode
, regno
);
2441 endregno
= regno
+ 1;
2444 for (; i
< endregno
; i
++)
2446 struct elt_list
**l
= ®_VALUES (i
);
2448 /* Go through all known values for this reg; if it overlaps the range
2449 we're invalidating, remove the value. */
2452 cselib_val
*v
= (*l
)->elt
;
2453 unsigned int this_last
= i
;
2455 if (i
< FIRST_PSEUDO_REGISTER
&& v
!= NULL
)
2456 this_last
= end_hard_regno (GET_MODE (v
->val_rtx
), i
) - 1;
2458 if (this_last
< regno
|| v
== NULL
2459 || (v
== cfa_base_preserved_val
2460 && i
== cfa_base_preserved_regno
))
2466 /* We have an overlap. */
2467 cselib_invalidate_regno_val (i
, l
);
2472 /* Invalidate any locations in the table which are changed because of a
2473 store to MEM_RTX. If this is called because of a non-const call
2474 instruction, MEM_RTX is (mem:BLK const0_rtx). */
2477 cselib_invalidate_mem (rtx mem_rtx
)
2479 cselib_val
**vp
, *v
, *next
;
2483 mem_addr
= canon_rtx (get_addr (XEXP (mem_rtx
, 0)));
2484 mem_rtx
= canon_rtx (mem_rtx
);
2486 vp
= &first_containing_mem
;
2487 for (v
= *vp
; v
!= &dummy_val
; v
= next
)
2489 bool has_mem
= false;
2490 struct elt_loc_list
**p
= &v
->locs
;
2491 bool had_locs
= v
->locs
!= NULL
;
2492 rtx_insn
*setting_insn
= v
->locs
? v
->locs
->setting_insn
: NULL
;
2498 struct elt_list
**mem_chain
;
2500 /* MEMs may occur in locations only at the top level; below
2501 that every MEM or REG is substituted by its VALUE. */
2507 if (num_mems
< param_max_cselib_memory_locations
2508 && ! canon_anti_dependence (x
, false, mem_rtx
,
2509 GET_MODE (mem_rtx
), mem_addr
))
2517 /* This one overlaps. */
2518 /* We must have a mapping from this MEM's address to the
2519 value (E). Remove that, too. */
2520 addr
= cselib_lookup (XEXP (x
, 0), VOIDmode
, 0, GET_MODE (x
));
2521 addr
= canonical_cselib_val (addr
);
2522 gcc_checking_assert (v
== canonical_cselib_val (v
));
2523 mem_chain
= &addr
->addr_list
;
2526 cselib_val
*canon
= canonical_cselib_val ((*mem_chain
)->elt
);
2530 unchain_one_elt_list (mem_chain
);
2534 /* Record canonicalized elt. */
2535 (*mem_chain
)->elt
= canon
;
2537 mem_chain
= &(*mem_chain
)->next
;
2540 unchain_one_elt_loc_list (p
);
2543 if (had_locs
&& cselib_useless_value_p (v
))
2545 if (setting_insn
&& DEBUG_INSN_P (setting_insn
))
2546 n_useless_debug_values
++;
2551 next
= v
->next_containing_mem
;
2555 vp
= &(*vp
)->next_containing_mem
;
2558 v
->next_containing_mem
= NULL
;
2563 /* Invalidate DEST. */
2566 cselib_invalidate_rtx (rtx dest
)
2568 while (GET_CODE (dest
) == SUBREG
2569 || GET_CODE (dest
) == ZERO_EXTRACT
2570 || GET_CODE (dest
) == STRICT_LOW_PART
)
2571 dest
= XEXP (dest
, 0);
2574 cselib_invalidate_regno (REGNO (dest
), GET_MODE (dest
));
2575 else if (MEM_P (dest
))
2576 cselib_invalidate_mem (dest
);
2579 /* A wrapper for cselib_invalidate_rtx to be called via note_stores. */
2582 cselib_invalidate_rtx_note_stores (rtx dest
, const_rtx
,
2583 void *data ATTRIBUTE_UNUSED
)
2585 cselib_invalidate_rtx (dest
);
2588 /* Record the result of a SET instruction. DEST is being set; the source
2589 contains the value described by SRC_ELT. If DEST is a MEM, DEST_ADDR_ELT
2590 describes its address. */
2593 cselib_record_set (rtx dest
, cselib_val
*src_elt
, cselib_val
*dest_addr_elt
)
2595 if (src_elt
== 0 || side_effects_p (dest
))
2600 unsigned int dreg
= REGNO (dest
);
2601 if (dreg
< FIRST_PSEUDO_REGISTER
)
2603 unsigned int n
= REG_NREGS (dest
);
2605 if (n
> max_value_regs
)
2609 if (REG_VALUES (dreg
) == 0)
2611 used_regs
[n_used_regs
++] = dreg
;
2612 REG_VALUES (dreg
) = new_elt_list (REG_VALUES (dreg
), src_elt
);
2616 /* The register should have been invalidated. */
2617 gcc_assert (REG_VALUES (dreg
)->elt
== 0);
2618 REG_VALUES (dreg
)->elt
= src_elt
;
2621 if (cselib_useless_value_p (src_elt
))
2623 new_elt_loc_list (src_elt
, dest
);
2625 else if (MEM_P (dest
) && dest_addr_elt
!= 0
2626 && cselib_record_memory
)
2628 if (cselib_useless_value_p (src_elt
))
2630 add_mem_for_addr (dest_addr_elt
, src_elt
, dest
);
2634 /* Make ELT and X's VALUE equivalent to each other at INSN. */
2637 cselib_add_permanent_equiv (cselib_val
*elt
, rtx x
, rtx_insn
*insn
)
2640 rtx_insn
*save_cselib_current_insn
= cselib_current_insn
;
2642 gcc_checking_assert (elt
);
2643 gcc_checking_assert (PRESERVED_VALUE_P (elt
->val_rtx
));
2644 gcc_checking_assert (!side_effects_p (x
));
2646 cselib_current_insn
= insn
;
2648 nelt
= cselib_lookup (x
, GET_MODE (elt
->val_rtx
), 1, VOIDmode
);
2652 cselib_any_perm_equivs
= true;
2654 if (!PRESERVED_VALUE_P (nelt
->val_rtx
))
2655 cselib_preserve_value (nelt
);
2657 new_elt_loc_list (nelt
, elt
->val_rtx
);
2660 cselib_current_insn
= save_cselib_current_insn
;
2663 /* Return TRUE if any permanent equivalences have been recorded since
2664 the table was last initialized. */
2666 cselib_have_permanent_equivalences (void)
2668 return cselib_any_perm_equivs
;
2671 /* Record stack_pointer_rtx to be equal to
2672 (plus:P cfa_base_preserved_val offset). Used by var-tracking
2673 at the start of basic blocks for !frame_pointer_needed functions. */
2676 cselib_record_sp_cfa_base_equiv (HOST_WIDE_INT offset
, rtx_insn
*insn
)
2678 rtx sp_derived_value
= NULL_RTX
;
2679 for (struct elt_loc_list
*l
= cfa_base_preserved_val
->locs
; l
; l
= l
->next
)
2680 if (GET_CODE (l
->loc
) == VALUE
2681 && SP_DERIVED_VALUE_P (l
->loc
))
2683 sp_derived_value
= l
->loc
;
2686 else if (GET_CODE (l
->loc
) == PLUS
2687 && GET_CODE (XEXP (l
->loc
, 0)) == VALUE
2688 && SP_DERIVED_VALUE_P (XEXP (l
->loc
, 0))
2689 && CONST_INT_P (XEXP (l
->loc
, 1)))
2691 sp_derived_value
= XEXP (l
->loc
, 0);
2692 offset
= offset
+ UINTVAL (XEXP (l
->loc
, 1));
2695 if (sp_derived_value
== NULL_RTX
)
2698 = cselib_lookup_from_insn (plus_constant (Pmode
, sp_derived_value
, offset
),
2699 Pmode
, 1, VOIDmode
, insn
);
2702 PRESERVED_VALUE_P (val
->val_rtx
) = 1;
2703 cselib_record_set (stack_pointer_rtx
, val
, NULL
);
2707 /* Return true if V is SP_DERIVED_VALUE_P (or SP_DERIVED_VALUE_P + CONST_INT)
2708 that can be expressed using cfa_base_preserved_val + CONST_INT. */
2711 cselib_sp_derived_value_p (cselib_val
*v
)
2713 if (!SP_DERIVED_VALUE_P (v
->val_rtx
))
2714 for (struct elt_loc_list
*l
= v
->locs
; l
; l
= l
->next
)
2715 if (GET_CODE (l
->loc
) == PLUS
2716 && GET_CODE (XEXP (l
->loc
, 0)) == VALUE
2717 && SP_DERIVED_VALUE_P (XEXP (l
->loc
, 0))
2718 && CONST_INT_P (XEXP (l
->loc
, 1)))
2719 v
= CSELIB_VAL_PTR (XEXP (l
->loc
, 0));
2720 if (!SP_DERIVED_VALUE_P (v
->val_rtx
))
2722 for (struct elt_loc_list
*l
= v
->locs
; l
; l
= l
->next
)
2723 if (l
->loc
== cfa_base_preserved_val
->val_rtx
)
2725 else if (GET_CODE (l
->loc
) == PLUS
2726 && XEXP (l
->loc
, 0) == cfa_base_preserved_val
->val_rtx
2727 && CONST_INT_P (XEXP (l
->loc
, 1)))
2732 /* There is no good way to determine how many elements there can be
2733 in a PARALLEL. Since it's fairly cheap, use a really large number. */
2734 #define MAX_SETS (FIRST_PSEUDO_REGISTER * 2)
2736 struct cselib_record_autoinc_data
2738 struct cselib_set
*sets
;
2742 /* Callback for for_each_inc_dec. Records in ARG the SETs implied by
2743 autoinc RTXs: SRC plus SRCOFF if non-NULL is stored in DEST. */
2746 cselib_record_autoinc_cb (rtx mem ATTRIBUTE_UNUSED
, rtx op ATTRIBUTE_UNUSED
,
2747 rtx dest
, rtx src
, rtx srcoff
, void *arg
)
2749 struct cselib_record_autoinc_data
*data
;
2750 data
= (struct cselib_record_autoinc_data
*)arg
;
2752 data
->sets
[data
->n_sets
].dest
= dest
;
2755 data
->sets
[data
->n_sets
].src
= gen_rtx_PLUS (GET_MODE (src
), src
, srcoff
);
2757 data
->sets
[data
->n_sets
].src
= src
;
2764 /* Record the effects of any sets and autoincs in INSN. */
2766 cselib_record_sets (rtx_insn
*insn
)
2770 struct cselib_set sets
[MAX_SETS
];
2772 int n_sets_before_autoinc
;
2773 int n_strict_low_parts
= 0;
2774 struct cselib_record_autoinc_data data
;
2776 rtx body
= PATTERN (insn
);
2777 if (GET_CODE (body
) == COND_EXEC
)
2779 cond
= COND_EXEC_TEST (body
);
2780 body
= COND_EXEC_CODE (body
);
2783 /* Find all sets. */
2784 if (GET_CODE (body
) == SET
)
2786 sets
[0].src
= SET_SRC (body
);
2787 sets
[0].dest
= SET_DEST (body
);
2790 else if (GET_CODE (body
) == PARALLEL
)
2792 /* Look through the PARALLEL and record the values being
2793 set, if possible. Also handle any CLOBBERs. */
2794 for (i
= XVECLEN (body
, 0) - 1; i
>= 0; --i
)
2796 rtx x
= XVECEXP (body
, 0, i
);
2798 if (GET_CODE (x
) == SET
)
2800 sets
[n_sets
].src
= SET_SRC (x
);
2801 sets
[n_sets
].dest
= SET_DEST (x
);
2808 && MEM_P (sets
[0].src
)
2809 && !cselib_record_memory
2810 && MEM_READONLY_P (sets
[0].src
))
2812 rtx note
= find_reg_equal_equiv_note (insn
);
2814 if (note
&& CONSTANT_P (XEXP (note
, 0)))
2815 sets
[0].src
= XEXP (note
, 0);
2819 data
.n_sets
= n_sets_before_autoinc
= n_sets
;
2820 for_each_inc_dec (PATTERN (insn
), cselib_record_autoinc_cb
, &data
);
2821 n_sets
= data
.n_sets
;
2823 /* Look up the values that are read. Do this before invalidating the
2824 locations that are written. */
2825 for (i
= 0; i
< n_sets
; i
++)
2827 rtx dest
= sets
[i
].dest
;
2830 /* A STRICT_LOW_PART can be ignored; we'll record the equivalence for
2831 the low part after invalidating any knowledge about larger modes. */
2832 if (GET_CODE (sets
[i
].dest
) == STRICT_LOW_PART
)
2833 sets
[i
].dest
= dest
= XEXP (dest
, 0);
2835 /* We don't know how to record anything but REG or MEM. */
2837 || (MEM_P (dest
) && cselib_record_memory
))
2839 rtx src
= sets
[i
].src
;
2841 src
= gen_rtx_IF_THEN_ELSE (GET_MODE (dest
), cond
, src
, dest
);
2842 sets
[i
].src_elt
= cselib_lookup (src
, GET_MODE (dest
), 1, VOIDmode
);
2845 machine_mode address_mode
= get_address_mode (dest
);
2847 sets
[i
].dest_addr_elt
= cselib_lookup (XEXP (dest
, 0),
2852 sets
[i
].dest_addr_elt
= 0;
2855 /* Improve handling of STRICT_LOW_PART if the current value is known
2856 to be const0_rtx, then the low bits will be set to dest and higher
2857 bits will remain zero. Used in code like:
2859 {di:SI=0;clobber flags:CC;}
2860 flags:CCNO=cmp(bx:SI,0)
2861 strict_low_part(di:QI)=flags:CCNO<=0
2863 where we can note both that di:QI=flags:CCNO<=0 and
2864 also that because di:SI is known to be 0 and strict_low_part(di:QI)
2865 preserves the upper bits that di:SI=zero_extend(flags:CCNO<=0). */
2866 scalar_int_mode mode
;
2868 && cselib_record_sets_hook
2870 && HARD_REGISTER_P (dest
)
2872 && is_a
<scalar_int_mode
> (GET_MODE (dest
), &mode
)
2873 && n_sets
+ n_strict_low_parts
< MAX_SETS
)
2875 opt_scalar_int_mode wider_mode_iter
;
2876 FOR_EACH_WIDER_MODE (wider_mode_iter
, mode
)
2878 scalar_int_mode wider_mode
= wider_mode_iter
.require ();
2879 if (GET_MODE_PRECISION (wider_mode
) > BITS_PER_WORD
)
2882 rtx reg
= gen_lowpart (wider_mode
, dest
);
2886 cselib_val
*v
= cselib_lookup (reg
, wider_mode
, 0, VOIDmode
);
2890 struct elt_loc_list
*l
;
2891 for (l
= v
->locs
; l
; l
= l
->next
)
2892 if (l
->loc
== const0_rtx
)
2898 sets
[n_sets
+ n_strict_low_parts
].dest
= reg
;
2899 sets
[n_sets
+ n_strict_low_parts
].src
= dest
;
2900 sets
[n_sets
+ n_strict_low_parts
++].src_elt
= sets
[i
].src_elt
;
2906 if (cselib_record_sets_hook
)
2907 cselib_record_sets_hook (insn
, sets
, n_sets
);
2909 /* Invalidate all locations written by this insn. Note that the elts we
2910 looked up in the previous loop aren't affected, just some of their
2911 locations may go away. */
2912 note_pattern_stores (body
, cselib_invalidate_rtx_note_stores
, NULL
);
2914 for (i
= n_sets_before_autoinc
; i
< n_sets
; i
++)
2915 cselib_invalidate_rtx (sets
[i
].dest
);
2917 /* If this is an asm, look for duplicate sets. This can happen when the
2918 user uses the same value as an output multiple times. This is valid
2919 if the outputs are not actually used thereafter. Treat this case as
2920 if the value isn't actually set. We do this by smashing the destination
2921 to pc_rtx, so that we won't record the value later. */
2922 if (n_sets
>= 2 && asm_noperands (body
) >= 0)
2924 for (i
= 0; i
< n_sets
; i
++)
2926 rtx dest
= sets
[i
].dest
;
2927 if (REG_P (dest
) || MEM_P (dest
))
2930 for (j
= i
+ 1; j
< n_sets
; j
++)
2931 if (rtx_equal_p (dest
, sets
[j
].dest
))
2933 sets
[i
].dest
= pc_rtx
;
2934 sets
[j
].dest
= pc_rtx
;
2940 /* Now enter the equivalences in our tables. */
2941 for (i
= 0; i
< n_sets
; i
++)
2943 rtx dest
= sets
[i
].dest
;
2945 || (MEM_P (dest
) && cselib_record_memory
))
2946 cselib_record_set (dest
, sets
[i
].src_elt
, sets
[i
].dest_addr_elt
);
2949 /* And deal with STRICT_LOW_PART. */
2950 for (i
= 0; i
< n_strict_low_parts
; i
++)
2952 if (! PRESERVED_VALUE_P (sets
[n_sets
+ i
].src_elt
->val_rtx
))
2954 machine_mode dest_mode
= GET_MODE (sets
[n_sets
+ i
].dest
);
2956 = cselib_lookup (sets
[n_sets
+ i
].dest
, dest_mode
, 1, VOIDmode
);
2957 cselib_preserve_value (v
);
2958 rtx r
= gen_rtx_ZERO_EXTEND (dest_mode
,
2959 sets
[n_sets
+ i
].src_elt
->val_rtx
);
2960 cselib_add_permanent_equiv (v
, r
, insn
);
2964 /* Return true if INSN in the prologue initializes hard_frame_pointer_rtx. */
2967 fp_setter_insn (rtx_insn
*insn
)
2969 rtx expr
, pat
= NULL_RTX
;
2971 if (!RTX_FRAME_RELATED_P (insn
))
2974 expr
= find_reg_note (insn
, REG_FRAME_RELATED_EXPR
, NULL_RTX
);
2976 pat
= XEXP (expr
, 0);
2977 if (!modified_in_p (hard_frame_pointer_rtx
, pat
? pat
: insn
))
2980 /* Don't return true for frame pointer restores in the epilogue. */
2981 if (find_reg_note (insn
, REG_CFA_RESTORE
, hard_frame_pointer_rtx
))
2986 /* V is one of the values in REG_VALUES (REGNO). Return true if it
2987 would be invalidated by CALLEE_ABI. */
2990 cselib_invalidated_by_call_p (const function_abi
&callee_abi
,
2991 unsigned int regno
, cselib_val
*v
)
2993 machine_mode mode
= GET_MODE (v
->val_rtx
);
2994 if (mode
== VOIDmode
)
2996 v
= REG_VALUES (regno
)->elt
;
2998 /* If we don't know what the mode of the constant value is, and we
2999 don't know what mode the register was set in, conservatively
3000 assume that the register is clobbered. The value's going to be
3001 essentially useless in this case anyway. */
3003 mode
= GET_MODE (v
->val_rtx
);
3005 return callee_abi
.clobbers_reg_p (mode
, regno
);
3008 /* Record the effects of INSN. */
3011 cselib_process_insn (rtx_insn
*insn
)
3016 cselib_current_insn
= insn
;
3018 /* Forget everything at a CODE_LABEL or a setjmp. */
3021 && find_reg_note (insn
, REG_SETJMP
, NULL
)))
3022 && !cselib_preserve_constants
)
3024 cselib_reset_table (next_uid
);
3025 cselib_current_insn
= NULL
;
3029 if (! INSN_P (insn
))
3031 cselib_current_insn
= NULL
;
3035 /* If this is a call instruction, forget anything stored in a
3036 call clobbered register, or, if this is not a const call, in
3040 function_abi callee_abi
= insn_callee_abi (insn
);
3041 for (i
= 0; i
< FIRST_PSEUDO_REGISTER
; i
++)
3043 elt_list
**l
= ®_VALUES (i
);
3046 cselib_val
*v
= (*l
)->elt
;
3047 if (v
&& cselib_invalidated_by_call_p (callee_abi
, i
, v
))
3048 cselib_invalidate_regno_val (i
, l
);
3054 /* Since it is not clear how cselib is going to be used, be
3055 conservative here and treat looping pure or const functions
3056 as if they were regular functions. */
3057 if (RTL_LOOPING_CONST_OR_PURE_CALL_P (insn
)
3058 || !(RTL_CONST_OR_PURE_CALL_P (insn
)))
3059 cselib_invalidate_mem (callmem
);
3061 /* For const/pure calls, invalidate any argument slots because
3062 they are owned by the callee. */
3063 for (x
= CALL_INSN_FUNCTION_USAGE (insn
); x
; x
= XEXP (x
, 1))
3064 if (GET_CODE (XEXP (x
, 0)) == USE
3065 && MEM_P (XEXP (XEXP (x
, 0), 0)))
3066 cselib_invalidate_mem (XEXP (XEXP (x
, 0), 0));
3069 cselib_record_sets (insn
);
3071 /* Look for any CLOBBERs in CALL_INSN_FUNCTION_USAGE, but only
3072 after we have processed the insn. */
3075 for (x
= CALL_INSN_FUNCTION_USAGE (insn
); x
; x
= XEXP (x
, 1))
3076 if (GET_CODE (XEXP (x
, 0)) == CLOBBER
)
3077 cselib_invalidate_rtx (XEXP (XEXP (x
, 0), 0));
3079 /* Flush everything on setjmp. */
3080 if (cselib_preserve_constants
3081 && find_reg_note (insn
, REG_SETJMP
, NULL
))
3083 cselib_preserve_only_values ();
3084 cselib_reset_table (next_uid
);
3088 /* On setter of the hard frame pointer if frame_pointer_needed,
3089 invalidate stack_pointer_rtx, so that sp and {,h}fp based
3090 VALUEs are distinct. */
3091 if (reload_completed
3092 && frame_pointer_needed
3093 && fp_setter_insn (insn
))
3094 cselib_invalidate_rtx (stack_pointer_rtx
);
3096 cselib_current_insn
= NULL
;
3098 if (n_useless_values
> MAX_USELESS_VALUES
3099 /* remove_useless_values is linear in the hash table size. Avoid
3100 quadratic behavior for very large hashtables with very few
3101 useless elements. */
3102 && ((unsigned int)n_useless_values
3103 > (cselib_hash_table
->elements () - n_debug_values
) / 4))
3104 remove_useless_values ();
3107 /* Initialize cselib for one pass. The caller must also call
3108 init_alias_analysis. */
3111 cselib_init (int record_what
)
3113 cselib_record_memory
= record_what
& CSELIB_RECORD_MEMORY
;
3114 cselib_preserve_constants
= record_what
& CSELIB_PRESERVE_CONSTANTS
;
3115 cselib_any_perm_equivs
= false;
3117 /* (mem:BLK (scratch)) is a special mechanism to conflict with everything,
3118 see canon_true_dependence. This is only created once. */
3120 callmem
= gen_rtx_MEM (BLKmode
, gen_rtx_SCRATCH (VOIDmode
));
3122 cselib_nregs
= max_reg_num ();
3124 /* We preserve reg_values to allow expensive clearing of the whole thing.
3125 Reallocate it however if it happens to be too large. */
3126 if (!reg_values
|| reg_values_size
< cselib_nregs
3127 || (reg_values_size
> 10 && reg_values_size
> cselib_nregs
* 4))
3130 /* Some space for newly emit instructions so we don't end up
3131 reallocating in between passes. */
3132 reg_values_size
= cselib_nregs
+ (63 + cselib_nregs
) / 16;
3133 reg_values
= XCNEWVEC (struct elt_list
*, reg_values_size
);
3135 used_regs
= XNEWVEC (unsigned int, cselib_nregs
);
3137 /* FIXME: enable sanitization (PR87845) */
3139 = new hash_table
<cselib_hasher
> (31, /* ggc */ false,
3140 /* sanitize_eq_and_hash */ false);
3141 if (cselib_preserve_constants
)
3142 cselib_preserved_hash_table
3143 = new hash_table
<cselib_hasher
> (31, /* ggc */ false,
3144 /* sanitize_eq_and_hash */ false);
3148 /* Called when the current user is done with cselib. */
3151 cselib_finish (void)
3153 bool preserved
= cselib_preserve_constants
;
3154 cselib_discard_hook
= NULL
;
3155 cselib_preserve_constants
= false;
3156 cselib_any_perm_equivs
= false;
3157 cfa_base_preserved_val
= NULL
;
3158 cfa_base_preserved_regno
= INVALID_REGNUM
;
3159 elt_list_pool
.release ();
3160 elt_loc_list_pool
.release ();
3161 cselib_val_pool
.release ();
3162 value_pool
.release ();
3163 cselib_clear_table ();
3164 delete cselib_hash_table
;
3165 cselib_hash_table
= NULL
;
3167 delete cselib_preserved_hash_table
;
3168 cselib_preserved_hash_table
= NULL
;
3171 n_useless_values
= 0;
3172 n_useless_debug_values
= 0;
3177 /* Dump the cselib_val *X to FILE *OUT. */
3180 dump_cselib_val (cselib_val
**x
, FILE *out
)
3183 bool need_lf
= true;
3185 print_inline_rtx (out
, v
->val_rtx
, 0);
3189 struct elt_loc_list
*l
= v
->locs
;
3195 fputs (" locs:", out
);
3198 if (l
->setting_insn
)
3199 fprintf (out
, "\n from insn %i ",
3200 INSN_UID (l
->setting_insn
));
3202 fprintf (out
, "\n ");
3203 print_inline_rtx (out
, l
->loc
, 4);
3205 while ((l
= l
->next
));
3210 fputs (" no locs", out
);
3216 struct elt_list
*e
= v
->addr_list
;
3222 fputs (" addr list:", out
);
3226 print_inline_rtx (out
, e
->elt
->val_rtx
, 2);
3228 while ((e
= e
->next
));
3233 fputs (" no addrs", out
);
3237 if (v
->next_containing_mem
== &dummy_val
)
3238 fputs (" last mem\n", out
);
3239 else if (v
->next_containing_mem
)
3241 fputs (" next mem ", out
);
3242 print_inline_rtx (out
, v
->next_containing_mem
->val_rtx
, 2);
3251 /* Dump to OUT everything in the CSELIB table. */
3254 dump_cselib_table (FILE *out
)
3256 fprintf (out
, "cselib hash table:\n");
3257 cselib_hash_table
->traverse
<FILE *, dump_cselib_val
> (out
);
3258 fprintf (out
, "cselib preserved hash table:\n");
3259 cselib_preserved_hash_table
->traverse
<FILE *, dump_cselib_val
> (out
);
3260 if (first_containing_mem
!= &dummy_val
)
3262 fputs ("first mem ", out
);
3263 print_inline_rtx (out
, first_containing_mem
->val_rtx
, 2);
3266 fprintf (out
, "next uid %i\n", next_uid
);
3269 #include "gt-cselib.h"