MSP430: Fix lines over 80 characters long in config/msp430/*.{c,h} files

2019-08-15  Jozef Lawrynowicz  <jozef.l@mittosystems.com>

	MSP430: Fix lines over 80 characters long in
	config/msp430/*.{c,h} files

	* config/msp430/driver-msp430.c (msp430_select_cpu): Fix format
	specifier in string.
	(msp430_select_hwmult_lib): Split line more than 80 characters long.
	* config/msp430/msp430-devices.c (msp430_extract_mcu_data): Remove
	redundant old comment.
	* config/msp430/msp430-protos.h (msp430_output_aligned_decl_common):
	Split line more than 80 characters long.
	* config/msp430/msp430.c (msp430_option_override): Likewise.
	(msp430_return_in_memory): Likewise.
	(msp430_gimplify_va_arg_expr): Likewise.
	(TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Likewise.
	(msp430_legitimate_constant): Likewise.
	(TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS): Likewise.
	(msp430_attr): Likewise.
	(msp430_data_attr): Likewise.
	(msp430_start_function): Likewise.
	(gen_prefix): Likewise.
	(msp430_init_sections): Likewise.
	(msp430_select_section): Likewise.
	(msp430_function_section): Likewise.
	(msp430_unique_section): Likewise.
	(msp430_output_aligned_decl_common): Likewise.
	(msp430_do_not_relax_short_jumps): Likewise.
	(msp430_init_builtins): Likewise.
	(msp430_expand_delay_cycles): Likewise.
	(msp430_expand_prologue): Likewise.
	(msp430_expand_epilogue): Likewise.
	(msp430_expand_helper): Likewise.
	(msp430_split_movsi): Likewise.
	(msp430_print_operand): Likewise.
	(msp430_return_addr_rtx): Likewise.
	(msp430x_extendhisi): Likewise.
	* config/msp430/msp430.h (STARTFILE_SPEC): Likewise.
	(ASM_SPEC): Likewise.
	Remove very obvious comments.
	(LIB_SPEC): Split line more than 80 characters long.
	(EH_RETURN_HANDLER_RTX): Likewise.
	(HARD_REGNO_CALLER_SAVE_MODE): Likewise.

From-SVN: r274537
This commit is contained in:
Jozef Lawrynowicz 2019-08-15 12:59:04 +00:00 committed by Jozef Lawrynowicz
parent 81a8845cc0
commit 43bfd4e87b
6 changed files with 196 additions and 82 deletions

View File

@ -1,3 +1,47 @@
2019-08-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
MSP430: Fix lines over 80 characters long in
config/msp430/*.{c,h} files
* config/msp430/driver-msp430.c (msp430_select_cpu): Fix format
specifier in string.
(msp430_select_hwmult_lib): Split line more than 80 characters long.
* config/msp430/msp430-devices.c (msp430_extract_mcu_data): Remove
redundant old comment.
* config/msp430/msp430-protos.h (msp430_output_aligned_decl_common):
Split line more than 80 characters long.
* config/msp430/msp430.c (msp430_option_override): Likewise.
(msp430_return_in_memory): Likewise.
(msp430_gimplify_va_arg_expr): Likewise.
(TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Likewise.
(msp430_legitimate_constant): Likewise.
(TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS): Likewise.
(msp430_attr): Likewise.
(msp430_data_attr): Likewise.
(msp430_start_function): Likewise.
(gen_prefix): Likewise.
(msp430_init_sections): Likewise.
(msp430_select_section): Likewise.
(msp430_function_section): Likewise.
(msp430_unique_section): Likewise.
(msp430_output_aligned_decl_common): Likewise.
(msp430_do_not_relax_short_jumps): Likewise.
(msp430_init_builtins): Likewise.
(msp430_expand_delay_cycles): Likewise.
(msp430_expand_prologue): Likewise.
(msp430_expand_epilogue): Likewise.
(msp430_expand_helper): Likewise.
(msp430_split_movsi): Likewise.
(msp430_print_operand): Likewise.
(msp430_return_addr_rtx): Likewise.
(msp430x_extendhisi): Likewise.
* config/msp430/msp430.h (STARTFILE_SPEC): Likewise.
(ASM_SPEC): Likewise.
Remove very obvious comments.
(LIB_SPEC): Split line more than 80 characters long.
(EH_RETURN_HANDLER_RTX): Likewise.
(HARD_REGNO_CALLER_SAVE_MODE): Likewise.
2019-08-15 Jozef Lawrynowicz <jozef.l@mittosystems.com> 2019-08-15 Jozef Lawrynowicz <jozef.l@mittosystems.com>
MSP430: Fix whitespace errors and incorrect indentation in MSP430: Fix whitespace errors and incorrect indentation in

View File

@ -35,7 +35,7 @@ msp430_select_cpu (int argc, const char ** argv)
{ {
if (argc == 0) if (argc == 0)
{ {
error ("expected an argument to %<msp430_select_cpu>%"); error ("expected an argument to %<msp430_select_cpu%>");
return NULL; return NULL;
} }
msp430_extract_mcu_data (argv[0]); msp430_extract_mcu_data (argv[0]);
@ -80,7 +80,8 @@ msp430_set_driver_var (int argc, const char ** argv)
/* Implement spec function `msp430_hwmult_lib´. */ /* Implement spec function `msp430_hwmult_lib´. */
const char * const char *
msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUTE_UNUSED) msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED,
const char ** argv ATTRIBUTE_UNUSED)
{ {
int i; int i;
@ -137,7 +138,8 @@ msp430_select_hwmult_lib (int argc ATTRIBUTE_UNUSED, const char ** argv ATTRIBUT
} }
} }
else else
error ("unexpected first argument to msp430_select_hwmult_lib: %s", argv[0]); error ("unexpected first argument to msp430_select_hwmult_lib: %s",
argv[0]);
break; break;
case 0: case 0:

View File

@ -311,7 +311,6 @@ msp430_extract_mcu_data (const char * mcu_name)
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
/* FIXME: This array is alpha sorted - we could use a binary search. */
for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;) for (i = ARRAY_SIZE (hard_msp430_mcu_data); i--;)
if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0) if (strcasecmp (mcu_name, hard_msp430_mcu_data[i].name) == 0)
{ {

View File

@ -38,7 +38,8 @@ int msp430_initial_elimination_offset (int, int);
bool msp430_is_interrupt_func (void); bool msp430_is_interrupt_func (void);
const char * msp430x_logical_shift_right (rtx); const char * msp430x_logical_shift_right (rtx);
const char * msp430_mcu_name (void); const char * msp430_mcu_name (void);
void msp430_output_aligned_decl_common (FILE *, const tree, const char *, unsigned HOST_WIDE_INT, unsigned); void msp430_output_aligned_decl_common (FILE *, const tree, const char *,
unsigned HOST_WIDE_INT, unsigned);
void msp430_output_labelref (FILE *, const char *); void msp430_output_labelref (FILE *, const char *);
void msp430_register_pragmas (void); void msp430_register_pragmas (void);
rtx msp430_return_addr_rtx (int); rtx msp430_return_addr_rtx (int);

View File

@ -97,7 +97,8 @@ msp430_init_machine_status (void)
#define TARGET_OPTION_OVERRIDE msp430_option_override #define TARGET_OPTION_OVERRIDE msp430_option_override
/* Generate a C preprocessor symbol based upon the MCU selected by the user. /* Generate a C preprocessor symbol based upon the MCU selected by the user.
If a specific MCU has not been selected then return a generic symbol instead. */ If a specific MCU has not been selected then return a generic symbol
instead. */
const char * const char *
msp430_mcu_name (void) msp430_mcu_name (void)
@ -178,7 +179,8 @@ msp430_option_override (void)
if (target_cpu && msp430x != xisa) if (target_cpu && msp430x != xisa)
warning (0, "MCU %qs supports %s ISA but %<-mcpu%> option " warning (0, "MCU %qs supports %s ISA but %<-mcpu%> option "
"is set to %s", "is set to %s",
target_mcu, xisa ? "430X" : "430", msp430x ? "430X" : "430"); target_mcu, xisa ? "430X" : "430",
msp430x ? "430X" : "430");
if (extracted_mcu_data.hwmpy == 0 if (extracted_mcu_data.hwmpy == 0
&& msp430_hwmult_type != MSP430_HWMULT_AUTO && msp430_hwmult_type != MSP430_HWMULT_AUTO
@ -187,7 +189,8 @@ msp430_option_override (void)
"support, but %<-mhwmult%> is set to %s", "support, but %<-mhwmult%> is set to %s",
target_mcu, target_mcu,
msp430_hwmult_type == MSP430_HWMULT_SMALL ? "16-bit" msp430_hwmult_type == MSP430_HWMULT_SMALL ? "16-bit"
: msp430_hwmult_type == MSP430_HWMULT_LARGE ? "32-bit" : "f5series"); : msp430_hwmult_type == MSP430_HWMULT_LARGE
? "32-bit" : "f5series");
else if (msp430_hwmult_type == MSP430_HWMULT_SMALL else if (msp430_hwmult_type == MSP430_HWMULT_SMALL
&& extracted_mcu_data.hwmpy != 1 && extracted_mcu_data.hwmpy != 1
&& extracted_mcu_data.hwmpy != 2) && extracted_mcu_data.hwmpy != 2)
@ -247,7 +250,8 @@ msp430_option_override (void)
} }
/* The F5 series are all able to support the 430X ISA. */ /* The F5 series are all able to support the 430X ISA. */
if (target_cpu == NULL && target_mcu == NULL && msp430_hwmult_type == MSP430_HWMULT_F5SERIES) if (target_cpu == NULL && target_mcu == NULL
&& msp430_hwmult_type == MSP430_HWMULT_F5SERIES)
msp430x = true; msp430x = true;
if (TARGET_LARGE && !msp430x) if (TARGET_LARGE && !msp430x)
@ -804,7 +808,8 @@ msp430_function_arg_boundary (machine_mode mode, const_tree type)
#define TARGET_RETURN_IN_MEMORY msp430_return_in_memory #define TARGET_RETURN_IN_MEMORY msp430_return_in_memory
static bool static bool
msp430_return_in_memory (const_tree ret_type, const_tree fntype ATTRIBUTE_UNUSED) msp430_return_in_memory (const_tree ret_type,
const_tree fntype ATTRIBUTE_UNUSED)
{ {
machine_mode mode = TYPE_MODE (ret_type); machine_mode mode = TYPE_MODE (ret_type);
@ -886,7 +891,8 @@ msp430_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp, t = build2 (MODIFY_EXPR, TREE_TYPE (valist), valist_tmp,
fold_build2 (BIT_AND_EXPR, TREE_TYPE (valist), fold_build2 (BIT_AND_EXPR, TREE_TYPE (valist),
valist_tmp, valist_tmp,
build_int_cst (TREE_TYPE (valist), -boundary))); build_int_cst (TREE_TYPE (valist),
-boundary)));
gimplify_and_add (t, pre_p); gimplify_and_add (t, pre_p);
} }
} }
@ -994,7 +1000,8 @@ msp430_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED,
} }
#undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P #undef TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P
#define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P msp430_addr_space_legitimate_address_p #define TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P \
msp430_addr_space_legitimate_address_p
bool bool
msp430_addr_space_legitimate_address_p (machine_mode mode, msp430_addr_space_legitimate_address_p (machine_mode mode,
@ -1051,7 +1058,8 @@ msp430_legitimate_constant (machine_mode mode, rtx x)
/* GCC does not know the width of the PSImode, so make /* GCC does not know the width of the PSImode, so make
sure that it does not try to use a constant value that sure that it does not try to use a constant value that
is out of range. */ is out of range. */
|| (INTVAL (x) < (1 << 20) && INTVAL (x) >= (HOST_WIDE_INT)(HOST_WIDE_INT_M1U << 20)); || (INTVAL (x) < (1 << 20)
&& INTVAL (x) >= (HOST_WIDE_INT)(HOST_WIDE_INT_M1U << 20));
} }
@ -1268,7 +1276,8 @@ has_section_name (const char * name, tree decl = current_function_decl)
} }
#undef TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS #undef TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS
#define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS msp430_allocate_stack_slots_for_args #define TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS \
msp430_allocate_stack_slots_for_args
static bool static bool
msp430_allocate_stack_slots_for_args (void) msp430_allocate_stack_slots_for_args (void)
@ -1329,8 +1338,8 @@ msp430_attr (tree * node,
default: default:
warning (OPT_Wattributes, warning (OPT_Wattributes,
"argument of %qE attribute is not a string constant or number", "argument of %qE attribute is not a string constant "
name); "or number", name);
*no_add_attrs = true; *no_add_attrs = true;
break; break;
} }
@ -1470,7 +1479,8 @@ msp430_data_attr (tree * node,
/* Check that it's possible for the variable to have a section. */ /* Check that it's possible for the variable to have a section. */
if ((TREE_STATIC (* node) || DECL_EXTERNAL (* node) || in_lto_p) if ((TREE_STATIC (* node) || DECL_EXTERNAL (* node) || in_lto_p)
&& DECL_SECTION_NAME (* node)) && DECL_SECTION_NAME (* node))
message = G_("%qE attribute cannot be applied to variables with specific sections"); message = G_("%qE attribute cannot be applied to variables with specific "
"sections");
if (!message && TREE_NAME_EQ (name, ATTR_PERSIST) && !TREE_STATIC (* node) if (!message && TREE_NAME_EQ (name, ATTR_PERSIST) && !TREE_STATIC (* node)
&& !TREE_PUBLIC (* node) && !DECL_EXTERNAL (* node)) && !TREE_PUBLIC (* node) && !DECL_EXTERNAL (* node))
@ -1485,7 +1495,8 @@ msp430_data_attr (tree * node,
set_decl_section_name (* node, ".persistent"); set_decl_section_name (* node, ".persistent");
/* If this var is thought to be common, then change this. Common variables /* If this var is thought to be common, then change this. Common variables
are assigned to sections before the backend has a chance to process them. */ are assigned to sections before the backend has a chance to process
them. */
if (DECL_COMMON (* node)) if (DECL_COMMON (* node))
DECL_COMMON (* node) = 0; DECL_COMMON (* node) = 0;
@ -1552,12 +1563,19 @@ msp430_start_function (FILE *outfile)
fprintf (outfile, "\n"); fprintf (outfile, "\n");
} }
fprintf (outfile, "; framesize_regs: %d\n", cfun->machine->framesize_regs); fprintf (outfile, "; framesize_regs: %d\n",
fprintf (outfile, "; framesize_locals: %d\n", cfun->machine->framesize_locals); cfun->machine->framesize_regs);
fprintf (outfile, "; framesize_outgoing: %d\n", cfun->machine->framesize_outgoing); fprintf (outfile, "; framesize_locals: %d\n",
cfun->machine->framesize_locals);
fprintf (outfile, "; framesize_outgoing: %d\n",
cfun->machine->framesize_outgoing);
fprintf (outfile, "; framesize: %d\n", cfun->machine->framesize); fprintf (outfile, "; framesize: %d\n", cfun->machine->framesize);
fprintf (outfile, "; elim ap -> fp %d\n", msp430_initial_elimination_offset (ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM)); fprintf (outfile, "; elim ap -> fp %d\n",
fprintf (outfile, "; elim fp -> sp %d\n", msp430_initial_elimination_offset (FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM)); msp430_initial_elimination_offset (ARG_POINTER_REGNUM,
FRAME_POINTER_REGNUM));
fprintf (outfile, "; elim fp -> sp %d\n",
msp430_initial_elimination_offset (FRAME_POINTER_REGNUM,
STACK_POINTER_REGNUM));
n = 0; n = 0;
fprintf (outfile, "; saved regs:"); fprintf (outfile, "; saved regs:");
@ -1618,7 +1636,8 @@ msp430_start_function (FILE *file, const char *name, tree decl)
functions implies multiple definitions. */ functions implies multiple definitions. */
if (DECL_WEAK (decl)) if (DECL_WEAK (decl))
{ {
error ("argument to interrupt attribute is unsupported for weak functions"); error ("argument to interrupt attribute is unsupported for weak "
"functions");
} }
intr_vector = TREE_VALUE (intr_vector); intr_vector = TREE_VALUE (intr_vector);
@ -1660,7 +1679,8 @@ gen_prefix (tree decl)
if (DECL_ONE_ONLY (decl)) if (DECL_ONE_ONLY (decl))
return NULL; return NULL;
/* If the user has specified a particular section then do not use any prefix. */ /* If the user has specified a particular section then do not use any
prefix. */
if (has_attr ("section", decl)) if (has_attr ("section", decl))
return NULL; return NULL;
@ -1674,7 +1694,8 @@ gen_prefix (tree decl)
if (has_attr (ATTR_LOWER, decl)) if (has_attr (ATTR_LOWER, decl))
return lower_prefix; return lower_prefix;
/* If we are compiling for the MSP430 then we do not support the upper region. */ /* If we are compiling for the MSP430 then we do not support the upper
region. */
if (! msp430x) if (! msp430x)
return NULL; return NULL;
@ -1719,8 +1740,10 @@ static section * persist_section;
static void static void
msp430_init_sections (void) msp430_init_sections (void)
{ {
noinit_section = get_unnamed_section (0, output_section_asm_op, ".section .noinit,\"aw\""); noinit_section = get_unnamed_section (0, output_section_asm_op,
persist_section = get_unnamed_section (0, output_section_asm_op, ".section .persistent,\"aw\""); ".section .noinit,\"aw\"");
persist_section = get_unnamed_section (0, output_section_asm_op,
".section .persistent,\"aw\"");
} }
#undef TARGET_ASM_SELECT_SECTION #undef TARGET_ASM_SELECT_SECTION
@ -1740,7 +1763,8 @@ msp430_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
/* In large mode we must make sure that interrupt handlers are put into /* In large mode we must make sure that interrupt handlers are put into
low memory as the vector table only accepts 16-bit addresses. */ low memory as the vector table only accepts 16-bit addresses. */
if (TARGET_LARGE && TREE_CODE (decl) == FUNCTION_DECL && is_interrupt_func (decl)) if (TARGET_LARGE && TREE_CODE (decl) == FUNCTION_DECL
&& is_interrupt_func (decl))
return get_section (".lowtext", SECTION_CODE | SECTION_WRITE , decl); return get_section (".lowtext", SECTION_CODE | SECTION_WRITE , decl);
const char * prefix = gen_prefix (decl); const char * prefix = gen_prefix (decl);
@ -1794,7 +1818,8 @@ msp430_select_section (tree decl, int reloc, unsigned HOST_WIDE_INT align)
#define TARGET_ASM_FUNCTION_SECTION msp430_function_section #define TARGET_ASM_FUNCTION_SECTION msp430_function_section
static section * static section *
msp430_function_section (tree decl, enum node_frequency freq, bool startup, bool exit) msp430_function_section (tree decl, enum node_frequency freq, bool startup,
bool exit)
{ {
const char * name; const char * name;
@ -1840,7 +1865,8 @@ msp430_unique_section (tree decl, int reloc)
/* In large mode we must make sure that interrupt handlers are put into /* In large mode we must make sure that interrupt handlers are put into
low memory as the vector table only accepts 16-bit addresses. */ low memory as the vector table only accepts 16-bit addresses. */
if (TARGET_LARGE && TREE_CODE (decl) == FUNCTION_DECL && is_interrupt_func (decl)) if (TARGET_LARGE && TREE_CODE (decl) == FUNCTION_DECL
&& is_interrupt_func (decl))
{ {
set_decl_section_name (decl, ".lowtext"); set_decl_section_name (decl, ".lowtext");
return; return;
@ -1891,9 +1917,15 @@ msp430_output_aligned_decl_common (FILE * stream,
else else
switch (msp430_data_region) switch (msp430_data_region)
{ {
case MSP430_REGION_UPPER: sec = get_named_section (NULL, ".upper.bss", 0); break; case MSP430_REGION_UPPER:
case MSP430_REGION_LOWER: sec = get_named_section (NULL, ".lower.bss", 0); break; sec = get_named_section (NULL, ".upper.bss", 0);
case MSP430_REGION_EITHER: sec = get_named_section (NULL, ".either.bss", 0); break; break;
case MSP430_REGION_LOWER:
sec = get_named_section (NULL, ".lower.bss", 0);
break;
case MSP430_REGION_EITHER:
sec = get_named_section (NULL, ".either.bss", 0);
break;
default: default:
gcc_unreachable (); gcc_unreachable ();
} }
@ -1911,11 +1943,11 @@ msp430_output_aligned_decl_common (FILE * stream,
bool bool
msp430_do_not_relax_short_jumps (void) msp430_do_not_relax_short_jumps (void)
{ {
/* When placing code into "either" low or high memory we do not want the linker /* When placing code into "either" low or high memory we do not want the
to grow the size of sections, which it can do if it is encounters a branch to linker to grow the size of sections, which it can do if it is encounters a
a label that is too far away. So we tell the cbranch patterns to avoid using branch to a label that is too far away. So we tell the cbranch patterns to
short jumps when there is a chance that the instructions will end up in a low avoid using short jumps when there is a chance that the instructions will
section. */ end up in a low section. */
return return
msp430_code_region == MSP430_REGION_EITHER msp430_code_region == MSP430_REGION_EITHER
|| msp430_code_region == MSP430_REGION_LOWER || msp430_code_region == MSP430_REGION_LOWER
@ -1936,8 +1968,11 @@ static GTY(()) tree msp430_builtins[(int) MSP430_BUILTIN_max];
static void static void
msp430_init_builtins (void) msp430_init_builtins (void)
{ {
tree void_ftype_int = build_function_type_list (void_type_node, integer_type_node, NULL); tree void_ftype_int = build_function_type_list (void_type_node,
tree void_ftype_longlong = build_function_type_list (void_type_node, long_long_integer_type_node, NULL); integer_type_node, NULL);
tree void_ftype_longlong
= build_function_type_list (void_type_node, long_long_integer_type_node,
NULL);
msp430_builtins[MSP430_BUILTIN_BIC_SR] = msp430_builtins[MSP430_BUILTIN_BIC_SR] =
add_builtin_function ( "__bic_SR_register_on_exit", void_ftype_int, add_builtin_function ( "__bic_SR_register_on_exit", void_ftype_int,
@ -1949,7 +1984,8 @@ msp430_init_builtins (void)
msp430_builtins[MSP430_BUILTIN_DELAY_CYCLES] = msp430_builtins[MSP430_BUILTIN_DELAY_CYCLES] =
add_builtin_function ( "__delay_cycles", void_ftype_longlong, add_builtin_function ( "__delay_cycles", void_ftype_longlong,
MSP430_BUILTIN_DELAY_CYCLES, BUILT_IN_MD, NULL, NULL_TREE); MSP430_BUILTIN_DELAY_CYCLES, BUILT_IN_MD, NULL,
NULL_TREE);
} }
static tree static tree
@ -2016,7 +2052,8 @@ msp430_expand_delay_cycles (rtx arg)
if (c > 3 * 0xffff + CYCX (7, 10)) if (c > 3 * 0xffff + CYCX (7, 10))
{ {
n = c; n = c;
/* There's 4 cycles in the short (i>0xffff) loop and 7 in the long (x<=0xffff) loop */ /* There's 4 cycles in the short (i>0xffff) loop and 7 in the long
(x<=0xffff) loop. */
if (c >= 0x10000 * 7 + CYCX (14, 16)) if (c >= 0x10000 * 7 + CYCX (14, 16))
{ {
i = 0x10000; i = 0x10000;
@ -2046,7 +2083,8 @@ msp430_expand_delay_cycles (rtx arg)
emit_insn (gen_delay_cycles_32 (GEN_INT (i), GEN_INT (n - c))); emit_insn (gen_delay_cycles_32 (GEN_INT (i), GEN_INT (n - c)));
} }
/* For 16-bit loops, there's 7(10) + 3x cycles - so the max cycles is 0x30004(7). */ /* For 16-bit loops, there's 7(10) + 3x cycles - so the max cycles is
0x30004(7). */
if (c > 12) if (c > 12)
{ {
n = c; n = c;
@ -2168,7 +2206,8 @@ msp430_expand_prologue (void)
/* Document the stack decrement... */ /* Document the stack decrement... */
note = F (gen_rtx_SET (stack_pointer_rtx, note = F (gen_rtx_SET (stack_pointer_rtx,
gen_rtx_MINUS (Pmode, stack_pointer_rtx, GEN_INT (2)))); gen_rtx_MINUS (Pmode,
stack_pointer_rtx, GEN_INT (2))));
add_reg_note (p, REG_FRAME_RELATED_EXPR, note); add_reg_note (p, REG_FRAME_RELATED_EXPR, note);
/* ...and the establishment of a new location for the return address. */ /* ...and the establishment of a new location for the return address. */
@ -2193,7 +2232,8 @@ msp430_expand_prologue (void)
if (msp430x) if (msp430x)
{ {
/* Note: with TARGET_LARGE we still use PUSHM as PUSHX.A is two bytes bigger. */ /* Note: with TARGET_LARGE we still use PUSHM as PUSHX.A is two
bytes bigger. */
p = F (emit_insn (gen_pushm (gen_rtx_REG (Pmode, i), p = F (emit_insn (gen_pushm (gen_rtx_REG (Pmode, i),
GEN_INT (count)))); GEN_INT (count))));
@ -2203,7 +2243,8 @@ msp430_expand_prologue (void)
= F (gen_rtx_SET (stack_pointer_rtx, = F (gen_rtx_SET (stack_pointer_rtx,
gen_rtx_PLUS (Pmode, gen_rtx_PLUS (Pmode,
stack_pointer_rtx, stack_pointer_rtx,
GEN_INT (count * (TARGET_LARGE ? -4 : -2))))); GEN_INT (count * (TARGET_LARGE
? -4 : -2)))));
/* *sp-- = R[i-j] */ /* *sp-- = R[i-j] */
/* sp+N R10 /* sp+N R10
@ -2276,7 +2317,8 @@ msp430_expand_epilogue (int is_eh)
emit_insn (gen_epilogue_start_marker ()); emit_insn (gen_epilogue_start_marker ());
if (cfun->decl && strcmp (IDENTIFIER_POINTER (DECL_NAME (cfun->decl)), "main") == 0) if (cfun->decl && strcmp (IDENTIFIER_POINTER (DECL_NAME (cfun->decl)),
"main") == 0)
emit_insn (gen_msp430_refsym_need_exit ()); emit_insn (gen_msp430_refsym_need_exit ());
if (is_wakeup_func ()) if (is_wakeup_func ())
@ -2305,7 +2347,9 @@ msp430_expand_epilogue (int is_eh)
emit_move_insn (r12, stack_pointer_rtx); emit_move_insn (r12, stack_pointer_rtx);
emit_insn (addPmode (r12, r12, EH_RETURN_STACKADJ_RTX)); emit_insn (addPmode (r12, r12, EH_RETURN_STACKADJ_RTX));
emit_insn (addPmode (r12, r12, GEN_INT (i))); emit_insn (addPmode (r12, r12, GEN_INT (i)));
emit_move_insn (gen_rtx_MEM (Pmode, plus_constant (Pmode, stack_pointer_rtx, i)), r12); emit_move_insn (gen_rtx_MEM (Pmode, plus_constant (Pmode,
stack_pointer_rtx,
i)), r12);
} }
for (i = 4; i <= 15; i++) for (i = 4; i <= 15; i++)
@ -2330,7 +2374,8 @@ msp430_expand_epilogue (int is_eh)
&& ! is_reentrant_func () && ! is_reentrant_func ()
&& ! is_critical_func () && ! is_critical_func ()
&& crtl->args.pretend_args_size == 0 && crtl->args.pretend_args_size == 0
/* Calling the helper takes as many bytes as the POP;RET sequence. */ /* Calling the helper takes as many bytes as the POP;RET
sequence. */
&& helper_n > 1 && helper_n > 1
&& !is_eh) && !is_eh)
{ {
@ -2346,7 +2391,8 @@ msp430_expand_epilogue (int is_eh)
/* Also pop SP, which puts us into the EH return frame. Except /* Also pop SP, which puts us into the EH return frame. Except
that you can't "pop" sp, you have to just load it off the that you can't "pop" sp, you have to just load it off the
stack. */ stack. */
emit_move_insn (stack_pointer_rtx, gen_rtx_MEM (Pmode, stack_pointer_rtx)); emit_move_insn (stack_pointer_rtx, gen_rtx_MEM (Pmode,
stack_pointer_rtx));
} }
if (crtl->args.pretend_args_size) if (crtl->args.pretend_args_size)
@ -2453,7 +2499,8 @@ const_shift_helpers[] =
emit such a function, using the table above to optimize some emit such a function, using the table above to optimize some
cases. */ cases. */
void void
msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variants) msp430_expand_helper (rtx *operands, const char *helper_name,
bool const_variants)
{ {
rtx c, f; rtx c, f;
char *helper_const = NULL; char *helper_const = NULL;
@ -2475,7 +2522,8 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
&& strcmp (helper_name, const_shift_helpers[i].name) == 0 && strcmp (helper_name, const_shift_helpers[i].name) == 0
&& INTVAL (operands[2]) == const_shift_helpers[i].count) && INTVAL (operands[2]) == const_shift_helpers[i].count)
{ {
emit_insn (const_shift_helpers[i].genfunc (operands[0], operands[1])); emit_insn (const_shift_helpers[i].genfunc (operands[0],
operands[1]));
return; return;
} }
} }
@ -2504,10 +2552,12 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
&& INTVAL (operands[2]) >= 1 && INTVAL (operands[2]) >= 1
&& INTVAL (operands[2]) <= 15) && INTVAL (operands[2]) <= 15)
{ {
/* Note that the INTVAL is limited in value and length by the conditional above. */ /* Note that the INTVAL is limited in value and length by the conditional
above. */
int len = strlen (helper_name) + 4; int len = strlen (helper_name) + 4;
helper_const = (char *) xmalloc (len); helper_const = (char *) xmalloc (len);
snprintf (helper_const, len, "%s_%d", helper_name, (int) INTVAL (operands[2])); snprintf (helper_const, len, "%s_%d", helper_name,
(int) INTVAL (operands[2]));
} }
emit_move_insn (gen_rtx_REG (arg1mode, arg1), emit_move_insn (gen_rtx_REG (arg1mode, arg1),
@ -2517,7 +2567,9 @@ msp430_expand_helper (rtx *operands, const char *helper_name, bool const_variant
operands[2]); operands[2]);
c = gen_call_value_internal (gen_rtx_REG (arg0mode, 12), c = gen_call_value_internal (gen_rtx_REG (arg0mode, 12),
gen_rtx_SYMBOL_REF (VOIDmode, helper_const ? helper_const : helper_name), gen_rtx_SYMBOL_REF (VOIDmode, helper_const
? helper_const
: helper_name),
GEN_INT (0)); GEN_INT (0));
c = emit_call_insn (c); c = emit_call_insn (c);
RTL_CONST_CALL_P (c) = 1; RTL_CONST_CALL_P (c) = 1;
@ -2600,9 +2652,11 @@ msp430_split_movsi (rtx *operands)
if (GET_CODE (operands[1]) == CONST if (GET_CODE (operands[1]) == CONST
|| GET_CODE (operands[1]) == SYMBOL_REF) || GET_CODE (operands[1]) == SYMBOL_REF)
{ {
op10 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16), GEN_INT (0)); op10 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16),
GEN_INT (0));
op10 = gen_rtx_CONST (HImode, op10); op10 = gen_rtx_CONST (HImode, op10);
op12 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16), GEN_INT (16)); op12 = gen_rtx_ZERO_EXTRACT (HImode, operands[1], GEN_INT (16),
GEN_INT (16));
op12 = gen_rtx_CONST (HImode, op12); op12 = gen_rtx_CONST (HImode, op12);
} }
else else
@ -2698,8 +2752,10 @@ helper_function_name_mappings[] =
{ "__muldi3", "__mspabi_mpyll" }, { "__muldi3", "__mspabi_mpyll" },
#if 0 #if 0
/* Clarify signed vs unsigned first. */ /* Clarify signed vs unsigned first. */
{ "__mulhisi3", "__mspabi_mpysl" }, /* gcc doesn't use widening multiply (yet?) */ { "__mulhisi3", "__mspabi_mpysl" }, /* gcc doesn't use widening multiply
{ "__mulsidi3", "__mspabi_mpysll" }, /* gcc doesn't use widening multiply (yet?) */ (yet?) */
{ "__mulsidi3", "__mspabi_mpysll" }, /* gcc doesn't use widening multiply
(yet?) */
#endif #endif
{ "__divhi3", "__mspabi_divi" }, { "__divhi3", "__mspabi_divi" },
@ -3130,9 +3186,11 @@ msp430_print_operand (FILE * file, rtx op, int letter)
case 'O': case 'O':
/* Computes the offset to the top of the stack for the current frame. /* Computes the offset to the top of the stack for the current frame.
This has to be done here rather than in, say, msp430_expand_builtin() This has to be done here rather than in, say, msp430_expand_builtin()
because builtins are expanded before the frame layout is determined. */ because builtins are expanded before the frame layout is
determined. */
fprintf (file, "%d", fprintf (file, "%d",
msp430_initial_elimination_offset (ARG_POINTER_REGNUM, STACK_POINTER_REGNUM) msp430_initial_elimination_offset (ARG_POINTER_REGNUM,
STACK_POINTER_REGNUM)
- (TARGET_LARGE ? 4 : 2)); - (TARGET_LARGE ? 4 : 2));
return; return;
@ -3216,7 +3274,8 @@ msp430_return_addr_rtx (int count)
if (crtl->args.pretend_args_size) if (crtl->args.pretend_args_size)
ra_size += 2; ra_size += 2;
return gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx, GEN_INT (- ra_size))); return gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, arg_pointer_rtx,
GEN_INT (- ra_size)));
} }
rtx rtx
@ -3235,8 +3294,8 @@ const char *
msp430x_extendhisi (rtx * operands) msp430x_extendhisi (rtx * operands)
{ {
if (REGNO (operands[0]) == REGNO (operands[1])) if (REGNO (operands[0]) == REGNO (operands[1]))
/* Low word of dest == source word. */ /* Low word of dest == source word. 8-byte sequence. */
return "BIT.W\t#0x8000, %L0 { SUBC.W\t%H0, %H0 { INV.W\t%H0, %H0"; /* 8-bytes. */ return "BIT.W\t#0x8000, %L0 { SUBC.W\t%H0, %H0 { INV.W\t%H0, %H0";
if (! msp430x) if (! msp430x)
/* Note: This sequence is approximately the same length as invoking a helper /* Note: This sequence is approximately the same length as invoking a helper
@ -3248,15 +3307,16 @@ msp430x_extendhisi (rtx * operands)
MOV.W r12, %H0 MOV.W r12, %H0
but this version does not involve any function calls or using argument but this version does not involve any function calls or using argument
registers, so it reduces register pressure. */ registers, so it reduces register pressure. 10-byte sequence. */
return "MOV.W\t%1, %L0 { BIT.W\t#0x8000, %L0 { SUBC.W\t%H0, %H0 { INV.W\t%H0, %H0"; /* 10-bytes. */ return "MOV.W\t%1, %L0 { BIT.W\t#0x8000, %L0 { SUBC.W\t%H0, %H0 "
"{ INV.W\t%H0, %H0";
if (REGNO (operands[0]) + 1 == REGNO (operands[1])) if (REGNO (operands[0]) + 1 == REGNO (operands[1]))
/* High word of dest == source word. */ /* High word of dest == source word. 6-byte sequence. */
return "MOV.W\t%1, %L0 { RPT\t#15 { RRAX.W\t%H0"; /* 6-bytes. */ return "MOV.W\t%1, %L0 { RPT\t#15 { RRAX.W\t%H0";
/* No overlap between dest and source. */ /* No overlap between dest and source. 8-byte sequence. */
return "MOV.W\t%1, %L0 { MOV.W\t%1, %H0 { RPT\t#15 { RRAX.W\t%H0"; /* 8-bytes. */ return "MOV.W\t%1, %L0 { MOV.W\t%1, %H0 { RPT\t#15 { RRAX.W\t%H0";
} }
/* Likewise for logical right shifts. */ /* Likewise for logical right shifts. */

View File

@ -45,7 +45,8 @@ extern bool msp430x;
while (0) while (0)
#undef STARTFILE_SPEC #undef STARTFILE_SPEC
#define STARTFILE_SPEC "%{pg:gcrt0.o%s}%{!pg:%{minrt:crt0-minrt.o%s}%{!minrt:crt0.o%s}} %{!minrt:crtbegin.o%s}" #define STARTFILE_SPEC "%{pg:gcrt0.o%s}" \
"%{!pg:%{minrt:crt0-minrt.o%s}%{!minrt:crt0.o%s}} %{!minrt:crtbegin.o%s}"
/* -lgcc is included because crtend.o needs __mspabi_func_epilog_1. */ /* -lgcc is included because crtend.o needs __mspabi_func_epilog_1. */
#undef ENDFILE_SPEC #undef ENDFILE_SPEC
@ -55,16 +56,20 @@ extern bool msp430x;
#define ASM_SPEC "-mP " /* Enable polymorphic instructions. */ \ #define ASM_SPEC "-mP " /* Enable polymorphic instructions. */ \
"%{mcpu=*:-mcpu=%*} " /* Pass the CPU type on to the assembler. */ \ "%{mcpu=*:-mcpu=%*} " /* Pass the CPU type on to the assembler. */ \
"%{mrelax=-mQ} " /* Pass the relax option on to the assembler. */ \ "%{mrelax=-mQ} " /* Pass the relax option on to the assembler. */ \
"%{mlarge:-ml} " /* Tell the assembler if we are building for the LARGE pointer model. */ \ /* Tell the assembler if we are building for the LARGE pointer model. */ \
"%{!msim:-md} %{msim:%{mlarge:-md}} " /* Copy data from ROM to RAM if necessary. */ \ "%{mlarge:-ml} " \
"%{msilicon-errata=*:-msilicon-errata=%*} " /* Pass on -msilicon-errata. */ \ /* Copy data from ROM to RAM if necessary. */ \
"%{msilicon-errata-warn=*:-msilicon-errata-warn=%*} " /* Pass on -msilicon-errata-warn. */ \ "%{!msim:-md} %{msim:%{mlarge:-md}} " \
"%{ffunction-sections:-gdwarf-sections} " /* If function sections are being created then create DWARF line number sections as well. */ \ "%{msilicon-errata=*:-msilicon-errata=%*} " \
"%{mdata-region=*:-mdata-region=%*} " /* Pass on -mdata-region. */ "%{msilicon-errata-warn=*:-msilicon-errata-warn=%*} " \
/* Create DWARF line number sections for -ffunction-sections. */ \
"%{ffunction-sections:-gdwarf-sections} " \
"%{mdata-region=*:-mdata-region=%*} "
/* Enable linker section garbage collection by default, unless we /* Enable linker section garbage collection by default, unless we
are creating a relocatable binary (gc does not work) or debugging are creating a relocatable binary (gc does not work) or debugging
is enabled (the GDB testsuite relies upon unused entities not being deleted). */ is enabled (the GDB testsuite relies upon unused entities not being
deleted). */
#define LINK_SPEC "%{mrelax:--relax} %{mlarge:%{!r:%{!g:--gc-sections}}} " \ #define LINK_SPEC "%{mrelax:--relax} %{mlarge:%{!r:%{!g:--gc-sections}}} " \
"%{mcode-region=*:--code-region=%*} %{mdata-region=*:--data-region=%*}" "%{mcode-region=*:--code-region=%*} %{mdata-region=*:--data-region=%*}"
@ -110,7 +115,8 @@ extern const char * msp430_check_path_for_devices (int, const char **);
#undef LIB_SPEC #undef LIB_SPEC
#define LIB_SPEC " \ #define LIB_SPEC " \
--start-group \ --start-group \
%{mhwmult=auto:%{mmcu=*:%:msp430_hwmult_lib(mcu %{mmcu=*:%*});:%:msp430_hwmult_lib(default)}; \ %{mhwmult=auto:%{mmcu=*:%:msp430_hwmult_lib(mcu %{mmcu=*:%*});\
:%:msp430_hwmult_lib(default)}; \
mhwmult=*:%:msp430_hwmult_lib(hwmult %{mhwmult=*:%*}); \ mhwmult=*:%:msp430_hwmult_lib(hwmult %{mhwmult=*:%*}); \
mmcu=*:%:msp430_hwmult_lib(mcu %{mmcu=*:%*}); \ mmcu=*:%:msp430_hwmult_lib(mcu %{mmcu=*:%*}); \
:%:msp430_hwmult_lib(default)} \ :%:msp430_hwmult_lib(default)} \
@ -395,7 +401,8 @@ typedef struct
(((N) < 3) ? ((N) + 12) : INVALID_REGNUM) (((N) < 3) ? ((N) + 12) : INVALID_REGNUM)
#define EH_RETURN_HANDLER_RTX \ #define EH_RETURN_HANDLER_RTX \
gen_rtx_MEM(Pmode, gen_rtx_PLUS (Pmode, gen_rtx_REG(Pmode, SP_REGNO), gen_rtx_REG (Pmode, 15))) gen_rtx_MEM (Pmode, gen_rtx_PLUS (Pmode, gen_rtx_REG (Pmode, SP_REGNO), \
gen_rtx_REG (Pmode, 15)))
#define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 15) #define EH_RETURN_STACKADJ_RTX gen_rtx_REG (Pmode, 15)
@ -459,7 +466,8 @@ typedef struct
/* Prevent reload (and others) from choosing HImode stack slots /* Prevent reload (and others) from choosing HImode stack slots
when spilling hard registers when they may contain PSImode values. */ when spilling hard registers when they may contain PSImode values. */
#define HARD_REGNO_CALLER_SAVE_MODE(REGNO,NREGS,MODE) \ #define HARD_REGNO_CALLER_SAVE_MODE(REGNO,NREGS,MODE) \
((TARGET_LARGE && ((NREGS) <= 2)) ? PSImode : choose_hard_reg_mode ((REGNO), (NREGS), false)) ((TARGET_LARGE && ((NREGS) <= 2)) ? PSImode \
: choose_hard_reg_mode ((REGNO), (NREGS), false))
#define ACCUMULATE_OUTGOING_ARGS 1 #define ACCUMULATE_OUTGOING_ARGS 1