Add inlining support for array dereferences.
authorEric Anholt <eric@anholt.net>
Thu, 8 Apr 2010 20:40:52 +0000 (13:40 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 8 Apr 2010 20:42:41 +0000 (13:42 -0700)
ir_function_inlining.cpp

index b6434b80544cad32aa599e5f9095279c275bda1e..40f82513095b2c8f856394c140e6a7e286e7b99c 100644 (file)
@@ -200,8 +200,21 @@ ir_function_cloning_visitor::visit(ir_dereference *ir)
 
         this->result = new ir_dereference(this->result);
       }
+   } else if (ir->mode == ir_dereference::ir_reference_array) {
+      ir_instruction *variable;
+      ir_rvalue *index;
+
+      ir->var->accept(this);
+      variable = this->result;
+
+      ir->selector.array_index->accept(this);
+      index = this->result->as_rvalue();
+
+      this->result = new ir_dereference(variable, index);
    } else {
-      this->result = NULL;
+      assert(ir->mode == ir_dereference::ir_reference_record);
+      /* FINISHME: inlining of structure references */
+      assert(0);
    }
 }