diff options
author | Ju-Zhe Zhong <juzhe.zhong@rivai.ai> | 2023-07-10 16:12:59 +0800 |
---|---|---|
committer | Pan Li <pan2.li@intel.com> | 2023-07-10 22:16:50 +0800 |
commit | a3ad2301d2f4aab2deeb286fa5bd0282260bfd0a (patch) | |
tree | 2a1b393df4089fdefd6c871461cafdffe5484cbc /gcc/gcse.cc | |
parent | eca10aaa3954af3dab56eccc208c90273c2b1732 (diff) | |
download | gcc-a3ad2301d2f4aab2deeb286fa5bd0282260bfd0a.zip gcc-a3ad2301d2f4aab2deeb286fa5bd0282260bfd0a.tar.gz gcc-a3ad2301d2f4aab2deeb286fa5bd0282260bfd0a.tar.bz2 |
GCSE: Export 'insert_insn_end_basic_block' as global function
Since VSETVL PASS in RISC-V port is using common part of 'insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb)'
and we will also this helper function in riscv.cc for the following patches.
So extract the common part codes of 'insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb)', the new function
of the common part is also call 'insert_insn_end_basic_block (rtx_insn *pat, basic_block bb)' but with different arguments.
And call 'insert_insn_end_basic_block (rtx_insn *pat, basic_block bb)' in 'insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb)'
and VSETVL PASS in RISC-V port.
Remove redundant codes of VSETVL PASS in RISC-V port.
gcc/ChangeLog:
* config/riscv/riscv-vsetvl.cc (add_label_notes): Remove it.
(insert_insn_end_basic_block): Ditto.
(pass_vsetvl::commit_vsetvls): Adapt for new helper function.
* gcse.cc (insert_insn_end_basic_block): Export as global function.
* gcse.h (insert_insn_end_basic_block): Ditto.
Diffstat (limited to 'gcc/gcse.cc')
-rw-r--r-- | gcc/gcse.cc | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/gcc/gcse.cc b/gcc/gcse.cc index 8413c9a..f689c0c 100644 --- a/gcc/gcse.cc +++ b/gcc/gcse.cc @@ -2013,20 +2013,16 @@ process_insert_insn (struct gcse_expr *expr) return prepare_copy_insn (reg, exp); } -/* Add EXPR to the end of basic block BB. - - This is used by both the PRE and code hoisting. */ +/* Return the INSN which is added at the end of the block BB with + same instruction pattern with PAT. */ -static void -insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb) +rtx_insn * +insert_insn_end_basic_block (rtx_insn *pat, basic_block bb) { rtx_insn *insn = BB_END (bb); rtx_insn *new_insn; - rtx reg = expr->reaching_reg; - int regno = REGNO (reg); - rtx_insn *pat, *pat_end; + rtx_insn *pat_end; - pat = process_insert_insn (expr); gcc_assert (pat && INSN_P (pat)); pat_end = pat; @@ -2086,6 +2082,21 @@ insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb) break; pat = NEXT_INSN (pat); } + return new_insn; +} + +/* Add EXPR to the end of basic block BB. + + This is used by both the PRE and code hoisting. */ + +static void +insert_insn_end_basic_block (struct gcse_expr *expr, basic_block bb) +{ + rtx reg = expr->reaching_reg; + int regno = REGNO (reg); + + rtx_insn *insn = process_insert_insn (expr); + rtx_insn *new_insn = insert_insn_end_basic_block (insn, bb); gcse_create_count++; |