From: Francisco Jerez Date: Tue, 27 Mar 2012 19:48:58 +0000 (+0200) Subject: nv50/ir: Clean up before calculating instruction ordering for a new function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4a44f94caf8887f6dfc66c4193e95c6430c9de57;p=mesa.git nv50/ir: Clean up before calculating instruction ordering for a new function. --- 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;