1 #ifndef _ARM_NODES_ATTR_H_
2 #define _ARM_NODES_ATTR_H_
5 #include "../../common/firm_types.h"
7 /** A register requirement. */
8 typedef struct _arm_register_req_t {
9 const arch_register_req_t req;
10 int same_pos; /**< in case of "should be same" we need to remember the pos to get the irn */
11 int different_pos; /**< in case of "should be different" we need to remember the pos to get the irn */
15 * Possible ARM register shift types.
17 typedef enum _arm_shift_modifier {
18 ARM_SHF_NONE = 0, /**< no shift */
19 ARM_SHF_IMM = 1, /**< immediate operand with implicit ROR */
20 ARM_SHF_ASR = 2, /**< arithmetic shift right */
21 ARM_SHF_LSL = 3, /**< logical shift left */
22 ARM_SHF_LSR = 4, /**< logical shift right */
23 ARM_SHF_ROR = 5, /**< rotate right */
24 ARM_SHF_RRX = 6, /**< rotate with sign extend */
27 /** True, if the modifier implies a shift argument */
28 #define ARM_HAS_SHIFT(mod) ((mod) > ARM_SHF_IMM)
30 /** get the shift modifier from flags */
31 #define ARM_GET_SHF_MOD(attr) ((attr)->instr_fl & 7)
33 /** set the shift modifier to flags */
34 #define ARM_SET_SHF_MOD(attr, mod) ((attr)->instr_fl = (((attr)->instr_fl & ~7) | (mod)))
38 * Possible ARM condition codes.
40 typedef enum _arm_condition {
41 ARM_COND_EQ = 0, /**< Equal, Z set. */
42 ARM_COND_NE = 1, /**< Not Equal, Z clear */
43 ARM_COND_CS = 2, /**< Carry set, unsigned >=, C set */
44 ARM_COND_CC = 3, /**< Carry clear, unsigned <, C clear */
45 ARM_COND_MI = 4, /**< Minus/Negativ, N set */
46 ARM_COND_PL = 5, /**< Plus/Positiv or Zero, N clear */
47 ARM_COND_VS = 6, /**< Overflow, V set */
48 ARM_COND_VC = 7, /**< No overflow, V clear */
49 ARM_COND_HI = 8, /**< unsigned >, C set and Z clear */
50 ARM_COND_LS = 9, /**< unsigned <=, C clear or Z set */
51 ARM_COND_GE = 10, /**< signed >=, N == V */
52 ARM_COND_LT = 11, /**< signed <, N != V */
53 ARM_COND_GT = 12, /**< signed >, Z clear and N == V */
54 ARM_COND_LE = 13, /**< signed <=, Z set or N != V */
55 ARM_COND_AL = 14, /**< Always (unconditional) */
56 ARM_COND_NV = 15 /**< forbidden */
59 /** Get the condition code from flags */
60 #define ARM_GET_COND(attr) (((attr)->instr_fl >> 3) & 15)
62 /** Set the condition code to flags */
63 #define ARM_SET_COND(attr, code) ((attr)->instr_fl = (((attr)->instr_fl & ~(15 << 3)) | ((code) << 3)))
65 typedef struct _arm_attr_t {
66 arch_irn_flags_t flags; /**< indicating if spillable, rematerializeable ... etc. */
67 int n_res; /**< number of results for this node */
69 const arm_register_req_t **in_req; /**< register requirements for arguments */
70 const arm_register_req_t **out_req; /**< register requirements for results */
72 ir_mode *op_mode; /**< operation mode */
73 unsigned instr_fl; /**< condition code, shift modifier */
74 tarval *value; /**< immediate */
75 const char *symconst_label;
78 long default_proj_num;
80 /* must be last, dynamically allocated */
81 const arch_register_t *slots[1]; /**< register slots for assigned registers */
85 * Returns the shift modifier string.
87 const char *arm_shf_mod_name(arm_shift_modifier mod);
89 #endif /* _ARM_NODES_ATTR_H_ */