summaryrefslogtreecommitdiff
path: root/source/slang/slang-ir-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-ir-util.cpp')
-rw-r--r--source/slang/slang-ir-util.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/slang/slang-ir-util.cpp b/source/slang/slang-ir-util.cpp
index bff80392f..c5cebb8b5 100644
--- a/source/slang/slang-ir-util.cpp
+++ b/source/slang/slang-ir-util.cpp
@@ -582,6 +582,32 @@ void sortBlocksInFunc(IRGlobalValueWithCode* func)
block->insertAtEnd(func);
}
+void removeLinkageDecorations(IRGlobalValueWithCode* func)
+{
+ List<IRInst*> toRemove;
+ for (auto inst : func->getDecorations())
+ {
+ switch (inst->getOp())
+ {
+ case kIROp_ImportDecoration:
+ case kIROp_ExportDecoration:
+ case kIROp_ExternCppDecoration:
+ case kIROp_PublicDecoration:
+ case kIROp_KeepAliveDecoration:
+ case kIROp_DllImportDecoration:
+ case kIROp_CudaDeviceExportDecoration:
+ case kIROp_DllExportDecoration:
+ case kIROp_HLSLExportDecoration:
+ toRemove.add(inst);
+ break;
+ default:
+ break;
+ }
+ }
+ for (auto inst : toRemove)
+ inst->removeAndDeallocate();
+}
+
void setInsertBeforeOrdinaryInst(IRBuilder* builder, IRInst* inst)
{
if (as<IRParam>(inst))