Wire up REG and NOP properly (so they actually import the right values).
authorDavid Given <dg@cowlark.com>
Sat, 21 Jan 2017 22:43:35 +0000 (23:43 +0100)
committerDavid Given <dg@cowlark.com>
Sat, 21 Jan 2017 22:43:35 +0000 (23:43 +0100)
mach/proto/mcg/pass_instructionselection.c

index 8a2277f..c9d80b2 100644 (file)
@@ -221,10 +221,19 @@ static struct insn* walk_instructions(struct burm_node* node, int goal)
                 case ir_to_esn(IR_NOP, 'F'):
                 case ir_to_esn(IR_NOP, 'L'):
                 case ir_to_esn(IR_NOP, 'D'):
-                    hop_get_value_usage(current_hop, &insn->children[0]->value)->input = true;
+                {
+                    struct insn* child = insn->children[0];
+                    struct value* value;
+                    if (child->hop)
+                        value = child->hop->value;
+                    else
+                        value = &child->ir->value;
+
+                    hop_get_value_usage(current_hop, value)->input = true;
                     hop_get_value_usage(current_hop, current_hop->value)->output = true;
-                    hop_add_insel(current_hop, "@copy %V %V", &insn->children[0]->value, current_hop->value);
+                    hop_add_insel(current_hop, "@copy %V %V", value, current_hop->value);
                     break;
+                }
             }
 
             hop_print('I', current_hop);