[v4] RISC-V: Refactor riscv-vector-builtins-bases.cc
Checks
Commit Message
This patch moves the definition of the enums lst_type and
frm_op_type into riscv-vector-builtins-bases.h and removes
the static visibility of fold_fault_load(), so these
can be used in other compile units.
gcc/ChangeLog:
* config/riscv/riscv-vector-builtins-bases.cc (enum lst_type):
(enum frm_op_type): move to riscv-vector-builtins-bases.h
* config/riscv/riscv-vector-builtins-bases.h
(GCC_RISCV_VECTOR_BUILTINS_BASES_H): Add header files.
(enum lst_type): move from
(enum frm_op_type): riscv-vector-builtins-bases.cc
(fold_fault_load): riscv-vector-builtins-bases.cc
Co-authored-by: Jin Ma <jinma@linux.alibaba.com>
Co-authored-by: Xianmiao Qu <cooper.qu@linux.alibaba.com>
Co-authored-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
.../riscv/riscv-vector-builtins-bases.cc | 18 +-----------------
.../riscv/riscv-vector-builtins-bases.h | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 17 deletions(-)
@@ -48,24 +48,8 @@ using namespace riscv_vector;
namespace riscv_vector {
-/* Enumerates types of loads/stores operations.
- It's only used in here so we don't define it
- in riscv-vector-builtins-bases.h. */
-enum lst_type
-{
- LST_UNIT_STRIDE,
- LST_STRIDED,
- LST_INDEXED,
-};
-
-enum frm_op_type
-{
- NO_FRM,
- HAS_FRM,
-};
-
/* Helper function to fold vleff and vlsegff. */
-static gimple *
+gimple *
fold_fault_load (gimple_folder &f)
{
/* fold fault_load (const *base, size_t *new_vl, size_t vl)
@@ -21,8 +21,27 @@
#ifndef GCC_RISCV_VECTOR_BUILTINS_BASES_H
#define GCC_RISCV_VECTOR_BUILTINS_BASES_H
+#include "gimple.h"
+#include "riscv-vector-builtins.h"
+
namespace riscv_vector {
+/* Enumerates types of loads/stores operations. */
+enum lst_type
+{
+ LST_UNIT_STRIDE,
+ LST_STRIDED,
+ LST_INDEXED,
+};
+
+enum frm_op_type
+{
+ NO_FRM,
+ HAS_FRM,
+};
+
+extern gimple *fold_fault_load (gimple_folder &f);
+
namespace bases {
extern const function_base *const vsetvl;
extern const function_base *const vsetvlmax;