besched: Change sched_foreach_from(sched_next(x), y) to sched_foreach_after(x, y).
[libfirm] / ir / be / sparc / bearch_sparc_t.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 University of Karlsruhe.
4  */
5
6 /**
7  * @file
8  * @brief   declarations for SPARC backend -- private header
9  * @author  Hannes Rapp, Matthias Braun
10  */
11 #ifndef FIRM_BE_SPARC_BEARCH_SPARC_T_H
12 #define FIRM_BE_SPARC_BEARCH_SPARC_T_H
13
14 #include <stdbool.h>
15 #include "sparc_nodes_attr.h"
16 #include "be.h"
17
18 typedef struct sparc_isa_t            sparc_isa_t;
19 typedef struct calling_convention_t   calling_convention_t;
20
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,
26 };
27
28 struct sparc_isa_t {
29         arch_env_t  base;      /**< must be derived from arch_env_t */
30         pmap       *constants;
31         int         fpu_arch;  /**< FPU architecture */
32 };
33
34 extern const arch_irn_ops_t sparc_irn_ops;
35
36 /**
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
42  *            or not)
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
48  */
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
58
59 static inline bool sparc_is_value_imm_encodeable(int32_t value)
60 {
61         return SPARC_IMMEDIATE_MIN <= value && value <= SPARC_IMMEDIATE_MAX;
62 }
63
64 void sparc_finish_graph(ir_graph *irg);
65
66 void sparc_introduce_prolog_epilog(ir_graph *irg);
67
68 void sparc_lower_64bit(void);
69
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);
74
75 #endif