From: law Date: Tue, 3 Apr 2012 17:09:53 +0000 (+0000) Subject: * h8300/h8300.c (h8300_current_function_monitor_function_p): X-Git-Tag: upstream/4.9.2~13438 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3677aa8096a45d135e3cbd6ed771fe706bca1fb;p=platform%2Fupstream%2Flinaro-gcc.git * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@186109 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db51659..e1fc73b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2012-04-03 Sandeep Kumar Singh + + * 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 * configure.ac: Use GCC_AC_FUNC_MMAP_BLACKLIST instead diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index aeac904..428a86a 100644 --- a/gcc/config/h8300/h8300-protos.h +++ b/gcc/config/h8300/h8300-protos.h @@ -96,6 +96,7 @@ extern int h8300_can_use_return_insn_p (void); extern void h8300_expand_prologue (void); extern void h8300_expand_epilogue (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_regs_ok_for_stm (int, rtx[]); extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int); diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c index 3911cd4..7eaaf20 100644 --- a/gcc/config/h8300/h8300.c +++ b/gcc/config/h8300/h8300.c @@ -316,6 +316,14 @@ h8300_option_override (void) static const char *const h8_pop_ops[2] = { "pop" , "pop.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) { cpu_type = (int) CPU_H8300; @@ -339,10 +347,34 @@ h8300_option_override (void) 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; } + 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. See http://gcc.gnu.org/ml/gcc-patches/2002-07/msg01858.html If optimizing for size, change shift_alg for those shift to @@ -795,9 +827,9 @@ h8300_expand_prologue (void) return; if (h8300_monitor_function_p (current_function_decl)) - /* My understanding of monitor functions is they act just like - interrupt functions, except the prologue must mask - interrupts. */ + /* The monitor function act as normal functions, which means it + can accept parameters and return values. In addition to this, + interrupts are masked in prologue and return with "rte" in epilogue. */ emit_insn (gen_monitor_prologue ()); if (frame_pointer_needed) @@ -925,8 +957,13 @@ h8300_expand_epilogue (void) int h8300_current_function_interrupt_function_p (void) { - return (h8300_interrupt_function_p (current_function_decl) - || h8300_monitor_function_p (current_function_decl)); + return (h8300_interrupt_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. */ diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md index bf41e66..df983e1 100644 --- a/gcc/config/h8300/h8300.md +++ b/gcc/config/h8300/h8300.md @@ -2609,7 +2609,8 @@ { operands[3] = SET_DEST (XVECEXP (operands[0], 0, 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"; else return "rts/l\t%S1-%S3"; @@ -2628,7 +2629,8 @@ "reload_completed" "* { - if (h8300_current_function_interrupt_function_p ()) + if (h8300_current_function_interrupt_function_p () + || h8300_current_function_monitor_function_p ()) return \"rte\"; else return \"rts\"; @@ -2654,8 +2656,16 @@ { 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\"; + 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) 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) 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 (); @@ -6199,3 +6209,5 @@ && !reg_overlap_mentioned_p (operands[0], operands[2])" [(set (match_dup 2) (match_dup 1))]) + + diff --git a/gcc/config/h8300/h8300.opt b/gcc/config/h8300/h8300.opt index 989375e..16c6ef5 100644 --- a/gcc/config/h8300/h8300.opt +++ b/gcc/config/h8300/h8300.opt @@ -60,3 +60,12 @@ Enable the normal mode malign-300 Target RejectNegative Mask(ALIGN_300) 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 + diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 672e597..36d09cd 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -596,7 +596,7 @@ Objective-C and Objective-C++ Dialects}. -tno-android-cc -tno-android-ld} @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} @gccoptlist{-march=@var{architecture-type} @gol @@ -12815,6 +12815,18 @@ must be used either with @option{-mh} or @option{-ms}. @opindex ms2600 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 @opindex mint32 Make @code{int} data 32 bits by default.