destroysCallerSavedRegisters and register reference map in DebugInfo

Christian Wimmer christian.wimmer at
Wed Jul 24 19:03:41 PDT 2013

[summary of a chat with Chris today]

>> Quick question about this code in LinearScan:
>>     private void computeDebugInfo(IntervalWalker iw, final LIRInstruction op, LIRFrameState info) {
>>         BitSet registerRefMap = op.destroysCallerSavedRegisters() ? null : frameMap.initRegisterRefMap();
>>         BitSet frameRefMap = frameMap.initFrameRefMap();
>>         computeOopMap(iw, op, registerRefMap, frameRefMap);
>> Why are we not creating a register reference map if we destroy caller saved registers?
> Because all live registers will be spilled around the call and so there are no live values in registers during the call.

This is only true for X86, not for SPARC.

>>   I'm having trouble with this logic on SPARC because computeOopMap wants to store a register in the map (a local register).
> Wouldn't we just ensure that op.destroysCallerSavedRegisters() returns false for all SPARC ops (given that local registers are never killed by a callee)?

This does not work. destroysCallerSavedRegisters is the trigger in the 
register allocator to spill before a call: A short temporary life range 
is generated for every caller save register for every LIR instruction 
that returns true. If you return false, no register will be saved at the 
call site.

>> Would there be a downside if we always would create and empty map and just pass it on except a little bit of overhead?

For SPARC, are register reference map is needed for every call site.

So instead of

   BitSet registerRefMap = op.destroysCallerSavedRegisters() ? null : 

you need something like

   BitSet registerRefMap = op.destroysCallerSavedRegisters() && 
callKillsRegisters ? null : frameMap.initRegisterRefMap();

callKillsRegisters is defined in the LinearScanWalker, so that 
information is not too far away


More information about the graal-dev mailing list