regrename.h 3.3 KB

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