Skip to content

Commit

Permalink
Use llvm::endianness (NFC)
Browse files Browse the repository at this point in the history
Now that llvm::support::endianness has been renamed to
llvm::endianness, we can use the shorter form.  This patch replaces
support::endianness with llvm::endianness.
  • Loading branch information
kazutakahirata committed Oct 11, 2023
1 parent d95a6c9 commit a9d5056
Show file tree
Hide file tree
Showing 57 changed files with 158 additions and 167 deletions.
6 changes: 3 additions & 3 deletions lldb/unittests/tools/lldb-server/tests/MessageObjects.cpp
Expand Up @@ -53,7 +53,7 @@ Expected<ProcessInfo> ProcessInfo::create(StringRef response) {

lldb::pid_t ProcessInfo::GetPid() const { return m_pid; }

support::endianness ProcessInfo::GetEndian() const { return m_endian; }
llvm::endianness ProcessInfo::GetEndian() const { return m_endian; }

//====== ThreadInfo ============================================================
ThreadInfo::ThreadInfo(StringRef name, StringRef reason, RegisterMap registers,
Expand Down Expand Up @@ -237,7 +237,7 @@ StopReply::create(StringRef Response, llvm::endianness Endian,

Expected<RegisterMap> StopReplyStop::parseRegisters(
const StringMap<SmallVector<StringRef, 2>> &Elements,
support::endianness Endian, ArrayRef<lldb_private::RegisterInfo> RegInfos) {
llvm::endianness Endian, ArrayRef<lldb_private::RegisterInfo> RegInfos) {

RegisterMap Result;
for (const auto &E : Elements) {
Expand All @@ -263,7 +263,7 @@ Expected<RegisterMap> StopReplyStop::parseRegisters(
}

Expected<std::unique_ptr<StopReplyStop>>
StopReplyStop::create(StringRef Response, support::endianness Endian,
StopReplyStop::create(StringRef Response, llvm::endianness Endian,
ArrayRef<RegisterInfo> RegInfos) {
unsigned int Signal;
StringRef SignalStr = Response.take_front(2);
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/BinaryFormat/MsgPack.h
Expand Up @@ -21,7 +21,7 @@ namespace llvm {
namespace msgpack {

/// The endianness of all multi-byte encoded values in MessagePack.
constexpr support::endianness Endianness = support::big;
constexpr llvm::endianness Endianness = support::big;

/// The first byte identifiers of MessagePack object formats.
namespace FirstByte {
Expand Down
8 changes: 2 additions & 6 deletions llvm/include/llvm/DebugInfo/MSF/MappedBlockStream.h
Expand Up @@ -54,9 +54,7 @@ class MappedBlockStream : public BinaryStream {
createDirectoryStream(const MSFLayout &Layout, BinaryStreamRef MsfData,
BumpPtrAllocator &Allocator);

support::endianness getEndian() const override {
return support::little;
}
llvm::endianness getEndian() const override { return support::little; }

Error readBytes(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) override;
Expand Down Expand Up @@ -121,9 +119,7 @@ class WritableMappedBlockStream : public WritableBinaryStream {
createFpmStream(const MSFLayout &Layout, WritableBinaryStreamRef MsfData,
BumpPtrAllocator &Allocator, bool AltFpm = false);

support::endianness getEndian() const override {
return support::little;
}
llvm::endianness getEndian() const override { return support::little; }

Error readBytes(uint64_t Offset, uint64_t Size,
ArrayRef<uint8_t> &Buffer) override;
Expand Down
8 changes: 4 additions & 4 deletions llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
Expand Up @@ -995,14 +995,14 @@ class LinkGraph {
using GetEdgeKindNameFunction = const char *(*)(Edge::Kind);

LinkGraph(std::string Name, const Triple &TT, SubtargetFeatures Features,
unsigned PointerSize, support::endianness Endianness,
unsigned PointerSize, llvm::endianness Endianness,
GetEdgeKindNameFunction GetEdgeKindName)
: Name(std::move(Name)), TT(TT), Features(std::move(Features)),
PointerSize(PointerSize), Endianness(Endianness),
GetEdgeKindName(std::move(GetEdgeKindName)) {}

LinkGraph(std::string Name, const Triple &TT, unsigned PointerSize,
support::endianness Endianness,
llvm::endianness Endianness,
GetEdgeKindNameFunction GetEdgeKindName)
: LinkGraph(std::move(Name), TT, SubtargetFeatures(), PointerSize,
Endianness, GetEdgeKindName) {}
Expand All @@ -1026,7 +1026,7 @@ class LinkGraph {
unsigned getPointerSize() const { return PointerSize; }

/// Returns the endianness of content in this graph.
support::endianness getEndianness() const { return Endianness; }
llvm::endianness getEndianness() const { return Endianness; }

const char *getEdgeKindName(Edge::Kind K) const { return GetEdgeKindName(K); }

Expand Down Expand Up @@ -1530,7 +1530,7 @@ class LinkGraph {
Triple TT;
SubtargetFeatures Features;
unsigned PointerSize;
support::endianness Endianness;
llvm::endianness Endianness;
GetEdgeKindNameFunction GetEdgeKindName = nullptr;
DenseMap<StringRef, std::unique_ptr<Section>> Sections;
ExternalSymbolMap ExternalSymbols;
Expand Down
16 changes: 8 additions & 8 deletions llvm/include/llvm/ExecutionEngine/JITLink/ppc64.h
Expand Up @@ -88,7 +88,7 @@ struct PLTCallStubInfo {
SmallVector<PLTCallStubReloc, 2> Relocs;
};

template <support::endianness Endianness>
template <llvm::endianness Endianness>
inline PLTCallStubInfo pickStub(PLTCallStubKind StubKind) {
constexpr bool isLE = Endianness == llvm::endianness::little;
switch (StubKind) {
Expand Down Expand Up @@ -139,7 +139,7 @@ inline Symbol &createAnonymousPointer(LinkGraph &G, Section &PointerSection,
return G.addAnonymousSymbol(B, 0, G.getPointerSize(), false, false);
}

template <support::endianness Endianness>
template <llvm::endianness Endianness>
inline Symbol &createAnonymousPointerJumpStub(LinkGraph &G,
Section &StubSection,
Symbol &PointerSymbol,
Expand All @@ -152,7 +152,7 @@ inline Symbol &createAnonymousPointerJumpStub(LinkGraph &G,
return G.addAnonymousSymbol(B, 0, StubInfo.Content.size(), true, false);
}

template <support::endianness Endianness>
template <llvm::endianness Endianness>
class TOCTableManager : public TableManager<TOCTableManager<Endianness>> {
public:
// FIXME: `llvm-jitlink -check` relies this name to be $__GOT.
Expand Down Expand Up @@ -190,7 +190,7 @@ class TOCTableManager : public TableManager<TOCTableManager<Endianness>> {
Section *TOCSection = nullptr;
};

template <support::endianness Endianness>
template <llvm::endianness Endianness>
class PLTTableManager : public TableManager<PLTTableManager<Endianness>> {
public:
PLTTableManager(TOCTableManager<Endianness> &TOC) : TOC(TOC) {}
Expand Down Expand Up @@ -271,21 +271,21 @@ inline static uint16_t highesta(uint64_t x) { return (x + 0x8000) >> 48; }
// the most significant 32 bits belong to the prefix word. The prefix word is at
// low address for both big/little endian. Byte order in each word still follows
// its endian.
template <support::endianness Endianness>
template <llvm::endianness Endianness>
inline static uint64_t readPrefixedInstruction(const char *Loc) {
constexpr bool isLE = Endianness == llvm::endianness::little;
uint64_t Inst = support::endian::read64<Endianness>(Loc);
return isLE ? (Inst << 32) | (Inst >> 32) : Inst;
}

template <support::endianness Endianness>
template <llvm::endianness Endianness>
inline static void writePrefixedInstruction(char *Loc, uint64_t Inst) {
constexpr bool isLE = Endianness == llvm::endianness::little;
Inst = isLE ? (Inst << 32) | (Inst >> 32) : Inst;
support::endian::write64<Endianness>(Loc, Inst);
}

template <support::endianness Endianness>
template <llvm::endianness Endianness>
inline Error relocateHalf16(char *FixupPtr, int64_t Value, Edge::Kind K) {
switch (K) {
case Delta16:
Expand Down Expand Up @@ -343,7 +343,7 @@ inline Error relocateHalf16(char *FixupPtr, int64_t Value, Edge::Kind K) {
}

/// Apply fixup expression for edge to block content.
template <support::endianness Endianness>
template <llvm::endianness Endianness>
inline Error applyFixup(LinkGraph &G, Block &B, const Edge &E,
const Symbol *TOCSymbol) {
char *BlockWorkingMem = B.getAlreadyMutableContent().data();
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h
Expand Up @@ -343,7 +343,7 @@ class DLLImportDefinitionGenerator : public DefinitionGenerator {
: ES(ES), L(L) {}

static Expected<unsigned> getTargetPointerSize(const Triple &TT);
static Expected<support::endianness> getTargetEndianness(const Triple &TT);
static Expected<llvm::endianness> getTargetEndianness(const Triple &TT);
Expected<std::unique_ptr<jitlink::LinkGraph>>
createStubsGraph(const SymbolMap &Resolved);

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ExecutionEngine/Orc/MachOBuilder.h
Expand Up @@ -507,7 +507,7 @@ struct MachO64LE {
using NList = MachO::nlist_64;
using Relocation = MachO::relocation_info;

static constexpr support::endianness Endianness = support::little;
static constexpr llvm::endianness Endianness = support::little;
static constexpr uint32_t Magic = MachO::MH_MAGIC_64;
static constexpr MachO::LoadCommandType SegmentCmd = MachO::LC_SEGMENT_64;
static constexpr MachO::LoadCommandType SymTabCmd = MachO::LC_SYMTAB;
Expand Down
6 changes: 3 additions & 3 deletions llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h
Expand Up @@ -163,9 +163,9 @@ class RuntimeDyldChecker {
GetSymbolInfoFunction GetSymbolInfo,
GetSectionInfoFunction GetSectionInfo,
GetStubInfoFunction GetStubInfo,
GetGOTInfoFunction GetGOTInfo,
support::endianness Endianness, Triple TT, StringRef CPU,
SubtargetFeatures TF, raw_ostream &ErrStream);
GetGOTInfoFunction GetGOTInfo, llvm::endianness Endianness,
Triple TT, StringRef CPU, SubtargetFeatures TF,
raw_ostream &ErrStream);
~RuntimeDyldChecker();

/// Check a single expression against the attached RuntimeDyld
Expand Down
5 changes: 2 additions & 3 deletions llvm/include/llvm/MC/MCAsmBackend.h
Expand Up @@ -41,15 +41,14 @@ class raw_ostream;
/// Generic interface to target specific assembler backends.
class MCAsmBackend {
protected: // Can only create subclasses.
MCAsmBackend(support::endianness Endian,
unsigned RelaxFixupKind = MaxFixupKind);
MCAsmBackend(llvm::endianness Endian, unsigned RelaxFixupKind = MaxFixupKind);

public:
MCAsmBackend(const MCAsmBackend &) = delete;
MCAsmBackend &operator=(const MCAsmBackend &) = delete;
virtual ~MCAsmBackend();

const support::endianness Endian;
const llvm::endianness Endian;

/// Fixup kind used for linker relaxation. Currently only used by RISC-V.
const unsigned RelaxFixupKind;
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/Object/ELFTypes.h
Expand Up @@ -740,15 +740,15 @@ template <class ELFT> struct Elf_CGProfile_Impl {
template <class ELFT>
struct Elf_Mips_RegInfo;

template <support::endianness TargetEndianness>
template <llvm::endianness TargetEndianness>
struct Elf_Mips_RegInfo<ELFType<TargetEndianness, false>> {
LLVM_ELF_IMPORT_TYPES(TargetEndianness, false)
Elf_Word ri_gprmask; // bit-mask of used general registers
Elf_Word ri_cprmask[4]; // bit-mask of used co-processor registers
Elf_Addr ri_gp_value; // gp register value
};

template <support::endianness TargetEndianness>
template <llvm::endianness TargetEndianness>
struct Elf_Mips_RegInfo<ELFType<TargetEndianness, true>> {
LLVM_ELF_IMPORT_TYPES(TargetEndianness, true)
Elf_Word ri_gprmask; // bit-mask of used general registers
Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/Object/StackMapParser.h
Expand Up @@ -21,8 +21,7 @@
namespace llvm {

/// A parser for the latest stackmap format. At the moment, latest=V3.
template <support::endianness Endianness>
class StackMapParser {
template <llvm::endianness Endianness> class StackMapParser {
public:
template <typename AccessorT>
class AccessorIterator {
Expand Down

0 comments on commit a9d5056

Please sign in to comment.