Page MenuHomePhabricator

[libunwind] Express Registers_*::lastDwarfReg using _LIBUNWIND_HIGHEST_DWARF_REGISTER
ClosedPublic

Authored by mstorsjo on Oct 25 2017, 1:38 AM.

Details

Summary

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.

Diff Detail

Repository
rL LLVM

Event Timeline

bsdjhb added a subscriber: bsdjhb.Oct 26 2017, 7:10 AM

I think one source of truth is better than two. I do find the constant's value a bit off in general though. That is, the name 'HIGHEST' implies to me that it is the highest value used, not N + 1 as we currently define it.

mstorsjo updated this revision to Diff 120467.Oct 26 2017, 12:59 PM
mstorsjo edited the summary of this revision. (Show Details)

Adjusted _LIBUNWIND_HIGHEST_DWARF_REGISTER to actually have the value of the highest register, not highest+1.

compnerd accepted this revision.Oct 26 2017, 7:28 PM
compnerd added inline comments.
src/DwarfInstructions.hpp
170 ↗(On Diff #120467)

Please use static_cast rather than the C style cast.

This revision is now accepted and ready to land.Oct 26 2017, 7:28 PM
This revision was automatically updated to reflect the committed changes.