Advice

I'm going through all the LLVM doc especially the "Writing an LLVM Compiler
Backend" material. I'm sure to be bugging the list with questions so I'd
like to start the process with the following request: System z uses
instructions that vary from 2 to 6 bytes in length. The opcode can be 1 byte
(always in the 1st byte) or 2 bytes (either the first two bytes or the 1st
byte and the 6th byte). The IBM principles of operation manual, which is the
canonical source of all things System z, defines various instruction formats
that describe the exact layout of the instructions (e.g. RR, RI, RS, SS
...). Would creating a class for each of these instruction formats be the
best way to structure things? I did something similar for Mono by creating C
structures that mapped each of the formats.

I'm wondering if any of the currently supported architectures have formats
as "bizarre" as System z which I can use as a reference.

Neale

Hi, Neale

...). Would creating a class for each of these instruction formats be the
best way to structure things?

Yes. The basic idea is to encode everything, which are not operands of instructions into the separate fields and emit subclass for each more-or-less proper defined 'flavour' of instructions (e.g. those accepting i32 imm, pure reg/reg instrs, etc).

I'm wondering if any of the currently supported architectures have formats
as "bizarre" as System z which I can use as a reference.

Yes, for example... x86 :slight_smile: