Use create_Const_from_bool() instead of duplicating it.
authorChristoph Mallon <christoph.mallon@gmx.de>
Tue, 17 Apr 2012 09:23:17 +0000 (11:23 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Tue, 17 Apr 2012 09:23:17 +0000 (11:23 +0200)
ast2firm.c

index 6c5fcb9..5e55bc2 100644 (file)
@@ -1072,15 +1072,16 @@ static ir_node *create_symconst(dbg_info *dbgi, ir_entity *entity)
        return new_d_SymConst(dbgi, mode_P, sym, symconst_addr_ent);
 }
 
+static ir_node *create_Const_from_bool(ir_mode *const mode, bool const v)
+{
+       return new_Const((v ? get_mode_one : get_mode_null)(mode));
+}
+
 static ir_node *create_conv_from_b(dbg_info *dbgi, ir_node *value,
                                    ir_mode *dest_mode)
 {
        if (is_Const(value)) {
-               if (is_Const_null(value)) {
-                       return new_Const(get_mode_null(dest_mode));
-               } else {
-                       return new_Const(get_mode_one(dest_mode));
-               }
+               return create_Const_from_bool(dest_mode, !is_Const_null(value));
        }
 
        ir_node *cond       = new_d_Cond(dbgi, value);
@@ -1121,11 +1122,6 @@ static ir_node *create_conv(dbg_info *dbgi, ir_node *value, ir_mode *dest_mode)
        return new_d_Conv(dbgi, value, dest_mode);
 }
 
-static ir_node *create_Const_from_bool(ir_mode *const mode, bool const v)
-{
-       return new_Const((v ? get_mode_one : get_mode_null)(mode));
-}
-
 /**
  * Creates a SymConst node representing a wide string literal.
  *