Commit d7edde11 by Nick Clifton Committed by Nick Clifton

msp430-opts.h (enum msp430_regions): New.

	* config/msp430/msp430-opts.h (enum msp430_regions): New.
	* config/msp430/msp430.c (msp430_override_options): Complain if
	-mcode-region or -mdata-region is used on a non MSP430X.
	(msp430_section_attr): New function.  Checks lower, upper and
	either attributes.
	(msp430_attribute_table): Add lower, upper and either.
	(gen_prefix): New function.  Generates a prefix for a section
	name.
	(msp430_select_section): New function - handles the choice of
	section for an object.  Takes into account memory region
	attributes and options.
	(msp430_function_section): Use gen_prefix.
	(TARGET_SECTION_TYPE_FLAGS): Define.
	(msp430_section_type_flags): New function.
	(TARGET_ASM_UNIQUE_SECTION): Define.
	(msp430_unique_section): New function.
	(msp430_output_aligned_decl_common): New function.
	(msp430_do_not_relax_short_jumps): New function.
	* config/msp430/msp430.h (USE_SELECT_SECTION_FOR_FUNCTIONS):
	Define.
	(ASM_OUTPUT_ALIGNED_DECL_COMMON): Define.
	* config/msp430/msp430-protos.h
	(msp430_do_not_relax_short_jumps): New prototype.
	(msp430_output_aligned_decl_common): New prototype.
	* config/msp430/msp430.md (length): New attribute.
	(cbranchhi4_real): If msp430_do_not_relax_short_jumps is true
	then use a long code sequence for short jumps.
	* config/msp430/msp430.opt (mcode-region): New.
	(mdata-region): New.
	* doc/invoke.texi: Document new options.
	* doc/extend.texi: Document new attributes.

From-SVN: r222810
parent c87b25e6
2015-05-05 Nick Clifton <nickc@redhat.com>
* config/msp430/msp430-opts.h (enum msp430_regions): New.
* config/msp430/msp430.c (msp430_override_options): Complain if
-mcode-region or -mdata-region is used on a non MSP430X.
(msp430_section_attr): New function. Checks lower, upper and
either attributes.
(msp430_attribute_table): Add lower, upper and either.
(gen_prefix): New function. Generates a prefix for a section
name.
(msp430_select_section): New function - handles the choice of
section for an object. Takes into account memory region
attributes and options.
(msp430_function_section): Use gen_prefix.
(TARGET_SECTION_TYPE_FLAGS): Define.
(msp430_section_type_flags): New function.
(TARGET_ASM_UNIQUE_SECTION): Define.
(msp430_unique_section): New function.
(msp430_output_aligned_decl_common): New function.
(msp430_do_not_relax_short_jumps): New function.
* config/msp430/msp430.h (USE_SELECT_SECTION_FOR_FUNCTIONS):
Define.
(ASM_OUTPUT_ALIGNED_DECL_COMMON): Define.
* config/msp430/msp430-protos.h
(msp430_do_not_relax_short_jumps): New prototype.
(msp430_output_aligned_decl_common): New prototype.
* config/msp430/msp430.md (length): New attribute.
(cbranchhi4_real): If msp430_do_not_relax_short_jumps is true
then use a long code sequence for short jumps.
* config/msp430/msp430.opt (mcode-region): New.
(mdata-region): New.
* doc/invoke.texi: Document new options.
* doc/extend.texi: Document new attributes.
2015-05-05 Matthew Wahab <matthew.wahab@arm.com>
* gcc/config/aarch64-protos.h (struct cpu_branch_cost): New.
......
......@@ -29,4 +29,12 @@ enum msp430_hwmult_types
F5SERIES
};
enum msp430_regions
{
ANY,
EITHER,
LOWER,
UPPER
};
#endif
......@@ -21,6 +21,7 @@
#ifndef GCC_MSP430_PROTOS_H
#define GCC_MSP430_PROTOS_H
bool msp430_do_not_relax_short_jumps (void);
rtx msp430_eh_return_stackadj_rtx (void);
void msp430_expand_eh_return (rtx);
void msp430_expand_epilogue (int);
......@@ -40,6 +41,7 @@ bool msp430_is_interrupt_func (void);
const char * msp430x_logical_shift_right (rtx);
const char * msp430_mcu_name (void);
bool msp430_modes_tieable_p (machine_mode, machine_mode);
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_register_pragmas (void);
rtx msp430_return_addr_rtx (int);
......
......@@ -404,3 +404,9 @@ typedef struct
msp430_start_function ((FILE), (NAME), (DECL))
#define TARGET_HAS_NO_HW_DIVIDE (! TARGET_HWMULT)
#undef USE_SELECT_SECTION_FOR_FUNCTIONS
#define USE_SELECT_SECTION_FOR_FUNCTIONS 1
#define ASM_OUTPUT_ALIGNED_DECL_COMMON(FILE, DECL, NAME, SIZE, ALIGN) \
msp430_output_aligned_decl_common ((FILE), (DECL), (NAME), (SIZE), (ALIGN))
......@@ -58,6 +58,9 @@
UNS_DELAY_END
])
;; This is an approximation.
(define_attr "length" "" (const_int 4))
(include "predicates.md")
(include "constraints.md")
......@@ -210,7 +213,7 @@
""
""
)
(define_insn_and_split "movsi_x"
[(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
(match_operand:SI 1 "general_operand" "rmi"))]
......@@ -551,7 +554,7 @@
[(set (match_dup 0)
(zero_extend:HI (match_dup 1)))]
)
(define_insn "zero_extendhipsi2"
[(set (match_operand:PSI 0 "msp_nonimmediate_operand" "=r,m")
(zero_extend:PSI (match_operand:HI 1 "msp_nonimmediate_operand" "rm,r")))]
......@@ -939,14 +942,12 @@
"msp430_expand_epilogue (0); DONE;"
)
(define_insn "epilogue_helper"
[(unspec_volatile [(match_operand 0 "immediate_operand" "i")] UNS_EPILOGUE_HELPER)]
""
"BR%Q0\t#__mspabi_func_epilog_%J0"
)
(define_insn "prologue_start_marker"
[(unspec_volatile [(const_int 0)] UNS_PROLOGUE_START_MARKER)]
""
......@@ -1110,9 +1111,32 @@
(clobber (reg:BI CARRY))
]
""
"@
CMP.W\t%2, %1 { J%0\t%l3
CMP%X0.W\t%2, %1 { J%0\t%l3"
"*
/* This is nasty. If we are splitting code between low and high memory
then we do not want the linker to increase the size of sections by
relaxing out of range jump instructions. (Since relaxation occurs
after section placement). So we have to generate pessimal branches
here. But we only want to do this when really necessary.
FIXME: Do we need code in the other cbranch patterns ? */
if (msp430_do_not_relax_short_jumps () && get_attr_length (insn) > 6)
{
return which_alternative == 0 ?
\"CMP.W\t%2, %1 { J%r0 1f { BRA #%l3 { 1:\" :
\"CMP%X0.W\t%2, %1 { J%r0 1f { BRA #%l3 { 1:\";
}
return which_alternative == 0 ?
\"CMP.W\t%2, %1 { J%0\t%l3\" :
\"CMP%X0.W\t%2, %1 { J%0\t%l3\";
"
[(set (attr "length")
(if_then_else
(and (ge (minus (match_dup 3) (pc)) (const_int -510))
(le (minus (match_dup 3) (pc)) (const_int 510)))
(const_int 6)
(const_int 10))
)]
)
(define_insn "cbranchpsi4_reversed"
......
......@@ -57,3 +57,26 @@ Enum(msp430_hwmult_types) String(32bit) Value(LARGE)
EnumValue
Enum(msp430_hwmult_types) String(f5series) Value(F5SERIES)
mcode-region=
Target Joined RejectNegative Report ToLower Var(msp430_code_region) Enum(msp430_regions) Init(ANY)
Specify whether functions should be placed into low or high memory
mdata-region=
Target Joined RejectNegative Report ToLower Var(msp430_data_region) Enum(msp430_regions) Init(ANY)
Specify whether variables should be placed into low or high memory
Enum
Name(msp430_regions) Type(enum msp430_regions)
EnumValue
Enum(msp430_regions) String(none) Value(ANY)
EnumValue
Enum(msp430_regions) String(either) Value(EITHER)
EnumValue
Enum(msp430_regions) String(lower) Value(LOWER)
EnumValue
Enum(msp430_regions) String(upper) Value(UPPER)
......@@ -3254,6 +3254,38 @@ performing a reloadable link on them.
At present, a declaration to which @code{weakref} is attached can
only be @code{static}.
@item lower
@itemx upper
@itemx either
@cindex lower memory region on the MSP430
@cindex upper memory region on the MSP430
@cindex either memory region on the MSP430
On the MSP430 target these attributes can be used to specify whether
the function or variable should be placed into low memory, high
memory, or the placement should be left to the linker to decide. The
attributes are only significant if compiling for the MSP430X
architecture.
The attributes work in conjunction with a linker script that has been
augmented to specify where to place sections with a @code{.lower} and
a @code{.upper} prefix. So for example as well as placing the
@code{.data} section the script would also specify the placement of a
@code{.lower.data} and a @code{.upper.data} section. The intention
being that @code{lower} sections are placed into a small but easier to
access memory region and the upper sections are placed into a larger, but
slower to access region.
The @code{either} attribute is special. It tells the linker to place
the object into the corresponding @code{lower} section if there is
room for it. If there is insufficient room then the object is placed
into the corresponding @code{upper} section instead. Note - the
placement algorithm is not very sophisticated. It will not attempt to
find an optimal packing of the @code{lower} sections. It just makes
one pass over the objects and does the best that it can. Using the
@option{-ffunction-sections} and @option{-fdata-sections} command line
options can help the packing however, since they produce smaller,
easier to pack regions.
@end table
@c This is the end of the target-independent attribute table
......
......@@ -827,6 +827,7 @@ Objective-C and Objective-C++ Dialects}.
@emph{MSP430 Options}
@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
-mcode-region= -mdata-region= @gol
-mhwmult= -minrt}
@emph{NDS32 Options}
......@@ -18164,6 +18165,19 @@ initializers or constructors. This is intended for memory-constrained
devices. The compiler includes special symbols in some objects
that tell the linker and runtime which code fragments are required.
@item -mcode-region=
@itemx -mdata-region=
@opindex mcode-region
@opindex mdata-region
These options tell the compiler where to place functions and data that
do not have one of the @code{lower}, @code{upper}, @code{either} or
@code{section} attributes. Possible values are @code{lower},
@code{upper}, @code{either} or @code{any}. The first three behave
like the corresponding attribute. The fourth possible value -
@code{any} - is the default. It leaves placement entirely up to the
linker script and how it assigns the standard sections (.text, .data
etc) to the memory regions.
@end table
@node NDS32 Options
......
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