No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

152 líneas
5.4KB

  1. /* Functions and structures shared between arm and aarch64.
  2. Copyright (C) 1991-2020 Free Software Foundation, Inc.
  3. Contributed by ARM Ltd.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published
  7. by the Free Software Foundation; either version 3, or (at your
  8. option) any later version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT
  10. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  12. License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_AARCH_COMMON_PROTOS_H
  17. #define GCC_AARCH_COMMON_PROTOS_H
  18. #include "hard-reg-set.h"
  19. extern int aarch_accumulator_forwarding (rtx_insn *, rtx_insn *);
  20. extern bool aarch_rev16_p (rtx);
  21. extern bool aarch_rev16_shleft_mask_imm_p (rtx, machine_mode);
  22. extern bool aarch_rev16_shright_mask_imm_p (rtx, machine_mode);
  23. extern bool aarch_mm_needs_acquire (rtx);
  24. extern bool aarch_mm_needs_release (rtx);
  25. extern int arm_early_load_addr_dep (rtx, rtx);
  26. extern int arm_early_load_addr_dep_ptr (rtx, rtx);
  27. extern int arm_early_store_addr_dep (rtx, rtx);
  28. extern int arm_early_store_addr_dep_ptr (rtx, rtx);
  29. extern int arm_mac_accumulator_is_mul_result (rtx, rtx);
  30. extern int arm_mac_accumulator_is_result (rtx, rtx);
  31. extern int arm_no_early_alu_shift_dep (rtx, rtx);
  32. extern int arm_no_early_alu_shift_value_dep (rtx, rtx);
  33. extern int arm_no_early_mul_dep (rtx, rtx);
  34. extern int arm_no_early_store_addr_dep (rtx, rtx);
  35. extern bool arm_rtx_shift_left_p (rtx);
  36. /* RTX cost table definitions. These are used when tuning for speed rather
  37. than for size and should reflect the _additional_ cost over the cost
  38. of the fastest instruction in the machine, which is COSTS_N_INSNS (1).
  39. Therefore it's okay for some costs to be 0.
  40. Costs may not have a negative value. */
  41. struct alu_cost_table
  42. {
  43. const int arith; /* ADD/SUB. */
  44. const int logical; /* AND/ORR/EOR/BIC, etc. */
  45. const int shift; /* Simple shift. */
  46. const int shift_reg; /* Simple shift by reg. */
  47. const int arith_shift; /* Additional when arith also shifts... */
  48. const int arith_shift_reg; /* ... and when the shift is by a reg. */
  49. const int log_shift; /* Additional when logic also shifts... */
  50. const int log_shift_reg; /* ... and when the shift is by a reg. */
  51. const int extend; /* Zero/sign extension. */
  52. const int extend_arith; /* Extend and arith. */
  53. const int bfi; /* Bit-field insert. */
  54. const int bfx; /* Bit-field extraction. */
  55. const int clz; /* Count Leading Zeros. */
  56. const int rev; /* Reverse bits/bytes. */
  57. const int non_exec; /* Extra cost when not executing insn. */
  58. const bool non_exec_costs_exec; /* True if non-execution must add the exec
  59. cost. */
  60. };
  61. struct mult_cost_table
  62. {
  63. const int simple;
  64. const int flag_setting; /* Additional cost if multiply sets flags. */
  65. const int extend;
  66. const int add;
  67. const int extend_add;
  68. const int idiv;
  69. };
  70. /* Calculations of LDM costs are complex. We assume an initial cost
  71. (ldm_1st) which will load the number of registers mentioned in
  72. ldm_regs_per_insn_1st registers; then each additional
  73. ldm_regs_per_insn_subsequent registers cost one more insn.
  74. Similarly for STM operations.
  75. Therefore the ldm_regs_per_insn_1st/stm_regs_per_insn_1st and
  76. ldm_regs_per_insn_subsequent/stm_regs_per_insn_subsequent fields indicate
  77. the number of registers loaded/stored and are expressed by a simple integer
  78. and not by a COSTS_N_INSNS (N) expression.
  79. */
  80. struct mem_cost_table
  81. {
  82. const int load;
  83. const int load_sign_extend; /* Additional to load cost. */
  84. const int ldrd; /* Cost of LDRD. */
  85. const int ldm_1st;
  86. const int ldm_regs_per_insn_1st;
  87. const int ldm_regs_per_insn_subsequent;
  88. const int loadf; /* SFmode. */
  89. const int loadd; /* DFmode. */
  90. const int load_unaligned; /* Extra for unaligned loads. */
  91. const int store;
  92. const int strd;
  93. const int stm_1st;
  94. const int stm_regs_per_insn_1st;
  95. const int stm_regs_per_insn_subsequent;
  96. const int storef; /* SFmode. */
  97. const int stored; /* DFmode. */
  98. const int store_unaligned; /* Extra for unaligned stores. */
  99. const int loadv; /* Vector load. */
  100. const int storev; /* Vector store. */
  101. };
  102. struct fp_cost_table
  103. {
  104. const int div;
  105. const int mult;
  106. const int mult_addsub; /* Non-fused. */
  107. const int fma; /* Fused. */
  108. const int addsub;
  109. const int fpconst; /* Immediate. */
  110. const int neg; /* NEG and ABS. */
  111. const int compare;
  112. const int widen; /* Widen to this size. */
  113. const int narrow; /* Narrow from this size. */
  114. const int toint;
  115. const int fromint;
  116. const int roundint; /* V8 round to integral, remains FP format. */
  117. };
  118. struct vector_cost_table
  119. {
  120. const int alu;
  121. };
  122. struct cpu_cost_table
  123. {
  124. const struct alu_cost_table alu;
  125. const struct mult_cost_table mult[2]; /* SImode and DImode. */
  126. const struct mem_cost_table ldst;
  127. const struct fp_cost_table fp[2]; /* SFmode and DFmode. */
  128. const struct vector_cost_table vect;
  129. };
  130. rtx_insn *
  131. arm_md_asm_adjust (vec<rtx> &outputs, vec<rtx> &/*inputs*/,
  132. vec<const char *> &constraints,
  133. vec<rtx> &clobbers, HARD_REG_SET &clobbered_regs);
  134. #endif /* GCC_AARCH_COMMON_PROTOS_H */