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.
27 lines
744 B
27 lines
744 B
package dev.openrs2.deob.ir
|
|
|
|
import com.google.common.graph.MutableValueGraph
|
|
import dev.openrs2.deob.ir.flow.ControlFlowTransfer
|
|
|
|
typealias BasicBlockGraph = MutableValueGraph<BasicBlock, ControlFlowTransfer>
|
|
|
|
class BasicBlock(
|
|
internal val graph: BasicBlockGraph
|
|
) {
|
|
val statements = mutableListOf<Stmt>()
|
|
|
|
fun successors(): Set<BasicBlock> = graph.successors(this)
|
|
fun predecessors(): Set<BasicBlock> = graph.predecessors(this)
|
|
|
|
override fun equals(other: Any?): Boolean {
|
|
return this === other
|
|
}
|
|
|
|
override fun hashCode(): Int {
|
|
return System.identityHashCode(this)
|
|
}
|
|
|
|
override fun toString(): String {
|
|
return "BasicBlock(expressions=\n${statements.joinToString("\n")}\n)"
|
|
}
|
|
}
|
|
|