Skip to content

Commit 139b435

Browse files
committed
Switch from clear_builtin_types to TARGET_CLEANUP_BUILTINS
1 parent 42f20cf commit 139b435

File tree

7 files changed

+33
-4
lines changed

7 files changed

+33
-4
lines changed

gcc/config/i386/i386-builtins.cc

+2-4
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX + 1];
227227

228228
struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX];
229229

230-
static void
231-
clear_builtin_types (void)
230+
void
231+
ix86_cleanup_builtins (void)
232232
{
233233
for (int i = 0 ; i < IX86_BT_LAST_CPTR + 1 ; i++)
234234
ix86_builtin_type_tab[i] = NULL;
@@ -1490,8 +1490,6 @@ ix86_init_builtins (void)
14901490
{
14911491
tree ftype, decl;
14921492

1493-
clear_builtin_types ();
1494-
14951493
ix86_init_builtin_types ();
14961494

14971495
/* Builtins to get CPU type and features. */

gcc/config/i386/i386-builtins.h

+1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ extern builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX];
318318
tree ix86_builtin_vectorized_function (unsigned int fn, tree type_out,
319319
tree type_in);
320320
void ix86_init_builtins (void);
321+
void ix86_cleanup_builtins (void);
321322
tree ix86_vectorize_builtin_gather (const_tree mem_vectype,
322323
const_tree index_type, int scale);
323324
tree ix86_builtin_decl (unsigned code, bool);

gcc/config/i386/i386.cc

+2
Original file line numberDiff line numberDiff line change
@@ -26538,6 +26538,8 @@ static const scoped_attribute_specs *const ix86_attribute_table[] =
2653826538

2653926539
#undef TARGET_INIT_BUILTINS
2654026540
#define TARGET_INIT_BUILTINS ix86_init_builtins
26541+
#undef TARGET_CLEANUP_BUILTINS
26542+
#define TARGET_CLEANUP_BUILTINS ix86_cleanup_builtins
2654126543
#undef TARGET_BUILTIN_DECL
2654226544
#define TARGET_BUILTIN_DECL ix86_builtin_decl
2654326545
#undef TARGET_EXPAND_BUILTIN

gcc/doc/tm.texi

+7
Original file line numberDiff line numberDiff line change
@@ -12112,6 +12112,13 @@ only language front ends that use those two functions will call
1211212112
@samp{TARGET_INIT_BUILTINS}.
1211312113
@end deftypefn
1211412114

12115+
@deftypefn {Target Hook} void TARGET_CLEANUP_BUILTINS (void)
12116+
Define this hook if you have any machine-specific built-in functions
12117+
that need to be cleaned up. It should be a function that performs the
12118+
necessary cleanup so that a second compilation in the same process via
12119+
the jit frontend will not fail.
12120+
@end deftypefn
12121+
1211512122
@deftypefn {Target Hook} tree TARGET_BUILTIN_DECL (unsigned @var{code}, bool @var{initialize_p})
1211612123
Define this hook if you have any machine-specific built-in functions
1211712124
that need to be defined. It should be a function that returns the

gcc/doc/tm.texi.in

+2
Original file line numberDiff line numberDiff line change
@@ -7868,6 +7868,8 @@ to by @var{ce_info}.
78687868

78697869
@hook TARGET_INIT_BUILTINS
78707870

7871+
@hook TARGET_CLEANUP_BUILTINS
7872+
78717873
@hook TARGET_BUILTIN_DECL
78727874

78737875
@hook TARGET_EXPAND_BUILTIN

gcc/jit/dummy-frontend.cc

+9
Original file line numberDiff line numberDiff line change
@@ -1088,6 +1088,12 @@ jit_langhook_init (void)
10881088
return true;
10891089
}
10901090

1091+
void
1092+
jit_langhook_finish (void)
1093+
{
1094+
targetm.cleanup_builtins ();
1095+
}
1096+
10911097
static void
10921098
jit_langhook_parse_file (void)
10931099
{
@@ -1455,6 +1461,9 @@ jit_langhook_eh_personality (void)
14551461
#undef LANG_HOOKS_INIT
14561462
#define LANG_HOOKS_INIT jit_langhook_init
14571463

1464+
#undef LANG_HOOKS_FINISH
1465+
#define LANG_HOOKS_FINISH jit_langhook_finish
1466+
14581467
#undef LANG_HOOKS_PARSE_FILE
14591468
#define LANG_HOOKS_PARSE_FILE jit_langhook_parse_file
14601469

gcc/target.def

+10
Original file line numberDiff line numberDiff line change
@@ -2450,6 +2450,16 @@ only language front ends that use those two functions will call\n\
24502450
void, (void),
24512451
hook_void_void)
24522452

2453+
/* Clean up target-specific built-in functions. */
2454+
DEFHOOK
2455+
(cleanup_builtins,
2456+
"Define this hook if you have any machine-specific built-in functions\n\
2457+
that need to be cleaned up. It should be a function that performs the\n\
2458+
necessary cleanup so that a second compilation in the same process via\n\
2459+
the jit frontend will not fail.",
2460+
void, (void),
2461+
hook_void_void)
2462+
24532463
/* Initialize (if INITIALIZE_P is true) and return the target-specific
24542464
built-in function decl for CODE.
24552465
Return NULL if that is not possible. Return error_mark_node if CODE

0 commit comments

Comments
 (0)