irop_flag_constlike flag and is_op_constlike() function added
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 14 Sep 2005 10:17:24 +0000 (10:17 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 14 Sep 2005 10:17:24 +0000 (10:17 +0000)
[r6615]

ir/ir/irop.c
ir/ir/irop.h
ir/ir/irop_t.h

index db8a14c..a2497ea 100644 (file)
@@ -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));
index 052bda4..30d6249 100644 (file)
@@ -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. */
index 6adbfb0..fc18e3f 100644 (file)
@@ -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;
 }