diff options
author | Francisco Jerez <[email protected]> | 2012-04-14 21:23:03 +0200 |
---|---|---|
committer | Christoph Bumiller <[email protected]> | 2012-04-14 21:54:01 +0200 |
commit | da28ba00d84f59650bf180769d9d9a1609eb6164 (patch) | |
tree | 333afd155882706c213b1b383f6c9ac65e10d11b /src/gallium/drivers | |
parent | 9362d4bc0a03860ec386156cf499e855a9c2d2a5 (diff) |
nv50/ir: Make sure that several IR objects are destroyed on takedown.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir.cpp | 9 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir.h | 5 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp | 6 |
3 files changed, 17 insertions, 3 deletions
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp index 4e270c583f6..a93dc730e42 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp @@ -873,8 +873,11 @@ Program::Program(Type type, Target *arch) Program::~Program() { - if (main) - delete main; + for (ArrayList::Iterator it = allFuncs.iterator(); !it.end(); it.next()) + delete reinterpret_cast<Function *>(it.get()); + + for (ArrayList::Iterator it = allRValues.iterator(); !it.end(); it.next()) + releaseValue(reinterpret_cast<Value *>(it.get())); } void Program::releaseInstruction(Instruction *insn) @@ -897,6 +900,8 @@ void Program::releaseInstruction(Instruction *insn) void Program::releaseValue(Value *value) { + value->~Value(); + if (value->asLValue()) mem_LValue.release(value); else diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.h b/src/gallium/drivers/nv50/codegen/nv50_ir.h index 32511f64e88..8d86a9ce282 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir.h +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.h @@ -449,6 +449,7 @@ class Value { public: Value(); + virtual ~Value() { } virtual Value *clone(Function *) const { return NULL; } @@ -496,6 +497,7 @@ class LValue : public Value public: LValue(Function *, DataFile file); LValue(Function *, LValue *); + ~LValue() { } virtual Value *clone(Function *) const; @@ -511,6 +513,7 @@ class Symbol : public Value { public: Symbol(Program *, DataFile file = FILE_MEMORY_CONST, ubyte fileIdx = 0); + ~Symbol() { } virtual Value *clone(Function *) const; @@ -543,9 +546,9 @@ public: ImmediateValue(Program *, uint32_t); ImmediateValue(Program *, float); ImmediateValue(Program *, double); - // NOTE: not added to program with ImmediateValue(const ImmediateValue *, DataType ty); + ~ImmediateValue() { }; virtual bool equals(const Value *that, bool strict) const; diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp index e766c62f47f..e6f3c353a1b 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_bb.cpp @@ -50,6 +50,12 @@ Function::~Function() if (bbArray) delete[] bbArray; + for (ArrayList::Iterator it = allInsns.iterator(); !it.end(); it.next()) + delete_Instruction(prog, reinterpret_cast<Instruction *>(it.get())); + + for (ArrayList::Iterator it = allLValues.iterator(); !it.end(); it.next()) + delete_Value(prog, reinterpret_cast<LValue *>(it.get())); + for (ArrayList::Iterator BBs = allBBlocks.iterator(); !BBs.end(); BBs.next()) delete reinterpret_cast<BasicBlock *>(BBs.get()); } |