stor-layout.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /* Definitions and declarations for stor-layout.c.
  2. Copyright (C) 2013-2015 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify it under
  5. the terms of the GNU General Public License as published by the Free
  6. Software Foundation; either version 3, or (at your option) any later
  7. version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  9. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  11. for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GCC; see the file COPYING3. If not see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef GCC_STOR_LAYOUT_H
  16. #define GCC_STOR_LAYOUT_H
  17. extern void set_min_and_max_values_for_integral_type (tree, int, signop);
  18. extern void fixup_signed_type (tree);
  19. extern void internal_reference_types (void);
  20. extern unsigned int update_alignment_for_field (record_layout_info, tree,
  21. unsigned int);
  22. extern record_layout_info start_record_layout (tree);
  23. extern tree bit_from_pos (tree, tree);
  24. extern tree byte_from_pos (tree, tree);
  25. extern void pos_from_bit (tree *, tree *, unsigned int, tree);
  26. extern void normalize_offset (tree *, tree *, unsigned int);
  27. extern tree rli_size_unit_so_far (record_layout_info);
  28. extern tree rli_size_so_far (record_layout_info);
  29. extern void normalize_rli (record_layout_info);
  30. extern void place_field (record_layout_info, tree);
  31. extern void compute_record_mode (tree);
  32. extern void finish_bitfield_layout (tree);
  33. extern void finish_record_layout (record_layout_info, int);
  34. extern unsigned int element_precision (const_tree);
  35. extern void finalize_size_functions (void);
  36. extern void fixup_unsigned_type (tree);
  37. extern void initialize_sizetypes (void);
  38. /* Finish up a builtin RECORD_TYPE. Give it a name and provide its
  39. fields. Optionally specify an alignment, and then lay it out. */
  40. extern void finish_builtin_struct (tree, const char *, tree, tree);
  41. /* Given a VAR_DECL, PARM_DECL, RESULT_DECL or FIELD_DECL node,
  42. calculates the DECL_SIZE, DECL_SIZE_UNIT, DECL_ALIGN and DECL_MODE
  43. fields. Call this only once for any given decl node.
  44. Second argument is the boundary that this field can be assumed to
  45. be starting at (in bits). Zero means it can be assumed aligned
  46. on any boundary that may be needed. */
  47. extern void layout_decl (tree, unsigned);
  48. /* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
  49. TYPE_ALIGN and TYPE_MODE fields. If called more than once on one
  50. node, does nothing except for the first time. */
  51. extern void layout_type (tree);
  52. /* Return the least alignment in bytes required for type TYPE. */
  53. extern unsigned int min_align_of_type (tree);
  54. /* Construct various nodes representing fract or accum data types. */
  55. extern tree make_fract_type (int, int, int);
  56. extern tree make_accum_type (int, int, int);
  57. #define make_signed_fract_type(P) make_fract_type (P, 0, 0)
  58. #define make_unsigned_fract_type(P) make_fract_type (P, 1, 0)
  59. #define make_sat_signed_fract_type(P) make_fract_type (P, 0, 1)
  60. #define make_sat_unsigned_fract_type(P) make_fract_type (P, 1, 1)
  61. #define make_signed_accum_type(P) make_accum_type (P, 0, 0)
  62. #define make_unsigned_accum_type(P) make_accum_type (P, 1, 0)
  63. #define make_sat_signed_accum_type(P) make_accum_type (P, 0, 1)
  64. #define make_sat_unsigned_accum_type(P) make_accum_type (P, 1, 1)
  65. #define make_or_reuse_signed_fract_type(P) \
  66. make_or_reuse_fract_type (P, 0, 0)
  67. #define make_or_reuse_unsigned_fract_type(P) \
  68. make_or_reuse_fract_type (P, 1, 0)
  69. #define make_or_reuse_sat_signed_fract_type(P) \
  70. make_or_reuse_fract_type (P, 0, 1)
  71. #define make_or_reuse_sat_unsigned_fract_type(P) \
  72. make_or_reuse_fract_type (P, 1, 1)
  73. #define make_or_reuse_signed_accum_type(P) \
  74. make_or_reuse_accum_type (P, 0, 0)
  75. #define make_or_reuse_unsigned_accum_type(P) \
  76. make_or_reuse_accum_type (P, 1, 0)
  77. #define make_or_reuse_sat_signed_accum_type(P) \
  78. make_or_reuse_accum_type (P, 0, 1)
  79. #define make_or_reuse_sat_unsigned_accum_type(P) \
  80. make_or_reuse_accum_type (P, 1, 1)
  81. extern tree make_signed_type (int);
  82. extern tree make_unsigned_type (int);
  83. /* Return the mode for data of a given size SIZE and mode class CLASS.
  84. If LIMIT is nonzero, then don't use modes bigger than MAX_FIXED_MODE_SIZE.
  85. The value is BLKmode if no other mode is found. This is like
  86. mode_for_size, but is passed a tree. */
  87. extern machine_mode mode_for_size_tree (const_tree, enum mode_class, int);
  88. extern tree bitwise_type_for_mode (machine_mode);
  89. /* Given a VAR_DECL, PARM_DECL or RESULT_DECL, clears the results of
  90. a previous call to layout_decl and calls it again. */
  91. extern void relayout_decl (tree);
  92. /* variable_size (EXP) is like save_expr (EXP) except that it
  93. is for the special case of something that is part of a
  94. variable size for a data type. It makes special arrangements
  95. to compute the value at the right time when the data type
  96. belongs to a function parameter. */
  97. extern tree variable_size (tree);
  98. /* Vector types need to check target flags to determine type. */
  99. extern machine_mode vector_type_mode (const_tree);
  100. #endif // GCC_STOR_LAYOUT_H