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 PARROT_CANNOT_RETURN_NULL Instruction *_mk_instruction(ARGIN(const char *op), ARGIN(const char *fmt), int n, SymReg **r, int flags)

Creates a new instruction

void imcc_init_tables(PARROT_INTERP)

RT#48260: Not yet documented!!!

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

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

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

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

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

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

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

RT#48260: Not yet documented!!!

int get_branch_regno(ARGIN(const Instruction *ins))

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

PARROT_WARN_UNUSED_RESULT PARROT_CAN_RETURN_NULL SymReg *get_branch_reg(ARGIN(const Instruction *ins))

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

PARROT_CAN_RETURN_NULL 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.

PARROT_CAN_RETURN_NULL 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.

PARROT_CAN_RETURN_NULL 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), ARGIN(const Instruction *ins))

Print details of instruction ins in file fd.

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

RT#48260: Not yet documented!!!

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

RT#48260: Not yet documented!!!

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

RT#48260: Not yet documented!!!

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

RT#48260: Not yet documented!!!

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

RT#48260: Not yet documented!!!

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

RT#48260: Not yet documented!!!


parrot