RISC-V: Refine riscv-vector-builtins.o include files and makefile.

Message ID 20221011063156.115984-1-juzhe.zhong@rivai.ai
State Accepted, archived
Headers
Series RISC-V: Refine riscv-vector-builtins.o include files and makefile. |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

juzhe.zhong@rivai.ai Oct. 11, 2022, 6:31 a.m. UTC
  From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

gcc/ChangeLog:

        * config/riscv/riscv-vector-builtins.cc: Change include files same as ARM SVE.
        * config/riscv/t-riscv: Refine makefile.

---
 gcc/config/riscv/riscv-vector-builtins.cc |  9 +++++++--
 gcc/config/riscv/t-riscv                  | 14 ++++++++------
 2 files changed, 15 insertions(+), 8 deletions(-)
  

Comments

Kito Cheng Oct. 12, 2022, 3:39 a.m. UTC | #1
I would suggest we do not include those header files unless we really need that.

On Tue, Oct 11, 2022 at 2:32 PM <juzhe.zhong@rivai.ai> wrote:
>
> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vector-builtins.cc: Change include files same as ARM SVE.
>         * config/riscv/t-riscv: Refine makefile.
>
> ---
>  gcc/config/riscv/riscv-vector-builtins.cc |  9 +++++++--
>  gcc/config/riscv/t-riscv                  | 14 ++++++++------
>  2 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc
> index 4814b6ef6e7..61f5f9802cf 100644
> --- a/gcc/config/riscv/riscv-vector-builtins.cc
> +++ b/gcc/config/riscv/riscv-vector-builtins.cc
> @@ -33,17 +33,22 @@
>  #include "recog.h"
>  #include "diagnostic.h"
>  #include "expr.h"
> +#include "basic-block.h"
>  #include "function.h"
>  #include "fold-const.h"
> +#include "gimple.h"
> +#include "gimple-iterator.h"
>  #include "gimplify.h"
>  #include "explow.h"
> +#include "emit-rtl.h"
> +#include "tree-vector-builder.h"
>  #include "stor-layout.h"
> +#include "regs.h"
>  #include "alias.h"
> +#include "gimple-fold.h"
>  #include "langhooks.h"
>  #include "stringpool.h"
>  #include "attribs.h"
> -#include "targhooks.h"
> -#include "regs.h"
>  #include "riscv-vector-builtins.h"
>
>  using namespace riscv_vector;
> diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
> index 2f060437c23..82010721348 100644
> --- a/gcc/config/riscv/t-riscv
> +++ b/gcc/config/riscv/t-riscv
> @@ -6,12 +6,14 @@ riscv-builtins.o: $(srcdir)/config/riscv/riscv-builtins.cc $(CONFIG_H) \
>                 $(srcdir)/config/riscv/riscv-builtins.cc
>
>  riscv-vector-builtins.o: $(srcdir)/config/riscv/riscv-vector-builtins.cc \
> -  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \
> -  memmodel.h insn-codes.h $(OPTABS_H) $(RECOG_H) $(DIAGNOSTIC_H) $(EXPR_H) \
> -  $(FUNCTION_H) fold-const.h gimplify.h explow.h stor-layout.h $(REGS_H) \
> -  alias.h langhooks.h attribs.h stringpool.h \
> -  $(srcdir)/config/riscv/riscv-vector-builtins.h \
> -       $(srcdir)/config/riscv/riscv-vector-builtins.def
> +  $(srcdir)/config/riscv/riscv-vector-builtins.def \
> +  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
> +  $(TM_P_H) memmodel.h insn-codes.h $(OPTABS_H) $(RECOG_H) $(DIAGNOSTIC_H) \
> +  $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) fold-const.h $(GIMPLE_H) \
> +  gimple-iterator.h gimplify.h explow.h $(EMIT_RTL_H) tree-vector-builder.h \
> +  stor-layout.h $(REG_H) alias.h gimple-fold.h langhooks.h \
> +  stringpool.h \
> +  $(srcdir)/config/riscv/riscv-vector-builtins.h
>         $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
>                 $(srcdir)/config/riscv/riscv-vector-builtins.cc
>
> --
> 2.36.1
>
  
juzhe.zhong@rivai.ai Oct. 12, 2022, 3:48 a.m. UTC | #2
OK. I am gonna commit this with the following patches.


juzhe.zhong@rivai.ai
 
From: Kito Cheng
Date: 2022-10-12 11:39
To: juzhe.zhong
CC: gcc-patches
Subject: Re: [PATCH] RISC-V: Refine riscv-vector-builtins.o include files and makefile.
I would suggest we do not include those header files unless we really need that.
 
On Tue, Oct 11, 2022 at 2:32 PM <juzhe.zhong@rivai.ai> wrote:
>
> From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
>
> gcc/ChangeLog:
>
>         * config/riscv/riscv-vector-builtins.cc: Change include files same as ARM SVE.
>         * config/riscv/t-riscv: Refine makefile.
>
> ---
>  gcc/config/riscv/riscv-vector-builtins.cc |  9 +++++++--
>  gcc/config/riscv/t-riscv                  | 14 ++++++++------
>  2 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc
> index 4814b6ef6e7..61f5f9802cf 100644
> --- a/gcc/config/riscv/riscv-vector-builtins.cc
> +++ b/gcc/config/riscv/riscv-vector-builtins.cc
> @@ -33,17 +33,22 @@
>  #include "recog.h"
>  #include "diagnostic.h"
>  #include "expr.h"
> +#include "basic-block.h"
>  #include "function.h"
>  #include "fold-const.h"
> +#include "gimple.h"
> +#include "gimple-iterator.h"
>  #include "gimplify.h"
>  #include "explow.h"
> +#include "emit-rtl.h"
> +#include "tree-vector-builder.h"
>  #include "stor-layout.h"
> +#include "regs.h"
>  #include "alias.h"
> +#include "gimple-fold.h"
>  #include "langhooks.h"
>  #include "stringpool.h"
>  #include "attribs.h"
> -#include "targhooks.h"
> -#include "regs.h"
>  #include "riscv-vector-builtins.h"
>
>  using namespace riscv_vector;
> diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
> index 2f060437c23..82010721348 100644
> --- a/gcc/config/riscv/t-riscv
> +++ b/gcc/config/riscv/t-riscv
> @@ -6,12 +6,14 @@ riscv-builtins.o: $(srcdir)/config/riscv/riscv-builtins.cc $(CONFIG_H) \
>                 $(srcdir)/config/riscv/riscv-builtins.cc
>
>  riscv-vector-builtins.o: $(srcdir)/config/riscv/riscv-vector-builtins.cc \
> -  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \
> -  memmodel.h insn-codes.h $(OPTABS_H) $(RECOG_H) $(DIAGNOSTIC_H) $(EXPR_H) \
> -  $(FUNCTION_H) fold-const.h gimplify.h explow.h stor-layout.h $(REGS_H) \
> -  alias.h langhooks.h attribs.h stringpool.h \
> -  $(srcdir)/config/riscv/riscv-vector-builtins.h \
> -       $(srcdir)/config/riscv/riscv-vector-builtins.def
> +  $(srcdir)/config/riscv/riscv-vector-builtins.def \
> +  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
> +  $(TM_P_H) memmodel.h insn-codes.h $(OPTABS_H) $(RECOG_H) $(DIAGNOSTIC_H) \
> +  $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) fold-const.h $(GIMPLE_H) \
> +  gimple-iterator.h gimplify.h explow.h $(EMIT_RTL_H) tree-vector-builder.h \
> +  stor-layout.h $(REG_H) alias.h gimple-fold.h langhooks.h \
> +  stringpool.h \
> +  $(srcdir)/config/riscv/riscv-vector-builtins.h
>         $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
>                 $(srcdir)/config/riscv/riscv-vector-builtins.cc
>
> --
> 2.36.1
>
  
Jeff Law Oct. 12, 2022, 3:56 a.m. UTC | #3
On 10/11/22 21:39, Kito Cheng via Gcc-patches wrote:
> I would suggest we do not include those header files unless we really need that.

Agreed.  Policy is to include what's needed.  There's actually some 
scripts that will identify extraneous header includes, but I don't 
recall if we ever ran them on the target files -- the focus was much 
more on starting to cut the ties between RTL and gimple/tree bits in the 
generic parts of GCC.


jeff
  

Patch

diff --git a/gcc/config/riscv/riscv-vector-builtins.cc b/gcc/config/riscv/riscv-vector-builtins.cc
index 4814b6ef6e7..61f5f9802cf 100644
--- a/gcc/config/riscv/riscv-vector-builtins.cc
+++ b/gcc/config/riscv/riscv-vector-builtins.cc
@@ -33,17 +33,22 @@ 
 #include "recog.h"
 #include "diagnostic.h"
 #include "expr.h"
+#include "basic-block.h"
 #include "function.h"
 #include "fold-const.h"
+#include "gimple.h"
+#include "gimple-iterator.h"
 #include "gimplify.h"
 #include "explow.h"
+#include "emit-rtl.h"
+#include "tree-vector-builder.h"
 #include "stor-layout.h"
+#include "regs.h"
 #include "alias.h"
+#include "gimple-fold.h"
 #include "langhooks.h"
 #include "stringpool.h"
 #include "attribs.h"
-#include "targhooks.h"
-#include "regs.h"
 #include "riscv-vector-builtins.h"
 
 using namespace riscv_vector;
diff --git a/gcc/config/riscv/t-riscv b/gcc/config/riscv/t-riscv
index 2f060437c23..82010721348 100644
--- a/gcc/config/riscv/t-riscv
+++ b/gcc/config/riscv/t-riscv
@@ -6,12 +6,14 @@  riscv-builtins.o: $(srcdir)/config/riscv/riscv-builtins.cc $(CONFIG_H) \
 		$(srcdir)/config/riscv/riscv-builtins.cc
 
 riscv-vector-builtins.o: $(srcdir)/config/riscv/riscv-vector-builtins.cc \
-  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \
-  memmodel.h insn-codes.h $(OPTABS_H) $(RECOG_H) $(DIAGNOSTIC_H) $(EXPR_H) \
-  $(FUNCTION_H) fold-const.h gimplify.h explow.h stor-layout.h $(REGS_H) \
-  alias.h langhooks.h attribs.h stringpool.h \
-  $(srcdir)/config/riscv/riscv-vector-builtins.h \
-	$(srcdir)/config/riscv/riscv-vector-builtins.def
+  $(srcdir)/config/riscv/riscv-vector-builtins.def \
+  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
+  $(TM_P_H) memmodel.h insn-codes.h $(OPTABS_H) $(RECOG_H) $(DIAGNOSTIC_H) \
+  $(EXPR_H) $(BASIC_BLOCK_H) $(FUNCTION_H) fold-const.h $(GIMPLE_H) \
+  gimple-iterator.h gimplify.h explow.h $(EMIT_RTL_H) tree-vector-builder.h \
+  stor-layout.h $(REG_H) alias.h gimple-fold.h langhooks.h \
+  stringpool.h \
+  $(srcdir)/config/riscv/riscv-vector-builtins.h
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
 		$(srcdir)/config/riscv/riscv-vector-builtins.cc