From cbde6614a4d03c9cd2bbe36abfcbc96fba66bee7 Mon Sep 17 00:00:00 2001 From: Sebastian Hack Date: Fri, 10 Mar 2006 15:54:58 +0000 Subject: [PATCH] Added small helper function [r7432] --- ir/common/survive_dce.c | 11 ++++++++++- ir/common/survive_dce.h | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ir/common/survive_dce.c b/ir/common/survive_dce.c index 37a83f781..c574a25c0 100644 --- a/ir/common/survive_dce.c +++ b/ir/common/survive_dce.c @@ -72,5 +72,14 @@ void free_survive_dce(survive_dce_t *sd) void survive_dce_register_irn(survive_dce_t *sd, ir_node **place) { - pmap_insert(sd->places, *place, (void *) place); + if(*place != NULL) + pmap_insert(sd->places, *place, (void *) place); +} + +void survive_dce_register_pmap(survive_dce_t *sd, pmap *m) +{ + pmap_entry *ent; + + for(ent = pmap_first(m); ent; ent = pmap_next(m)) + survive_dce_register_irn(sd, (ir_node **) &ent->value); } diff --git a/ir/common/survive_dce.h b/ir/common/survive_dce.h index 3c0c2059b..803b78859 100644 --- a/ir/common/survive_dce.h +++ b/ir/common/survive_dce.h @@ -5,6 +5,8 @@ #ifndef _FIRM_SURVIVE_DCE_H #define _FIRM_SURVIVE_DCE_H +#include "pmap.h" + typedef struct _survive_dce_t survive_dce_t; /** @@ -26,4 +28,13 @@ void free_survive_dce(survive_dce_t *sd); */ void survive_dce_register_irn(survive_dce_t *sd, ir_node **place); +/** + * Register a map to survive the dce. + * All value parts of the map's entries are assumed to be ir node pointers + * and are registered with survive_dce_register_irn(). + * @param sd The survive dce private data. + * @param m The map. + */ +void survive_dce_register_pmap(survive_dce_t *sd, pmap *m); + #endif -- 2.20.1