sparc: fix too short Save offsets
[libfirm] / ir / be / sparc / bearch_sparc_t.h
1 /*
2  * Copyright (C) 1995-2008 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   declarations for SPARC backend -- private header
23  * @author  Hannes Rapp, Matthias Braun
24  */
25 #ifndef FIRM_BE_SPARC_BEARCH_SPARC_T_H
26 #define FIRM_BE_SPARC_BEARCH_SPARC_T_H
27
28 #include <stdbool.h>
29 #include "sparc_nodes_attr.h"
30 #include "be.h"
31
32 typedef struct sparc_isa_t            sparc_isa_t;
33 typedef struct calling_convention_t   calling_convention_t;
34
35 /** Floating point instruction set. */
36 enum sparc_fp_architectures {
37         SPARC_FPU_ARCH_NONE      = 0,
38         SPARC_FPU_ARCH_FPU       = 0x00000001,
39         SPARC_FPU_ARCH_SOFTFLOAT = 0x00000002,
40 };
41
42 struct sparc_isa_t {
43         arch_env_t  base;      /**< must be derived from arch_env_t */
44         pmap       *constants;
45         int         fpu_arch;  /**< FPU architecture */
46 };
47
48 extern const arch_irn_ops_t sparc_irn_ops;
49
50 /**
51  * SPARC ABI requires some space which is always available at the top of
52  * the stack. It contains:
53  * 16*4 bytes space for spilling the register window
54  * 1*4 byte   holding a pointer to space for aggregate returns (the space is
55  *            always reserved, regardless whether we have an aggregate return
56  *            or not)
57  * 6*4 bytes  Space for spilling parameters 0-5. For the cases when someone
58  *            takes the address of a parameter. I guess this is also there so
59  *            the implementation of va_args gets easier -> We can simply store
60  *            param 0-5 in this spaces and then handle va_next by simply
61  *            incrementing the stack pointer
62  */
63 #define SPARC_IMMEDIATE_MIN           -4096
64 #define SPARC_IMMEDIATE_MAX            4095
65 #define SPARC_MIN_STACKSIZE              92
66 #define SPARC_AGGREGATE_RETURN_OFFSET    64
67 #define SPARC_PARAMS_SPILL_OFFSET        68
68 #define SPARC_SAVE_AREA_SIZE             64
69 #define SPARC_N_PARAM_REGS                6
70 #define SPARC_STACK_ALIGNMENT             8
71 #define SPARC_REGISTER_SIZE               4
72
73 static inline bool sparc_is_value_imm_encodeable(int32_t value)
74 {
75         return SPARC_IMMEDIATE_MIN <= value && value <= SPARC_IMMEDIATE_MAX;
76 }
77
78 void sparc_finish_graph(ir_graph *irg);
79
80 void sparc_introduce_prolog_epilog(ir_graph *irg);
81
82 void sparc_lower_64bit(void);
83
84 bool sparc_variadic_fixups(ir_graph *irg, calling_convention_t *cconv);
85 void sparc_create_stacklayout(ir_graph *irg, calling_convention_t *cconv);
86 void sparc_adjust_stack_entity_offsets(ir_graph *irg);
87 void sparc_fix_stack_bias(ir_graph *irg);
88
89 #endif