From bd1cd0d0e0fecc6ac8632c266591767392480746 Mon Sep 17 00:00:00 2001 From: Segher Boessenkool Date: Fri, 23 Apr 2021 19:59:00 +0000 Subject: Remove CC0 This removes CC0 and all directly related infrastructure. CC_STATUS, CC_STATUS_MDEP, CC_STATUS_MDEP_INIT, and NOTICE_UPDATE_CC are deleted and poisoned. CC0 is only deleted (some targets use that name for something else). HAVE_cc0 is automatically generated, and we no longer will do that after this patch. CC_STATUS_INIT is suggested in final.c to also be useful for ports that are not CC0, and at least arm seems to use it for something. So I am leaving that alone, but most targets that have it could remove it. 2021-05-04 Segher Boessenkool * caller-save.c: Remove CC0. * cfgcleanup.c: Remove CC0. * cfgrtl.c: Remove CC0. * combine.c: Remove CC0. * compare-elim.c: Remove CC0. * conditions.h: Remove CC0. * config/h8300/h8300.h: Remove CC0. * config/h8300/h8300-protos.h: Remove CC0. * config/h8300/peepholes.md: Remove CC0. * config/i386/x86-tune-sched.c: Remove CC0. * config/m68k/m68k.c: Remove CC0. * config/rl78/rl78.c: Remove CC0. * config/sparc/sparc.c: Remove CC0. * config/xtensa/xtensa.c: Remove CC0. (gen_conditional_move): Use pc_rtx instead of cc0_rtx in a piece of RTL where that is used as a placeholder only. * cprop.c: Remove CC0. * cse.c: Remove CC0. * cselib.c: Remove CC0. * df-problems.c: Remove CC0. * df-scan.c: Remove CC0. * doc/md.texi: Remove CC0. Adjust an example. * doc/rtl.texi: Remove CC0. Adjust an example. * doc/tm.texi: Regenerate. * doc/tm.texi.in: Remove CC0. * emit-rtl.c: Remove CC0. * final.c: Remove CC0. * fwprop.c: Remove CC0. * gcse-common.c: Remove CC0. * gcse.c: Remove CC0. * genattrtab.c: Remove CC0. * genconfig.c: Remove CC0. * genemit.c: Remove CC0. * genextract.c: Remove CC0. * gengenrtl.c: Remove CC0. * genrecog.c: Remove CC0. * haifa-sched.c: Remove CC0. * ifcvt.c: Remove CC0. * ira-costs.c: Remove CC0. * ira.c: Remove CC0. * jump.c: Remove CC0. * loop-invariant.c: Remove CC0. * lra-constraints.c: Remove CC0. * lra-eliminations.c: Remove CC0. * optabs.c: Remove CC0. * postreload-gcse.c: Remove CC0. * postreload.c: Remove CC0. * print-rtl.c: Remove CC0. * read-rtl-function.c: Remove CC0. * reg-notes.def: Remove CC0. * reg-stack.c: Remove CC0. * reginfo.c: Remove CC0. * regrename.c: Remove CC0. * reload.c: Remove CC0. * reload1.c: Remove CC0. * reorg.c: Remove CC0. * resource.c: Remove CC0. * rtl.c: Remove CC0. * rtl.def: Remove CC0. * rtl.h: Remove CC0. * rtlanal.c: Remove CC0. * sched-deps.c: Remove CC0. * sched-rgn.c: Remove CC0. * shrink-wrap.c: Remove CC0. * simplify-rtx.c: Remove CC0. * system.h: Remove CC0. Poison NOTICE_UPDATE_CC, CC_STATUS_MDEP_INIT, CC_STATUS_MDEP, and CC_STATUS. * target.def: Remove CC0. * valtrack.c: Remove CC0. * var-tracking.c: Remove CC0. --- gcc/df-scan.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/df-scan.c') diff --git a/gcc/df-scan.c b/gcc/df-scan.c index b9b6d2b..6691c3e 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -2816,7 +2816,6 @@ df_uses_record (class df_collection_rec *collection_rec, case CONST: CASE_CONST_ANY: case PC: - case CC0: case ADDR_VEC: case ADDR_DIFF_VEC: return; @@ -2902,7 +2901,6 @@ df_uses_record (class df_collection_rec *collection_rec, case PARALLEL: case SCRATCH: case PC: - case CC0: break; case MEM: df_uses_record (collection_rec, &XEXP (dst, 0), -- cgit v1.1 From 16465ceb06cc1f65cfca3c0eb2c1ee27ab03bdfd Mon Sep 17 00:00:00 2001 From: liuhongt Date: Tue, 1 Jun 2021 09:00:57 +0800 Subject: CALL_INSN may not be a real function call. Use "used" flag for CALL_INSN to indicate it's a fake call. If it's a fake call, it won't have its own function stack. gcc/ChangeLog PR target/82735 * df-scan.c (df_get_call_refs): When call_insn is a fake call, it won't use stack pointer reg. * final.c (leaf_function_p): When call_insn is a fake call, it won't affect caller as a leaf function. * reg-stack.c (callee_clobbers_any_stack_reg): New. (subst_stack_regs): When call_insn doesn't clobber any stack reg, don't clear the arguments. * rtl.c (shallow_copy_rtx): Don't clear flag used when orig is a insn. * shrink-wrap.c (requires_stack_frame_p): No need for stack frame for a fake call. * rtl.h (FAKE_CALL_P): New macro. --- gcc/df-scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/df-scan.c') diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 6691c3e..1268536 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -3090,7 +3090,8 @@ df_get_call_refs (class df_collection_rec *collection_rec, for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { - if (i == STACK_POINTER_REGNUM) + if (i == STACK_POINTER_REGNUM + && !FAKE_CALL_P (insn_info->insn)) /* The stack ptr is used (honorarily) by a CALL insn. */ df_ref_record (DF_REF_BASE, collection_rec, regno_reg_rtx[i], NULL, bb, insn_info, DF_REF_REG_USE, -- cgit v1.1 From 7232f7c4c2d727431096a7ecfcf4ad4db71dcf2a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 13 Jun 2021 14:00:12 -0400 Subject: expand: empty class return optimization [PR88529] The x86_64 psABI says that an empty class isn't passed or returned in memory or registers, so we shouldn't set %eax in this function. The df-scan hunk catches the case where we look at a 0-length reg and build a range the length of unsigned int, which happened before I changed assign_parms to match expand_function_end. PR target/88529 gcc/ChangeLog: * df-scan.c (df_ref_record): Check that regno < endregno. * function.c (assign_parms, expand_function_end): Do nothing with a TYPE_EMPTY_P result. gcc/testsuite/ChangeLog: * g++.target/i386/empty-class1.C: New test. --- gcc/df-scan.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/df-scan.c') diff --git a/gcc/df-scan.c b/gcc/df-scan.c index 1268536..e9da64f 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -2595,6 +2595,8 @@ df_ref_record (enum df_ref_class cl, ref_flags |= DF_REF_PARTIAL; ref_flags |= DF_REF_MW_HARDREG; + gcc_assert (regno < endregno); + hardreg = problem_data->mw_reg_pool->allocate (); hardreg->type = ref_type; hardreg->flags = ref_flags; -- cgit v1.1 From 9872bd8c35be0f4d475fac739115cf5b82cdabc0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 24 Jun 2021 12:24:48 +0200 Subject: df: Fix up handling of paradoxical subregs in debug insns [PR101170] The recent addition of gcc_assert (regno < endregno); triggers during glibc build on m68k. The problem is that RA decisions shouldn't depend on expressions in DEBUG_INSNs and those expressions can contain paradoxical subregs of certain pseudos. If RA then decides to allocate the pseudo to a register with very small hard register REGNO, we can trigger the new assert, as (int) subreg_regno_offset may be negative on big endian and the small REGNO + the negative offset can wrap around. The following patch in that case records the range from the REGNO 0 to endregno, before the addition of the assert as both regno and endregno are unsigned it wouldn't record anything at all silently. 2021-06-24 Jakub Jelinek PR middle-end/101170 * df-scan.c (df_ref_record): For paradoxical big-endian SUBREGs where regno + subreg_regno_offset wraps around use 0 as starting regno. * gcc.dg/pr101170.c: New test. --- gcc/df-scan.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'gcc/df-scan.c') diff --git a/gcc/df-scan.c b/gcc/df-scan.c index e9da64f..3dbda7a 100644 --- a/gcc/df-scan.c +++ b/gcc/df-scan.c @@ -2576,9 +2576,21 @@ df_ref_record (enum df_ref_class cl, if (GET_CODE (reg) == SUBREG) { - regno += subreg_regno_offset (regno, GET_MODE (SUBREG_REG (reg)), - SUBREG_BYTE (reg), GET_MODE (reg)); - endregno = regno + subreg_nregs (reg); + int off = subreg_regno_offset (regno, GET_MODE (SUBREG_REG (reg)), + SUBREG_BYTE (reg), GET_MODE (reg)); + unsigned int nregno = regno + off; + endregno = nregno + subreg_nregs (reg); + if (off < 0 && regno < (unsigned) -off) + /* Deal with paradoxical SUBREGs on big endian where + in debug insns the hard reg number might be smaller + than -off, such as (subreg:DI (reg:SI 0 [+4 ]) 0)); + RA decisions shouldn't be affected by debug insns + and so RA can decide to put pseudo into a hard reg + with small REGNO, even when it is referenced in + a paradoxical SUBREG in a debug insn. */ + regno = 0; + else + regno = nregno; } else endregno = END_REGNO (reg); -- cgit v1.1