Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
llvm::support::endian Namespace Reference

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>
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>
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)

Typedef Documentation

◆ make_unsigned_t

template<typename value_type>
using llvm::support::endian::make_unsigned_t = std::make_unsigned_t<value_type>

Definition at line 121 of file Endian.h.

Function Documentation

◆ byte_swap() [1/2]

template<typename value_type, endianness endian>
value_type llvm::support::endian::byte_swap ( value_type value)
inlinenodiscard

Swap the bytes of value to match the given endianness.

Definition at line 52 of file Endian.h.

References byte_swap().

◆ byte_swap() [2/2]

◆ read() [1/3]

template<typename value_type, endianness endian, std::size_t alignment>
value_type llvm::support::endian::read ( const void * memory)
inlinenodiscard

Definition at line 69 of file Endian.h.

References read().

◆ read() [2/3]

template<typename value_type, std::size_t alignment = unaligned>
value_type llvm::support::endian::read ( const void * memory,
endianness endian )
inlinenodiscard

◆ read() [3/3]

template<typename T, endianness E>
T llvm::support::endian::read ( const void * P)
inlinenodiscard

Definition at line 401 of file Endian.h.

References P, and T.

◆ read16() [1/2]

template<endianness E>
uint16_t llvm::support::endian::read16 ( const void * P)
inlinenodiscard

Definition at line 415 of file Endian.h.

References P, and read().

◆ read16() [2/2]

uint16_t llvm::support::endian::read16 ( const void * P,
endianness E )
inlinenodiscard

◆ read16be()

uint16_t llvm::support::endian::read16be ( const void * P)
inlinenodiscard

Definition at line 434 of file Endian.h.

References P, and read16().

Referenced by M68kDisassembler::getInstruction().

◆ read16le()

◆ read32() [1/2]

template<endianness E>
uint32_t llvm::support::endian::read32 ( const void * P)
inlinenodiscard

Definition at line 418 of file Endian.h.

References P, and read().

◆ read32() [2/2]

◆ read32be()

◆ read32le()

◆ read64() [1/2]

template<endianness E>
uint64_t llvm::support::endian::read64 ( const void * P)
inlinenodiscard

Definition at line 421 of file Endian.h.

References P, and read().

◆ read64() [2/2]

uint64_t llvm::support::endian::read64 ( const void * P,
endianness E )
inlinenodiscard

◆ read64be()

uint64_t llvm::support::endian::read64be ( const void * P)
inlinenodiscard

◆ read64le()

◆ readAtBitAlignment()

template<typename value_type, endianness endian, std::size_t alignment>
value_type llvm::support::endian::readAtBitAlignment ( const void * memory,
uint64_t startBit )
inlinenodiscard

Read a value of a particular endianness from memory, for a location that starts at the given bit offset within the first byte.

Definition at line 126 of file Endian.h.

References assert(), byte_swap(), LLVM_ASSUME_ALIGNED, read(), and llvm::support::detail::PickAlignment< T, alignment >::value.

Referenced by llvm::BitstreamWriter::BackpatchByte().

◆ 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

Definition at line 86 of file Endian.h.

References readNext().

◆ 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

◆ write() [1/6]

template<typename value_type>
void llvm::support::endian::write ( raw_ostream & os,
ArrayRef< value_type > vals,
endianness endian )
inline

Definition at line 54 of file EndianStream.h.

References write().

◆ write() [2/6]

template<typename value_type>
void llvm::support::endian::write ( raw_ostream & os,
value_type value,
endianness endian )
inline

Definition at line 37 of file EndianStream.h.

References byte_swap(), and llvm::raw_ostream::write().

◆ write() [3/6]

template<typename value_type>
void llvm::support::endian::write ( SmallVectorImpl< char > & Out,
value_type V,
endianness E )
inline

Definition at line 61 of file EndianStream.h.

References llvm::SmallVectorImpl< T >::append(), byte_swap(), and E().

◆ write() [4/6]

template<typename value_type, endianness endian, std::size_t alignment>
void llvm::support::endian::write ( void * memory,
value_type value )
inline

Definition at line 101 of file Endian.h.

References inline, and write().

◆ 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 92 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]

template<typename T, endianness E>
void llvm::support::endian::write ( void * P,
T V )
inline

Definition at line 444 of file Endian.h.

References P, and T.

◆ write16() [1/2]

template<endianness E>
void llvm::support::endian::write16 ( void * P,
uint16_t V )
inline

Definition at line 458 of file Endian.h.

References P, and write().

◆ write16() [2/2]

void llvm::support::endian::write16 ( void * P,
uint16_t V,
endianness E )
inline

Definition at line 448 of file Endian.h.

References E(), P, and write().

Referenced by llvm::jitlink::ppc64::relocateHalf16(), write16be(), and write16le().

◆ write16be()

void llvm::support::endian::write16be ( void * P,
uint16_t V )
inline

Definition at line 477 of file Endian.h.

References P, and write16().

◆ write16le()

void llvm::support::endian::write16le ( void * P,
uint16_t V )
inline

Definition at line 468 of file Endian.h.

References P, and write16().

Referenced by llvm::add16(), and llvm::jitlink::finalizeBlockRelax().

◆ write32() [1/2]

template<endianness E>
void llvm::support::endian::write32 ( void * P,
uint32_t V )
inline

Definition at line 461 of file Endian.h.

References P, and write().

◆ write32() [2/2]

void llvm::support::endian::write32 ( void * P,
uint32_t V,
endianness E )
inline

◆ write32be()

void llvm::support::endian::write32be ( void * P,
uint32_t V )
inline

Definition at line 480 of file Endian.h.

References P, and write32().

Referenced by llvm::jitlink::aarch32::applyFixupData(), and llvm::StringTableBuilder::write().

◆ write32le()

◆ write64() [1/2]

template<endianness E>
void llvm::support::endian::write64 ( void * P,
uint64_t V )
inline

Definition at line 464 of file Endian.h.

References P, and write().

◆ write64() [2/2]

void llvm::support::endian::write64 ( void * P,
uint64_t V,
endianness E )
inline

◆ write64be()

void llvm::support::endian::write64be ( void * P,
uint64_t V )
inline

Definition at line 483 of file Endian.h.

References P, and write64().

◆ write64le()

◆ write< double >()

template<>
void llvm::support::endian::write< double > ( raw_ostream & os,
double value,
endianness endian )
inline

Definition at line 48 of file EndianStream.h.

References llvm::bit_cast(), and write().

◆ write< float >()

template<>
void llvm::support::endian::write< float > ( raw_ostream & os,
float value,
endianness endian )
inline

Definition at line 43 of file EndianStream.h.

References llvm::bit_cast(), and write().

◆ write_array()

template<typename value_type>
void llvm::support::endian::write_array ( raw_ostream & os,
ArrayRef< value_type > values,
endianness endian )
inline

Definition at line 28 of file EndianStream.h.

References byte_swap(), and llvm::raw_ostream::write().

Referenced by llvm::mcdxbc::PSVRuntimeInfo::write().

◆ 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

Write a value to memory with a particular endianness, for a location that starts at the given bit offset within the first byte.

Definition at line 161 of file Endian.h.

References assert(), byte_swap(), LLVM_ASSUME_ALIGNED, llvm::support::detail::PickAlignment< T, alignment >::value, and write().

Referenced by llvm::BitstreamWriter::BackpatchByte().

◆ 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

Definition at line 116 of file Endian.h.

References writeNext().

◆ 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 109 of file Endian.h.

References write().

Referenced by writeNext().