aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl-ssa/functions.h
diff options
context:
space:
mode:
authorAlex Coplan <alex.coplan@arm.com>2023-09-16 09:23:52 +0100
committerAlex Coplan <alex.coplan@arm.com>2023-11-24 10:57:51 +0000
commita49befbd2c783e751dc2110b544fe540eb7e33eb (patch)
tree40f8c2ce0f164a247811413dd1019a89e17b9b68 /gcc/rtl-ssa/functions.h
parenteebcad0ac22010fc59de9d856bb02017fccab282 (diff)
downloadgcc-a49befbd2c783e751dc2110b544fe540eb7e33eb.zip
gcc-a49befbd2c783e751dc2110b544fe540eb7e33eb.tar.gz
gcc-a49befbd2c783e751dc2110b544fe540eb7e33eb.tar.bz2
rtl-ssa: Support for inserting new insns
The upcoming aarch64 load pair pass needs to form store pairs, and can re-order stores over loads when alias analysis determines this is safe. In the case that both mem defs have uses in the RTL-SSA IR, and both stores require re-ordering over their uses, we represent that as (tentative) deletion of the original store insns and creation of a new insn, to prevent requiring repeated re-parenting of uses during the pass. We then update all mem uses that require re-parenting in one go at the end of the pass. To support this, RTL-SSA needs to handle inserting new insns (rather than just changing existing ones), so this patch adds support for that. New insns (and new accesses) are temporaries, allocated above a temporary obstack_watermark, such that the user can easily back out of a change without awkward bookkeeping. gcc/ChangeLog: * rtl-ssa/accesses.cc (function_info::create_set): New. * rtl-ssa/accesses.h (access_info::is_temporary): New. * rtl-ssa/changes.cc (move_insn): Handle new (temporary) insns. (function_info::finalize_new_accesses): Handle new/temporary user-created accesses. (function_info::apply_changes_to_insn): Ensure m_is_temp flag on new insns gets cleared. (function_info::change_insns): Handle new/temporary insns. (function_info::create_insn): New. * rtl-ssa/changes.h (class insn_change): Make function_info a friend class. * rtl-ssa/functions.h (function_info): Declare new entry points: create_set, create_insn. Declare new change_alloc helper. * rtl-ssa/insns.cc (insn_info::print_full): Identify temporary insns in dump. * rtl-ssa/insns.h (insn_info): Add new m_is_temp flag and accompanying is_temporary accessor. * rtl-ssa/internals.inl (insn_info::insn_info): Initialize m_is_temp to false. * rtl-ssa/member-fns.inl (function_info::change_alloc): New. * rtl-ssa/movement.h (restrict_movement_for_defs_ignoring): Add handling for temporary defs.
Diffstat (limited to 'gcc/rtl-ssa/functions.h')
-rw-r--r--gcc/rtl-ssa/functions.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/rtl-ssa/functions.h b/gcc/rtl-ssa/functions.h
index ecb40fd..4ffd3fa 100644
--- a/gcc/rtl-ssa/functions.h
+++ b/gcc/rtl-ssa/functions.h
@@ -68,6 +68,16 @@ public:
// Return the SSA information for CFG_BB.
bb_info *bb (basic_block cfg_bb) const { return m_bbs[cfg_bb->index]; }
+ // Create a temporary def.
+ set_info *create_set (obstack_watermark &watermark,
+ insn_info *insn,
+ resource_info resource);
+
+ // Create a temporary insn with code INSN_CODE and pattern PAT.
+ insn_info *create_insn (obstack_watermark &watermark,
+ rtx_code insn_code,
+ rtx pat);
+
// Return a list of all the instructions in the function, in reverse
// postorder. The list includes both real and artificial instructions.
//
@@ -195,6 +205,10 @@ public:
// Print the contents of the function to PP.
void print (pretty_printer *pp) const;
+ // Allocate an object of type T above the obstack watermark WM.
+ template<typename T, typename... Ts>
+ T *change_alloc (obstack_watermark &wm, Ts... args);
+
private:
class bb_phi_info;
class build_info;