added new licence header
[libfirm] / ir / opt / return.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/return.h
23  * Purpose:     normalize returns
24  * Author:      Michael Beck
25  * Created:
26  * CVS-ID:      $Id$
27  * Copyright:   (c) 1998-2005 Universität Karlsruhe
28  */
29
30 /**
31  * @file return.h
32  *
33  * Normalize returns.
34  *
35  * @author Michael Beck
36  */
37 #ifndef _RETURN_H_
38 #define _RETURN_H_
39
40 #include "irgraph.h"
41
42 /**
43  * Normalize the Returns of a graph by creating a new End block
44  * with One Return(Phi).
45  * This is the preferred input for the if-conversion.
46  *
47  * In pseudocode, it means:
48  *
49  * if (a)
50  *   return b;
51  * else
52  *   return c;
53  *
54  * is transformed into
55  *
56  * if (a)
57  *   res = b;
58  * else
59  *   res = c;
60  * return res;
61  */
62 void normalize_one_return(ir_graph *irg);
63
64 /**
65  * Normalize the Returns of a graph by moving
66  * the Returns upwards as much as possible.
67  * This might be preferred for code generation.
68  *
69  * In pseudocode, it means:
70  *
71  * if (a)
72  *   res = b;
73  * else
74  *   res = c;
75  * return res;
76  *
77  * is transformed into
78  *
79  * if (a)
80  *   return b;
81  * else
82  *   return c;
83  */
84 void normalize_n_returns(ir_graph *irg);
85
86 #endif /* _RETURN_H_ */