Commit 089b90d3 authored by Matthias Braun's avatar Matthias Braun
Browse files

hide enum as bitfield base type extension behind a macro

parent 639fd69a
......@@ -38,11 +38,19 @@
*/
#define UNUSED __attribute__((unused))
/**
* Use an enum type as the base type for a bitfield. This is more usefull
* than using the generic "unsigned" because the compiler can warn if the
* range of enum elements exceeds the bitfield size now.
*/
#define ENUMBF(type) __extension__ type
#else
#define LIKELY(x) x
#define UNLIKELY(x) x
#define PURE
#define UNUSED
#define ENUMBF(type) unsigned
#endif
/**
......
......@@ -38,7 +38,7 @@ struct amd64_attr_t
unsigned ins_permuted : 1; /**< inputs of node have been permuted
(for commutative nodes) */
unsigned cmp_unsigned : 1; /**< compare should be unsigned */
__extension__ amd64_insn_mode_t insn_mode : 2;
ENUMBF(amd64_insn_mode_t) insn_mode : 2;
} data;
struct amd64_attr_extended {
ir_relation relation; /**< type of compare operation >*/
......
......@@ -278,16 +278,16 @@ typedef struct alloc_attr {
/** Load attributes. */
typedef struct load_attr {
except_attr exc; /**< The exception attribute. MUST be the first one. */
__extension__ ir_volatility volatility:1; /**< The volatility of this Load operation. */
__extension__ ir_align unaligned:1; /**< The align attribute of this Load operation. */
ENUMBF(ir_volatility) volatility:1; /**< The volatility of this Load operation. */
ENUMBF(ir_align) unaligned:1; /**< The align attribute of this Load operation. */
ir_mode *mode; /**< The mode of this Load operation. */
} load_attr;
/** Store attributes. */
typedef struct store_attr {
except_attr exc; /**< the exception attribute. MUST be the first one. */
__extension__ ir_volatility volatility:1; /**< The volatility of this Store operation. */
__extension__ ir_align unaligned:1; /**< The align attribute of this Store operation. */
ENUMBF(ir_volatility) volatility:1; /**< The volatility of this Store operation. */
ENUMBF(ir_align) unaligned:1; /**< The align attribute of this Store operation. */
} store_attr;
typedef struct phi_attr {
......@@ -316,7 +316,7 @@ typedef struct confirm_attr {
/** CopyB attribute. */
typedef struct copyb_attr {
ir_type *type; /**< Type of the copied entity. */
__extension__ ir_volatility volatility:1; /**< The volatility of this CopyB operation. */
ENUMBF(ir_volatility) volatility:1; /**< The volatility of this CopyB operation. */
} copyb_attr;
/** Div attribute. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment