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 ^

Instruction *_mk_instruction

Creates a new instruction

void imcc_init_tables

Initializes IMCC's table of opcodes, based on the list maintained by the Parrot interpreter. Stores the results in global variable w_special.

int ins_writes2

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

int instruction_reads

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

int instruction_writes

Determines whether the instruction ins writes to the SymReg r. Returns 1 if it does, 0 if not.

int get_branch_regno

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

SymReg *get_branch_reg

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

Instruction *_delete_ins

Delete instruction ins. It's up to the caller to actually free the memory of ins, if appropriate.

The instruction following ins is returned.

Instruction *delete_ins

Delete instruction ins, and then free it.

The instruction following ins is returned.

void insert_ins

Insert Instruction tmp in the execution flow after Instruction ins.

void prepend_ins

Insert Instruction tmp into the execution flow before Instruction ins.

void subst_ins

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

Instruction *move_ins

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

Instruction *emitb

Emit a single instruction into the current unit buffer.

void free_ins

Free the Instruction structure ins.

int ins_print

Print details of instruction ins in file fd.

static int e_file_open

Prints a me

static int e_file_close

RT#48260: Not yet documented!!!

static int e_file_emit

RT#48260: Not yet documented!!!

int emit_open

Opens the emitter function open of the given type. Passes the param to the open function.

int emit_flush

Flushes the emitter by emitting all the instructions in the current IMC_Unit unit.

int emit_close

Closes the given emitter.


parrot