forked from openrs2/openrs2
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
925 B
32 lines
925 B
package dev.openrs2.deob.cli.ir
|
|
|
|
import com.google.common.graph.EndpointPair
|
|
import dev.openrs2.deob.ir.BasicBlock
|
|
import dev.openrs2.deob.ir.Method
|
|
import org.jgrapht.Graph
|
|
import org.jgrapht.nio.DefaultAttribute
|
|
import org.jgrapht.nio.GraphExporter
|
|
import org.jgrapht.nio.dot.DOTExporter
|
|
|
|
typealias BlockGraph = Graph<BasicBlock, EndpointPair<BasicBlock>>
|
|
typealias BlockGraphExporter = GraphExporter<BasicBlock, EndpointPair<BasicBlock>>
|
|
|
|
fun dotExporter(): BlockGraphExporter {
|
|
val exporter = DOTExporter<BasicBlock, EndpointPair<BasicBlock>>()
|
|
|
|
exporter.setVertexAttributeProvider {
|
|
val label = it.toString().replace("\n", "\\l")
|
|
|
|
mapOf(
|
|
"label" to DefaultAttribute.createAttribute(label)
|
|
)
|
|
}
|
|
|
|
return exporter
|
|
}
|
|
|
|
object PrintCfgCommand : MethodScopedCommand("ir-print-cfg") {
|
|
override fun run(method: Method) {
|
|
TODO("Make this output expressions")
|
|
}
|
|
}
|
|
|