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

Commit

Permalink
fix: disable intrinsic warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanzhang Wang committed May 22, 2023
1 parent 33484c5 commit a6c96b8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
42 changes: 39 additions & 3 deletions gcc/config/riscv/riscv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3798,6 +3798,28 @@ riscv_pass_in_vector_p (const_tree type)
}
}

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

void
init_cumulative_args (CUMULATIVE_ARGS *cum, /* Argument info to initialize */
tree fntype, /* tree ptr for function decl */
rtx libname, /* SYMBOL_REF of library name or 0 */
tree fndecl,
int caller)
{
memset (cum, 0, sizeof (*cum));

if (fndecl)
{
const tree_function_decl &fn = FUNCTION_DECL_CHECK (fndecl)->function_decl;

if (fn.built_in_class == NOT_BUILT_IN)
cum->rvv_psabi_warning = 1;
}
}

/* Fill INFO with information about a single argument, and return an
RTL pattern to pass or return the argument. CUM is the cumulative
state for earlier arguments. MODE is the mode of this argument and
Expand Down Expand Up @@ -3882,8 +3904,11 @@ riscv_get_arg_info (struct riscv_arg_info *info, const CUMULATIVE_ARGS *cum,
}
}

/* Only check existing of vector type. */
riscv_pass_in_vector_p (type);
if (cum->rvv_psabi_warning)
{
/* Only check existing of vector type. */
riscv_pass_in_vector_p (type);
}

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

memset (&args, 0, sizeof args);
return riscv_get_arg_info (&info, &args, mode, type, true, true);

const_tree arg_type = type;
if (func && DECL_RESULT (func))
{
const tree_function_decl &fn = FUNCTION_DECL_CHECK(func)->function_decl;
if (fn.built_in_class == NOT_BUILT_IN)
args.rvv_psabi_warning = 1;

arg_type = TREE_TYPE (DECL_RESULT (func));
}

return riscv_get_arg_info (&info, &args, mode, arg_type, true, true);
}

/* Implement TARGET_PASS_BY_REFERENCE. */
Expand Down
6 changes: 5 additions & 1 deletion gcc/config/riscv/riscv.h
Original file line number Diff line number Diff line change
Expand Up @@ -671,14 +671,18 @@ typedef struct {

/* Number of floating-point registers used so far, likewise. */
unsigned int num_fprs;

bool rvv_psabi_warning;
} CUMULATIVE_ARGS;

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

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

#define EPILOGUE_USES(REGNO) riscv_epilogue_uses (REGNO)

Expand Down

0 comments on commit a6c96b8

Please sign in to comment.