A "high-level" language for the Gameboy
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.
 
 

28 lines
659 B

import type { AbsInsn2 } from "./insn"
import type { Loc } from "./loc"
export class BasicBlock {
insns: Array<AbsInsn2>
constructor(insns: Array<AbsInsn2>) {
this.insns = insns
}
locs(): Set<Loc> {
return new Set(
this.insns.flatMap(insn => {
const insnLocs = []
if (insn.type === "copy" || insn.type === "unary") {
insnLocs.push(insn.dest)
if (typeof insn.source !== "number") {
insnLocs.push(insn.source)
}
}
return insnLocs
})
)
}
}