You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
3.5KB

  1. /* This file contains definitions for the register renamer.
  2. Copyright (C) 2011-2020 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_REGRENAME_H
  16. #define GCC_REGRENAME_H
  17. /* We keep linked lists of DU_HEAD structures, each of which describes
  18. a chain of occurrences of a reg. */
  19. class du_head
  20. {
  21. public:
  22. /* The next chain. */
  23. class du_head *next_chain;
  24. /* The first and last elements of this chain. */
  25. struct du_chain *first, *last;
  26. /* The chain that this chain is tied to. */
  27. class du_head *tied_chain;
  28. /* Describes the register being tracked. */
  29. unsigned regno;
  30. int nregs;
  31. /* A unique id to be used as an index into the conflicts bitmaps. */
  32. unsigned id;
  33. /* A bitmap to record conflicts with other chains. */
  34. bitmap_head conflicts;
  35. /* Conflicts with untracked hard registers. */
  36. HARD_REG_SET hard_conflicts;
  37. /* Which registers are fully or partially clobbered by the calls that
  38. the chain crosses. */
  39. HARD_REG_SET call_clobber_mask;
  40. /* A bitmask of ABIs used by the calls that the chain crosses. */
  41. unsigned int call_abis : NUM_ABI_IDS;
  42. /* Nonzero if the register is used in a way that prevents renaming,
  43. such as the SET_DEST of a CALL_INSN or an asm operand that used
  44. to be a hard register. */
  45. unsigned int cannot_rename:1;
  46. /* Nonzero if the chain has already been renamed. */
  47. unsigned int renamed:1;
  48. /* Fields for use by target code. */
  49. unsigned int target_data_1;
  50. unsigned int target_data_2;
  51. };
  52. typedef class du_head *du_head_p;
  53. /* This struct describes a single occurrence of a register. */
  54. struct du_chain
  55. {
  56. /* Links to the next occurrence of the register. */
  57. struct du_chain *next_use;
  58. /* The insn where the register appears. */
  59. rtx_insn *insn;
  60. /* The location inside the insn. */
  61. rtx *loc;
  62. /* The register class required by the insn at this location. */
  63. ENUM_BITFIELD(reg_class) cl : 16;
  64. };
  65. /* This struct describes data gathered during regrename_analyze about
  66. a single operand of an insn. */
  67. struct operand_rr_info
  68. {
  69. /* The number of chains recorded for this operand. */
  70. short n_chains;
  71. bool failed;
  72. /* Holds either the chain for the operand itself, or for the registers in
  73. a memory operand. */
  74. struct du_chain *chains[MAX_REGS_PER_ADDRESS];
  75. class du_head *heads[MAX_REGS_PER_ADDRESS];
  76. };
  77. /* A struct to hold a vector of operand_rr_info structures describing the
  78. operands of an insn. */
  79. struct insn_rr_info
  80. {
  81. operand_rr_info *op_info;
  82. };
  83. extern vec<insn_rr_info> insn_rr;
  84. extern void regrename_init (bool);
  85. extern void regrename_finish (void);
  86. extern void regrename_analyze (bitmap);
  87. extern du_head_p regrename_chain_from_id (unsigned int);
  88. extern int find_rename_reg (du_head_p, enum reg_class, HARD_REG_SET *, int,
  89. bool);
  90. extern bool regrename_do_replace (du_head_p, int);
  91. extern reg_class regrename_find_superclass (du_head_p, int *,
  92. HARD_REG_SET *);
  93. #endif