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