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
20 #ifndef _ARM_NODES_ATTR_H_
21 #define _ARM_NODES_ATTR_H_
23 #include "../bearch_t.h"
24 #include "../../common/firm_types.h"
27 * Possible ARM register shift types.
29 typedef enum _arm_shift_modifier {
30 ARM_SHF_NONE = 0, /**< no shift */
31 ARM_SHF_IMM = 1, /**< immediate operand with implicit ROR */
32 ARM_SHF_ASR = 2, /**< arithmetic shift right */
33 ARM_SHF_LSL = 3, /**< logical shift left */
34 ARM_SHF_LSR = 4, /**< logical shift right */
35 ARM_SHF_ROR = 5, /**< rotate right */
36 ARM_SHF_RRX = 6, /**< rotate with sign extend */
39 /** True, if the modifier implies a shift argument */
40 #define ARM_HAS_SHIFT(mod) ((mod) > ARM_SHF_IMM)
42 /** get the shift modifier from flags */
43 #define ARM_GET_SHF_MOD(attr) ((attr)->instr_fl & 7)
45 /** set the shift modifier to flags */
46 #define ARM_SET_SHF_MOD(attr, mod) ((attr)->instr_fl = (((attr)->instr_fl & ~7) | (mod)))
50 * Possible ARM condition codes.
52 typedef enum _arm_condition {
53 ARM_COND_EQ = 0, /**< Equal, Z set. */
54 ARM_COND_NE = 1, /**< Not Equal, Z clear */
55 ARM_COND_CS = 2, /**< Carry set, unsigned >=, C set */
56 ARM_COND_CC = 3, /**< Carry clear, unsigned <, C clear */
57 ARM_COND_MI = 4, /**< Minus/Negativ, N set */
58 ARM_COND_PL = 5, /**< Plus/Positiv or Zero, N clear */
59 ARM_COND_VS = 6, /**< Overflow, V set */
60 ARM_COND_VC = 7, /**< No overflow, V clear */
61 ARM_COND_HI = 8, /**< unsigned >, C set and Z clear */
62 ARM_COND_LS = 9, /**< unsigned <=, C clear or Z set */
63 ARM_COND_GE = 10, /**< signed >=, N == V */
64 ARM_COND_LT = 11, /**< signed <, N != V */
65 ARM_COND_GT = 12, /**< signed >, Z clear and N == V */
66 ARM_COND_LE = 13, /**< signed <=, Z set or N != V */
67 ARM_COND_AL = 14, /**< Always (unconditional) */
68 ARM_COND_NV = 15 /**< forbidden */
71 /** Get the condition code from flags */
72 #define ARM_GET_COND(attr) (((attr)->instr_fl >> 3) & 15)
74 /** Set the condition code to flags */
75 #define ARM_SET_COND(attr, code) ((attr)->instr_fl = (((attr)->instr_fl & ~(15 << 3)) | ((code) << 3)))
77 typedef struct _arm_attr_t {
78 arch_irn_flags_t flags; /**< indicating if spillable, rematerializeable ... etc. */
79 int n_res; /**< number of results for this node */
81 const arch_register_req_t **in_req; /**< register requirements for arguments */
82 const arch_register_req_t **out_req; /**< register requirements for results */
84 ir_mode *op_mode; /**< operation mode */
85 unsigned instr_fl; /**< condition code, shift modifier */
86 tarval *value; /**< immediate */
87 const char *symconst_label;
90 long default_proj_num;
92 /* must be last, dynamically allocated */
93 const arch_register_t *slots[1]; /**< register slots for assigned registers */
97 * Returns the shift modifier string.
99 const char *arm_shf_mod_name(arm_shift_modifier mod);
101 #endif /* _ARM_NODES_ATTR_H_ */