
Millicode - peter_d_sherman
https://en.wikipedia.org/wiki/Millicode
======
skissane
I wonder, is the z/Arch millicode still written in PL/8?

It's a pity that (as far as I know) IBM has never released the GCC front-end
it wrote for PL/8 [1]. (Not that anyone outside of IBM would have any real use
for it, but still...)

[1]
[https://ieeexplore.ieee.org/document/5388881](https://ieeexplore.ieee.org/document/5388881)

~~~
peter_d_sherman
Fascinating! Did not know z/Arch millicode was written in PL/8, so let's do
some archaeology:

Wikipedia:
[https://en.wikipedia.org/wiki/PL/8](https://en.wikipedia.org/wiki/PL/8)

"PL/8 (or PL.8), is a dialect of PL/I developed by IBM Research in the 1970s
by compiler group, under Martin Hopkins, within a major research program that
led to the IBM RISC architecture.[1] It was so-called because it was about 80%
of PL/I. Written in PL/I and bootstrapped via the PL/I Optimizing compiler, it
was an alternative to PL/S for system programming, compiling initially to an

 _intermediate machine-independent language_

with symbolic registers and machine-like operations.[2] It applied machine-
independent program optimization techniques to this intermediate language to
produce exceptionally good object code. The intermediate language was mapped
by the back-end to the target machine's register architecture and instruction
set. Back-ends were written for IBM 801, S/370, Motorola 68000,[3][4] and
POWER/PowerPC.[citation needed] A version was used on IBM mainframes as a
development tool for software that was being designed for the AS/400, as well
as to write the "i370" internal code for the "Capitol" chipset used in some
ES/9370 models[5] and the

 _millicode for S /390 and z/Architecture processors.[6]_"

Interesting!

Before there was LLVM's IR, IBM had something similar to it, as part of PL/8,
and apparently at least early in history (we don't know about the current day)
wrote the millicode for S/390 and z/Architecture processors with it!

~~~
skissane
At least as I understand it, "PL/8" had two different components:

(a) a compiler suite including an IR, optimizer, backends, frontends for
various languages including Pascal

(b) one of those frontends providing its own PL/I dialect designed for system
programming

I think, in sense (b), PL/8 was viewed as an alternative to PL/S, PL/X, etc.
PL/8 was used for millicode, and possibly also coprocessors for IO and service
functions, whereas PL/X played the same role for the OS proper (at least for
MVS / OS/390 / z/OS). Whereas, I think as that paper explains, (a) was at some
point retired in favour of writing a GCC frontend for (b), partially because
(a) didn't support 64-bit, and I guess reusing GCC was seen as less work than
upgrading (a) to have 64-bit support.

I think (a) may have had some shared history with IBM CSet / VisualAge / XL C
compilers, in their pre-LLVM form. But, given the later got 64-bit support
long before LLVM came along, why was (a) retired for lacking 64-bit support?
Pure speculation on my part, but I suspect that there was a fork/divergence at
some point, and the PL/8 compiler ended up being a completely different body
of code, even if some of it had contributed to IBM's other compilers. (And,
that contribution may have been in the form of ideas or concepts rather than
actual code.)

(I'm sort of piecing together bits of information IBM has released here, so I
may be wildly wrong in my speculations. I've never worked for IBM, so I don't
have any inside info on this.)

------
peter_d_sherman
More detailed explanation:

The What and Why of System z Millicode (Bob Rogers, IBM Corporation, 2012):

[https://share.confex.com/share/119/webprogram/Handout/Sessio...](https://share.confex.com/share/119/webprogram/Handout/Session11773/The%20What%20and%20Why%20of%20System%20z%20Millicode%20-%20%2311773.pdf)

