sparc: redo and improve sparc immediate handling (low-part after sethi is now omitted...
[libfirm] / ir / be / sparc / sparc_nodes_attr.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   attributes attached to all sparc nodes
23  * @version $Id$
24  */
25 #ifndef FIRM_BE_SPARC_SPARC_NODES_ATTR_H
26 #define FIRM_BE_SPARC_SPARC_NODES_ATTR_H
27
28 #include "../bearch.h"
29 #include <stdint.h>
30
31 typedef struct sparc_attr_t  sparc_attr_t;
32
33 /**
34  * base SPARC attribute
35  */
36 struct sparc_attr_t
37 {
38         except_attr                 exc;                /**< the exception attribute. MUST be the first one. */
39         const arch_register_req_t **in_req;             /**< register requirements for arguments */
40         int32_t                     immediate_value;    /* immediate values */
41         bool                        is_load_store;
42
43         ir_entity                  *immediate_value_entity; /* hack for now */
44 };
45
46 enum sparc_arch_irn_flags_t {
47         sparc_arch_irn_flag_modifies_flags        = arch_irn_flags_backend << 0,
48         sparc_arch_irn_flag_modifies_fp_flags     = arch_irn_flags_backend << 1,
49         sparc_arch_irn_flag_needs_64bit_spillslot = arch_irn_flags_backend << 2,
50 };
51
52 /**
53  * attribute for FP immediate instruction
54  */
55 typedef struct sparc_fp_attr_t sparc_fp_attr_t;
56 struct sparc_fp_attr_t {
57         sparc_attr_t  base;         /**< generic attribute */
58         ir_mode      *fp_mode;
59 };
60
61 typedef struct sparc_fp_conv_attr_t sparc_fp_conv_attr_t;
62 struct sparc_fp_conv_attr_t {
63         sparc_attr_t  base;
64         ir_mode      *src_mode;
65         ir_mode      *dest_mode;
66 };
67
68 /**
69  * attribute for save instruction
70  */
71 typedef struct sparc_save_attr_t sparc_save_attr_t;
72 struct sparc_save_attr_t {
73         sparc_attr_t  base;              /**< generic attribute */
74         int           initial_stacksize; /* the min. stack size required by the sparc ABI */
75 };
76
77 /**
78  * attributes for load/store adressing modes
79  */
80 typedef struct sparc_load_store_attr_t sparc_load_store_attr_t;
81 struct sparc_load_store_attr_t {
82         sparc_attr_t  base;    /**< generic attribute */
83         ir_mode      *load_store_mode;
84         ir_entity    *entity;
85         int           entity_sign;
86         long          offset;
87         bool          is_frame_entity;
88 };
89
90 /**
91  * attributes for SymConsts
92  */
93 typedef struct sparc_symconst_attr_t sparc_symconst_attr_t;
94 struct sparc_symconst_attr_t {
95         sparc_attr_t  base;    /**< generic attribute */
96         ir_entity    *entity;
97         int           fp_offset;
98 };
99
100 /**
101  * attributes for conditional jumps
102  */
103 typedef struct sparc_jmp_cond_attr_t sparc_jmp_cond_attr_t;
104 struct sparc_jmp_cond_attr_t {
105         sparc_attr_t base;    /**< generic attribute */
106         pn_Cmp       pnc;
107         bool         is_unsigned : 1;
108 };
109
110 /**
111  * attributes for switch jumps
112  */
113 typedef struct sparc_jmp_switch_attr_t sparc_jmp_switch_attr_t;
114 struct sparc_jmp_switch_attr_t {
115         sparc_attr_t  base;    /**< generic attribute */
116         int           n_projs;
117         long          default_proj_num;
118 };
119
120 #endif