fixed svn properties
[libfirm] / ir / lower / lower_hl.c
index b77fcfd..c6282a5 100644 (file)
@@ -352,6 +352,10 @@ static void lower_bitfields_loads(ir_node *proj, ir_node *load) {
        ent     = get_Sel_entity(sel);
        bf_type = get_entity_type(ent);
 
+       /* must be a bitfield type */
+       if (!is_Primitive_type(bf_type) || get_primitive_base_type(bf_type) == NULL)
+               return;
+
        /* We have a bitfield access, if either a bit offset is given, or
           the size is not integral. */
        bf_mode = get_type_mode(bf_type);
@@ -441,6 +445,10 @@ static void lower_bitfields_stores(ir_node *store) {
        ent     = get_Sel_entity(sel);
        bf_type = get_entity_type(ent);
 
+       /* must be a bitfield type */
+       if (!is_Primitive_type(bf_type) || get_primitive_base_type(bf_type) == NULL)
+               return;
+
        /* We have a bitfield access, if either a bit offset is given, or
           the size is not integral. */
        bf_mode = get_type_mode(bf_type);
@@ -498,6 +506,22 @@ static void lower_bitfields_stores(ir_node *store) {
        set_Store_ptr(store, ptr);
 }  /* lower_bitfields_stores */
 
+/**
+ * Lowers unaligned Loads.
+ */
+static void lower_unaligned_Load(ir_node *load) {
+  (void) load;
+       /* NYI */
+}
+
+/**
+ * Lowers unaligned Stores
+ */
+static void lower_unaligned_Store(ir_node *store) {
+       (void) store;
+       /* NYI */
+}
+
 /**
  * lowers IR-nodes, called from walker
  */
@@ -510,6 +534,17 @@ static void lower_irnode(ir_node *irn, void *env) {
        case iro_SymConst:
                lower_symconst(irn);
                break;
+       case iro_Load:
+               if (env != NULL && get_Load_align(irn) == align_non_aligned)
+                       lower_unaligned_Load(irn);
+               break;
+       case iro_Store:
+               if (env != NULL && get_Store_align(irn) == align_non_aligned)
+                       lower_unaligned_Store(irn);
+               break;
+       case iro_Cast:
+               exchange(irn, get_Cast_op(irn));
+               break;
        default:
                break;
        }
@@ -555,7 +590,7 @@ void lower_highlevel(void) {
                /* First step: lower bitfield access: must be run as long as Sels still exists. */
                irg_walk_graph(irg, NULL, lower_bf_access, NULL);
 
-               /* Finally: lower SymConst-Size and Sel nodes. */
+               /* Finally: lower SymConst-Size and Sel nodes, Casts, unaligned Load/Stores. */
                irg_walk_graph(irg, NULL, lower_irnode, NULL);
 
                set_irg_phase_low(irg);