home *** CD-ROM | disk | FTP | other *** search
/ Education Sampler 1992 [NeXTSTEP] / Education_1992_Sampler.iso / NeXT / GnuSource / cc-61.0.1 / cc / machmode.h < prev    next >
C/C++ Source or Header  |  1991-06-03  |  3KB  |  97 lines

  1. /* Machine mode definitions for GNU C-Compiler; included by rtl.h and tree.h.
  2.    Copyright (C) 1990 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.  
  21. #ifndef HAVE_MACHINE_MODES
  22.  
  23. #define DEF_MACHMODE(SYM, NAME, TYPE, SIZE, UNIT, WIDER)  SYM,
  24.  
  25. enum machine_mode {
  26. #include "machmode.def"
  27.  
  28. #ifdef EXTRA_CC_MODES
  29.   EXTRA_CC_MODES,
  30. #endif
  31. MAX_MACHINE_MODE };
  32.  
  33. #undef DEF_MACHMODE
  34.  
  35. #define HAVE_MACHINE_MODES
  36.  
  37. #ifndef NUM_MACHINE_MODES
  38. #define NUM_MACHINE_MODES (int) MAX_MACHINE_MODE
  39. #endif
  40.  
  41. /* Get the name of mode MODE as a string.  */
  42.  
  43. extern char *mode_name[];
  44. #define GET_MODE_NAME(MODE)        (mode_name[(int)(MODE)])
  45.  
  46. enum mode_class { MODE_RANDOM, MODE_INT, MODE_FLOAT, MODE_PARTIAL_INT, MODE_CC,
  47.           MODE_COMPLEX_INT, MODE_COMPLEX_FLOAT };
  48.  
  49. /* Get the general kind of object that mode MODE represents
  50.    (integer, floating, complex, etc.)  */
  51.  
  52. extern enum mode_class mode_class[];
  53. #define GET_MODE_CLASS(MODE)        (mode_class[(int)(MODE)])
  54.  
  55. /* Get the size in bytes of an object of mode MODE.  */
  56.  
  57. extern int mode_size[];
  58. #define GET_MODE_SIZE(MODE)        (mode_size[(int)(MODE)])
  59.  
  60. /* Get the size in bytes of the basic parts of an object of mode MODE.  */
  61.  
  62. extern int mode_unit_size[];
  63. #define GET_MODE_UNIT_SIZE(MODE)    (mode_unit_size[(int)(MODE)])
  64.  
  65. /* Get the number of units in the object.  */
  66.  
  67. #define GET_MODE_NUNITS(MODE)  \
  68.   (GET_MODE_SIZE ((MODE)) / GET_MODE_UNIT_SIZE ((MODE)))
  69.  
  70. /* Get the size in bits of an object of mode MODE.  */
  71.  
  72. #define GET_MODE_BITSIZE(MODE)  (BITS_PER_UNIT * mode_size[(int)(MODE)])
  73.  
  74. /* Get a bitmask containing 1 for all bits in a word
  75.    that fit within mode MODE.  */
  76.  
  77. #define GET_MODE_MASK(MODE)  \
  78.    ((GET_MODE_BITSIZE (MODE) >= HOST_BITS_PER_INT)  \
  79.     ? -1 : ((1 << GET_MODE_BITSIZE (MODE)) - 1))
  80.  
  81. /* Get the next wider natural mode (eg, QI -> HI -> SI -> DI -> TI).  */
  82.  
  83. extern enum machine_mode mode_wider_mode[];
  84. #define GET_MODE_WIDER_MODE(MODE)    (mode_wider_mode[(int)(MODE)])
  85.  
  86. /* Find the best mode to use to access a bit field.  */
  87.  
  88. extern enum machine_mode get_best_mode ();
  89.  
  90. /* Determine alignment, 1<=result<=BIGGEST_ALIGNMENT.  */
  91.  
  92. #define GET_MODE_ALIGNMENT(MODE)   \
  93.   MIN (BIGGEST_ALIGNMENT,        \
  94.        MAX (1, (GET_MODE_UNIT_SIZE (MODE) * BITS_PER_UNIT)))
  95.  
  96. #endif /* not HAVE_MACHINE_MODES */
  97.