@@ -6,6 +6,7 @@
#include "token.h"
#include "parse.h"
#include "symbol.h"
+#include "ptrmap.h"
struct instruction;
DECLARE_PTR_LIST(pseudo_ptr_list, pseudo_t);
@@ -18,6 +19,7 @@ struct pseudo_user {
DECLARE_ALLOCATOR(pseudo_user);
DECLARE_PTR_LIST(pseudo_user_list, struct pseudo_user);
+DECLARE_PTRMAP(phi_map, struct basic_block *, pseudo_t);
enum pseudo_type {
PSEUDO_VOID,
@@ -90,6 +92,7 @@ struct instruction {
};
struct /* phi_node */ {
struct pseudo_list *phi_list;
+ struct symbol *var; /* SSSA only */
};
struct /* phi source */ {
pseudo_t phi_src;
@@ -231,7 +234,14 @@ struct basic_block {
struct basic_block_list *parents; /* sources */
struct basic_block_list *children; /* destinations */
struct instruction_list *insns; /* Linear list of instructions */
- struct pseudo_list *needs, *defines;
+ union {
+ struct { // SSA construction
+ unsigned int sealed:1;
+ };
+ struct { // liveness
+ struct pseudo_list *needs, *defines;
+ };
+ };
union {
unsigned int nr; /* unique id for label's names */
void *priv;
@@ -184,6 +184,7 @@ struct symbol {
struct expression *initializer;
struct entrypoint *ep;
long long value; /* Initial value */
+ struct phi_map *phi_map;
struct symbol *definition;
};
};
The incoming new method to construct the SSA needs a few new members for pseudos, basic_blocks & symbols. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- linearize.h | 12 +++++++++++- symbol.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-)