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