NAME ^

compilers/imcc/instructions.c

DESCRIPTION ^

When generating the code, the instructions of the program are stored in an array.

After the register allocation is resolved, the instructions array is flushed.

These functions operate over this array and its contents.

Functions ^

PARROT_MALLOC Instruction *_mk_instruction(NOTNULL(const char *op), NOTNULL(const char *fmt), int n, SymReg ** r, int flags)

Creates a new instruction

void imcc_init_tables(PARROT_INTERP)

TODO: Not yet documented!!!

int ins_reads2(NOTNULL(const Instruction *ins), int t)

Returns TRUE if instruction ins reads from a register of type t

int ins_writes2(NOTNULL(const Instruction *ins), int t)

Returns TRUE if instruction ins writes to a register of type t

int instruction_reads(NOTNULL(const Instruction *ins), NOTNULL(const SymReg *r))

next 2 functions are called very often, says gprof they should be fast

int instruction_writes(NOTNULL(const Instruction *ins), NOTNULL(const SymReg *r))

TODO: Not yet documented!!!

int get_branch_regno(NOTNULL(const Instruction *ins))

Get the register number of an address which is a branch target

SymReg *get_branch_reg(NOTNULL(const Instruction *ins))

Get the register corresponding to an address which is a branch target

Instruction *delete_ins(NOTNULL(struct _IMC_Unit *unit), NOTNULL(Instruction *ins), int needs_freeing)

Delete instruction ins. Also free it if needs_freeing is true. The instruction following ins is returned.

void insert_ins(NOTNULL(struct _IMC_Unit *unit), NULLOK(Instruction *ins), NOTNULL(Instruction *tmp))

insert tmp after ins

void prepend_ins(NOTNULL(struct _IMC_Unit *unit), NULLOK(Instruction *ins), NOTNULL(Instruction *tmp))

insert tmp before ins

void subst_ins(NOTNULL(struct _IMC_Unit *unit), NOTNULL(Instruction *ins), NOTNULL(Instruction *tmp), int needs_freeing)

Substitute tmp for ins. Free ins if needs_freeing is true.

Instruction *move_ins(NOTNULL(struct _IMC_Unit *unit), NOTNULL(Instruction *ins), NOTNULL(Instruction *to))

Move instruction ins from its current position to the position following instruction to. Returns the instruction following the initial position of ins.

Instruction *emitb(PARROT_INTERP, NULLOK(struct _IMC_Unit *unit), NULLOK(Instruction *i))

Emit a single instruction into the current unit buffer.

void free_ins(NOTNULL(Instruction *ins))

Free the Instruction structure ins.

int ins_print(PARROT_INTERP, NOTNULL(FILE *fd), NOTNULL(const Instruction *ins))

Print details of instruction ins in file fd.

static int e_file_open(SHIM_INTERP, NOTNULL(void *param))

TODO: Not yet documented!!!

static int e_file_close(PARROT_INTERP, SHIM(void *param))

TODO: Not yet documented!!!

static int e_file_emit(PARROT_INTERP, SHIM(void *param), SHIM(IMC_Unit *unit), NOTNULL(const Instruction *ins))

TODO: Not yet documented!!!

PARROT_API int emit_open(PARROT_INTERP, int type, NULLOK(void *param))

TODO: Not yet documented!!!

PARROT_API int emit_flush(PARROT_INTERP, NULLOK(void *param), NOTNULL(struct _IMC_Unit *unit))

TODO: Not yet documented!!!

PARROT_API int emit_close(PARROT_INTERP, NULLOK(void *param))

TODO: Not yet documented!!!


parrot