2 * Copyright (C) 1995-2008 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
6 * This file may be distributed and/or modified under the terms of the
7 * GNU General Public License version 2 as published by the Free Software
8 * Foundation and appearing in the file LICENSE.GPL included in the
9 * packaging of this file.
11 * Licensees holding valid libFirm Professional Edition licenses may use
12 * this file in accordance with the libFirm Commercial License.
13 * Agreement provided with the Software.
15 * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * @brief be transform helper extracted from the ia32 backend.
23 * @author Matthias Braun, Michael Beck
26 #ifndef FIRM_BE_BETRANSHLP_H
27 #define FIRM_BE_BETRANSHLP_H
29 #include "firm_types.h"
33 * A callback to pre-transform some nodes before the transformation starts.
35 typedef void (arch_pretrans_nodes)(void);
38 * The type of a transform function.
40 typedef ir_node *(be_transform_func)(ir_node *node);
42 /** pre-transform a node */
43 ir_node *be_pre_transform_node(ir_node *place);
46 * Calls transformation function for given node and marks it visited.
48 ir_node *be_transform_node(ir_node *node);
51 * Duplicate all dependency edges of a node.
53 void be_duplicate_deps(ir_node *old_node, ir_node *new_node);
56 * Duplicate a node during transformation.
58 ir_node *be_duplicate_node(ir_node *node);
60 /** clear transform functions and sets some virtual nodes like
61 * Start, Sync, Pin to the duplication transformer */
62 void be_start_transform_setup(void);
64 /** register a transform function for a specific node type */
65 void be_set_transform_function(ir_op *op, be_transform_func func);
68 * Associate an old node with a transformed node. Uses link field.
70 void be_set_transformed_node(ir_node *old_node, ir_node *new_node);
73 * returns 1 if the node is already transformed
75 int be_is_transformed(const ir_node *node);
78 * enqueue all inputs into the transform queue.
80 void be_enqueue_preds(ir_node *node);
83 * Transform a graph. Transformers must be registered first.
85 void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func);