ia32_pn_Cmp_Unsigned = 0x100 /**< set this flag in a pnc to indicate an unsigned compare operation */
};
+#ifndef NDEBUG
+typedef enum {
+ IA32_ATTR_INVALID = 0,
+ IA32_ATTR_ia32_attr_t = 1 << 0,
+ IA32_ATTR_ia32_x87_attr_t = 1 << 1,
+ IA32_ATTR_ia32_asm_attr_t = 1 << 2,
+} ia32_attr_type_t;
+#endif
+
typedef struct ia32_attr_t ia32_attr_t;
struct ia32_attr_t {
struct {
unsigned got_lea:1; /**< Indicates whether or not this node already consumed a LEA. */
unsigned need_stackent:1; /**< Set to 1 if node need space on stack. */
-
- unsigned n_res:6; /**< Number of results produced by this node. */
} data;
int *out_flags; /**< flags for each produced value */
union {
tarval *tv; /**< tarval for immediate operations */
ir_entity *sc; /**< the symconst ident */
- ident *asm_text; /**< used by asm node */
} cnst_val;
ir_mode *ls_mode; /**< Load/Store mode: This is the mode of the value
unsigned latency; /**< the latency of the instruction in clock cycles */
#ifndef NDEBUG
- const char *orig_node; /**< holds the name of the original ir node for debugging purposes */
-#endif /* NDEBUG */
+ const char *orig_node; /**< holds the name of the original ir node */
+ unsigned attr_type; /**< bitfield indicating the attribute type */
+#endif
const be_execution_unit_t ***exec_units; /**< list of units this operation can be executed on */
const arch_register_req_t **in_req; /**< register requirements for arguments */
const arch_register_req_t **out_req; /**< register requirements for results */
- const arch_register_t *x87[3]; /**< register slots for x87 register */
+ const arch_register_t **slots; /**< register slots for assigned registers */
+};
+
+typedef struct ia32_x87_attr_t ia32_x87_attr_t;
+struct ia32_x87_attr_t {
+ ia32_attr_t attr;
+ const arch_register_t *x87[3]; /**< register slots for x87 register */
+};
- /* must be last, dynamic */
- const arch_register_t *slots[1]; /**< register slots for assigned registers */
+typedef struct ia32_asm_attr_t ia32_asm_attr_t;
+struct ia32_asm_attr_t {
+ ia32_x87_attr_t x87_attr;
+ ident *asm_text;
};
-#endif /* FIRM_BE_IA32_IA32_NODES_ATTR_H */
+/* the following union is necessary to indicate to the compiler that we might want to cast
+ * the structs (we use them to simulate OO-inheritance) */
+union allow_casts_attr_t_ {
+ ia32_attr_t attr;
+ ia32_x87_attr_t x87_attr;
+ ia32_asm_attr_t asm_attr;
+};
+
+#ifndef NDEBUG
+#define CAST_IA32_ATTR(type,ptr) (assert( ((const ia32_attr_t*)(ptr))->attr_type & IA32_ATTR_ ## type ), (type*) (ptr))
+#define CONST_CAST_IA32_ATTR(type,ptr) (assert( ((const ia32_attr_t*)(ptr))->attr_type & IA32_ATTR_ ## type ), (const type*) (ptr))
+#else
+#define CAST_IA32_ATTR(type,ptr) ((type*) (ptr))
+#define CONST_CAST_IA32_ATTR(type,ptr) ((const type*) (ptr))
+#endif
+
+#endif