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