1 /* Routines for expanding from SSA form to RTL.
2 Copyright (C) 2009-2013 Free Software Foundation, Inc.
4 This file is part of GCC.
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)
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.
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/>. */
21 #ifndef GCC_TREE_OUTOF_SSA_H
22 #define GCC_TREE_OUTOF_SSA_H
24 #include "tree-ssa-live.h"
25 #include "tree-ssa-ter.h"
27 /* This structure (of which only a singleton SA exists) is used to
28 pass around information between the outof-SSA functions, cfgexpand
32 /* The computed partitions of SSA names are stored here. */
35 /* For an SSA name version V bit V is set iff TER decided that
36 its definition should be forwarded. */
39 /* For a partition number I partition_to_pseudo[I] contains the
40 RTL expression of the allocated space of it (either a MEM or
42 rtx
*partition_to_pseudo
;
44 /* If partition I contains an SSA name that has a default def,
45 bit I will be set in this bitmap. */
46 bitmap partition_has_default_def
;
49 /* This is the singleton described above. */
50 extern struct ssaexpand SA
;
52 /* Returns the RTX expression representing the storage of the outof-SSA
53 partition that the SSA name EXP is a member of. */
55 get_rtx_for_ssa_name (tree exp
)
57 int p
= partition_find (SA
.map
->var_partition
, SSA_NAME_VERSION (exp
));
58 if (SA
.map
->partition_to_view
)
59 p
= SA
.map
->partition_to_view
[p
];
60 gcc_assert (p
!= NO_PARTITION
);
61 return SA
.partition_to_pseudo
[p
];
64 /* If TER decided to forward the definition of SSA name EXP this function
65 returns the defining statement, otherwise NULL. */
67 get_gimple_for_ssa_name (tree exp
)
69 int v
= SSA_NAME_VERSION (exp
);
70 if (SA
.values
&& bitmap_bit_p (SA
.values
, v
))
71 return SSA_NAME_DEF_STMT (exp
);
75 extern bool ssa_is_replaceable_p (gimple stmt
);
76 extern void finish_out_of_ssa (struct ssaexpand
*sa
);
77 extern unsigned int rewrite_out_of_ssa (struct ssaexpand
*sa
);
78 extern void expand_phi_nodes (struct ssaexpand
*sa
);
80 #endif /* GCC_TREE_OUTOF_SSA_H */