[comp.lang.ada] Portable "asm"

daveb@geac.UUCP (David Collier-Brown) (03/04/88)

In article <7401@brl-smoke.ARPA> gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
writes:
[re a discussion of "asm" in C]
| A properly-designed system programming language should not have such
| a feature at all.  (It is not guaranteed in C, either.)  The interface
| between the optimized code produced for the HLL and the in-line
| assembly code is quite problematic.  Also, the compiler should not be
| forced to have an assembler built-in just to handle such stuff...

    The interfaces are hard, but within state-of-practice (I hate the
idea of assembler escapes for other reasons).

    As an example, in Honeywell's experimental ADAsil (an incomplete
implementation of Ada[tm]), one could specify the interface to
either a procedure or instruction, and whether its was to be placed
inline or not.  The compiler, having been informed about the
restrictions on parameters via a pragma, arranged to do any register
allocations and transfers required to execute the code.
    Specifically, one coded system calls by producing an object file
containing the instruction (a trap), and placing the restrictions,
the request to put it in-line and the requirements in pragmas
preceding the call.  The compiler would then insert the instruction,
and make sure the registers were used properly around the
instruction.

  Yes, its hard.  But it was claimed to have been harder to write
the pragma interpreter to find out what to do than to write the
optimizer code to do it.

--dave c-b
ps: Corrections re difficulty and exact details welcome: this was some
    years ago! (Ada is old?)

-- 
 David Collier-Brown.                 {mnetor yunexus utgpu}!geac!daveb
 Geac Computers International Inc.,   |  Computer Science loses its
 350 Steelcase Road,Markham, Ontario, |  memory (if not its mind) 
 CANADA, L3R 1B3 (416) 475-0525 x3279 |  every 6 months.