Commit 9b80b7bc by Andreas Krebbel Committed by Andreas Krebbel

S/390: Define TARGET_BUILTIN_DECL

gcc/ChangeLog:
	* config/s390/s390.c: (enum s390_builtin, s390_expand_builtin):
	Rename S390_BUILTIN_max to S390_BUILTIN_MAX.
	(s390_builtin_decls): New array.
	(s390_init_builtins): Put builtin decls into s390_builtin_decls.
	(s390_builtin_decl): New function.
	(TARGET_BUILTIN_DECL): Define macro.

From-SVN: r221046
parent 4ceae7e9
2015-02-27 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.c: (enum s390_builtin, s390_expand_builtin):
Rename S390_BUILTIN_max to S390_BUILTIN_MAX.
(s390_builtin_decls): New array.
(s390_init_builtins): Put builtin decls into s390_builtin_decls.
(s390_builtin_decl): New function.
(TARGET_BUILTIN_DECL): Define macro.
2015-02-27 Richard Biener <rguenther@suse.de> 2015-02-27 Richard Biener <rguenther@suse.de>
PR middle-end/63175 PR middle-end/63175
......
...@@ -9982,10 +9982,12 @@ enum s390_builtin ...@@ -9982,10 +9982,12 @@ enum s390_builtin
S390_BUILTIN_TX_NESTING_DEPTH, S390_BUILTIN_TX_NESTING_DEPTH,
S390_BUILTIN_TX_ASSIST, S390_BUILTIN_TX_ASSIST,
S390_BUILTIN_max S390_BUILTIN_MAX
}; };
static enum insn_code const code_for_builtin[S390_BUILTIN_max] = { tree s390_builtin_decls[S390_BUILTIN_MAX];
static enum insn_code const code_for_builtin[S390_BUILTIN_MAX] = {
CODE_FOR_tbegin, CODE_FOR_tbegin,
CODE_FOR_tbegin_nofloat, CODE_FOR_tbegin_nofloat,
CODE_FOR_tbegin_retry, CODE_FOR_tbegin_retry,
...@@ -10008,44 +10010,57 @@ s390_init_builtins (void) ...@@ -10008,44 +10010,57 @@ s390_init_builtins (void)
/* void foo (void) */ /* void foo (void) */
ftype = build_function_type_list (void_type_node, NULL_TREE); ftype = build_function_type_list (void_type_node, NULL_TREE);
add_builtin_function ("__builtin_tbeginc", ftype, S390_BUILTIN_TBEGINC, s390_builtin_decls[S390_BUILTIN_TBEGINC] =
BUILT_IN_MD, NULL, NULL_TREE); add_builtin_function ("__builtin_tbeginc", ftype, S390_BUILTIN_TBEGINC,
BUILT_IN_MD, NULL, NULL_TREE);
/* void foo (int) */ /* void foo (int) */
ftype = build_function_type_list (void_type_node, integer_type_node, ftype = build_function_type_list (void_type_node, integer_type_node,
NULL_TREE); NULL_TREE);
add_builtin_function ("__builtin_tabort", ftype, s390_builtin_decls[S390_BUILTIN_TABORT] =
S390_BUILTIN_TABORT, BUILT_IN_MD, NULL, noreturn_attr); add_builtin_function ("__builtin_tabort", ftype,
add_builtin_function ("__builtin_tx_assist", ftype, S390_BUILTIN_TABORT, BUILT_IN_MD, NULL,
S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE); noreturn_attr);
s390_builtin_decls[S390_BUILTIN_TX_ASSIST] =
add_builtin_function ("__builtin_tx_assist", ftype,
S390_BUILTIN_TX_ASSIST, BUILT_IN_MD, NULL, NULL_TREE);
/* int foo (void *) */ /* int foo (void *) */
ftype = build_function_type_list (integer_type_node, ptr_type_node, NULL_TREE); ftype = build_function_type_list (integer_type_node, ptr_type_node,
add_builtin_function ("__builtin_tbegin", ftype, S390_BUILTIN_TBEGIN, NULL_TREE);
BUILT_IN_MD, NULL, returns_twice_attr); s390_builtin_decls[S390_BUILTIN_TBEGIN] =
add_builtin_function ("__builtin_tbegin_nofloat", ftype, add_builtin_function ("__builtin_tbegin", ftype, S390_BUILTIN_TBEGIN,
S390_BUILTIN_TBEGIN_NOFLOAT, BUILT_IN_MD, NULL, returns_twice_attr);
BUILT_IN_MD, NULL, returns_twice_attr); s390_builtin_decls[S390_BUILTIN_TBEGIN_NOFLOAT] =
add_builtin_function ("__builtin_tbegin_nofloat", ftype,
S390_BUILTIN_TBEGIN_NOFLOAT,
BUILT_IN_MD, NULL, returns_twice_attr);
/* int foo (void *, int) */ /* int foo (void *, int) */
ftype = build_function_type_list (integer_type_node, ptr_type_node, ftype = build_function_type_list (integer_type_node, ptr_type_node,
integer_type_node, NULL_TREE); integer_type_node, NULL_TREE);
add_builtin_function ("__builtin_tbegin_retry", ftype, s390_builtin_decls[S390_BUILTIN_TBEGIN_RETRY] =
S390_BUILTIN_TBEGIN_RETRY, add_builtin_function ("__builtin_tbegin_retry", ftype,
BUILT_IN_MD, S390_BUILTIN_TBEGIN_RETRY,
NULL, returns_twice_attr); BUILT_IN_MD,
add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype, NULL, returns_twice_attr);
S390_BUILTIN_TBEGIN_RETRY_NOFLOAT, s390_builtin_decls[S390_BUILTIN_TBEGIN_RETRY_NOFLOAT] =
BUILT_IN_MD, add_builtin_function ("__builtin_tbegin_retry_nofloat", ftype,
NULL, returns_twice_attr); S390_BUILTIN_TBEGIN_RETRY_NOFLOAT,
BUILT_IN_MD,
NULL, returns_twice_attr);
/* int foo (void) */ /* int foo (void) */
ftype = build_function_type_list (integer_type_node, NULL_TREE); ftype = build_function_type_list (integer_type_node, NULL_TREE);
add_builtin_function ("__builtin_tx_nesting_depth", ftype, s390_builtin_decls[S390_BUILTIN_TX_NESTING_DEPTH] =
S390_BUILTIN_TX_NESTING_DEPTH, add_builtin_function ("__builtin_tx_nesting_depth", ftype,
BUILT_IN_MD, NULL, NULL_TREE); S390_BUILTIN_TX_NESTING_DEPTH,
add_builtin_function ("__builtin_tend", ftype, BUILT_IN_MD, NULL, NULL_TREE);
S390_BUILTIN_TEND, BUILT_IN_MD, NULL, NULL_TREE); s390_builtin_decls[S390_BUILTIN_TEND] =
add_builtin_function ("__builtin_tend", ftype,
S390_BUILTIN_TEND, BUILT_IN_MD, NULL, NULL_TREE);
/* void foo (uint64_t *, uint64_t) */ /* void foo (uint64_t *, uint64_t) */
if (TARGET_64BIT) if (TARGET_64BIT)
...@@ -10053,12 +10068,13 @@ s390_init_builtins (void) ...@@ -10053,12 +10068,13 @@ s390_init_builtins (void)
else else
uint64_type = long_long_unsigned_type_node; uint64_type = long_long_unsigned_type_node;
ftype = build_function_type_list (void_type_node, ftype = build_function_type_list (void_type_node,
build_pointer_type (uint64_type), build_pointer_type (uint64_type),
uint64_type, NULL_TREE); uint64_type, NULL_TREE);
add_builtin_function ("__builtin_non_tx_store", ftype, s390_builtin_decls[S390_BUILTIN_NON_TX_STORE] =
S390_BUILTIN_NON_TX_STORE, add_builtin_function ("__builtin_non_tx_store", ftype,
BUILT_IN_MD, NULL, NULL_TREE); S390_BUILTIN_NON_TX_STORE,
BUILT_IN_MD, NULL, NULL_TREE);
} }
/* Expand an expression EXP that calls a built-in function, /* Expand an expression EXP that calls a built-in function,
...@@ -10083,7 +10099,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, ...@@ -10083,7 +10099,7 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
tree arg; tree arg;
call_expr_arg_iterator iter; call_expr_arg_iterator iter;
if (fcode >= S390_BUILTIN_max) if (fcode >= S390_BUILTIN_MAX)
internal_error ("bad builtin fcode"); internal_error ("bad builtin fcode");
icode = code_for_builtin[fcode]; icode = code_for_builtin[fcode];
if (icode == 0) if (icode == 0)
...@@ -10170,6 +10186,18 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED, ...@@ -10170,6 +10186,18 @@ s390_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
return const0_rtx; return const0_rtx;
} }
/* Return the decl for the target specific builtin with the function
code FCODE. */
static tree
s390_builtin_decl (unsigned fcode, bool initialized_p ATTRIBUTE_UNUSED)
{
if (fcode >= S390_BUILTIN_MAX)
return error_mark_node;
return s390_builtin_decls[fcode];
}
/* We call mcount before the function prologue. So a profiled leaf /* We call mcount before the function prologue. So a profiled leaf
function should stay a leaf function. */ function should stay a leaf function. */
...@@ -12138,6 +12166,8 @@ s390_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size, ...@@ -12138,6 +12166,8 @@ s390_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size,
#define TARGET_INIT_BUILTINS s390_init_builtins #define TARGET_INIT_BUILTINS s390_init_builtins
#undef TARGET_EXPAND_BUILTIN #undef TARGET_EXPAND_BUILTIN
#define TARGET_EXPAND_BUILTIN s390_expand_builtin #define TARGET_EXPAND_BUILTIN s390_expand_builtin
#undef TARGET_BUILTIN_DECL
#define TARGET_BUILTIN_DECL s390_builtin_decl
#undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA #undef TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA
#define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA s390_output_addr_const_extra #define TARGET_ASM_OUTPUT_ADDR_CONST_EXTRA s390_output_addr_const_extra
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment