summaryrefslogtreecommitdiff
path: root/source/slang/ir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/ir.cpp')
-rw-r--r--source/slang/ir.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp
index 408f4257d..92801ec9a 100644
--- a/source/slang/ir.cpp
+++ b/source/slang/ir.cpp
@@ -1564,6 +1564,7 @@ namespace Slang
nullptr,
nullptr);
module->moduleInst = moduleInst;
+ moduleInst->module = module;
return module;
}
@@ -2891,12 +2892,6 @@ namespace Slang
ff->debugValidate();
}
- void IRInst::deallocate()
- {
- // Run destructor to be sure...
- this->~IRInst();
- }
-
void IRInst::dispose()
{
IRObject::dispose();
@@ -3055,6 +3050,7 @@ namespace Slang
void IRInst::removeArguments()
{
+ typeUse.clear();
for( UInt aa = 0; aa < operandCount; ++aa )
{
IRUse& use = getOperands()[aa];
@@ -3068,7 +3064,9 @@ namespace Slang
{
removeFromParent();
removeArguments();
- deallocate();
+
+ // Run destructor to be sure...
+ this->~IRInst();
}
bool IRInst::mightHaveSideEffects()
@@ -3144,6 +3142,20 @@ namespace Slang
}
}
+ IRModule* IRInst::getModule()
+ {
+ IRInst* ii = this;
+ while(ii)
+ {
+ if(auto moduleInst = as<IRModuleInst>(ii))
+ return moduleInst->module;
+
+ ii = ii->getParent();
+ }
+ return nullptr;
+ }
+
+
//
// Legalization of entry points for GLSL:
//
@@ -4563,8 +4575,7 @@ namespace Slang
for( auto pp = firstBlock->getFirstParam(); pp; )
{
auto next = pp->getNextParam();
- pp->removeFromParent();
- pp->deallocate();
+ pp->removeAndDeallocate();
pp = next;
}
}