[libunwind] r316745 - Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 12:41:23 PDT 2017

On Fri, 27 Oct 2017, John Baldwin wrote:

> On 10/27/17 8:59 AM, Martin Storsjo via cfe-commits wrote:
>> Author: mstorsjo
>> Date: Fri Oct 27 00:59:01 2017
>> New Revision: 316745
>> URL: http://llvm.org/viewvc/llvm-project?rev=316745&view=rev
>> Log:
>> Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER
>> This avoids having to keep the same information duplicated in multiple
>> places.
>> Adjust _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value
>> of the highest used register and only use the value
>> _LIBUNWIND_HIGHEST_DWARF_REGISTER + 1 (kMaxRegisterNumber + 1) for
>> allocating the savedRegisters array.
> Sorry I didn't realize it during the review, but I've just realized why
> using HIGHEST_DWARF_REGISTER is not correct in the various Register classes.
> If you are building without _LIBUNWIND_IS_NATIVE_ONLY defined, then you
> will end up with all of the Register classes returning the same value
> (119 from the end of __libunwind_config.h) instead of the architecture-specific
> value.  This is a change in behavior, so the Registers.hpp portion of this
> change should perhaps be reverted.

I did think of it at some point, but wasn't aware if that setup actually 
was too relevant.

In any case - I can think of an even better way of doing this, without 
having to duplicate the definitions, while still keeping the individual 
Registers classes returning the right values - I'll post a patch in a 
little moment.

// Martin

More information about the cfe-commits mailing list