* later in the other (NORMALISATION2).
*/
IR_GRAPH_STATE_NORMALISATION2 = 1U << 4,
+ /**
+ * Define the semantic of Load(Sel(x)), if x has a bit offset (Bitfields!).
+ * Normally, the frontend is responsible for bitfield masking operations.
+ * Set IMPLICIT_BITFIELD_MASKING, if the lowering phase must insert masking operations.
+ */
+ IR_GRAPH_STATE_IMPLICIT_BITFIELD_MASKING = 1U << 5,
} ir_graph_state_t;
ENUM_BITSET(ir_graph_state_t)
* Handle bit fields by added And/Or calculations.
*
* @param irg the graph to lower
- * @param lower_bitfields the graph contains old-style bitfield
- * constructs
*
* @note: There is NO lowering ob objects oriented types. This is highly compiler
* and ABI specific and should be placed directly in the compiler.
*/
-FIRM_API void lower_highlevel_graph(ir_graph *irg, int lower_bitfields);
+FIRM_API void lower_highlevel_graph(ir_graph *irg);
/**
* Creates an ir_graph pass for lower_highlevel_graph().
*
* @param name the name of this pass or NULL
- * @param lower_bitfields the graph contains old-style bitfield
- * constructs
*
* @return the newly created ir_graph pass
*/
-FIRM_API ir_graph_pass_t *lower_highlevel_graph_pass(const char *name,
- int lower_bitfields);
+FIRM_API ir_graph_pass_t *lower_highlevel_graph_pass(const char *name);
/**
* Replaces SymConsts by a real constant if possible.
* @note There is NO lowering of objects oriented types. This is highly compiler
* and ABI specific and should be placed directly in the compiler.
*/
-FIRM_API void lower_highlevel(int lower_bitfields);
+FIRM_API void lower_highlevel(void);
/**
* does the same as lower_highlevel for all nodes on the const code irg
* Replace Sel nodes by address computation. Also resolves array access.
* Handle Bitfields by added And/Or calculations.
*/
-void lower_highlevel_graph(ir_graph *irg, int lower_bitfields)
+void lower_highlevel_graph(ir_graph *irg)
{
- if (lower_bitfields) {
+ if (is_irg_state(irg, IR_GRAPH_STATE_IMPLICIT_BITFIELD_MASKING)) {
/* First step: lower bitfield access: must be run as long as Sels still
* exists. */
irg_walk_graph(irg, NULL, lower_bf_access, NULL);
typedef struct pass_t {
ir_graph_pass_t pass;
- int lower_bitfields;
} pass_t;
/**
*/
static int lower_highlevel_graph_wrapper(ir_graph *irg, void *context)
{
- pass_t *pass = (pass_t*)context;
+ (void)context;
- lower_highlevel_graph(irg, pass->lower_bitfields);
+ lower_highlevel_graph(irg);
return 0;
} /* lower_highlevel_graph_wrapper */
-ir_graph_pass_t *lower_highlevel_graph_pass(const char *name, int lower_bitfields)
+ir_graph_pass_t *lower_highlevel_graph_pass(const char *name)
{
pass_t *pass = XMALLOCZ(pass_t);
- pass->lower_bitfields = lower_bitfields;
return def_graph_pass_constructor(
&pass->pass, name ? name : "lower_hl", lower_highlevel_graph_wrapper);
} /* lower_highlevel_graph_pass */
* Replace Sel nodes by address computation. Also resolves array access.
* Handle Bitfields by added And/Or calculations.
*/
-void lower_highlevel(int lower_bitfields)
+void lower_highlevel()
{
size_t i, n;
n = get_irp_n_irgs();
for (i = 0; i < n; ++i) {
ir_graph *irg = get_irp_irg(i);
- lower_highlevel_graph(irg, lower_bitfields);
+ lower_highlevel_graph(irg);
}
lower_const_code();
} /* lower_highlevel */