X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fir%2Firedges.h;h=57b52e597977faf8f1d2ae0091f8ebc3d0d7f4a3;hb=23ea16875f38dc0c067cce24f64b5c70f3acc496;hp=d726ab289e9ef69a34af855665aadce0426d5134;hpb=c7daadaa26601179dd9edac254b2c7315378d2e8;p=libfirm diff --git a/ir/ir/iredges.h b/ir/ir/iredges.h index d726ab289..57b52e597 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. @@ -5,10 +15,10 @@ * @date 3.2.2005 */ -#ifndef _FIRM_EDGES_H -#define _FIRM_EDGES_H +#ifndef _FIRM_IR_EDGES_H +#define _FIRM_IR_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. @@ -77,6 +105,16 @@ int get_irn_n_edges(const ir_node *irn); */ extern int get_edge_src_pos(const ir_edge_t *edge); +/** + * Get the edge object of an outgoing edge at a node. + * @param irg The graph, the node is in. + * @param irn The node at which the edge originates. + * @param pos The position of the edge. + * @return The corresponding edge object or NULL, + * if no such edge exists. + */ +const ir_edge_t *get_irn_edge(ir_graph *irg, const ir_node *irn, int pos); + /** * Check, if the out edges are activated. * @param irg The graph. @@ -96,4 +134,4 @@ extern void edges_activate(ir_graph *irg); */ extern void edges_deactivate(ir_graph *irg); -#endif /* _FIRM_EDGES_H */ +#endif /* _FIRM_IR_EDGES_H */