mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-05 14:11:33 +00:00
IR WIP
This commit is contained in:
@ -4,6 +4,9 @@ import com.github.ajalt.clikt.core.CliktCommand
|
||||
import com.github.ajalt.clikt.parameters.arguments.argument
|
||||
import gay.pizza.dough.fs.PlatformFsProvider
|
||||
import gay.pizza.pork.ast.gen.Symbol
|
||||
import gay.pizza.pork.bir.IrSlab
|
||||
import gay.pizza.pork.bir.IrSymbolGraph
|
||||
import gay.pizza.pork.bir.IrWorld
|
||||
import gay.pizza.pork.compiler.Compiler
|
||||
import gay.pizza.pork.minimal.FileTool
|
||||
|
||||
@ -31,5 +34,18 @@ class CompileCommand : CliktCommand(help = "Compile Pork to Bytecode", name = "c
|
||||
println(" ${symbol.offset + index.toUInt()} ${op}${annotation}")
|
||||
}
|
||||
}
|
||||
|
||||
val compiledIrSlabs = mutableListOf<IrSlab>()
|
||||
for (symbol in compiledMain.usedSymbols) {
|
||||
val what = compiler.resolve(symbol)
|
||||
compiledIrSlabs.add(what.compilableSlab.compiledIrSlab)
|
||||
}
|
||||
compiledIrSlabs.add(compiledMain.compilableSlab.compiledIrSlab)
|
||||
val irWorld = IrWorld(compiledIrSlabs.toList())
|
||||
val graph = IrSymbolGraph()
|
||||
graph.crawl(irWorld)
|
||||
graph.forEachEdge { user, owner ->
|
||||
println("$user -> $owner")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user