First implementation of lowering for calls with compound return values
[libfirm] / ir / lower / lower_calls.h
1 /*
2  * Project:     libFIRM
3  * File name:   ir/lower/lower_calls.h
4  * Purpose:     lowering of Calls with compound parameters
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 lower_calls.h
14  *
15  * Lowering of Calls with compound return types.
16  *
17  * @author Michael Beck
18  */
19 #ifndef _LOWER_CALLS_H_
20 #define _LOWER_CALLS_H_
21
22 /**
23  * A type telling where to add hidden parameters.
24  */
25 typedef enum add_hidden_params {
26   ADD_HIDDEN_ALWAYS_IN_FRONT = 0,   /**< always add hidden parameters in front (default). */
27   ADD_HIDDEN_ALWAYS_LAST     = 1,   /**< always add hidden parameters last, did not work for variadic functions. */
28   ADD_HIDDEN_SMART           = 2,   /**< add hidden parameters last for non-variadic and first for variadic functions. */
29 } add_hidden;
30
31 typedef struct {
32   int        def_ptr_alignment;   /**< default alignment for data pointer */
33   add_hidden hidden_params;       /**< where to add hidden params. */
34
35   /** a function returning a pointer type for a given type */
36   ir_type *(*find_pointer_type)(ir_type *e_type, ir_mode *mode, int alignment);
37 } lower_params_t;
38
39 /**
40  * Lower calls with compound return types.
41  * This function does the following transformations:
42  *
43  * - Adds a new (hidden) pointer parameter for
44  *   any return compound type.
45  *
46  * - Use of the hidden parameters in the function code.
47  *
48  * - Change all calls to functions with compound return
49  *   by providing space for the hidden parameter on the callers
50  *   stack.
51  *
52  * - Replace a possible block copy after the function call.
53  */
54 void lower_compound_ret_calls(const lower_params_t *params);
55
56 #endif /* _LOWER_CALLS_H_ */