Fixed opt/fehler192.c.
[libfirm] / ir / be / sparc / sparc_cconv.h
1 /*
2  * Copyright (C) 1995-2010 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  * @file
22  * @brief   support functions for calling conventions
23  * @author  Matthias Braun
24  * @version $Id$
25  */
26 #ifndef FIRM_BE_SPARC_SPARC_CCONV_H
27 #define FIRM_BE_SPARC_SPARC_CCONV_H
28
29 #include "firm_types.h"
30 #include "../be_types.h"
31 #include "gen_sparc_regalloc_if.h"
32
33 /** information about a single parameter or result */
34 typedef struct reg_or_stackslot_t
35 {
36         const arch_register_t *reg0;   /**< if != NULL, the first register used for
37                                             this parameter. */
38         const arch_register_t *reg1;   /**< if != NULL, the second register used. */
39         ir_type               *type;   /**< indicates that an entity of the specific
40                                                                             type is needed */
41         unsigned               offset; /**< if transmitted via stack, the offset for
42                                             this parameter. */
43         ir_entity             *entity; /**< entity in frame type */
44 } reg_or_stackslot_t;
45
46 /** The calling convention info for one call site. */
47 typedef struct calling_convention_t
48 {
49         bool                omit_fp;          /**< do not use frame pointer (and no
50                                                    save/restore) */
51         reg_or_stackslot_t *parameters;       /**< parameter info. */
52         unsigned            param_stack_size; /**< stack size for parameters */
53         unsigned            n_param_regs;     /**< number of values passed in a
54                                                    register */
55         reg_or_stackslot_t *results;          /**< result info. */
56 } calling_convention_t;
57
58 /**
59  * Determine how function parameters and return values are passed.
60  * Decides what goes to register or to stack and what stack offsets/
61  * datatypes are used.
62  *
63  * @param function_type  the type of the caller/callee function
64  * @param caller         true for convention for the caller, false for callee
65  */
66 calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
67                                                       ir_graph *irg);
68
69 /**
70  * free memory used by a calling_convention_t
71  */
72 void sparc_free_calling_convention(calling_convention_t *cconv);
73
74 #endif