tree-outof-ssa.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /* Routines for expanding from SSA form to RTL.
  2. Copyright (C) 2009-2015 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,
  32. bit I will be set in this bitmap. */
  33. bitmap partition_has_default_def;
  34. };
  35. /* This is the singleton described above. */
  36. extern struct ssaexpand SA;
  37. /* Returns the RTX expression representing the storage of the outof-SSA
  38. partition that the SSA name EXP is a member of. */
  39. static inline rtx
  40. get_rtx_for_ssa_name (tree exp)
  41. {
  42. int p = partition_find (SA.map->var_partition, SSA_NAME_VERSION (exp));
  43. if (SA.map->partition_to_view)
  44. p = SA.map->partition_to_view[p];
  45. gcc_assert (p != NO_PARTITION);
  46. return SA.partition_to_pseudo[p];
  47. }
  48. /* If TER decided to forward the definition of SSA name EXP this function
  49. returns the defining statement, otherwise NULL. */
  50. static inline gimple
  51. get_gimple_for_ssa_name (tree exp)
  52. {
  53. int v = SSA_NAME_VERSION (exp);
  54. if (SA.values && bitmap_bit_p (SA.values, v))
  55. return SSA_NAME_DEF_STMT (exp);
  56. return NULL;
  57. }
  58. extern bool ssa_is_replaceable_p (gimple stmt);
  59. extern void finish_out_of_ssa (struct ssaexpand *sa);
  60. extern unsigned int rewrite_out_of_ssa (struct ssaexpand *sa);
  61. extern void expand_phi_nodes (struct ssaexpand *sa);
  62. #endif /* GCC_TREE_OUTOF_SSA_H */