bearch: Dump the output requirement and the assigned register in the same line for...
[libfirm] / ir / be / betranshlp.h
1 /*
2  * Copyright (C) 1995-2008 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  */
26 #ifndef FIRM_BE_BETRANSHLP_H
27 #define FIRM_BE_BETRANSHLP_H
28
29 #include "be_types.h"
30 #include "firm_types.h"
31
32 /**
33  * A callback to pre-transform some nodes before the transformation starts.
34  */
35 typedef void (arch_pretrans_nodes)(void);
36
37 /**
38  * The type of a transform function.
39  */
40 typedef ir_node *(be_transform_func)(ir_node *node);
41
42 /** pre-transform a node */
43 ir_node *be_pre_transform_node(ir_node *place);
44
45 /**
46  * Calls transformation function for given node and marks it visited.
47  */
48 ir_node *be_transform_node(ir_node *node);
49
50 /**
51  * Creates a new phi (needs some special handling since we can't transform
52  * all predecessors yet).
53  */
54 ir_node *be_transform_phi(ir_node *node, const arch_register_req_t *req);
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 /** clear transform functions and sets some virtual nodes like
67  * Start, Sync, Pin to the duplication transformer */
68 void be_start_transform_setup(void);
69
70 /** register a transform function for a specific node type */
71 void be_set_transform_function(ir_op *op, be_transform_func func);
72
73 /**
74  * Associate an old node with a transformed node. Uses link field.
75  */
76 void be_set_transformed_node(ir_node *old_node, ir_node *new_node);
77
78 /**
79  * returns 1 if the node is already transformed
80  */
81 int be_is_transformed(const ir_node *node);
82
83 /**
84  * enqueue all inputs into the transform queue.
85  */
86 void be_enqueue_preds(ir_node *node);
87
88 /**
89  * Transform a graph. Transformers must be registered first.
90  */
91 void be_transform_graph(ir_graph *irg, arch_pretrans_nodes *func);
92
93 typedef bool (*upper_bits_clean_func)(const ir_node *node, ir_mode *mode);
94
95 /**
96  * register a test function for be_upper_bits_clean for a specific node
97  * type.
98  */
99 void be_set_upper_bits_clean_function(ir_op *op, upper_bits_clean_func func);
100
101 /**
102  * returns true if it is assured, that the upper bits of a node are "clean"
103  * which means for a 16 or 8 bit value, that the upper bits in the register
104  * are 0 for unsigned and a copy of the last significant bit for signed
105  * numbers.
106  */
107 bool be_upper_bits_clean(const ir_node *node, ir_mode *mode);
108
109 #endif