[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.
authorIlya Kuklin <ikuklin@accesssoftek.com>
Thu, 4 May 2023 19:36:25 +0000 (12:36 -0700)
committerAnton Korobeynikov <anton@korobeynikov.info>
Thu, 4 May 2023 19:37:30 +0000 (12:37 -0700)
commitc395a846001aa953e54916c6f88da22173efb25e
tree0fb9f5345b8d022f0e7d26b6af54defbb4e7a6bc
parentd1d4e56433c193e6fff48f0fbf0c0fac14b93acc
[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.

This change will allow to put code pointers in DWARF info fields that are larger than actual pointer size, e.g. 16-bit pointers into 32-bit fields.

The need for this came up while creating support for MSP430 in LLDB. MSP430-GCC already generates DWARF info with 32-bit fields, so this change is necessary for LLDB to maintain compatibility with both GCC and LLVM binaries. Moreover, right now in LLDB there is no support for having DWARF pointer size different from ELF header type, e.g. 16-bit DWARF info within ELF32, and it seems there is no such thing as ELF16.

Since other mainline targets are made to have the same pointer size in both MCAsmInfo and DataLayout, there is no need to change anything there.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D148042
llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
llvm/lib/Target/MSP430/MCTargetDesc/MSP430MCAsmInfo.cpp
llvm/test/DebugInfo/MSP430/cu-ranges.ll
llvm/test/DebugInfo/MSP430/dwarf-basics-v5.ll
llvm/test/DebugInfo/MSP430/dwarf-basics.ll
llvm/test/DebugInfo/MSP430/ranges_always.ll