summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-strip-cached-dict.cpp
blob: d14a74d7304470c1c49040a97cb0c444336cfda1 (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
// 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();
}

} // namespace Slang