gensupport.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* Declarations for rtx-reader support for gen* routines.
  2. Copyright (C) 2000-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_GENSUPPORT_H
  16. #define GCC_GENSUPPORT_H
  17. struct obstack;
  18. extern struct obstack *rtl_obstack;
  19. extern bool init_rtx_reader_args_cb (int, char **, bool (*)(const char *));
  20. extern bool init_rtx_reader_args (int, char **);
  21. extern rtx read_md_rtx (int *, int *);
  22. /* Set this to 0 to disable automatic elision of insn patterns which
  23. can never be used in this configuration. See genconditions.c.
  24. Must be set before calling init_md_reader. */
  25. extern int insn_elision;
  26. /* If the C test passed as the argument can be evaluated at compile
  27. time, return its truth value; else return -1. The test must have
  28. appeared somewhere in the machine description when genconditions
  29. was run. */
  30. extern int maybe_eval_c_test (const char *);
  31. /* Add an entry to the table of conditions. Used by genconditions and
  32. by read-rtl.c. */
  33. extern void add_c_test (const char *, int);
  34. /* This structure is used internally by gensupport.c and genconditions.c. */
  35. struct c_test
  36. {
  37. const char *expr;
  38. int value;
  39. };
  40. #ifdef __HASHTAB_H__
  41. extern hashval_t hash_c_test (const void *);
  42. extern int cmp_c_test (const void *, const void *);
  43. extern void traverse_c_tests (htab_trav, void *);
  44. #endif
  45. /* Predicate handling: helper functions and data structures. */
  46. struct pred_data
  47. {
  48. struct pred_data *next; /* for iterating over the set of all preds */
  49. const char *name; /* predicate name */
  50. bool special; /* special handling of modes? */
  51. /* data used primarily by genpreds.c */
  52. const char *c_block; /* C test block */
  53. rtx exp; /* RTL test expression */
  54. /* data used primarily by genrecog.c */
  55. enum rtx_code singleton; /* if pred takes only one code, that code */
  56. int num_codes; /* number of codes accepted */
  57. bool allows_non_lvalue; /* if pred allows non-lvalue expressions */
  58. bool allows_non_const; /* if pred allows non-const expressions */
  59. bool codes[NUM_RTX_CODE]; /* set of codes accepted */
  60. };
  61. extern struct pred_data *first_predicate;
  62. extern struct pred_data *lookup_predicate (const char *);
  63. extern void add_predicate_code (struct pred_data *, enum rtx_code);
  64. extern void add_predicate (struct pred_data *);
  65. #define FOR_ALL_PREDICATES(p) for (p = first_predicate; p; p = p->next)
  66. struct pattern_stats
  67. {
  68. /* The largest match_operand, match_operator or match_parallel
  69. number found. */
  70. int max_opno;
  71. /* The largest match_dup, match_op_dup or match_par_dup number found. */
  72. int max_dup_opno;
  73. /* The largest match_scratch number found. */
  74. int max_scratch_opno;
  75. /* The number of times match_dup, match_op_dup or match_par_dup appears
  76. in the pattern. */
  77. int num_dups;
  78. /* The number of rtx arguments to the generator function. */
  79. int num_generator_args;
  80. /* The number of rtx operands in an insn. */
  81. int num_insn_operands;
  82. /* The number of operand variables that are needed. */
  83. int num_operand_vars;
  84. };
  85. extern void get_pattern_stats (struct pattern_stats *ranges, rtvec vec);
  86. #endif /* GCC_GENSUPPORT_H */