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.
 
 

39 lines
825 B

import type { BinaryOp, UnaryOp } from "../ast"
import type { Loc } from "./loc"
export type Operand = Loc | number
export type AbsInsnCopy = {
type: "copy",
dest: Loc,
source: Operand,
}
export type AbsInsn2Unary = {
type: "unary",
dest: Loc,
// NOTE: We convert binary -> unary when going SSA3 -> SSA2
op: UnaryOp | BinaryOp,
source: Operand,
}
// Abstract instruction in two-address form
export type AbsInsn2 = AbsInsnCopy | AbsInsn2Unary
export type AbsInsn3Unary = {
type: "unary",
dest: Loc,
op: UnaryOp,
source: Operand,
}
export type AbsInsnBinary = {
type: "binary",
dest: Loc,
source: Operand,
op: BinaryOp,
source1: Operand
}
// Abstract instruction in three-address form
export type AbsInsn3 = AbsInsnCopy | AbsInsn3Unary | AbsInsnBinary