Re: Superior IBM supplied "register equate" macro?

44 views
Skip to first unread message

Brent Longborough

unread,
Jul 22, 2017, 5:59:41 AM7/22/17
to ASSEMBL...@listserv.uga.edu
Unfortunately, (like base registers), registers can change the "meaning"
of their contents at different points in the program.

Rather than static equates giving the same register two different names,
I think it would be cleaner, and safer, to have a directive analogous to
USING which would say to HLASM (for example) "From this point in the
code until further notice, R0 being used for a 64-bit value".

Or, better yet, maybe(in my dreams!?) have two sets of registers -- one
for 32-bit ops and one for 64-bit.

I'm not holding my breath for either, though.

Brent Longborough

Charles Mills

unread,
Jul 22, 2017, 9:03:04 AM7/22/17
to ASSEMBL...@listserv.uga.edu
Two sets of registers would change the whole architecture. I'm sure as the gurus of the hardware sat around 20 (?) years ago pondering how to deal with 64-bit as the architecture went forward, certainly two separate sets of registers crossed their whiteboards.

But I really like your "USING" idea. It's so easy to write a string of 64-bit code and accidentally code an LR instead of an LGR or an AHI instead of an AGHI somewhere in the middle.

Charles

graeme

unread,
Jul 22, 2017, 9:54:56 AM7/22/17
to ASSEMBL...@listserv.uga.edu
I use r0:r15 for 32 bit reg references, g0:g15 for 64 bit reg references.

Where the instruction references, or sets, bits 0:31 of a 64 bit reg, I use the appropriate "gn" symbolic to identify the register, else I use the appropriate "rn" symbolic.

For the assembler to "police" this in some way I'd imagine having a set of 32 directives like:
g0 gpr64 0
g1 gpr64 1
..
r0 gpr32 0
r1 gpr32 1
..

which would both define the symbols -and- authorise the assembler to issue a warning message if, for example, it found a "gpr32" symbolic used where an instruction operand references a 64 bit reg.

Cheers,
Graeme G.

Steve Smith

unread,
Jul 22, 2017, 10:19:07 AM7/22/17
to ASSEMBL...@listserv.uga.edu
HLASM already does exactly that. RTFM for EQU attributes.

sas

Tom Marchant

unread,
Jul 24, 2017, 10:00:36 AM7/24/17
to ASSEMBL...@listserv.uga.edu
On Sat, 22 Jul 2017 23:54:49 +1000, graeme wrote:

>I use r0:r15 for 32 bit reg references, g0:g15 for 64 bit reg references.
>
>Where the instruction references, or sets, bits 0:31 of a 64 bit reg, I use the appropriate "gn" symbolic to identify the register, else I use the appropriate "rn" symbolic.
>
>For the assembler to "police" this in some way I'd imagine having a set of 32 directives like:
>g0 gpr64 0

EQU does this for you, as described in John's original post.

G0 EQU 0,,,,GR64

>..
>r0 gpr32 0

R0 EQU 0,,,,GR32

--
Tom Marchant
Reply all
Reply to author
Forward
0 new messages