ifcvt.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* If-conversion header file.
  2. Copyright (C) 2014-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
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3, or (at your option)
  7. any later version.
  8. GCC is distributed in the hope that it will be useful, but WITHOUT
  9. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  11. License 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_IFCVT_H
  16. #define GCC_IFCVT_H
  17. /* Structure to group all of the information to process IF-THEN and
  18. IF-THEN-ELSE blocks for the conditional execution support. */
  19. struct ce_if_block
  20. {
  21. basic_block test_bb; /* First test block. */
  22. basic_block then_bb; /* THEN block. */
  23. basic_block else_bb; /* ELSE block or NULL. */
  24. basic_block join_bb; /* Join THEN/ELSE blocks. */
  25. basic_block last_test_bb; /* Last bb to hold && or || tests. */
  26. int num_multiple_test_blocks; /* # of && and || basic blocks. */
  27. int num_and_and_blocks; /* # of && blocks. */
  28. int num_or_or_blocks; /* # of || blocks. */
  29. int num_multiple_test_insns; /* # of insns in && and || blocks. */
  30. int and_and_p; /* Complex test is &&. */
  31. int num_then_insns; /* # of insns in THEN block. */
  32. int num_else_insns; /* # of insns in ELSE block. */
  33. int pass; /* Pass number. */
  34. };
  35. /* Used by noce_process_if_block to communicate with its subroutines.
  36. The subroutines know that A and B may be evaluated freely. They
  37. know that X is a register. They should insert new instructions
  38. before cond_earliest. */
  39. struct noce_if_info
  40. {
  41. /* The basic blocks that make up the IF-THEN-{ELSE-,}JOIN block. */
  42. basic_block test_bb, then_bb, else_bb, join_bb;
  43. /* The jump that ends TEST_BB. */
  44. rtx_insn *jump;
  45. /* The jump condition. */
  46. rtx cond;
  47. /* Reversed jump condition. */
  48. rtx rev_cond;
  49. /* New insns should be inserted before this one. */
  50. rtx_insn *cond_earliest;
  51. /* Insns in the THEN and ELSE block. There is always just this
  52. one insns in those blocks. The insns are single_set insns.
  53. If there was no ELSE block, INSN_B is the last insn before
  54. COND_EARLIEST, or NULL_RTX. In the former case, the insn
  55. operands are still valid, as if INSN_B was moved down below
  56. the jump. */
  57. rtx_insn *insn_a, *insn_b;
  58. /* The SET_SRC of INSN_A and INSN_B. */
  59. rtx a, b;
  60. /* The SET_DEST of INSN_A. */
  61. rtx x;
  62. /* The original set destination that the THEN and ELSE basic blocks finally
  63. write their result to. */
  64. rtx orig_x;
  65. /* True if this if block is not canonical. In the canonical form of
  66. if blocks, the THEN_BB is the block reached via the fallthru edge
  67. from TEST_BB. For the noce transformations, we allow the symmetric
  68. form as well. */
  69. bool then_else_reversed;
  70. /* True if the contents of then_bb and else_bb are a
  71. simple single set instruction. */
  72. bool then_simple;
  73. bool else_simple;
  74. /* True if we're optimisizing the control block for speed, false if
  75. we're optimizing for size. */
  76. bool speed_p;
  77. /* An estimate of the original costs. When optimizing for size, this is the
  78. combined cost of COND, JUMP and the costs for THEN_BB and ELSE_BB.
  79. When optimizing for speed, we use the costs of COND plus the minimum of
  80. the costs for THEN_BB and ELSE_BB, as computed in the next field. */
  81. unsigned int original_cost;
  82. /* Maximum permissible cost for the unconditional sequence we should
  83. generate to replace this branch. */
  84. unsigned int max_seq_cost;
  85. /* The name of the noce transform that succeeded in if-converting
  86. this structure. Used for debugging. */
  87. const char *transform_name;
  88. };
  89. #endif /* GCC_IFCVT_H */