Compiler Specific Operators

Robert Stroud robert at cheviot.newcastle.ac.uk
Wed Jul 16 00:22:07 AEST 1986


In article <3519 at lll-crg.ARpA> brooks at lll-crg.UUCP (Eugene D. Brooks III) writes:
>It would be nice if asm was more "printf like" instead of just dumping
>a string.

>suppose you want to change the stack pointer...
>
>	char *oldpointer;
>	char *newpointer;
>
>	asm("store sp,%a", oldpointer);
>	asm("load sp,%a", newpointer);
>
>The code is machine dependent, but the compiler takes care of the
>C name -> AS name  mapping for you.   Of course I guess the compiler
>should not encourage such screwing around.

A machine called the Orion made by a British company called High Level
Hardware has something similar. It is based on a bit slice architecture
and has been microcoded as a stack based C machine. Consequently, it is
possible to interpret

	asm(opcode, expr, ...)

as "push all the C expressions onto the stack and then perform opcode".

This lets you mix C expressions with special-purpose opcodes (you can
define your own because the microcode is user-extensible). However,
the clean semantics are only possible because it is a stack machine
and all operations are performed in this way.

Robert Stroud,
Computing Laboratory,
University of Newcastle upon Tyne.

ARPA robert%cheviot.newcastle at ucl-cs.ARPA
UUCP ...!ukc!cheviot!robert
JANET robert at newcastle.cheviot



More information about the Comp.lang.c mailing list