[PATCH] genrecog.cc (print_nonbool_test): Fix type error of SUBREG_BYTE
* gcc/genrecog.cc (print_nonbool_test): Fix type error of SUBREG_BYTE --- gcc/genrecog.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/genrecog.cc b/gcc/genrecog.cc index 77f8fb97853..319e437e334 100644 --- a/gcc/genrecog.cc +++ b/gcc/genrecog.cc @@ -4619,6 +4619,7 @@ print_nonbool_test (output_state *os, const rtx_test ) printf ("SUBREG_BYTE ("); print_test_rtx (os, test); printf (")"); + printf (".to_constant ()"); break; case rtx_test::WIDE_INT_FIELD: -- 2.24.3 (Apple Git-128)
Re: [PATCH v2] regrename: Skip renaming if instruction is noop move.
Hi, Thank you for your review & help. I could not fetch the merged patch from gcc master of git. Is there any problem for this ? Thanks. — Jojo 在 2021年12月3日 +0800 PM10:57,Jeff Law ,写道: > > > On 12/2/2021 9:26 PM, Jojo R wrote: > > Skip renaming if instruction is noop move, and it will > > been removed for performance. > > > > gcc/ > > * regrename.c (find_rename_reg): Return satisfied regno > > if instruction is noop move. > OK > jeff
[PATCH v2] regrename: Skip renaming if instruction is noop move.
Skip renaming if instruction is noop move, and it will been removed for performance. gcc/ * regrename.c (find_rename_reg): Return satisfied regno if instruction is noop move. --- gcc/regrename.c | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/regrename.c b/gcc/regrename.c index b8a9ca36f22..fe72fcc3624 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -394,6 +394,11 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class, this_head, *unavailable)) return this_head->tied_chain->regno; + /* If this insn is a noop move, then do not rename in this chain as doing so + would inhibit removal of the noop move. */ + if (noop_move_p (this_head->first->insn)) +return best_new_reg; + /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass over registers that belong to PREFERRED_CLASS and try to find the best register within the class. If that failed, we iterate in -- 2.24.3 (Apple Git-128)
[PATCH v2] regrename: Skip renaming if instruction is noop move.
Skip renaming if instruction is noop move, and it will been removed for performance. gcc/ * regrename.c (find_rename_reg): Return satisfied regno if instruction is noop move. --- gcc/regrename.c | 5 + 1 file changed, 5 insertions(+) diff --git a/gcc/regrename.c b/gcc/regrename.c index b8a9ca36f22..fe72fcc3624 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -394,6 +394,11 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class, this_head, *unavailable)) return this_head->tied_chain->regno; + /* If this insn is a noop move, then do not rename in this chain as doing so + would inhibit removal of the noop move. */ + if (noop_move_p (this_head->first->insn)) +return best_new_reg; + /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass over registers that belong to PREFERRED_CLASS and try to find the best register within the class. If that failed, we iterate in -- 2.24.3 (Apple Git-128)
Re: [PATCH] regrename: Skip renaming if instruction is noop move.
— Jojo 在 2021年11月19日 +0800 AM12:13,Jeff Law ,写道: > > > On 11/16/2021 7:20 PM, Jojo R via Gcc-patches wrote: > > — Jojo > > 在 2021年11月16日 +0800 PM8:12,Richard Biener ,写道: > > > On Tue, Nov 16, 2021 at 12:45 PM Jojo R via Gcc-patches > > > wrote: > > > > Skip renaming if instruction is noop move, and it will > > > > been removed for performance. > > > Is there any (target specific) testcase you can add? Such commits are > > > problematic > > > when later bisected to since the intent isn't clear. > > I made a issue in bugzilla, please check it, thanks. > > > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103296 > So what Richi is asking is can you construct a testcase for the > testsuite? Having a BZ is helpful because we can reference it in the > commit message, but a test, even if it's target specific, is even better > from a long term maintenance standpoint. > I found this issue from the ISA extension vector of risc-v target, and It has not been upstream by now, normal test case without vector isa Is difficult to construct for this patch, but I think it’s simple and useful for other ISAs or targets, or recommit this patch after our risc-v Vector ISA Is ready on master branch ? Any suggestions ? > Jeff
Re: [PATCH] regrename: Skip renaming if instruction is noop move.
— Jojo 在 2021年11月16日 +0800 PM8:12,Richard Biener ,写道: > On Tue, Nov 16, 2021 at 12:45 PM Jojo R via Gcc-patches > wrote: > > > > Skip renaming if instruction is noop move, and it will > > been removed for performance. > > Is there any (target specific) testcase you can add? Such commits are > problematic > when later bisected to since the intent isn't clear. I made a issue in bugzilla, please check it, thanks. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103296 > > > gcc/ > > * regrename.c (find_rename_reg): Return satisfied regno > > if instruction is noop move. > > --- > > gcc/regrename.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/gcc/regrename.c b/gcc/regrename.c > > index b8a9ca36f22..cb605f5176b 100644 > > --- a/gcc/regrename.c > > +++ b/gcc/regrename.c > > @@ -394,6 +394,9 @@ find_rename_reg (du_head_p this_head, enum reg_class > > super_class, > > this_head, *unavailable)) > > return this_head->tied_chain->regno; > > > > + if (noop_move_p (this_head->first->insn)) > > + return best_new_reg; > > + > > /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass > > over registers that belong to PREFERRED_CLASS and try to find the > > best register within the class. If that failed, we iterate in > > -- > > 2.24.3 (Apple Git-128)
[PATCH] regrename: Skip renaming if instruction is noop move.
Skip renaming if instruction is noop move, and it will been removed for performance. gcc/ * regrename.c (find_rename_reg): Return satisfied regno if instruction is noop move. --- gcc/regrename.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/regrename.c b/gcc/regrename.c index b8a9ca36f22..cb605f5176b 100644 --- a/gcc/regrename.c +++ b/gcc/regrename.c @@ -394,6 +394,9 @@ find_rename_reg (du_head_p this_head, enum reg_class super_class, this_head, *unavailable)) return this_head->tied_chain->regno; + if (noop_move_p (this_head->first->insn)) +return best_new_reg; + /* If PREFERRED_CLASS is not NO_REGS, we iterate in the first pass over registers that belong to PREFERRED_CLASS and try to find the best register within the class. If that failed, we iterate in -- 2.24.3 (Apple Git-128)
Re: [PATCH 1/2] RISC-V: Add arch flags for T-HEAD.
Hi, - Add documents of XuanTie series [1]. - Add QEMU binary [2] by now, you can execute application with argument ‘-cpu c910’, and opening source is on the way. - Add my colleague [3] to commit patches of binutils [1] https://github.com/rjiejie/XuanTie-doc [2] https://github.com/rjiejie/thead-bin-qemu [3] lifang_...@c-sky.com Thanks, — Jojo 在 2021年7月22日 +0800 AM10:16,Jojo R ,写道: > > — Jojo > 在 2021年7月22日 +0800 AM4:53,Jim Wilson ,写道: > > On Tue, Jul 13, 2021 at 11:06 AM Palmer Dabbelt wrote: > > > Is there are documentation as to what this "theadc" extension is? > > > > The best doc I know of is https://github.com/isrc-cas/c910-llvmThe > > README is in Chinese, but google translate does a decent job on it. If you > > want more details, you have to read the llvm sources to see exactly what > > each instruction does. They have mentioned that they are working on > > English language docs, but I don't know when they will be available. > > There are quite a few T-Head specific instructions here. This patch is > > only adding support for a few of them, probably as a trial to see how it > > goes before they try to add the rest. > Hi, > > Please let me feed more details for this patch, > > There are about ~100+ instructions in our ISA spec, > and we put the RFC[1] to ask guide how to commit vendor extension ISAs, > we want to commit one type instruction every time, it’s helpful for > reviewing. > > Some Chinese T-HEAD ISA Specs have been on the our web page [2] already, > and we are converting these docs to english version to help your > reading :) > it will be out in the next week, including binutils. > > Thanks for your suggestion of the patch > > [1] https://github.com/riscv/riscv-gcc/issues/278 > [2] https://www.t-head.cn/technology > > Jim > >
Re: [PATCH] Adding target hook allows to reject initialization of register
— Jojo 在 2021年8月16日 +0800 PM3:15,Richard Biener ,写道: > On Fri, Aug 13, 2021 at 3:59 AM Jojo R wrote: > > > > > > — Jojo > > 在 2021年8月11日 +0800 PM6:44,Richard Biener ,写道: > > > > On Wed, Aug 11, 2021 at 11:28 AM Richard Sandiford > > wrote: > > > > > > Richard Biener writes: > > > > On Tue, Aug 10, 2021 at 10:33 AM Jojo R via Gcc-patches > > wrote: > > > > > > Some target like RISC-V allow to group vector register as a whole, > > and only operate part of it in fact, but the 'init-regs' pass will add > > initialization > > for uninitialized registers. Add this hook to reject this action for > > reducing instruction. > > > > > > Are these groups "visible"? That is, are the pseudos multi-reg > > pseudos? I wonder > > if there's a more generic way to tame down initregs w/o introducing a new > > target > > hook. > > > > Btw, initregs is a red herring - it ideally should go away. See PR61810. > > > > So instead of adding to it can you see whether disabling the pass for RISC-V > > works w/o fallout (and add a comment to the PR)? Maybe some more RTL > > literate (in particular DF literate) can look at the remaining issue. > > Richard, did you > > ever have a look into the "issue" that initregs covers up (whatever > > that exactly is)? > > > > > > No, sorry. I don't really understand what it would be from the comment > > in the code: > > > > [...] papers over some problems on the arm and other > > processors where certain isa constraints cannot be handled by gcc. > > These are of the form where two operands to an insn my not be the > > same. The ra will only make them the same if they do not > > interfere, and this can only happen if one is not initialized. > > > > That would definitely be an RA bug if true, since the constraints need > > to be applied independently of dataflow information. But the comment > > and code predate LRA and maybe no-one fancied poking around in reload > > (hard to believe). > > > > I'd be very surprised if LRA gets this wrong. > > > > > > OK, we're wondering since quite some time - how about changing the > > gate of initregs to optimize > 0 && !targetm.lra_p ()? We'll hopefully > > figure out the "real" issue the pass is papering over. At the same time > > we're leaving old reload (and likely unmaintianed) targets unaffected. > > > > Richard, > > > > So this patch is not necessary ? > > > > I need to disable this pass in my situation only ? > > I am afraid some side effect in my projects without this init-regs pass … > > ... > > Can you try disabling the pass on RISC-V? Okay, I will do the test on GCC version 10.2, is it ok ? It will take a few days :) Or which version do you suggest to do this ? > Richard. > > > Richard. > > > > Thanks, > > Richard
Re: [PATCH] Adding target hook allows to reject initialization of register
— Jojo 在 2021年8月11日 +0800 PM6:44,Richard Biener ,写道: > On Wed, Aug 11, 2021 at 11:28 AM Richard Sandiford > wrote: > > > > Richard Biener writes: > > > On Tue, Aug 10, 2021 at 10:33 AM Jojo R via Gcc-patches > > > wrote: > > > > > > > > Some target like RISC-V allow to group vector register as a whole, > > > > and only operate part of it in fact, but the 'init-regs' pass will add > > > > initialization > > > > for uninitialized registers. Add this hook to reject this action for > > > > reducing instruction. > > > > > > Are these groups "visible"? That is, are the pseudos multi-reg > > > pseudos? I wonder > > > if there's a more generic way to tame down initregs w/o introducing a new > > > target > > > hook. > > > > > > Btw, initregs is a red herring - it ideally should go away. See PR61810. > > > > > > So instead of adding to it can you see whether disabling the pass for > > > RISC-V > > > works w/o fallout (and add a comment to the PR)? Maybe some more RTL > > > literate (in particular DF literate) can look at the remaining issue. > > > Richard, did you > > > ever have a look into the "issue" that initregs covers up (whatever > > > that exactly is)? > > > > No, sorry. I don't really understand what it would be from the comment > > in the code: > > > > [...] papers over some problems on the arm and other > > processors where certain isa constraints cannot be handled by gcc. > > These are of the form where two operands to an insn my not be the > > same. The ra will only make them the same if they do not > > interfere, and this can only happen if one is not initialized. > > > > That would definitely be an RA bug if true, since the constraints need > > to be applied independently of dataflow information. But the comment > > and code predate LRA and maybe no-one fancied poking around in reload > > (hard to believe). > > > > I'd be very surprised if LRA gets this wrong. > > OK, we're wondering since quite some time - how about changing the > gate of initregs to optimize > 0 && !targetm.lra_p ()? We'll hopefully > figure out the "real" issue the pass is papering over. At the same time > we're leaving old reload (and likely unmaintianed) targets unaffected. > Richard, So this patch is not necessary ? I need to disable this pass in my situation only ? I am afraid some side effect in my projects without this init-regs pass … ... > Richard. > > > Thanks, > > Richard
Re: [PATCH] Adding target hook allows to reject initialization of register
— Jojo 在 2021年8月10日 +0800 PM7:03,Richard Biener ,写道: > On Tue, Aug 10, 2021 at 10:33 AM Jojo R via Gcc-patches > wrote: > > > > Some target like RISC-V allow to group vector register as a whole, > > and only operate part of it in fact, but the 'init-regs' pass will add > > initialization > > for uninitialized registers. Add this hook to reject this action for > > reducing instruction. > > Are these groups "visible"? That is, are the pseudos multi-reg > pseudos? I wonder > if there's a more generic way to tame down initregs w/o introducing a new > target > hook. > > Btw, initregs is a red herring - it ideally should go away. See PR61810. > > So instead of adding to it can you see whether disabling the pass for RISC-V > works w/o fallout (and add a comment to the PR)? Maybe some more RTL > literate (in particular DF literate) can look at the remaining issue. BTW, is there any side effect if I disable this init-regs pass ? > Richard, did you > ever have a look into the "issue" that initregs covers up (whatever > that exactly is)? > > Thanks, > Richard. > > > gcc/ > > * init-regs.c (initialize_uninitialized_regs): Call register_reject_init_p. > > * target.def (register_reject_init_p): New hook. > > * doc/tm.texi.in: Add TARGET_REGISTER_REJECT_INIT_P. > > * doc/tm.texi: Regenerated. > > --- > > gcc/doc/tm.texi | 6 ++ > > gcc/doc/tm.texi.in | 2 ++ > > gcc/init-regs.c | 5 + > > gcc/target.def | 8 > > 4 files changed, 21 insertions(+) > > > > diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi > > index a30fdcbbf3d6..83fd5496ca3f 100644 > > --- a/gcc/doc/tm.texi > > +++ b/gcc/doc/tm.texi > > @@ -12588,3 +12588,9 @@ Return an RTX representing @var{tagged_pointer} > > with its tag set to zero. > > Store the result in @var{target} if convenient. > > The default clears the top byte of the original pointer. > > @end deftypefn > > + > > +@deftypefn {Target Hook} bool TARGET_REGISTER_REJECT_INIT_P (rtx @var{reg}) > > +This target hook should return @code{true} if reject initialization for a > > uninitialized @var{reg}. > > + > > +The default value of this hook is @code{NULL}. > > +@end deftypefn > > diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in > > index 611fc500ac86..13174ce66d59 100644 > > --- a/gcc/doc/tm.texi.in > > +++ b/gcc/doc/tm.texi.in > > @@ -8180,3 +8180,5 @@ maintainer is familiar with. > > @hook TARGET_MEMTAG_EXTRACT_TAG > > > > @hook TARGET_MEMTAG_UNTAGGED_POINTER > > + > > +@hook TARGET_REGISTER_REJECT_INIT_P > > diff --git a/gcc/init-regs.c b/gcc/init-regs.c > > index 72e898f3e334..51c0d669d30b 100644 > > --- a/gcc/init-regs.c > > +++ b/gcc/init-regs.c > > @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see > > #include "system.h" > > #include "coretypes.h" > > #include "backend.h" > > +#include "target.h" > > #include "rtl.h" > > #include "tree.h" > > #include "df.h" > > @@ -101,6 +102,10 @@ initialize_uninitialized_regs (void) > > rtx_insn *move_insn; > > rtx reg = DF_REF_REAL_REG (use); > > > > + if (targetm.register_reject_init_p > > + && targetm.register_reject_init_p (reg)) > > + continue; > > + > > bitmap_set_bit (already_genned, regno); > > > > start_sequence (); > > diff --git a/gcc/target.def b/gcc/target.def > > index 7676d5e626e3..c2b54421618d 100644 > > --- a/gcc/target.def > > +++ b/gcc/target.def > > @@ -4545,6 +4545,14 @@ by a subtarget.", > > unsigned HOST_WIDE_INT, (void), > > NULL) > > > > +/* Return true if reject initialization for a uninitialized register. */ > > +DEFHOOK > > +(register_reject_init_p, > > + "This target hook should return @code{true} if reject initialization for > > a uninitialized @var{reg}.\n\ > > +\n\ > > +The default value of this hook is @code{NULL}.", > > + bool, (rtx reg), NULL) > > + > > /* Functions relating to calls - argument passing, returns, etc. */ > > /* Members of struct call have no special macro prefix. */ > > HOOK_VECTOR (TARGET_CALLS, calls) > > -- > > 2.24.3 (Apple Git-128)
Re: [PATCH] Adding target hook allows to reject initialization of register
— Jojo 在 2021年8月10日 +0800 PM7:03,Richard Biener ,写道: > On Tue, Aug 10, 2021 at 10:33 AM Jojo R via Gcc-patches > wrote: > > > > Some target like RISC-V allow to group vector register as a whole, > > and only operate part of it in fact, but the 'init-regs' pass will add > > initialization > > for uninitialized registers. Add this hook to reject this action for > > reducing instruction. > > Are these groups "visible"? That is, are the pseudos multi-reg > pseudos? I wonder > if there's a more generic way to tame down initregs w/o introducing a new > target > hook. Yes, it is visible. I make a simple demo as: vuint8m1_t foo (vuint8m1_t a, vuint8m2_t b, int vl) { vuint8m2_t tmp; tmp = vset_v_u8m1_u8m2(tmp, 0, a); tmp = vadd_vv_u8m2 (tmp, b, vl); return vget_v_u8m2_u8m1(tmp, 0); } The intrinsic spec refer to: https://github.com/riscv/rvv-intrinsic-doc/blob/master/rvv-intrinsic-api.md#vector-insertion-functions The problematic intrinsic is vset_v_u8m1_u8m2() here, Only half of it is operated, and RTL dump from ‘266r.auto_inc_dec’ is : (insn 11 8 12 2 (set (reg:VNx32QI 138 [ _10 ]) (unspec:VNx32QI [ (reg/v:VNx32QI 135 [ tmp ]) (reg:SI 66 vl) ] UNSPEC_USEVL)) "riscv_vector.h":235:1 21133 {*movvnx32qi} (expr_list:REG_DEAD (reg/v:VNx32QI 135 [ tmp ]) (nil))) (insn 12 11 13 2 (set (subreg:VNx16QI (reg:VNx32QI 138 [ _10 ]) 0) (unspec:VNx16QI [ (reg/v:VNx16QI 141 [ a ]) (reg:SI 66 vl) ] UNSPEC_USEVL)) "riscv_vector.h":235:1 21132 {*movvnx16qi} (expr_list:REG_DEAD (reg/v:VNx16QI 141 [ a ]) (expr_list:REG_DEAD (reg:SI 66 vl) (nil RTL dump from ‘267r.init-regs’ is : starting the processing of deferred insns ending the processing of deferred insns df_analyze called scanning new insn with uid = 24. scanning new insn with uid = 25. scanning new insn with uid = 26. scanning new insn with uid = 27. adding initialization in foo of reg 135 at in block 2 for insn 11. starting the processing of deferred insns ending the processing of deferred insns … … > > Btw, initregs is a red herring - it ideally should go away. See PR61810. > > So instead of adding to it can you see whether disabling the pass for RISC-V > works w/o fallout (and add a comment to the PR)? Maybe some more RTL > literate (in particular DF literate) can look at the remaining issue. > Richard, did you > ever have a look into the "issue" that initregs covers up (whatever > that exactly is)? > > Thanks, > Richard. > > > gcc/ > > * init-regs.c (initialize_uninitialized_regs): Call register_reject_init_p. > > * target.def (register_reject_init_p): New hook. > > * doc/tm.texi.in: Add TARGET_REGISTER_REJECT_INIT_P. > > * doc/tm.texi: Regenerated. > > --- > > gcc/doc/tm.texi | 6 ++ > > gcc/doc/tm.texi.in | 2 ++ > > gcc/init-regs.c | 5 + > > gcc/target.def | 8 > > 4 files changed, 21 insertions(+) > > > > diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi > > index a30fdcbbf3d6..83fd5496ca3f 100644 > > --- a/gcc/doc/tm.texi > > +++ b/gcc/doc/tm.texi > > @@ -12588,3 +12588,9 @@ Return an RTX representing @var{tagged_pointer} > > with its tag set to zero. > > Store the result in @var{target} if convenient. > > The default clears the top byte of the original pointer. > > @end deftypefn > > + > > +@deftypefn {Target Hook} bool TARGET_REGISTER_REJECT_INIT_P (rtx @var{reg}) > > +This target hook should return @code{true} if reject initialization for a > > uninitialized @var{reg}. > > + > > +The default value of this hook is @code{NULL}. > > +@end deftypefn > > diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in > > index 611fc500ac86..13174ce66d59 100644 > > --- a/gcc/doc/tm.texi.in > > +++ b/gcc/doc/tm.texi.in > > @@ -8180,3 +8180,5 @@ maintainer is familiar with. > > @hook TARGET_MEMTAG_EXTRACT_TAG > > > > @hook TARGET_MEMTAG_UNTAGGED_POINTER > > + > > +@hook TARGET_REGISTER_REJECT_INIT_P > > diff --git a/gcc/init-regs.c b/gcc/init-regs.c > > index 72e898f3e334..51c0d669d30b 100644 > > --- a/gcc/init-regs.c > > +++ b/gcc/init-regs.c > > @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see > > #include "system.h" > > #include "coretypes.h" > > #include "backend.h" > > +#include "target.h" > > #include "rtl.h" > > #include "tree.h" > > #include "df.h" > > @@ -101,6 +102,10 @@ initialize_uninitialized_regs (void) > > rtx_insn *move_insn; > > rtx reg = DF_REF_REAL_REG (use); > > > > + if (targetm.register_reject_init_p > > + && targetm.register_reject_init_p (reg)) >
[PATCH] Adding target hook allows to reject initialization of register
Some target like RISC-V allow to group vector register as a whole, and only operate part of it in fact, but the 'init-regs' pass will add initialization for uninitialized registers. Add this hook to reject this action for reducing instruction. gcc/ * init-regs.c (initialize_uninitialized_regs): Call register_reject_init_p. * target.def (register_reject_init_p): New hook. * doc/tm.texi.in: Add TARGET_REGISTER_REJECT_INIT_P. * doc/tm.texi: Regenerated. --- gcc/doc/tm.texi| 6 ++ gcc/doc/tm.texi.in | 2 ++ gcc/init-regs.c| 5 + gcc/target.def | 8 4 files changed, 21 insertions(+) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index a30fdcbbf3d6..83fd5496ca3f 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12588,3 +12588,9 @@ Return an RTX representing @var{tagged_pointer} with its tag set to zero. Store the result in @var{target} if convenient. The default clears the top byte of the original pointer. @end deftypefn + +@deftypefn {Target Hook} bool TARGET_REGISTER_REJECT_INIT_P (rtx @var{reg}) +This target hook should return @code{true} if reject initialization for a uninitialized @var{reg}. + +The default value of this hook is @code{NULL}. +@end deftypefn diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 611fc500ac86..13174ce66d59 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -8180,3 +8180,5 @@ maintainer is familiar with. @hook TARGET_MEMTAG_EXTRACT_TAG @hook TARGET_MEMTAG_UNTAGGED_POINTER + +@hook TARGET_REGISTER_REJECT_INIT_P diff --git a/gcc/init-regs.c b/gcc/init-regs.c index 72e898f3e334..51c0d669d30b 100644 --- a/gcc/init-regs.c +++ b/gcc/init-regs.c @@ -21,6 +21,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "backend.h" +#include "target.h" #include "rtl.h" #include "tree.h" #include "df.h" @@ -101,6 +102,10 @@ initialize_uninitialized_regs (void) rtx_insn *move_insn; rtx reg = DF_REF_REAL_REG (use); + if (targetm.register_reject_init_p + && targetm.register_reject_init_p (reg)) + continue; + bitmap_set_bit (already_genned, regno); start_sequence (); diff --git a/gcc/target.def b/gcc/target.def index 7676d5e626e3..c2b54421618d 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -4545,6 +4545,14 @@ by a subtarget.", unsigned HOST_WIDE_INT, (void), NULL) +/* Return true if reject initialization for a uninitialized register. */ +DEFHOOK +(register_reject_init_p, + "This target hook should return @code{true} if reject initialization for a uninitialized @var{reg}.\n\ +\n\ +The default value of this hook is @code{NULL}.", + bool, (rtx reg), NULL) + /* Functions relating to calls - argument passing, returns, etc. */ /* Members of struct call have no special macro prefix. */ HOOK_VECTOR (TARGET_CALLS, calls) -- 2.24.3 (Apple Git-128)
Re: [PATCH 1/2] RISC-V: Add arch flags for T-HEAD.
— Jojo 在 2021年7月22日 +0800 AM4:53,Jim Wilson ,写道: > On Tue, Jul 13, 2021 at 11:06 AM Palmer Dabbelt wrote: > > Is there are documentation as to what this "theadc" extension is? > > The best doc I know of is https://github.com/isrc-cas/c910-llvmThe README > is in Chinese, but google translate does a decent job on it. If you want > more details, you have to read the llvm sources to see exactly what each > instruction does. They have mentioned that they are working on English > language docs, but I don't know when they will be available. > There are quite a few T-Head specific instructions here. This patch is only > adding support for a few of them, probably as a trial to see how it goes > before they try to add the rest. Hi, Please let me feed more details for this patch, There are about ~100+ instructions in our ISA spec, and we put the RFC[1] to ask guide how to commit vendor extension ISAs, we want to commit one type instruction every time, it’s helpful for reviewing. Some Chinese T-HEAD ISA Specs have been on the our web page [2] already, and we are converting these docs to english version to help your reading :) it will be out in the next week, including binutils. Thanks for your suggestion of the patch [1] https://github.com/riscv/riscv-gcc/issues/278 [2] https://www.t-head.cn/technology > Jim >
[PATCH 2/2] RISC-V: Add ldr/str instruction for T-HEAD.
gcc/ * gcc/config/riscv/riscv-opts.h (TARGET_LDR): New. (TARGET_LDUR): Likewise. * gcc/config/riscv/riscv.h (INDEX_REG_CLASS): Use TARGET_LDR. (REGNO_OK_FOR_INDEX_P): Use TARGET_LDR. (REG_OK_FOR_INDEX_P): Use REGNO_OK_FOR_INDEX_P. * gcc/config/riscv/riscv.c (riscv_address_type): Add ADDRESS_REG_REG, ADDRESS_REG_UREG. (riscv_address_info): Add shift. (riscv_classify_address_index): New. (riscv_classify_address): Use riscv_classify_address_index. (riscv_legitimize_address_index_p): New. (riscv_output_move_index): New. (riscv_output_move): Add parameter, Use riscv_output_move_index. (riscv_print_operand_address): Use ADDRESS_REG_REG, ADDRESS_REG_UREG. * gcc/config/riscv/riscv-protos.h (riscv_output_move): Update riscv_output_move. * gcc/config/riscv/riscv.md (zero_extendsidi2): Use riscv_output_move. (zero_extendhi2): Likewise. (zero_extendqi2): Likewise. (extendsidi2): Likewise. (extend2): Likewise. * gcc/config/riscv/predicates.md (sync_memory_operand): New. * gcc/config/riscv/sync.md (atomic_store): Use sync_memory_operand. (atomic_): Likewise. (atomic_fetch_): Likewise. (atomic_exchange): Likewise. (atomic_cas_value_strong): Likewise. (atomic_compare_and_swap): Likewise. (atomic_test_and_set): Likewise. gcc/testsuite/ * gcc.target/riscv/xthead/riscv-xthead.exp: New. * gcc.target/riscv/xthead/ldr.c: Likewise. --- gcc/config/riscv/predicates.md| 4 + gcc/config/riscv/riscv-opts.h | 3 + gcc/config/riscv/riscv-protos.h | 2 +- gcc/config/riscv/riscv.c | 234 -- gcc/config/riscv/riscv.h | 7 +- gcc/config/riscv/riscv.md | 50 ++-- gcc/config/riscv/sync.md | 14 +- gcc/testsuite/gcc.target/riscv/xthead/ldr.c | 34 +++ .../gcc.target/riscv/xthead/riscv-xthead.exp | 41 +++ 9 files changed, 348 insertions(+), 41 deletions(-) create mode 100644 gcc/testsuite/gcc.target/riscv/xthead/ldr.c create mode 100644 gcc/testsuite/gcc.target/riscv/xthead/riscv-xthead.exp diff --git a/gcc/config/riscv/predicates.md b/gcc/config/riscv/predicates.md index 232115135544..802e7a40e880 100644 --- a/gcc/config/riscv/predicates.md +++ b/gcc/config/riscv/predicates.md @@ -217,3 +217,7 @@ { return riscv_gpr_save_operation_p (op); }) + +(define_predicate "sync_memory_operand" + (and (match_operand 0 "memory_operand") + (match_code "reg" "0"))) diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index a2d84a66f037..d3163cb2377c 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -76,4 +76,7 @@ enum stack_protector_guard { #define MASK_XTHEAD_C (1 << 0) #define TARGET_XTHEAD_C ((riscv_x_subext & MASK_XTHEAD_C) != 0) +#define TARGET_LDR (TARGET_XTHEAD_C) +#define TARGET_LDUR (TARGET_XTHEAD_C) + #endif /* ! GCC_RISCV_OPTS_H */ diff --git a/gcc/config/riscv/riscv-protos.h b/gcc/config/riscv/riscv-protos.h index 43d7224d6941..3a218f327c42 100644 --- a/gcc/config/riscv/riscv-protos.h +++ b/gcc/config/riscv/riscv-protos.h @@ -52,9 +52,9 @@ extern bool riscv_legitimize_move (machine_mode, rtx, rtx); extern rtx riscv_subword (rtx, bool); extern bool riscv_split_64bit_move_p (rtx, rtx); extern void riscv_split_doubleword_move (rtx, rtx); -extern const char *riscv_output_move (rtx, rtx); extern const char *riscv_output_return (); #ifdef RTX_CODE +extern const char *riscv_output_move (rtx, rtx, rtx_code outer = UNKNOWN); extern void riscv_expand_int_scc (rtx, enum rtx_code, rtx, rtx); extern void riscv_expand_float_scc (rtx, enum rtx_code, rtx, rtx); extern void riscv_expand_conditional_branch (rtx, enum rtx_code, rtx, rtx); diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 576960bb37cb..7d321826f669 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -80,6 +80,12 @@ along with GCC; see the file COPYING3. If not see A natural register + offset address. The register satisfies riscv_valid_base_register_p and the offset is a const_arith_operand. + ADDRESS_REG_REG + A base register indexed by (optionally scaled) register. + + ADDRESS_REG_UREG + A base register indexed by (optionally scaled) zero-extended register. + ADDRESS_LO_SUM A LO_SUM rtx. The first operand is a valid base register and the second operand is a symbolic address. @@ -91,6 +97,8 @@ along with GCC; see the file COPYING3. If not see A constant symbolic address. */ enum riscv_address_type { ADDRESS_REG, + ADDRESS_REG_REG, + ADDRESS_REG_UREG, ADDRESS_LO_SUM, ADDRESS_CONST_INT, ADDRESS_SYMBOLIC @@ -175,6 +183,11 @@ struct riscv_arg_info { ADDRESS_REG REG is the base
[PATCH 1/2] RISC-V: Add arch flags for T-HEAD.
gcc/ * gcc/config/riscv/riscv.opt (riscv_x_subext): New. * gcc/config/riscv/riscv-opts.h (MASK_XTHEAD_C): New. (TARGET_XTHEAD_C): Likewise. * gcc/common/config/riscv/riscv-common.c (riscv_ext_flag_table): Use riscv_x_subext & MASK_XTHEAD_C. --- gcc/common/config/riscv/riscv-common.c | 2 ++ gcc/config/riscv/riscv-opts.h | 3 +++ gcc/config/riscv/riscv.opt | 3 +++ 3 files changed, 8 insertions(+) diff --git a/gcc/common/config/riscv/riscv-common.c b/gcc/common/config/riscv/riscv-common.c index 10868fd417dc..a62080129259 100644 --- a/gcc/common/config/riscv/riscv-common.c +++ b/gcc/common/config/riscv/riscv-common.c @@ -906,6 +906,8 @@ static const riscv_ext_flag_table_t riscv_ext_flag_table[] = {"zicsr",_options::x_riscv_zi_subext, MASK_ZICSR}, {"zifencei", _options::x_riscv_zi_subext, MASK_ZIFENCEI}, + {"xtheadc", _options::x_riscv_x_subext, MASK_XTHEAD_C}, + {NULL, NULL, 0} }; diff --git a/gcc/config/riscv/riscv-opts.h b/gcc/config/riscv/riscv-opts.h index f4cf6ca4b823..a2d84a66f037 100644 --- a/gcc/config/riscv/riscv-opts.h +++ b/gcc/config/riscv/riscv-opts.h @@ -73,4 +73,7 @@ enum stack_protector_guard { #define TARGET_ZICSR((riscv_zi_subext & MASK_ZICSR) != 0) #define TARGET_ZIFENCEI ((riscv_zi_subext & MASK_ZIFENCEI) != 0) +#define MASK_XTHEAD_C (1 << 0) +#define TARGET_XTHEAD_C ((riscv_x_subext & MASK_XTHEAD_C) != 0) + #endif /* ! GCC_RISCV_OPTS_H */ diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt index 5ff85c214307..84176aea05e9 100644 --- a/gcc/config/riscv/riscv.opt +++ b/gcc/config/riscv/riscv.opt @@ -195,6 +195,9 @@ long riscv_stack_protector_guard_offset = 0 TargetVariable int riscv_zi_subext +TargetVariable +int riscv_x_subext + Enum Name(isa_spec_class) Type(enum riscv_isa_spec_class) Supported ISA specs (for use with the -misa-spec= option): -- 2.24.3 (Apple Git-128)
[PATCH 0/2] RISC-V: Add ldr/str instruction for T-HEAD.
T-HEAD extends some customized ISAs for Cores. The patches support ldr/str insns, it likes arm's LDR insn, the memory model is a base register indexed by (optionally scaled) register.
[PATCH] RISC-V: Add tune info for T-HEAD C906.
gcc/ * config/riscv/riscv.c (thead_c906_tune_info): New. * config/riscv/riscv.c (riscv_tune_info_table): Use new tune. --- gcc/config/riscv/riscv.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c index 1baa2990ee27..576960bb37cb 100644 --- a/gcc/config/riscv/riscv.c +++ b/gcc/config/riscv/riscv.c @@ -300,6 +300,19 @@ static const struct riscv_tune_param sifive_7_tune_info = { true,/* slow_unaligned_access */ }; +/* Costs to use when optimizing for T-HEAD c906. */ +static const struct riscv_tune_param thead_c906_tune_info = { + {COSTS_N_INSNS (4), COSTS_N_INSNS (5)}, /* fp_add */ + {COSTS_N_INSNS (4), COSTS_N_INSNS (5)}, /* fp_mul */ + {COSTS_N_INSNS (20), COSTS_N_INSNS (20)}, /* fp_div */ + {COSTS_N_INSNS (4), COSTS_N_INSNS (4)}, /* int_mul */ + {COSTS_N_INSNS (6), COSTS_N_INSNS (6)}, /* int_div */ + 1,/* issue_rate */ + 3,/* branch_cost */ + 5,/* memory_cost */ + false,/* slow_unaligned_access */ +}; + /* Costs to use when optimizing for size. */ static const struct riscv_tune_param optimize_size_tune_info = { {COSTS_N_INSNS (1), COSTS_N_INSNS (1)}, /* fp_add */ @@ -348,6 +361,7 @@ static const struct riscv_tune_info riscv_tune_info_table[] = { { "sifive-3-series", generic, _tune_info }, { "sifive-5-series", generic, _tune_info }, { "sifive-7-series", sifive_7, _7_tune_info }, + { "thead-c906", generic, _c906_tune_info }, { "size", generic, _size_tune_info }, }; -- 2.24.3 (Apple Git-128)
Re: [PATCH v3] Include checking of 0 cost dependency due to bypass in rank_for_schedule
Ping … ... Jojo 在 2020年11月6日 +0800 PM5:38,Jojo R ,写道: > Insn seqs before sched: > > .L1: > a5 = insn-1 (a0) > a6 = insn-2 (a1) > a7 = insn-3 (a7, a5) > a8 = insn-4 (a8, a6) > Jmp .L1 > > Insn-3 & insn-4 is REG_DEP_TRUE of insn-1 & insn-2, > so insn-3 & insn-4 will be as the last of ready list. > And this patch will put 0 cost dependency due to a bypass > as highest numbered class also if some target have forward > feature between DEP_PRO and DEP_CON. > > if the insns are in the same cost class on -fsched-last-insn-heuristic, > And then, go to "prefer the insn which has more later insns that depend on > it", > return from dep_list_size() is not satisfied, it includes all dependence of > insn. > We need to ignore the ones that have a 0 cost dependency due to a bypass. > > With this patch and pipeline description as below: > > (define_bypass 0 "insn-1, insn-2" "insn-3, insn-4") > > We can get better insn seqs after sched: > > .L1: > a5 = insn-1 (a0) > a7 = insn-3 (a7, a5) > a6 = insn-2 (a1) > a8 = insn-4 (a8, a6) > Jmp .L1 > > I have tested on ck860 of C-SKY arch and C960 of T-Head based on RISCV arch > > gcc/ > * haifa-sched.c (dep_list_costs): New. > (rank_for_schedule): Replace dep_list_size with dep_list_costs. > Add 0 cost dependency due to bypass on -fsched-last-insn-heuristic. > > --- > gcc/haifa-sched.c | 49 +++ > 1 file changed, 45 insertions(+), 4 deletions(-) > > diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c > index 350178c82b8..51c6d23d3a5 100644 > --- a/gcc/haifa-sched.c > +++ b/gcc/haifa-sched.c > @@ -1584,6 +1584,44 @@ dep_list_size (rtx_insn *insn, sd_list_types_def list) > return nodbgcount; > } > > +/* Get the bypass cost of dependence DEP. */ > + > +HAIFA_INLINE static int > +dep_cost_bypass(dep_t dep) > +{ > + if (dep == NULL) > + return -1; > + > + if (INSN_CODE (DEP_PRO (dep)) >= 0 > + && bypass_p (DEP_PRO (dep)) > + && recog_memoized (DEP_CON (dep)) >= 0) > + return dep_cost (dep); > + > + return -1; > +} > + > +/* Compute the costs of nondebug deps in list LIST for INSN. */ > + > +static int > +dep_list_costs (rtx_insn *insn, sd_list_types_def list) > +{ > + sd_iterator_def sd_it; > + dep_t dep; > + int costs = 0; > + > + FOR_EACH_DEP (insn, list, sd_it, dep) > + { > + if (!DEBUG_INSN_P (DEP_CON (dep)) > + && !DEBUG_INSN_P (DEP_PRO (dep))) > + { > + if (dep_cost_bypass (dep) != 0) > + costs++; > + } > + } > + > + return costs; > +} > + > bool sched_fusion; > > /* Compute the priority number for INSN. */ > @@ -2758,10 +2796,12 @@ rank_for_schedule (const void *x, const void *y) > 1) Data dependent on last schedule insn. > 2) Anti/Output dependent on last scheduled insn. > 3) Independent of last scheduled insn, or has latency of one. > + 4) bypass of last scheduled insn, and has latency of zero. > Choose the insn from the highest numbered class if different. */ > dep1 = sd_find_dep_between (last, tmp, true); > > - if (dep1 == NULL || dep_cost (dep1) == 1) > + if (dep1 == NULL || dep_cost (dep1) == 1 > + || (dep_cost_bypass (dep1) == 0)) > tmp_class = 3; > else if (/* Data dependence. */ > DEP_TYPE (dep1) == REG_DEP_TRUE) > @@ -2771,7 +2811,8 @@ rank_for_schedule (const void *x, const void *y) > > dep2 = sd_find_dep_between (last, tmp2, true); > > - if (dep2 == NULL || dep_cost (dep2) == 1) > + if (dep2 == NULL || dep_cost (dep2) == 1 > + || (dep_cost_bypass (dep2) == 0)) > tmp2_class = 3; > else if (/* Data dependence. */ > DEP_TYPE (dep2) == REG_DEP_TRUE) > @@ -2795,8 +2836,8 @@ rank_for_schedule (const void *x, const void *y) > This gives the scheduler more freedom when scheduling later > instructions at the expense of added register pressure. */ > > - val = (dep_list_size (tmp2, SD_LIST_FORW) > - - dep_list_size (tmp, SD_LIST_FORW)); > + val = (dep_list_costs (tmp2, SD_LIST_FORW) > + - dep_list_costs (tmp, SD_LIST_FORW)); > > if (flag_sched_dep_count_heuristic && val != 0) > return rfs_result (RFS_DEP_COUNT, val, tmp, tmp2); > -- > 2.24.3 (Apple Git-128)
Re: [PATCH v2] Add bypass_p cost check in flag_sched_last_insn_heuristic
Jojo 在 2020年11月6日 +0800 AM11:18,Jeff Law ,写道: On 11/5/20 7:52 PM, Jim Wilson wrote: On Thu, Nov 5, 2020 at 6:10 PM Jojo R wrote: > > gcc/ > > * haifa-sched.c (rank_for_schedule): Add bypass_p > > cost check in flag_sched_last_insn_heuristic. > > > > + || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1)) > > + && recog_memoized (DEP_CON (dep1)) >= 0 > > + && !dep_cost (dep1))) > > This is using the same idiom at the previous patch. Do the two patches > depend on each other? It isn't clear. Since this idiom is used 3 times > across the 2 patches, maybe it should be a macro or an inline function. FWIW, I'd just let the inliner make the decision. > > As with the other patch, some explanation would be nice, and some testing on > multiple targets too. Agreed. Ok & Thanks, It’s fixed in patch v3. jeff
Re: [PATCH v2] Replace dep_list_size with dep_list_costs for better scheduling
Jojo 在 2020年11月6日 +0800 AM11:18,Jeff Law ,写道: On 11/5/20 7:50 PM, Jim Wilson wrote: On Thu, Nov 5, 2020 at 6:03 PM Jojo R wrote: > > gcc/ > > * haifa-sched.c (dep_list_costs): New. > > (rank_for_schedule): Use dep_list_costs. > > When you post a patch, you should explain what the patch is doing and why > this is better than the code that was there before. It is helpful if you can > show results that demonstrate that it is better, e.g. give a small example > and show some scheduler or assembly output to show what it does. > > You should also consider that when you modify target independent code then > you are affecting every target. This change may work well for your target, > but does it also work for x86, arm, ppc, etc? This probably requires some > testing to see if it works for other targets. If not, then maybe it needs to > be conditional on a target hook. > > The patch does seem to make some sense though. When choosing the instruction > that has the most dependent instructions to schedule next, you want to ignore > the ones that have a 0 cost dependency due to a bypass. Agreed. It looks pretty reasonable, but a bit more background would be helpful. Ok & Thanks, It’s fixed in patch v3. jeff
[PATCH v3] Include checking of 0 cost dependency due to bypass in rank_for_schedule
Insn seqs before sched: .L1: a5 = insn-1 (a0) a6 = insn-2 (a1) a7 = insn-3 (a7, a5) a8 = insn-4 (a8, a6) Jmp .L1 Insn-3 & insn-4 is REG_DEP_TRUE of insn-1 & insn-2, so insn-3 & insn-4 will be as the last of ready list. And this patch will put 0 cost dependency due to a bypass as highest numbered class also if some target have forward feature between DEP_PRO and DEP_CON. if the insns are in the same cost class on -fsched-last-insn-heuristic, And then, go to "prefer the insn which has more later insns that depend on it", return from dep_list_size() is not satisfied, it includes all dependence of insn. We need to ignore the ones that have a 0 cost dependency due to a bypass. With this patch and pipeline description as below: (define_bypass 0 "insn-1, insn-2" "insn-3, insn-4") We can get better insn seqs after sched: .L1: a5 = insn-1 (a0) a7 = insn-3 (a7, a5) a6 = insn-2 (a1) a8 = insn-4 (a8, a6) Jmp .L1 I have tested on ck860 of C-SKY arch and C960 of T-Head based on RISCV arch gcc/ * haifa-sched.c (dep_list_costs): New. (rank_for_schedule): Replace dep_list_size with dep_list_costs. Add 0 cost dependency due to bypass on -fsched-last-insn-heuristic. --- gcc/haifa-sched.c | 49 +++ 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 350178c82b8..51c6d23d3a5 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -1584,6 +1584,44 @@ dep_list_size (rtx_insn *insn, sd_list_types_def list) return nodbgcount; } +/* Get the bypass cost of dependence DEP. */ + +HAIFA_INLINE static int +dep_cost_bypass(dep_t dep) +{ + if (dep == NULL) +return -1; + + if (INSN_CODE (DEP_PRO (dep)) >= 0 + && bypass_p (DEP_PRO (dep)) + && recog_memoized (DEP_CON (dep)) >= 0) +return dep_cost (dep); + + return -1; +} + +/* Compute the costs of nondebug deps in list LIST for INSN. */ + +static int +dep_list_costs (rtx_insn *insn, sd_list_types_def list) +{ + sd_iterator_def sd_it; + dep_t dep; + int costs = 0; + + FOR_EACH_DEP (insn, list, sd_it, dep) +{ + if (!DEBUG_INSN_P (DEP_CON (dep)) + && !DEBUG_INSN_P (DEP_PRO (dep))) + { + if (dep_cost_bypass (dep) != 0) + costs++; + } +} + + return costs; +} + bool sched_fusion; /* Compute the priority number for INSN. */ @@ -2758,10 +2796,12 @@ rank_for_schedule (const void *x, const void *y) 1) Data dependent on last schedule insn. 2) Anti/Output dependent on last scheduled insn. 3) Independent of last scheduled insn, or has latency of one. + 4) bypass of last scheduled insn, and has latency of zero. Choose the insn from the highest numbered class if different. */ dep1 = sd_find_dep_between (last, tmp, true); - if (dep1 == NULL || dep_cost (dep1) == 1) + if (dep1 == NULL || dep_cost (dep1) == 1 + || (dep_cost_bypass (dep1) == 0)) tmp_class = 3; else if (/* Data dependence. */ DEP_TYPE (dep1) == REG_DEP_TRUE) @@ -2771,7 +2811,8 @@ rank_for_schedule (const void *x, const void *y) dep2 = sd_find_dep_between (last, tmp2, true); - if (dep2 == NULL || dep_cost (dep2) == 1) + if (dep2 == NULL || dep_cost (dep2) == 1 + || (dep_cost_bypass (dep2) == 0)) tmp2_class = 3; else if (/* Data dependence. */ DEP_TYPE (dep2) == REG_DEP_TRUE) @@ -2795,8 +2836,8 @@ rank_for_schedule (const void *x, const void *y) This gives the scheduler more freedom when scheduling later instructions at the expense of added register pressure. */ - val = (dep_list_size (tmp2, SD_LIST_FORW) -- dep_list_size (tmp, SD_LIST_FORW)); + val = (dep_list_costs (tmp2, SD_LIST_FORW) +- dep_list_costs (tmp, SD_LIST_FORW)); if (flag_sched_dep_count_heuristic && val != 0) return rfs_result (RFS_DEP_COUNT, val, tmp, tmp2); -- 2.24.3 (Apple Git-128)
[PATCH v2] Add bypass_p cost check in flag_sched_last_insn_heuristic
gcc/ * haifa-sched.c (rank_for_schedule): Add bypass_p cost check in flag_sched_last_insn_heuristic. --- gcc/haifa-sched.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 62d1816a55d..adf63659d15 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -2780,10 +2780,14 @@ rank_for_schedule (const void *x, const void *y) 1) Data dependent on last schedule insn. 2) Anti/Output dependent on last scheduled insn. 3) Independent of last scheduled insn, or has latency of one. + 4) bypass of last scheduled insn, and has latency of zero. Choose the insn from the highest numbered class if different. */ dep1 = sd_find_dep_between (last, tmp, true); - if (dep1 == NULL || dep_cost (dep1) == 1) + if (dep1 == NULL || dep_cost (dep1) == 1 + || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1)) + && recog_memoized (DEP_CON (dep1)) >= 0 + && !dep_cost (dep1))) tmp_class = 3; else if (/* Data dependence. */ DEP_TYPE (dep1) == REG_DEP_TRUE) @@ -2793,7 +2797,10 @@ rank_for_schedule (const void *x, const void *y) dep2 = sd_find_dep_between (last, tmp2, true); - if (dep2 == NULL || dep_cost (dep2) == 1) + if (dep2 == NULL || dep_cost (dep2) == 1 + || (INSN_CODE (DEP_PRO (dep2)) >= 0 && bypass_p (DEP_PRO (dep2)) + && recog_memoized (DEP_CON (dep2)) >= 0 + && !dep_cost (dep2))) tmp2_class = 3; else if (/* Data dependence. */ DEP_TYPE (dep2) == REG_DEP_TRUE) -- 2.24.3 (Apple Git-128)
[PATCH v2] Replace dep_list_size with dep_list_costs for better scheduling
gcc/ * haifa-sched.c (dep_list_costs): New. (rank_for_schedule): Use dep_list_costs. --- gcc/haifa-sched.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 350178c82b8..32cd640bb67 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -1584,6 +1584,33 @@ dep_list_size (rtx_insn *insn, sd_list_types_def list) return nodbgcount; } +/* Compute the costs of nondebug deps in list LIST for INSN. */ + +static int +dep_list_costs (rtx_insn *insn, sd_list_types_def list) +{ + sd_iterator_def sd_it; + dep_t dep; + int costs = 0; + + FOR_EACH_DEP (insn, list, sd_it, dep) +{ + if (!DEBUG_INSN_P (DEP_CON (dep)) + && !DEBUG_INSN_P (DEP_PRO (dep))) + { + int bypass = INSN_CODE (DEP_PRO (dep)) >= 0 + && bypass_p (DEP_PRO (dep)) + && recog_memoized (DEP_CON (dep)) >= 0 + && !dep_cost (dep); + + if (!bypass) + costs++; + } +} + + return costs; +} + bool sched_fusion; /* Compute the priority number for INSN. */ @@ -2795,8 +2822,8 @@ rank_for_schedule (const void *x, const void *y) This gives the scheduler more freedom when scheduling later instructions at the expense of added register pressure. */ - val = (dep_list_size (tmp2, SD_LIST_FORW) -- dep_list_size (tmp, SD_LIST_FORW)); + val = (dep_list_costs (tmp2, SD_LIST_FORW) +- dep_list_costs (tmp, SD_LIST_FORW)); if (flag_sched_dep_count_heuristic && val != 0) return rfs_result (RFS_DEP_COUNT, val, tmp, tmp2); -- 2.24.3 (Apple Git-128)
[PATCH] Add bypass_p cost check in flag_sched_last_insn_heuristic
gcc/ * haifa-sched.c (rank_for_schedule): Add bypass_p cost check in flag_sched_last_insn_heuristic. --- gcc/haifa-sched.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 62d1816a55d..7d826483f55 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -2780,10 +2780,14 @@ rank_for_schedule (const void *x, const void *y) 1) Data dependent on last schedule insn. 2) Anti/Output dependent on last scheduled insn. 3) Independent of last scheduled insn, or has latency of one. + 4) bypass of last scheduled insn, and has latency of zero. Choose the insn from the highest numbered class if different. */ dep1 = sd_find_dep_between (last, tmp, true); - if (dep1 == NULL || dep_cost (dep1) == 1) + if (dep1 == NULL || dep_cost (dep1) == 1 + || (INSN_CODE (DEP_PRO (dep1)) >= 0 && bypass_p (DEP_PRO (dep1)) + && recog_memoized (DEP_CON (dep1)) >= 0 + && !insn_latency (DEP_PRO (dep1), DEP_CON (dep1 tmp_class = 3; else if (/* Data dependence. */ DEP_TYPE (dep1) == REG_DEP_TRUE) @@ -2793,7 +2797,10 @@ rank_for_schedule (const void *x, const void *y) dep2 = sd_find_dep_between (last, tmp2, true); - if (dep2 == NULL || dep_cost (dep2) == 1) + if (dep2 == NULL || dep_cost (dep2) == 1 + || (INSN_CODE (DEP_PRO (dep2)) >= 0 && bypass_p (DEP_PRO (dep2)) + && recog_memoized (DEP_CON (dep2)) >= 0 + && !insn_latency (DEP_PRO (dep2), DEP_CON (dep2 tmp2_class = 3; else if (/* Data dependence. */ DEP_TYPE (dep2) == REG_DEP_TRUE) -- 2.24.3 (Apple Git-128)
[PATCH] Replace dep_list_size with dep_list_costs for better scheduling
gcc/ * haifa-sched.c (dep_list_costs): New. (rank_for_schedule): Use dep_list_costs. --- gcc/haifa-sched.c | 26 -- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 350178c82b8..62d1816a55d 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -1584,6 +1584,28 @@ dep_list_size (rtx_insn *insn, sd_list_types_def list) return nodbgcount; } +/* Compute the costs of nondebug deps in list LIST for INSN. */ + +static int +dep_list_costs (rtx_insn *insn, sd_list_types_def list) +{ + sd_iterator_def sd_it; + dep_t dep; + int costs = 0; + + FOR_EACH_DEP (insn, list, sd_it, dep) +{ + if (!DEBUG_INSN_P (DEP_CON (dep)) + && !DEBUG_INSN_P (DEP_PRO (dep))) + { + if (DEP_COST (dep) != 0) + costs++; + } +} + + return costs; +} + bool sched_fusion; /* Compute the priority number for INSN. */ @@ -2795,8 +2817,8 @@ rank_for_schedule (const void *x, const void *y) This gives the scheduler more freedom when scheduling later instructions at the expense of added register pressure. */ - val = (dep_list_size (tmp2, SD_LIST_FORW) -- dep_list_size (tmp, SD_LIST_FORW)); + val = (dep_list_costs (tmp2, SD_LIST_FORW) +- dep_list_costs (tmp, SD_LIST_FORW)); if (flag_sched_dep_count_heuristic && val != 0) return rfs_result (RFS_DEP_COUNT, val, tmp, tmp2); -- 2.24.3 (Apple Git-128)
Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
Jojo 在 2020年10月30日 +0800 PM11:29,Richard Sandiford ,写道: > Jojo R writes: > > Jojo > > 在 2020年10月27日 +0800 PM10:14,Richard Sandiford > > ,写道: > > > Jojo R writes: > > > > gcc/ChangeLog: > > > > > > > > * genemit.c (main): Print 'split line'. > > > > * Makefile.in (insn-emit.c): Define split count and file > > > > > > > > --- > > > > gcc/Makefile.in | 19 + > > > > gcc/genemit.c | 104 +--- > > > > 2 files changed, 83 insertions(+), 40 deletions(-) > > > > > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > > > index 79e854aa938..a7fcc7d5949 100644 > > > > --- a/gcc/Makefile.in > > > > +++ b/gcc/Makefile.in > > > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ > > > > # We put the *-match.o and insn-*.o files first so that a parallel make > > > > # will build them sooner, because they are large and otherwise tend to > > > > be > > > > # the last objects to finish building. > > > > + > > > > +# target overrides > > > > +-include $(tmake_file) > > > > + > > > > +INSN-GENERATED-SPLIT-NUM ?= 0 > > > > + > > > > +insn-generated-split-num = $(shell i=1; j=`expr > > > > $(INSN-GENERATED-SPLIT-NUM) + 1`; \ > > > > + while test $$i -le $$j; do \ > > > > + echo $$i; i=`expr $$i + 1`; \ > > > > + done) > > > > + > > > > +insn-emit-split-c := $(foreach o, $(shell for i in > > > > $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) > > > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > > > > +$(insn-emit-split-c): insn-emit.c > > > > > > Sorry for the slow reply. I stand by what I said in > > > https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552863.html: > > > > > > I think we should use the same wordlist technique as check_p_numbers[0-6]. > > > So I guess the first step would be to rename check_p_numbers[0-6] to > > > something more general and use it both here and in check_p_numbers. > > > > > > I think that would be better than having two different ways of > > > generating lists of numbers, one directly in make and one calling > > > out to the shell. But I didn't want to reassert that comment in > > > case anyone was prepared to approve the patch in its current form. > > > > > > > Ok & Thanks. > > > > It’s fixed in patch v8. > > Thanks. Like I say, I think we should rename check_p_numbers* at the > same time, since it's now used for more than just parallel check. Maybe > s/check_p_numbers/number_series/. Ok & It’s fixed in patch v9. > > But otherwise it looks good. > > > > BTW, do you have a copyright assignment on file? > > > > I email the patch without copyright, and I think it is same with other gcc > > community patch. > > Some changes can be so small and mechanical that they're not in practice > copyrightable, but all other changes need a copyright assignment. > Unfortunately this patch is too complex to fall into the first category. > See: > > https://gcc.gnu.org/contribute.html#legal > > for more details about the requirement and process. > From the patch of https://gcc.gnu.org/legacy-ml/gcc-patches/2018-07/msg01289.html we have supported c-sky port in GCC backend, I think we also need to submit a copyright for it and have submitted that. I am contacting ass...@gnu.org to check it. Thanks. > Thanks, > Richard
[PATCH v9] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 35 +++- gcc/genemit.c | 104 +--- 2 files changed, 90 insertions(+), 49 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 978a08f7b04..de846c0fcd4 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1154,6 +1154,15 @@ export STRIP_FOR_TARGET export RANLIB_FOR_TARGET export libsubdir +number_series0:=1 2 3 4 5 6 7 8 9 +number_series1:=0 $(number_series0) +number_series2:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series1))) +number_series3:=$(addprefix 0,$(number_series1)) $(number_series2) +number_series4:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series3))) +number_series5:=$(addprefix 0,$(number_series3)) $(number_series4) +number_series6:=$(foreach i,$(number_series0),$(addprefix $(i),$(number_series5))) +number_series:=$(number_series0) $(number_series2) $(number_series4) $(number_series6) + FLAGS_TO_PASS = \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "BISON=$(BISON)" \ @@ -1259,6 +1268,18 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +# target overrides +-include $(tmake_file) + +INSN-GENERATED-SPLIT-NUM ?= 0 + +insn-generated-split-num = $(wordlist 1,$(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1),$(number_series)) + +insn-emit-split-c := $(foreach o, $(insn-generated-split-num), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1266,6 +1287,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2376,6 +2398,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced @@ -4096,18 +4121,10 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets: check_p_tool=$(firstword $(subst _, ,$*)) check_p_count=$(check_$(check_p_tool)_parallelize) check_p_subno=$(word 2,$(subst _, ,$*)) -check_p_numbers0:=1 2 3 4 5 6 7 8 9 -check_p_numbers1:=0 $(check_p_numbers0) -check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1))) -check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2) -check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3))) -check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4) -check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5))) -check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6) check_p_subdir=$(subst _,,$*) check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \ $(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \ - $(check_p_numbers))) + $(number_series))) # For parallelized check-% targets, this decides whether parallelization # is desirable (if -jN is used). If desirable, recursive make is run with diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..54a0d909d9d 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) } } -int -main (int argc, const char **argv) -{ - progname = "genemit"; - - if (!init_rtx_reader_args (argc, argv)) -return (FATAL_EXIT_CODE); - -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ - nofail_optabs[OPTAB##_optab] = true; -#include "internal-fn.def" - - /* Assign sequential codes to all entries in the machine description - in parallel with the tables in insn-output.c. */ - - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); +/* Print include header. */ +static void +printf_include (void) +{ + printf ("/* Generated automatically by the program `genemit'\n" + "from the machine description file `md'. */\n\n"); printf ("#define IN_TARGET_CODE 1\n"); printf ("#include \"config.h\"\n"); printf ("#include \"system.h\"\n"); @@ -900,35 +889,70 @@
[PATCH v8] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 33 +++ gcc/genemit.c | 104 +--- 2 files changed, 89 insertions(+), 48 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7fc03c8d946..974b65c560d 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1154,6 +1154,15 @@ export STRIP_FOR_TARGET export RANLIB_FOR_TARGET export libsubdir +check_p_numbers0:=1 2 3 4 5 6 7 8 9 +check_p_numbers1:=0 $(check_p_numbers0) +check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1))) +check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2) +check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3))) +check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4) +check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5))) +check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6) + FLAGS_TO_PASS = \ "ADA_CFLAGS=$(ADA_CFLAGS)" \ "BISON=$(BISON)" \ @@ -1259,6 +1268,18 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +# target overrides +-include $(tmake_file) + +INSN-GENERATED-SPLIT-NUM ?= 0 + +insn-generated-split-num = $(wordlist 1,$(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1),$(check_p_numbers)) + +insn-emit-split-c := $(foreach o, $(insn-generated-split-num), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1266,6 +1287,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2375,6 +2397,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced @@ -4094,14 +4119,6 @@ $(patsubst %,%-subtargets,$(lang_checks)): check-%-subtargets: check_p_tool=$(firstword $(subst _, ,$*)) check_p_count=$(check_$(check_p_tool)_parallelize) check_p_subno=$(word 2,$(subst _, ,$*)) -check_p_numbers0:=1 2 3 4 5 6 7 8 9 -check_p_numbers1:=0 $(check_p_numbers0) -check_p_numbers2:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers1))) -check_p_numbers3:=$(addprefix 0,$(check_p_numbers1)) $(check_p_numbers2) -check_p_numbers4:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers3))) -check_p_numbers5:=$(addprefix 0,$(check_p_numbers3)) $(check_p_numbers4) -check_p_numbers6:=$(foreach i,$(check_p_numbers0),$(addprefix $(i),$(check_p_numbers5))) -check_p_numbers:=$(check_p_numbers0) $(check_p_numbers2) $(check_p_numbers4) $(check_p_numbers6) check_p_subdir=$(subst _,,$*) check_p_subdirs=$(wordlist 1,$(check_p_count),$(wordlist 1, \ $(if $(GCC_TEST_PARALLEL_SLOTS),$(GCC_TEST_PARALLEL_SLOTS),128), \ diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..54a0d909d9d 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) } } -int -main (int argc, const char **argv) -{ - progname = "genemit"; - - if (!init_rtx_reader_args (argc, argv)) -return (FATAL_EXIT_CODE); - -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ - nofail_optabs[OPTAB##_optab] = true; -#include "internal-fn.def" - - /* Assign sequential codes to all entries in the machine description - in parallel with the tables in insn-output.c. */ - - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); +/* Print include header. */ +static void +printf_include (void) +{ + printf ("/* Generated automatically by the program `genemit'\n" + "from the machine description file `md'. */\n\n"); printf ("#define IN_TARGET_CODE 1\n"); printf ("#include \"config.h\"\n"); printf ("#include \"system.h\"\n"); @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n"); printf ("#include \"tm-constrs.h\"\n"); printf ("#include \"ggc.h\"\n"); printf ("#include \"target.h\"\n\n"); +} -
Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
Jojo 在 2020年10月27日 +0800 PM10:14,Richard Sandiford ,写道: > Jojo R writes: > > gcc/ChangeLog: > > > > * genemit.c (main): Print 'split line'. > > * Makefile.in (insn-emit.c): Define split count and file > > > > --- > > gcc/Makefile.in | 19 + > > gcc/genemit.c | 104 +--- > > 2 files changed, 83 insertions(+), 40 deletions(-) > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > index 79e854aa938..a7fcc7d5949 100644 > > --- a/gcc/Makefile.in > > +++ b/gcc/Makefile.in > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ > > # We put the *-match.o and insn-*.o files first so that a parallel make > > # will build them sooner, because they are large and otherwise tend to be > > # the last objects to finish building. > > + > > +# target overrides > > +-include $(tmake_file) > > + > > +INSN-GENERATED-SPLIT-NUM ?= 0 > > + > > +insn-generated-split-num = $(shell i=1; j=`expr > > $(INSN-GENERATED-SPLIT-NUM) + 1`; \ > > + while test $$i -le $$j; do \ > > + echo $$i; i=`expr $$i + 1`; \ > > + done) > > + > > +insn-emit-split-c := $(foreach o, $(shell for i in > > $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > > +$(insn-emit-split-c): insn-emit.c > > Sorry for the slow reply. I stand by what I said in > https://gcc.gnu.org/pipermail/gcc-patches/2020-August/552863.html: > > I think we should use the same wordlist technique as check_p_numbers[0-6]. > So I guess the first step would be to rename check_p_numbers[0-6] to > something more general and use it both here and in check_p_numbers. > > I think that would be better than having two different ways of > generating lists of numbers, one directly in make and one calling > out to the shell. But I didn't want to reassert that comment in > case anyone was prepared to approve the patch in its current form. > Ok & Thanks. It’s fixed in patch v8. > BTW, do you have a copyright assignment on file? I email the patch without copyright, and I think it is same with other gcc community patch. > > Thanks, > Richard > > > + > > OBJS = \ > > gimple-match.o \ > > generic-match.o \ > > @@ -1265,6 +1280,7 @@ OBJS = \ > > insn-automata.o \ > > insn-dfatab.o \ > > insn-emit.o \ > > + $(insn-emit-split-obj) \ > > insn-extract.o \ > > insn-latencytab.o \ > > insn-modes.o \ > > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: > > build/gen%$(build_exeext) > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ > > $(filter insn-conditions.md,$^) > tmp-$*.c > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c > > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s > > {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ > > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v > > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch > > insn-$*$$i.c; done && echo "" > insn-$*.c) > > $(STAMP) s-$* > > > > # gencheck doesn't read the machine description, and the file produced > > diff --git a/gcc/genemit.c b/gcc/genemit.c > > index 84d07d388ee..54a0d909d9d 100644 > > --- a/gcc/genemit.c > > +++ b/gcc/genemit.c > > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) > > } > > } > > > > -int > > -main (int argc, const char **argv) > > -{ > > - progname = "genemit"; > > - > > - if (!init_rtx_reader_args (argc, argv)) > > - return (FATAL_EXIT_CODE); > > - > > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ > > - nofail_optabs[OPTAB##_optab] = true; > > -#include "internal-fn.def" > > - > > - /* Assign sequential codes to all entries in the machine description > > - in parallel with the tables in insn-output.c. */ > > - > > - printf ("/* Generated automatically by the program `genemit'\n\ > > -from the machine description file `md'. */\n\n"); > > +/* Print include header. */ > > > > +static void > > +printf_include (void) > > +{ > > + printf ("/* Generated automatically by the program `genemit'\n" > > + "from the machine description file `md'. */\n\n"); > > printf ("#define IN_TARGET_CODE 1\n"); > > printf ("#include \"config.h\"\n"); > > printf ("#include \"system.h\"\n"); > > @@ -900,
Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
Ping …. …. Jojo 在 2020年10月24日 +0800 PM2:02,Jojo R ,写道: > Hi, > > Has this patch been merged ? > > I track this some weeks and the patch has reviewed still on the way ... > > Could someone help me ? > > Thanks so much. > > Jojo > 在 2020年10月8日 +0800 AM10:01,Jojo R ,写道: > > Ping …... > > > > Jojo > > 在 2020年9月27日 +0800 AM10:34,Jojo R ,写道: > > > Hi, > > > > > > Has this patch been merged ? > > > > > > Jojo > > > 在 2020年9月15日 +0800 PM5:16,Jojo R ,写道: > > > > gcc/ChangeLog: > > > > > > > > * genemit.c (main): Print 'split line'. > > > > * Makefile.in (insn-emit.c): Define split count and file > > > > > > > > --- > > > > gcc/Makefile.in | 19 + > > > > gcc/genemit.c | 104 +--- > > > > 2 files changed, 83 insertions(+), 40 deletions(-) > > > > > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > > > index 79e854aa938..a7fcc7d5949 100644 > > > > --- a/gcc/Makefile.in > > > > +++ b/gcc/Makefile.in > > > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ > > > > # We put the *-match.o and insn-*.o files first so that a parallel make > > > > # will build them sooner, because they are large and otherwise tend to > > > > be > > > > # the last objects to finish building. > > > > + > > > > +# target overrides > > > > +-include $(tmake_file) > > > > + > > > > +INSN-GENERATED-SPLIT-NUM ?= 0 > > > > + > > > > +insn-generated-split-num = $(shell i=1; j=`expr > > > > $(INSN-GENERATED-SPLIT-NUM) + 1`; \ > > > > + while test $$i -le $$j; do \ > > > > + echo $$i; i=`expr $$i + 1`; \ > > > > + done) > > > > + > > > > +insn-emit-split-c := $(foreach o, $(shell for i in > > > > $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) > > > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > > > > +$(insn-emit-split-c): insn-emit.c > > > > + > > > > OBJS = \ > > > > gimple-match.o \ > > > > generic-match.o \ > > > > @@ -1265,6 +1280,7 @@ OBJS = \ > > > > insn-automata.o \ > > > > insn-dfatab.o \ > > > > insn-emit.o \ > > > > + $(insn-emit-split-obj) \ > > > > insn-extract.o \ > > > > insn-latencytab.o \ > > > > insn-modes.o \ > > > > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: > > > > build/gen%$(build_exeext) > > > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ > > > > $(filter insn-conditions.md,$^) > tmp-$*.c > > > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c > > > > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s > > > > {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ > > > > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v > > > > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch > > > > insn-$*$$i.c; done && echo "" > insn-$*.c) > > > > $(STAMP) s-$* > > > > > > > > # gencheck doesn't read the machine description, and the file produced > > > > diff --git a/gcc/genemit.c b/gcc/genemit.c > > > > index 84d07d388ee..54a0d909d9d 100644 > > > > --- a/gcc/genemit.c > > > > +++ b/gcc/genemit.c > > > > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) > > > > } > > > > } > > > > > > > > -int > > > > -main (int argc, const char **argv) > > > > -{ > > > > - progname = "genemit"; > > > > - > > > > - if (!init_rtx_reader_args (argc, argv)) > > > > - return (FATAL_EXIT_CODE); > > > > - > > > > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ > > > > - nofail_optabs[OPTAB##_optab] = true; > > > > -#include "internal-fn.def" > > > > - > > > > - /* Assign sequential codes to all entries in the machine description > > > > - in parallel with the tables in insn-output.c. */ > > > > - > > > > - printf ("/* Generated automatically by the program `genemit'\n\ > > > > -from the machine description file
Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
Hi, Has this patch been merged ? I track this some weeks and the patch has reviewed still on the way ... Could someone help me ? Thanks so much. Jojo 在 2020年10月8日 +0800 AM10:01,Jojo R ,写道: > Ping …... > > Jojo > 在 2020年9月27日 +0800 AM10:34,Jojo R ,写道: > > Hi, > > > > Has this patch been merged ? > > > > Jojo > > 在 2020年9月15日 +0800 PM5:16,Jojo R ,写道: > > > gcc/ChangeLog: > > > > > > * genemit.c (main): Print 'split line'. > > > * Makefile.in (insn-emit.c): Define split count and file > > > > > > --- > > > gcc/Makefile.in | 19 + > > > gcc/genemit.c | 104 +--- > > > 2 files changed, 83 insertions(+), 40 deletions(-) > > > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > > index 79e854aa938..a7fcc7d5949 100644 > > > --- a/gcc/Makefile.in > > > +++ b/gcc/Makefile.in > > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ > > > # We put the *-match.o and insn-*.o files first so that a parallel make > > > # will build them sooner, because they are large and otherwise tend to be > > > # the last objects to finish building. > > > + > > > +# target overrides > > > +-include $(tmake_file) > > > + > > > +INSN-GENERATED-SPLIT-NUM ?= 0 > > > + > > > +insn-generated-split-num = $(shell i=1; j=`expr > > > $(INSN-GENERATED-SPLIT-NUM) + 1`; \ > > > + while test $$i -le $$j; do \ > > > + echo $$i; i=`expr $$i + 1`; \ > > > + done) > > > + > > > +insn-emit-split-c := $(foreach o, $(shell for i in > > > $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) > > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > > > +$(insn-emit-split-c): insn-emit.c > > > + > > > OBJS = \ > > > gimple-match.o \ > > > generic-match.o \ > > > @@ -1265,6 +1280,7 @@ OBJS = \ > > > insn-automata.o \ > > > insn-dfatab.o \ > > > insn-emit.o \ > > > + $(insn-emit-split-obj) \ > > > insn-extract.o \ > > > insn-latencytab.o \ > > > insn-modes.o \ > > > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: > > > build/gen%$(build_exeext) > > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ > > > $(filter insn-conditions.md,$^) > tmp-$*.c > > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c > > > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s > > > {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ > > > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v > > > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch > > > insn-$*$$i.c; done && echo "" > insn-$*.c) > > > $(STAMP) s-$* > > > > > > # gencheck doesn't read the machine description, and the file produced > > > diff --git a/gcc/genemit.c b/gcc/genemit.c > > > index 84d07d388ee..54a0d909d9d 100644 > > > --- a/gcc/genemit.c > > > +++ b/gcc/genemit.c > > > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) > > > } > > > } > > > > > > -int > > > -main (int argc, const char **argv) > > > -{ > > > - progname = "genemit"; > > > - > > > - if (!init_rtx_reader_args (argc, argv)) > > > - return (FATAL_EXIT_CODE); > > > - > > > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ > > > - nofail_optabs[OPTAB##_optab] = true; > > > -#include "internal-fn.def" > > > - > > > - /* Assign sequential codes to all entries in the machine description > > > - in parallel with the tables in insn-output.c. */ > > > - > > > - printf ("/* Generated automatically by the program `genemit'\n\ > > > -from the machine description file `md'. */\n\n"); > > > +/* Print include header. */ > > > > > > +static void > > > +printf_include (void) > > > +{ > > > + printf ("/* Generated automatically by the program `genemit'\n" > > > + "from the machine description file `md'. */\n\n"); > > > printf ("#define IN_TARGET_CODE 1\n"); > > > printf ("#include \"config.h\"\n"); > > > printf ("#include \"system.h\"\n"); > > > @@ -900,35 +889,70 @@ from the machine description
Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
Ping …... Jojo 在 2020年9月27日 +0800 AM10:34,Jojo R ,写道: > Hi, > > Has this patch been merged ? > > Jojo > 在 2020年9月15日 +0800 PM5:16,Jojo R ,写道: > > gcc/ChangeLog: > > > > * genemit.c (main): Print 'split line'. > > * Makefile.in (insn-emit.c): Define split count and file > > > > --- > > gcc/Makefile.in | 19 + > > gcc/genemit.c | 104 +--- > > 2 files changed, 83 insertions(+), 40 deletions(-) > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > index 79e854aa938..a7fcc7d5949 100644 > > --- a/gcc/Makefile.in > > +++ b/gcc/Makefile.in > > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ > > # We put the *-match.o and insn-*.o files first so that a parallel make > > # will build them sooner, because they are large and otherwise tend to be > > # the last objects to finish building. > > + > > +# target overrides > > +-include $(tmake_file) > > + > > +INSN-GENERATED-SPLIT-NUM ?= 0 > > + > > +insn-generated-split-num = $(shell i=1; j=`expr > > $(INSN-GENERATED-SPLIT-NUM) + 1`; \ > > + while test $$i -le $$j; do \ > > + echo $$i; i=`expr $$i + 1`; \ > > + done) > > + > > +insn-emit-split-c := $(foreach o, $(shell for i in > > $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > > +$(insn-emit-split-c): insn-emit.c > > + > > OBJS = \ > > gimple-match.o \ > > generic-match.o \ > > @@ -1265,6 +1280,7 @@ OBJS = \ > > insn-automata.o \ > > insn-dfatab.o \ > > insn-emit.o \ > > + $(insn-emit-split-obj) \ > > insn-extract.o \ > > insn-latencytab.o \ > > insn-modes.o \ > > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: > > build/gen%$(build_exeext) > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ > > $(filter insn-conditions.md,$^) > tmp-$*.c > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c > > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s > > {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ > > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v > > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch > > insn-$*$$i.c; done && echo "" > insn-$*.c) > > $(STAMP) s-$* > > > > # gencheck doesn't read the machine description, and the file produced > > diff --git a/gcc/genemit.c b/gcc/genemit.c > > index 84d07d388ee..54a0d909d9d 100644 > > --- a/gcc/genemit.c > > +++ b/gcc/genemit.c > > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) > > } > > } > > > > -int > > -main (int argc, const char **argv) > > -{ > > - progname = "genemit"; > > - > > - if (!init_rtx_reader_args (argc, argv)) > > - return (FATAL_EXIT_CODE); > > - > > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ > > - nofail_optabs[OPTAB##_optab] = true; > > -#include "internal-fn.def" > > - > > - /* Assign sequential codes to all entries in the machine description > > - in parallel with the tables in insn-output.c. */ > > - > > - printf ("/* Generated automatically by the program `genemit'\n\ > > -from the machine description file `md'. */\n\n"); > > +/* Print include header. */ > > > > +static void > > +printf_include (void) > > +{ > > + printf ("/* Generated automatically by the program `genemit'\n" > > + "from the machine description file `md'. */\n\n"); > > printf ("#define IN_TARGET_CODE 1\n"); > > printf ("#include \"config.h\"\n"); > > printf ("#include \"system.h\"\n"); > > @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n"); > > printf ("#include \"tm-constrs.h\"\n"); > > printf ("#include \"ggc.h\"\n"); > > printf ("#include \"target.h\"\n\n"); > > +} > > > > - /* Read the machine description. */ > > +/* Generate the `gen_...' function from GET_CODE(). */ > > > > - md_rtx_info info; > > - while (read_md_rtx ()) > > - switch (GET_CODE (info.def)) > > - { > > - case DEFINE_INSN: > > - gen_insn (); > > - break; > > +static void > > +gen_md_rtx (md_rtx_info *info) > > +{ > > + switch (GET_CODE (info->def)) > > + { > > + case DEFINE_INSN: > > + gen_in
Re: [PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
Hi, Has this patch been merged ? Jojo 在 2020年9月15日 +0800 PM5:16,Jojo R ,写道: > gcc/ChangeLog: > > * genemit.c (main): Print 'split line'. > * Makefile.in (insn-emit.c): Define split count and file > > --- > gcc/Makefile.in | 19 + > gcc/genemit.c | 104 +--- > 2 files changed, 83 insertions(+), 40 deletions(-) > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > index 79e854aa938..a7fcc7d5949 100644 > --- a/gcc/Makefile.in > +++ b/gcc/Makefile.in > @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ > # We put the *-match.o and insn-*.o files first so that a parallel make > # will build them sooner, because they are large and otherwise tend to be > # the last objects to finish building. > + > +# target overrides > +-include $(tmake_file) > + > +INSN-GENERATED-SPLIT-NUM ?= 0 > + > +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) > + 1`; \ > + while test $$i -le $$j; do \ > + echo $$i; i=`expr $$i + 1`; \ > + done) > + > +insn-emit-split-c := $(foreach o, $(shell for i in > $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > +$(insn-emit-split-c): insn-emit.c > + > OBJS = \ > gimple-match.o \ > generic-match.o \ > @@ -1265,6 +1280,7 @@ OBJS = \ > insn-automata.o \ > insn-dfatab.o \ > insn-emit.o \ > + $(insn-emit-split-obj) \ > insn-extract.o \ > insn-latencytab.o \ > insn-modes.o \ > @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: > build/gen%$(build_exeext) > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ > $(filter insn-conditions.md,$^) > tmp-$*.c > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c > + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s > {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ > + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v > + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch > insn-$*$$i.c; done && echo "" > insn-$*.c) > $(STAMP) s-$* > > # gencheck doesn't read the machine description, and the file produced > diff --git a/gcc/genemit.c b/gcc/genemit.c > index 84d07d388ee..54a0d909d9d 100644 > --- a/gcc/genemit.c > +++ b/gcc/genemit.c > @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) > } > } > > -int > -main (int argc, const char **argv) > -{ > - progname = "genemit"; > - > - if (!init_rtx_reader_args (argc, argv)) > - return (FATAL_EXIT_CODE); > - > -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ > - nofail_optabs[OPTAB##_optab] = true; > -#include "internal-fn.def" > - > - /* Assign sequential codes to all entries in the machine description > - in parallel with the tables in insn-output.c. */ > - > - printf ("/* Generated automatically by the program `genemit'\n\ > -from the machine description file `md'. */\n\n"); > +/* Print include header. */ > > +static void > +printf_include (void) > +{ > + printf ("/* Generated automatically by the program `genemit'\n" > + "from the machine description file `md'. */\n\n"); > printf ("#define IN_TARGET_CODE 1\n"); > printf ("#include \"config.h\"\n"); > printf ("#include \"system.h\"\n"); > @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n"); > printf ("#include \"tm-constrs.h\"\n"); > printf ("#include \"ggc.h\"\n"); > printf ("#include \"target.h\"\n\n"); > +} > > - /* Read the machine description. */ > +/* Generate the `gen_...' function from GET_CODE(). */ > > - md_rtx_info info; > - while (read_md_rtx ()) > - switch (GET_CODE (info.def)) > - { > - case DEFINE_INSN: > - gen_insn (); > - break; > +static void > +gen_md_rtx (md_rtx_info *info) > +{ > + switch (GET_CODE (info->def)) > + { > + case DEFINE_INSN: > + gen_insn (info); > + break; > > - case DEFINE_EXPAND: > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); > - gen_expand (); > - break; > + case DEFINE_EXPAND: > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno); > + gen_expand (info); > + break; > > - case DEFINE_SPLIT: > - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); > - gen_split (); > - break; > + case DEFINE_SPLIT: > + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno); > + gen_split (info); > + break; > > - case DEFINE_PEEPHOLE2: >
[PATCH] C-SKY: Add -msim option
gcc/ChangeLog: * config/csky/csky.opt (msim): New. * doc/invoke.texi (C-SKY Options): Document -msim. * config/csky/csky-elf.h (LIB_SPEC): Add simulator runtime. --- gcc/config/csky/csky-elf.h | 10 -- gcc/config/csky/csky.opt | 4 gcc/doc/invoke.texi| 7 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/gcc/config/csky/csky-elf.h b/gcc/config/csky/csky-elf.h index 15a0e73..a79d757 100644 --- a/gcc/config/csky/csky-elf.h +++ b/gcc/config/csky/csky-elf.h @@ -70,8 +70,14 @@ %{EL:-EL} -X" #undef LIB_SPEC -#define LIB_SPEC \ - "%{pthread:-lpthread} -lc %{mccrt:-lcc-rt}" +#define LIB_SPEC "\ +%{pthread:-lpthread} \ +--start-group \ +-lc \ +%{msim:-lsemi}%{!msim:-lnosys} \ +--end-group \ +%{mccrt:-lcc-rt} \ +" /* FIXME add this to LIB_SPEC when need */ /* %{!shared:%{profile:-lc_p}%{!profile:-lc}}" */ diff --git a/gcc/config/csky/csky.opt b/gcc/config/csky/csky.opt index 60b51e5..505a764 100644 --- a/gcc/config/csky/csky.opt +++ b/gcc/config/csky/csky.opt @@ -192,3 +192,7 @@ Set the branch costs to roughly the specified number of instructions. msched-prolog Target Report Var(flag_sched_prolog) Init(0) Permit scheduling of function prologue and epilogue sequences. + +msim +Target +Use the simulator runtime. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6d9ff2c..9176c83 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -829,7 +829,7 @@ Objective-C and Objective-C++ Dialects}. -mdsp -medsp -mvdsp @gol -mdiv -msmart -mhigh-registers -manchor @gol -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol --mbranch-cost=@var{n} -mcse-cc -msched-prolog} +-mbranch-cost=@var{n} -mcse-cc -msched-prolog -msim} @emph{Darwin Options} @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol @@ -20835,6 +20835,11 @@ this option can result in code that is not compliant with the C-SKY V2 ABI prologue requirements and that cannot be debugged or backtraced. It is disabled by default. +@item -msim +@opindex msim +Links the library libsemi.a which is in compatible with simulator. Applicable +to ELF compiler only. + @end table @node Darwin Options -- 1.9.1
[PATCH 3/3] C-SKY: Refine target name for elf target test
gcc/testsuite/ChangeLog: * lib/target-supports.exp (check_profiling_available): Refine name of elf target. --- gcc/testsuite/lib/target-supports.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 6881b66..60f76db 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -698,7 +698,7 @@ proc check_profiling_available { test_what } { || [istarget avr-*-*] || [istarget bfin-*-*] || [istarget cris-*-*] -|| [istarget csky-*-elf] +|| [istarget csky-*-elf*] || [istarget fido-*-elf] || [istarget h8300-*-*] || [istarget lm32-*-*] -- 1.9.1
[PATCH 2/3] C-SKY: Set use_gcc_stdint=wrap for elf target
gcc/ChangeLog: * config.gcc (C-SKY): Set use_gcc_stdint=wrap for elf target. --- gcc/config.gcc | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/config.gcc b/gcc/config.gcc index 797f0ad..845f10e 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1543,6 +1543,7 @@ csky-*-*) tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} csky/csky-elf.h" tmake_file="csky/t-csky csky/t-csky-elf" default_use_cxa_atexit=no + use_gcc_stdint=wrap ;; csky-*-linux*) tm_file="dbxelf.h elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} csky/csky-linux-elf.h" -- 1.9.1
[PATCH 1/3] C-SKY: Enable crtbegin/crtend.o of libgcc for elf target
libgcc/ChangeLog: * config.host (C-SKY): Enable crtbegin/crtend.o of libgcc for elf target. --- libgcc/config.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgcc/config.host b/libgcc/config.host index 7a3e29d..dbb378f 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -579,7 +579,7 @@ cris-*-elf) ;; csky-*-elf*) tmake_file="csky/t-csky t-fdpbit" - extra_parts="$extra_parts crti.o crtn.o" + extra_parts="crtbegin.o crtend.o crti.o crtn.o" ;; csky-*-linux*) tmake_file="$tmake_file csky/t-csky t-slibgcc-libgcc t-fdpbit csky/t-linux-csky" -- 1.9.1
[PATCH] C-SKY: Support multilib for mfloat-abi=.
gcc/ChangeLog: * config/csky/t-csky-linux (CSKY_MULTILIB_OSDIRNAMES): Use mfloat-abi. (MULTILIB_OPTIONS): Likewise. * config/csky/t-csky-elf (MULTILIB_OPTIONS): Likewise. (MULTILIB_EXCEPTIONS): Likewise. --- gcc/config/csky/t-csky-elf | 13 - gcc/config/csky/t-csky-linux | 8 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gcc/config/csky/t-csky-elf b/gcc/config/csky/t-csky-elf index cd690bc..62a2d83 100644 --- a/gcc/config/csky/t-csky-elf +++ b/gcc/config/csky/t-csky-elf @@ -100,8 +100,11 @@ MULTILIB_MATCHES += mcpu?ck807f=march?ck807ef MULTILIB_MATCHES += mcpu?ck807f=march?ck807 MULTILIB_MATCHES += mcpu?ck807f=mcpu?ck807 -# For option -msoft-float/-mhard-float. -MULTILIB_OPTIONS += msoft-float/mhard-float -MULTILIB_DIRNAMES+= soft-fp hard-fp -MULTILIB_EXCEPTIONS += *mcpu=ck801/*mhard-float* -MULTILIB_EXCEPTIONS += *mcpu=ck802/*mhard-float* +# For option -mfloat-abi= +MULTILIB_OPTIONS += mfloat-abi=soft/mfloat-abi=softfp/mfloat-abi=hard +MULTILIB_DIRNAMES+= soft soft-fp hard-fp + +MULTILIB_EXCEPTIONS += *mcpu=ck801/*mfloat-abi=softfp* +MULTILIB_EXCEPTIONS += *mcpu=ck802/*mfloat-abi=softfp* +MULTILIB_EXCEPTIONS += *mcpu=ck801/*mfloat-abi=hard* +MULTILIB_EXCEPTIONS += *mcpu=ck802/*mfloat-abi=hard* diff --git a/gcc/config/csky/t-csky-linux b/gcc/config/csky/t-csky-linux index df471ed..f4d656a 100644 --- a/gcc/config/csky/t-csky-linux +++ b/gcc/config/csky/t-csky-linux @@ -21,7 +21,7 @@ MULTILIB_EXCEPTIONS = -CSKY_MULTILIB_OSDIRNAMES = mhard-float=/hard-fp msoft-float=/. mcpu.ck810f=/. mcpu.ck807f=/ck807 +CSKY_MULTILIB_OSDIRNAMES = mfloat-abi.softfp=/soft-fp mfloat-abi.hard=/hard-fp mfloat-abi.soft=/. mcpu.ck810f=/. mcpu.ck807f=/ck807 # Arch variants. MULTILIB_OPTIONS += mcpu=ck810f/mcpu=ck807f @@ -41,6 +41,6 @@ MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810vf MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810ft MULTILIB_MATCHES += mcpu?ck810f=mcpu?ck810vft -# For option -msoft-float/-mhard-float. -MULTILIB_OPTIONS+= msoft-float/mhard-float -MULTILIB_DIRNAMES += soft-fp hard-fp +# For option -mfloat-abi= +MULTILIB_OPTIONS += mfloat-abi=soft/mfloat-abi=softfp/mfloat-abi=hard +MULTILIB_DIRNAMES+= soft soft-fp hard-fp -- 1.9.1
[PATCH] C-SKY: Fix wrong ld name with option -mfloat-abi=hard.
gcc/ChangeLog: * config/csky/csky-linux-elf.h (GLIBC_DYNAMIC_LINKER): Use mfloat-abi. --- gcc/config/csky/csky-linux-elf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/config/csky/csky-linux-elf.h b/gcc/config/csky/csky-linux-elf.h index 9a57dd04..cf587ae 100644 --- a/gcc/config/csky/csky-linux-elf.h +++ b/gcc/config/csky/csky-linux-elf.h @@ -63,7 +63,7 @@ %{mvdsp:-mvdsp} \ " -#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-cskyv2%{mhard-float:-hf}%{mbig-endian:-be}.so.1" +#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-cskyv2%{mfloat-abi=hard:-hf}%{mbig-endian:-be}.so.1" #define LINUX_TARGET_LINK_SPEC "%{h*} %{version:-v}\ %{b}\ -- 1.9.1
Re: [PATCH v6] genemit.c (main): split insn-emit.c for compiling parallelly
Hi, Ok & Thanks, I will do my best for it :) It’s fixed in patch v7. Jojo 在 2020年9月11日 +0800 PM11:29,Segher Boessenkool ,写道: > Hi! > > On Fri, Sep 11, 2020 at 03:26:17PM +0800, Jojo R wrote: > > +#define printf_include() do { \ > > Don't use macros please, use a function? > > And maybe do this in a separate patch, for ease of review. That should > be ack'ed pretty much immediately, after which it is out of the way, and > we do not have to see it again. > > > while (read_md_rtx ()) > > - switch (GET_CODE (info.def)) > > Factor this body to a separate function, too? Again, as earlier patch. > As it is, it is impossible to see if you changed anything here. > > I suspect all this patch really does is pretty trivial, but it is hard > to tell. > > > Segher
[PATCH v7] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 19 + gcc/genemit.c | 104 +--- 2 files changed, 83 insertions(+), 40 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 79e854aa938..a7fcc7d5949 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +# target overrides +-include $(tmake_file) + +INSN-GENERATED-SPLIT-NUM ?= 0 + +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \ + while test $$i -le $$j; do \ + echo $$i; i=`expr $$i + 1`; \ + done) + +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1265,6 +1280,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..54a0d909d9d 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,24 +847,13 @@ handle_overloaded_gen (overloaded_name *oname) } } -int -main (int argc, const char **argv) -{ - progname = "genemit"; - - if (!init_rtx_reader_args (argc, argv)) -return (FATAL_EXIT_CODE); - -#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ - nofail_optabs[OPTAB##_optab] = true; -#include "internal-fn.def" - - /* Assign sequential codes to all entries in the machine description - in parallel with the tables in insn-output.c. */ - - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); +/* Print include header. */ +static void +printf_include (void) +{ + printf ("/* Generated automatically by the program `genemit'\n" + "from the machine description file `md'. */\n\n"); printf ("#define IN_TARGET_CODE 1\n"); printf ("#include \"config.h\"\n"); printf ("#include \"system.h\"\n"); @@ -900,35 +889,70 @@ from the machine description file `md'. */\n\n"); printf ("#include \"tm-constrs.h\"\n"); printf ("#include \"ggc.h\"\n"); printf ("#include \"target.h\"\n\n"); +} - /* Read the machine description. */ +/* Generate the `gen_...' function from GET_CODE(). */ - md_rtx_info info; - while (read_md_rtx ()) -switch (GET_CODE (info.def)) - { - case DEFINE_INSN: - gen_insn (); - break; +static void +gen_md_rtx (md_rtx_info *info) +{ + switch (GET_CODE (info->def)) +{ +case DEFINE_INSN: + gen_insn (info); + break; - case DEFINE_EXPAND: - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); - gen_expand (); - break; +case DEFINE_EXPAND: + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno); + gen_expand (info); + break; - case DEFINE_SPLIT: - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); - gen_split (); - break; +case DEFINE_SPLIT: + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno); + gen_split (info); + break; - case DEFINE_PEEPHOLE2: - printf ("/* %s:%d */\n", info.loc.filename, info.loc.lineno); - gen_split (); - break; +case DEFINE_PEEPHOLE2: + printf ("/* %s:%d */\n", info->loc.filename, info->loc.lineno); + gen_split (info); + break; - default: - break; - } +default: + break; +} +} + +int +main (int argc, const char **argv) +{ + progname = "genemit"; + + if (!init_rtx_reader_args (argc, argv)) +return (FATAL_EXIT_CODE); + +#define DEF_INTERNAL_OPTAB_FN(NAME, FLAGS, OPTAB, TYPE) \ + nofail_optabs[OPTAB##_optab] = true; +#include "internal-fn.def" + + /* Assign sequential codes to all entries in the machine description + in parallel with the
[PATCH v3] C-SKY: Support -mfloat-abi=hard.
gcc/ChangeLog: * config/csky/csky.md (CSKY_NPARM_FREGS): New. (call_value_internal_vs/d): New. (untyped_call): New. * config/csky/csky.h (TARGET_SINGLE_FPU): New. (TARGET_DOUBLE_FPU): New. (FUNCTION_VARG_REGNO_P): New. (CSKY_VREG_MODE_P): New. (FUNCTION_VARG_MODE_P): New. (CUMULATIVE_ARGS): Add extra regs info. (INIT_CUMULATIVE_ARGS): Use csky_init_cumulative_args. (FUNCTION_ARG_REGNO_P): Use FUNCTION_VARG_REGNO_P. * config/csky/csky-protos.h (csky_init_cumulative_args): Extern. * config/csky/csky.c (csky_cpu_cpp_builtins): Support TARGET_HARD_FLOAT_ABI. (csky_function_arg): Likewise. (csky_num_arg_regs): Likewise. (csky_function_arg_advance): Likewise. (csky_function_value): Likewise. (csky_libcall_value): Likewise. (csky_function_value_regno_p): Likewise. (csky_arg_partial_bytes): Likewise. (csky_setup_incoming_varargs): Likewise. (csky_init_cumulative_args): New. gcc/testsuite/ChangeLog: * gcc.dg/builtin-apply2.c : Skip if CSKY. * gcc.dg/torture/stackalign/builtin-apply-2.c : Likewise. --- gcc/config/csky/csky-protos.h | 2 + gcc/config/csky/csky.c | 96 +++--- gcc/config/csky/csky.h | 34 ++-- gcc/config/csky/csky.md| 84 +++ gcc/testsuite/gcc.dg/builtin-apply2.c | 2 +- .../gcc.dg/torture/stackalign/builtin-apply-2.c| 2 +- 6 files changed, 200 insertions(+), 20 deletions(-) diff --git a/gcc/config/csky/csky-protos.h b/gcc/config/csky/csky-protos.h index cc1a033..2c02399 100644 --- a/gcc/config/csky/csky-protos.h +++ b/gcc/config/csky/csky-protos.h @@ -68,4 +68,6 @@ extern int csky_compute_pushpop_length (rtx *); extern int csky_default_branch_cost (bool, bool); extern bool csky_default_logical_op_non_short_circuit (void); + +extern void csky_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree); #endif /* GCC_CSKY_PROTOS_H */ diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c index 7ba3ed3..8463d8f 100644 --- a/gcc/config/csky/csky.c +++ b/gcc/config/csky/csky.c @@ -328,6 +328,16 @@ csky_cpu_cpp_builtins (cpp_reader *pfile) { builtin_define ("__csky_hard_float__"); builtin_define ("__CSKY_HARD_FLOAT__"); + if (TARGET_HARD_FLOAT_ABI) + { + builtin_define ("__csky_hard_float_abi__"); + builtin_define ("__CSKY_HARD_FLOAT_ABI__"); + } + if (TARGET_SINGLE_FPU) + { + builtin_define ("__csky_hard_float_fpu_sf__"); + builtin_define ("__CSKY_HARD_FLOAT_FPU_SF__"); + } } else { @@ -1790,9 +1800,22 @@ static rtx csky_function_arg (cumulative_args_t pcum_v, const function_arg_info ) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); + int reg = pcum->reg; + machine_mode mode = arg.mode; - if (*pcum < CSKY_NPARM_REGS) -return gen_rtx_REG (arg.mode, CSKY_FIRST_PARM_REGNUM + *pcum); + if (FUNCTION_VARG_MODE_P(mode) + && !pcum->is_stdarg) +{ + reg = pcum->freg; + + if (reg < CSKY_NPARM_FREGS) + return gen_rtx_REG (mode, CSKY_FIRST_VFP_REGNUM + reg); + else + return NULL_RTX; +} + + if (reg < CSKY_NPARM_REGS) +return gen_rtx_REG (mode, CSKY_FIRST_PARM_REGNUM + reg); return NULL_RTX; } @@ -1802,7 +1825,7 @@ csky_function_arg (cumulative_args_t pcum_v, const function_arg_info ) MODE and TYPE. */ static int -csky_num_arg_regs (machine_mode mode, const_tree type) +csky_num_arg_regs (machine_mode mode, const_tree type, bool is_stdarg) { int size; @@ -1811,6 +1834,14 @@ csky_num_arg_regs (machine_mode mode, const_tree type) else size = GET_MODE_SIZE (mode); + if (TARGET_HARD_FLOAT_ABI + && !is_stdarg) +{ + if (CSKY_VREG_MODE_P(mode) + && !TARGET_SINGLE_FPU) + return ((CSKY_NUM_WORDS (size) + 1) / 2); +} + return CSKY_NUM_WORDS (size); } @@ -1822,12 +1853,23 @@ csky_function_arg_advance (cumulative_args_t pcum_v, const function_arg_info ) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); - int param_size = csky_num_arg_regs (arg.mode, arg.type); + int *reg = >reg; + machine_mode mode = arg.mode; - if (*pcum + param_size > CSKY_NPARM_REGS) -*pcum = CSKY_NPARM_REGS; + int param_size = csky_num_arg_regs (mode, arg.type, pcum->is_stdarg); + int param_regs_nums = CSKY_NPARM_REGS; + + if (FUNCTION_VARG_MODE_P(mode) + && !pcum->is_stdarg) +{ + reg = >freg; + param_regs_nums = CSKY_NPARM_FREGS; +} + + if (*reg + param_size > param_regs_nums) +*reg = param_regs_nums; else -*pcum += param_size; +*reg += param_size; } @@ -1843,6 +1885,12 @@ csky_function_value (const_tree type, const_tree func, mode = TYPE_MODE (type); size =
[PATCH v6] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 19 +++ gcc/genemit.c | 128 ++-- 2 files changed, 89 insertions(+), 58 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 79e854aa938..a7fcc7d5949 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1258,6 +1258,21 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +# target overrides +-include $(tmake_file) + +INSN-GENERATED-SPLIT-NUM ?= 0 + +insn-generated-split-num = $(shell i=1; j=`expr $(INSN-GENERATED-SPLIT-NUM) + 1`; \ + while test $$i -le $$j; do \ + echo $$i; i=`expr $$i + 1`; \ + done) + +insn-emit-split-c := $(foreach o, $(shell for i in $(insn-generated-split-num); do echo $$i; done), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1265,6 +1280,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2365,6 +2381,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v + [ -s insn-$*0.c ] || (for i in $(insn-generated-split-num); do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..4fc8e61c5c8 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,6 +847,46 @@ handle_overloaded_gen (overloaded_name *oname) } } +#define printf_include() do { \ + printf ("/* Generated automatically by the program `genemit'\n\ +from the machine description file `md'. */\n\n"); \ + printf ("#define IN_TARGET_CODE 1\n");\ + printf ("#include \"config.h\"\n"); \ + printf ("#include \"system.h\"\n"); \ + printf ("#include \"coretypes.h\"\n");\ + printf ("#include \"backend.h\"\n"); \ + printf ("#include \"predict.h\"\n"); \ + printf ("#include \"tree.h\"\n"); \ + printf ("#include \"rtl.h\"\n"); \ + printf ("#include \"alias.h\"\n");\ + printf ("#include \"varasm.h\"\n"); \ + printf ("#include \"stor-layout.h\"\n"); \ + printf ("#include \"calls.h\"\n");\ + printf ("#include \"memmodel.h\"\n"); \ + printf ("#include \"tm_p.h\"\n"); \ + printf ("#include \"flags.h\"\n");\ + printf ("#include \"insn-config.h\"\n"); \ + printf ("#include \"expmed.h\"\n"); \ + printf ("#include \"dojump.h\"\n"); \ + printf ("#include \"explow.h\"\n"); \ + printf ("#include \"emit-rtl.h\"\n"); \ + printf ("#include \"stmt.h\"\n"); \ + printf ("#include \"expr.h\"\n"); \ + printf ("#include \"insn-codes.h\"\n"); \ + printf ("#include \"optabs.h\"\n"); \ + printf ("#include \"dfp.h\"\n"); \ + printf ("#include \"output.h\"\n"); \ + printf ("#include \"recog.h\"\n");\ + printf ("#include \"df.h\"\n"); \ + printf ("#include \"resource.h\"\n"); \ + printf ("#include \"reload.h\"\n"); \ + printf ("#include \"diagnostic-core.h\"\n"); \ + printf ("#include \"regs.h\"\n"); \ + printf ("#include \"tm-constrs.h\"\n"); \ + printf ("#include \"ggc.h\"\n"); \ + printf ("#include \"target.h\"\n\n"); \ +} while (0) + int main (int argc, const char **argv) { @@ -862,73 +902,45 @@ main (int argc, const char **argv) /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); - - printf ("#define IN_TARGET_CODE 1\n"); - printf ("#include \"config.h\"\n"); - printf ("#include \"system.h\"\n"); - printf
Re: [PATCH v5] genemit.c (main): split insn-emit.c for compiling parallelly
Hi, Ok & Thanks, It’s fixed in patch v6. Jojo 在 2020年8月28日 +0800 PM5:52,Richard Sandiford ,写道: > Thanks for doing this. In addition to what Segher said: > > Jojo R writes: > > gcc/ChangeLog: > > > > * genemit.c (main): Print 'split line'. > > * Makefile.in (insn-emit.c): Define split count and file > > > > --- > > gcc/Makefile.in | 15 + > > gcc/genemit.c | 87 - > > 2 files changed, 64 insertions(+), 38 deletions(-) > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > index 79e854aa938..08e4aa7ef6f 100644 > > --- a/gcc/Makefile.in > > +++ b/gcc/Makefile.in > > @@ -1258,6 +1258,17 @@ ANALYZER_OBJS = \ > > # We put the *-match.o and insn-*.o files first so that a parallel make > > # will build them sooner, because they are large and otherwise tend to be > > # the last objects to finish building. > > + > > +# target overrides > > +-include $(tmake_file) > > + > > +INSN-GENERATED-SPLIT-NUM ?= 0 > > +insn-generated-split-num = $(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1) > > + > > +insn-emit-split-c = $(foreach o, $(shell for i in > > {1..$(insn-generated-split-num)}; do echo $$i; done), insn-emit$(o).c) > > The {a..b} construct isn't portable: this needs to be runnable with > a plain Bourne shell like /bin/dash. > > I think we should use the same wordlist technique as check_p_numbers[0-6]. > So I guess the first step would be to rename check_p_numbers[0-6] to > something more general and use it both here and in check_p_numbers. > > Thanks, > Richard
Re: [PATCH v5] genemit.c (main): split insn-emit.c for compiling parallelly
Hi, Ok & Thanks, It’s fixed in patch v6. Jojo 在 2020年8月28日 +0800 AM4:40,Segher Boessenkool ,写道: > Hi! > > On Thu, Aug 27, 2020 at 08:47:19PM +0800, Jojo R wrote: > > +insn-emit-split-c = $(foreach o, $(shell for i in > > {1..$(insn-generated-split-num)}; do echo $$i; done), insn-emit$(o).c) > > If you use a variable for the result of that "seq", this will be more > readable / maintainable / etc. > > (Should this use := instead of = ? What about the assignment to > insn-generated-split-num itself?) > > > + long long read_count = 0; > > We use "int" in many other places for similar counts. 2**31 should be > enough for anybody. > > > md_rtx_info info; > > while (read_md_rtx ()) > > + { > > + if (!(read_count++ % 1)) > > Wrong indent. "== 0" is more typical for testing if numbers are zero. > > > + { > > + printf ("/* Split file into separate compilation units for parallel > > compilation %lld */\n\n", read_count); > > Please split this (at least the source line, but probably the target > line is too long a well). > > > All that are details. This does look like it fixes the problems in the > previous versions. Thanks! > > > Segher
[PATCH] C-SKY: Add compatibility of elf target name
gcc/ChangeLog: * config.gcc (C-SKY): Add compatibility of elf target name. libgcc/ChangeLog: * config.host (C-SKY): Add compatibility of elf target name. --- gcc/config.gcc | 2 +- libgcc/config.host | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/config.gcc b/gcc/config.gcc index ed9697b..f2324ba 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -1558,7 +1558,7 @@ csky-*-*) fi case ${target} in - csky-*-elf*) + csky*-elf*) tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file} csky/csky-elf.h" tmake_file="csky/t-csky csky/t-csky-elf" default_use_cxa_atexit=no diff --git a/libgcc/config.host b/libgcc/config.host index c529cc4..c291a8a 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -586,7 +586,7 @@ cris-*-elf) cris-*-linux* | crisv32-*-linux*) tmake_file="$tmake_file cris/t-cris t-softfp-sfdf t-softfp cris/t-linux" ;; -csky-*-elf*) +csky*-elf*) tmake_file="csky/t-csky t-fdpbit" extra_parts="$extra_parts crti.o crtn.o" ;; -- 1.9.1
Re: [PATCH] C-SKY: Add -mbacktrace option.
Hi, Ok & thanks, I will reroll this :) Jojo 在 2020年8月26日 +0800 AM4:22,Jeff Law ,写道: > On Fri, 2020-08-21 at 14:18 +0800, Jojo R wrote: > > gcc/ChangeLog: > > > > * config/csky/csky.opt (TARGET_BACKTRACE): New. > > * doc/invoke.texi (C-SKY Options): Document -mbacktrace. > ISTM you need an actual implementation. All this does is add an option. It's > impossible to know if this is a good idea without seeing implementation bits. > > jeff
[PATCH v5] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 15 + gcc/genemit.c | 87 - 2 files changed, 64 insertions(+), 38 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 79e854aa938..08e4aa7ef6f 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1258,6 +1258,17 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +# target overrides +-include $(tmake_file) + +INSN-GENERATED-SPLIT-NUM ?= 0 +insn-generated-split-num = $(shell expr $(INSN-GENERATED-SPLIT-NUM) + 1) + +insn-emit-split-c = $(foreach o, $(shell for i in {1..$(insn-generated-split-num)}; do echo $$i; done), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1265,6 +1276,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2365,6 +2377,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(INSN-GENERATED-SPLIT-NUM)} -f insn-$* -b "%d.c" 2>&1));\ + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v + [ -s insn-$*0.c ] || (for i in {1..$(insn-generated-split-num)}; do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..3aaaeb62b0a 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,6 +847,46 @@ handle_overloaded_gen (overloaded_name *oname) } } +#define printf_include() do { \ + printf ("/* Generated automatically by the program `genemit'\n\ +from the machine description file `md'. */\n\n"); \ + printf ("#define IN_TARGET_CODE 1\n");\ + printf ("#include \"config.h\"\n"); \ + printf ("#include \"system.h\"\n"); \ + printf ("#include \"coretypes.h\"\n");\ + printf ("#include \"backend.h\"\n"); \ + printf ("#include \"predict.h\"\n"); \ + printf ("#include \"tree.h\"\n"); \ + printf ("#include \"rtl.h\"\n"); \ + printf ("#include \"alias.h\"\n");\ + printf ("#include \"varasm.h\"\n"); \ + printf ("#include \"stor-layout.h\"\n"); \ + printf ("#include \"calls.h\"\n");\ + printf ("#include \"memmodel.h\"\n"); \ + printf ("#include \"tm_p.h\"\n"); \ + printf ("#include \"flags.h\"\n");\ + printf ("#include \"insn-config.h\"\n"); \ + printf ("#include \"expmed.h\"\n"); \ + printf ("#include \"dojump.h\"\n"); \ + printf ("#include \"explow.h\"\n"); \ + printf ("#include \"emit-rtl.h\"\n"); \ + printf ("#include \"stmt.h\"\n"); \ + printf ("#include \"expr.h\"\n"); \ + printf ("#include \"insn-codes.h\"\n"); \ + printf ("#include \"optabs.h\"\n"); \ + printf ("#include \"dfp.h\"\n"); \ + printf ("#include \"output.h\"\n"); \ + printf ("#include \"recog.h\"\n");\ + printf ("#include \"df.h\"\n"); \ + printf ("#include \"resource.h\"\n"); \ + printf ("#include \"reload.h\"\n"); \ + printf ("#include \"diagnostic-core.h\"\n"); \ + printf ("#include \"regs.h\"\n"); \ + printf ("#include \"tm-constrs.h\"\n"); \ + printf ("#include \"ggc.h\"\n"); \ + printf ("#include \"target.h\"\n\n"); \ +} while (0) + int main (int argc, const char **argv) { @@ -862,49 +902,19 @@ main (int argc, const char **argv) /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); - - printf ("#define IN_TARGET_CODE 1\n"); - printf ("#include \"config.h\"\n"); - printf ("#include \"system.h\"\n"); - printf ("#include \"coretypes.h\"\n"); - printf ("#include \"backend.h\"\n"); - printf ("#include
Re: [PATCH v4] genemit.c (main): split insn-emit.c for compiling parallelly
Jojo 在 2020年8月2日 +0800 AM8:09,Segher Boessenkool ,写道: > On Sat, Aug 01, 2020 at 07:02:07PM +0800, Jojo R wrote: > > +insn-generated-split-num = $(shell nproc) > > nproc isn't portable, is not the same on every system, and can lead to > a number of processes quadratic in the number of processors being > launched (say, if someone does make -jK with K some fraction of the > number of processors). > > (It is a bad choice anyway: nproc shows how many hardware threads are > available, not how many it is a good idea to use for optimal > performance; and it can be overridden by the user as well, via an > environment variable). > > You need to split to some fixed number of parts, where that fixed number > can depend on the target, but not on the host (or build machine) at all. > > > Segher Ok & Thanks, It’s fixed in patch v5 Jojo
[PATCH] C-SKY: Add -mbacktrace option.
gcc/ChangeLog: * config/csky/csky.opt (TARGET_BACKTRACE): New. * doc/invoke.texi (C-SKY Options): Document -mbacktrace. --- gcc/config/csky/csky.opt | 4 gcc/doc/invoke.texi | 7 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/config/csky/csky.opt b/gcc/config/csky/csky.opt index 60b51e5..00fa343 100644 --- a/gcc/config/csky/csky.opt +++ b/gcc/config/csky/csky.opt @@ -192,3 +192,7 @@ Set the branch costs to roughly the specified number of instructions. msched-prolog Target Report Var(flag_sched_prolog) Init(0) Permit scheduling of function prologue and epilogue sequences. + +mbacktrace +Target Report Var(TARGET_BACKTRACE) Init(0) Undocumented +Generate code can be backtraced. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 6352eab..41d0634 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -821,7 +821,7 @@ Objective-C and Objective-C++ Dialects}. -mdsp -medsp -mvdsp @gol -mdiv -msmart -mhigh-registers -manchor @gol -mpushpop -mmultiple-stld -mconstpool -mstack-size -mccrt @gol --mbranch-cost=@var{n} -mcse-cc -msched-prolog} +-mbranch-cost=@var{n} -mcse-cc -msched-prolog -mbacktrace} @emph{Darwin Options} @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol @@ -20434,6 +20434,11 @@ this option can result in code that is not compliant with the C-SKY V2 ABI prologue requirements and that cannot be debugged or backtraced. It is disabled by default. +@item -mbacktrace +@itemx -mno-backtrace +@opindex mbacktrace +Generate code can be backtraced. This option defaults to off. + @end table @node Darwin Options -- 1.9.1
Re: [PATCH v2] C-SKY: Support -mfloat-abi=hard.
Hi, Good points :) Jojo 在 2020年8月18日 +0800 AM10:40,Cooper Qu ,写道: > Hi Jojo, > > Nowhere is this rule directly stated. But there are indent options > showed in > https://www.gnu.org/prep/standards/html_node/Formatting.html#Formatting > corresponding to recommendations of C formatting style, which use the > defualt 8 clumns tab wide. > > > On 8/18/20 9:42 AM, Jojo R wrote: > > Hi, > > > > Is there coding rule with it ? > > > > I can not find it from > > https://www.gnu.org/prep/standards/html_node/index.html > > and https://gcc.gnu.org/codingconventions.html > > > > Could you give me any hints ? > > > > Thanks. > > > > Jojo > > 在 2020年8月17日 +0800 PM11:05,Xianmiao Qu ,写道: > > > Hi Jojo, > > > > > > > > > On 8/17/20 7:09 PM, Jojo R wrote: > > > > diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c > > > > index 7ba3ed3..b71291a 100644 > > > > --- a/gcc/config/csky/csky.c > > > > +++ b/gcc/config/csky/csky.c > > > > @@ -328,6 +328,16 @@ csky_cpu_cpp_builtins (cpp_reader *pfile) > > > > { > > > > builtin_define ("__csky_hard_float__"); > > > > builtin_define ("__CSKY_HARD_FLOAT__"); > > > > + if (TARGET_HARD_FLOAT_ABI) > > > > + { > > > > + builtin_define ("__csky_hard_float_abi__"); > > > > + builtin_define ("__CSKY_HARD_FLOAT_ABI__"); > > > > + } > > > > + if (TARGET_SINGLE_FPU) > > > > + { > > > > + builtin_define ("__csky_hard_float_fpu_sf__"); > > > > + builtin_define ("__CSKY_HARD_FLOAT_FPU_SF__"); > > > > + } > > > > } > > > These is one more thing you shoud pay attention to, if the spaces number > > > reaches 8 at begining of a line, you should use tab instead of 8 spaces. > > > > > > > > > Thanks, > > > > > > Xianmiao
Re: [PATCH v2] C-SKY: Support -mfloat-abi=hard.
Hi, Is there coding rule with it ? I can not find it from https://www.gnu.org/prep/standards/html_node/index.html and https://gcc.gnu.org/codingconventions.html Could you give me any hints ? Thanks. Jojo 在 2020年8月17日 +0800 PM11:05,Xianmiao Qu ,写道: > Hi Jojo, > > > On 8/17/20 7:09 PM, Jojo R wrote: > > diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c > > index 7ba3ed3..b71291a 100644 > > --- a/gcc/config/csky/csky.c > > +++ b/gcc/config/csky/csky.c > > @@ -328,6 +328,16 @@ csky_cpu_cpp_builtins (cpp_reader *pfile) > > { > > builtin_define ("__csky_hard_float__"); > > builtin_define ("__CSKY_HARD_FLOAT__"); > > + if (TARGET_HARD_FLOAT_ABI) > > + { > > + builtin_define ("__csky_hard_float_abi__"); > > + builtin_define ("__CSKY_HARD_FLOAT_ABI__"); > > + } > > + if (TARGET_SINGLE_FPU) > > + { > > + builtin_define ("__csky_hard_float_fpu_sf__"); > > + builtin_define ("__CSKY_HARD_FLOAT_FPU_SF__"); > > + } > > } > > These is one more thing you shoud pay attention to, if the spaces number > reaches 8 at begining of a line, you should use tab instead of 8 spaces. > > > Thanks, > > Xianmiao
[PATCH v2] C-SKY: Support -mfloat-abi=hard.
gcc/ChangeLog: * config/csky/csky.md (CSKY_NPARM_FREGS): New. (call_value_internal_vs/d): New. (untyped_call): New. * config/csky/csky.h (TARGET_SINGLE_FPU): New. (TARGET_DOUBLE_FPU): New. (FUNCTION_VARG_REGNO_P): New. (CSKY_VREG_MODE_P): New. (FUNCTION_VARG_MODE_P): New. (CUMULATIVE_ARGS): Add extra regs info. (INIT_CUMULATIVE_ARGS): Use csky_init_cumulative_args. (FUNCTION_ARG_REGNO_P): Use FUNCTION_VARG_REGNO_P. * config/csky/csky-protos.h (csky_init_cumulative_args): Extern. * config/csky/csky.c (csky_cpu_cpp_builtins): Support TARGET_HARD_FLOAT_ABI. (csky_function_arg): Likewise. (csky_num_arg_regs): Likewise. (csky_function_arg_advance): Likewise. (csky_function_value): Likewise. (csky_libcall_value): Likewise. (csky_function_value_regno_p): Likewise. (csky_arg_partial_bytes): Likewise. (csky_setup_incoming_varargs): Likewise. (csky_init_cumulative_args): New. gcc/testsuite/ChangeLog: * gcc.dg/builtin-apply2.c : Skip if CSKY. * gcc.dg/torture/stackalign/builtin-apply-2.c : Likewise. --- gcc/config/csky/csky-protos.h | 2 + gcc/config/csky/csky.c | 96 +++--- gcc/config/csky/csky.h | 34 ++-- gcc/config/csky/csky.md| 84 +++ gcc/testsuite/gcc.dg/builtin-apply2.c | 2 +- .../gcc.dg/torture/stackalign/builtin-apply-2.c| 2 +- 6 files changed, 200 insertions(+), 20 deletions(-) diff --git a/gcc/config/csky/csky-protos.h b/gcc/config/csky/csky-protos.h index cc1a033..2c02399 100644 --- a/gcc/config/csky/csky-protos.h +++ b/gcc/config/csky/csky-protos.h @@ -68,4 +68,6 @@ extern int csky_compute_pushpop_length (rtx *); extern int csky_default_branch_cost (bool, bool); extern bool csky_default_logical_op_non_short_circuit (void); + +extern void csky_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree); #endif /* GCC_CSKY_PROTOS_H */ diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c index 7ba3ed3..b71291a 100644 --- a/gcc/config/csky/csky.c +++ b/gcc/config/csky/csky.c @@ -328,6 +328,16 @@ csky_cpu_cpp_builtins (cpp_reader *pfile) { builtin_define ("__csky_hard_float__"); builtin_define ("__CSKY_HARD_FLOAT__"); + if (TARGET_HARD_FLOAT_ABI) +{ + builtin_define ("__csky_hard_float_abi__"); + builtin_define ("__CSKY_HARD_FLOAT_ABI__"); +} + if (TARGET_SINGLE_FPU) +{ + builtin_define ("__csky_hard_float_fpu_sf__"); + builtin_define ("__CSKY_HARD_FLOAT_FPU_SF__"); +} } else { @@ -1790,9 +1800,22 @@ static rtx csky_function_arg (cumulative_args_t pcum_v, const function_arg_info ) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); + int reg = pcum->reg; + machine_mode mode = arg.mode; - if (*pcum < CSKY_NPARM_REGS) -return gen_rtx_REG (arg.mode, CSKY_FIRST_PARM_REGNUM + *pcum); + if (FUNCTION_VARG_MODE_P(mode) + && !pcum->is_stdarg) +{ + reg = pcum->freg; + + if (reg < CSKY_NPARM_FREGS) +return gen_rtx_REG (mode, CSKY_FIRST_VFP_REGNUM + reg); + else +return NULL_RTX; +} + + if (reg < CSKY_NPARM_REGS) +return gen_rtx_REG (mode, CSKY_FIRST_PARM_REGNUM + reg); return NULL_RTX; } @@ -1802,7 +1825,7 @@ csky_function_arg (cumulative_args_t pcum_v, const function_arg_info ) MODE and TYPE. */ static int -csky_num_arg_regs (machine_mode mode, const_tree type) +csky_num_arg_regs (machine_mode mode, const_tree type, bool is_stdarg) { int size; @@ -1811,6 +1834,14 @@ csky_num_arg_regs (machine_mode mode, const_tree type) else size = GET_MODE_SIZE (mode); + if (TARGET_HARD_FLOAT_ABI + && !is_stdarg) +{ + if (CSKY_VREG_MODE_P(mode) + && !TARGET_SINGLE_FPU) +return ((CSKY_NUM_WORDS (size) + 1) / 2); +} + return CSKY_NUM_WORDS (size); } @@ -1822,12 +1853,23 @@ csky_function_arg_advance (cumulative_args_t pcum_v, const function_arg_info ) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); - int param_size = csky_num_arg_regs (arg.mode, arg.type); + int *reg = >reg; + machine_mode mode = arg.mode; + + int param_size = csky_num_arg_regs (mode, arg.type, pcum->is_stdarg); + int param_regs_nums = CSKY_NPARM_REGS; + + if (FUNCTION_VARG_MODE_P(mode) + && !pcum->is_stdarg) +{ + reg = >freg; + param_regs_nums = CSKY_NPARM_FREGS; +} - if (*pcum + param_size > CSKY_NPARM_REGS) -*pcum = CSKY_NPARM_REGS; + if (*reg + param_size > param_regs_nums) +*reg = param_regs_nums; else -*pcum += param_size; +*reg += param_size; } @@ -1843,6 +1885,12 @@ csky_function_value (const_tree type, const_tree func, mode = TYPE_MODE (type); size
[PATCH] C-SKY: Support -mfloat-abi=hard.
gcc/ChangeLog: * config/csky/csky.md (CSKY_NPARM_FREGS): New. (call_value_internal_vs/d): New. (untyped_call): New. * config/csky/csky.h (TARGET_SINGLE_FPU): New. (TARGET_DOUBLE_FPU): New. (FUNCTION_VARG_REGNO_P): New. (CSKY_VREG_MODE_P): New. (FUNCTION_VARG_MODE_P): New. (CUMULATIVE_ARGS): Add extra regs info. (INIT_CUMULATIVE_ARGS): Use csky_init_cumulative_args. (FUNCTION_ARG_REGNO_P): Use FUNCTION_VARG_REGNO_P. * config/csky/csky-protos.h (csky_init_cumulative_args): Extern. * config/csky/csky.c (csky_cpu_cpp_builtins): Support TARGET_HARD_FLOAT_ABI. (csky_function_arg): Likewise. (csky_num_arg_regs): Likewise. (csky_function_arg_advance): Likewise. (csky_function_value): Likewise. (csky_libcall_value): Likewise. (csky_function_value_regno_p): Likewise. (csky_arg_partial_bytes): Likewise. (csky_setup_incoming_varargs): Likewise. (csky_init_cumulative_args): New. gcc/testsuite/ChangeLog: * gcc.dg/builtin-apply2.c : Skip if CSKY. * gcc.dg/torture/stackalign/builtin-apply-2.c : Likewise. --- gcc/config/csky/csky-protos.h | 2 + gcc/config/csky/csky.c | 90 ++ gcc/config/csky/csky.h | 34 ++-- gcc/config/csky/csky.md| 84 gcc/testsuite/gcc.dg/builtin-apply2.c | 2 +- .../gcc.dg/torture/stackalign/builtin-apply-2.c| 2 +- 6 files changed, 194 insertions(+), 20 deletions(-) diff --git a/gcc/config/csky/csky-protos.h b/gcc/config/csky/csky-protos.h index cc1a033..2c02399 100644 --- a/gcc/config/csky/csky-protos.h +++ b/gcc/config/csky/csky-protos.h @@ -68,4 +68,6 @@ extern int csky_compute_pushpop_length (rtx *); extern int csky_default_branch_cost (bool, bool); extern bool csky_default_logical_op_non_short_circuit (void); + +extern void csky_init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree); #endif /* GCC_CSKY_PROTOS_H */ diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c index 7ba3ed3..9a43dfa 100644 --- a/gcc/config/csky/csky.c +++ b/gcc/config/csky/csky.c @@ -328,6 +328,10 @@ csky_cpu_cpp_builtins (cpp_reader *pfile) { builtin_define ("__csky_hard_float__"); builtin_define ("__CSKY_HARD_FLOAT__"); + if (TARGET_HARD_FLOAT_ABI) +builtin_define ("__CSKY_HARD_FLOAT_ABI__"); + if (TARGET_SINGLE_FPU) +builtin_define ("__CSKY_HARD_FLOAT_FPU_SF__"); } else { @@ -1790,9 +1794,22 @@ static rtx csky_function_arg (cumulative_args_t pcum_v, const function_arg_info ) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); + int reg = pcum->reg; + machine_mode mode = arg.mode; - if (*pcum < CSKY_NPARM_REGS) -return gen_rtx_REG (arg.mode, CSKY_FIRST_PARM_REGNUM + *pcum); + if (FUNCTION_VARG_MODE_P(mode) + && !pcum->is_stdarg) +{ + reg = pcum->freg; + + if (reg < CSKY_NPARM_FREGS) +return gen_rtx_REG (mode, CSKY_FIRST_VFP_REGNUM + reg); + else +return NULL_RTX; +} + + if (reg < CSKY_NPARM_REGS) +return gen_rtx_REG (mode, CSKY_FIRST_PARM_REGNUM + reg); return NULL_RTX; } @@ -1802,7 +1819,7 @@ csky_function_arg (cumulative_args_t pcum_v, const function_arg_info ) MODE and TYPE. */ static int -csky_num_arg_regs (machine_mode mode, const_tree type) +csky_num_arg_regs (machine_mode mode, const_tree type, bool is_stdarg) { int size; @@ -1811,6 +1828,14 @@ csky_num_arg_regs (machine_mode mode, const_tree type) else size = GET_MODE_SIZE (mode); + if (TARGET_HARD_FLOAT_ABI + && !is_stdarg) +{ + if (CSKY_VREG_MODE_P(mode) + && !TARGET_SINGLE_FPU) +return ((CSKY_NUM_WORDS (size) + 1) / 2); +} + return CSKY_NUM_WORDS (size); } @@ -1822,12 +1847,23 @@ csky_function_arg_advance (cumulative_args_t pcum_v, const function_arg_info ) { CUMULATIVE_ARGS *pcum = get_cumulative_args (pcum_v); - int param_size = csky_num_arg_regs (arg.mode, arg.type); + int *reg = >reg; + machine_mode mode = arg.mode; + + int param_size = csky_num_arg_regs (mode, arg.type, pcum->is_stdarg); + int param_regs_nums = CSKY_NPARM_REGS; + + if (FUNCTION_VARG_MODE_P(mode) + && !pcum->is_stdarg) +{ + reg = >freg; + param_regs_nums = CSKY_NPARM_FREGS; +} - if (*pcum + param_size > CSKY_NPARM_REGS) -*pcum = CSKY_NPARM_REGS; + if (*reg + param_size > param_regs_nums) +*reg = param_regs_nums; else -*pcum += param_size; +*reg += param_size; } @@ -1843,6 +1879,12 @@ csky_function_value (const_tree type, const_tree func, mode = TYPE_MODE (type); size = int_size_in_bytes (type); + if (FUNCTION_VARG_MODE_P(mode)) +{ + mode = promote_function_mode (type, mode, , func, 1); + return gen_rtx_REG
Re: [PATCH] C-SKY: Fix assembling error with -mfloat-abi=hard.
Hi, Ok & thanks. Jojo 在 2020年8月14日 +0800 PM3:02,Xianmiao Qu ,写道: > Hi Jojo, > > > gcc/ChangeLog: > > * gcc/config/csky/csky-elf.h (ASM_SPEC): Use mfloat-abi. > > * gcc/config/csky/csky-linux-elf.h (ASM_SPEC): mfloat-abi. > > > I have committed it to trunk. But there two points you shoud pay > attention to, > > 1. line should start with a tab not spaces > > 2. The path of changed file should not include the 'gcc' > > > Thanks, > > Xianmiao
[PATCH] C-SKY: Fix assembling error with -mfloat-abi=hard.
gcc/ChangeLog: * gcc/config/csky/csky-elf.h (ASM_SPEC): Use mfloat-abi. * gcc/config/csky/csky-linux-elf.h (ASM_SPEC): mfloat-abi. --- gcc/config/csky/csky-elf.h | 2 ++ gcc/config/csky/csky-linux-elf.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/gcc/config/csky/csky-elf.h b/gcc/config/csky/csky-elf.h index 0a319c0..15a0e73 100644 --- a/gcc/config/csky/csky-elf.h +++ b/gcc/config/csky/csky-elf.h @@ -47,6 +47,8 @@ %{mcpu=*:-mcpu=%*} \ %{march=*:-march=%*} \ %{mhard-float:-mhard-float} \ + %{mfloat-abi=softfp:-mhard-float} \ + %{mfloat-abi=hard:-mhard-float} \ %{melrw:-melrw} \ %{mno-elrw:-mno-elrw}\ %{mistack:-mistack} \ diff --git a/gcc/config/csky/csky-linux-elf.h b/gcc/config/csky/csky-linux-elf.h index 2f052fd..9a57dd04 100644 --- a/gcc/config/csky/csky-linux-elf.h +++ b/gcc/config/csky/csky-linux-elf.h @@ -47,6 +47,8 @@ %{mcpu=*:-mcpu=%*} \ %{march=*:-march=%*} \ %{mhard-float:-mhard-float} \ + %{mfloat-abi=softfp:-mhard-float} \ + %{mfloat-abi=hard:-mhard-float} \ %{melrw:-melrw} \ %{mno-elrw:-mno-elrw}\ %{mistack:-mistack} \ -- 1.9.1
[PATCH v2] CSKY: Add -mfloat-abi= option.
From: jojo gcc/ChangeLog: * config/csky/csky_opts.h (float_abi_type): New. * config/csky/csky.h (TARGET_SOFT_FLOAT): New. (TARGET_HARD_FLOAT): New. (TARGET_HARD_FLOAT_ABI): New. (OPTION_DEFAULT_SPECS): Use mfloat-abi. * config/csky/csky.opt (mfloat-abi): New. * doc/invoke.texi (C-SKY Options): Document -mfloat-abi=. * gcc/config/csky/csky-elf.h (ASM_SPEC): Use mfloat-abi. * gcc/config/csky/csky-linux-elf.h (ASM_SPEC): Use mfloat-abi. --- gcc/config/csky/csky-elf.h | 2 ++ gcc/config/csky/csky-linux-elf.h | 2 ++ gcc/config/csky/csky.h | 9 - gcc/config/csky/csky.opt | 29 + gcc/config/csky/csky_opts.h | 7 +++ gcc/doc/invoke.texi | 18 ++ 6 files changed, 62 insertions(+), 5 deletions(-) diff --git a/gcc/config/csky/csky-elf.h b/gcc/config/csky/csky-elf.h index 0a319c0..15a0e73 100644 --- a/gcc/config/csky/csky-elf.h +++ b/gcc/config/csky/csky-elf.h @@ -47,6 +47,8 @@ %{mcpu=*:-mcpu=%*} \ %{march=*:-march=%*} \ %{mhard-float:-mhard-float} \ + %{mfloat-abi=softfp:-mhard-float} \ + %{mfloat-abi=hard:-mhard-float} \ %{melrw:-melrw} \ %{mno-elrw:-mno-elrw}\ %{mistack:-mistack} \ diff --git a/gcc/config/csky/csky-linux-elf.h b/gcc/config/csky/csky-linux-elf.h index 2f052fd..9a57dd04 100644 --- a/gcc/config/csky/csky-linux-elf.h +++ b/gcc/config/csky/csky-linux-elf.h @@ -47,6 +47,8 @@ %{mcpu=*:-mcpu=%*} \ %{march=*:-march=%*} \ %{mhard-float:-mhard-float} \ + %{mfloat-abi=softfp:-mhard-float} \ + %{mfloat-abi=hard:-mhard-float} \ %{melrw:-melrw} \ %{mno-elrw:-mno-elrw}\ %{mistack:-mistack} \ diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h index 2d5a66c..8f4090b 100644 --- a/gcc/config/csky/csky.h +++ b/gcc/config/csky/csky.h @@ -126,6 +126,13 @@ #define TARGET_TLS \ (CSKY_TARGET_ARCH (CK807) || CSKY_TARGET_ARCH (CK810)) +/* Run-time Target Specification. */ +#define TARGET_SOFT_FLOAT (csky_float_abi == CSKY_FLOAT_ABI_SOFT) +/* Use hardware floating point instructions. */ +#define TARGET_HARD_FLOAT (csky_float_abi != CSKY_FLOAT_ABI_SOFT) +/* Use hardware floating point calling convention. */ +#define TARGET_HARD_FLOAT_ABI (csky_float_abi == CSKY_FLOAT_ABI_HARD) + /* Number of loads/stores handled by ldm/stm. */ #define CSKY_MIN_MULTIPLE_STLD 3 #define CSKY_MAX_MULTIPLE_STLD 12 @@ -818,7 +825,7 @@ while (0) {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \ {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ {"endian", "%{!mbig-endian:%{!mlittle-endian:-m%(VALUE)-endian}}" }, \ - {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, + {"float", "%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}" }, /** diff --git a/gcc/config/csky/csky.opt b/gcc/config/csky/csky.opt index 5846e50..60b51e5 100644 --- a/gcc/config/csky/csky.opt +++ b/gcc/config/csky/csky.opt @@ -57,12 +57,33 @@ Target RejectNegative Report Alias(mlittle-endian) Undocumented ;; assembly. mhard-float -Target Report RejectNegative Mask(HARD_FLOAT) -Enable hardware floating-point instructions. +Target RejectNegative Alias(mfloat-abi=, hard) Undocumented msoft-float -Target Report RejectNegative InverseMask(HARD_FLOAT) -Use library calls to perform floating-point operations (default). +Target RejectNegative Alias(mfloat-abi=, soft) Undocumented + +mfloat-abi=v2 +Target RejectNegative Alias(mfloat-abi=, hard) Undocumented + +mfloat-abi=v1 +Target RejectNegative Alias(mfloat-abi=, softfp) Undocumented + +mfloat-abi= +Target RejectNegative Joined Enum(float_abi_type) Var(csky_float_abi) Init(CSKY_FLOAT_ABI_SOFT) +Specify if floating point hardware should be used. + +Enum +Name(float_abi_type) Type(enum float_abi_type) +Known floating-point ABIs (for use with the -mfloat-abi= option): + +EnumValue +Enum(float_abi_type) String(soft) Value(CSKY_FLOAT_ABI_SOFT) + +EnumValue +Enum(float_abi_type) String(softfp) Value(CSKY_FLOAT_ABI_SOFTFP) + +EnumValue +Enum(float_abi_type) String(hard) Value(CSKY_FLOAT_ABI_HARD) mfpu= Target RejectNegative Joined Enum(csky_fpu) Var(csky_fpu_index) Init(TARGET_FPU_auto) Save diff --git a/gcc/config/csky/csky_opts.h b/gcc/config/csky/csky_opts.h index a6dbf5a..7ee56be 100644 --- a/gcc/config/csky/csky_opts.h +++ b/gcc/config/csky/csky_opts.h @@ -59,5 +59,12 @@ enum csky_fpu_type }; #define CSKY_TARGET_FPU_GET(name) TARGET_FPU_ ## name +enum float_abi_type +{ + CSKY_FLOAT_ABI_SOFT, + CSKY_FLOAT_ABI_SOFTFP, + CSKY_FLOAT_ABI_HARD +}; + #endif /* CSKY_OPTS_H */ diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index a2794a6..b68079d 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -815,6 +815,7 @@ Objective-C and Objective-C++ Dialects}.
[PATCH v4] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 11 +++ gcc/genemit.c | 87 - 2 files changed, 60 insertions(+), 38 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2ba76656dbf..bc0b3e6d343 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1253,6 +1253,13 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +insn-generated-split-num = $(shell nproc) + +insn-emit-split-c = $(foreach o, $(shell for i in {1..$(insn-generated-split-num)}; do echo $$i; done), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1260,6 +1267,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2367,6 +2375,9 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + $*v=$$(echo $$(csplit insn-$*.c /parallel\ compilation/ -k -s {$(insn-generated-split-num)} -f insn-$* -b "%d.c" 2>&1));\ + [ ! "$$$*v" ] || grep "match not found" <<< $$$*v + [ -s insn-$*0.c ] || (for i in {1..$(insn-generated-split-num)}; do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..3aaaeb62b0a 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,6 +847,46 @@ handle_overloaded_gen (overloaded_name *oname) } } +#define printf_include() do { \ + printf ("/* Generated automatically by the program `genemit'\n\ +from the machine description file `md'. */\n\n"); \ + printf ("#define IN_TARGET_CODE 1\n");\ + printf ("#include \"config.h\"\n"); \ + printf ("#include \"system.h\"\n"); \ + printf ("#include \"coretypes.h\"\n");\ + printf ("#include \"backend.h\"\n"); \ + printf ("#include \"predict.h\"\n"); \ + printf ("#include \"tree.h\"\n"); \ + printf ("#include \"rtl.h\"\n"); \ + printf ("#include \"alias.h\"\n");\ + printf ("#include \"varasm.h\"\n"); \ + printf ("#include \"stor-layout.h\"\n"); \ + printf ("#include \"calls.h\"\n");\ + printf ("#include \"memmodel.h\"\n"); \ + printf ("#include \"tm_p.h\"\n"); \ + printf ("#include \"flags.h\"\n");\ + printf ("#include \"insn-config.h\"\n"); \ + printf ("#include \"expmed.h\"\n"); \ + printf ("#include \"dojump.h\"\n"); \ + printf ("#include \"explow.h\"\n"); \ + printf ("#include \"emit-rtl.h\"\n"); \ + printf ("#include \"stmt.h\"\n"); \ + printf ("#include \"expr.h\"\n"); \ + printf ("#include \"insn-codes.h\"\n"); \ + printf ("#include \"optabs.h\"\n"); \ + printf ("#include \"dfp.h\"\n"); \ + printf ("#include \"output.h\"\n"); \ + printf ("#include \"recog.h\"\n");\ + printf ("#include \"df.h\"\n"); \ + printf ("#include \"resource.h\"\n"); \ + printf ("#include \"reload.h\"\n"); \ + printf ("#include \"diagnostic-core.h\"\n"); \ + printf ("#include \"regs.h\"\n"); \ + printf ("#include \"tm-constrs.h\"\n"); \ + printf ("#include \"ggc.h\"\n"); \ + printf ("#include \"target.h\"\n\n"); \ +} while (0) + int main (int argc, const char **argv) { @@ -862,49 +902,19 @@ main (int argc, const char **argv) /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); - - printf ("#define IN_TARGET_CODE 1\n"); - printf ("#include \"config.h\"\n"); - printf ("#include \"system.h\"\n"); - printf ("#include \"coretypes.h\"\n"); - printf ("#include \"backend.h\"\n"); - printf ("#include \"predict.h\"\n"); - printf ("#include \"tree.h\"\n"); - printf ("#include \"rtl.h\"\n"); - printf ("#include
[PATCH] CSKY: Add -mfloat-abi= option.
gcc/ChangeLog: * config/csky/csky_opts.h (float_abi_type): New. * config/csky/csky.h (TARGET_SOFT_FLOAT): New. (TARGET_HARD_FLOAT): New. (TARGET_HARD_FLOAT_ABI): New. (OPTION_DEFAULT_SPECS): Use mfloat-abi. * config/csky/csky.opt (mfloat-abi): New. * doc/invoke.texi (C-SKY Options): Document -mfloat-abi=. --- gcc/config/csky/csky.h | 9 - gcc/config/csky/csky.opt| 29 + gcc/config/csky/csky_opts.h | 7 +++ gcc/doc/invoke.texi | 18 ++ 4 files changed, 58 insertions(+), 5 deletions(-) diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h index 2d5a66ca187..8f4090b4b38 100644 --- a/gcc/config/csky/csky.h +++ b/gcc/config/csky/csky.h @@ -126,6 +126,13 @@ #define TARGET_TLS \ (CSKY_TARGET_ARCH (CK807) || CSKY_TARGET_ARCH (CK810)) +/* Run-time Target Specification. */ +#define TARGET_SOFT_FLOAT (csky_float_abi == CSKY_FLOAT_ABI_SOFT) +/* Use hardware floating point instructions. */ +#define TARGET_HARD_FLOAT (csky_float_abi != CSKY_FLOAT_ABI_SOFT) +/* Use hardware floating point calling convention. */ +#define TARGET_HARD_FLOAT_ABI (csky_float_abi == CSKY_FLOAT_ABI_HARD) + /* Number of loads/stores handled by ldm/stm. */ #define CSKY_MIN_MULTIPLE_STLD 3 #define CSKY_MAX_MULTIPLE_STLD 12 @@ -818,7 +825,7 @@ while (0) {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" }, \ {"cpu", "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" }, \ {"endian", "%{!mbig-endian:%{!mlittle-endian:-m%(VALUE)-endian}}" }, \ - {"float", "%{!msoft-float:%{!mhard-float:-m%(VALUE)-float}}" }, + {"float", "%{!mfloat-abi=*:-mfloat-abi=%(VALUE)}" }, /** diff --git a/gcc/config/csky/csky.opt b/gcc/config/csky/csky.opt index 5846e50344f..60b51e5798f 100644 --- a/gcc/config/csky/csky.opt +++ b/gcc/config/csky/csky.opt @@ -57,12 +57,33 @@ Target RejectNegative Report Alias(mlittle-endian) Undocumented ;; assembly. mhard-float -Target Report RejectNegative Mask(HARD_FLOAT) -Enable hardware floating-point instructions. +Target RejectNegative Alias(mfloat-abi=, hard) Undocumented msoft-float -Target Report RejectNegative InverseMask(HARD_FLOAT) -Use library calls to perform floating-point operations (default). +Target RejectNegative Alias(mfloat-abi=, soft) Undocumented + +mfloat-abi=v2 +Target RejectNegative Alias(mfloat-abi=, hard) Undocumented + +mfloat-abi=v1 +Target RejectNegative Alias(mfloat-abi=, softfp) Undocumented + +mfloat-abi= +Target RejectNegative Joined Enum(float_abi_type) Var(csky_float_abi) Init(CSKY_FLOAT_ABI_SOFT) +Specify if floating point hardware should be used. + +Enum +Name(float_abi_type) Type(enum float_abi_type) +Known floating-point ABIs (for use with the -mfloat-abi= option): + +EnumValue +Enum(float_abi_type) String(soft) Value(CSKY_FLOAT_ABI_SOFT) + +EnumValue +Enum(float_abi_type) String(softfp) Value(CSKY_FLOAT_ABI_SOFTFP) + +EnumValue +Enum(float_abi_type) String(hard) Value(CSKY_FLOAT_ABI_HARD) mfpu= Target RejectNegative Joined Enum(csky_fpu) Var(csky_fpu_index) Init(TARGET_FPU_auto) Save diff --git a/gcc/config/csky/csky_opts.h b/gcc/config/csky/csky_opts.h index a6dbf5ab6dd..7ee56be3e81 100644 --- a/gcc/config/csky/csky_opts.h +++ b/gcc/config/csky/csky_opts.h @@ -59,5 +59,12 @@ enum csky_fpu_type }; #define CSKY_TARGET_FPU_GET(name) TARGET_FPU_ ## name +enum float_abi_type +{ + CSKY_FLOAT_ABI_SOFT, + CSKY_FLOAT_ABI_SOFTFP, + CSKY_FLOAT_ABI_HARD +}; + #endif /* CSKY_OPTS_H */ diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index eaaf6d06b65..a132e09c674 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -820,6 +820,7 @@ Objective-C and Objective-C++ Dialects}. @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} @gol -mbig-endian -EB -mlittle-endian -EL @gol -mhard-float -msoft-float -mfpu=@var{fpu} -mdouble-float -mfdivdu @gol +-mfloat-abi=@var{name} @gol -melrw -mistack -mmp -mcp -mcache -msecurity -mtrust @gol -mdsp -medsp -mvdsp @gol -mdiv -msmart -mhigh-registers -manchor @gol @@ -20644,6 +20645,23 @@ Specify the C-SKY target processor. Valid values for @var{cpu} are: Select big- or little-endian code. The default is little-endian. +@item -mfloat-abi=@var{name} +@opindex mfloat-abi +Specifies which floating-point ABI to use. Permissible values +are: @samp{soft}, @samp{softfp} and @samp{hard}. + +Specifying @samp{soft} causes GCC to generate output containing +library calls for floating-point operations. +@samp{softfp} allows the generation of code using hardware floating-point +instructions, but still uses the soft-float calling conventions. +@samp{hard} allows generation of floating-point instructions +and uses FPU-specific calling conventions. + +The default depends on the specific target configuration. Note that +the hard-float and soft-float ABIs are not link-compatible; you must +compile your
Re: [PATCH v3] genemit.c (main): split insn-emit.c for compiling parallelly
在 2020年7月24日 +0800 PM9:19,Segher Boessenkool ,写道: > On Fri, Jul 24, 2020 at 12:03:16PM +0200, Richard Biener via Gcc-patches > wrote: > > On Fri, Jul 24, 2020 at 10:13 AM Rainer Orth > > wrote: > > > Jojo R writes: > > > > +insn-generated-split-num = $(shell grep -c ^processor /proc/cpuinfo) > > > > > > This is highly unportable, probably Linux-only. It certainly doesn't > > > exist on at least Solaris and macOS. Maybe gnulib has something here. > > > > It will also produce different build results depending on the build host > > which is even more undesirable. > > Yeah, it has to be the same number everywhere. Something high enough > that bigger machines benefit (so 100 or so), but not so high that the > overhead increases too much... It shouldn't be quite as high for > smaller backends... so some fixed ratio of number of define_insns > perhaps, something like that? > We can get bigger benefit with much more huge file in this simple solution, Indeed, it does not cover smaller backends. Yes, we should consider to target all backends, I thinks there is no high enough benefit for smaller backends, is it necessary ? > Something else. Does this make the generated compiler slower? It will > at least potentially have fewer inlining opportunities, but does that > matter? > Yes, some machine will take > 30 minutes in my testcase, It’s really matter in gcc development stage :( > Thanks for working on this, > > > Segher
Re: [PATCH v3] genemit.c (main): split insn-emit.c for compiling parallelly
在 2020年7月24日 +0800 PM9:57,Joseph Myers ,写道: > On Fri, 24 Jul 2020, Jojo R wrote: > > > + -csplit insn-$*.c /parallel\ compilation/ -k -s > > {$(insn-generated-split-num)} -f insn-$* -b "%d.c" > > + -( [ ! -s insn-$*0.c ] && for i in {1..$(insn-generated-split-num)}; do > > touch insn-$*$$i.c; done && echo "" > insn-$*.c) > > Ignoring errors (disk full, out of memory, etc.) here is not appropriate. > If csplit fails, the build must fail. Thank you and it’s fixed in the next version patch > > -- > Joseph S. Myers > jos...@codesourcery.com
Re: [PATCH v3] genemit.c (main): split insn-emit.c for compiling parallelly
在 2020年7月24日 +0800 PM6:03,Richard Biener ,写道: > On Fri, Jul 24, 2020 at 10:13 AM Rainer Orth > wrote: > > > > Jojo R writes: > > > > > gcc/ChangeLog: > > > > > > * genemit.c (main): Print 'split line'. > > > * Makefile.in (insn-emit.c): Define split count and file > > [...] > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > > index 2ba76656dbf..75841e49127 100644 > > > --- a/gcc/Makefile.in > > > +++ b/gcc/Makefile.in > > > @@ -1253,6 +1253,13 @@ ANALYZER_OBJS = \ > > > # We put the *-match.o and insn-*.o files first so that a parallel make > > > # will build them sooner, because they are large and otherwise tend to be > > > # the last objects to finish building. > > > + > > > +insn-generated-split-num = $(shell grep -c ^processor /proc/cpuinfo) > > > > This is highly unportable, probably Linux-only. It certainly doesn't > > exist on at least Solaris and macOS. Maybe gnulib has something here. > > It will also produce different build results depending on the build host > which is even more undesirable. > Theoretically possible it’s the highest performance for building insn-emit.c if all processors are used. User should not pay much more attention at auto-generated file like insn-emit.c, it’s right ? > Richard, > > > Rainer > > > > -- > > - > > Rainer Orth, Center for Biotechnology, Bielefeld University
Re: [PATCH v3] genemit.c (main): split insn-emit.c for compiling parallelly
在 2020年7月24日 +0800 PM4:12,Rainer Orth ,写道: > Jojo R writes: > > > gcc/ChangeLog: > > > > * genemit.c (main): Print 'split line'. > > * Makefile.in (insn-emit.c): Define split count and file > [...] > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > index 2ba76656dbf..75841e49127 100644 > > --- a/gcc/Makefile.in > > +++ b/gcc/Makefile.in > > @@ -1253,6 +1253,13 @@ ANALYZER_OBJS = \ > > # We put the *-match.o and insn-*.o files first so that a parallel make > > # will build them sooner, because they are large and otherwise tend to be > > # the last objects to finish building. > > + > > +insn-generated-split-num = $(shell grep -c ^processor /proc/cpuinfo) > > This is highly unportable, probably Linux-only. It certainly doesn't > exist on at least Solaris and macOS. Maybe gnulib has something here. > Thank you and it’s fixed in the next version patch > Rainer > > -- > - > Rainer Orth, Center for Biotechnology, Bielefeld University
[PATCH v3] genemit.c (main): split insn-emit.c for compiling parallelly
gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 10 ++ gcc/genemit.c | 87 - 2 files changed, 59 insertions(+), 38 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2ba76656dbf..75841e49127 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1253,6 +1253,13 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +insn-generated-split-num = $(shell grep -c ^processor /proc/cpuinfo) + +insn-emit-split-c = $(foreach o, $(shell for i in {1..$(insn-generated-split-num)}; do echo $$i; done), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1260,6 +1267,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2367,6 +2375,8 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + -csplit insn-$*.c /parallel\ compilation/ -k -s {$(insn-generated-split-num)} -f insn-$* -b "%d.c" + -( [ ! -s insn-$*0.c ] && for i in {1..$(insn-generated-split-num)}; do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..3aaaeb62b0a 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,6 +847,46 @@ handle_overloaded_gen (overloaded_name *oname) } } +#define printf_include() do { \ + printf ("/* Generated automatically by the program `genemit'\n\ +from the machine description file `md'. */\n\n"); \ + printf ("#define IN_TARGET_CODE 1\n");\ + printf ("#include \"config.h\"\n"); \ + printf ("#include \"system.h\"\n"); \ + printf ("#include \"coretypes.h\"\n");\ + printf ("#include \"backend.h\"\n"); \ + printf ("#include \"predict.h\"\n"); \ + printf ("#include \"tree.h\"\n"); \ + printf ("#include \"rtl.h\"\n"); \ + printf ("#include \"alias.h\"\n");\ + printf ("#include \"varasm.h\"\n"); \ + printf ("#include \"stor-layout.h\"\n"); \ + printf ("#include \"calls.h\"\n");\ + printf ("#include \"memmodel.h\"\n"); \ + printf ("#include \"tm_p.h\"\n"); \ + printf ("#include \"flags.h\"\n");\ + printf ("#include \"insn-config.h\"\n"); \ + printf ("#include \"expmed.h\"\n"); \ + printf ("#include \"dojump.h\"\n"); \ + printf ("#include \"explow.h\"\n"); \ + printf ("#include \"emit-rtl.h\"\n"); \ + printf ("#include \"stmt.h\"\n"); \ + printf ("#include \"expr.h\"\n"); \ + printf ("#include \"insn-codes.h\"\n"); \ + printf ("#include \"optabs.h\"\n"); \ + printf ("#include \"dfp.h\"\n"); \ + printf ("#include \"output.h\"\n"); \ + printf ("#include \"recog.h\"\n");\ + printf ("#include \"df.h\"\n"); \ + printf ("#include \"resource.h\"\n"); \ + printf ("#include \"reload.h\"\n"); \ + printf ("#include \"diagnostic-core.h\"\n"); \ + printf ("#include \"regs.h\"\n"); \ + printf ("#include \"tm-constrs.h\"\n"); \ + printf ("#include \"ggc.h\"\n"); \ + printf ("#include \"target.h\"\n\n"); \ +} while (0) + int main (int argc, const char **argv) { @@ -862,49 +902,19 @@ main (int argc, const char **argv) /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); - - printf ("#define IN_TARGET_CODE 1\n"); - printf ("#include \"config.h\"\n"); - printf ("#include \"system.h\"\n"); - printf ("#include \"coretypes.h\"\n"); - printf ("#include \"backend.h\"\n"); - printf ("#include \"predict.h\"\n"); - printf ("#include \"tree.h\"\n"); - printf ("#include \"rtl.h\"\n"); - printf ("#include \"alias.h\"\n"); - printf ("#include
Re: [PATCH v2] genemit.c (main): split insn-emit.c for compiling parallelly
在 2020年7月21日 +0800 PM2:55,Bin.Cheng ,写道: > On Tue, Jul 21, 2020 at 11:14 AM Jojo wrote: > > > > gcc/ChangeLog: > > > > * genemit.c (main): Print 'split line'. > > * Makefile.in (insn-emit.c): Define split count and file > > > > Thanks for working one this, following comments are based on the > assumption that the approach is feasible after your investigation. > > It's great to accelerate compilation time, do you have any number > showing how much this can achieve, on a typical machine with > reasonable parallelism? > Here are time collections from machine: 20 Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz, Size of insn-emit.c (du -sh insn-emit.c) : 121M Not split (same like j1) : 195 second Split 20, -j1 : 213 second Split 20, -j4: 76 second Split 20, -j8: 44 second Split 20, -j12: 44 second Split 20, -j16: 44 second Split 20, -j20: 44 second Also, litter RAM will be consumed by litter code :) > > --- > > gcc/Makefile.in | 10 ++ > > gcc/genemit.c | 86 +++-- > > 2 files changed, 58 insertions(+), 38 deletions(-) > > > > diff --git a/gcc/Makefile.in b/gcc/Makefile.in > > index 2ba76656dbf..f805050a119 100644 > > --- a/gcc/Makefile.in > > +++ b/gcc/Makefile.in > > @@ -1253,6 +1253,13 @@ ANALYZER_OBJS = \ > > # We put the *-match.o and insn-*.o files first so that a parallel make > > # will build them sooner, because they are large and otherwise tend to be > > # the last objects to finish building. > > + > > +insn-generated-split-num = 15 > Hardcode number 15 looks strange here, how shall we know it's enough? > Or one step further, can we use some kind of general match "*" for > writing make rules here? I have researched the detail of Makefile rules, As far as I know, ‘Make’ analyze the dependent objects before some object running it’s shell command, so we need to static define the ‘insn-emit.c’ counts for creating ‘insn-emit.o’. We can define split counts from processor numbers from machine, it should be nice ? It’s fixed in v3 patch. > > + > > +insn-emit-split-c = $(foreach o, $(shell for i in > > {1..$(insn-generated-split-num)}; do echo $$i; done), insn-emit$(o).c) > > +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) > > +$(insn-emit-split-c): insn-emit.c > > + > > OBJS = \ > > gimple-match.o \ > > generic-match.o \ > > @@ -1260,6 +1267,7 @@ OBJS = \ > > insn-automata.o \ > > insn-dfatab.o \ > > insn-emit.o \ > > + $(insn-emit-split-obj) \ > > insn-extract.o \ > > insn-latencytab.o \ > > insn-modes.o \ > > @@ -2367,6 +2375,8 @@ $(simple_generated_c:insn-%.c=s-%): s-%: > > build/gen%$(build_exeext) > > $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ > > $(filter insn-conditions.md,$^) > tmp-$*.c > > $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c > > + -csplit insn-$*.c /i\ am\ split\ line/ -k -s > > {$(insn-generated-split-num)} -f insn-$* -b "%d.c" > > + -( [ ! -s insn-$*0.c ] && for i in {1..$(insn-generated-split-num)}; do > > touch insn-$*$$i.c; done && echo "" > insn-$*.c) > Not sure if this is the first time that csplit/coreutils is used, > shall we mention it here > https://gcc.gnu.org/install/prerequisites.html, even check it in > configure? I grep coreutils from gcc source code and much more modules have checked the coreutils like libcc1, libssp and so on. > > $(STAMP) s-$* > > > > # gencheck doesn't read the machine description, and the file produced > > diff --git a/gcc/genemit.c b/gcc/genemit.c > > index 84d07d388ee..fd60cdeeb96 100644 > > --- a/gcc/genemit.c > > +++ b/gcc/genemit.c > > @@ -847,6 +847,45 @@ handle_overloaded_gen (overloaded_name *oname) > > } > > } > > > > +#define printf_include() \ > > + printf ("/* Generated automatically by the program `genemit'\n\ > > +from the machine description file `md'. */\n\n"); \ > > + printf ("#define IN_TARGET_CODE 1\n"); \ > > + printf ("#include \"config.h\"\n"); \ > > + printf ("#include \"system.h\"\n"); \ > > + printf ("#include \"coretypes.h\"\n"); \ > > + printf ("#include \"backend.h\"\n"); \ > > + printf ("#include \"predict.h\"\n"); \ > > + printf ("#include \"tree.h\"\n"); \ > > + printf ("#include \"rtl.h\"\n"); \ > > + printf ("#include \"alias.h\"\n"); \ > > + printf ("#include \"varasm.h\"\n"); \ > > + printf ("#include \"stor-layout.h\"\n"); \ > > + printf ("#include \"calls.h\"\n"); \ > > + printf ("#include \"memmodel.h\"\n"); \ > > + printf ("#include \"tm_p.h\"\n"); \ > > + printf ("#include \"flags.h\"\n"); \ > > + printf ("#include \"insn-config.h\"\n"); \ > > + printf ("#include \"expmed.h\"\n"); \ > > + printf ("#include \"dojump.h\"\n"); \ > > + printf ("#include \"explow.h\"\n"); \ > > + printf ("#include \"emit-rtl.h\"\n"); \ > > + printf ("#include \"stmt.h\"\n"); \ > > + printf ("#include \"expr.h\"\n"); \ > > + printf ("#include \"insn-codes.h\"\n"); \ > > + printf ("#include \"optabs.h\"\n"); \ > > + printf ("#include \"dfp.h\"\n"); \ > > + printf ("#include \"output.h\"\n"); \ > > + printf ("#include \"recog.h\"\n"); \ > >
[PATCH] genemit.c (main): split insn-emit.c for compiling parallelly
Hi, The size of generated file like insn-emit.c is very huge if we add lots of define_expand patten or define_insn patten. It’s present easily when there are much more intrinsic interfaces it costs much more time to create toolchain with compiling these files :( gcc/ChangeLog: * genemit.c (main): Print 'split line'. * Makefile.in (insn-emit.c): Define split count and file --- gcc/Makefile.in | 10 ++ gcc/genemit.c | 86 +++-- 2 files changed, 58 insertions(+), 38 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 2ba76656dbf..3306510a9a8 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1253,6 +1253,13 @@ ANALYZER_OBJS = \ # We put the *-match.o and insn-*.o files first so that a parallel make # will build them sooner, because they are large and otherwise tend to be # the last objects to finish building. + +insn-generated-split-num = 15 + +insn-emit-split-c = $(foreach o, $(shell seq 1 $(insn-generated-split-num)), insn-emit$(o).c) +insn-emit-split-obj = $(patsubst %.c,%.o, $(insn-emit-split-c)) +$(insn-emit-split-c): insn-emit.c + OBJS = \ gimple-match.o \ generic-match.o \ @@ -1260,6 +1267,7 @@ OBJS = \ insn-automata.o \ insn-dfatab.o \ insn-emit.o \ + $(insn-emit-split-obj) \ insn-extract.o \ insn-latencytab.o \ insn-modes.o \ @@ -2367,6 +2375,8 @@ $(simple_generated_c:insn-%.c=s-%): s-%: build/gen%$(build_exeext) $(RUN_GEN) build/gen$*$(build_exeext) $(md_file) \ $(filter insn-conditions.md,$^) > tmp-$*.c $(SHELL) $(srcdir)/../move-if-change tmp-$*.c insn-$*.c + -csplit insn-$*.c /i\ am\ split\ line/ -k -s {$(insn-generated-split-num)} -f insn-$* -b "%d.c" + -( [ ! -s insn-$*0.c ] && for i in `seq 1 $(insn-generated-split-num)`; do touch insn-$*$$i.c; done && echo "" > insn-$*.c) $(STAMP) s-$* # gencheck doesn't read the machine description, and the file produced diff --git a/gcc/genemit.c b/gcc/genemit.c index 84d07d388ee..fd60cdeeb96 100644 --- a/gcc/genemit.c +++ b/gcc/genemit.c @@ -847,6 +847,45 @@ handle_overloaded_gen (overloaded_name *oname) } } +#define printf_include() \ + printf ("/* Generated automatically by the program `genemit'\n\ +from the machine description file `md'. */\n\n"); \ + printf ("#define IN_TARGET_CODE 1\n"); \ + printf ("#include \"config.h\"\n"); \ + printf ("#include \"system.h\"\n"); \ + printf ("#include \"coretypes.h\"\n"); \ + printf ("#include \"backend.h\"\n"); \ + printf ("#include \"predict.h\"\n"); \ + printf ("#include \"tree.h\"\n"); \ + printf ("#include \"rtl.h\"\n"); \ + printf ("#include \"alias.h\"\n"); \ + printf ("#include \"varasm.h\"\n"); \ + printf ("#include \"stor-layout.h\"\n"); \ + printf ("#include \"calls.h\"\n"); \ + printf ("#include \"memmodel.h\"\n"); \ + printf ("#include \"tm_p.h\"\n"); \ + printf ("#include \"flags.h\"\n"); \ + printf ("#include \"insn-config.h\"\n"); \ + printf ("#include \"expmed.h\"\n"); \ + printf ("#include \"dojump.h\"\n"); \ + printf ("#include \"explow.h\"\n"); \ + printf ("#include \"emit-rtl.h\"\n"); \ + printf ("#include \"stmt.h\"\n"); \ + printf ("#include \"expr.h\"\n"); \ + printf ("#include \"insn-codes.h\"\n"); \ + printf ("#include \"optabs.h\"\n"); \ + printf ("#include \"dfp.h\"\n"); \ + printf ("#include \"output.h\"\n"); \ + printf ("#include \"recog.h\"\n"); \ + printf ("#include \"df.h\"\n"); \ + printf ("#include \"resource.h\"\n"); \ + printf ("#include \"reload.h\"\n"); \ + printf ("#include \"diagnostic-core.h\"\n"); \ + printf ("#include \"regs.h\"\n"); \ + printf ("#include \"tm-constrs.h\"\n"); \ + printf ("#include \"ggc.h\"\n"); \ + printf ("#include \"target.h\"\n\n"); \ + int main (int argc, const char **argv) { @@ -862,49 +901,19 @@ main (int argc, const char **argv) /* Assign sequential codes to all entries in the machine description in parallel with the tables in insn-output.c. */ - printf ("/* Generated automatically by the program `genemit'\n\ -from the machine description file `md'. */\n\n"); - - printf ("#define IN_TARGET_CODE 1\n"); - printf ("#include \"config.h\"\n"); - printf ("#include \"system.h\"\n"); - printf ("#include \"coretypes.h\"\n"); - printf ("#include \"backend.h\"\n"); - printf ("#include \"predict.h\"\n"); - printf ("#include \"tree.h\"\n"); - printf ("#include \"rtl.h\"\n"); - printf ("#include \"alias.h\"\n"); - printf ("#include \"varasm.h\"\n"); - printf ("#include \"stor-layout.h\"\n"); - printf ("#include \"calls.h\"\n"); - printf ("#include \"memmodel.h\"\n"); - printf ("#include \"tm_p.h\"\n"); - printf ("#include \"flags.h\"\n"); - printf ("#include \"insn-config.h\"\n"); - printf ("#include \"expmed.h\"\n"); - printf ("#include \"dojump.h\"\n"); - printf ("#include \"explow.h\"\n"); - printf ("#include \"emit-rtl.h\"\n"); - printf ("#include \"stmt.h\"\n"); - printf ("#include \"expr.h\"\n"); - printf ("#include \"insn-codes.h\"\n"); - printf ("#include \"optabs.h\"\n"); - printf