]>
Commit | Line | Data |
---|---|---|
bf55c04f | 1 | /* Definitions for condition code handling in final.c and output routines. |
818ab71a | 2 | Copyright (C) 1987-2016 Free Software Foundation, Inc. |
bf55c04f | 3 | |
1322177d | 4 | This file is part of GCC. |
bf55c04f | 5 | |
1322177d LB |
6 | GCC is free software; you can redistribute it and/or modify it under |
7 | the terms of the GNU General Public License as published by the Free | |
9dcd6f09 | 8 | Software Foundation; either version 3, or (at your option) any later |
1322177d | 9 | version. |
bf55c04f | 10 | |
1322177d LB |
11 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
12 | WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
14 | for more details. | |
bf55c04f CH |
15 | |
16 | You should have received a copy of the GNU General Public License | |
9dcd6f09 NC |
17 | along with GCC; see the file COPYING3. If not see |
18 | <http://www.gnu.org/licenses/>. */ | |
bf55c04f | 19 | |
f1717f8d KC |
20 | #ifndef GCC_CONDITIONS_H |
21 | #define GCC_CONDITIONS_H | |
22 | ||
bf55c04f CH |
23 | /* The variable cc_status says how to interpret the condition code. |
24 | It is set by output routines for an instruction that sets the cc's | |
25 | and examined by output routines for jump instructions. | |
26 | ||
27 | cc_status contains two components named `value1' and `value2' | |
28 | that record two equivalent expressions for the values that the | |
29 | condition codes were set from. (Either or both may be null if | |
30 | there is no useful expression to record.) These fields are | |
31 | used for eliminating redundant test and compare instructions | |
32 | in the cases where the condition codes were already set by the | |
33 | previous instruction. | |
34 | ||
35 | cc_status.flags contains flags which say that the condition codes | |
36 | were set in a nonstandard manner. The output of jump instructions | |
37 | uses these flags to compensate and produce the standard result | |
38 | with the nonstandard condition codes. Standard flags are defined here. | |
39 | The tm.h file can also define other machine-dependent flags. | |
40 | ||
41 | cc_status also contains a machine-dependent component `mdep' | |
42 | whose type, `CC_STATUS_MDEP', may be defined as a macro in the | |
43 | tm.h file. */ | |
44 | ||
45 | #ifndef CC_STATUS_MDEP | |
46 | #define CC_STATUS_MDEP int | |
47 | #endif | |
48 | ||
49 | #ifndef CC_STATUS_MDEP_INIT | |
50 | #define CC_STATUS_MDEP_INIT 0 | |
51 | #endif | |
52 | ||
84562394 | 53 | struct CC_STATUS {int flags; rtx value1, value2; CC_STATUS_MDEP mdep;}; |
bf55c04f CH |
54 | |
55 | /* While outputting an insn as assembler code, | |
56 | this is the status BEFORE that insn. */ | |
57 | extern CC_STATUS cc_prev_status; | |
58 | ||
59 | /* While outputting an insn as assembler code, | |
60 | this is being altered to the status AFTER that insn. */ | |
61 | extern CC_STATUS cc_status; | |
62 | ||
63 | /* These are the machine-independent flags: */ | |
64 | ||
65 | /* Set if the sign of the cc value is inverted: | |
66 | output a following jump-if-less as a jump-if-greater, etc. */ | |
67 | #define CC_REVERSED 1 | |
68 | ||
69 | /* This bit means that the current setting of the N bit is bogus | |
70 | and conditional jumps should use the Z bit in its place. | |
71 | This state obtains when an extraction of a signed single-bit field | |
72 | or an arithmetic shift right of a byte by 7 bits | |
73 | is turned into a btst, because btst does not set the N bit. */ | |
74 | #define CC_NOT_POSITIVE 2 | |
75 | ||
76 | /* This bit means that the current setting of the N bit is bogus | |
77 | and conditional jumps should pretend that the N bit is clear. | |
78 | Used after extraction of an unsigned bit | |
79 | or logical shift right of a byte by 7 bits is turned into a btst. | |
80 | The btst does not alter the N bit, but the result of that shift | |
81 | or extract is never negative. */ | |
82 | #define CC_NOT_NEGATIVE 4 | |
83 | ||
84 | /* This bit means that the current setting of the overflow flag | |
85 | is bogus and conditional jumps should pretend there is no overflow. */ | |
d7083c81 DE |
86 | /* ??? Note that for most targets this macro is misnamed as it applies |
87 | to the carry flag, not the overflow flag. */ | |
bf55c04f CH |
88 | #define CC_NO_OVERFLOW 010 |
89 | ||
90 | /* This bit means that what ought to be in the Z bit | |
91 | should be tested as the complement of the N bit. */ | |
92 | #define CC_Z_IN_NOT_N 020 | |
93 | ||
94 | /* This bit means that what ought to be in the Z bit | |
95 | should be tested as the N bit. */ | |
96 | #define CC_Z_IN_N 040 | |
97 | ||
98 | /* Nonzero if we must invert the sense of the following branch, i.e. | |
99 | change EQ to NE. This is not safe for IEEE floating point operations! | |
100 | It is intended for use only when a combination of arithmetic | |
101 | or logical insns can leave the condition codes set in a fortuitous | |
102 | (though inverted) state. */ | |
103 | #define CC_INVERTED 0100 | |
104 | ||
e8a2790c | 105 | /* Nonzero if we must convert signed condition operators to unsigned. |
19eb1ad7 | 106 | This is only used by machine description files. */ |
e8a2790c JVA |
107 | #define CC_NOT_SIGNED 0200 |
108 | ||
bf55c04f CH |
109 | /* This is how to initialize the variable cc_status. |
110 | final does this at appropriate moments. */ | |
111 | ||
8778aed7 KT |
112 | /* FIXME: We want to get rid of these ifndefs. */ |
113 | #ifndef CC_STATUS_INIT | |
bf55c04f CH |
114 | #define CC_STATUS_INIT \ |
115 | (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \ | |
116 | CC_STATUS_MDEP_INIT) | |
8778aed7 | 117 | #endif |
f1717f8d | 118 | #endif /* GCC_CONDITIONS_H */ |