Implement better magic to handle changing control dependencies when welding blocks
[libfirm] / ir / opt / return.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/opt/return.h
4  * Purpose:     normalize returns
5  * Author:      Michael Beck
6  * Created:
7  * CVS-ID:      $Id$
8  * Copyright:   (c) 1998-2005 Universität Karlsruhe
9  * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
10  */
11
12 /**
13  * @file return.h
14  *
15  * Normalize returns.
16  *
17  * @author Michael Beck
18  */
19 #ifndef _RETURN_H_
20 #define _RETURN_H_
21
22 #include "irgraph.h"
23
24 /**
25  * Normalize the Returns of a graph by creating a new End block
26  * with One Return(Phi).
27  * This is the preferred input for the if-conversion.
28  *
29  * In pseudocode, it means:
30  *
31  * if (a)
32  *   return b;
33  * else
34  *   return c;
35  *
36  * is transformed into
37  *
38  * if (a)
39  *   res = b;
40  * else
41  *   res = c;
42  * return res;
43  */
44 void normalize_one_return(ir_graph *irg);
45
46 /**
47  * Normalize the Returns of a graph by moving
48  * the Returns upwards as much as possible.
49  * This might be preferred for code generation.
50  *
51  * In pseudocode, it means:
52  *
53  * if (a)
54  *   res = b;
55  * else
56  *   res = c;
57  * return res;
58  *
59  * is transformed into
60  *
61  * if (a)
62  *   return b;
63  * else
64  *   return c;
65  */
66 void normalize_n_returns(ir_graph *irg);
67
68 #endif /* _RETURN_H_ */