Class MipsWriter

Generates machine code for mips.

Hierarchy

  • MipsWriter

Constructors

Properties

Memory location of the first byte of output.

Memory location of the next byte of output.

offset: number

Current offset in bytes.

Program counter at the next byte of output.

Methods

  • Eagerly cleans up memory.

    Returns void

  • Resolves label references and writes pending data to memory. You should always call this once you've finished generating code. It is usually also desirable to do this between pieces of unrelated code, e.g. when generating multiple functions in one go.

    Returns void

  • Puts an ADDI instruction.

    Parameters

    Returns void

  • Puts a B instruction.

    Parameters

    • offset: number

    Returns void

  • Puts a BEQ instruction referencing labelId, defined by a past or future putLabel().

    Parameters

    Returns void

  • Puts a BREAK instruction.

    Returns void

  • Puts raw data.

    Parameters

    Returns void

  • Puts a raw instruction.

    Parameters

    • insn: number

    Returns void

  • Puts a J instruction referencing labelId, defined by a past or future putLabel().

    Parameters

    • labelId: string

    Returns void

  • Puts a JAL instruction.

    Parameters

    • address: number

    Returns void

  • Puts a JALR instruction.

    Parameters

    Returns void

  • Puts a JR instruction.

    Parameters

    Returns void

  • Puts a label at the current position, where id is an identifier that may be referenced in past and future put*Label() calls.

    Parameters

    • id: string

    Returns void

  • Puts a LUI instruction.

    Parameters

    Returns void

  • Puts a MFHI instruction.

    Parameters

    Returns void

  • Puts a MFLO instruction.

    Parameters

    Returns void

  • Puts a MTHI instruction.

    Parameters

    Returns void

  • Puts a MTLO instruction.

    Parameters

    Returns void

  • Puts a NOP instruction.

    Returns void

  • Puts a POP instruction.

    Parameters

    Returns void

  • Puts a PUSH instruction.

    Parameters

    Returns void

  • Puts a RET instruction.

    Returns void

  • Skips nBytes.

    Parameters

    • nBytes: number

    Returns void

Generated using TypeDoc