LLVM: llvm::support::endian Namespace Reference (original) (raw)
| Classes | |
|---|---|
| struct | Writer |
| Adapter to write values to a stream in a particular byte order. More... |
| Typedefs | |
|---|---|
| template<typename value_type> | |
| using | make_unsigned_t = std::make_unsigned_t<value_type> |
| Functions | |
|---|---|
| template<typename value_type> | |
| value_type | byte_swap (value_type value, endianness endian) |
| template<typename value_type, endianness endian> | |
| LLVM_DEPRECATED ("Pass endian as a function argument instead", "byte_swap") inline value_type byte_swap(value_type value) | |
| Swap the bytes of value to match the given endianness. | |
| template<typename value_type, std::size_t alignment = unaligned> | |
| value_type | read (const void *memory, endianness endian) |
| Read a value of a particular endianness from memory. | |
| template<typename value_type, endianness endian, std::size_t alignment> | |
| LLVM_DEPRECATED ("Pass endian as a function argument instead", "read") inline value_type read(const void *memory) | |
| template<typename value_type, std::size_t alignment = unaligned, typename CharT> | |
| value_type | readNext (const CharT *&memory, endianness endian) |
| Read a value of a particular endianness from a buffer, and increment the buffer past that value. | |
| template<typename value_type, endianness endian, std::size_t alignment = unaligned, typename CharT> | |
| value_type | readNext (const CharT *&memory) |
| template<typename value_type, std::size_t alignment = unaligned> | |
| void | write (void *memory, value_type value, endianness endian) |
| Write a value to memory with a particular endianness. | |
| template<typename value_type, endianness endian, std::size_t alignment> | |
| void | write (void *memory, value_type value) |
| template<typename value_type, std::size_t alignment = unaligned, typename CharT> | |
| void | writeNext (CharT *&memory, value_type value, endianness endian) |
| Write a value of a particular endianness, and increment the buffer past that value. | |
| template<typename value_type, endianness endian, std::size_t alignment = unaligned, typename CharT> | |
| void | writeNext (CharT *&memory, value_type value) |
| template<typename value_type, endianness endian, std::size_t alignment> | |
| value_type | readAtBitAlignment (const void *memory, uint64_t startBit) |
| Read a value of a particular endianness from memory, for a location that starts at the given bit offset within the first byte. | |
| template<typename value_type, endianness endian, std::size_t alignment> | |
| void | writeAtBitAlignment (void *memory, value_type value, uint64_t startBit) |
| Write a value to memory with a particular endianness, for a location that starts at the given bit offset within the first byte. | |
| template<typename T, endianness E> | |
| T | read (const void *P) |
| uint16_t | read16 (const void *P, endianness E) |
| uint32_t | read32 (const void *P, endianness E) |
| uint64_t | read64 (const void *P, endianness E) |
| template<endianness E> | |
| uint16_t | read16 (const void *P) |
| template<endianness E> | |
| uint32_t | read32 (const void *P) |
| template<endianness E> | |
| uint64_t | read64 (const void *P) |
| uint16_t | read16le (const void *P) |
| uint32_t | read32le (const void *P) |
| uint64_t | read64le (const void *P) |
| uint16_t | read16be (const void *P) |
| uint32_t | read32be (const void *P) |
| uint64_t | read64be (const void *P) |
| template<typename T, endianness E> | |
| void | write (void *P, T V) |
| void | write16 (void *P, uint16_t V, endianness E) |
| void | write32 (void *P, uint32_t V, endianness E) |
| void | write64 (void *P, uint64_t V, endianness E) |
| template<endianness E> | |
| void | write16 (void *P, uint16_t V) |
| template<endianness E> | |
| void | write32 (void *P, uint32_t V) |
| template<endianness E> | |
| void | write64 (void *P, uint64_t V) |
| void | write16le (void *P, uint16_t V) |
| void | write32le (void *P, uint32_t V) |
| void | write64le (void *P, uint64_t V) |
| void | write16be (void *P, uint16_t V) |
| void | write32be (void *P, uint32_t V) |
| void | write64be (void *P, uint64_t V) |
| template<typename value_type> | |
| void | write_array (raw_ostream &os, ArrayRef< value_type > values, endianness endian) |
| template<typename value_type> | |
| void | write (raw_ostream &os, value_type value, endianness endian) |
| template<> | |
| void | write< float > (raw_ostream &os, float value, endianness endian) |
| template<> | |
| void | write< double > (raw_ostream &os, double value, endianness endian) |
| template<typename value_type> | |
| void | write (raw_ostream &os, ArrayRef< value_type > vals, endianness endian) |
| template<typename value_type> | |
| void | write (SmallVectorImpl< char > &Out, value_type V, endianness E) |
◆ make_unsigned_t
template<typename value_type>
using llvm::support::endian::make_unsigned_t = std::make_unsigned_t<value_type>
◆ byte_swap()
template<typename value_type>
| value_type llvm::support::endian::byte_swap ( value_type value, endianness endian ) | inlinenodiscard |
|---|
Definition at line 44 of file Endian.h.
References llvm::native, and llvm::sys::swapByteOrder().
Referenced by llvm::HashBuilder< hashbuilder_detail::HashCodeHasher, llvm::endianness::native >::adjustForEndiannessAndAdd(), llvm::coverage::BinaryCoverageReader::create(), llvm::MCStreamer::emitIntValue(), llvm::gsym::FileWriter::fixup32(), llvm::coverage::accessors::getDataSize(), llvm::coverage::accessors::getFuncHash(), llvm::coverage::accessors::getFuncNameRef(), LLVM_DEPRECATED(), loadTestingFormat(), llvm::CGDataOStream::patch(), llvm::ProfOStream::patch(), read(), readAtBitAlignment(), rewriteOffsetToCurrentByte(), llvm::M68k::swapWord(), llvm::coverage::TestingFormatWriter::write(), write(), write(), write(), write_array(), writeAtBitAlignment(), llvm::gsym::FileWriter::writeU16(), llvm::gsym::FileWriter::writeU32(), and llvm::gsym::FileWriter::writeU64().
◆ LLVM_DEPRECATED() [1/2]
template<typename value_type, endianness endian>
| llvm::support::endian::LLVM_DEPRECATED ( "Pass endian as a function argument instead" , "byte_swap" ) | nodiscard |
|---|
◆ LLVM_DEPRECATED() [2/2]
template<typename value_type, endianness endian, std::size_t alignment>
| llvm::support::endian::LLVM_DEPRECATED ( "Pass endian as a function argument instead" , "read" ) const | nodiscard |
|---|
◆ read() [1/2]
template<typename value_type, std::size_t alignment = unaligned>
| value_type llvm::support::endian::read ( const void * memory, endianness endian ) | inlinenodiscard |
|---|
Read a value of a particular endianness from memory.
Definition at line 60 of file Endian.h.
References byte_swap(), LLVM_ASSUME_ALIGNED, and llvm::support::detail::PickAlignment< T, alignment >::value.
Referenced by consume(), llvm::sys::fs::copy_file_internal(), llvm::memprof::MemProfSummary::deserialize(), eat12Bytes(), eat16Bytes(), eatBytes(), llvm::SimpleBitstreamCursor::fillCurWord(), llvm::object::Record::get(), llvm::IndexedInstrProfReader::getFunctionBitmap(), llvm::object::DirectX::RootSignature::getParameter(), llvm::IndexedCodeGenDataReader::hasFormat(), llvm::IndexedInstrProfReader::hasFormat(), llvm::MD5::MD5Result::high(), instructionsMatch(), LLVM_DEPRECATED(), llvm::MD5::MD5Result::low(), llvm::sys::fs::md5_contents(), llvm::support::detail::packed_endian_specific_integral< ValueType, Endian, Alignment, ALIGN >::ref::operator value_type(), llvm::memprof::CallerCalleePairExtractor::operator()(), llvm::memprof::LinearCallStackIdConverter::operator()(), llvm::object::DirectX::RootSignature::parse(), parseImmediate(), parseStrTabSize(), parseVersion(), llvm::msgpack::Reader::read(), llvm::object::DirectX::DescriptorTableView::read(), read16(), read16(), read32(), read32(), read64(), read64(), readAtBitAlignment(), readInstruction32(), llvm::BinaryStreamReader::readInteger(), llvm::sampleprof::SampleProfileReaderExtBinaryBase::readNameTableSec(), readNext(), and llvm::support::detail::packed_endian_specific_integral< T, E, support::unaligned >::value().
◆ read() [2/2]
| T llvm::support::endian::read ( const void * P) | inlinenodiscard |
|---|
◆ read16() [1/2]
| uint16_t llvm::support::endian::read16 ( const void * P) | inlinenodiscard |
|---|
◆ read16() [2/2]
◆ read16be()
| uint16_t llvm::support::endian::read16be ( const void * P) | inlinenodiscard |
|---|
◆ read16le()
| uint16_t llvm::support::endian::read16le ( const void * P) | inlinenodiscard |
|---|
◆ read32() [1/2]
| uint32_t llvm::support::endian::read32 ( const void * P) | inlinenodiscard |
|---|
◆ read32() [2/2]
Definition at line 412 of file Endian.h.
References E(), P, and read().
Referenced by llvm::jitlink::ppc64::applyFixup(), llvm::dwarf_linker::parallel::SectionDescriptor::getIntVal(), read32be(), read32le(), llvm::jitlink::aarch32::readAddendData(), llvm::jitlink::CompactUnwindTraits< CRTPImpl, PtrSize >::readEncoding(), llvm::jitlink::CompactUnwindTraits< CRTPImpl, PtrSize >::readPCRangeSize(), and verifyNoteSection().
◆ read32be()
| uint32_t llvm::support::endian::read32be ( const void * P) | inlinenodiscard |
|---|
◆ read32le()
| uint32_t llvm::support::endian::read32le ( const void * P) | inlinenodiscard |
|---|
Definition at line 432 of file Endian.h.
Referenced by analyzeHeader(), llvm::jitlink::loongarch::applyFixup(), llvm::jitlink::aarch32::applyFixupData(), discoverTypeIndices(), llvm::object::Archive::ec_symbols(), llvm::AMDGPUAsmPrinter::emitInstruction(), llvm::X86_MC::findX86_64PltEntries(), llvm::X86_MC::findX86PltEntries(), llvm::object::Archive::Symbol::getMember(), llvm::object::Archive::Symbol::getNext(), llvm::object::Archive::getNumberOfECSymbols(), llvm::object::Archive::getNumberOfSymbols(), handlePointer(), llvm::identify_magic(), llvm::or32le(), or32le(), llvm::RuntimeDyldCOFFAArch64::processRelocationRef(), readUint32(), llvm::jitlink::relaxCall(), llvm::RuntimeDyldCOFFAArch64::resolveRelocation(), llvm::SkipBitcodeWrapperHeader(), llvm::object::Archive::symbol_begin(), llvm::write32AArch64Addr(), write32AArch64Addr(), llvm::write32AArch64Imm(), llvm::write32AArch64Ldr(), XXH3_len_1to3_128b(), XXH3_len_1to3_64b(), XXH3_len_4to8_128b(), XXH3_len_4to8_64b(), and llvm::xxHash64().
◆ read64() [1/2]
| uint64_t llvm::support::endian::read64 ( const void * P) | inlinenodiscard |
|---|
◆ read64() [2/2]
◆ read64be()
| uint64_t llvm::support::endian::read64be ( const void * P) | inlinenodiscard |
|---|
◆ read64le()
| uint64_t llvm::support::endian::read64le ( const void * P) | inlinenodiscard |
|---|
Definition at line 435 of file Endian.h.
Referenced by llvm::jitlink::loongarch::applyFixup(), ComputeHash(), llvm::object::Archive::Symbol::getMember(), llvm::object::Archive::getNumberOfSymbols(), llvm::cas::ondisk::UnifiedOnDiskCache::getObjectIDFromValue(), llvm::getStableSipHash(), llvm::RuntimeDyldCOFFAArch64::processRelocationRef(), llvm::sampleprof::SampleProfileReaderBinary::readSampleContextFromTable(), llvm::object::Archive::symbol_begin(), XXH128_mix32B(), XXH3_accumulate_512_scalar(), XXH3_len_0to16_128b(), XXH3_len_0to16_64b(), XXH3_len_4to8_128b(), XXH3_len_4to8_64b(), XXH3_len_9to16_128b(), XXH3_len_9to16_64b(), XXH3_mix16B(), XXH3_mix2Accs(), XXH3_scrambleAcc_scalar(), and llvm::xxHash64().
◆ readAtBitAlignment()
template<typename value_type, endianness endian, std::size_t alignment>
| value_type llvm::support::endian::readAtBitAlignment ( const void * memory, uint64_t startBit ) | inlinenodiscard |
|---|
◆ readNext() [1/2]
template<typename value_type, endianness endian, std::size_t alignment = unaligned, typename CharT>
| value_type llvm::support::endian::readNext ( const CharT *& memory) | inlinenodiscard |
|---|
◆ readNext() [2/2]
template<typename value_type, std::size_t alignment = unaligned, typename CharT>
| value_type llvm::support::endian::readNext ( const CharT *& memory, endianness endian ) | inlinenodiscard |
|---|
Read a value of a particular endianness from a buffer, and increment the buffer past that value.
Definition at line 81 of file Endian.h.
References read().
Referenced by llvm::IndexedMemProfReader::deserialize(), llvm::memprof::DataAccessProfData::deserialize(), llvm::memprof::Frame::deserialize(), llvm::memprof::MemProfSummary::deserialize(), llvm::OutlinedHashTreeRecord::deserialize(), llvm::StableFunctionMapRecord::deserializeEntry(), llvm::memprof::deserializeV2(), llvm::memprof::deserializeV3(), llvm::memprof::deserializeV4(), llvm::OnDiskChainedHashTable< Info >::find_hashed(), llvm::memprof::CallerCalleePairExtractor::operator()(), llvm::memprof::LinearCallStackIdConverter::operator()(), readBinaryIdsInternal(), llvm::InstrProfLookupTrait::ReadData(), llvm::memprof::CallStackLookupTrait::ReadData(), llvm::IndexedCGData::Header::readFromBuffer(), llvm::IndexedInstrProf::Header::readFromBuffer(), llvm::IndexedInstrProfReader::readHeader(), llvm::memprof::CallStackLookupTrait::ReadKey(), llvm::memprof::FrameLookupTrait::ReadKey(), llvm::memprof::RecordLookupTrait::ReadKey(), llvm::InstrProfLookupTrait::ReadKeyDataLength(), llvm::memprof::CallStackLookupTrait::ReadKeyDataLength(), llvm::memprof::FrameLookupTrait::ReadKeyDataLength(), llvm::memprof::RecordLookupTrait::ReadKeyDataLength(), llvm::memprof::readMemProfSchema(), readNext(), llvm::OnDiskChainedHashTable< Info >::readNumBucketsAndEntries(), and llvm::sampleprof::SampleProfileReaderBinary::readUnencodedNumber().
◆ write() [1/6]
template<typename value_type>
◆ write() [2/6]
template<typename value_type>
◆ write() [3/6]
template<typename value_type>
◆ write() [4/6]
template<typename value_type, endianness endian, std::size_t alignment>
| void llvm::support::endian::write ( void * memory, value_type value ) | inline |
|---|
◆ write() [5/6]
template<typename value_type, std::size_t alignment = unaligned>
| void llvm::support::endian::write ( void * memory, value_type value, endianness endian ) | inline |
|---|
Write a value to memory with a particular endianness.
Definition at line 96 of file Endian.h.
References byte_swap(), LLVM_ASSUME_ALIGNED, and llvm::support::detail::PickAlignment< T, alignment >::value.
Referenced by llvm::dwarf_linker::parallel::SectionDescriptor::applyIntVal(), emitOperand(), llvm::MCDwarfFrameEmitter::encodeAdvanceLoc(), llvm::MCSFrameEmitter::encodeFuncOffset(), llvm::MipsMCCodeEmitter::encodeInstruction(), llvm::MSP430MCCodeEmitter::encodeInstruction(), llvm::PPCMCCodeEmitter::encodeInstruction(), llvm::HexagonMCCodeEmitter::encodeSingleInstruction(), llvm::MCContext::getELFSection(), operator<<(), llvm::support::detail::packed_endian_specific_integral< ValueType, Endian, Alignment, ALIGN >::ref::operator=(), llvm::support::detail::packed_endian_specific_integral< T, E, support::unaligned >::operator=(), print(), printLE(), llvm::LoongArchAsmBackend::relaxDwarfCFA(), llvm::RISCVAsmBackend::relaxDwarfCFA(), llvm::LoongArchAsmBackend::relaxDwarfLineAddr(), llvm::RISCVAsmBackend::relaxDwarfLineAddr(), llvm::mcdxbc::PSVRuntimeInfo::write(), llvm::mcdxbc::RootSignatureDesc::write(), write(), write(), llvm::support::endian::Writer::write(), llvm::support::endian::Writer::write(), write16(), write16(), write32(), write32(), write64(), write64(), write< double >(), write< float >(), writeAtBitAlignment(), writeData(), writeFragment(), llvm::RuntimeDyldImpl::writeInt16BE(), llvm::RuntimeDyldImpl::writeInt32BE(), llvm::RuntimeDyldImpl::writeInt64BE(), llvm::BinaryStreamWriter::writeInteger(), writeNext(), llvm::ARMAsmBackend::writeNopData(), llvm::MachObjectWriter::writeObject(), llvm::WinCOFFWriter::writeObject(), and writePlaceholder().
◆ write() [6/6]
| void llvm::support::endian::write ( void * P, T V ) | inline |
|---|
◆ write16() [1/2]
| void llvm::support::endian::write16 ( void * P, uint16_t V ) | inline |
|---|
◆ write16() [2/2]
◆ write16be()
| void llvm::support::endian::write16be ( void * P, uint16_t V ) | inline |
|---|
◆ write16le()
| void llvm::support::endian::write16le ( void * P, uint16_t V ) | inline |
|---|
◆ write32() [1/2]
| void llvm::support::endian::write32 ( void * P, uint32_t V ) | inline |
|---|
◆ write32() [2/2]
◆ write32be()
| void llvm::support::endian::write32be ( void * P, uint32_t V ) | inline |
|---|
◆ write32le()
| void llvm::support::endian::write32le ( void * P, uint32_t V ) | inline |
|---|
Definition at line 475 of file Endian.h.
Referenced by llvm::jitlink::aarch32::applyFixupData(), ComputeHash(), llvm::computeLTOCacheKey(), llvm::objcopy::coff::createGnuDebugLinkSectionContents(), llvm::MD5::final(), llvm::jitlink::finalizeBlockRelax(), getSourceLineHash(), or32le(), llvm::objcopy::wasm::Writer::write(), llvm::StringTableBuilder::write(), write32AArch64Addr(), writeInt32ToBuffer(), llvm::object::writeStringTable(), and writeUint32().
◆ write64() [1/2]
| void llvm::support::endian::write64 ( void * P, uint64_t V ) | inline |
|---|
◆ write64() [2/2]
◆ write64be()
| void llvm::support::endian::write64be ( void * P, uint64_t V ) | inline |
|---|
◆ write64le()
| void llvm::support::endian::write64le ( void * P, uint64_t V ) | inline |
|---|
◆ write< double >()
◆ write< float >()
◆ write_array()
template<typename value_type>
◆ writeAtBitAlignment()
template<typename value_type, endianness endian, std::size_t alignment>
| void llvm::support::endian::writeAtBitAlignment ( void * memory, value_type value, uint64_t startBit ) | inline |
|---|
◆ writeNext() [1/2]
template<typename value_type, endianness endian, std::size_t alignment = unaligned, typename CharT>
| void llvm::support::endian::writeNext ( CharT *& memory, value_type value ) | inline |
|---|
◆ writeNext() [2/2]
template<typename value_type, std::size_t alignment = unaligned, typename CharT>
| void llvm::support::endian::writeNext ( CharT *& memory, value_type value, endianness endian ) | inline |
|---|
Write a value of a particular endianness, and increment the buffer past that value.
Definition at line 113 of file Endian.h.
References write().
Referenced by writeNext().