Commit f4ea8112 by Sandeep Kumar Singh Committed by Jeff Law

h8300.c (h8300_current_function_monitor_function_p): New function.

	* h8300/h8300.c (h8300_current_function_monitor_function_p):
	New function. Added to check monitor functions. 
	(h8300_option_override): Modified to generate error/warning 
	messages for invalid combinations of different command line 
	options.
	* h8300/h8300.md: Generate 'rte' for monitor functions. Do not
	save EXR on stack for monitor function in case of H8S target 
	when "-mno-exr" is passed.
	* h8300/h8300-protos.h 
	(h8300_current_function_monitor_function_p): Add prototype.
	* doc/invoke.texi: Document H8S options.

From-SVN: r186109
parent 2f6935f4
2012-04-03 Sandeep Kumar Singh <Sandeep.Singh2@kpitcummins.com>
* h8300/h8300.c (h8300_current_function_monitor_function_p):
New function. Added to check monitor functions.
(h8300_option_override): Modified to generate error/warning
messages for invalid combinations of different command line
options.
* h8300/h8300.md: Generate 'rte' for monitor functions. Do not
save EXR on stack for monitor function in case of H8S target
when "-mno-exr" is passed.
* h8300/h8300-protos.h
(h8300_current_function_monitor_function_p): Add prototype.
* doc/invoke.texi: Document H8S options.
2012-04-03 Tristan Gingold <gingold@adacore.com> 2012-04-03 Tristan Gingold <gingold@adacore.com>
* configure.ac: Use GCC_AC_FUNC_MMAP_BLACKLIST instead * configure.ac: Use GCC_AC_FUNC_MMAP_BLACKLIST instead
......
...@@ -96,6 +96,7 @@ extern int h8300_can_use_return_insn_p (void); ...@@ -96,6 +96,7 @@ extern int h8300_can_use_return_insn_p (void);
extern void h8300_expand_prologue (void); extern void h8300_expand_prologue (void);
extern void h8300_expand_epilogue (void); extern void h8300_expand_epilogue (void);
extern int h8300_current_function_interrupt_function_p (void); extern int h8300_current_function_interrupt_function_p (void);
extern int h8300_current_function_monitor_function_p (void);
extern int h8300_initial_elimination_offset (int, int); extern int h8300_initial_elimination_offset (int, int);
extern int h8300_regs_ok_for_stm (int, rtx[]); extern int h8300_regs_ok_for_stm (int, rtx[]);
extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int); extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int);
......
...@@ -316,6 +316,14 @@ h8300_option_override (void) ...@@ -316,6 +316,14 @@ h8300_option_override (void)
static const char *const h8_pop_ops[2] = { "pop" , "pop.l" }; static const char *const h8_pop_ops[2] = { "pop" , "pop.l" };
static const char *const h8_mov_ops[2] = { "mov.w", "mov.l" }; static const char *const h8_mov_ops[2] = { "mov.w", "mov.l" };
#ifndef OBJECT_FORMAT_ELF
if (TARGET_H8300SX)
{
error ("-msx is not supported in coff");
target_flags |= MASK_H8300S;
}
#endif
if (TARGET_H8300) if (TARGET_H8300)
{ {
cpu_type = (int) CPU_H8300; cpu_type = (int) CPU_H8300;
...@@ -339,10 +347,34 @@ h8300_option_override (void) ...@@ -339,10 +347,34 @@ h8300_option_override (void)
if (TARGET_H8300 && TARGET_NORMAL_MODE) if (TARGET_H8300 && TARGET_NORMAL_MODE)
{ {
error ("-mn is used without -mh or -ms"); error ("-mn is used without -mh or -ms or -msx");
target_flags ^= MASK_NORMAL_MODE; target_flags ^= MASK_NORMAL_MODE;
} }
if (! TARGET_H8300S && TARGET_EXR)
{
error ("-mexr is used without -ms");
target_flags |= MASK_H8300S_1;
}
if (TARGET_H8300 && TARGET_INT32)
{
error ("-mint32 is not supported for H8300 and H8300L targets");
target_flags ^= MASK_INT32;
}
if ((!TARGET_H8300S && TARGET_EXR) && (!TARGET_H8300SX && TARGET_EXR))
{
error ("-mexr is used without -ms or -msx");
target_flags |= MASK_H8300S_1;
}
if ((!TARGET_H8300S && TARGET_NEXR) && (!TARGET_H8300SX && TARGET_NEXR))
{
warning (OPT_mno_exr, "-mno-exr valid only with -ms or -msx \
- Option ignored!");
}
/* Some of the shifts are optimized for speed by default. /* Some of the shifts are optimized for speed by default.
See http://gcc.gnu.org/ml/gcc-patches/2002-07/msg01858.html See http://gcc.gnu.org/ml/gcc-patches/2002-07/msg01858.html
If optimizing for size, change shift_alg for those shift to If optimizing for size, change shift_alg for those shift to
...@@ -795,9 +827,9 @@ h8300_expand_prologue (void) ...@@ -795,9 +827,9 @@ h8300_expand_prologue (void)
return; return;
if (h8300_monitor_function_p (current_function_decl)) if (h8300_monitor_function_p (current_function_decl))
/* My understanding of monitor functions is they act just like /* The monitor function act as normal functions, which means it
interrupt functions, except the prologue must mask can accept parameters and return values. In addition to this,
interrupts. */ interrupts are masked in prologue and return with "rte" in epilogue. */
emit_insn (gen_monitor_prologue ()); emit_insn (gen_monitor_prologue ());
if (frame_pointer_needed) if (frame_pointer_needed)
...@@ -925,8 +957,13 @@ h8300_expand_epilogue (void) ...@@ -925,8 +957,13 @@ h8300_expand_epilogue (void)
int int
h8300_current_function_interrupt_function_p (void) h8300_current_function_interrupt_function_p (void)
{ {
return (h8300_interrupt_function_p (current_function_decl) return (h8300_interrupt_function_p (current_function_decl));
|| h8300_monitor_function_p (current_function_decl)); }
int
h8300_current_function_monitor_function_p ()
{
return (h8300_monitor_function_p (current_function_decl));
} }
/* Output assembly code for the start of the file. */ /* Output assembly code for the start of the file. */
......
...@@ -2609,7 +2609,8 @@ ...@@ -2609,7 +2609,8 @@
{ {
operands[3] = SET_DEST (XVECEXP (operands[0], 0, operands[3] = SET_DEST (XVECEXP (operands[0], 0,
XVECLEN (operands[0], 0) - 2)); XVECLEN (operands[0], 0) - 2));
if (h8300_current_function_interrupt_function_p ()) if (h8300_current_function_interrupt_function_p ()
|| h8300_current_function_monitor_function_p ())
return "rte/l\t%S1-%S3"; return "rte/l\t%S1-%S3";
else else
return "rts/l\t%S1-%S3"; return "rts/l\t%S1-%S3";
...@@ -2628,7 +2629,8 @@ ...@@ -2628,7 +2629,8 @@
"reload_completed" "reload_completed"
"* "*
{ {
if (h8300_current_function_interrupt_function_p ()) if (h8300_current_function_interrupt_function_p ()
|| h8300_current_function_monitor_function_p ())
return \"rte\"; return \"rte\";
else else
return \"rts\"; return \"rts\";
...@@ -2654,8 +2656,16 @@ ...@@ -2654,8 +2656,16 @@
{ {
if (TARGET_H8300) if (TARGET_H8300)
return \"subs\\t#2,r7\;mov.w\\tr0,@-r7\;stc\\tccr,r0l\;mov.b\tr0l,@(2,r7)\;mov.w\\t@r7+,r0\;orc\t#128,ccr\"; return \"subs\\t#2,r7\;mov.w\\tr0,@-r7\;stc\\tccr,r0l\;mov.b\tr0l,@(2,r7)\;mov.w\\t@r7+,r0\;orc\t#128,ccr\";
else if (TARGET_H8300H && TARGET_NORMAL_MODE)
return \"subs\\t#2,er7\;mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr\";
else if (TARGET_H8300H) else if (TARGET_H8300H)
return \"mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr\"; return \"mov.l\\ter0,@-er7\;stc\\tccr,r0l\;mov.b\\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\\t#128,ccr\";
else if (TARGET_H8300S && TARGET_NEXR )
return \"mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\";
else if (TARGET_H8300S && TARGET_NEXR && TARGET_NORMAL_MODE)
return \"subs\\t#2,er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(4,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\";
else if (TARGET_H8300S && TARGET_NORMAL_MODE)
return \"subs\\t#2,er7\;stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\";
else if (TARGET_H8300S) else if (TARGET_H8300S)
return \"stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\"; return \"stc\texr,@-er7\;mov.l\\ter0,@-er7\;stc\tccr,r0l\;mov.b\tr0l,@(6,er7)\;mov.l\\t@er7+,er0\;orc\t#128,ccr\";
gcc_unreachable (); gcc_unreachable ();
...@@ -6199,3 +6209,5 @@ ...@@ -6199,3 +6209,5 @@
&& !reg_overlap_mentioned_p (operands[0], operands[2])" && !reg_overlap_mentioned_p (operands[0], operands[2])"
[(set (match_dup 2) [(set (match_dup 2)
(match_dup 1))]) (match_dup 1))])
...@@ -60,3 +60,12 @@ Enable the normal mode ...@@ -60,3 +60,12 @@ Enable the normal mode
malign-300 malign-300
Target RejectNegative Mask(ALIGN_300) Target RejectNegative Mask(ALIGN_300)
Use H8/300 alignment rules Use H8/300 alignment rules
mexr
Target Mask(EXR)
Push extended registers on stack in monitor functions
mno-exr
Target Mask(NEXR)
Do not push extended registers on stack in monitor functions
...@@ -596,7 +596,7 @@ Objective-C and Objective-C++ Dialects}. ...@@ -596,7 +596,7 @@ Objective-C and Objective-C++ Dialects}.
-tno-android-cc -tno-android-ld} -tno-android-cc -tno-android-ld}
@emph{H8/300 Options} @emph{H8/300 Options}
@gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300} @gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
@emph{HPPA Options} @emph{HPPA Options}
@gccoptlist{-march=@var{architecture-type} @gol @gccoptlist{-march=@var{architecture-type} @gol
...@@ -12815,6 +12815,18 @@ must be used either with @option{-mh} or @option{-ms}. ...@@ -12815,6 +12815,18 @@ must be used either with @option{-mh} or @option{-ms}.
@opindex ms2600 @opindex ms2600
Generate code for the H8S/2600. This switch must be used with @option{-ms}. Generate code for the H8S/2600. This switch must be used with @option{-ms}.
@item -mexr
@opindex mexr
Extended registers are stored on stack before execution of function
with monitor attribute. Default option is @option{-mexr}.
This option is valid only for H8S targets.
@item -mno-exr
@opindex mno-exr
Extended registers are not stored on stack before execution of function
with monitor attribute. Default option is @option{-mno-exr}.
This option is valid only for H8S targets.
@item -mint32 @item -mint32
@opindex mint32 @opindex mint32
Make @code{int} data 32 bits by default. Make @code{int} data 32 bits by default.
......
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