summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-strip-cached-dict.cpp
blob: 3b7c1479eb82c7a94f32fcf82ae10735ad113aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// slang-ir-strip-cached-dict.cpp
#include "slang-ir-strip-cached-dict.h"
#include "slang-ir-insts.h"

namespace Slang
{

void stripCachedDictionaries(IRModule* module)
{
    List<IRInst*> toRemove;
    for (auto inst : module->getGlobalInsts())
    {
        switch (inst->getOp())
        {
        case kIROp_GenericSpecializationDictionary:
        case kIROp_ExistentialFuncSpecializationDictionary:
        case kIROp_ExistentialTypeSpecializationDictionary:
            toRemove.add(inst);
            break;
        default:
            continue;
        }
    }
    for (auto inst : toRemove)
        inst->removeAndDeallocate();
}

}