Skip several gcc.dg/builtin-dynamic-object-size tests on hppa*-*-hpux*
[official-gcc.git] / gcc / rtl-ssa / changes.h
blob35ab02243a9c90df034e858226c3a30b094f3ce3
1 // RTL SSA classes related to changing instructions -*- 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 namespace rtl_ssa {
22 // A class that describes a change that we're considering making to an
23 // instruction. There are three choices:
25 // (1) delete the instruction
26 // (2) replace the instruction with a new instruction in-place
27 // (3) replace the instruction with a new instruction at a different location
29 // Anything related to the "new instruction" is irrelevant for (1).
31 // The class doesn't actually change anything itself, it simply records
32 // something that we might do.
33 class insn_change
35 friend class function_info;
37 public:
38 enum delete_action { DELETE };
40 // Construct a possible change to INSN.
41 insn_change (insn_info *insn);
43 // Construct a possible deletion of INSN.
44 insn_change (insn_info *insn, delete_action);
46 // The instruction that we would change.
47 insn_info *insn () const { return m_insn; }
49 // The rtx_insn of the instruction that we would change.
50 rtx_insn *rtl () const { return m_insn->rtl (); }
52 // The basic block that contains insn ().
53 bb_info *bb () const { return m_insn->bb (); }
55 // The extended basic block that contains insn ().
56 ebb_info *ebb () const { return m_insn->ebb (); }
58 // The uid of the instruction that we would change.
59 unsigned int insn_uid () const { return m_insn->uid (); }
61 // The list of things that the original instruction defined and used.
62 def_array old_defs () const { return m_insn->defs (); }
63 use_array old_uses () const { return m_insn->uses (); }
65 // The cost of the original instruction, as calculated by the target.
66 unsigned int old_cost () const { return m_insn->cost (); }
68 // Return true if the original instruction would simply be deleted,
69 // rather than being replaced by a new instruction.
70 bool is_deletion () const { return m_is_deletion; }
72 // Print a description of the change to PP.
73 void print (pretty_printer *pp) const;
75 // Return an insn_change for deleting INSN.
76 static insn_change delete_insn (insn_info *insn) { return { insn, DELETE }; }
78 private:
79 // The value returned by insn ().
80 insn_info *m_insn;
82 public:
83 // The list of things that the new instruction would define and use.
84 def_array new_defs;
85 use_array new_uses;
87 // The range of instructions after which the instruction could be placed.
88 // The range can include INSN itself: placing the instruction after either
89 // INSN or INSN->prev_nondebug_insn () is equivalent to not moving the
90 // instruction.
91 insn_range_info move_range;
93 // The cost that the new instruction would have, as calculated by the target.
94 unsigned int new_cost;
96 private:
97 // The value returned by is_deletion ().
98 bool m_is_deletion;
101 // A class that represents a closure of the two-argument form of
102 // insn_is_changing. See the comment above the one-argument form
103 // for details.
104 class insn_is_changing_closure
106 public:
107 insn_is_changing_closure (array_slice<insn_change *const> changes);
108 bool operator() (const insn_info *) const;
110 private:
111 array_slice<insn_change *const> m_changes;
114 void pp_insn_change (pretty_printer *, const insn_change &);
118 void dump (FILE *, const rtl_ssa::insn_change &);
120 void DEBUG_FUNCTION debug (const rtl_ssa::insn_change &);