2 * Copyright (C) 1995-2007 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 * File name: ir/opt/ifconv.h
23 * Purpose: If conversion.
24 * Author: Sebastian Hack.
27 * Copyright: (c) 1998-2005 Universität Karlsruhe
29 #ifndef _FIRM_IF_CONV_H
30 #define _FIRM_IF_CONV_H
36 * @author Sebastian Hack
42 * This function is called to evaluate, if a mux can build
43 * of the current architecture.
44 * If it returns non-zero, a mux is created, else the code
46 * @param sel A selector of a Cond.
47 * @param phi_list List of Phi nodes about to be converted (linked via link field)
48 * @param i First data predecessor involved in if conversion
49 * @param j Second data predecessor involved in if conversion
51 typedef int (*arch_allow_ifconv_func)(ir_node *sel, ir_node* phi_list, int i, int j);
54 * The parameters structure.
56 typedef struct _opt_if_conv_info_t {
57 int max_depth; /**< The maximum depth up to which expressions
58 are examined when it has to be decided if they
59 can be placed into another block. */
60 arch_allow_ifconv_func allow_ifconv; /**< Evaluator function, if not set all possible Psi
61 nodes will be created. */
65 * Perform If conversion on a graph.
67 * @param irg The graph.
68 * @param params The parameters for the if conversion.
70 * Cannot handle blocks with Bad control predecessors, so call it after control
73 void opt_if_conv(ir_graph *irg, const opt_if_conv_info_t *params);
75 #endif /* _FIRM_IF_CONV_H */