Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.

Commit a6c96b8

Browse files
author
Yanzhang Wang
committed
fix: disable intrinsic warning.
1 parent 33484c5 commit a6c96b8

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

gcc/config/riscv/riscv.cc

+39-3
Original file line numberDiff line numberDiff line change
@@ -3798,6 +3798,28 @@ riscv_pass_in_vector_p (const_tree type)
37983798
}
37993799
}
38003800

3801+
/* Initialize a variable CUM of type CUMULATIVE_ARGS
3802+
for a call to a function whose data type is FNTYPE.
3803+
For a library call, FNTYPE is 0. */
3804+
3805+
void
3806+
init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
3807+
tree fntype, /* tree ptr for function decl */
3808+
rtx libname, /* SYMBOL_REF of library name or 0 */
3809+
tree fndecl,
3810+
int caller)
3811+
{
3812+
memset (cum, 0, sizeof (*cum));
3813+
3814+
if (fndecl)
3815+
{
3816+
const tree_function_decl &fn = FUNCTION_DECL_CHECK (fndecl)->function_decl;
3817+
3818+
if (fn.built_in_class == NOT_BUILT_IN)
3819+
cum->rvv_psabi_warning = 1;
3820+
}
3821+
}
3822+
38013823
/* Fill INFO with information about a single argument, and return an
38023824
RTL pattern to pass or return the argument. CUM is the cumulative
38033825
state for earlier arguments. MODE is the mode of this argument and
@@ -3882,8 +3904,11 @@ riscv_get_arg_info (struct riscv_arg_info *info, const CUMULATIVE_ARGS *cum,
38823904
}
38833905
}
38843906

3885-
/* Only check existing of vector type. */
3886-
riscv_pass_in_vector_p (type);
3907+
if (cum->rvv_psabi_warning)
3908+
{
3909+
/* Only check existing of vector type. */
3910+
riscv_pass_in_vector_p (type);
3911+
}
38873912

38883913
/* Work out the size of the argument. */
38893914
num_bytes = type ? int_size_in_bytes (type) : GET_MODE_SIZE (mode).to_constant ();
@@ -3972,7 +3997,18 @@ riscv_function_value (const_tree type, const_tree func, machine_mode mode)
39723997
}
39733998

39743999
memset (&args, 0, sizeof args);
3975-
return riscv_get_arg_info (&info, &args, mode, type, true, true);
4000+
4001+
const_tree arg_type = type;
4002+
if (func && DECL_RESULT (func))
4003+
{
4004+
const tree_function_decl &fn = FUNCTION_DECL_CHECK(func)->function_decl;
4005+
if (fn.built_in_class == NOT_BUILT_IN)
4006+
args.rvv_psabi_warning = 1;
4007+
4008+
arg_type = TREE_TYPE (DECL_RESULT (func));
4009+
}
4010+
4011+
return riscv_get_arg_info (&info, &args, mode, arg_type, true, true);
39764012
}
39774013

39784014
/* Implement TARGET_PASS_BY_REFERENCE. */

gcc/config/riscv/riscv.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -671,14 +671,18 @@ typedef struct {
671671

672672
/* Number of floating-point registers used so far, likewise. */
673673
unsigned int num_fprs;
674+
675+
bool rvv_psabi_warning;
674676
} CUMULATIVE_ARGS;
675677

676678
/* Initialize a variable CUM of type CUMULATIVE_ARGS
677679
for a call to a function whose data type is FNTYPE.
678680
For a library call, FNTYPE is 0. */
679681

682+
void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx, tree, int);
680683
#define INIT_CUMULATIVE_ARGS(CUM, FNTYPE, LIBNAME, INDIRECT, N_NAMED_ARGS) \
681-
memset (&(CUM), 0, sizeof (CUM))
684+
init_cumulative_args (&(CUM), (FNTYPE), (LIBNAME), (INDIRECT), \
685+
(N_NAMED_ARGS) != -1)
682686

683687
#define EPILOGUE_USES(REGNO) riscv_epilogue_uses (REGNO)
684688

0 commit comments

Comments
 (0)