tree-outof-ssa.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Routines for expanding from SSA form to RTL.
  2. Copyright (C) 2009-2019 Free Software Foundation, Inc.
  3. This file is part of GCC.
  4. GCC is free software; you can redistribute it and/or modify
  5. it 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,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public 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_TREE_OUTOF_SSA_H
  16. #define GCC_TREE_OUTOF_SSA_H
  17. /* This structure (of which only a singleton SA exists) is used to
  18. pass around information between the outof-SSA functions, cfgexpand
  19. and expand itself. */
  20. struct ssaexpand
  21. {
  22. /* The computed partitions of SSA names are stored here. */
  23. var_map map;
  24. /* For an SSA name version V bit V is set iff TER decided that
  25. its definition should be forwarded. */
  26. bitmap values;
  27. /* For a partition number I partition_to_pseudo[I] contains the
  28. RTL expression of the allocated space of it (either a MEM or
  29. a pseudos REG). */
  30. rtx *partition_to_pseudo;
  31. /* If partition I contains an SSA name that has a default def for a
  32. parameter, bit I will be set in this bitmap. */
  33. bitmap partitions_for_parm_default_defs;
  34. /* If partition I contains an SSA name that has an undefined value,
  35. bit I will be set in this bitmap. */
  36. bitmap partitions_for_undefined_values;
  37. };
  38. /* This is the singleton described above. */
  39. extern struct ssaexpand SA;
  40. /* Returns the RTX expression representing the storage of the outof-SSA
  41. partition that the SSA name EXP is a member of. */
  42. static inline rtx
  43. get_rtx_for_ssa_name (tree exp)
  44. {
  45. int p = partition_find (SA.map->var_partition, SSA_NAME_VERSION (exp));
  46. if (SA.map->partition_to_view)
  47. p = SA.map->partition_to_view[p];
  48. gcc_assert (p != NO_PARTITION);
  49. return SA.partition_to_pseudo[p];
  50. }
  51. /* If TER decided to forward the definition of SSA name EXP this function
  52. returns the defining statement, otherwise NULL. */
  53. static inline gimple *
  54. get_gimple_for_ssa_name (tree exp)
  55. {
  56. int v = SSA_NAME_VERSION (exp);
  57. if (SA.values && bitmap_bit_p (SA.values, v))
  58. return SSA_NAME_DEF_STMT (exp);
  59. return NULL;
  60. }
  61. extern bool ssa_is_replaceable_p (gimple *stmt);
  62. extern void finish_out_of_ssa (struct ssaexpand *sa);
  63. extern unsigned int rewrite_out_of_ssa (struct ssaexpand *sa);
  64. extern void expand_phi_nodes (struct ssaexpand *sa);
  65. #endif /* GCC_TREE_OUTOF_SSA_H */