This commit is contained in:
Irmen de Jong 2023-05-02 01:19:36 +02:00
parent f465b2e2a0
commit 24f37e2062

View File

@ -78,7 +78,6 @@ class IRUnusedCodeRemover(
// check if asmsub is called from another asmsub // check if asmsub is called from another asmsub
irprog.blocks.asSequence().forEach { block -> irprog.blocks.asSequence().forEach { block ->
block.children.filterIsInstance<IRAsmSubroutine>().forEach { sub -> block.children.filterIsInstance<IRAsmSubroutine>().forEach { sub ->
require(sub.asmChunk.next == null) { "asmsubs won't be pointing to their successor, otherwise we should do more work here" }
if (block.forceOutput || block.library) if (block.forceOutput || block.library)
linkedAsmSubs += sub linkedAsmSubs += sub
if (sub.asmChunk.isNotEmpty()) { if (sub.asmChunk.isNotEmpty()) {
@ -87,6 +86,13 @@ class IRUnusedCodeRemover(
linkedAsmSubs += asmsub linkedAsmSubs += asmsub
} }
} }
val inlineAsm = sub.asmChunk.next as? IRInlineAsmChunk
if(inlineAsm!=null) {
allSubs.forEach { (label, asmsub) ->
if (inlineAsm.assembly.contains(label))
linkedAsmSubs += asmsub
}
}
} }
} }