You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
5.0 KiB
HTML
106 lines
5.0 KiB
HTML
<html lang="en">
|
|
<head>
|
|
<title>Define Subst - GNU Compiler Collection (GCC) Internals</title>
|
|
<meta http-equiv="Content-Type" content="text/html">
|
|
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
|
|
<meta name="generator" content="makeinfo 4.13">
|
|
<link title="Top" rel="start" href="index.html#Top">
|
|
<link rel="up" href="Machine-Desc.html#Machine-Desc" title="Machine Desc">
|
|
<link rel="prev" href="Conditional-Execution.html#Conditional-Execution" title="Conditional Execution">
|
|
<link rel="next" href="Constant-Definitions.html#Constant-Definitions" title="Constant Definitions">
|
|
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
|
|
<!--
|
|
Copyright (C) 1988-2015 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.-->
|
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
|
<style type="text/css"><!--
|
|
pre.display { font-family:inherit }
|
|
pre.format { font-family:inherit }
|
|
pre.smalldisplay { font-family:inherit; font-size:smaller }
|
|
pre.smallformat { font-family:inherit; font-size:smaller }
|
|
pre.smallexample { font-size:smaller }
|
|
pre.smalllisp { font-size:smaller }
|
|
span.sc { font-variant:small-caps }
|
|
span.roman { font-family:serif; font-weight:normal; }
|
|
span.sansserif { font-family:sans-serif; font-weight:normal; }
|
|
--></style>
|
|
</head>
|
|
<body>
|
|
<div class="node">
|
|
<a name="Define-Subst"></a>
|
|
<p>
|
|
Next: <a rel="next" accesskey="n" href="Constant-Definitions.html#Constant-Definitions">Constant Definitions</a>,
|
|
Previous: <a rel="previous" accesskey="p" href="Conditional-Execution.html#Conditional-Execution">Conditional Execution</a>,
|
|
Up: <a rel="up" accesskey="u" href="Machine-Desc.html#Machine-Desc">Machine Desc</a>
|
|
<hr>
|
|
</div>
|
|
|
|
<h3 class="section">16.21 RTL Templates Transformations</h3>
|
|
|
|
<p><a name="index-define_005fsubst-3823"></a>
|
|
For some hardware architectures there are common cases when the RTL
|
|
templates for the instructions can be derived from the other RTL
|
|
templates using simple transformations. E.g., <samp><span class="file">i386.md</span></samp> contains
|
|
an RTL template for the ordinary <code>sub</code> instruction—
|
|
<code>*subsi_1</code>, and for the <code>sub</code> instruction with subsequent
|
|
zero-extension—<code>*subsi_1_zext</code>. Such cases can be easily
|
|
implemented by a single meta-template capable of generating a modified
|
|
case based on the initial one:
|
|
|
|
<p><a name="index-define_005fsubst-3824"></a>
|
|
<pre class="smallexample"> (define_subst "<var>name</var>"
|
|
[<var>input-template</var>]
|
|
"<var>condition</var>"
|
|
[<var>output-template</var>])
|
|
</pre>
|
|
<p><var>input-template</var> is a pattern describing the source RTL template,
|
|
which will be transformed.
|
|
|
|
<p><var>condition</var> is a C expression that is conjunct with the condition
|
|
from the input-template to generate a condition to be used in the
|
|
output-template.
|
|
|
|
<p><var>output-template</var> is a pattern that will be used in the resulting
|
|
template.
|
|
|
|
<p><code>define_subst</code> mechanism is tightly coupled with the notion of the
|
|
subst attribute (see <a href="Subst-Iterators.html#Subst-Iterators">Subst Iterators</a>). The use of
|
|
<code>define_subst</code> is triggered by a reference to a subst attribute in
|
|
the transforming RTL template. This reference initiates duplication of
|
|
the source RTL template and substitution of the attributes with their
|
|
values. The source RTL template is left unchanged, while the copy is
|
|
transformed by <code>define_subst</code>. This transformation can fail in the
|
|
case when the source RTL template is not matched against the
|
|
input-template of the <code>define_subst</code>. In such case the copy is
|
|
deleted.
|
|
|
|
<p><code>define_subst</code> can be used only in <code>define_insn</code> and
|
|
<code>define_expand</code>, it cannot be used in other expressions (e.g. in
|
|
<code>define_insn_and_split</code>).
|
|
|
|
<ul class="menu">
|
|
<li><a accesskey="1" href="Define-Subst-Example.html#Define-Subst-Example">Define Subst Example</a>: Example of <code>define_subst</code> work.
|
|
<li><a accesskey="2" href="Define-Subst-Pattern-Matching.html#Define-Subst-Pattern-Matching">Define Subst Pattern Matching</a>: Process of template comparison.
|
|
<li><a accesskey="3" href="Define-Subst-Output-Template.html#Define-Subst-Output-Template">Define Subst Output Template</a>: Generation of output template.
|
|
</ul>
|
|
|
|
</body></html>
|
|
|