added a callback function to check whether a given entity is a allocation call
[libfirm] / ir / opt / ifconv.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  * Project:     libFIRM
22  * File name:   ir/opt/ifconv.h
23  * Purpose:     If conversion.
24  * Author:      Sebastian Hack.
25  * Created:
26  * CVS-ID:      $Id$
27  * Copyright:   (c) 1998-2005 Universität Karlsruhe
28  */
29 #ifndef _FIRM_IF_CONV_H
30 #define _FIRM_IF_CONV_H
31
32 /**
33  * @file ifconv.h
34  *
35  * If conversion.
36  * @author Sebastian Hack
37  * @date 10.2.2005
38  */
39 #include "irnode.h"
40
41 /**
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
45  * is not modified.
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
50  */
51 typedef int (*arch_allow_ifconv_func)(ir_node *sel, ir_node* phi_list, int i, int j);
52
53 /**
54  * The parameters structure.
55  */
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. */
62 } opt_if_conv_info_t;
63
64 /**
65  * Perform If conversion on a graph.
66  *
67  * @param irg The graph.
68  * @param params The parameters for the if conversion.
69  *
70  * Cannot handle blocks with Bad control predecessors, so call it after control
71  * flow optimization.
72  */
73 void opt_if_conv(ir_graph *irg, const opt_if_conv_info_t *params);
74
75 #endif /* _FIRM_IF_CONV_H */