fix bugs when exchanging nodes to projs in bepeephole
[libfirm] / ir / be / betranshlp.h
1 /*
2  * Copyright (C) 1995-2007 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
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.
10  *
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.
14  *
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
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief       be transform helper extracted from the ia32 backend.
23  * @author      Matthias Braun, Michael Beck
24  * @date        14.06.2007
25  * @version     $Id$
26  */
27 #ifndef FIRM_BE_BETRANSHLP_H
28 #define FIRM_BE_BETRANSHLP_H
29
30 #include "firm_types.h"
31 #include "beirg.h"
32
33 /**
34  * A callback to pre-transform some nodes before the transformation starts.
35  */
36 typedef void (arch_pretrans_nodes)(void *arch_cg);
37
38 /**
39  * The type of a transform function.
40  */
41 typedef ir_node *(be_transform_func)(ir_node *node);
42
43 /** pre-transform a node */
44 ir_node *be_pre_transform_node(ir_node *place);
45
46 /**
47  * Calls transformation function for given node and marks it visited.
48  */
49 ir_node *be_transform_node(ir_node *node);
50
51 /**
52  * returns an anchor from the graph before the transformation
53  */
54 ir_node *be_get_old_anchor(int anchor);
55
56 /**
57  * Duplicate all dependency edges of a node.
58  */
59 void be_duplicate_deps(ir_node *old_node, ir_node *new_node);
60
61 /**
62  * Duplicate a node during transformation.
63  */
64 ir_node *be_duplicate_node(ir_node *node);
65
66 /**
67  * Associate an old node with a transformed node. Uses link field.
68  */
69 void be_set_transformed_node(ir_node *old_node, ir_node *new_node);
70
71 /**
72  * returns 1 if the node is already transformed
73  */
74 int be_is_transformed(const ir_node *node);
75
76 /**
77  * enqueue all inputs into the transform queue.
78  */
79 void be_enqueue_preds(ir_node *node);
80
81 /**
82  * Transform a graph. Transformers must be registered first.
83  */
84 void be_transform_graph(be_irg_t *birg, arch_pretrans_nodes *func, void *cg_env);
85
86 #endif /* FIRM_BE_BETRANSHLP_H */