gcc 8.2 fixups

This commit is contained in:
Wolfgang Thaller 2018-12-29 00:41:17 +01:00
parent 39af85e1fd
commit 78de0215f8
6 changed files with 28 additions and 187 deletions

View File

@ -18438,146 +18438,6 @@ c_parse_file (void)
the_parser = NULL; the_parser = NULL;
} }
<<<<<<< HEAD
/* This function parses Cilk Plus array notation. The starting index is
passed in INITIAL_INDEX and the array name is passes in ARRAY_VALUE. The
return value of this function is a tree_node called VALUE_TREE of type
ARRAY_NOTATION_REF. */
static tree
c_parser_array_notation (location_t loc, c_parser *parser, tree initial_index,
tree array_value)
{
c_token *token = NULL;
tree start_index = NULL_TREE, end_index = NULL_TREE, stride = NULL_TREE;
tree value_tree = NULL_TREE, type = NULL_TREE, array_type = NULL_TREE;
tree array_type_domain = NULL_TREE;
if (array_value == error_mark_node || initial_index == error_mark_node)
{
/* No need to continue. If either of these 2 were true, then an error
must be emitted already. Thus, no need to emit them twice. */
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
array_type = TREE_TYPE (array_value);
gcc_assert (array_type);
if (TREE_CODE (array_type) != ARRAY_TYPE
&& TREE_CODE (array_type) != POINTER_TYPE)
{
error_at (loc, "base of array section must be pointer or array type");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
type = TREE_TYPE (array_type);
token = c_parser_peek_token (parser);
if (token->type == CPP_EOF)
{
c_parser_error (parser, "expected %<:%> or numeral");
return value_tree;
}
else if (token->type == CPP_COLON)
{
if (!initial_index)
{
/* If we are here, then we have a case like this A[:]. */
c_parser_consume_token (parser);
if (TREE_CODE (array_type) == POINTER_TYPE)
{
error_at (loc, "start-index and length fields necessary for "
"using array notations in pointers");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
if (TREE_CODE (array_type) == FUNCTION_TYPE)
{
error_at (loc, "array notations cannot be used with function "
"type");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
array_type_domain = TYPE_DOMAIN (array_type);
if (!array_type_domain)
{
error_at (loc, "start-index and length fields necessary for "
"using array notations in dimensionless arrays");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
start_index = TYPE_MINVAL (array_type_domain);
start_index = fold_build1 (CONVERT_EXPR, ptrdiff_type_node,
start_index);
if (!TYPE_MAXVAL (array_type_domain)
|| !TREE_CONSTANT (TYPE_MAXVAL (array_type_domain)))
{
error_at (loc, "start-index and length fields necessary for "
"using array notations in variable-length arrays");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
end_index = TYPE_MAXVAL (array_type_domain);
end_index = fold_build2 (PLUS_EXPR, TREE_TYPE (end_index),
end_index, integer_one_node);
end_index = fold_build1 (CONVERT_EXPR, ptrdiff_type_node, end_index);
stride = build_int_cst (integer_type_node, 1);
stride = fold_build1 (CONVERT_EXPR, ptrdiff_type_node, stride);
}
else if (initial_index != error_mark_node)
{
/* If we are here, then there should be 2 possibilities:
1. Array [EXPR : EXPR]
2. Array [EXPR : EXPR : EXPR]
*/
start_index = initial_index;
if (TREE_CODE (array_type) == FUNCTION_TYPE)
{
error_at (loc, "array notations cannot be used with function "
"type");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, NULL);
return error_mark_node;
}
c_parser_consume_token (parser); /* consume the ':' */
struct c_expr ce = c_parser_expression (parser);
ce = convert_lvalue_to_rvalue (loc, ce, false, false);
end_index = ce.value;
if (!end_index || end_index == error_mark_node)
{
c_parser_skip_to_end_of_block_or_statement (parser);
return error_mark_node;
}
if (c_parser_peek_token (parser)->type == CPP_COLON)
{
c_parser_consume_token (parser);
ce = c_parser_expression (parser);
ce = convert_lvalue_to_rvalue (loc, ce, false, false);
stride = ce.value;
if (!stride || stride == error_mark_node)
{
c_parser_skip_to_end_of_block_or_statement (parser);
return error_mark_node;
}
}
}
else
c_parser_error (parser, "expected array notation expression");
}
else
c_parser_error (parser, "expected array notation expression");
c_parser_skip_until_found (parser, CPP_CLOSE_SQUARE, "expected %<]%>");
value_tree = build_array_notation_ref (loc, array_value, start_index,
end_index, stride, type);
if (value_tree != error_mark_node)
SET_EXPR_LOCATION (value_tree, loc);
return value_tree;
}
static tree c_parser_inline_opcodes(c_parser * parser) static tree c_parser_inline_opcodes(c_parser * parser)
{ {
tree attr_args; tree attr_args;
@ -18604,8 +18464,6 @@ static tree c_parser_inline_opcodes(c_parser * parser)
return build_tree_list (get_identifier("__raw_inline__"), attr_args); return build_tree_list (get_identifier("__raw_inline__"), attr_args);
} }
=======
>>>>>>> upstream
/* Parse the body of a function declaration marked with "__RTL". /* Parse the body of a function declaration marked with "__RTL".
The RTL parser works on the level of characters read from a The RTL parser works on the level of characters read from a

View File

@ -570,7 +570,7 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
if (valreg) if (valreg)
{ {
rtx pop_insn; rtx pop_insn;
int modesize = GET_MODE_SIZE (GET_MODE (valreg)); poly_uint16 modesize = GET_MODE_SIZE (GET_MODE (valreg));
#ifdef PUSH_ROUNDING #ifdef PUSH_ROUNDING
modesize = PUSH_ROUNDING (modesize); modesize = PUSH_ROUNDING (modesize);
#endif #endif
@ -581,7 +581,7 @@ emit_call_1 (rtx funexp, tree fntree ATTRIBUTE_UNUSED, tree fndecl ATTRIBUTE_UNU
)); ));
stack_pointer_delta -= modesize; stack_pointer_delta -= modesize;
add_reg_note (pop_insn, REG_ARGS_SIZE, GEN_INT (stack_pointer_delta)); add_reg_note (pop_insn, REG_ARGS_SIZE, gen_int_mode (stack_pointer_delta, Pmode));
} }
} }
@ -4242,15 +4242,12 @@ expand_call (tree exp, rtx target, int ignore)
if (is_pascal) if (is_pascal)
{ /* ### */ { /* ### */
int modesize;
pascal_return_mode = TYPE_MODE (TREE_TYPE (funtype)); pascal_return_mode = TYPE_MODE (TREE_TYPE (funtype));
modesize = GET_MODE_SIZE (pascal_return_mode); poly_uint16 modesize = GET_MODE_SIZE (pascal_return_mode);
#ifdef PUSH_ROUNDING #ifdef PUSH_ROUNDING
modesize = PUSH_ROUNDING (modesize); modesize = PUSH_ROUNDING (modesize);
#endif #endif
push_block (GEN_INT (modesize), 0, 0); push_block (gen_int_mode (modesize, VOIDmode), 0, 0);
//stack_pointer_delta -= INTVAL (GEN_INT (modesize)); //stack_pointer_delta -= INTVAL (GEN_INT (modesize));
NO_DEFER_POP; NO_DEFER_POP;
} }

View File

@ -198,16 +198,14 @@ static bool m68k_output_addr_const_extra (FILE *, rtx);
static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED; static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
static enum flt_eval_method static enum flt_eval_method
m68k_excess_precision (enum excess_precision_type); m68k_excess_precision (enum excess_precision_type);
<<<<<<< HEAD
static tree m68k_mangle_decl_assembler_name (tree decl, tree id); static tree m68k_mangle_decl_assembler_name (tree decl, tree id);
======= static pad_direction m68k_function_arg_padding (machine_mode mode, const_tree type);
static unsigned int m68k_hard_regno_nregs (unsigned int, machine_mode); static unsigned int m68k_hard_regno_nregs (unsigned int, machine_mode);
static bool m68k_hard_regno_mode_ok (unsigned int, machine_mode); static bool m68k_hard_regno_mode_ok (unsigned int, machine_mode);
static bool m68k_modes_tieable_p (machine_mode, machine_mode); static bool m68k_modes_tieable_p (machine_mode, machine_mode);
static machine_mode m68k_promote_function_mode (const_tree, machine_mode, static machine_mode m68k_promote_function_mode (const_tree, machine_mode,
int *, const_tree, int); int *, const_tree, int);
>>>>>>> upstream
/* Initialize the GCC target structure. */ /* Initialize the GCC target structure. */
@ -355,33 +353,6 @@ static machine_mode m68k_promote_function_mode (const_tree, machine_mode,
#undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL #undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
#define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128 #define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128
<<<<<<< HEAD
#undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE m68k_function_value
#undef TARGET_MANGLE_DECL_ASSEMBLER_NAME
#define TARGET_MANGLE_DECL_ASSEMBLER_NAME m68k_mangle_decl_assembler_name
static const struct attribute_spec m68k_attribute_table[] =
{
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
affects_type_identity } */
{ "interrupt", 0, 0, true, false, false, m68k_handle_fndecl_attribute,
false },
/* Stdcall attribute says callee is responsible for popping arguments
if they are not variable. */
{ "pascal", 0, 0, false, true, true, m68k_handle_fndecl_attribute,
true },
{ "regparam", 1, 1, false, true, true, m68k_handle_fndecl_attribute,
true },
{ "raw_inline", 1, 32, false, true, true, m68k_handle_fndecl_attribute,
false },
{ "interrupt_handler", 0, 0, true, false, false,
m68k_handle_fndecl_attribute, false },
{ "interrupt_thread", 0, 0, true, false, false,
m68k_handle_fndecl_attribute, false },
{ NULL, 0, 0, false, false, false, NULL, false }
=======
#undef TARGET_HARD_REGNO_NREGS #undef TARGET_HARD_REGNO_NREGS
#define TARGET_HARD_REGNO_NREGS m68k_hard_regno_nregs #define TARGET_HARD_REGNO_NREGS m68k_hard_regno_nregs
#undef TARGET_HARD_REGNO_MODE_OK #undef TARGET_HARD_REGNO_MODE_OK
@ -393,6 +364,15 @@ static const struct attribute_spec m68k_attribute_table[] =
#undef TARGET_PROMOTE_FUNCTION_MODE #undef TARGET_PROMOTE_FUNCTION_MODE
#define TARGET_PROMOTE_FUNCTION_MODE m68k_promote_function_mode #define TARGET_PROMOTE_FUNCTION_MODE m68k_promote_function_mode
#undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE m68k_function_value
#undef TARGET_MANGLE_DECL_ASSEMBLER_NAME
#define TARGET_MANGLE_DECL_ASSEMBLER_NAME m68k_mangle_decl_assembler_name
#undef TARGET_FUNCTION_ARG_PADDING
#define TARGET_FUNCTION_ARG_PADDING m68k_function_arg_padding
static const struct attribute_spec m68k_attribute_table[] = static const struct attribute_spec m68k_attribute_table[] =
{ {
/* { name, min_len, max_len, decl_req, type_req, fn_type_req, /* { name, min_len, max_len, decl_req, type_req, fn_type_req,
@ -403,8 +383,13 @@ static const struct attribute_spec m68k_attribute_table[] =
m68k_handle_fndecl_attribute, NULL }, m68k_handle_fndecl_attribute, NULL },
{ "interrupt_thread", 0, 0, true, false, false, false, { "interrupt_thread", 0, 0, true, false, false, false,
m68k_handle_fndecl_attribute, NULL }, m68k_handle_fndecl_attribute, NULL },
{ "pascal", 0, 0, false, true, true, true,
m68k_handle_fndecl_attribute, NULL },
{ "regparam", 1, 1, false, true, true, true,
m68k_handle_fndecl_attribute, NULL },
{ "raw_inline", 1, 32, false, true, true, false,
m68k_handle_fndecl_attribute, NULL },
{ NULL, 0, 0, false, false, false, false, NULL, NULL } { NULL, 0, 0, false, false, false, false, NULL, NULL }
>>>>>>> upstream
}; };
struct gcc_target targetm = TARGET_INITIALIZER; struct gcc_target targetm = TARGET_INITIALIZER;
@ -6881,8 +6866,11 @@ m68k_mangle_decl_assembler_name (tree decl, tree id)
return id; return id;
} }
static pad_direction
m68k_function_arg_padding (machine_mode mode, const_tree type)
{
return PAD_UPWARD;
}
/* Implement PUSH_ROUNDING. On the 680x0, sp@- in a byte insn really pushes /* Implement PUSH_ROUNDING. On the 680x0, sp@- in a byte insn really pushes
a word. On the ColdFire, sp@- in a byte insn pushes just a byte. */ a word. On the ColdFire, sp@- in a byte insn pushes just a byte. */

View File

@ -303,9 +303,6 @@ extern void m68k_register_pragmas(void);
#define PREFERRED_STACK_BOUNDARY \ #define PREFERRED_STACK_BOUNDARY \
((TARGET_COLDFIRE || TARGET_FIDOA) ? 32 : 16) ((TARGET_COLDFIRE || TARGET_FIDOA) ? 32 : 16)
#define FUNCTION_ARG_PADDING(MODE, TYPE) upward
/* No data type wants to be aligned rounder than this. /* No data type wants to be aligned rounder than this.
Most published ABIs say that ints should be aligned on 16-bit Most published ABIs say that ints should be aligned on 16-bit
boundaries, but CPUs with 32-bit busses get better performance boundaries, but CPUs with 32-bit busses get better performance

View File

@ -108,7 +108,8 @@
registers and memory. FIRST is nonzero if this is the only registers and memory. FIRST is nonzero if this is the only
element. */ element. */
#define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \ #define BLOCK_REG_PADDING(MODE, TYPE, FIRST) \
(!(FIRST) ? upward : FUNCTION_ARG_PADDING (MODE, TYPE)) (!(FIRST) ? PAD_UPWARD : targetm.calls.function_arg_padding (MODE, TYPE))
/* Indicate that jump tables go in the text section. */ /* Indicate that jump tables go in the text section. */

View File

@ -5549,7 +5549,7 @@ expand_function_end (void)
{ {
enum machine_mode mode = GET_MODE(decl_rtl);; enum machine_mode mode = GET_MODE(decl_rtl);;
rtx return_slot = GEN_INT(crtl->args.pops_args + 8); rtx return_slot = gen_int_mode(crtl->args.pops_args + 8, Pmode);
return_slot = gen_rtx_PLUS(Pmode, arg_pointer_rtx, return_slot); return_slot = gen_rtx_PLUS(Pmode, arg_pointer_rtx, return_slot);
return_slot = gen_rtx_MEM(mode, return_slot); return_slot = gen_rtx_MEM(mode, return_slot);
MEM_VOLATILE_P(return_slot) = true; MEM_VOLATILE_P(return_slot) = true;