Skip several gcc.dg/builtin-dynamic-object-size tests on hppa*-*-hpux*
[official-gcc.git] / gcc / rtl-ssa / insns.cc
blob0171d93c3571c981eb3e496374a16d7506c68834
1 // Implementation of instruction-related RTL SSA functions -*- C++ -*-
2 // Copyright (C) 2020-2024 Free Software Foundation, Inc.
3 //
4 // This file is part of GCC.
5 //
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
9 // version.
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
14 // for more details.
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/>.
20 #define INCLUDE_ALGORITHM
21 #define INCLUDE_FUNCTIONAL
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "backend.h"
26 #include "rtl.h"
27 #include "df.h"
28 #include "rtl-ssa.h"
29 #include "rtl-ssa/internals.h"
30 #include "rtl-ssa/internals.inl"
31 #include "predict.h"
32 #include "print-rtl.h"
33 #include "rtl-iter.h"
35 using namespace rtl_ssa;
37 // The gap to leave between program points when building up the list
38 // of instructions for the first time. Using 2 allows an instruction
39 // to be inserted between two others without resorting to splay tree
40 // ordering. Using 0 is useful as a debugging aid to stress the
41 // splay tree code.
42 static const unsigned int POINT_INCREASE = 2;
44 // Calculate and record the cost of the instruction, based on the
45 // form it had before any in-progress changes were made.
46 void
47 insn_info::calculate_cost () const
49 basic_block cfg_bb = BLOCK_FOR_INSN (m_rtl);
50 temporarily_undo_changes (0);
51 m_cost_or_uid = insn_cost (m_rtl, optimize_bb_for_speed_p (cfg_bb));
52 redo_changes (0);
55 // Add NOTE to the instruction's notes.
56 void
57 insn_info::add_note (insn_note *note)
59 insn_note **ptr = &m_first_note;
60 // Always put the order node first, since it's the one that's likely
61 // to be used most often.
62 if (*ptr && (*ptr)->kind () == insn_note_kind::ORDER_NODE)
63 ptr = &(*ptr)->m_next_note;
64 note->m_next_note = *ptr;
65 *ptr = note;
68 // Implement compare_with for the case in which this insn and OTHER
69 // have the same program point.
70 int
71 insn_info::slow_compare_with (const insn_info &other) const
73 return order_splay_tree::compare_nodes (get_known_order_node (),
74 other.get_known_order_node ());
77 // Print insn uid UID to PP, where UID has the same form as insn_info::uid.
78 void
79 insn_info::print_uid (pretty_printer *pp, int uid)
81 char tmp[3 * sizeof (uid) + 2];
82 if (uid < 0)
83 // An artificial instruction.
84 snprintf (tmp, sizeof (tmp), "a%d", -uid);
85 else
86 // A real RTL instruction.
87 snprintf (tmp, sizeof (tmp), "i%d", uid);
88 pp_string (pp, tmp);
91 // See comment above declaration.
92 void
93 insn_info::print_identifier (pretty_printer *pp) const
95 print_uid (pp, uid ());
98 // See comment above declaration.
99 void
100 insn_info::print_location (pretty_printer *pp) const
102 if (bb_info *bb = this->bb ())
104 ebb_info *ebb = bb->ebb ();
105 if (ebb && is_phi ())
106 ebb->print_identifier (pp);
107 else
108 bb->print_identifier (pp);
109 pp_string (pp, " at point ");
110 pp_decimal_int (pp, m_point);
112 else
113 pp_string (pp, "<unknown location>");
116 // See comment above declaration.
117 void
118 insn_info::print_identifier_and_location (pretty_printer *pp) const
120 if (m_is_asm)
121 pp_string (pp, "asm ");
122 if (m_is_debug_insn)
123 pp_string (pp, "debug ");
124 pp_string (pp, "insn ");
125 print_identifier (pp);
126 pp_string (pp, " in ");
127 print_location (pp);
130 // See comment above declaration.
131 void
132 insn_info::print_full (pretty_printer *pp) const
134 print_identifier_and_location (pp);
135 pp_colon (pp);
136 if (is_real ())
138 pp_newline_and_indent (pp, 2);
139 if (has_been_deleted ())
140 pp_string (pp, "deleted");
141 else
143 // Print the insn pattern to a temporary printer.
144 pretty_printer sub_pp;
145 print_insn_with_notes (&sub_pp, rtl ());
146 const char *text = pp_formatted_text (&sub_pp);
148 // Calculate the length of the maximum line in the pattern.
149 unsigned int max_len = 0;
150 const char *start = text;
151 while (const char *end = strchr (start, '\n'))
153 max_len = MAX (max_len, (unsigned int) (end - start));
154 start = end + 1;
157 // Print a separator before or after the pattern.
158 auto print_top_bottom = [&]()
160 pp_character (pp, '+');
161 for (unsigned int i = 0; i < max_len + 2; ++i)
162 pp_character (pp, '-');
165 print_top_bottom ();
166 start = text;
167 while (const char *end = strchr (start, '\n'))
169 pp_newline_and_indent (pp, 0);
170 pp_character (pp, '|');
171 // Each line of the pattern already starts with a space.
172 // so we don't need to add another one here.
173 pp_append_text (pp, start, end);
174 start = end + 1;
176 pp_newline_and_indent (pp, 0);
177 print_top_bottom ();
179 if (m_cost_or_uid != UNKNOWN_COST)
181 pp_newline_and_indent (pp, 0);
182 pp_string (pp, "cost: ");
183 pp_decimal_int (pp, m_cost_or_uid);
185 if (m_has_pre_post_modify)
187 pp_newline_and_indent (pp, 0);
188 pp_string (pp, "has pre/post-modify operations");
190 if (m_has_volatile_refs)
192 pp_newline_and_indent (pp, 0);
193 pp_string (pp, "has volatile refs");
195 if (m_is_temp)
197 pp_newline_and_indent (pp, 0);
198 pp_string (pp, "temporary");
201 pp_indentation (pp) -= 2;
204 auto print_accesses = [&](const char *heading, access_array accesses,
205 unsigned int flags)
207 if (!accesses.empty ())
209 pp_newline_and_indent (pp, 2);
210 pp_string (pp, heading);
211 pp_newline_and_indent (pp, 2);
212 pp_accesses (pp, accesses, flags);
213 pp_indentation (pp) -= 4;
217 print_accesses ("uses:", uses (), PP_ACCESS_USER);
218 auto *call_clobbers_note = find_note<insn_call_clobbers_note> ();
219 if (call_clobbers_note)
221 pp_newline_and_indent (pp, 2);
222 pp_string (pp, "has call clobbers for ABI ");
223 pp_decimal_int (pp, call_clobbers_note->abi_id ());
224 pp_indentation (pp) -= 2;
226 print_accesses ("defines:", defs (), PP_ACCESS_SETTER);
227 if (num_uses () == 0 && !call_clobbers_note && num_defs () == 0)
229 pp_newline_and_indent (pp, 2);
230 pp_string (pp, "has no uses or defs");
231 pp_indentation (pp) -= 2;
234 if (order_node *node = get_order_node ())
236 while (node->m_parent)
237 node = node->m_parent;
239 pp_newline_and_indent (pp, 2);
240 pp_string (pp, "insn order: ");
241 pp_newline_and_indent (pp, 2);
242 auto print_order = [](pretty_printer *pp, order_node *node)
244 print_uid (pp, node->uid ());
246 order_splay_tree::print (pp, node, print_order);
247 pp_indentation (pp) -= 4;
251 // Return an insn_info::order_node for INSN, creating one if necessary.
252 insn_info::order_node *
253 function_info::need_order_node (insn_info *insn)
255 insn_info::order_node *order = insn->get_order_node ();
256 if (!order)
258 order = allocate<insn_info::order_node> (insn->uid ());
259 insn->add_note (order);
261 return order;
264 // Add instruction INSN immediately after AFTER in the reverse postorder list.
265 // INSN is not currently in the list.
266 void
267 function_info::add_insn_after (insn_info *insn, insn_info *after)
269 gcc_checking_assert (!insn->has_insn_links ());
271 insn->copy_next_from (after);
272 after->set_next_any_insn (insn);
274 // The prev link is easy if AFTER and INSN are the same type.
275 // Handle the other cases below.
276 if (after->is_debug_insn () == insn->is_debug_insn ())
277 insn->set_prev_sametype_insn (after);
279 if (insn_info *next = insn->next_any_insn ())
281 if (insn->is_debug_insn () == next->is_debug_insn ())
283 // INSN might now be the start of the subsequence of debug insns,
284 // and so its prev pointer might point to the end of the subsequence
285 // instead of AFTER.
286 insn->copy_prev_from (next);
287 next->set_prev_sametype_insn (insn);
289 else if (insn->is_debug_insn ()) // && !next->is_debug_insn ()
291 // INSN ends a subsequence of debug instructions. Find the
292 // first debug instruction in the subsequence, which might
293 // be INSN itself. (If it isn't, then AFTER is also a debug
294 // instruction and we updated INSN's prev link above.)
295 insn_info *first = next->prev_nondebug_insn ()->next_any_insn ();
296 first->set_last_debug_insn (insn);
298 else // !insn->is_debug_insn () && next->is_debug_insn ()
300 // At present we don't (need to) support inserting a nondebug
301 // instruction between two existing debug instructions.
302 gcc_assert (!after->is_debug_insn ());
304 // Find the next nondebug insn and update its previous pointer
305 // to point to INSN.
306 auto next_nondebug = next->last_debug_insn ()->next_any_insn ();
307 gcc_checking_assert (!next_nondebug->is_debug_insn ());
308 next_nondebug->set_prev_sametype_insn (insn);
311 // If AFTER and NEXT are separated by at least two points, we can
312 // use a unique point number for INSN. Otherwise INSN will have
313 // the same point number as AFTER.
314 insn->set_point ((next->point () + after->point ()) / 2);
316 else
318 if (!insn->is_debug_insn ())
320 insn->set_prev_sametype_insn (m_last_nondebug_insn);
321 m_last_nondebug_insn = insn;
323 else
324 // There is now at least one debug instruction after
325 // m_last_nondebug_insn: either INSN itself, or the start of
326 // a longer subsequence of debug insns that now ends with AFTER
327 // followed by INSN.
328 m_last_nondebug_insn->next_any_insn ()->set_last_debug_insn (insn);
329 m_last_insn = insn;
331 insn->set_point (after->point () + POINT_INCREASE);
334 // If INSN's program point is the same as AFTER's, we need to use the
335 // splay tree to record their relative order.
336 if (insn->point () == after->point ())
338 insn_info::order_node *after_node = need_order_node (after);
339 insn_info::order_node *insn_node = need_order_node (insn);
340 insn_info::order_splay_tree::insert_child (after_node, 1, insn_node);
344 // Remove INSN from the function's list of instructions.
345 void
346 function_info::remove_insn (insn_info *insn)
348 if (insn_info::order_node *order = insn->get_order_node ())
349 insn_info::order_splay_tree::remove_node (order);
351 if (auto *note = insn->find_note<insn_call_clobbers_note> ())
353 ebb_call_clobbers_info *ecc = insn->ebb ()->first_call_clobbers ();
354 while (ecc->abi ()->id () != note->abi_id ())
355 ecc = ecc->next ();
356 int comparison = lookup_call_clobbers (*ecc, insn);
357 gcc_assert (comparison == 0);
358 ecc->remove_root ();
361 insn_info *prev = insn->prev_any_insn ();
362 insn_info *next = insn->next_any_insn ();
363 insn_info *prev_nondebug = insn->prev_nondebug_insn ();
364 insn_info *next_nondebug = insn->next_nondebug_insn ();
366 // We should never remove the entry or exit block's instructions.
367 // At present we also don't remove entire blocks, so should never
368 // remove debug instructions.
369 gcc_checking_assert (prev_nondebug
370 && next_nondebug
371 && !insn->is_debug_insn ());
373 if (prev->is_debug_insn () && next->is_debug_insn ())
375 // We need to stitch together two subsequences of debug insns.
376 insn_info *last = next->last_debug_insn ();
377 next->set_prev_sametype_insn (prev);
378 prev_nondebug->next_any_insn ()->set_last_debug_insn (last);
380 prev->set_next_any_insn (next);
381 next_nondebug->set_prev_sametype_insn (prev_nondebug);
383 insn->clear_insn_links ();
386 // Create an artificial instruction for BB, associating it with RTL (which can
387 // be null). Add the new instruction to the end of the function's list and
388 // return the new instruction.
389 insn_info *
390 function_info::append_artificial_insn (bb_info *bb, rtx_insn *rtl)
392 insn_info *insn = allocate<insn_info> (bb, rtl, m_next_artificial_uid);
393 m_next_artificial_uid -= 1;
394 append_insn (insn);
395 return insn;
398 // Finish building a new list of uses and definitions for instruction INSN.
399 void
400 function_info::finish_insn_accesses (insn_info *insn)
402 unsigned int num_defs = m_temp_defs.length ();
403 unsigned int num_uses = m_temp_uses.length ();
404 obstack_make_room (&m_obstack, num_defs + num_uses);
405 if (num_defs)
407 sort_accesses (m_temp_defs);
408 obstack_grow (&m_obstack, m_temp_defs.address (),
409 num_defs * sizeof (access_info *));
410 m_temp_defs.truncate (0);
412 if (num_uses)
414 sort_accesses (m_temp_uses);
415 obstack_grow (&m_obstack, m_temp_uses.address (),
416 num_uses * sizeof (access_info *));
417 m_temp_uses.truncate (0);
419 void *addr = obstack_finish (&m_obstack);
420 insn->set_accesses (static_cast<access_info **> (addr), num_defs, num_uses);
423 // Called while building SSA form using BI. Create and return a use of
424 // register RESOURCE in INSN. Create a degenerate phi where necessary.
425 use_info *
426 function_info::create_reg_use (build_info &bi, insn_info *insn,
427 resource_info resource)
429 set_info *value = bi.current_reg_value (resource.regno);
430 if (value && value->ebb () != bi.current_ebb)
432 if (insn->is_debug_insn ())
433 value = look_through_degenerate_phi (value);
434 else if (bitmap_bit_p (bi.potential_phi_regs, resource.regno))
436 // VALUE is defined by a previous EBB and RESOURCE has multiple
437 // definitions. Create a degenerate phi in the current EBB
438 // so that all definitions and uses follow a linear RPO view;
439 // see rtl.texi for details.
440 access_info *inputs[] = { look_through_degenerate_phi (value) };
441 value = create_phi (bi.current_ebb, value->resource (), inputs, 1);
442 bi.record_reg_def (value);
445 auto *use = allocate<use_info> (insn, resource, value);
446 add_use (use);
447 return use;
450 // Called while building SSA form using BI. Record that INSN contains
451 // read reference REF. If this requires new entries to be added to
452 // INSN->uses (), add those entries to the list we're building in
453 // m_temp_uses.
454 void
455 function_info::record_use (build_info &bi, insn_info *insn,
456 rtx_obj_reference ref)
458 unsigned int regno = ref.regno;
459 machine_mode mode = ref.is_reg () ? ref.mode : BLKmode;
460 access_info *access = bi.last_access[ref.regno + 1];
461 use_info *use = safe_dyn_cast<use_info *> (access);
462 if (!use)
464 set_info *value = safe_dyn_cast<set_info *> (access);
465 // In order to ensure that -g doesn't affect codegen, uses in debug
466 // instructions do not affect liveness, either in DF or here.
467 // This means that there might be no correct definition of the resource
468 // available (e.g. if it would require a phi node that the nondebug
469 // code doesn't need). Perhaps we could have "debug phi nodes" as
470 // well as "debug instructions", but that would require a method
471 // of building phi nodes that didn't depend on DF liveness information,
472 // and so might be significantly more expensive.
474 // Therefore, the only value we try to attach to a use by a debug
475 // instruction is VALUE itself (as we would for nondebug instructions).
476 // We then need to make a conservative check for whether VALUE is
477 // actually correct.
478 auto value_is_valid = [&]()
480 // Memmory always has a valid definition.
481 if (ref.is_mem ())
482 return true;
484 // If VALUE would lead to an uninitialized use anyway, there's
485 // nothing to check.
486 if (!value)
487 return false;
489 // If the previous definition occurs in the same EBB then it
490 // is certainly correct.
491 if (value->ebb () == bi.current_ebb)
492 return true;
494 // Check if VALUE is the function's only definition of REGNO.
495 // (We already know that it dominates the use.)
496 if (!bitmap_bit_p (bi.potential_phi_regs, regno))
497 return true;
499 // If the register is live on entry to the EBB but not used
500 // within it, VALUE is the correct live-in value.
501 if (!bi.ebb_live_in_for_debug)
502 calculate_ebb_live_in_for_debug (bi);
503 if (bitmap_bit_p (bi.ebb_live_in_for_debug, regno))
504 return true;
506 // Punt for other cases.
507 return false;
509 if (insn->is_debug_insn () && !value_is_valid ())
510 value = nullptr;
512 use = create_reg_use (bi, insn, { mode, regno });
513 m_temp_uses.safe_push (use);
514 bi.last_access[ref.regno + 1] = use;
515 use->record_reference (ref, true);
517 else
519 // Record the mode of the largest use. The choice is arbitrary if
520 // the instruction (unusually) references the same register in two
521 // different but equal-sized modes.
522 gcc_checking_assert (use->insn () == insn);
523 if (HARD_REGISTER_NUM_P (regno))
525 if (!ordered_p (GET_MODE_PRECISION (use->mode ()),
526 GET_MODE_PRECISION (mode)))
527 use->set_mode (reg_raw_mode[regno]);
528 else if (partial_subreg_p (use->mode (), mode))
529 use->set_mode (mode);
531 use->record_reference (ref, false);
535 // Called while building SSA form for INSN using BI. Record the effect
536 // of call clobbers in RTL. We have already added the explicit sets and
537 // clobbers for RTL, which have priority over any call clobbers.
538 void
539 function_info::record_call_clobbers (build_info &bi, insn_info *insn,
540 rtx_call_insn *rtl)
542 // See whether we should record this call in the EBB's list of
543 // call clobbers. Three things affect this choice:
545 // (1) The list is the only way we have of recording partial clobbers.
546 // All calls that only partially clobber registers must therefore
547 // be in the list.
549 // (2) Adding calls to the list is much more memory-efficient than
550 // creating a long list of clobber_infos.
552 // (3) Adding calls to the list limits the ability to move definitions
553 // of registers that are normally fully or partially clobbered
554 // by the associated predefined ABI. So adding calls to the list
555 // can hamper optimization if (thanks to -fipa-ra) the number of
556 // clobbers is much smaller than the usual set.
558 // The trade-off that we currently take is to use the list if there
559 // are some registers that the call only partially clobbers or if
560 // the set of clobbers is the standard set.
561 function_abi abi = insn_callee_abi (rtl);
562 if (abi.base_abi ().full_reg_clobbers () == abi.full_reg_clobbers ()
563 || abi.full_and_partial_reg_clobbers () != abi.full_reg_clobbers ())
565 // Find an entry for this predefined ABI, creating one if necessary.
566 ebb_call_clobbers_info *ecc = bi.current_ebb->first_call_clobbers ();
567 while (ecc && ecc->abi () != &abi.base_abi ())
568 ecc = ecc->next ();
569 if (!ecc)
571 ecc = allocate<ebb_call_clobbers_info> (&abi.base_abi ());
572 ecc->m_next = bi.current_ebb->first_call_clobbers ();
573 bi.current_ebb->set_first_call_clobbers (ecc);
576 auto abi_id = abi.base_abi ().id ();
577 auto *insn_clobbers = allocate<insn_call_clobbers_note> (abi_id, insn);
578 insn->add_note (insn_clobbers);
580 ecc->insert_max_node (insn_clobbers);
582 m_clobbered_by_calls |= abi.full_and_partial_reg_clobbers ();
584 else
585 for (unsigned int regno = 0; regno < FIRST_PSEUDO_REGISTER; ++regno)
586 if (TEST_HARD_REG_BIT (abi.full_reg_clobbers (), regno))
588 def_info *def = m_defs[regno + 1];
589 if (!def || def->last_def ()->insn () != insn)
591 def = allocate<clobber_info> (insn, regno);
592 def->m_is_call_clobber = true;
593 append_def (def);
594 m_temp_defs.safe_push (def);
595 bi.record_reg_def (def);
600 // Called while building SSA form using BI. Record that INSN contains
601 // write reference REF. Add associated def_infos to the list of accesses
602 // that we're building in m_temp_defs. Record the register's new live
603 // value in BI.
604 void
605 function_info::record_def (build_info &bi, insn_info *insn,
606 rtx_obj_reference ref)
608 // Punt if we see multiple definitions of the same resource.
609 // This can happen for several reasons:
611 // - An instruction might store two values to memory at once, giving two
612 // distinct memory references.
614 // - An instruction might assign to multiple pieces of a wide pseudo
615 // register. For example, on 32-bit targets, an instruction might
616 // assign to both the upper and lower halves of a 64-bit pseudo register.
618 // - It's possible for the same register to be clobbered by the
619 // CALL_INSN_FUNCTION_USAGE and to be set by the main instruction
620 // pattern as well. In that case, the clobber conceptually happens
621 // before the set and can essentially be ignored.
623 // - Similarly, global registers are implicitly set by a call but can
624 // be explicitly set or clobbered as well. In that situation, the sets
625 // are listed first and should win over a clobber.
626 unsigned int regno = ref.regno;
627 machine_mode mode = ref.is_reg () ? ref.mode : BLKmode;
628 def_info *def = safe_dyn_cast<def_info *> (bi.last_access[ref.regno + 1]);
629 if (def && def->insn () == insn)
631 if (!ref.is_clobber ())
633 gcc_checking_assert (!is_a<clobber_info *> (def));
634 def->record_reference (ref, false);
636 return;
639 // Memory is always well-defined, so only use clobber_infos for registers.
640 if (ref.is_reg () && ref.is_clobber ())
641 def = allocate<clobber_info> (insn, regno);
642 else
643 def = allocate<set_info> (insn, resource_info { mode, regno });
644 def->record_reference (ref, true);
645 append_def (def);
646 m_temp_defs.safe_push (def);
647 bi.record_reg_def (def);
650 // Called while building SSA form using BI. Add an insn_info for RTL
651 // to the block that we're current building.
652 void
653 function_info::add_insn_to_block (build_info &bi, rtx_insn *rtl)
655 insn_info *insn = allocate<insn_info> (bi.current_bb, rtl, UNKNOWN_COST);
656 append_insn (insn);
658 vec_rtx_properties properties;
659 properties.add_insn (rtl, true);
660 insn->set_properties (properties);
662 start_insn_accesses ();
664 // Record the uses.
665 for (rtx_obj_reference ref : properties.refs ())
666 if (ref.is_read ())
667 record_use (bi, insn, ref);
669 // Restore the contents of bi.last_access, which we used as a cache
670 // when assembling the uses.
671 for (access_info *access : m_temp_uses)
673 unsigned int regno = access->regno ();
674 gcc_checking_assert (bi.last_access[regno + 1] == access);
675 bi.last_access[regno + 1] = as_a<use_info *> (access)->def ();
678 // Record the definitions.
679 for (rtx_obj_reference ref : properties.refs ())
680 if (ref.is_write ())
681 record_def (bi, insn, ref);
683 // Logically these happen before the explicit definitions, but if the
684 // explicit definitions and call clobbers reference the same register,
685 // the explicit definition should win.
686 if (auto *call_rtl = dyn_cast<rtx_call_insn *> (rtl))
687 record_call_clobbers (bi, insn, call_rtl);
689 finish_insn_accesses (insn);
692 // Check whether INSN sets any registers that are never subsequently used.
693 // If so, add REG_UNUSED notes for them. The caller has already removed
694 // any previous REG_UNUSED notes.
695 void
696 function_info::add_reg_unused_notes (insn_info *insn)
698 rtx_insn *rtl = insn->rtl ();
700 auto handle_potential_set = [&](rtx pattern)
702 if (GET_CODE (pattern) != SET)
703 return;
705 rtx dest = SET_DEST (pattern);
706 if (!REG_P (dest))
707 return;
709 def_array defs = insn->defs ();
710 unsigned int index = find_access_index (defs, REGNO (dest));
711 for (unsigned int i = 0; i < REG_NREGS (dest); ++i)
713 def_info *def = defs[index + i];
714 gcc_checking_assert (def->regno () == REGNO (dest) + i);
715 set_info *set = dyn_cast<set_info *> (def);
716 if (set && set->has_nondebug_uses ())
717 return;
719 add_reg_note (rtl, REG_UNUSED, dest);
722 rtx pattern = PATTERN (rtl);
723 if (GET_CODE (pattern) == PARALLEL)
724 for (int i = 0; i < XVECLEN (pattern, 0); ++i)
725 handle_potential_set (XVECEXP (pattern, 0, i));
726 else
727 handle_potential_set (pattern);
730 // Search TREE for call clobbers at INSN. Return:
732 // - less than zero if INSN occurs before the root of TREE
733 // - 0 if INSN is the root of TREE
734 // - greater than zero if INSN occurs after the root of TREE
736 rtl_ssa::lookup_call_clobbers (insn_call_clobbers_tree &tree, insn_info *insn)
738 auto compare = [&](insn_call_clobbers_note *clobbers)
740 return insn->compare_with (clobbers->insn ());
742 return tree.lookup (compare);
745 // Print a description of INSN to PP.
746 void
747 rtl_ssa::pp_insn (pretty_printer *pp, const insn_info *insn)
749 if (!insn)
750 pp_string (pp, "<null>");
751 else
752 insn->print_full (pp);
755 // Print a description of INSN to FILE.
756 void
757 dump (FILE *file, const insn_info *insn)
759 dump_using (file, pp_insn, insn);
762 // Debug interface to the dump routine above.
763 void debug (const insn_info *x) { dump (stderr, x); }