Portable "asm" (Was: The D Programming Language)

Herman Rubin cik at l.cc.purdue.edu
Sat Feb 27 21:51:56 AEST 1988


In article <1988Feb25.203425.8925 at utzoo.uucp>, henry at utzoo.uucp (Henry Spencer) writes:
> > If we have the compiler replace names by locations (register and/or memory)
> > of the variables used...
> 
> This does of course assume that all locations are addressable in all
> instructions, which is emphatically not the case on many machines.

This is another reason for the user to be able to force the compiler to put
things in registers.  The stupid compiler should not be able to force the 
user to use many instructions because it does not see the need for register
variables.  This applies also to such constructs as register pairs, triples,
etc.  Naturally, this would require some way of modifying the register number,
but so what?  This is simple, compared to the machinations that compilers 
now undertake.

Also, it is rash to assume that the programmer does not make mistakes.  If the
location types of the arguments do not work with the instruction, this is a
programming error; what are diagnostic and error messages for?

> > We also should get rid of those quotes in the process...
> 
> What if I want to write asm("mov ')', r0")?  The quotes are a reasonable way
> of keeping the syntax of the assembler entirely out of the compiler's own
> syntax handling, which is a good thing, especially for portable compilers.

Someone has posted an example where the failure was due to a " in the assembler
instruction.  It is just as easy, since C requires a ; to end a statement, to
tell the compiler that until it sees ); to continue processing for the
assembler, and to have some escape mechanism for inserting ); into the 
assembler statement.  Alternatively, if we get rid of the ;s as mandatory
terminators (which I think is a good idea), have an escape mechanism for
inserting ) in an assembler statement.  Is this worse than not being able
to put ", or even "), in an assembler statement?

-- 
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054
hrubin at l.cc.purdue.edu (ARPA or UUCP) or hrubin at purccvm.bitnet



More information about the Comp.lang.c mailing list