Commit | Line | Data |
---|---|---|
3b86acdb WJ |
1 | /* Definitions for condition code handling in final.c and output routines. |
2 | Copyright (C) 1987 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 1, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
19 | ||
20 | ||
21 | /* The variable cc_status says how to interpret the condition code. | |
22 | It is set by output routines for an instruction that sets the cc's | |
23 | and examined by output routines for jump instructions. | |
24 | ||
25 | cc_status contains two components named `value1' and `value2' | |
26 | that record two equivalent expressions for the values that the | |
27 | condition codes were set from. (Either or both may be null if | |
28 | there is no useful expression to record.) These fields are | |
29 | used for eliminating redundant test and compare instructions | |
30 | in the cases where the condition codes were already set by the | |
31 | previous instruction. | |
32 | ||
33 | cc_status.flags contains flags which say that the condition codes | |
34 | were set in a nonstandard manner. The output of jump instructions | |
35 | uses these flags to compensate and produce the standard result | |
36 | with the nonstandard condition codes. Standard flags are defined here. | |
37 | The tm- file can also define other machine-dependent flags. | |
38 | ||
39 | cc_status also contains a machine-dependent component `mdep' | |
40 | whose type, `CC_STATUS_MDEP', may be defined as a macro in the | |
41 | tm- file. */ | |
42 | ||
43 | #ifndef CC_STATUS_MDEP | |
44 | #define CC_STATUS_MDEP int | |
45 | #endif | |
46 | ||
47 | #ifndef CC_STATUS_MDEP_INIT | |
48 | #define CC_STATUS_MDEP_INIT 0 | |
49 | #endif | |
50 | ||
51 | typedef struct {int flags; rtx value1, value2; CC_STATUS_MDEP mdep;} CC_STATUS; | |
52 | ||
53 | /* While outputting an insn as assembler code, | |
54 | this is the status BEFORE that insn. */ | |
55 | extern CC_STATUS cc_prev_status; | |
56 | ||
57 | /* While outputting an insn as assembler code, | |
58 | this is being altered to the status AFTER that insn. */ | |
59 | extern CC_STATUS cc_status; | |
60 | ||
61 | /* These are the machine-independent flags: */ | |
62 | ||
63 | /* Set if the sign of the cc value is inverted: | |
64 | output a following jump-if-less as a jump-if-greater, etc. */ | |
65 | #define CC_REVERSED 1 | |
66 | ||
67 | /* This bit means that the current setting of the N bit is bogus | |
68 | and conditional jumps should use the Z bit in its place. | |
69 | This state obtains when an extraction of a signed single-bit field | |
70 | or an arithmetic shift right of a byte by 7 bits | |
71 | is turned into a btst, because btst does not set the N bit. */ | |
72 | #define CC_NOT_POSITIVE 2 | |
73 | ||
74 | /* This bit means that the current setting of the N bit is bogus | |
75 | and conditional jumps should pretend that the N bit is clear. | |
76 | Used after extraction of an unsigned bit | |
77 | or logical shift right of a byte by 7 bits is turned into a btst. | |
78 | The btst does not alter the N bit, but the result of that shift | |
79 | or extract is never negative. */ | |
80 | #define CC_NOT_NEGATIVE 4 | |
81 | ||
82 | /* This bit means that the current setting of the overflow flag | |
83 | is bogus and conditional jumps should pretend there is no overflow. */ | |
84 | #define CC_NO_OVERFLOW 010 | |
85 | ||
86 | /* This bit means that what ought to be in the Z bit | |
87 | should be tested as the complement of the N bit. */ | |
88 | #define CC_Z_IN_NOT_N 020 | |
89 | ||
90 | /* This bit means that what ought to be in the Z bit | |
91 | should be tested as the N bit. */ | |
92 | #define CC_Z_IN_N 040 | |
93 | ||
94 | /* This is how to initialize the variable cc_status. | |
95 | final does this at appropriate moments. */ | |
96 | ||
97 | #define CC_STATUS_INIT \ | |
98 | (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \ | |
99 | CC_STATUS_MDEP_INIT) |