Machine-Desc.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2017 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 5.2, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <title>GNU Compiler Collection (GCC) Internals: Machine Desc</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: Machine Desc">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: Machine Desc">
  22. <meta name="resource-type" content="document">
  23. <meta name="distribution" content="global">
  24. <meta name="Generator" content="makeinfo">
  25. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="index.html#Top" rel="up" title="Top">
  30. <link href="Overview.html#Overview" rel="next" title="Overview">
  31. <link href="Dependency-analysis.html#Dependency-analysis" rel="prev" title="Dependency analysis">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.smallquotation {font-size: smaller}
  36. div.display {margin-left: 3.2em}
  37. div.example {margin-left: 3.2em}
  38. div.indentedblock {margin-left: 3.2em}
  39. div.lisp {margin-left: 3.2em}
  40. div.smalldisplay {margin-left: 3.2em}
  41. div.smallexample {margin-left: 3.2em}
  42. div.smallindentedblock {margin-left: 3.2em; font-size: smaller}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style:oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nocodebreak {white-space:nowrap}
  54. span.nolinebreak {white-space:nowrap}
  55. span.roman {font-family:serif; font-weight:normal}
  56. span.sansserif {font-family:sans-serif; font-weight:normal}
  57. ul.no-bullet {list-style: none}
  58. -->
  59. </style>
  60. </head>
  61. <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
  62. <a name="Machine-Desc"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="Target-Macros.html#Target-Macros" accesskey="n" rel="next">Target Macros</a>, Previous: <a href="Loop-Analysis-and-Representation.html#Loop-Analysis-and-Representation" accesskey="p" rel="prev">Loop Analysis and Representation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<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>
  66. </div>
  67. <hr>
  68. <a name="Machine-Descriptions"></a>
  69. <h2 class="chapter">16 Machine Descriptions</h2>
  70. <a name="index-machine-descriptions"></a>
  71. <p>A machine description has two parts: a file of instruction patterns
  72. (<samp>.md</samp> file) and a C header file of macro definitions.
  73. </p>
  74. <p>The <samp>.md</samp> file for a target machine contains a pattern for each
  75. instruction that the target machine supports (or at least each instruction
  76. that is worth telling the compiler about). It may also contain comments.
  77. A semicolon causes the rest of the line to be a comment, unless the semicolon
  78. is inside a quoted string.
  79. </p>
  80. <p>See the next chapter for information on the C header file.
  81. </p>
  82. <table class="menu" border="0" cellspacing="0">
  83. <tr><td align="left" valign="top">&bull; <a href="Overview.html#Overview" accesskey="1">Overview</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How the machine description is used.
  84. </td></tr>
  85. <tr><td align="left" valign="top">&bull; <a href="Patterns.html#Patterns" accesskey="2">Patterns</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to write instruction patterns.
  86. </td></tr>
  87. <tr><td align="left" valign="top">&bull; <a href="Example.html#Example" accesskey="3">Example</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">An explained example of a <code>define_insn</code> pattern.
  88. </td></tr>
  89. <tr><td align="left" valign="top">&bull; <a href="RTL-Template.html#RTL-Template" accesskey="4">RTL Template</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The RTL template defines what insns match a pattern.
  90. </td></tr>
  91. <tr><td align="left" valign="top">&bull; <a href="Output-Template.html#Output-Template" accesskey="5">Output Template</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">The output template says how to make assembler code
  92. from such an insn.
  93. </td></tr>
  94. <tr><td align="left" valign="top">&bull; <a href="Output-Statement.html#Output-Statement" accesskey="6">Output Statement</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">For more generality, write C code to output
  95. the assembler code.
  96. </td></tr>
  97. <tr><td align="left" valign="top">&bull; <a href="Predicates.html#Predicates" accesskey="7">Predicates</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Controlling what kinds of operands can be used
  98. for an insn.
  99. </td></tr>
  100. <tr><td align="left" valign="top">&bull; <a href="Constraints.html#Constraints" accesskey="8">Constraints</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Fine-tuning operand selection.
  101. </td></tr>
  102. <tr><td align="left" valign="top">&bull; <a href="Standard-Names.html#Standard-Names" accesskey="9">Standard Names</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Names mark patterns to use for code generation.
  103. </td></tr>
  104. <tr><td align="left" valign="top">&bull; <a href="Pattern-Ordering.html#Pattern-Ordering">Pattern Ordering</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">When the order of patterns makes a difference.
  105. </td></tr>
  106. <tr><td align="left" valign="top">&bull; <a href="Dependent-Patterns.html#Dependent-Patterns">Dependent Patterns</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Having one pattern may make you need another.
  107. </td></tr>
  108. <tr><td align="left" valign="top">&bull; <a href="Jump-Patterns.html#Jump-Patterns">Jump Patterns</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Special considerations for patterns for jump insns.
  109. </td></tr>
  110. <tr><td align="left" valign="top">&bull; <a href="Looping-Patterns.html#Looping-Patterns">Looping Patterns</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">How to define patterns for special looping insns.
  111. </td></tr>
  112. <tr><td align="left" valign="top">&bull; <a href="Insn-Canonicalizations.html#Insn-Canonicalizations">Insn Canonicalizations</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Canonicalization of Instructions
  113. </td></tr>
  114. <tr><td align="left" valign="top">&bull; <a href="Expander-Definitions.html#Expander-Definitions">Expander Definitions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Generating a sequence of several RTL insns
  115. for a standard operation.
  116. </td></tr>
  117. <tr><td align="left" valign="top">&bull; <a href="Insn-Splitting.html#Insn-Splitting">Insn Splitting</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Splitting Instructions into Multiple Instructions.
  118. </td></tr>
  119. <tr><td align="left" valign="top">&bull; <a href="Including-Patterns.html#Including-Patterns">Including Patterns</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Including Patterns in Machine Descriptions.
  120. </td></tr>
  121. <tr><td align="left" valign="top">&bull; <a href="Peephole-Definitions.html#Peephole-Definitions">Peephole Definitions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Defining machine-specific peephole optimizations.
  122. </td></tr>
  123. <tr><td align="left" valign="top">&bull; <a href="Insn-Attributes.html#Insn-Attributes">Insn Attributes</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Specifying the value of attributes for generated insns.
  124. </td></tr>
  125. <tr><td align="left" valign="top">&bull; <a href="Conditional-Execution.html#Conditional-Execution">Conditional Execution</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Generating <code>define_insn</code> patterns for
  126. predication.
  127. </td></tr>
  128. <tr><td align="left" valign="top">&bull; <a href="Define-Subst.html#Define-Subst">Define Subst</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Generating <code>define_insn</code> and <code>define_expand</code>
  129. patterns from other patterns.
  130. </td></tr>
  131. <tr><td align="left" valign="top">&bull; <a href="Constant-Definitions.html#Constant-Definitions">Constant Definitions</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Defining symbolic constants that can be used in the
  132. md file.
  133. </td></tr>
  134. <tr><td align="left" valign="top">&bull; <a href="Iterators.html#Iterators">Iterators</a>:</td><td>&nbsp;&nbsp;</td><td align="left" valign="top">Using iterators to generate patterns from a template.
  135. </td></tr>
  136. </table>
  137. <hr>
  138. <div class="header">
  139. <p>
  140. Next: <a href="Target-Macros.html#Target-Macros" accesskey="n" rel="next">Target Macros</a>, Previous: <a href="Loop-Analysis-and-Representation.html#Loop-Analysis-and-Representation" accesskey="p" rel="prev">Loop Analysis and Representation</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> &nbsp; [<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>
  141. </div>
  142. </body>
  143. </html>