nv50/ir: Clean up before calculating instruction ordering for a new function.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 27 Mar 2012 19:48:58 +0000 (21:48 +0200)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 14 Apr 2012 19:54:02 +0000 (21:54 +0200)
src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp
src/gallium/drivers/nv50/codegen/nv50_ir_util.h

index 6515ba7e0c9a4e79f8acf2bf9d1542511057553b..7b211a2e0d12477792d76470903c94a592dd3915 100644 (file)
@@ -405,6 +405,8 @@ Function::setExit(BasicBlock *bb)
 unsigned int
 Function::orderInstructions(ArrayList &result)
 {
+   result.clear();
+
    for (IteratorRef it = cfg.iteratorCFG(); !it->end(); it->next()) {
       BasicBlock *bb =
          BasicBlock::get(reinterpret_cast<Graph::Node *>(it->get()));
index 262cf9cd496067e4856721b1c2023f516fc183d1..830320721d19dd1e058ce9cd97a57ee3d9ab4261 100644 (file)
@@ -337,6 +337,13 @@ public:
       data = (Item *)REALLOC(data, oldSize, size * sizeof(Item));
    }
 
+   void clear()
+   {
+      FREE(data);
+      data = NULL;
+      size = 0;
+   }
+
 private:
    Item *data;
    unsigned int size;
@@ -392,6 +399,13 @@ public:
 
    Iterator iterator() const { return Iterator(this); }
 
+   void clear()
+   {
+      data.clear();
+      ids.clear(true);
+      size = 0;
+   }
+
 private:
    DynArray data;
    Stack ids;