public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Kito Cheng <kito@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5410] RISC-V: Cleanup the codes of bitmap create and free [NFC] Date: Thu, 26 Jan 2023 19:12:31 +0000 (GMT) [thread overview] Message-ID: <20230126191231.4ED0B3858C2C@sourceware.org> (raw) https://gcc.gnu.org/g:cfe3fbc678d7b69785d2b017d3ff3cd78cd91580 commit r13-5410-gcfe3fbc678d7b69785d2b017d3ff3cd78cd91580 Author: Ju-Zhe Zhong <juzhe.zhong@rivai.ai> Date: Tue Jan 10 06:33:07 2023 +0800 RISC-V: Cleanup the codes of bitmap create and free [NFC] This patch is a NFC patch to move the codes into a wrapper function so that they can be reused. I will reuse them in the following patches. gcc/ChangeLog: * config/riscv/riscv-vsetvl.cc (vector_infos_manager::create_bitmap_vectors): New function. (vector_infos_manager::free_bitmap_vectors): Ditto. (pass_vsetvl::pre_vsetvl): Adjust codes. * config/riscv/riscv-vsetvl.h: New function declaration. Diff: --- gcc/config/riscv/riscv-vsetvl.cc | 95 ++++++++++++++++++++++++---------------- gcc/config/riscv/riscv-vsetvl.h | 2 + 2 files changed, 59 insertions(+), 38 deletions(-) diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 9ed081d0a72..f67459ca8ca 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -1570,18 +1570,62 @@ vector_infos_manager::release (void) vector_exprs.release (); if (optimize > 0) - { - /* Finished. Free up all the things we've allocated. */ - free_edge_list (vector_edge_list); - sbitmap_vector_free (vector_del); - sbitmap_vector_free (vector_insert); - sbitmap_vector_free (vector_kill); - sbitmap_vector_free (vector_antic); - sbitmap_vector_free (vector_transp); - sbitmap_vector_free (vector_comp); - sbitmap_vector_free (vector_avin); - sbitmap_vector_free (vector_avout); - } + free_bitmap_vectors (); +} + +void +vector_infos_manager::create_bitmap_vectors (void) +{ + /* Create the bitmap vectors. */ + vector_antic = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_transp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_comp = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_avin = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_avout = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + vector_kill = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), + vector_exprs.length ()); + + bitmap_vector_ones (vector_transp, last_basic_block_for_fn (cfun)); + bitmap_vector_clear (vector_antic, last_basic_block_for_fn (cfun)); + bitmap_vector_clear (vector_comp, last_basic_block_for_fn (cfun)); +} + +void +vector_infos_manager::free_bitmap_vectors (void) +{ + /* Finished. Free up all the things we've allocated. */ + free_edge_list (vector_edge_list); + if (vector_del) + sbitmap_vector_free (vector_del); + if (vector_insert) + sbitmap_vector_free (vector_insert); + if (vector_kill) + sbitmap_vector_free (vector_kill); + if (vector_antic) + sbitmap_vector_free (vector_antic); + if (vector_transp) + sbitmap_vector_free (vector_transp); + if (vector_comp) + sbitmap_vector_free (vector_comp); + if (vector_avin) + sbitmap_vector_free (vector_avin); + if (vector_avout) + sbitmap_vector_free (vector_avout); + + vector_edge_list = nullptr; + vector_kill = nullptr; + vector_del = nullptr; + vector_insert = nullptr; + vector_antic = nullptr; + vector_transp = nullptr; + vector_comp = nullptr; + vector_avin = nullptr; + vector_avout = nullptr; } void @@ -2479,32 +2523,7 @@ pass_vsetvl::pre_vsetvl (void) /* Compute entity list. */ prune_expressions (); - /* Create the bitmap vectors. */ - m_vector_manager->vector_antic - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_transp - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_comp - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_avin - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_avout - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - m_vector_manager->vector_kill - = sbitmap_vector_alloc (last_basic_block_for_fn (cfun), - m_vector_manager->vector_exprs.length ()); - - bitmap_vector_ones (m_vector_manager->vector_transp, - last_basic_block_for_fn (cfun)); - bitmap_vector_clear (m_vector_manager->vector_antic, - last_basic_block_for_fn (cfun)); - bitmap_vector_clear (m_vector_manager->vector_comp, - last_basic_block_for_fn (cfun)); + m_vector_manager->create_bitmap_vectors (); compute_local_properties (); m_vector_manager->vector_edge_list = pre_edge_lcm_avs ( m_vector_manager->vector_exprs.length (), m_vector_manager->vector_transp, diff --git a/gcc/config/riscv/riscv-vsetvl.h b/gcc/config/riscv/riscv-vsetvl.h index 72a02289adb..1038f35523e 100644 --- a/gcc/config/riscv/riscv-vsetvl.h +++ b/gcc/config/riscv/riscv-vsetvl.h @@ -341,6 +341,8 @@ public: bool all_same_ratio_p (sbitmap) const; void release (void); + void create_bitmap_vectors (void); + void free_bitmap_vectors (void); void dump (FILE *) const; };
reply other threads:[~2023-01-26 19:12 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230126191231.4ED0B3858C2C@sourceware.org \ --to=kito@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).