Bug 69151 - missing docs for H8/3000 monitor/OS_Task attributes and related breakage in -mexr/-mno-exr options
Summary: missing docs for H8/3000 monitor/OS_Task attributes and related breakage in -...
Status: UNCONFIRMED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-05 17:03 UTC by sandra
Modified: 2016-01-05 17:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sandra 2016-01-05 17:03:07 UTC
In reviewing the current state of PR1078, I found that there is no documentation for the H8/3000 function attributes "monitor" and "OS_Task".

The "monitor" attribute is mentioned in invoke.texi, though:

@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.

Besides needing markup fixes and copy-editing, this text is totally confusing:  *both* of these behaviors cannot be the default.  Trying to figure this out from the code, in "monitor_prologue" in h8300.md I see:

...
  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";
...

The second clause is clearly dead code.  I think there is a mistake in logic here, and that a target expert needs to figure out what the intended behavior is and correct both the implementation and documentation.