* @file
* @brief support functions for calling conventions
* @author Matthias Braun
- * @version $Id$
*/
#ifndef FIRM_BE_SPARC_SPARC_CCONV_H
#define FIRM_BE_SPARC_SPARC_CCONV_H
#include "firm_types.h"
-#include "../be_types.h"
+#include "bearch_sparc_t.h"
+#include "be_types.h"
+#include "benode.h"
#include "gen_sparc_regalloc_if.h"
-static const arch_register_t *const caller_saves[] = {
- &sparc_gp_regs[REG_G1],
- &sparc_gp_regs[REG_G2],
- &sparc_gp_regs[REG_G3],
- &sparc_gp_regs[REG_G4],
- &sparc_gp_regs[REG_O0],
- &sparc_gp_regs[REG_O1],
- &sparc_gp_regs[REG_O2],
- &sparc_gp_regs[REG_O3],
- &sparc_gp_regs[REG_O4],
- &sparc_gp_regs[REG_O5],
-
- &sparc_fp_regs[REG_F0],
- &sparc_fp_regs[REG_F1],
- &sparc_fp_regs[REG_F2],
- &sparc_fp_regs[REG_F3],
- &sparc_fp_regs[REG_F4],
- &sparc_fp_regs[REG_F5],
- &sparc_fp_regs[REG_F6],
- &sparc_fp_regs[REG_F7],
- &sparc_fp_regs[REG_F8],
- &sparc_fp_regs[REG_F9],
- &sparc_fp_regs[REG_F10],
- &sparc_fp_regs[REG_F11],
- &sparc_fp_regs[REG_F12],
- &sparc_fp_regs[REG_F13],
- &sparc_fp_regs[REG_F14],
- &sparc_fp_regs[REG_F15],
- &sparc_fp_regs[REG_F16],
- &sparc_fp_regs[REG_F17],
- &sparc_fp_regs[REG_F18],
- &sparc_fp_regs[REG_F19],
- &sparc_fp_regs[REG_F20],
- &sparc_fp_regs[REG_F21],
- &sparc_fp_regs[REG_F22],
- &sparc_fp_regs[REG_F23],
- &sparc_fp_regs[REG_F24],
- &sparc_fp_regs[REG_F25],
- &sparc_fp_regs[REG_F26],
- &sparc_fp_regs[REG_F27],
- &sparc_fp_regs[REG_F28],
- &sparc_fp_regs[REG_F29],
- &sparc_fp_regs[REG_F30],
- &sparc_fp_regs[REG_F31],
-};
-
-static const arch_register_t* const param_regs[] = {
- &sparc_gp_regs[REG_I0],
- &sparc_gp_regs[REG_I1],
- &sparc_gp_regs[REG_I2],
- &sparc_gp_regs[REG_I3],
- &sparc_gp_regs[REG_I4],
- &sparc_gp_regs[REG_I5],
-};
-
-static const arch_register_t* const float_result_regs[] = {
- &sparc_fp_regs[REG_F0],
- &sparc_fp_regs[REG_F1],
- &sparc_fp_regs[REG_F2],
- &sparc_fp_regs[REG_F3],
-};
-
/** information about a single parameter or result */
typedef struct reg_or_stackslot_t
{
- const arch_register_t *reg0; /**< if != NULL, the first register used for
- this parameter. */
- const arch_register_t *reg1; /**< if != NULL, the second register used. */
+ const arch_register_req_t *req0; /**< if != NULL, register requirements
+ for this parameter (or the first
+ part of it). */
+ const arch_register_req_t *req1; /**< if != NULL, register requirements
+ for the 2nd part of the parameter */
+ const arch_register_t *reg0;
+ const arch_register_t *reg1;
+ size_t reg_offset;
ir_type *type; /**< indicates that an entity of the specific
type is needed */
- int offset; /**< if transmitted via stack, the offset for
+ unsigned offset; /**< if transmitted via stack, the offset for
this parameter. */
ir_entity *entity; /**< entity in frame type */
} reg_or_stackslot_t;
/** The calling convention info for one call site. */
-typedef struct calling_convention_t
+struct calling_convention_t
{
+ bool omit_fp; /**< do not use frame pointer (and no
+ save/restore) */
reg_or_stackslot_t *parameters; /**< parameter info. */
- int param_stack_size; /**< stack size for parameters */
+ unsigned param_stack_size; /**< stack size for parameters */
+ unsigned n_param_regs; /**< number of values passed in a
+ register */
reg_or_stackslot_t *results; /**< result info. */
-} calling_convention_t;
+ unsigned n_reg_results;
+ unsigned *caller_saves; /**< bitset of caller save registers */
+};
/**
* Determine how function parameters and return values are passed.
* @param caller true for convention for the caller, false for callee
*/
calling_convention_t *sparc_decide_calling_convention(ir_type *function_type,
- bool caller);
+ ir_graph *irg);
/**
* free memory used by a calling_convention_t
*/
void sparc_free_calling_convention(calling_convention_t *cconv);
+void sparc_cconv_init(void);
+
#endif