2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief support functions for calling conventions
9 * @author Matthias Braun
11 #ifndef FIRM_BE_SPARC_SPARC_CCONV_H
12 #define FIRM_BE_SPARC_SPARC_CCONV_H
14 #include "firm_types.h"
15 #include "bearch_sparc_t.h"
18 #include "gen_sparc_regalloc_if.h"
20 /** information about a single parameter or result */
21 typedef struct reg_or_stackslot_t
23 const arch_register_req_t *req0; /**< if != NULL, register requirements
24 for this parameter (or the first
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;
31 ir_type *type; /**< indicates that an entity of the specific
33 unsigned offset; /**< if transmitted via stack, the offset for
35 ir_entity *entity; /**< entity in frame type */
38 /** The calling convention info for one call site. */
39 struct calling_convention_t
41 bool omit_fp; /**< do not use frame pointer (and no
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
47 reg_or_stackslot_t *results; /**< result info. */
48 unsigned n_reg_results;
49 unsigned *caller_saves; /**< bitset of caller save registers */
53 * Determine how function parameters and return values are passed.
54 * Decides what goes to register or to stack and what stack offsets/
57 * @param function_type the type of the caller/callee function
58 * @param caller true for convention for the caller, false for callee
60 calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
64 * free memory used by a calling_convention_t
66 void sparc_free_calling_convention(calling_convention_t *cconv);
68 void sparc_cconv_init(void);