2 * Copyright (C) 1995-2007 University of Karlsruhe. All right reserved.
4 * This file is part of libFirm.
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.
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.
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
22 * @brief declarations for arm node attributes
23 * @author Oliver Richter, Tobias Gneist
26 #ifndef FIRM_BE_ARM_ARM_NODES_ATTR_H
27 #define FIRM_BE_ARM_ARM_NODES_ATTR_H
29 #include "firm_types.h"
31 #include "../bearch_t.h"
34 * Possible ARM register shift types.
36 typedef enum _arm_shift_modifier {
37 ARM_SHF_NONE = 0, /**< no shift */
38 ARM_SHF_IMM = 1, /**< immediate operand with implicit ROR */
39 ARM_SHF_ASR = 2, /**< arithmetic shift right */
40 ARM_SHF_LSL = 3, /**< logical shift left */
41 ARM_SHF_LSR = 4, /**< logical shift right */
42 ARM_SHF_ROR = 5, /**< rotate right */
43 ARM_SHF_RRX = 6, /**< rotate with sign extend */
46 /** True, if the modifier implies a shift argument */
47 #define ARM_HAS_SHIFT(mod) ((mod) > ARM_SHF_IMM)
49 /** get the shift modifier from flags */
50 #define ARM_GET_SHF_MOD(attr) ((attr)->instr_fl & 7)
52 /** set the shift modifier to flags */
53 #define ARM_SET_SHF_MOD(attr, mod) ((attr)->instr_fl = (((attr)->instr_fl & ~7) | (mod)))
57 * Possible ARM condition codes.
59 typedef enum _arm_condition {
60 ARM_COND_EQ = 0, /**< Equal, Z set. */
61 ARM_COND_NE = 1, /**< Not Equal, Z clear */
62 ARM_COND_CS = 2, /**< Carry set, unsigned >=, C set */
63 ARM_COND_CC = 3, /**< Carry clear, unsigned <, C clear */
64 ARM_COND_MI = 4, /**< Minus/Negativ, N set */
65 ARM_COND_PL = 5, /**< Plus/Positiv or Zero, N clear */
66 ARM_COND_VS = 6, /**< Overflow, V set */
67 ARM_COND_VC = 7, /**< No overflow, V clear */
68 ARM_COND_HI = 8, /**< unsigned >, C set and Z clear */
69 ARM_COND_LS = 9, /**< unsigned <=, C clear or Z set */
70 ARM_COND_GE = 10, /**< signed >=, N == V */
71 ARM_COND_LT = 11, /**< signed <, N != V */
72 ARM_COND_GT = 12, /**< signed >, Z clear and N == V */
73 ARM_COND_LE = 13, /**< signed <=, Z set or N != V */
74 ARM_COND_AL = 14, /**< Always (unconditional) */
75 ARM_COND_NV = 15 /**< forbidden */
78 /** Get the condition code from flags */
79 #define ARM_GET_COND(attr) (((attr)->instr_fl >> 3) & 15)
81 /** Set the condition code to flags */
82 #define ARM_SET_COND(attr, code) ((attr)->instr_fl = (((attr)->instr_fl & ~(15 << 3)) | ((code) << 3)))
84 /** Generic ARM node attributes. */
85 typedef struct _arm_attr_t {
86 except_attr exc; /**< the exception attribute. MUST be the first one. */
87 arch_irn_flags_t flags; /**< indicating if spillable, rematerializeable ... etc. */
89 const arch_register_req_t **in_req; /**< register requirements for arguments */
90 const arch_register_req_t **out_req; /**< register requirements for results */
92 ir_mode *op_mode; /**< operation mode if different from node's mode */
93 unsigned instr_fl; /**< condition code, shift modifier */
94 tarval *value; /**< immediate */
95 int *out_flags; /**< flags for each produced value */
97 const arch_register_t **slots; /**< register slots for assigned registers */
100 /** Attributes for a SymConst */
101 typedef struct _arm_SymConst_attr_t {
103 ident *symconst_id; /**< for SymConsts: its ident */
104 } arm_SymConst_attr_t;
106 /** Attributes for a CondJmp */
107 typedef struct _arm_CondJmp_attr_t {
110 } arm_CondJmp_attr_t;
112 /** Attributes for a SwitchJmp */
113 typedef struct _arm_SwitchJmp_attr_t {
116 long default_proj_num;
117 } arm_SwitchJmp_attr_t;
120 * Returns the shift modifier string.
122 const char *arm_shf_mod_name(arm_shift_modifier mod);