Dan Sugalski <[EMAIL PROTECTED]> writes:
>At 02:08 PM 5/30/2001 +0000, Nick Ing-Simmons wrote:
>>Classic CISC code generation taught "us" that CISC is a pain to code-gen.
>>(I am not a Guru but did design TMS320C80's RISC specifically to match
>>gcc of that vintage, and dabbled in a p-code for Pascal way back.)
>
>Right, but in this case we have the advantage of tailoring the instruction
>set to the language, and given the overhead inherent in op dispatch we also
>have an incentive to hoist opcodes up to as high a level as we can manage.
That is of course what they/we all say ;-)
The 68K for example matched quite well to the low-tech compiler technology
of its day, as did UCSD's p-code for USCD Pascal, and DSPs have their own
reasons (inner loops are more important than generic C) for their CISC nature.
Even the horrible x86 architecture is quasi-sane if you assume all variables
are on the stack addressed by the Base Pointer.
It is interesting now that people are looking at building chips for JVM
how much cursing there is about certain features - though I don't have
the references to hand.
The "overhead of op dispatch" is a self-proving issue - if you have complex
ops they are expensive to dispatch.
In the limit FORTH-like threaded code
while (1) *(*op_ptr++)();
is not really very expensive, it is then up to the "op" to adjust op_ptr
for in-line args etc. Down sides are size op is at least size of a pointer.
With a 16-bit opcode as-per-Uri that becomes:
while (1) *(table[*op_ptr++])();
(Assuming we don't need to check bounds 'cos we won't generate bad code...)
One can then start adding decode to the loop:
while (1) {
op_t op = *op_ptr++;
switch(NUM_ARGS(op))
case 1:
*(table[FUNC_NUM(op)])(*op_ptr++);
break;
case 3:
*(table[FUNC_NUM(op)])(op_ptr[0],op_ptr[1],op_ptr[2]);
op_ptr += 3;
break;
...
}
Then one can do byte-ordering and mis-aligned hackery and index into reg-array
while (1) {
op_t op = GET16BITS(*op_ptr);
switch(NUM_ARGS(op))
case 1:
*(table[FUNC_NUM(op)])(reg_ptr[GET8BITS(*op_ptr)]);
break;
...
}
>
--
Nick Ing-Simmons
who is looking for a new job see http://www.ni-s.u-net.com/