From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1012) id 3F9C53858C01; Thu, 28 Sep 2023 13:42:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F9C53858C01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1695908543; bh=VwyFcMHsVQ76+vXmg+bvyK0tPj1MxijDIyb86qPkxo4=; h=From:To:Subject:Date:From; b=tpXYL8ajiLMKxaX1ATfOlHFv4Ok6py5CA++7dL+mcVfli+p8bO6SyQCb67FtNWNCi iRVcLujpOuazxkGPDFB8obDId1QOPbBxYUhefbtSB9aKCDpMpEW6Uh9z84txrNHnTQ rFctNZdSU3LpxJSuVgyx5fhHb36ktenjFocHhaKA= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Vladimir Makarov To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-4309] [RA]: Add flag for checking IRA in progress X-Act-Checkin: gcc X-Git-Author: Vladimir N. Makarov X-Git-Refname: refs/heads/trunk X-Git-Oldrev: f194c684a28a5d449bd034a2c604d04ba465e4fe X-Git-Newrev: 0c8ecbcd3cf7d7187d2017ad02b663a57123b417 Message-Id: <20230928134223.3F9C53858C01@sourceware.org> Date: Thu, 28 Sep 2023 13:42:23 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0c8ecbcd3cf7d7187d2017ad02b663a57123b417 commit r14-4309-g0c8ecbcd3cf7d7187d2017ad02b663a57123b417 Author: Vladimir N. Makarov Date: Thu Sep 28 09:41:18 2023 -0400 [RA]: Add flag for checking IRA in progress RISCV target developers need a flag to prevent creating insns in IRA which can not be split after RA as they will need a temporary reg. The patch introduces such flag. gcc/ChangeLog: * rtl.h (lra_in_progress): Change type to bool. (ira_in_progress): Add new extern. * ira.cc (ira_in_progress): New global. (pass_ira::execute): Set up ira_in_progress. * lra.cc: (lra_in_progress): Change type to bool and initialize. (lra): Use bool values for lra_in_progress. * lra-eliminations.cc (init_elim_table): Ditto. Diff: --- gcc/ira.cc | 5 +++++ gcc/lra-eliminations.cc | 4 ++-- gcc/lra.cc | 8 ++++---- gcc/rtl.h | 7 +++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/ira.cc b/gcc/ira.cc index 0b0d460689d..d7530f01380 100644 --- a/gcc/ira.cc +++ b/gcc/ira.cc @@ -5542,6 +5542,9 @@ bool ira_conflicts_p; /* Saved between IRA and reload. */ static int saved_flag_ira_share_spill_slots; +/* Set to true while in IRA. */ +bool ira_in_progress = false; + /* This is the main entry of IRA. */ static void ira (FILE *f) @@ -6110,7 +6113,9 @@ public: } unsigned int execute (function *) final override { + ira_in_progress = true; ira (dump_file); + ira_in_progress = false; return 0; } diff --git a/gcc/lra-eliminations.cc b/gcc/lra-eliminations.cc index 4daaff1a124..9ff4774cf5d 100644 --- a/gcc/lra-eliminations.cc +++ b/gcc/lra-eliminations.cc @@ -1294,14 +1294,14 @@ init_elim_table (void) will cause, e.g., gen_rtx_REG (Pmode, STACK_POINTER_REGNUM) to equal stack_pointer_rtx. We depend on this. Threfore we switch off that we are in LRA temporarily. */ - lra_in_progress = 0; + lra_in_progress = false; for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) { ep->from_rtx = gen_rtx_REG (Pmode, ep->from); ep->to_rtx = gen_rtx_REG (Pmode, ep->to); eliminable_reg_rtx[ep->from] = ep->from_rtx; } - lra_in_progress = 1; + lra_in_progress = true; } /* Function for initialization of elimination once per function. It diff --git a/gcc/lra.cc b/gcc/lra.cc index 361f84fdacb..bcc00ff7d6b 100644 --- a/gcc/lra.cc +++ b/gcc/lra.cc @@ -2262,8 +2262,8 @@ update_inc_notes (void) } } -/* Set to 1 while in lra. */ -int lra_in_progress; +/* Set to true while in LRA. */ +bool lra_in_progress = false; /* Start of pseudo regnos before the LRA. */ int lra_new_regno_start; @@ -2360,7 +2360,7 @@ lra (FILE *f) if (flag_checking) check_rtl (false); - lra_in_progress = 1; + lra_in_progress = true; lra_live_range_iter = lra_coalesce_iter = lra_constraint_iter = 0; lra_assignment_iter = lra_assignment_iter_after_spill = 0; @@ -2552,7 +2552,7 @@ lra (FILE *f) ira_restore_scratches (lra_dump_file); lra_eliminate (true, false); lra_final_code_change (); - lra_in_progress = 0; + lra_in_progress = false; if (live_p) lra_clear_live_ranges (); lra_live_ranges_finish (); diff --git a/gcc/rtl.h b/gcc/rtl.h index 102ad9b57a6..8e59cd5d156 100644 --- a/gcc/rtl.h +++ b/gcc/rtl.h @@ -4108,8 +4108,11 @@ extern int epilogue_completed; extern int reload_in_progress; -/* Set to 1 while in lra. */ -extern int lra_in_progress; +/* Set to true while in IRA. */ +extern bool ira_in_progress; + +/* Set to true while in LRA. */ +extern bool lra_in_progress; /* This macro indicates whether you may create a new pseudo-register. */