You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

131 lines
6.4KB

  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-2020 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 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Jump Patterns (GNU Compiler Collection (GCC) Internals)</title>
  21. <meta name="description" content="Jump Patterns (GNU Compiler Collection (GCC) Internals)">
  22. <meta name="keywords" content="Jump Patterns (GNU Compiler Collection (GCC) Internals)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  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="Machine-Desc.html#Machine-Desc" rel="up" title="Machine Desc">
  30. <link href="Looping-Patterns.html#Looping-Patterns" rel="next" title="Looping Patterns">
  31. <link href="Dependent-Patterns.html#Dependent-Patterns" rel="prev" title="Dependent Patterns">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  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.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Jump-Patterns"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Looping-Patterns.html#Looping-Patterns" accesskey="n" rel="next">Looping Patterns</a>, Previous: <a href="Dependent-Patterns.html#Dependent-Patterns" accesskey="p" rel="prev">Dependent Patterns</a>, Up: <a href="Machine-Desc.html#Machine-Desc" accesskey="u" rel="up">Machine Desc</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>
  65. </div>
  66. <hr>
  67. <a name="Defining-Jump-Instruction-Patterns"></a>
  68. <h3 class="section">17.12 Defining Jump Instruction Patterns</h3>
  69. <a name="index-jump-instruction-patterns"></a>
  70. <a name="index-defining-jump-instruction-patterns"></a>
  71. <p>GCC does not assume anything about how the machine realizes jumps.
  72. The machine description should define a single pattern, usually
  73. a <code>define_expand</code>, which expands to all the required insns.
  74. </p>
  75. <p>Usually, this would be a comparison insn to set the condition code
  76. and a separate branch insn testing the condition code and branching
  77. or not according to its value. For many machines, however,
  78. separating compares and branches is limiting, which is why the
  79. more flexible approach with one <code>define_expand</code> is used in GCC.
  80. The machine description becomes clearer for architectures that
  81. have compare-and-branch instructions but no condition code. It also
  82. works better when different sets of comparison operators are supported
  83. by different kinds of conditional branches (e.g. integer vs.
  84. floating-point), or by conditional branches with respect to conditional stores.
  85. </p>
  86. <p>Two separate insns are always used if the machine description represents
  87. a condition code register using the legacy RTL expression <code>(cc0)</code>,
  88. and on most machines that use a separate condition code register
  89. (see <a href="Condition-Code.html#Condition-Code">Condition Code</a>). For machines that use <code>(cc0)</code>, in
  90. fact, the set and use of the condition code must be separate and
  91. adjacent<a name="DOCF4" href="#FOOT4"><sup>4</sup></a>, thus
  92. allowing flags in <code>cc_status</code> to be used (see <a href="Condition-Code.html#Condition-Code">Condition Code</a>) and
  93. so that the comparison and branch insns could be located from each other
  94. by using the functions <code>prev_cc0_setter</code> and <code>next_cc0_user</code>.
  95. </p>
  96. <p>Even in this case having a single entry point for conditional branches
  97. is advantageous, because it handles equally well the case where a single
  98. comparison instruction records the results of both signed and unsigned
  99. comparison of the given operands (with the branch insns coming in distinct
  100. signed and unsigned flavors) as in the x86 or SPARC, and the case where
  101. there are distinct signed and unsigned compare instructions and only
  102. one set of conditional branch instructions as in the PowerPC.
  103. </p>
  104. <div class="footnote">
  105. <hr>
  106. <h4 class="footnotes-heading">Footnotes</h4>
  107. <h3><a name="FOOT4" href="#DOCF4">(4)</a></h3>
  108. <p><code>note</code> insns can separate them, though.</p>
  109. </div>
  110. <hr>
  111. <div class="header">
  112. <p>
  113. Next: <a href="Looping-Patterns.html#Looping-Patterns" accesskey="n" rel="next">Looping Patterns</a>, Previous: <a href="Dependent-Patterns.html#Dependent-Patterns" accesskey="p" rel="prev">Dependent Patterns</a>, Up: <a href="Machine-Desc.html#Machine-Desc" accesskey="u" rel="up">Machine Desc</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>
  114. </div>
  115. </body>
  116. </html>