[llvm] Use llvm::endianness::{big,little,native} (NFC)
Now that llvm::support::endianness has been renamed to llvm::endianness, we can use the shorter form. This patch replaces support::endianness::{big,little,native} with llvm::endianness::{big,little,native}.
This commit is contained in:
parent
8c67c48591
commit
b05dbc4d5f
@ -90,7 +90,7 @@ struct PLTCallStubInfo {
|
|||||||
|
|
||||||
template <support::endianness Endianness>
|
template <support::endianness Endianness>
|
||||||
inline PLTCallStubInfo pickStub(PLTCallStubKind StubKind) {
|
inline PLTCallStubInfo pickStub(PLTCallStubKind StubKind) {
|
||||||
constexpr bool isLE = Endianness == support::endianness::little;
|
constexpr bool isLE = Endianness == llvm::endianness::little;
|
||||||
switch (StubKind) {
|
switch (StubKind) {
|
||||||
case LongBranch: {
|
case LongBranch: {
|
||||||
ArrayRef<char> Content =
|
ArrayRef<char> Content =
|
||||||
@ -273,14 +273,14 @@ inline static uint16_t highesta(uint64_t x) { return (x + 0x8000) >> 48; }
|
|||||||
// its endian.
|
// its endian.
|
||||||
template <support::endianness Endianness>
|
template <support::endianness Endianness>
|
||||||
inline static uint64_t readPrefixedInstruction(const char *Loc) {
|
inline static uint64_t readPrefixedInstruction(const char *Loc) {
|
||||||
constexpr bool isLE = Endianness == support::endianness::little;
|
constexpr bool isLE = Endianness == llvm::endianness::little;
|
||||||
uint64_t Inst = support::endian::read64<Endianness>(Loc);
|
uint64_t Inst = support::endian::read64<Endianness>(Loc);
|
||||||
return isLE ? (Inst << 32) | (Inst >> 32) : Inst;
|
return isLE ? (Inst << 32) | (Inst >> 32) : Inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <support::endianness Endianness>
|
template <support::endianness Endianness>
|
||||||
inline static void writePrefixedInstruction(char *Loc, uint64_t Inst) {
|
inline static void writePrefixedInstruction(char *Loc, uint64_t Inst) {
|
||||||
constexpr bool isLE = Endianness == support::endianness::little;
|
constexpr bool isLE = Endianness == llvm::endianness::little;
|
||||||
Inst = isLE ? (Inst << 32) | (Inst >> 32) : Inst;
|
Inst = isLE ? (Inst << 32) | (Inst >> 32) : Inst;
|
||||||
support::endian::write64<Endianness>(Loc, Inst);
|
support::endian::write64<Endianness>(Loc, Inst);
|
||||||
}
|
}
|
||||||
|
@ -348,7 +348,7 @@ public:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
using HasByteSwapT = decltype(support::endian::byte_swap(
|
using HasByteSwapT = decltype(support::endian::byte_swap(
|
||||||
std::declval<T &>(), support::endianness::little));
|
std::declval<T &>(), llvm::endianness::little));
|
||||||
/// Adjust `Value` for the target endianness and add it to the hash.
|
/// Adjust `Value` for the target endianness and add it to the hash.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
std::enable_if_t<is_detected<HasByteSwapT, T>::value, HashBuilder &>
|
std::enable_if_t<is_detected<HasByteSwapT, T>::value, HashBuilder &>
|
||||||
@ -393,8 +393,8 @@ public:
|
|||||||
hash_code Code;
|
hash_code Code;
|
||||||
};
|
};
|
||||||
|
|
||||||
using HashCodeHashBuilder = HashBuilder<hashbuilder_detail::HashCodeHasher,
|
using HashCodeHashBuilder =
|
||||||
support::endianness::native>;
|
HashBuilder<hashbuilder_detail::HashCodeHasher, llvm::endianness::native>;
|
||||||
} // namespace hashbuilder_detail
|
} // namespace hashbuilder_detail
|
||||||
|
|
||||||
/// Provide a default implementation of `hash_value` when `addHash(const T &)`
|
/// Provide a default implementation of `hash_value` when `addHash(const T &)`
|
||||||
|
@ -68,8 +68,8 @@ Error DWARFLinkerImpl::link() {
|
|||||||
|
|
||||||
if (TheDwarfEmitter) {
|
if (TheDwarfEmitter) {
|
||||||
GlobalEndianness = TheDwarfEmitter->getTargetTriple().isLittleEndian()
|
GlobalEndianness = TheDwarfEmitter->getTargetTriple().isLittleEndian()
|
||||||
? support::endianness::little
|
? llvm::endianness::little
|
||||||
: support::endianness::big;
|
: llvm::endianness::big;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::unique_ptr<LinkContext> &Context : ObjectContexts) {
|
for (std::unique_ptr<LinkContext> &Context : ObjectContexts) {
|
||||||
|
@ -227,8 +227,8 @@ protected:
|
|||||||
// Set context format&endianness based on the input file.
|
// Set context format&endianness based on the input file.
|
||||||
Format.Version = File.Dwarf->getMaxVersion();
|
Format.Version = File.Dwarf->getMaxVersion();
|
||||||
Format.AddrSize = File.Dwarf->getCUAddrSize();
|
Format.AddrSize = File.Dwarf->getCUAddrSize();
|
||||||
Endianness = File.Dwarf->isLittleEndian() ? support::endianness::little
|
Endianness = File.Dwarf->isLittleEndian() ? llvm::endianness::little
|
||||||
: support::endianness::big;
|
: llvm::endianness::big;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ protected:
|
|||||||
|
|
||||||
/// Output format.
|
/// Output format.
|
||||||
dwarf::FormParams Format = {4, 4, dwarf::DWARF32};
|
dwarf::FormParams Format = {4, 4, dwarf::DWARF32};
|
||||||
support::endianness Endianess = support::endianness::little;
|
support::endianness Endianess = llvm::endianness::little;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// This class keeps contents and offsets to the debug sections. Any objects
|
/// This class keeps contents and offsets to the debug sections. Any objects
|
||||||
|
@ -394,7 +394,7 @@ static Error writePublics(BinaryStreamWriter &Writer,
|
|||||||
|
|
||||||
static Error writeRecords(BinaryStreamWriter &Writer,
|
static Error writeRecords(BinaryStreamWriter &Writer,
|
||||||
ArrayRef<CVSymbol> Records) {
|
ArrayRef<CVSymbol> Records) {
|
||||||
BinaryItemStream<CVSymbol> ItemStream(support::endianness::little);
|
BinaryItemStream<CVSymbol> ItemStream(llvm::endianness::little);
|
||||||
ItemStream.setItems(Records);
|
ItemStream.setItems(Records);
|
||||||
BinaryStreamRef RecordsRef(ItemStream);
|
BinaryStreamRef RecordsRef(ItemStream);
|
||||||
return Writer.writeStreamRef(RecordsRef);
|
return Writer.writeStreamRef(RecordsRef);
|
||||||
|
@ -84,14 +84,14 @@ private:
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
const uint8_t TLSInfoTableManager_ELF_ppc64<
|
const uint8_t TLSInfoTableManager_ELF_ppc64<
|
||||||
support::endianness::little>::TLSInfoEntryContent[16] = {
|
llvm::endianness::little>::TLSInfoEntryContent[16] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*pthread key */
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*pthread key */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*data address*/
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*data address*/
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
const uint8_t TLSInfoTableManager_ELF_ppc64<
|
const uint8_t TLSInfoTableManager_ELF_ppc64<
|
||||||
support::endianness::big>::TLSInfoEntryContent[16] = {
|
llvm::endianness::big>::TLSInfoEntryContent[16] = {
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*pthread key */
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /*pthread key */
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*data address*/
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /*data address*/
|
||||||
};
|
};
|
||||||
|
@ -60,7 +60,7 @@ public:
|
|||||||
switch (TT.getArch()) {
|
switch (TT.getArch()) {
|
||||||
case Triple::x86_64:
|
case Triple::x86_64:
|
||||||
PointerSize = 8;
|
PointerSize = 8;
|
||||||
Endianness = support::endianness::little;
|
Endianness = llvm::endianness::little;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Unrecognized architecture");
|
llvm_unreachable("Unrecognized architecture");
|
||||||
|
@ -158,15 +158,15 @@ public:
|
|||||||
|
|
||||||
std::optional<StringRef> FileName;
|
std::optional<StringRef> FileName;
|
||||||
if (!DebugLineSectionData.empty()) {
|
if (!DebugLineSectionData.empty()) {
|
||||||
assert((G.getEndianness() == support::endianness::big ||
|
assert((G.getEndianness() == llvm::endianness::big ||
|
||||||
G.getEndianness() == support::endianness::little) &&
|
G.getEndianness() == llvm::endianness::little) &&
|
||||||
"G.getEndianness() must be either big or little");
|
"G.getEndianness() must be either big or little");
|
||||||
auto DWARFCtx = DWARFContext::create(DebugSectionMap, G.getPointerSize(),
|
auto DWARFCtx =
|
||||||
G.getEndianness() ==
|
DWARFContext::create(DebugSectionMap, G.getPointerSize(),
|
||||||
support::endianness::little);
|
G.getEndianness() == llvm::endianness::little);
|
||||||
DWARFDataExtractor DebugLineData(
|
DWARFDataExtractor DebugLineData(
|
||||||
DebugLineSectionData,
|
DebugLineSectionData, G.getEndianness() == llvm::endianness::little,
|
||||||
G.getEndianness() == support::endianness::little, G.getPointerSize());
|
G.getPointerSize());
|
||||||
uint64_t Offset = 0;
|
uint64_t Offset = 0;
|
||||||
DWARFDebugLine::LineTable LineTable;
|
DWARFDebugLine::LineTable LineTable;
|
||||||
|
|
||||||
|
@ -47,22 +47,22 @@ public:
|
|||||||
switch (TT.getArch()) {
|
switch (TT.getArch()) {
|
||||||
case Triple::x86_64:
|
case Triple::x86_64:
|
||||||
PointerSize = 8;
|
PointerSize = 8;
|
||||||
Endianness = support::endianness::little;
|
Endianness = llvm::endianness::little;
|
||||||
EdgeKind = jitlink::x86_64::Pointer64;
|
EdgeKind = jitlink::x86_64::Pointer64;
|
||||||
break;
|
break;
|
||||||
case Triple::aarch64:
|
case Triple::aarch64:
|
||||||
PointerSize = 8;
|
PointerSize = 8;
|
||||||
Endianness = support::endianness::little;
|
Endianness = llvm::endianness::little;
|
||||||
EdgeKind = jitlink::aarch64::Pointer64;
|
EdgeKind = jitlink::aarch64::Pointer64;
|
||||||
break;
|
break;
|
||||||
case Triple::ppc64:
|
case Triple::ppc64:
|
||||||
PointerSize = 8;
|
PointerSize = 8;
|
||||||
Endianness = support::endianness::big;
|
Endianness = llvm::endianness::big;
|
||||||
EdgeKind = jitlink::ppc64::Pointer64;
|
EdgeKind = jitlink::ppc64::Pointer64;
|
||||||
break;
|
break;
|
||||||
case Triple::ppc64le:
|
case Triple::ppc64le:
|
||||||
PointerSize = 8;
|
PointerSize = 8;
|
||||||
Endianness = support::endianness::little;
|
Endianness = llvm::endianness::little;
|
||||||
EdgeKind = jitlink::ppc64::Pointer64;
|
EdgeKind = jitlink::ppc64::Pointer64;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -542,7 +542,7 @@ Expected<support::endianness>
|
|||||||
DLLImportDefinitionGenerator::getTargetEndianness(const Triple &TT) {
|
DLLImportDefinitionGenerator::getTargetEndianness(const Triple &TT) {
|
||||||
switch (TT.getArch()) {
|
switch (TT.getArch()) {
|
||||||
case Triple::x86_64:
|
case Triple::x86_64:
|
||||||
return support::endianness::little;
|
return llvm::endianness::little;
|
||||||
default:
|
default:
|
||||||
return make_error<StringError>(
|
return make_error<StringError>(
|
||||||
"architecture unsupported by DLLImportDefinitionGenerator",
|
"architecture unsupported by DLLImportDefinitionGenerator",
|
||||||
|
@ -71,7 +71,7 @@ std::unique_ptr<jitlink::LinkGraph> createPlatformGraph(MachOPlatform &MOP,
|
|||||||
case Triple::aarch64:
|
case Triple::aarch64:
|
||||||
case Triple::x86_64:
|
case Triple::x86_64:
|
||||||
PointerSize = 8;
|
PointerSize = 8;
|
||||||
Endianness = support::endianness::little;
|
Endianness = llvm::endianness::little;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
llvm_unreachable("Unrecognized architecture");
|
llvm_unreachable("Unrecognized architecture");
|
||||||
|
@ -857,25 +857,23 @@ BinaryCoverageReader::createCoverageReaderFromBuffer(
|
|||||||
new BinaryCoverageReader(std::move(FuncRecords)));
|
new BinaryCoverageReader(std::move(FuncRecords)));
|
||||||
Reader->ProfileNames = std::move(ProfileNames);
|
Reader->ProfileNames = std::move(ProfileNames);
|
||||||
StringRef FuncRecordsRef = Reader->FuncRecords->getBuffer();
|
StringRef FuncRecordsRef = Reader->FuncRecords->getBuffer();
|
||||||
if (BytesInAddress == 4 && Endian == support::endianness::little) {
|
if (BytesInAddress == 4 && Endian == llvm::endianness::little) {
|
||||||
if (Error E =
|
if (Error E = readCoverageMappingData<uint32_t, llvm::endianness::little>(
|
||||||
readCoverageMappingData<uint32_t, support::endianness::little>(
|
|
||||||
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
||||||
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
||||||
return std::move(E);
|
return std::move(E);
|
||||||
} else if (BytesInAddress == 4 && Endian == support::endianness::big) {
|
} else if (BytesInAddress == 4 && Endian == llvm::endianness::big) {
|
||||||
if (Error E = readCoverageMappingData<uint32_t, support::endianness::big>(
|
if (Error E = readCoverageMappingData<uint32_t, llvm::endianness::big>(
|
||||||
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
||||||
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
||||||
return std::move(E);
|
return std::move(E);
|
||||||
} else if (BytesInAddress == 8 && Endian == support::endianness::little) {
|
} else if (BytesInAddress == 8 && Endian == llvm::endianness::little) {
|
||||||
if (Error E =
|
if (Error E = readCoverageMappingData<uint64_t, llvm::endianness::little>(
|
||||||
readCoverageMappingData<uint64_t, support::endianness::little>(
|
|
||||||
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
||||||
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
||||||
return std::move(E);
|
return std::move(E);
|
||||||
} else if (BytesInAddress == 8 && Endian == support::endianness::big) {
|
} else if (BytesInAddress == 8 && Endian == llvm::endianness::big) {
|
||||||
if (Error E = readCoverageMappingData<uint64_t, support::endianness::big>(
|
if (Error E = readCoverageMappingData<uint64_t, llvm::endianness::big>(
|
||||||
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
Reader->ProfileNames, Coverage, FuncRecordsRef,
|
||||||
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
Reader->MappingRecords, CompilationDir, Reader->Filenames))
|
||||||
return std::move(E);
|
return std::move(E);
|
||||||
@ -889,7 +887,7 @@ BinaryCoverageReader::createCoverageReaderFromBuffer(
|
|||||||
static Expected<std::unique_ptr<BinaryCoverageReader>>
|
static Expected<std::unique_ptr<BinaryCoverageReader>>
|
||||||
loadTestingFormat(StringRef Data, StringRef CompilationDir) {
|
loadTestingFormat(StringRef Data, StringRef CompilationDir) {
|
||||||
uint8_t BytesInAddress = 8;
|
uint8_t BytesInAddress = 8;
|
||||||
support::endianness Endian = support::endianness::little;
|
support::endianness Endian = llvm::endianness::little;
|
||||||
|
|
||||||
// Read the magic and version.
|
// Read the magic and version.
|
||||||
Data = Data.substr(sizeof(TestingFormatMagic));
|
Data = Data.substr(sizeof(TestingFormatMagic));
|
||||||
@ -897,7 +895,7 @@ loadTestingFormat(StringRef Data, StringRef CompilationDir) {
|
|||||||
return make_error<CoverageMapError>(coveragemap_error::malformed,
|
return make_error<CoverageMapError>(coveragemap_error::malformed,
|
||||||
"the size of data is too small");
|
"the size of data is too small");
|
||||||
auto TestingVersion =
|
auto TestingVersion =
|
||||||
support::endian::byte_swap<uint64_t, support::endianness::little>(
|
support::endian::byte_swap<uint64_t, llvm::endianness::little>(
|
||||||
*reinterpret_cast<const uint64_t *>(Data.data()));
|
*reinterpret_cast<const uint64_t *>(Data.data()));
|
||||||
Data = Data.substr(sizeof(uint64_t));
|
Data = Data.substr(sizeof(uint64_t));
|
||||||
|
|
||||||
@ -957,7 +955,7 @@ loadTestingFormat(StringRef Data, StringRef CompilationDir) {
|
|||||||
auto const *CovHeader = reinterpret_cast<const CovMapHeader *>(
|
auto const *CovHeader = reinterpret_cast<const CovMapHeader *>(
|
||||||
Data.substr(0, sizeof(CovMapHeader)).data());
|
Data.substr(0, sizeof(CovMapHeader)).data());
|
||||||
auto Version =
|
auto Version =
|
||||||
CovMapVersion(CovHeader->getVersion<support::endianness::little>());
|
CovMapVersion(CovHeader->getVersion<llvm::endianness::little>());
|
||||||
|
|
||||||
// In Version1, the size of CoverageMapping is calculated.
|
// In Version1, the size of CoverageMapping is calculated.
|
||||||
if (TestingVersion == uint64_t(TestingFormatVersion::Version1)) {
|
if (TestingVersion == uint64_t(TestingFormatVersion::Version1)) {
|
||||||
@ -965,7 +963,7 @@ loadTestingFormat(StringRef Data, StringRef CompilationDir) {
|
|||||||
CoverageMappingSize = Data.size();
|
CoverageMappingSize = Data.size();
|
||||||
} else {
|
} else {
|
||||||
auto FilenamesSize =
|
auto FilenamesSize =
|
||||||
CovHeader->getFilenamesSize<support::endianness::little>();
|
CovHeader->getFilenamesSize<llvm::endianness::little>();
|
||||||
CoverageMappingSize = sizeof(CovMapHeader) + FilenamesSize;
|
CoverageMappingSize = sizeof(CovMapHeader) + FilenamesSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1046,9 +1044,8 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch,
|
|||||||
|
|
||||||
// The coverage uses native pointer sizes for the object it's written in.
|
// The coverage uses native pointer sizes for the object it's written in.
|
||||||
uint8_t BytesInAddress = OF->getBytesInAddress();
|
uint8_t BytesInAddress = OF->getBytesInAddress();
|
||||||
support::endianness Endian = OF->isLittleEndian()
|
support::endianness Endian =
|
||||||
? support::endianness::little
|
OF->isLittleEndian() ? llvm::endianness::little : llvm::endianness::big;
|
||||||
: support::endianness::big;
|
|
||||||
|
|
||||||
// Look for the sections that we are interested in.
|
// Look for the sections that we are interested in.
|
||||||
auto ObjFormat = OF->getTripleObjectFormat();
|
auto ObjFormat = OF->getTripleObjectFormat();
|
||||||
@ -1156,7 +1153,7 @@ BinaryCoverageReader::create(
|
|||||||
|
|
||||||
if (ObjectBuffer.getBuffer().size() > sizeof(TestingFormatMagic)) {
|
if (ObjectBuffer.getBuffer().size() > sizeof(TestingFormatMagic)) {
|
||||||
uint64_t Magic =
|
uint64_t Magic =
|
||||||
support::endian::byte_swap<uint64_t, support::endianness::little>(
|
support::endian::byte_swap<uint64_t, llvm::endianness::little>(
|
||||||
*reinterpret_cast<const uint64_t *>(ObjectBuffer.getBufferStart()));
|
*reinterpret_cast<const uint64_t *>(ObjectBuffer.getBufferStart()));
|
||||||
if (Magic == TestingFormatMagic) {
|
if (Magic == TestingFormatMagic) {
|
||||||
// This is a special format used for testing.
|
// This is a special format used for testing.
|
||||||
|
@ -252,7 +252,7 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
|
|||||||
|
|
||||||
void TestingFormatWriter::write(raw_ostream &OS, TestingFormatVersion Version) {
|
void TestingFormatWriter::write(raw_ostream &OS, TestingFormatVersion Version) {
|
||||||
auto ByteSwap = [](uint64_t N) {
|
auto ByteSwap = [](uint64_t N) {
|
||||||
return support::endian::byte_swap<uint64_t, support::endianness::little>(N);
|
return support::endian::byte_swap<uint64_t, llvm::endianness::little>(N);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Output a 64bit magic number.
|
// Output a 64bit magic number.
|
||||||
|
@ -428,18 +428,19 @@ DECODE_SDWA(VopcDst)
|
|||||||
|
|
||||||
template <typename T> static inline T eatBytes(ArrayRef<uint8_t>& Bytes) {
|
template <typename T> static inline T eatBytes(ArrayRef<uint8_t>& Bytes) {
|
||||||
assert(Bytes.size() >= sizeof(T));
|
assert(Bytes.size() >= sizeof(T));
|
||||||
const auto Res = support::endian::read<T, support::endianness::little>(Bytes.data());
|
const auto Res =
|
||||||
|
support::endian::read<T, llvm::endianness::little>(Bytes.data());
|
||||||
Bytes = Bytes.slice(sizeof(T));
|
Bytes = Bytes.slice(sizeof(T));
|
||||||
return Res;
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline DecoderUInt128 eat12Bytes(ArrayRef<uint8_t> &Bytes) {
|
static inline DecoderUInt128 eat12Bytes(ArrayRef<uint8_t> &Bytes) {
|
||||||
assert(Bytes.size() >= 12);
|
assert(Bytes.size() >= 12);
|
||||||
uint64_t Lo = support::endian::read<uint64_t, support::endianness::little>(
|
uint64_t Lo =
|
||||||
Bytes.data());
|
support::endian::read<uint64_t, llvm::endianness::little>(Bytes.data());
|
||||||
Bytes = Bytes.slice(8);
|
Bytes = Bytes.slice(8);
|
||||||
uint64_t Hi = support::endian::read<uint32_t, support::endianness::little>(
|
uint64_t Hi =
|
||||||
Bytes.data());
|
support::endian::read<uint32_t, llvm::endianness::little>(Bytes.data());
|
||||||
Bytes = Bytes.slice(4);
|
Bytes = Bytes.slice(4);
|
||||||
return DecoderUInt128(Lo, Hi);
|
return DecoderUInt128(Lo, Hi);
|
||||||
}
|
}
|
||||||
@ -2076,7 +2077,7 @@ MCDisassembler::DecodeStatus AMDGPUDisassembler::decodeKernelDescriptor(
|
|||||||
if (isGFX10Plus()) {
|
if (isGFX10Plus()) {
|
||||||
uint16_t KernelCodeProperties =
|
uint16_t KernelCodeProperties =
|
||||||
support::endian::read16(&Bytes[amdhsa::KERNEL_CODE_PROPERTIES_OFFSET],
|
support::endian::read16(&Bytes[amdhsa::KERNEL_CODE_PROPERTIES_OFFSET],
|
||||||
support::endianness::little);
|
llvm::endianness::little);
|
||||||
EnableWavefrontSize32 =
|
EnableWavefrontSize32 =
|
||||||
AMDHSA_BITS_GET(KernelCodeProperties,
|
AMDHSA_BITS_GET(KernelCodeProperties,
|
||||||
amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32);
|
amdhsa::KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32);
|
||||||
|
@ -411,7 +411,7 @@ void AMDGPUMCCodeEmitter::encodeInstruction(const MCInst &MI,
|
|||||||
} else if (!Op.isExpr()) // Exprs will be replaced with a fixup value.
|
} else if (!Op.isExpr()) // Exprs will be replaced with a fixup value.
|
||||||
llvm_unreachable("Must be immediate or expr");
|
llvm_unreachable("Must be immediate or expr");
|
||||||
|
|
||||||
support::endian::write<uint32_t>(CB, Imm, support::endianness::little);
|
support::endian::write<uint32_t>(CB, Imm, llvm::endianness::little);
|
||||||
|
|
||||||
// Only one literal value allowed
|
// Only one literal value allowed
|
||||||
break;
|
break;
|
||||||
|
@ -723,7 +723,7 @@ void AMDGPUPALMetadata::toLegacyBlob(std::string &Blob) {
|
|||||||
if (Registers.getMap().empty())
|
if (Registers.getMap().empty())
|
||||||
return;
|
return;
|
||||||
raw_string_ostream OS(Blob);
|
raw_string_ostream OS(Blob);
|
||||||
support::endian::Writer EW(OS, support::endianness::little);
|
support::endian::Writer EW(OS, llvm::endianness::little);
|
||||||
for (auto I : Registers.getMap()) {
|
for (auto I : Registers.getMap()) {
|
||||||
EW.write(uint32_t(I.first.getUInt()));
|
EW.write(uint32_t(I.first.getUInt()));
|
||||||
EW.write(uint32_t(I.second.getUInt()));
|
EW.write(uint32_t(I.second.getUInt()));
|
||||||
|
@ -285,7 +285,7 @@ void AVRMCCodeEmitter::encodeInstruction(const MCInst &MI,
|
|||||||
|
|
||||||
for (int64_t i = Size / 2 - 1; i >= 0; --i) {
|
for (int64_t i = Size / 2 - 1; i >= 0; --i) {
|
||||||
uint16_t Word = (BinaryOpCode >> (i * 16)) & 0xFFFF;
|
uint16_t Word = (BinaryOpCode >> (i * 16)) & 0xFFFF;
|
||||||
support::endian::write(CB, Word, support::endianness::little);
|
support::endian::write(CB, Word, llvm::endianness::little);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +109,8 @@ template <typename T>
|
|||||||
bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
|
bool parseImmediate(MCInst &MI, uint64_t &Size, ArrayRef<uint8_t> Bytes) {
|
||||||
if (Size + sizeof(T) > Bytes.size())
|
if (Size + sizeof(T) > Bytes.size())
|
||||||
return false;
|
return false;
|
||||||
T Val = support::endian::read<T, support::endianness::little, 1>(
|
T Val = support::endian::read<T, llvm::endianness::little, 1>(Bytes.data() +
|
||||||
Bytes.data() + Size);
|
Size);
|
||||||
Size += sizeof(T);
|
Size += sizeof(T);
|
||||||
if (std::is_floating_point<T>::value) {
|
if (std::is_floating_point<T>::value) {
|
||||||
MI.addOperand(
|
MI.addOperand(
|
||||||
|
@ -788,8 +788,8 @@ bool GCOVProfiler::emitProfileNotes(
|
|||||||
std::vector<uint8_t> EdgeDestinations;
|
std::vector<uint8_t> EdgeDestinations;
|
||||||
SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP;
|
SmallVector<std::pair<GlobalVariable *, MDNode *>, 8> CountersBySP;
|
||||||
|
|
||||||
Endian = M->getDataLayout().isLittleEndian() ? support::endianness::little
|
Endian = M->getDataLayout().isLittleEndian() ? llvm::endianness::little
|
||||||
: support::endianness::big;
|
: llvm::endianness::big;
|
||||||
unsigned FunctionIdent = 0;
|
unsigned FunctionIdent = 0;
|
||||||
for (auto &F : M->functions()) {
|
for (auto &F : M->functions()) {
|
||||||
DISubprogram *SP = F.getSubprogram();
|
DISubprogram *SP = F.getSubprogram();
|
||||||
@ -957,7 +957,7 @@ bool GCOVProfiler::emitProfileNotes(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
os = &out;
|
os = &out;
|
||||||
if (Endian == support::endianness::big) {
|
if (Endian == llvm::endianness::big) {
|
||||||
out.write("gcno", 4);
|
out.write("gcno", 4);
|
||||||
out.write(Options.Version, 4);
|
out.write(Options.Version, 4);
|
||||||
} else {
|
} else {
|
||||||
|
@ -57,7 +57,7 @@ Error writeMetadata(support::endian::Writer &OS, Values &&... Ds) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
FDRTraceWriter::FDRTraceWriter(raw_ostream &O, const XRayFileHeader &H)
|
FDRTraceWriter::FDRTraceWriter(raw_ostream &O, const XRayFileHeader &H)
|
||||||
: OS(O, support::endianness::native) {
|
: OS(O, llvm::endianness::native) {
|
||||||
// We need to re-construct a header, by writing the fields we care about for
|
// We need to re-construct a header, by writing the fields we care about for
|
||||||
// traces, in the format that the runtime would have written.
|
// traces, in the format that the runtime would have written.
|
||||||
uint32_t BitField =
|
uint32_t BitField =
|
||||||
|
@ -113,8 +113,7 @@ void PrinterContext<ELFT>::printEHFrameHdr(const Elf_Phdr *EHFramePHdr) const {
|
|||||||
if (!Content)
|
if (!Content)
|
||||||
reportError(Content.takeError(), ObjF.getFileName());
|
reportError(Content.takeError(), ObjF.getFileName());
|
||||||
|
|
||||||
DataExtractor DE(*Content,
|
DataExtractor DE(*Content, ELFT::TargetEndianness == llvm::endianness::little,
|
||||||
ELFT::TargetEndianness == support::endianness::little,
|
|
||||||
ELFT::Is64Bits ? 8 : 4);
|
ELFT::Is64Bits ? 8 : 4);
|
||||||
|
|
||||||
DictScope D(W, "Header");
|
DictScope D(W, "Header");
|
||||||
@ -189,7 +188,7 @@ void PrinterContext<ELFT>::printEHFrame(const Elf_Shdr *EHFrameShdr) const {
|
|||||||
ObjF, DWARFContext::ProcessDebugRelocations::Process, nullptr);
|
ObjF, DWARFContext::ProcessDebugRelocations::Process, nullptr);
|
||||||
DWARFDataExtractor DE(DICtx->getDWARFObj(),
|
DWARFDataExtractor DE(DICtx->getDWARFObj(),
|
||||||
DICtx->getDWARFObj().getEHFrameSection(),
|
DICtx->getDWARFObj().getEHFrameSection(),
|
||||||
ELFT::TargetEndianness == support::endianness::little,
|
ELFT::TargetEndianness == llvm::endianness::little,
|
||||||
ELFT::Is64Bits ? 8 : 4);
|
ELFT::Is64Bits ? 8 : 4);
|
||||||
DWARFDebugFrame EHFrame(Triple::ArchType(ObjF.getArch()), /*IsEH=*/true,
|
DWARFDebugFrame EHFrame(Triple::ArchType(ObjF.getArch()), /*IsEH=*/true,
|
||||||
/*EHFrameAddress=*/Address);
|
/*EHFrameAddress=*/Address);
|
||||||
|
@ -104,7 +104,7 @@ void TraceConverter::exportAsYAML(const Trace &Records, raw_ostream &OS) {
|
|||||||
void TraceConverter::exportAsRAWv1(const Trace &Records, raw_ostream &OS) {
|
void TraceConverter::exportAsRAWv1(const Trace &Records, raw_ostream &OS) {
|
||||||
// First write out the file header, in the correct endian-appropriate format
|
// First write out the file header, in the correct endian-appropriate format
|
||||||
// (XRay assumes currently little endian).
|
// (XRay assumes currently little endian).
|
||||||
support::endian::Writer Writer(OS, support::endianness::little);
|
support::endian::Writer Writer(OS, llvm::endianness::little);
|
||||||
const auto &FH = Records.getFileHeader();
|
const auto &FH = Records.getFileHeader();
|
||||||
Writer.write(FH.Version);
|
Writer.write(FH.Version);
|
||||||
Writer.write(FH.Type);
|
Writer.write(FH.Type);
|
||||||
|
@ -62,7 +62,7 @@ TEST(BLAKE3Test, BLAKE3) {
|
|||||||
"616F575A1B58D4C9797D4217B9730AE5E6EB319D76EDEF6549B46F4EFE31FF8B");
|
"616F575A1B58D4C9797D4217B9730AE5E6EB319D76EDEF6549B46F4EFE31FF8B");
|
||||||
|
|
||||||
// Using generic HashBuilder.
|
// Using generic HashBuilder.
|
||||||
HashBuilder<BLAKE3, support::endianness::native> HashBuilder;
|
HashBuilder<BLAKE3, llvm::endianness::native> HashBuilder;
|
||||||
HashBuilder.update(std::get<0>(testvectors[2]));
|
HashBuilder.update(std::get<0>(testvectors[2]));
|
||||||
BLAKE3Result<> HBHash1 = HashBuilder.final();
|
BLAKE3Result<> HBHash1 = HashBuilder.final();
|
||||||
BLAKE3Result<> HBHash2 = HashBuilder.result();
|
BLAKE3Result<> HBHash2 = HashBuilder.result();
|
||||||
@ -84,7 +84,7 @@ TEST(BLAKE3Test, SmallerHashSize) {
|
|||||||
EXPECT_EQ(hashStr1, "6437B3AC38465133FFB63B75273A8DB5");
|
EXPECT_EQ(hashStr1, "6437B3AC38465133FFB63B75273A8DB5");
|
||||||
|
|
||||||
// Using generic HashBuilder.
|
// Using generic HashBuilder.
|
||||||
HashBuilder<TruncatedBLAKE3<16>, support::endianness::native> HashBuilder;
|
HashBuilder<TruncatedBLAKE3<16>, llvm::endianness::native> HashBuilder;
|
||||||
HashBuilder.update(Input);
|
HashBuilder.update(Input);
|
||||||
BLAKE3Result<16> hash3 = HashBuilder.final();
|
BLAKE3Result<16> hash3 = HashBuilder.final();
|
||||||
BLAKE3Result<16> hash4 = HashBuilder.result();
|
BLAKE3Result<16> hash4 = HashBuilder.result();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user