From fdd9df1952c962fc8e2e14861c095d12f55947dc Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Fri, 31 Mar 2023 18:56:20 -0700 Subject: [PATCH] [ORC] Remove more unnecessary ExecutorAddr::getValue calls. --- llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp | 19 +++++---------- llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp | 28 +++++++--------------- llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp | 17 +++++-------- .../Orc/TargetProcess/SimpleRemoteEPCServer.cpp | 18 +++++++------- 4 files changed, 29 insertions(+), 53 deletions(-) diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp index c08476a..06144bd 100644 --- a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp @@ -562,10 +562,9 @@ void COFFPlatform::rt_pushInitializers(PushInitializersSendResultFn SendResult, }); if (!JD) { - SendResult( - make_error("No JITDylib with header addr " + - formatv("{0:x}", JDHeaderAddr.getValue()), - inconvertibleErrorCode())); + SendResult(make_error("No JITDylib with header addr " + + formatv("{0:x}", JDHeaderAddr), + inconvertibleErrorCode())); return; } @@ -580,10 +579,7 @@ void COFFPlatform::rt_pushInitializers(PushInitializersSendResultFn SendResult, void COFFPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddr Handle, StringRef SymbolName) { - LLVM_DEBUG({ - dbgs() << "COFFPlatform::rt_lookupSymbol(\"" - << formatv("{0:x}", Handle.getValue()) << "\")\n"; - }); + LLVM_DEBUG(dbgs() << "COFFPlatform::rt_lookupSymbol(\"" << Handle << "\")\n"); JITDylib *JD = nullptr; @@ -595,12 +591,9 @@ void COFFPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult, } if (!JD) { - LLVM_DEBUG({ - dbgs() << " No JITDylib for handle " - << formatv("{0:x}", Handle.getValue()) << "\n"; - }); + LLVM_DEBUG(dbgs() << " No JITDylib for handle " << Handle << "\n"); SendResult(make_error("No JITDylib associated with handle " + - formatv("{0:x}", Handle.getValue()), + formatv("{0:x}", Handle), inconvertibleErrorCode())); return; } diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp index ce47c87..7b99616 100644 --- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp @@ -239,8 +239,7 @@ ELFNixPlatform::standardPlatformAliases(ExecutionSession &ES, // Since LLVM libunwind is not present, we assume that unwinding // is provided by libgcc LLVM_DEBUG({ - dbgs() << "Using libgcc __register_frame" - << " for unwind info registration\n"; + dbgs() << "Using libgcc __register_frame for unwind info registration\n"; }); Aliases[std::move(RTRegisterFrame)] = {ES.intern("__register_frame"), JITSymbolFlags::Exported}; @@ -429,8 +428,7 @@ void ELFNixPlatform::rt_getInitializers(SendInitializerSequenceFn SendResult, void ELFNixPlatform::rt_getDeinitializers( SendDeinitializerSequenceFn SendResult, ExecutorAddr Handle) { LLVM_DEBUG({ - dbgs() << "ELFNixPlatform::rt_getDeinitializers(\"" - << formatv("{0:x}", Handle.getValue()) << "\")\n"; + dbgs() << "ELFNixPlatform::rt_getDeinitializers(\"" << Handle << "\")\n"; }); JITDylib *JD = nullptr; @@ -443,12 +441,9 @@ void ELFNixPlatform::rt_getDeinitializers( } if (!JD) { - LLVM_DEBUG({ - dbgs() << " No JITDylib for handle " - << formatv("{0:x}", Handle.getValue()) << "\n"; - }); + LLVM_DEBUG(dbgs() << " No JITDylib for handle " << Handle << "\n"); SendResult(make_error("No JITDylib associated with handle " + - formatv("{0:x}", Handle.getValue()), + formatv("{0:x}", Handle), inconvertibleErrorCode())); return; } @@ -460,8 +455,7 @@ void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddr Handle, StringRef SymbolName) { LLVM_DEBUG({ - dbgs() << "ELFNixPlatform::rt_lookupSymbol(\"" - << formatv("{0:x}", Handle.getValue()) << "\")\n"; + dbgs() << "ELFNixPlatform::rt_lookupSymbol(\"" << Handle << "\")\n"; }); JITDylib *JD = nullptr; @@ -474,12 +468,9 @@ void ELFNixPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult, } if (!JD) { - LLVM_DEBUG({ - dbgs() << " No JITDylib for handle " - << formatv("{0:x}", Handle.getValue()) << "\n"; - }); + LLVM_DEBUG(dbgs() << " No JITDylib for handle " << Handle << "\n"); SendResult(make_error("No JITDylib associated with handle " + - formatv("{0:x}", Handle.getValue()), + formatv("{0:x}", Handle), inconvertibleErrorCode())); return; } @@ -810,7 +801,7 @@ Error ELFNixPlatform::ELFNixPlatformPlugin::registerInitSections( SmallVector InitSections; - LLVM_DEBUG({ dbgs() << "ELFNixPlatform::registerInitSections\n"; }); + LLVM_DEBUG(dbgs() << "ELFNixPlatform::registerInitSections\n"); for (auto &Sec : G.sections()) { if (isELFInitializerSection(Sec.getName())) { @@ -823,8 +814,7 @@ Error ELFNixPlatform::ELFNixPlatformPlugin::registerInitSections( dbgs() << "ELFNixPlatform: Scraped " << G.getName() << " init sections:\n"; for (auto *Sec : InitSections) { jitlink::SectionRange R(*Sec); - dbgs() << " " << Sec->getName() << ": " - << formatv("[ {0:x} -- {1:x} ]", R.getStart(), R.getEnd()) << "\n"; + dbgs() << " " << Sec->getName() << ": " << R.getRange() << "\n"; } }); diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp index bc6194d..4266bbc 100644 --- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp @@ -636,10 +636,9 @@ void MachOPlatform::rt_pushInitializers(PushInitializersSendResultFn SendResult, }); if (!JD) { - SendResult( - make_error("No JITDylib with header addr " + - formatv("{0:x}", JDHeaderAddr.getValue()), - inconvertibleErrorCode())); + SendResult(make_error("No JITDylib with header addr " + + formatv("{0:x}", JDHeaderAddr), + inconvertibleErrorCode())); return; } @@ -649,8 +648,7 @@ void MachOPlatform::rt_pushInitializers(PushInitializersSendResultFn SendResult, void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult, ExecutorAddr Handle, StringRef SymbolName) { LLVM_DEBUG({ - dbgs() << "MachOPlatform::rt_lookupSymbol(\"" - << formatv("{0:x}", Handle.getValue()) << "\")\n"; + dbgs() << "MachOPlatform::rt_lookupSymbol(\"" << Handle << "\")\n"; }); JITDylib *JD = nullptr; @@ -663,12 +661,9 @@ void MachOPlatform::rt_lookupSymbol(SendSymbolAddressFn SendResult, } if (!JD) { - LLVM_DEBUG({ - dbgs() << " No JITDylib for handle " - << formatv("{0:x}", Handle.getValue()) << "\n"; - }); + LLVM_DEBUG(dbgs() << " No JITDylib for handle " << Handle << "\n"); SendResult(make_error("No JITDylib associated with handle " + - formatv("{0:x}", Handle.getValue()), + formatv("{0:x}", Handle), inconvertibleErrorCode())); return; } diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp index 49a8079..230a7c0 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/SimpleRemoteEPCServer.cpp @@ -68,23 +68,22 @@ SimpleRemoteEPCServer::handleMessage(SimpleRemoteEPCOpcode OpC, uint64_t SeqNo, case SimpleRemoteEPCOpcode::Setup: dbgs() << "Setup"; assert(SeqNo == 0 && "Non-zero SeqNo for Setup?"); - assert(TagAddr.getValue() == 0 && "Non-zero TagAddr for Setup?"); + assert(!TagAddr && "Non-zero TagAddr for Setup?"); break; case SimpleRemoteEPCOpcode::Hangup: dbgs() << "Hangup"; assert(SeqNo == 0 && "Non-zero SeqNo for Hangup?"); - assert(TagAddr.getValue() == 0 && "Non-zero TagAddr for Hangup?"); + assert(!TagAddr && "Non-zero TagAddr for Hangup?"); break; case SimpleRemoteEPCOpcode::Result: dbgs() << "Result"; - assert(TagAddr.getValue() == 0 && "Non-zero TagAddr for Result?"); + assert(!TagAddr && "Non-zero TagAddr for Result?"); break; case SimpleRemoteEPCOpcode::CallWrapper: dbgs() << "CallWrapper"; break; } - dbgs() << ", seqno = " << SeqNo - << ", tag-addr = " << formatv("{0:x}", TagAddr.getValue()) + dbgs() << ", seqno = " << SeqNo << ", tag-addr = " << TagAddr << ", arg-buffer = " << formatv("{0:x}", ArgBytes.size()) << " bytes\n"; }); @@ -158,23 +157,22 @@ Error SimpleRemoteEPCServer::sendMessage(SimpleRemoteEPCOpcode OpC, case SimpleRemoteEPCOpcode::Setup: dbgs() << "Setup"; assert(SeqNo == 0 && "Non-zero SeqNo for Setup?"); - assert(TagAddr.getValue() == 0 && "Non-zero TagAddr for Setup?"); + assert(!TagAddr && "Non-zero TagAddr for Setup?"); break; case SimpleRemoteEPCOpcode::Hangup: dbgs() << "Hangup"; assert(SeqNo == 0 && "Non-zero SeqNo for Hangup?"); - assert(TagAddr.getValue() == 0 && "Non-zero TagAddr for Hangup?"); + assert(!TagAddr && "Non-zero TagAddr for Hangup?"); break; case SimpleRemoteEPCOpcode::Result: dbgs() << "Result"; - assert(TagAddr.getValue() == 0 && "Non-zero TagAddr for Result?"); + assert(!TagAddr && "Non-zero TagAddr for Result?"); break; case SimpleRemoteEPCOpcode::CallWrapper: dbgs() << "CallWrapper"; break; } - dbgs() << ", seqno = " << SeqNo - << ", tag-addr = " << formatv("{0:x}", TagAddr.getValue()) + dbgs() << ", seqno = " << SeqNo << ", tag-addr = " << TagAddr << ", arg-buffer = " << formatv("{0:x}", ArgBytes.size()) << " bytes\n"; }); -- 2.7.4