Message ID | 20231031225144.24448-1-ewlu@rivosinc.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:abcd:0:b0:403:3b70:6f57 with SMTP id f13csp67725vqx; Tue, 31 Oct 2023 15:52:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGugWXZx4SWyapRkchsCpxH9SmVtBbuM95fLZ7I1UqolCykc77yYMgk3bTwfuU7AnBDg3zr X-Received: by 2002:a05:622a:130c:b0:41e:54be:7956 with SMTP id v12-20020a05622a130c00b0041e54be7956mr13430190qtk.46.1698792734324; Tue, 31 Oct 2023 15:52:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698792734; cv=pass; d=google.com; s=arc-20160816; b=c8FRpa5Lfm5eKpgNIkyYOksmO8oGuApgueHpvla8lhPwiQ9xxsL8kxhed6V0Dh4l11 bSXBOFL/f6qWJ8UKuCfI7uXtNXoGF+GD8/vEeU/eRZXoaXOUm809J+01SPvGWdtL+vAg 0HaHmgusFPobD1nlDE6/yUv39+xRxx7q3xy816pup2NL4svZ7wyBk/ygdOvbQZSM+KLk RAws950wxXpnm3FIC0RDdwy53etz4DpC1Reta/sPiAjxr8F2bJPkGj1gIszzytiwD11/ beKb7uwBbrZD3myz3VRlBkSRXOnYNhSgP7BJi3mnZkrwK0Y+LuYzgEd7as+eR74O4UzG yxJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=OlRJlv7bQGYs2DhvY5fDOjiLLmfwynjgKy3pMoPfBUg=; fh=zhYFxclBfTKAWtXB1Gl5nS7+4VD7hX+sRpwxbYWOBUg=; b=fOZmrTmL8/s0HARO3+3nF1a5ax+Q0M6uX0czV9NOu+HAKMJ4m5tyq0g00keWqTozUP q428/tIpbHfadWTGa1XjpCJZWQCeNOz/e1PLkXxvdYCG80ZN1iw4/vtIvL+aKjVAn92g 38tBSlLY3TWUsdIOHLBFr/MWbFIqTMZ7B/qUnnymfyZ1O2X4Aq5WybstSAvgTfNLDb08 iPw0kWNUY1/IL31X8nKSQxRqZ+q6QlelDUST3HKnAYz3PArpCeTrD15KoS04nF4BFZvS 9q4ifW0J+ODwlxh5caZA8NNJsGlivVS4wOrTi38pIhA0dMLW/UJhho6ccyfsaztXSbZ2 CO8Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CHcIKuAl; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i11-20020ac85e4b000000b004181b5c82b9si1929904qtx.83.2023.10.31.15.52.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 15:52:14 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=CHcIKuAl; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1BE9F3857715 for <ouuuleilei@gmail.com>; Tue, 31 Oct 2023 22:52:14 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oa1-x32.google.com (mail-oa1-x32.google.com [IPv6:2001:4860:4864:20::32]) by sourceware.org (Postfix) with ESMTPS id 705CE3858D1E for <gcc-patches@gcc.gnu.org>; Tue, 31 Oct 2023 22:51:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 705CE3858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rivosinc.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 705CE3858D1E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::32 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698792711; cv=none; b=gUvb2BJpiFDKm4neZHcGf7BbTisM5QMCUhuk67yx3c7V7bfju7rIedWP+ChAgchzS5Xbt6gGcqYFKx1DlblFHNj1vDl0Ar7fZR2e176jE8tRZqRc1lZAR5fuAYCXgS6hRV8rP0OjBk+TSpgmQJdYImirtTd0LNYfUTUPnnVzmts= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698792711; c=relaxed/simple; bh=e6XTkyAi2R+p+x/oQsjF0M2AAaNhKPTZsPWL+ztXXik=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=ScBn3ZrIfYKFUPnUuY6MAHruy19+P9mXSV7CFrRaDuqxXqNCUc2HEF7zF1rwkmslgaIqyqiiNMxTrZqxQM/TJJ4lGD7m7891wssOf7kmNvBm4JeJafe9VV00hSmGvPHcpKspMPOkIXsMLTIkHsTCG4jnxFGDXnUu/bL9SkxE6Fo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-1dc9c2b2b79so2810258fac.0 for <gcc-patches@gcc.gnu.org>; Tue, 31 Oct 2023 15:51:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1698792708; x=1699397508; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OlRJlv7bQGYs2DhvY5fDOjiLLmfwynjgKy3pMoPfBUg=; b=CHcIKuAlGzIdEiXsFmv/d1v7CTVbge6OR8I5wE6YBZAkVnmxs37kyGyIi+dyfETiI8 +zc6tCSfk+yNi4TYzvfNCQkI3A5lhtxoFv13Ml0OaghF8iWOjpziuuiQaSUdD0zEJJt2 2FAx4E26FI+DNrt6kpegHUjm71bhksIZkbHmgDGAHYw6O+eHgAdqJZdLoVIEl7S5/9Yb FDTTFOI6g2MVol/p9oefzsthRs0n3gE2rGhQTvtvo877JK+Fon+jjsAxqm0+ZeRR7UB+ iFLDszUz6yoS/xzXHO+YVbqwDGEFTS8rK0U4Q2NkyYKEgdrN7p8E3zuTAkxvVF8Qk+7j pnIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698792708; x=1699397508; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OlRJlv7bQGYs2DhvY5fDOjiLLmfwynjgKy3pMoPfBUg=; b=odmziEarfzx9wmn1GnLvXUGen1BTqTHC2rNPhC6yP9CwlYbuBHBr3GXUG823uGcEEk 7lM5bNPkeOf3ce5jCndJODzRWWYhkz1QAamY8t9BerpQZfrPb/gp98VyTGdVY3oMeeRf evEWPHpmudAkwkSzIqba7sHDqb8RdQ28Aks+bUcQwK7nmva6FfYDIW45iTmtDLxA2DOf zMkjUR2xINGg4WcMggBW76Iwh5N0xXxa32WakvB6Zzo+9cWELy4qO06+Pfqsi3hLG1ll ZkKaF3qnmkaWQFoo056zECUCUazUA9t8i4YpyiiJjHtufZbpZlWfuiNyNqSDAOKtnFHn RjIw== X-Gm-Message-State: AOJu0YzUkZQzbTssN/sdQbN2Zv2FgzxeVMCSYDp1JylUfPQ14Aqr8Hts V/lYz4DmQnnydmrFZbA+PTJh5yjpUKGfoAOMK9E= X-Received: by 2002:a05:6870:1004:b0:1d5:b1c7:3617 with SMTP id 4-20020a056870100400b001d5b1c73617mr11013120oai.13.1698792708614; Tue, 31 Oct 2023 15:51:48 -0700 (PDT) Received: from ewlu.ba.rivosinc.com ([64.71.180.162]) by smtp.gmail.com with ESMTPSA id n6-20020a05687104c600b001eae28db525sm58487oai.23.2023.10.31.15.51.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 15:51:48 -0700 (PDT) From: Edwin Lu <ewlu@rivosinc.com> To: gcc-patches@gcc.gnu.org Cc: gnu-toolchain@rivosinc.com, jeffreyalaw@gmail.com, Edwin Lu <ewlu@rivosinc.com> Subject: [RFC] Make genautomata.cc output reflect insn-attr.h expectation: Date: Tue, 31 Oct 2023 15:51:44 -0700 Message-Id: <20231031225144.24448-1-ewlu@rivosinc.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781313290201879777 X-GMAIL-MSGID: 1781313290201879777 |
Series |
[RFC] Make genautomata.cc output reflect insn-attr.h expectation:
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Edwin Lu
Oct. 31, 2023, 10:51 p.m. UTC
genattr.cc currently generates insn-attr.h with the following structure:
#if CPU_UNITS_QUERY
extern int get_cpu_unit_code (const char *);
extern int cpu_unit_reservation_p (state_t, int);
#endif
extern bool insn_has_dfa_reservation_p (rtx_insn *);
however genautomata.cc generates insn-automata.cc with the following structure:
#if CPU_UNITS_QUERY
int get_cpu_unit_code (const char * ) { ... }
int cpu_unit_reservation_p (state_t, int) { ... }
bool insn_has_dfa_reservation_p (rtx_insn *) { ... }
#endif
I'm not sure if insn_has_dfa_reservation_p is supposed to be a part of the
CPU_UNITS_QUERY conditional group or not. For consistency, I would like to
move it outside of the group.
This would move insn_has_dfa_reservation_p out of the #if CPU_UNITS_QUERY
conditional inside of insn-automata.cc. This would allow us to see if the
scheduler is trying to schedule an insn with a type which is not associated
with a cpu unit or insn reservation through the TARGET_SCHED_VARIABLE_ISSUE
hook.
If there is a reason for insn_has_dfa_reservation_p being within the
conditional, please let me know!
gcc/Changelog:
* genautomata.cc (write_automata): move endif
Signed-off-by: Edwin Lu <ewlu@rivosinc.com>
---
gcc/genautomata.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On 10/31/23 18:51, Edwin Lu wrote: > genattr.cc currently generates insn-attr.h with the following structure: > > #if CPU_UNITS_QUERY > extern int get_cpu_unit_code (const char *); > extern int cpu_unit_reservation_p (state_t, int); > #endif > extern bool insn_has_dfa_reservation_p (rtx_insn *); > > however genautomata.cc generates insn-automata.cc with the following structure: > #if CPU_UNITS_QUERY > int get_cpu_unit_code (const char * ) { ... } > int cpu_unit_reservation_p (state_t, int) { ... } > bool insn_has_dfa_reservation_p (rtx_insn *) { ... } > #endif > > I'm not sure if insn_has_dfa_reservation_p is supposed to be a part of the > CPU_UNITS_QUERY conditional group or not. For consistency, I would like to > move it outside of the group. No, it should be not considered a part of cpu unit query group. The function just says that there is any cpu reservation by insns. Two other functions say that the state is still reserving a particular cpu unit. Using these 2 functions requires a lot of memory for their implementation and prevent further dfa minimizations. The functions should be used mostly for VLIW CPUs when we need this information to generate machine insns (e.g, ia64 VLIW insn template). > This would move insn_has_dfa_reservation_p out of the #if CPU_UNITS_QUERY > conditional inside of insn-automata.cc. This would allow us to see if the > scheduler is trying to schedule an insn with a type which is not associated > with a cpu unit or insn reservation through the TARGET_SCHED_VARIABLE_ISSUE > hook. > > If there is a reason for insn_has_dfa_reservation_p being within the > conditional, please let me know! It seems a typo. The patch is ok for me. Thank you for finding this out. > gcc/Changelog: > > * genautomata.cc (write_automata): move endif > > Signed-off-by: Edwin Lu <ewlu@rivosinc.com> > --- > gcc/genautomata.cc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc > index 72f01686d6b..9dda25e5ba2 100644 > --- a/gcc/genautomata.cc > +++ b/gcc/genautomata.cc > @@ -9503,9 +9503,9 @@ write_automata (void) > fprintf (output_file, "\n#if %s\n\n", CPU_UNITS_QUERY_MACRO_NAME); > output_get_cpu_unit_code_func (); > output_cpu_unit_reservation_p (); > - output_insn_has_dfa_reservation_p (); > fprintf (output_file, "\n#endif /* #if %s */\n\n", > CPU_UNITS_QUERY_MACRO_NAME); > + output_insn_has_dfa_reservation_p (); > output_dfa_clean_insn_cache_func (); > output_dfa_start_func (); > output_dfa_finish_func ();
On 11/1/2023 8:07 AM, Vladimir Makarov wrote: > > On 10/31/23 18:51, Edwin Lu wrote: >> genattr.cc currently generates insn-attr.h with the following structure: >> >> #if CPU_UNITS_QUERY >> extern int get_cpu_unit_code (const char *); >> extern int cpu_unit_reservation_p (state_t, int); >> #endif >> extern bool insn_has_dfa_reservation_p (rtx_insn *); >> >> however genautomata.cc generates insn-automata.cc with the following >> structure: >> #if CPU_UNITS_QUERY >> int get_cpu_unit_code (const char * ) { ... } >> int cpu_unit_reservation_p (state_t, int) { ... } >> bool insn_has_dfa_reservation_p (rtx_insn *) { ... } >> #endif >> >> I'm not sure if insn_has_dfa_reservation_p is supposed to be a part of >> the >> CPU_UNITS_QUERY conditional group or not. For consistency, I would >> like to >> move it outside of the group. > > No, it should be not considered a part of cpu unit query group. The > function just says that there is any cpu reservation by insns. > > Two other functions say that the state is still reserving a particular > cpu unit. Using these 2 functions requires a lot of memory for their > implementation and prevent further dfa minimizations. The functions > should be used mostly for VLIW CPUs when we need this information to > generate machine insns (e.g, ia64 VLIW insn template). > Thanks for the clarification! >> This would move insn_has_dfa_reservation_p out of the #if CPU_UNITS_QUERY >> conditional inside of insn-automata.cc. This would allow us to see if the >> scheduler is trying to schedule an insn with a type which is not >> associated >> with a cpu unit or insn reservation through the >> TARGET_SCHED_VARIABLE_ISSUE >> hook. >> >> If there is a reason for insn_has_dfa_reservation_p being within the >> conditional, please let me know! > > It seems a typo. > > The patch is ok for me. Thank you for finding this out. > Committed! Edwin >> gcc/Changelog: >> >> * genautomata.cc (write_automata): move endif >> >> Signed-off-by: Edwin Lu <ewlu@rivosinc.com> >> --- >> gcc/genautomata.cc | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc >> index 72f01686d6b..9dda25e5ba2 100644 >> --- a/gcc/genautomata.cc >> +++ b/gcc/genautomata.cc >> @@ -9503,9 +9503,9 @@ write_automata (void) >> fprintf (output_file, "\n#if %s\n\n", CPU_UNITS_QUERY_MACRO_NAME); >> output_get_cpu_unit_code_func (); >> output_cpu_unit_reservation_p (); >> - output_insn_has_dfa_reservation_p (); >> fprintf (output_file, "\n#endif /* #if %s */\n\n", >> CPU_UNITS_QUERY_MACRO_NAME); >> + output_insn_has_dfa_reservation_p (); >> output_dfa_clean_insn_cache_func (); >> output_dfa_start_func (); >> output_dfa_finish_func (); > >
diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc index 72f01686d6b..9dda25e5ba2 100644 --- a/gcc/genautomata.cc +++ b/gcc/genautomata.cc @@ -9503,9 +9503,9 @@ write_automata (void) fprintf (output_file, "\n#if %s\n\n", CPU_UNITS_QUERY_MACRO_NAME); output_get_cpu_unit_code_func (); output_cpu_unit_reservation_p (); - output_insn_has_dfa_reservation_p (); fprintf (output_file, "\n#endif /* #if %s */\n\n", CPU_UNITS_QUERY_MACRO_NAME); + output_insn_has_dfa_reservation_p (); output_dfa_clean_insn_cache_func (); output_dfa_start_func (); output_dfa_finish_func ();