mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-20 11:33:24 +02:00
[DWARF] Make dwarf::getDwarfOffsetByteSize() a free function. NFC.
This will help simplify code in upcoming patches and make some expressions constexpr. Differential Revision: https://reviews.llvm.org/D73039
This commit is contained in:
parent
6e98885794
commit
faaa32f610
@ -532,6 +532,17 @@ unsigned LanguageVendor(SourceLanguage L);
|
|||||||
|
|
||||||
Optional<unsigned> LanguageLowerBound(SourceLanguage L);
|
Optional<unsigned> LanguageLowerBound(SourceLanguage L);
|
||||||
|
|
||||||
|
/// The size of a reference determined by the DWARF 32/64-bit format.
|
||||||
|
constexpr uint8_t getDwarfOffsetByteSize(DwarfFormat Format) {
|
||||||
|
switch (Format) {
|
||||||
|
case DwarfFormat::DWARF32:
|
||||||
|
return 4;
|
||||||
|
case DwarfFormat::DWARF64:
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
llvm_unreachable("Invalid Format value");
|
||||||
|
}
|
||||||
|
|
||||||
/// A helper struct providing information about the byte size of DW_FORM
|
/// A helper struct providing information about the byte size of DW_FORM
|
||||||
/// values that vary in size depending on the DWARF version, address byte
|
/// values that vary in size depending on the DWARF version, address byte
|
||||||
/// size, or DWARF32/DWARF64.
|
/// size, or DWARF32/DWARF64.
|
||||||
@ -551,13 +562,7 @@ struct FormParams {
|
|||||||
|
|
||||||
/// The size of a reference is determined by the DWARF 32/64-bit format.
|
/// The size of a reference is determined by the DWARF 32/64-bit format.
|
||||||
uint8_t getDwarfOffsetByteSize() const {
|
uint8_t getDwarfOffsetByteSize() const {
|
||||||
switch (Format) {
|
return dwarf::getDwarfOffsetByteSize(Format);
|
||||||
case DwarfFormat::DWARF32:
|
|
||||||
return 4;
|
|
||||||
case DwarfFormat::DWARF64:
|
|
||||||
return 8;
|
|
||||||
}
|
|
||||||
llvm_unreachable("Invalid Format value");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
explicit operator bool() const { return Version && AddrSize; }
|
explicit operator bool() const { return Version && AddrSize; }
|
||||||
|
Loading…
Reference in New Issue
Block a user