Skip to main content

adapt

Function adapt 

Source
pub fn adapt(
    ops: &[Op],
    constants: &[Constant],
    register_count: usize,
) -> Option<(Vec<MicroOp>, usize)>
Expand description

Translate WHOLE-PROGRAM Main bytecode into the J2 micro-op subset.

Requirements (else None):

  • ops drawn from {LoadConst(Int), Move, Add, Sub, Mul, Lt, Gt, Eq, Jump, JumpIfFalse, JumpIfTrue, Show};
  • exactly ONE Show, and it is the final op (it becomes Return);
  • no comparison-produced value is the shown register (bool-taint).

Returns the micro program and the frame size it needs.