Skip to content

Conversation

@Spencer-Comin
Copy link
Contributor

Add support to associate names with virtual registers in debug prints. Registers that don't have associated names are still printed with the original behaviour.

Example from jit log:
Before

 [0x7a02d18d1b00]       mov     qword ptr [GPR_0000+0x60], GPR_0029             # S8MemReg, SymRef [#439 +96]
 [0x7a02d18d1b90]       xor     GPR_0018, GPR_0018              # XOR1RegReg
 [0x7a02d18d1c20]       mov     GPR_0019, GPR_0028              # MOV8RegReg
 [0x7a02d18d1cb0]       sub     GPR_0029, GPR_0028              # SUB8RegReg

After

 [0x7ddf9c8d1b00]       mov     qword ptr [GPR_0000+0x60], GPR_multianewarray.allocEnd          # S8MemReg, SymRef [#439 +96]
 [0x7ddf9c8d1b90]       xor     GPR_multianewarray.zeroReg, GPR_multianewarray.zeroReg          # XOR1RegReg
 [0x7ddf9c8d1c20]       mov     GPR_multianewarray.nDims, GPR_multianewarray.leafArr            # MOV8RegReg
 [0x7ddf9c8d1cb0]       sub     GPR_multianewarray.allocEnd, GPR_multianewarray.leafArr         # SUB8RegReg

@Spencer-Comin Spencer-Comin force-pushed the named-registers branch 2 times, most recently from f21ac3e to c77d809 Compare November 14, 2025 15:25
@0xdaryl 0xdaryl self-assigned this Nov 21, 2025
@0xdaryl
Copy link
Contributor

0xdaryl commented Nov 21, 2025

How does this co-exist with the current scheme of assigning monotonically increasing register numbers to each virtual (stored in a hash table)? That mechanism is only useful for printing, as are named registers. Will named registers circumvent that? There is no need to do both for the same register.

@Spencer-Comin
Copy link
Contributor Author

Spencer-Comin commented Nov 21, 2025

As this change stands it doesn't affect the current scheme. Registers will still be assigned numbers when they are named. I'll have to modify TR_Debug::newRegister to accommodate named registers.

@0xdaryl
Copy link
Contributor

0xdaryl commented Nov 22, 2025

As part of this PR, can you include the complete solution with how these named registers will be used (including how you deal with the existing numbering mechanism)? Or is there some other reason why you need to introduce just this infrastructure first?

@Spencer-Comin Spencer-Comin marked this pull request as draft November 24, 2025 13:34
@Spencer-Comin
Copy link
Contributor Author

Marking this as draft until I have a completed solution that deals with the existing numbering mechanism

Add support to give a debug name to a virtual register when allocating.

Signed-off-by: Spencer Comin <spencer.comin@ibm.com>
@Spencer-Comin
Copy link
Contributor Author

I changed the approach to replace the numbering mechanism, should be good for review now

@Spencer-Comin Spencer-Comin marked this pull request as ready for review December 4, 2025 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants