rs6000: Mirror fix for PR102347 in new builtins support

Recently Kewen fixed a problem in the old builtins support where
rs6000_builtin_decl prematurely indicated that a target builtin is
unavailable.  This also needs to be done for the new builtins support, but in
this case we have to ensure the error message is still produced from the
overload support in rs6000-c.c.  Unfortunately, this is less straightforward
than it could be, because header file includes need to be adjusted to make this
happen.  Someday we'll consolidate all the builtin code in one file and this
won't have to be so ugly.

2021-12-01  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/102347
	* config/rs6000/rs6000-c.c (rs6000-builtins.h): Stop including.
	(rs6000-internal.h): Include.
	(altivec_resolve_new_overloaded_builtin): Move call to
	rs6000_invalid_new_builtin here from rs6000_new_builtin_decl.
	* config/rs6000/rs6000-call.c (rs6000-builtins.h): Stop including.
	(rs6000_invalid_new_builtin): Remove static qualifier.
	(rs6000_new_builtin_decl): Remove test for supported builtin.
	* config/rs6000/rs6000-internal.h (rs6000-builtins.h): Include.
	(rs6000_invalid_new_builtin): Declare.
	* config/rs6000/rs6000.c (rs6000-builtins.h): Don't include.
This commit is contained in:
Bill Schmidt 2021-12-01 09:20:15 -06:00
parent 54ebec35ab
commit d683a1b3e8
4 changed files with 11 additions and 13 deletions

View File

@ -35,7 +35,7 @@
#include "langhooks.h"
#include "c/c-tree.h"
#include "rs6000-builtins.h"
#include "rs6000-internal.h"
static tree altivec_resolve_new_overloaded_builtin (location_t, tree, void *);
@ -2987,11 +2987,14 @@ altivec_resolve_new_overloaded_builtin (location_t loc, tree fndecl,
const char *name = rs6000_overload_info[adj_fcode].ovld_name;
if (!supported)
{
/* Indicate that the instantiation of the overloaded builtin
name is not available with the target flags in effect. */
rs6000_gen_builtins fcode = (rs6000_gen_builtins) instance->bifid;
rs6000_invalid_new_builtin (fcode);
/* Provide clarity of the relationship between the overload
and the instantiation. */
const char *internal_name
= rs6000_builtin_info_x[instance->bifid].bifname;
/* An error message making reference to the name of the
non-overloaded function has already been issued. Add
clarification of the previous message. */
rich_location richloc (line_table, input_location);
inform (&richloc,
"overloaded builtin %qs is implemented by builtin %qs",

View File

@ -69,7 +69,6 @@
#include "opts.h"
#include "rs6000-internal.h"
#include "rs6000-builtins.h"
#if TARGET_MACHO
#include "gstab.h" /* for N_SLINE */
@ -11905,7 +11904,7 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
/* Raise an error message for a builtin function that is called without the
appropriate target options being set. */
static void
void
rs6000_invalid_new_builtin (enum rs6000_gen_builtins fncode)
{
size_t j = (size_t) fncode;
@ -16624,12 +16623,6 @@ rs6000_new_builtin_decl (unsigned code, bool /* initialize_p */)
if (fcode >= RS6000_OVLD_MAX)
return error_mark_node;
if (!rs6000_new_builtin_is_supported (fcode))
{
rs6000_invalid_new_builtin (fcode);
return error_mark_node;
}
return rs6000_builtin_decls_x[code];
}

View File

@ -22,6 +22,8 @@
#ifndef GCC_RS6000_INTERNAL_H
#define GCC_RS6000_INTERNAL_H
#include "rs6000-builtins.h"
/* Structure used to define the rs6000 stack */
typedef struct rs6000_stack {
int reload_completed; /* stack info won't change from here on */
@ -140,6 +142,7 @@ extern void rs6000_output_mi_thunk (FILE *file,
extern bool rs6000_output_addr_const_extra (FILE *file, rtx x);
extern bool rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi);
extern tree rs6000_build_builtin_va_list (void);
extern void rs6000_invalid_new_builtin (rs6000_gen_builtins fncode);
extern void rs6000_va_start (tree valist, rtx nextarg);
extern tree rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
gimple_seq *post_p);

View File

@ -78,7 +78,6 @@
#include "case-cfn-macros.h"
#include "ppc-auxv.h"
#include "rs6000-internal.h"
#include "rs6000-builtins.h"
#include "opts.h"
/* This file should be included last. */