161 lines
7.8 KiB
HTML
161 lines
7.8 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<!-- Copyright (C) 1988-2016 Free Software Foundation, Inc.
|
|
|
|
Permission is granted to copy, distribute and/or modify this document
|
|
under the terms of the GNU Free Documentation License, Version 1.3 or
|
|
any later version published by the Free Software Foundation; with the
|
|
Invariant Sections being "Funding Free Software", the Front-Cover
|
|
Texts being (a) (see below), and with the Back-Cover Texts being (b)
|
|
(see below). A copy of the license is included in the section entitled
|
|
"GNU Free Documentation License".
|
|
|
|
(a) The FSF's Front-Cover Text is:
|
|
|
|
A GNU Manual
|
|
|
|
(b) The FSF's Back-Cover Text is:
|
|
|
|
You have freedom to copy and modify this GNU Manual, like GNU
|
|
software. Copies published by the Free Software Foundation raise
|
|
funds for GNU development. -->
|
|
<!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
|
|
<head>
|
|
<title>GNU Compiler Collection (GCC) Internals: Delay Slots</title>
|
|
|
|
<meta name="description" content="GNU Compiler Collection (GCC) Internals: Delay Slots">
|
|
<meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Delay Slots">
|
|
<meta name="resource-type" content="document">
|
|
<meta name="distribution" content="global">
|
|
<meta name="Generator" content="makeinfo">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<link href="index.html#Top" rel="start" title="Top">
|
|
<link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
|
|
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
|
|
<link href="Insn-Attributes.html#Insn-Attributes" rel="up" title="Insn Attributes">
|
|
<link href="Processor-pipeline-description.html#Processor-pipeline-description" rel="next" title="Processor pipeline description">
|
|
<link href="Mnemonic-Attribute.html#Mnemonic-Attribute" rel="prev" title="Mnemonic Attribute">
|
|
<style type="text/css">
|
|
<!--
|
|
a.summary-letter {text-decoration: none}
|
|
blockquote.smallquotation {font-size: smaller}
|
|
div.display {margin-left: 3.2em}
|
|
div.example {margin-left: 3.2em}
|
|
div.indentedblock {margin-left: 3.2em}
|
|
div.lisp {margin-left: 3.2em}
|
|
div.smalldisplay {margin-left: 3.2em}
|
|
div.smallexample {margin-left: 3.2em}
|
|
div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
|
|
div.smalllisp {margin-left: 3.2em}
|
|
kbd {font-style:oblique}
|
|
pre.display {font-family: inherit}
|
|
pre.format {font-family: inherit}
|
|
pre.menu-comment {font-family: serif}
|
|
pre.menu-preformatted {font-family: serif}
|
|
pre.smalldisplay {font-family: inherit; font-size: smaller}
|
|
pre.smallexample {font-size: smaller}
|
|
pre.smallformat {font-family: inherit; font-size: smaller}
|
|
pre.smalllisp {font-size: smaller}
|
|
span.nocodebreak {white-space:nowrap}
|
|
span.nolinebreak {white-space:nowrap}
|
|
span.roman {font-family:serif; font-weight:normal}
|
|
span.sansserif {font-family:sans-serif; font-weight:normal}
|
|
ul.no-bullet {list-style: none}
|
|
-->
|
|
</style>
|
|
|
|
|
|
</head>
|
|
|
|
<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
|
|
<a name="Delay-Slots"></a>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="Processor-pipeline-description.html#Processor-pipeline-description" accesskey="n" rel="next">Processor pipeline description</a>, Previous: <a href="Mnemonic-Attribute.html#Mnemonic-Attribute" accesskey="p" rel="prev">Mnemonic Attribute</a>, Up: <a href="Insn-Attributes.html#Insn-Attributes" accesskey="u" rel="up">Insn Attributes</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
<hr>
|
|
<a name="Delay-Slot-Scheduling"></a>
|
|
<h4 class="subsection">16.19.8 Delay Slot Scheduling</h4>
|
|
<a name="index-delay-slots_002c-defining"></a>
|
|
|
|
<p>The insn attribute mechanism can be used to specify the requirements for
|
|
delay slots, if any, on a target machine. An instruction is said to
|
|
require a <em>delay slot</em> if some instructions that are physically
|
|
after the instruction are executed as if they were located before it.
|
|
Classic examples are branch and call instructions, which often execute
|
|
the following instruction before the branch or call is performed.
|
|
</p>
|
|
<p>On some machines, conditional branch instructions can optionally
|
|
<em>annul</em> instructions in the delay slot. This means that the
|
|
instruction will not be executed for certain branch outcomes. Both
|
|
instructions that annul if the branch is true and instructions that
|
|
annul if the branch is false are supported.
|
|
</p>
|
|
<p>Delay slot scheduling differs from instruction scheduling in that
|
|
determining whether an instruction needs a delay slot is dependent only
|
|
on the type of instruction being generated, not on data flow between the
|
|
instructions. See the next section for a discussion of data-dependent
|
|
instruction scheduling.
|
|
</p>
|
|
<a name="index-define_005fdelay"></a>
|
|
<p>The requirement of an insn needing one or more delay slots is indicated
|
|
via the <code>define_delay</code> expression. It has the following form:
|
|
</p>
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(define_delay <var>test</var>
|
|
[<var>delay-1</var> <var>annul-true-1</var> <var>annul-false-1</var>
|
|
<var>delay-2</var> <var>annul-true-2</var> <var>annul-false-2</var>
|
|
…])
|
|
</pre></div>
|
|
|
|
<p><var>test</var> is an attribute test that indicates whether this
|
|
<code>define_delay</code> applies to a particular insn. If so, the number of
|
|
required delay slots is determined by the length of the vector specified
|
|
as the second argument. An insn placed in delay slot <var>n</var> must
|
|
satisfy attribute test <var>delay-n</var>. <var>annul-true-n</var> is an
|
|
attribute test that specifies which insns may be annulled if the branch
|
|
is true. Similarly, <var>annul-false-n</var> specifies which insns in the
|
|
delay slot may be annulled if the branch is false. If annulling is not
|
|
supported for that delay slot, <code>(nil)</code> should be coded.
|
|
</p>
|
|
<p>For example, in the common case where branch and call insns require
|
|
a single delay slot, which may contain any insn other than a branch or
|
|
call, the following would be placed in the <samp>md</samp> file:
|
|
</p>
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(define_delay (eq_attr "type" "branch,call")
|
|
[(eq_attr "type" "!branch,call") (nil) (nil)])
|
|
</pre></div>
|
|
|
|
<p>Multiple <code>define_delay</code> expressions may be specified. In this
|
|
case, each such expression specifies different delay slot requirements
|
|
and there must be no insn for which tests in two <code>define_delay</code>
|
|
expressions are both true.
|
|
</p>
|
|
<p>For example, if we have a machine that requires one delay slot for branches
|
|
but two for calls, no delay slot can contain a branch or call insn,
|
|
and any valid insn in the delay slot for the branch can be annulled if the
|
|
branch is true, we might represent this as follows:
|
|
</p>
|
|
<div class="smallexample">
|
|
<pre class="smallexample">(define_delay (eq_attr "type" "branch")
|
|
[(eq_attr "type" "!branch,call")
|
|
(eq_attr "type" "!branch,call")
|
|
(nil)])
|
|
|
|
(define_delay (eq_attr "type" "call")
|
|
[(eq_attr "type" "!branch,call") (nil) (nil)
|
|
(eq_attr "type" "!branch,call") (nil) (nil)])
|
|
</pre></div>
|
|
|
|
<hr>
|
|
<div class="header">
|
|
<p>
|
|
Next: <a href="Processor-pipeline-description.html#Processor-pipeline-description" accesskey="n" rel="next">Processor pipeline description</a>, Previous: <a href="Mnemonic-Attribute.html#Mnemonic-Attribute" accesskey="p" rel="prev">Mnemonic Attribute</a>, Up: <a href="Insn-Attributes.html#Insn-Attributes" accesskey="u" rel="up">Insn Attributes</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
|
|
</div>
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|