2 * This file is part of libFirm.
3 * Copyright (C) 2012 University of Karlsruhe.
8 * @brief declarations for SPARC backend -- private header
9 * @author Hannes Rapp, Matthias Braun
11 #ifndef FIRM_BE_SPARC_BEARCH_SPARC_T_H
12 #define FIRM_BE_SPARC_BEARCH_SPARC_T_H
15 #include "sparc_nodes_attr.h"
18 typedef struct sparc_isa_t sparc_isa_t;
19 typedef struct calling_convention_t calling_convention_t;
21 /** Floating point instruction set. */
22 enum sparc_fp_architectures {
23 SPARC_FPU_ARCH_NONE = 0,
24 SPARC_FPU_ARCH_FPU = 0x00000001,
25 SPARC_FPU_ARCH_SOFTFLOAT = 0x00000002,
29 arch_env_t base; /**< must be derived from arch_env_t */
31 int fpu_arch; /**< FPU architecture */
34 extern const arch_irn_ops_t sparc_irn_ops;
37 * SPARC ABI requires some space which is always available at the top of
38 * the stack. It contains:
39 * 16*4 bytes space for spilling the register window
40 * 1*4 byte holding a pointer to space for aggregate returns (the space is
41 * always reserved, regardless whether we have an aggregate return
43 * 6*4 bytes Space for spilling parameters 0-5. For the cases when someone
44 * takes the address of a parameter. I guess this is also there so
45 * the implementation of va_args gets easier -> We can simply store
46 * param 0-5 in this spaces and then handle va_next by simply
47 * incrementing the stack pointer
49 #define SPARC_IMMEDIATE_MIN -4096
50 #define SPARC_IMMEDIATE_MAX 4095
51 #define SPARC_MIN_STACKSIZE 92
52 #define SPARC_AGGREGATE_RETURN_OFFSET 64
53 #define SPARC_PARAMS_SPILL_OFFSET 68
54 #define SPARC_SAVE_AREA_SIZE 64
55 #define SPARC_N_PARAM_REGS 6
56 #define SPARC_STACK_ALIGNMENT 8
57 #define SPARC_REGISTER_SIZE 4
59 static inline bool sparc_is_value_imm_encodeable(int32_t value)
61 return SPARC_IMMEDIATE_MIN <= value && value <= SPARC_IMMEDIATE_MAX;
64 void sparc_finish_graph(ir_graph *irg);
66 void sparc_introduce_prolog_epilog(ir_graph *irg);
68 void sparc_lower_64bit(void);
70 bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv);
71 void sparc_create_stacklayout(ir_graph *irg, calling_convention_t *cconv);
72 void sparc_adjust_stack_entity_offsets(ir_graph *irg);
73 void sparc_fix_stack_bias(ir_graph *irg);