From 4a44f94caf8887f6dfc66c4193e95c6430c9de57 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Tue, 27 Mar 2012 21:48:58 +0200 Subject: [PATCH] nv50/ir: Clean up before calculating instruction ordering for a new function. --- src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp | 2 ++ src/gallium/drivers/nv50/codegen/nv50_ir_util.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp index 6515ba7e0c9..7b211a2e0d1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp @@ -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(it->get())); diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_util.h b/src/gallium/drivers/nv50/codegen/nv50_ir_util.h index 262cf9cd496..830320721d1 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_util.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_util.h @@ -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; -- 2.30.2