This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use llvm::MC for register numbers in AArch64 ABIs
ClosedPublic

Authored by labath on Mar 4 2020, 6:03 AM.

Details

Summary

This is equivalent to previous patches (e.g. 07355c1c0) for the x86 ABIs.

One name fixup is needed -- lldb refers to the floating/vector registers by
their vector name (vN). Llvm does not use this name, so we map it to qN,
representing the register as a single 128 bit value (this choice is fairly
arbitrary -- any other name would also work fine as they all have the same
DWARF number).

Diff Detail

Event Timeline

labath created this revision.Mar 4 2020, 6:03 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 4 2020, 6:03 AM
labath marked an inline comment as done.Mar 4 2020, 6:10 AM
labath added inline comments.
lldb/source/Plugins/ABI/AArch64/ABIAArch64.cpp
29–32

This is here to ensure identical behavior to the previous code, but I am not sure it is really needed/correct. Arm-dwarf spec does not assign a register number to the pc (number 32, used by lldb, is reserved) or cpsr (number 33 is assigned to ELR_mode).

Llvm does not use either of these numbers, so at least no llvm-based toolchain should be generating them.

omjavaid accepted this revision.Apr 27 2020, 7:39 PM

Looks good to me. Tested on AArch64/Linux with no regressions.

This revision is now accepted and ready to land.Apr 27 2020, 7:39 PM
labath added a comment.May 5 2020, 7:27 AM

Thanks for trying this out. Do you by any chance have any ideas why would lldb assign a dwarf number to the pc register when neither llvm nor the arm64 abi do not specify a pc register number?

Thanks for trying this out. Do you by any chance have any ideas why would lldb assign a dwarf number to the pc register when neither llvm nor the arm64 abi do not specify a pc register number?

Not sure why this was added seems like original import from apple repos had this but AArch64 procedure call standard doesnt have it as you said. This also means compiler should never emit a dwarf instruction with reg num 32. GDB doesnt use PC reg num either and i dont remember seeing any special use of this register number anywhere in LLDB. May be ask @clayborg or @jasonmolenda they seems to have written the code according to commit log.

This revision was automatically updated to reflect the committed changes.