2 * This file is part of libFirm.
3 * Copyright (C) 2012 Karlsruhe Institute of Technology.
7 * @brief Remove all Tuple nodes from ir graph
8 * @author Andreas Zwinkau
26 static void exchange_tuple_projs(ir_node *node, void *env)
32 if (!is_Proj(node)) return;
34 pred = get_Proj_pred(node);
35 proj = get_Proj_proj(node);
37 if (!is_Tuple(pred)) return;
39 pred = get_Tuple_pred(pred, proj);
43 void remove_tuples(ir_graph *irg)
45 irg_walk_graph(irg, exchange_tuple_projs, NULL, NULL);
47 ir_node *end = get_irg_end(irg);
48 int n_keepalives = get_End_n_keepalives(end);
51 for (i = n_keepalives - 1; i >= 0; --i) {
52 ir_node *irn = get_End_keepalive(end, i);
55 remove_End_keepalive(end, irn);
59 add_irg_properties(irg, IR_GRAPH_PROPERTY_NO_TUPLES);