ival.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * The Amsterdam Compiler Kit
  3. * See the copyright notice in the ACK home directory, in the file "Copyright".
  4. */
  5. #ifndef LANG_CEM_CEMCOM_ANSI_IVAL_H
  6. #define LANG_CEM_CEMCOM_ANSI_IVAL_H
  7. #include "estack.h"
  8. /* lang/cem/cemcom.ansi/ival.g */
  9. void gen_tpcheck(struct type **tpp);
  10. void gen_simple_exp(struct type **tpp, struct expr **expp);
  11. struct type **arr_elem(struct type **tpp, struct e_stack *p);
  12. struct sdef *next_field(struct sdef *sd, struct e_stack *p);
  13. struct type **gen_tphead(struct type **tpp, int nest);
  14. struct type **gen_tpmiddle();
  15. struct sdef *gen_align_to_next(struct e_stack *p);
  16. void gen_tpend();
  17. /* check_and_pad() is given a simple initialisation expression
  18. where the type can be either a simple or an aggregate type.
  19. In the latter case, only the first member is initialised and
  20. the rest is zeroed.
  21. */
  22. void check_and_pad(struct expr **expp, struct type **tpp);
  23. /* pad() fills an element of type tp with zeroes.
  24. If the element is an aggregate, pad() is called recursively.
  25. */
  26. void pad(struct type *tpx);
  27. /* check_ival() checks whether the initialisation of an element
  28. of a fundamental type is legal and, if so, performs the initialisation
  29. by directly generating the necessary code.
  30. No further comment is needed to explain the internal structure
  31. of this straightforward function.
  32. */
  33. void check_ival(struct expr **expp, struct type *tp);
  34. /* ch_array() initialises an array of characters when given
  35. a string constant.
  36. Alignment is taken care of.
  37. */
  38. /* tpp -> type tp = array of characters */
  39. void ch_array(struct type **tpp, struct expr *ex);
  40. /* As long as some parts of the pipeline cannot handle very long string
  41. constants, string constants are written out in chunks
  42. */
  43. void str_cst(char *str, int len, int inrom);
  44. #ifndef NOBITFIELD
  45. /* put_bf() takes care of the initialisation of (bit-)field
  46. selectors of a struct: each time such an initialisation takes place,
  47. put_bf() is called instead of the normal code generating routines.
  48. Put_bf() stores the given integral value into "field" and
  49. "throws" the result of "field" out if the current selector
  50. is the last of this number of fields stored at the same address.
  51. */
  52. void put_bf(struct type *tp, arith val);
  53. #endif /* NOBITFIELD */
  54. int zero_bytes(struct sdef *sd);
  55. int valid_type(struct type *tp, char *str);
  56. void con_int(struct expr *ex);
  57. void illegal_init_cst(struct expr *ex);
  58. void too_many_initialisers();
  59. #endif /* LANG_CEM_CEMCOM_ANSI_IVAL_H */