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