CC0-Condition-Codes.html 7.7 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: CC0 Condition Codes</title>
  20. <meta name="description" content="GNU Compiler Collection (GCC) Internals: CC0 Condition Codes">
  21. <meta name="keywords" content="GNU Compiler Collection (GCC) Internals: CC0 Condition Codes">
  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="Condition-Code.html#Condition-Code" rel="up" title="Condition Code">
  30. <link href="MODE_005fCC-Condition-Codes.html#MODE_005fCC-Condition-Codes" rel="next" title="MODE_CC Condition Codes">
  31. <link href="Condition-Code.html#Condition-Code" rel="prev" title="Condition Code">
  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="CC0-Condition-Codes"></a>
  63. <div class="header">
  64. <p>
  65. Next: <a href="MODE_005fCC-Condition-Codes.html#MODE_005fCC-Condition-Codes" accesskey="n" rel="next">MODE_CC Condition Codes</a>, Up: <a href="Condition-Code.html#Condition-Code" accesskey="u" rel="up">Condition Code</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="Representation-of-condition-codes-using-_0028cc0_0029"></a>
  69. <h4 class="subsection">17.15.1 Representation of condition codes using <code>(cc0)</code></h4>
  70. <a name="index-cc0-1"></a>
  71. <a name="index-cc_005fstatus"></a>
  72. <p>The file <samp>conditions.h</samp> defines a variable <code>cc_status</code> to
  73. describe how the condition code was computed (in case the interpretation of
  74. the condition code depends on the instruction that it was set by). This
  75. variable contains the RTL expressions on which the condition code is
  76. currently based, and several standard flags.
  77. </p>
  78. <p>Sometimes additional machine-specific flags must be defined in the machine
  79. description header file. It can also add additional machine-specific
  80. information by defining <code>CC_STATUS_MDEP</code>.
  81. </p>
  82. <dl>
  83. <dt><a name="index-CC_005fSTATUS_005fMDEP"></a>Macro: <strong>CC_STATUS_MDEP</strong></dt>
  84. <dd><p>C code for a data type which is used for declaring the <code>mdep</code>
  85. component of <code>cc_status</code>. It defaults to <code>int</code>.
  86. </p>
  87. <p>This macro is not used on machines that do not use <code>cc0</code>.
  88. </p></dd></dl>
  89. <dl>
  90. <dt><a name="index-CC_005fSTATUS_005fMDEP_005fINIT"></a>Macro: <strong>CC_STATUS_MDEP_INIT</strong></dt>
  91. <dd><p>A C expression to initialize the <code>mdep</code> field to &ldquo;empty&rdquo;.
  92. The default definition does nothing, since most machines don&rsquo;t use
  93. the field anyway. If you want to use the field, you should probably
  94. define this macro to initialize it.
  95. </p>
  96. <p>This macro is not used on machines that do not use <code>cc0</code>.
  97. </p></dd></dl>
  98. <dl>
  99. <dt><a name="index-NOTICE_005fUPDATE_005fCC"></a>Macro: <strong>NOTICE_UPDATE_CC</strong> <em>(<var>exp</var>, <var>insn</var>)</em></dt>
  100. <dd><p>A C compound statement to set the components of <code>cc_status</code>
  101. appropriately for an insn <var>insn</var> whose body is <var>exp</var>. It is
  102. this macro&rsquo;s responsibility to recognize insns that set the condition
  103. code as a byproduct of other activity as well as those that explicitly
  104. set <code>(cc0)</code>.
  105. </p>
  106. <p>This macro is not used on machines that do not use <code>cc0</code>.
  107. </p>
  108. <p>If there are insns that do not set the condition code but do alter
  109. other machine registers, this macro must check to see whether they
  110. invalidate the expressions that the condition code is recorded as
  111. reflecting. For example, on the 68000, insns that store in address
  112. registers do not set the condition code, which means that usually
  113. <code>NOTICE_UPDATE_CC</code> can leave <code>cc_status</code> unaltered for such
  114. insns. But suppose that the previous insn set the condition code
  115. based on location &lsquo;<samp>a4@(102)</samp>&rsquo; and the current insn stores a new
  116. value in &lsquo;<samp>a4</samp>&rsquo;. Although the condition code is not changed by
  117. this, it will no longer be true that it reflects the contents of
  118. &lsquo;<samp>a4@(102)</samp>&rsquo;. Therefore, <code>NOTICE_UPDATE_CC</code> must alter
  119. <code>cc_status</code> in this case to say that nothing is known about the
  120. condition code value.
  121. </p>
  122. <p>The definition of <code>NOTICE_UPDATE_CC</code> must be prepared to deal
  123. with the results of peephole optimization: insns whose patterns are
  124. <code>parallel</code> RTXs containing various <code>reg</code>, <code>mem</code> or
  125. constants which are just the operands. The RTL structure of these
  126. insns is not sufficient to indicate what the insns actually do. What
  127. <code>NOTICE_UPDATE_CC</code> should do when it sees one is just to run
  128. <code>CC_STATUS_INIT</code>.
  129. </p>
  130. <p>A possible definition of <code>NOTICE_UPDATE_CC</code> is to call a function
  131. that looks at an attribute (see <a href="Insn-Attributes.html#Insn-Attributes">Insn Attributes</a>) named, for example,
  132. &lsquo;<samp>cc</samp>&rsquo;. This avoids having detailed information about patterns in
  133. two places, the <samp>md</samp> file and in <code>NOTICE_UPDATE_CC</code>.
  134. </p></dd></dl>
  135. <hr>
  136. <div class="header">
  137. <p>
  138. Next: <a href="MODE_005fCC-Condition-Codes.html#MODE_005fCC-Condition-Codes" accesskey="n" rel="next">MODE_CC Condition Codes</a>, Up: <a href="Condition-Code.html#Condition-Code" accesskey="u" rel="up">Condition Code</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>
  139. </div>
  140. </body>
  141. </html>