[COFF] machine code translation, as mental architecture models
Dan Cross
crossd at gmail.com
Sun Jul 14 05:42:24 AEST 2024
On Sat, Jul 13, 2024 at 2:50 PM John Levine <johnl at taugh.com> wrote:
> According to Ralph Corderoy <ralph at inputplus.co.uk>:
> >> Oh, no wonder the translator worked so well.
> >
> >Well, doesn't it depend on whether VAX MACRO kept the macros as
> >high-level entities when translating them, or if it processed macros in
> >the familiar way into instructions that sat at the same level as
> >hand-written ‘assembler’. I don't think this thread has made that clear
> >so far.
>
> It was a macro assembler. The macros generated assembler statements
> that got assembled the normal way. I agree with the person that every
> macro assembler I've ever seen did that. A semi-exception is the IBM
> assembler that also had a PUNCH statement that put records into the
> object file but I think that was only used to pass commands to the
> linker.
This is conflating two different things over the life of the MACRO-32
language. It certainly started out as a macro assembler, but with the
introduction of the Alpha, DEC turned it into a true compiler (where
the source language happens to be VAX assembly language) that
generated native code for whatever machine it was compiled for: VAX or
Alpha; using the GEM backends.
When Compaq started the port to Itanium, they employed the same
technique; this was maintained by HP.
VSI has shifted to using LLVM as their compiler backend for the x86_64
port, with ELF as the executable file format (and presumably for
object files as well). As I understand the current state of affairs,
there is a GEM to LLVM layer that interfaces between the still-GEM
output of compiler frontends and the LLVM backend, that performs
native code generation. Macro, in particular, bypasses most of the
LLVM optimization layer.
> The more relevant question is how they used the macros. If the macros
> were used consistently for semantically higher level things, the
> translator can use the semantics of the macros when translating.
As has been mentioned, they don't do this. The output of fully
expanded MACRO-32 is basically VAX assembly language, which is then
compiled in a manner similar to how one would compile preprocessed C.
- Dan C.
More information about the COFF
mailing list