becopyopt: Inline the thin wrapper nodes_interfere(), so we do not need to fetch...
[libfirm] / ir / be / sparc / sparc_cconv.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief   support functions for calling conventions
9  * @author  Matthias Braun
10  */
11 #ifndef FIRM_BE_SPARC_SPARC_CCONV_H
12 #define FIRM_BE_SPARC_SPARC_CCONV_H
13
14 #include "firm_types.h"
15 #include "bearch_sparc_t.h"
16 #include "be_types.h"
17 #include "benode.h"
18 #include "gen_sparc_regalloc_if.h"
19
20 /** information about a single parameter or result */
21 typedef struct reg_or_stackslot_t
22 {
23         const arch_register_req_t *req0; /**< if != NULL, register requirements
24                                               for this parameter (or the first
25                                               part of it). */
26         const arch_register_req_t *req1; /**< if != NULL, register requirements
27                                               for the 2nd part of the parameter */
28         const arch_register_t *reg0;
29         const arch_register_t *reg1;
30         size_t                 reg_offset;
31         ir_type               *type;   /**< indicates that an entity of the specific
32                                                                             type is needed */
33         unsigned               offset; /**< if transmitted via stack, the offset for
34                                             this parameter. */
35         ir_entity             *entity; /**< entity in frame type */
36 } reg_or_stackslot_t;
37
38 /** The calling convention info for one call site. */
39 struct calling_convention_t
40 {
41         bool                omit_fp;          /**< do not use frame pointer (and no
42                                                    save/restore) */
43         reg_or_stackslot_t *parameters;       /**< parameter info. */
44         unsigned            param_stack_size; /**< stack size for parameters */
45         unsigned            n_param_regs;     /**< number of values passed in a
46                                                    register */
47         reg_or_stackslot_t *results;          /**< result info. */
48         unsigned            n_reg_results;
49         unsigned           *caller_saves;     /**< bitset of caller save registers */
50 };
51
52 /**
53  * Determine how function parameters and return values are passed.
54  * Decides what goes to register or to stack and what stack offsets/
55  * datatypes are used.
56  *
57  * @param function_type  the type of the caller/callee function
58  * @param caller         true for convention for the caller, false for callee
59  */
60 calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
61                                                       ir_graph *irg);
62
63 /**
64  * free memory used by a calling_convention_t
65  */
66 void sparc_free_calling_convention(calling_convention_t *cconv);
67
68 void sparc_cconv_init(void);
69
70 #endif