X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firedges.h;h=2d8a734e4e76fd2495c81944c9e914f34d9d64fb;hb=d904350bc3a4b3b9c77a71d683be6c44b041a33d;hp=90e618af3098cdd088954c0c836dab5f96f118cc;hpb=5b6df0f4d0b9d130dfddcb948b3df749f9d44903;p=libfirm diff --git a/ir/ir/iredges.h b/ir/ir/iredges.h index 90e618af3..2d8a734e4 100644 --- a/ir/ir/iredges.h +++ b/ir/ir/iredges.h @@ -1,3 +1,13 @@ +/* + * Project: libFIRM + * File name: ir/ir/iredges.h + * Purpose: Public header for the automatically updating outs. + * Author: Sebastian Hack + * Created: 3.2.2005 + * CVS-ID: $Id$ + * Copyright: (c) 1998-2005 Universität Karlsruhe + * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. + */ /** * Public header for the automatically updating outs. @@ -8,7 +18,7 @@ #ifndef _FIRM_EDGES_H #define _FIRM_EDGES_H -#include "irnode.h" +#include "firm_types.h" #ifndef _IR_EDGE_TYPEDEF_ #define _IR_EDGE_TYPEDEF_ @@ -40,13 +50,31 @@ const ir_edge_t *get_irn_out_edge_next(const ir_node *irn, /** * A convenience iteration macro over all out edges of a node. - * @param irn The node. - * @param edge An @c ir_edge_t pointer which shall be set to the current + * @param irn The node. + * @param edge An ir_edge_t pointer which shall be set to the current * edge. */ #define foreach_out_edge(irn,edge) \ for(edge = get_irn_out_edge_first(irn); edge; edge = get_irn_out_edge_next(irn, edge)) +/** + * A convenience iteration macro over all out edges of a node, which is safe + * against alteration of the current edge. + * + * @param irn The node. + * @param edge An ir_edge_t pointer which shall be set to the current + * edge. + * @param ne The next edge, enables alteration safe edge processing. + */ +#define foreach_out_edge_safe(irn,edge,ne) \ + for( \ + (edge) = (get_irn_out_edge_first(irn)), \ + (ne) = ((edge) ? (get_irn_out_edge_next(irn, edge)) : NULL); \ + edge; \ + (edge) = (ne), (ne) = ((edge) ? (get_irn_out_edge_next(irn, edge)) : NULL) \ + ) + + /** * A convenience iteration macro for all control flow edges * leaving a block, and thus are cf successor edges.