beemit: Provide be_set_emitter() replacing identical functions in all backends.
[libfirm] / ir / be / arm / arm_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   declarations for ARM node attributes
23  * @author  Oliver Richter, Tobias Gneist, Michael Beck
24  */
25 #ifndef FIRM_BE_ARM_ARM_NODES_ATTR_H
26 #define FIRM_BE_ARM_ARM_NODES_ATTR_H
27
28 #include "firm_types.h"
29 #include "irnode_t.h"
30 #include "bearch.h"
31
32 /**
33  * Possible ARM "shifter operand" addressing mode types.
34  */
35 typedef enum arm_shift_modifier_t {
36         ARM_SHF_INVALID,   /**< invalid shift */
37         ARM_SHF_REG,       /**< simple register operand */
38         ARM_SHF_IMM,       /**< immediate operand with implicit ROR */
39         ARM_SHF_ASR_IMM,   /**< arithmetic shift right */
40         ARM_SHF_ASR_REG,   /**< arithmetic shift right */
41         ARM_SHF_LSL_IMM,   /**< logical shift left */
42         ARM_SHF_LSL_REG,   /**< logical shift left */
43         ARM_SHF_LSR_IMM,   /**< logical shift right */
44         ARM_SHF_LSR_REG,   /**< logical shift right */
45         ARM_SHF_ROR_IMM,   /**< rotate right */
46         ARM_SHF_ROR_REG,   /**< rotate right */
47         ARM_SHF_RRX,       /**< rotate right through carry bits */
48 } arm_shift_modifier_t;
49
50 /** Encoding for fpa immediates */
51 enum fpa_immediates {
52         fpa_null = 0,
53         fpa_one,
54         fpa_two,
55         fpa_three,
56         fpa_four,
57         fpa_five,
58         fpa_ten,
59         fpa_half,
60         fpa_max
61 };
62
63 /** Generic ARM node attributes. */
64 typedef struct arm_attr_t {
65         except_attr                 exc;                /**< the exception attribute. MUST be the first one. */
66         bool                        is_load_store : 1;  /**< if set, this is a load or store instruction */
67 } arm_attr_t;
68
69 /**
70  * This struct holds information needed to produce the arm
71  * "data processing operands" also called "shifter operand" addressing modes
72  */
73 typedef struct arm_shifter_operand_t {
74         arm_attr_t            base;
75         arm_shift_modifier_t  shift_modifier;
76         unsigned char         immediate_value;
77         unsigned char         shift_immediate;
78 } arm_shifter_operand_t;
79
80 typedef struct arm_cmp_attr_t {
81         arm_shifter_operand_t  base;
82         bool                   ins_permuted : 1;
83         bool                   is_unsigned  : 1;
84 } arm_cmp_attr_t;
85
86 /**
87  * this struct holds information needed to produce the arm addressing modes
88  * for "Load and Store Word or Unsigned Byte", "Miscellaneous Loads and Stores"
89  * and "Load and Store Multiple" */
90 typedef struct arm_load_store_attr_t {
91         arm_attr_t  base;
92         ir_mode    *load_store_mode;
93         ir_entity  *entity;
94         long        offset;
95         bool        is_frame_entity : 1;
96         bool        entity_sign     : 1;
97 } arm_load_store_attr_t;
98
99 /** Attributes for a SymConst */
100 typedef struct arm_SymConst_attr_t {
101         arm_attr_t  base;
102         ir_entity  *entity;
103         int         fp_offset;
104 } arm_SymConst_attr_t;
105
106 /** Attributes for a CondJmp */
107 typedef struct arm_CondJmp_attr_t {
108         arm_attr_t  base;
109         ir_relation relation;
110 } arm_CondJmp_attr_t;
111
112 /** Attributes for a SwitchJmp */
113 typedef struct arm_SwitchJmp_attr_t {
114         arm_attr_t             base;
115         const ir_switch_table *table;
116 } arm_SwitchJmp_attr_t;
117
118 /** CopyB attributes */
119 typedef struct arm_CopyB_attr_t {
120         arm_attr_t  base;
121         unsigned    size;
122 } arm_CopyB_attr_t;
123
124 /** Attributes for a fConst */
125 typedef struct arm_fConst_attr_t {
126         arm_attr_t  base;
127         ir_tarval  *tv;              /**< the tarval representing the FP const */
128 } arm_fConst_attr_t;
129
130 /** attributes for floatingpoint arithmetic operations */
131 typedef struct arm_farith_attr_t {
132         arm_attr_t  base;
133         ir_mode    *mode; /* operation mode */
134 } arm_farith_attr_t;
135
136 #define CAST_ARM_ATTR(type,ptr)        ((type *)(ptr))
137 #define CONST_CAST_ARM_ATTR(type,ptr)  ((const type *)(ptr))
138
139 #endif