wow what a busy topic! At the risk of throwing gasoline on a burning building,
I have to say it sounds like a lot of people are struggling to write "baseless
code" (or whatever is eventually decreed as the politically correct term) just
for the sake of being "baseless". It is obviously very trendy right now, but
IMO that is a "baseless" exercise. I have never needed extra registers in
assembly language code anyway. And if I had, what would I be saving by
rearranging everything just to avoid having a base register for code? I would
still need to establish a base register for program constants and it matters
not a whit to me whether I waste that register on the (usually small) number of
constants, or let it span the entire enclosing CSECT. In fact, in defense of
the latter, that's the easiest and simplest thing to do and in doing so, I
don't have to come up with any goof-ball schemes for establishing transient
addressability either to code or data. Everything works just like it always has
for nearly fifty years and there is much to be said for not astonishing the
great body of (gasp - legacy!) macro code we all depend on.
If I was writing enormous great gobs of code that needed more than one base
register, the first thing I would do is slap myself silly. Then I would
rearrange that code into manageable chunks so that problem went away. My
personal rule has always been 4KB or less per function. Sure I could do more
(and in exceptionally rare cases, I will) but why would I want to? It is a lot
easier to maintain intellectual control over small well structured hunks of
code than those gigantic single CSECT monsters with half a dozen on the fly
subroutine linkage conventions smeared haphazardly across five thousand lines
of code. Yeah you know the ones I'm talking about. Literally nobody has ever
complained about having to maintain my code - just ask the folks that still do.
Now if I was a compiler writer, I might get a lot more excited about long
displacement and relative instructions. To begin with there are no "legacy"
assembly macros to deal with in generated code and pretty much all compiler
writers tend to burn a base register for addressing constants anyway. After the
first blush of curiosity wears off, nobody ever looks at the generated code
anyway and they certainly don't have to maintain it, so all in all it is a
pretty decent deal for compiler writers and (btw) that's who it was done for.
My bottom line is: don't get carried away with this stuff. If you're an
assembly language programmer you don't need it and it is only going to end up
biting you in the ass if you pursue unnatural acts just to avoid having a base
register for code.
CC