some comments added and fixed
[libfirm] / ir / lower / lower_hl.c
index 4d5c336..e243cee 100644 (file)
@@ -223,8 +223,10 @@ static void lower_sel(ir_node *sel) {
                        newn   = get_Sel_ptr(sel);
                        offset = get_entity_offset(ent);
                        if (offset != 0) {
-                               tv = new_tarval_from_long(offset, mode_Int);
-                               cnst = new_r_Const(irg, get_irg_start_block(irg), mode_Int, tv);
+                               ir_mode *mode_UInt = get_reference_mode_unsigned_eq(mode);
+
+                               tv = new_tarval_from_long(offset, mode_UInt);
+                               cnst = new_r_Const(irg, get_irg_start_block(irg), mode_UInt, tv);
                                newn = new_rd_Add(dbg, irg, bl, newn, cnst, mode);
                        }
                } else {
@@ -588,7 +590,7 @@ static void lower_bf_access(ir_node *irn, void *env) {
  */
 void lower_highlevel_graph(ir_graph *irg, int lower_bitfields) {
 
-       if(lower_bitfields) {
+       if (lower_bitfields) {
                /* First step: lower bitfield access: must be run as long as Sels still
                 * exists. */
                irg_walk_graph(irg, NULL, lower_bf_access, NULL);
@@ -597,11 +599,14 @@ void lower_highlevel_graph(ir_graph *irg, int lower_bitfields) {
        /* Finally: lower SymConst-Size and Sel nodes, Casts, unaligned Load/Stores. */
        irg_walk_graph(irg, NULL, lower_irnode, NULL);
        set_irg_phase_low(irg);
-}  /* lower_highlevel */
+}  /* lower_highlevel_graph */
 
+/*
+ * does the same as lower_highlevel() for all nodes on the const code irg
+ */
 void lower_const_code(void) {
        walk_const_code(NULL, lower_irnode, NULL);
-}
+}  /* lower_const_code */
 
 /*
  * Replaces SymConsts by a real constant if possible.