conditions.h 3.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /* Definitions for condition code handling in final.c and output routines.
  2. Copyright (C) 1987 Free Software Foundation, Inc.
  3. This file is part of GNU CC.
  4. GNU CC is distributed in the hope that it will be useful,
  5. but WITHOUT ANY WARRANTY. No author or distributor
  6. accepts responsibility to anyone for the consequences of using it
  7. or for whether it serves any particular purpose or works at all,
  8. unless he says so in writing. Refer to the GNU CC General Public
  9. License for full details.
  10. Everyone is granted permission to copy, modify and redistribute
  11. GNU CC, but only under the conditions described in the
  12. GNU CC General Public License. A copy of this license is
  13. supposed to have been given to you along with GNU CC so you
  14. can know your rights and responsibilities. It should be in a
  15. file named COPYING. Among other things, the copyright notice
  16. and this notice must be preserved on all copies. */
  17. /* The variable cc_status says how to interpret the condition code.
  18. It is set by output routines for an instruction that sets the cc's
  19. and examined by output routines for jump instructions.
  20. cc_status contains two components named `value1' and `value2'
  21. that record two equivalent expressions for the values that the
  22. condition codes were set from. (Either or both may be null if
  23. there is no useful expression to record.) These fields are
  24. used for eliminating redundant test and compare instructions
  25. in the cases where the condition codes were already set by the
  26. previous instruction.
  27. cc_status.flags contains flags which say that the condition codes
  28. were set in a nonstandard manner. The output of jump instructions
  29. uses these flags to compensate and produce the standard result
  30. with the nonstandard condition codes. Standard flags are defined here.
  31. The tm- file can also define other machine-dependent flags.
  32. cc_status also contains a machine-dependent component `mdep'
  33. whose type, `CC_STATUS_MDEP', may be defined as a macro in the
  34. tm- file. */
  35. #ifndef CC_STATUS_MDEP
  36. #define CC_STATUS_MDEP int
  37. #endif
  38. #ifndef CC_STATUS_MDEP_INIT
  39. #define CC_STATUS_MDEP_INIT 0
  40. #endif
  41. typedef struct {int flags; rtx value1, value2; CC_STATUS_MDEP mdep;} CC_STATUS;
  42. extern CC_STATUS cc_status;
  43. /* These are the machine-independent flags: */
  44. /* Set if the sign of the cc value is inverted:
  45. output a following jump-if-less as a jump-if-greater, etc. */
  46. #define CC_REVERSED 1
  47. /* This bit means that the current setting of the N bit is bogus
  48. and conditional jumps should use the Z bit in its place.
  49. This state obtains when an extraction of a signed single-bit field
  50. or an arithmetic shift right of a byte by 7 bits
  51. is turned into a btst, because btst does not set the N bit. */
  52. #define CC_NOT_POSITIVE 2
  53. /* This bit means that the current setting of the N bit is bogus
  54. and conditional jumps should pretend that the N bit is clear.
  55. Used after extraction of an unsigned bit
  56. or logical shift right of a byte by 7 bits is turned into a btst.
  57. The btst does not alter the N bit, but the result of that shift
  58. or extract is never negative. */
  59. #define CC_NOT_NEGATIVE 4
  60. /* This bit means that the current setting of the overflow flag
  61. is bogus and conditional jumps should pretend there is no overflow. */
  62. #define CC_NO_OVERFLOW 010
  63. /* This bit means that what ought to be in the Z bit
  64. should be tested as the complement of the N bit. */
  65. #define CC_Z_IN_NOT_N 020
  66. /* This is how to initialize the variable cc_status.
  67. final does this at appropriate moments. */
  68. #define CC_STATUS_INIT \
  69. (cc_status.flags = 0, cc_status.value1 = 0, cc_status.value2 = 0, \
  70. CC_STATUS_MDEP_INIT)