On Dec 31, 2005, at 15:43, Amos Robinson wrote:

I was wondering if anybody could help: the best I've found for duplicating
an instruction is
  INS(interp, unit, ins->op, "", ins->r, ins->n_r, ins->keys, 0);

A copy_ins() function would be nice, if needed.

However, this doesn't seem to work with e.g. set_args.

Why?

Is there some easy way to duplicate an instruction, or should I just give
up when I see a pcc directive?

Duplicating e.g. a function call needs a bit more effort, e.g. allocation and filling the pcc_sub structure.

Also, with regards to in/out/inout of opcodes:
pop is currently described as (out ?, in PMC)
However, with say used_once optimizations, you want to know which registers
are written to, and read from.
I looked and thought that pop should be (out ?, inout PMC) because it
changes the array/whatever.

The in/out doesn't tell you if a PMC is modified like in 'pop' but tells you if the register is unmodified (in) or has a new contents after the operation (out). E.g.

  pop P0, P1   # (out, in)

doesn't modify P1 (it is a pointer to the same location before and after the operation - if the contents of the array changes, doesn't matter at all). But P0 has a total new value after the operation, namely a pointer to the previously last value of P1.

This information is needed for register allocation inside imcc itself and in the JIT. The 'out' means that the life range of the old 'P0' ends at that instruction and a new life range of 'P0' is starting.

Amos Robinson

leo

Reply via email to