From: Michael Beck Date: Wed, 14 Sep 2005 10:17:24 +0000 (+0000) Subject: irop_flag_constlike flag and is_op_constlike() function added X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=99d5b69d2e62cfc4f3ca0268677b867f07631edb;p=libfirm irop_flag_constlike flag and is_op_constlike() function added [r6615] --- diff --git a/ir/ir/irop.c b/ir/ir/irop.c index db8a14c8e..a2497ea13 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -181,6 +181,7 @@ init_op(void) #define F irop_flag_fragile #define Y irop_flag_forking #define H irop_flag_highlevel +#define c irop_flag_constlike op_Block = new_ir_op(iro_Block, "Block", op_pin_state_pinned, L, oparity_variable, -1, sizeof(block_attr)); @@ -192,8 +193,8 @@ init_op(void) op_Return = new_ir_op(iro_Return, "Return", op_pin_state_pinned, L|X, oparity_zero, -1, 0); op_Raise = new_ir_op(iro_Raise, "Raise", op_pin_state_pinned, L|X, oparity_any, -1, 0); - op_Const = new_ir_op(iro_Const, "Const", op_pin_state_floats, N, oparity_zero, -1, sizeof(const_attr)); - op_SymConst = new_ir_op(iro_SymConst, "SymConst", op_pin_state_floats, N, oparity_zero, -1, sizeof(symconst_attr)); + op_Const = new_ir_op(iro_Const, "Const", op_pin_state_floats, c, oparity_zero, -1, sizeof(const_attr)); + op_SymConst = new_ir_op(iro_SymConst, "SymConst", op_pin_state_floats, c, oparity_zero, -1, sizeof(symconst_attr)); op_Sel = new_ir_op(iro_Sel, "Sel", op_pin_state_floats, L, oparity_any, -1, sizeof(sel_attr)); op_InstOf = new_ir_op(iro_InstOf, "InstOf", op_pin_state_floats, L, oparity_any, -1, sizeof(sel_attr)); diff --git a/ir/ir/irop.h b/ir/ir/irop.h index 052bda4bd..30d6249ee 100644 --- a/ir/ir/irop.h +++ b/ir/ir/irop.h @@ -53,8 +53,10 @@ typedef enum { irop_flag_fragile = 0x00000010, /**< set if the operation can change the control flow because of an exception */ irop_flag_forking = 0x00000020, /**< the operation is a forking control flow */ - irop_flag_highlevel = 0x00000040 /**< the operation is a pure high-level one and can be + irop_flag_highlevel = 0x00000040, /**< the operation is a pure high-level one and can be skipped in low-level optimizations */ + irop_flag_constlike = 0x00000080 /**< the operation has no arguments and is some + kind of a constant */ } irop_flags; /** The opcodes of the libFirm predefined operations. */ diff --git a/ir/ir/irop_t.h b/ir/ir/irop_t.h index 6adbfb023..fc18e3fdd 100644 --- a/ir/ir/irop_t.h +++ b/ir/ir/irop_t.h @@ -167,6 +167,11 @@ static INLINE int is_op_highlevel(const ir_op *op) { return op->flags & irop_flag_highlevel; } +/* Returns non-zero if operation is a const-like op */ +static INLINE int is_op_constlike(const ir_op *op) { + return op->flags & irop_flag_constlike; +} + static INLINE opcode _get_op_code(const ir_op *op) { return op->code; }