|
|
1.1 root 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 2, 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: /* 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: #define CC_NO_OVERFLOW 010
88:
89: /* This bit means that what ought to be in the Z bit
90: should be tested as the complement of the N bit. */
91: #define CC_Z_IN_NOT_N 020
92:
93: /* This bit means that what ought to be in the Z bit
94: should be tested as the N bit. */
95: #define CC_Z_IN_N 040
96:
97: /* Nonzero if we must invert the sense of the following branch, i.e.
98: change EQ to NE. This is not safe for IEEE floating point operations!
99: It is intended for use only when a combination of arithmetic
100: or logical insns can leave the condition codes set in a fortuitous
101: (though inverted) state. */
102: #define CC_INVERTED 0100
103:
104: /* Nonzero if we must convert signed condition operators to unsigned.
105: This is only used by machine description files. */
106: #define CC_NOT_SIGNED 0200
107:
108: /* This is how to initialize the variable cc_status.
109: final does this at appropriate moments. */
110:
111: #define CC_STATUS_INIT \
112: (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \
113: CC_STATUS_MDEP_INIT)
114:
115: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.