import type { BinaryOp, UnaryOp } from "../ast"
|
|
import type { Loc } from "./loc"
|
|
|
|
export type Operand = Loc | number
|
|
|
|
type ASSA<Data> = { dest: Loc, source: Operand } & Data
|
|
|
|
// dest = source
|
|
export type SSACopy = ASSA<{}>
|
|
|
|
// dest = op(source)
|
|
export type SSAUnary = ASSA<{ op: UnaryOp }>
|
|
|
|
// dest = op(source, source1)
|
|
export type SSABinary = ASSA<{ op: BinaryOp, source1: Operand }>
|
|
|
|
export type SSA = SSACopy | SSAUnary | SSABinary
|