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