diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-03 17:09:53 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-04-03 17:09:53 +0000 |
commit | d3677aa8096a45d135e3cbd6ed771fe706bca1fb (patch) | |
tree | b2edac3b6d3857700848f93e9ecf3f0664463d49 /gcc/config/h8300 | |
parent | 749dea2a0549c126a0e992a6dd8e9b5eb28e1cee (diff) | |
download | gcc-d3677aa8096a45d135e3cbd6ed771fe706bca1fb.tar.gz |
* 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
Diffstat (limited to 'gcc/config/h8300')
-rw-r--r-- | gcc/config/h8300/h8300-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.c | 49 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.md | 16 | ||||
-rw-r--r-- | gcc/config/h8300/h8300.opt | 9 |
4 files changed, 67 insertions, 8 deletions
diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h index aeac904031c..428a86a316c 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 3911cd4dda4..7eaaf202f00 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 bf41e6669a6..df983e13634 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 989375e152c..16c6ef5e029 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 + |