1*38fd1498Szrj /* Routines for expanding from SSA form to RTL. 2*38fd1498Szrj Copyright (C) 2009-2018 Free Software Foundation, Inc. 3*38fd1498Szrj 4*38fd1498Szrj This file is part of GCC. 5*38fd1498Szrj 6*38fd1498Szrj GCC is free software; you can redistribute it and/or modify 7*38fd1498Szrj it under the terms of the GNU General Public License as published by 8*38fd1498Szrj the Free Software Foundation; either version 3, or (at your option) 9*38fd1498Szrj any later version. 10*38fd1498Szrj 11*38fd1498Szrj GCC is distributed in the hope that it will be useful, 12*38fd1498Szrj but WITHOUT ANY WARRANTY; without even the implied warranty of 13*38fd1498Szrj MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*38fd1498Szrj GNU General Public License for more details. 15*38fd1498Szrj 16*38fd1498Szrj You should have received a copy of the GNU General Public License 17*38fd1498Szrj along with GCC; see the file COPYING3. If not see 18*38fd1498Szrj <http://www.gnu.org/licenses/>. */ 19*38fd1498Szrj 20*38fd1498Szrj 21*38fd1498Szrj #ifndef GCC_TREE_OUTOF_SSA_H 22*38fd1498Szrj #define GCC_TREE_OUTOF_SSA_H 23*38fd1498Szrj 24*38fd1498Szrj 25*38fd1498Szrj /* This structure (of which only a singleton SA exists) is used to 26*38fd1498Szrj pass around information between the outof-SSA functions, cfgexpand 27*38fd1498Szrj and expand itself. */ 28*38fd1498Szrj struct ssaexpand 29*38fd1498Szrj { 30*38fd1498Szrj /* The computed partitions of SSA names are stored here. */ 31*38fd1498Szrj var_map map; 32*38fd1498Szrj 33*38fd1498Szrj /* For an SSA name version V bit V is set iff TER decided that 34*38fd1498Szrj its definition should be forwarded. */ 35*38fd1498Szrj bitmap values; 36*38fd1498Szrj 37*38fd1498Szrj /* For a partition number I partition_to_pseudo[I] contains the 38*38fd1498Szrj RTL expression of the allocated space of it (either a MEM or 39*38fd1498Szrj a pseudos REG). */ 40*38fd1498Szrj rtx *partition_to_pseudo; 41*38fd1498Szrj 42*38fd1498Szrj /* If partition I contains an SSA name that has a default def for a 43*38fd1498Szrj parameter, bit I will be set in this bitmap. */ 44*38fd1498Szrj bitmap partitions_for_parm_default_defs; 45*38fd1498Szrj 46*38fd1498Szrj /* If partition I contains an SSA name that has an undefined value, 47*38fd1498Szrj bit I will be set in this bitmap. */ 48*38fd1498Szrj bitmap partitions_for_undefined_values; 49*38fd1498Szrj }; 50*38fd1498Szrj 51*38fd1498Szrj /* This is the singleton described above. */ 52*38fd1498Szrj extern struct ssaexpand SA; 53*38fd1498Szrj 54*38fd1498Szrj /* Returns the RTX expression representing the storage of the outof-SSA 55*38fd1498Szrj partition that the SSA name EXP is a member of. */ 56*38fd1498Szrj static inline rtx get_rtx_for_ssa_name(tree exp)57*38fd1498Szrjget_rtx_for_ssa_name (tree exp) 58*38fd1498Szrj { 59*38fd1498Szrj int p = partition_find (SA.map->var_partition, SSA_NAME_VERSION (exp)); 60*38fd1498Szrj if (SA.map->partition_to_view) 61*38fd1498Szrj p = SA.map->partition_to_view[p]; 62*38fd1498Szrj gcc_assert (p != NO_PARTITION); 63*38fd1498Szrj return SA.partition_to_pseudo[p]; 64*38fd1498Szrj } 65*38fd1498Szrj 66*38fd1498Szrj /* If TER decided to forward the definition of SSA name EXP this function 67*38fd1498Szrj returns the defining statement, otherwise NULL. */ 68*38fd1498Szrj static inline gimple * get_gimple_for_ssa_name(tree exp)69*38fd1498Szrjget_gimple_for_ssa_name (tree exp) 70*38fd1498Szrj { 71*38fd1498Szrj int v = SSA_NAME_VERSION (exp); 72*38fd1498Szrj if (SA.values && bitmap_bit_p (SA.values, v)) 73*38fd1498Szrj return SSA_NAME_DEF_STMT (exp); 74*38fd1498Szrj return NULL; 75*38fd1498Szrj } 76*38fd1498Szrj 77*38fd1498Szrj extern bool ssa_is_replaceable_p (gimple *stmt); 78*38fd1498Szrj extern void finish_out_of_ssa (struct ssaexpand *sa); 79*38fd1498Szrj extern unsigned int rewrite_out_of_ssa (struct ssaexpand *sa); 80*38fd1498Szrj extern void expand_phi_nodes (struct ssaexpand *sa); 81*38fd1498Szrj 82*38fd1498Szrj #endif /* GCC_TREE_OUTOF_SSA_H */ 83