From: Fangrui Song Date: Wed, 14 Dec 2022 10:18:07 +0000 (+0000) Subject: [ExecutionEngine] llvm::Optional => std::optional X-Git-Tag: upstream/17.0.6~23887 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79e3e65b2649073b00df495b76835ee714db7e91;p=platform%2Fupstream%2Fllvm.git [ExecutionEngine] llvm::Optional => std::optional --- diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index a356b81..0f0fa6c 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -15,7 +15,6 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/Triple.h" #include "llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h" @@ -29,6 +28,7 @@ #include "llvm/Support/FormatVariadic.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" +#include #include #include @@ -1071,7 +1071,7 @@ public: } /// Cache type for the splitBlock function. - using SplitBlockCache = Optional>; + using SplitBlockCache = std::optional>; /// Splits block B at the given index which must be greater than zero. /// If SplitIndex == B.getSize() then this function is a no-op and returns B. @@ -1302,9 +1302,10 @@ public: /// given offset) of the size of the new block. /// /// All other symbol attributes are unchanged. - void transferDefinedSymbol(Symbol &Sym, Block &DestBlock, - orc::ExecutorAddrDiff NewOffset, - Optional ExplicitNewSize) { + void + transferDefinedSymbol(Symbol &Sym, Block &DestBlock, + orc::ExecutorAddrDiff NewOffset, + std::optional ExplicitNewSize) { auto &OldSection = Sym.getBlock().getSection(); Sym.setBlock(DestBlock); Sym.setOffset(NewOffset); diff --git a/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h index 6dc561b..79358ab 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/COFFPlatform.h @@ -44,7 +44,7 @@ public: JITDylib &PlatformJD, const char *OrcRuntimePath, LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime = false, const char *VCRuntimePath = nullptr, - Optional RuntimeAliases = std::nullopt); + std::optional RuntimeAliases = std::nullopt); ExecutionSession &getExecutionSession() const { return ES; } ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h index 89bcc6e..0d234e4 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h @@ -15,15 +15,14 @@ #define LLVM_EXECUTIONENGINE_ORC_COMPILEONDEMANDLAYER_H #include "llvm/ADT/APInt.h" -#include "llvm/ADT/Optional.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/ExecutionEngine/Orc/IndirectionUtils.h" #include "llvm/ExecutionEngine/Orc/Layer.h" #include "llvm/ExecutionEngine/Orc/LazyReexports.h" -#include "llvm/ExecutionEngine/Orc/Speculation.h" #include "llvm/ExecutionEngine/Orc/Shared/OrcError.h" +#include "llvm/ExecutionEngine/Orc/Speculation.h" #include "llvm/ExecutionEngine/RuntimeDyld.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/Constant.h" @@ -45,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -64,15 +64,17 @@ public: /// Partitioning function. using PartitionFunction = - std::function(GlobalValueSet Requested)>; + std::function(GlobalValueSet Requested)>; /// Off-the-shelf partitioning which compiles all requested symbols (usually /// a single function at a time). - static Optional compileRequested(GlobalValueSet Requested); + static std::optional + compileRequested(GlobalValueSet Requested); /// Off-the-shelf partitioning which compiles whole modules whenever any /// symbol in them is requested. - static Optional compileWholeModule(GlobalValueSet Requested); + static std::optional + compileWholeModule(GlobalValueSet Requested); /// Construct a CompileOnDemandLayer. CompileOnDemandLayer(ExecutionSession &ES, IRLayer &BaseLayer, diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h index 890c967..3fcacde 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/ELFNixPlatform.h @@ -95,7 +95,7 @@ public: static Expected> Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD, const char *OrcRuntimePath, - Optional RuntimeAliases = std::nullopt); + std::optional RuntimeAliases = std::nullopt); ExecutionSession &getExecutionSession() const { return ES; } ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h index 7ae2d60..8bd7624 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCDebugObjectRegistrar.h @@ -58,7 +58,7 @@ private: /// loaded to find the registration functions. Expected> createJITLoaderGDBRegistrar( ExecutionSession &ES, - Optional RegistrationFunctionDylib = std::nullopt); + std::optional RegistrationFunctionDylib = std::nullopt); } // end namespace orc } // end namespace llvm diff --git a/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h b/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h index 6482241..0494705 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/EPCEHFrameRegistrar.h @@ -34,7 +34,7 @@ public: /// will be loaded to find the registration functions. static Expected> Create(ExecutionSession &ES, - Optional RegistrationFunctionsDylib = std::nullopt); + std::optional RegistrationFunctionsDylib = std::nullopt); /// Create a EPCEHFrameRegistrar with the given ExecutorProcessControl /// object and registration/deregistration function addresses. diff --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h index dc68547..2982a7a 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h @@ -262,8 +262,8 @@ public: std::unique_ptr EPC; std::unique_ptr ES; - Optional JTMB; - Optional DL; + std::optional JTMB; + std::optional DL; ObjectLinkingLayerCreator CreateObjectLinkingLayer; CompileFunctionCreator CreateCompileFunction; PlatformSetupFunction SetUpPlatform; @@ -305,13 +305,13 @@ public: /// Return a reference to the JITTargetMachineBuilder. /// - Optional &getJITTargetMachineBuilder() { + std::optional &getJITTargetMachineBuilder() { return impl().JTMB; } /// Set a DataLayout for this instance. If no data layout is specified then /// the target's default data layout will be used. - SetterImpl &setDataLayout(Optional DL) { + SetterImpl &setDataLayout(std::optional DL) { impl().DL = std::move(DL); return impl(); } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h index cf0517b..6ca47d1 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h @@ -80,7 +80,7 @@ public: static Expected> Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD, const char *OrcRuntimePath, - Optional RuntimeAliases = std::nullopt); + std::optional RuntimeAliases = std::nullopt); ExecutionSession &getExecutionSession() const { return ES; } ObjectLinkingLayer &getObjectLinkingLayer() const { return ObjLinkingLayer; } diff --git a/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h b/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h index 2db6e17..b518d89 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h @@ -31,7 +31,7 @@ protected: bool isStraightLine(const Function &F); public: - using ResultTy = Optional>>; + using ResultTy = std::optional>>; }; // Direct calls in high frequency basic blocks are extracted. diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h index fa29aca..b555669 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Speculation.h @@ -44,7 +44,7 @@ public: private: // FIX ME: find a right way to distinguish the pre-compile Symbols, and update // the callsite - Optional getImplFor(const SymbolStringPtr &StubSymbol) { + std::optional getImplFor(const SymbolStringPtr &StubSymbol) { std::lock_guard Lockit(ConcurrentAccess); auto Position = Maps.find(StubSymbol); if (Position != Maps.end()) @@ -171,7 +171,8 @@ private: class IRSpeculationLayer : public IRLayer { public: - using IRlikiesStrRef = Optional>>; + using IRlikiesStrRef = + std::optional>>; using ResultEval = std::function; using TargetAndLikelies = DenseMap; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h index cb86798..7ef09fd 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h @@ -30,7 +30,7 @@ namespace orc { /// many main functions will expect a name argument at least, and will fail /// if none is provided. int runAsMain(int (*Main)(int, char *[]), ArrayRef Args, - Optional ProgramName = std::nullopt); + std::optional ProgramName = std::nullopt); int runAsVoidFunction(int (*Func)(void)); int runAsIntFunction(int (*Func)(int), int Arg); diff --git a/llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h b/llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h index 37fe44d..f094c02 100644 --- a/llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h +++ b/llvm/include/llvm/ExecutionEngine/RuntimeDyldChecker.h @@ -10,9 +10,9 @@ #define LLVM_EXECUTIONENGINE_RUNTIMEDYLDCHECKER_H #include "llvm/ADT/DenseMap.h" -#include "llvm/ADT/Optional.h" #include "llvm/ExecutionEngine/JITSymbol.h" #include "llvm/Support/Endian.h" +#include #include #include @@ -173,7 +173,7 @@ public: /// If there is a section at the given local address, return its load /// address, otherwise return none. - Optional getSectionLoadAddress(void *LocalAddress) const; + std::optional getSectionLoadAddress(void *LocalAddress) const; private: std::unique_ptr Impl; diff --git a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h index 58c8341..0c0a1a5 100644 --- a/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h +++ b/llvm/lib/ExecutionEngine/JITLink/COFFLinkGraphBuilder.h @@ -115,7 +115,7 @@ private: jitlink::Linkage Linkage; orc::ExecutorAddrDiff Size; }; - std::vector> PendingComdatExports; + std::vector> PendingComdatExports; // This represents a pending request to create a weak external symbol with a // name. diff --git a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h index 7cbc9f3..ba6cfaf 100644 --- a/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h +++ b/llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h @@ -37,8 +37,9 @@ protected: friend class MachOLinkGraphBuilder; private: - NormalizedSymbol(Optional Name, uint64_t Value, uint8_t Type, - uint8_t Sect, uint16_t Desc, Linkage L, Scope S) + NormalizedSymbol(std::optional Name, uint64_t Value, + uint8_t Type, uint8_t Sect, uint16_t Desc, Linkage L, + Scope S) : Name(Name), Value(Value), Type(Type), Sect(Sect), Desc(Desc), L(L), S(S) { assert((!Name || !Name->empty()) && "Name must be none or non-empty"); @@ -50,7 +51,7 @@ protected: NormalizedSymbol(NormalizedSymbol &&) = delete; NormalizedSymbol &operator=(NormalizedSymbol &&) = delete; - Optional Name; + std::optional Name; uint64_t Value = 0; uint8_t Type = 0; uint8_t Sect = 0; diff --git a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp index 642aa74..40716a7 100644 --- a/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/COFFPlatform.cpp @@ -164,7 +164,7 @@ COFFPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD, const char *OrcRuntimePath, LoadDynamicLibrary LoadDynLibrary, bool StaticVCRuntime, const char *VCRuntimePath, - Optional RuntimeAliases) { + std::optional RuntimeAliases) { auto &EPC = ES.getExecutorProcessControl(); // If the target is not supported then bail out immediately. diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp index 9386a03..6448ada 100644 --- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp @@ -102,12 +102,12 @@ private: CompileOnDemandLayer &Parent; }; -Optional +std::optional CompileOnDemandLayer::compileRequested(GlobalValueSet Requested) { return std::move(Requested); } -Optional +std::optional CompileOnDemandLayer::compileWholeModule(GlobalValueSet Requested) { return std::nullopt; } diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp index eb24221..00032e4 100644 --- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp @@ -111,7 +111,7 @@ Expected> ELFNixPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD, const char *OrcRuntimePath, - Optional RuntimeAliases) { + std::optional RuntimeAliases) { auto &EPC = ES.getExecutorProcessControl(); diff --git a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp index b980b50..30d641e 100644 --- a/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp +++ b/llvm/lib/ExecutionEngine/Orc/EPCDebugObjectRegistrar.cpp @@ -16,9 +16,9 @@ namespace llvm { namespace orc { -Expected> -createJITLoaderGDBRegistrar(ExecutionSession &ES, - Optional RegistrationFunctionDylib) { +Expected> createJITLoaderGDBRegistrar( + ExecutionSession &ES, + std::optional RegistrationFunctionDylib) { auto &EPC = ES.getExecutorProcessControl(); if (!RegistrationFunctionDylib) { diff --git a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp index 37dea5c..3aa94a7 100644 --- a/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp +++ b/llvm/lib/ExecutionEngine/Orc/EPCEHFrameRegistrar.cpp @@ -16,9 +16,9 @@ using namespace llvm::orc::shared; namespace llvm { namespace orc { -Expected> -EPCEHFrameRegistrar::Create(ExecutionSession &ES, - Optional RegistrationFunctionsDylib) { +Expected> EPCEHFrameRegistrar::Create( + ExecutionSession &ES, + std::optional RegistrationFunctionsDylib) { // FIXME: Proper mangling here -- we really need to decouple linker mangling // from DataLayout. diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp index fb458c2..7ba0386 100644 --- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp @@ -190,7 +190,7 @@ namespace orc { Expected> MachOPlatform::Create(ExecutionSession &ES, ObjectLinkingLayer &ObjLinkingLayer, JITDylib &PlatformJD, const char *OrcRuntimePath, - Optional RuntimeAliases) { + std::optional RuntimeAliases) { auto &EPC = ES.getExecutorProcessControl(); diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp index b76b745c..7546b3f 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.cpp @@ -14,7 +14,7 @@ namespace llvm { namespace orc { int runAsMain(int (*Main)(int, char *[]), ArrayRef Args, - Optional ProgramName) { + std::optional ProgramName) { std::vector> ArgVStorage; std::vector ArgV; diff --git a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h index ac9d4d4..f564b00 100644 --- a/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h +++ b/llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCheckerImpl.h @@ -57,7 +57,7 @@ private: getStubOrGOTAddrFor(StringRef StubContainerName, StringRef Symbol, bool IsInsideLoad, bool IsStubAddr) const; - Optional getSectionLoadAddress(void *LocalAddr) const; + std::optional getSectionLoadAddress(void *LocalAddr) const; IsSymbolValidFunction IsSymbolValid; GetSymbolInfoFunction GetSymbolInfo; diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp index 59e7bda..aee6f20 100644 --- a/llvm/tools/lli/lli.cpp +++ b/llvm/tools/lli/lli.cpp @@ -846,7 +846,7 @@ int runOrcJIT(const char *ProgName) { // Get TargetTriple and DataLayout from the main module if they're explicitly // set. std::optional TT; - Optional DL; + std::optional DL; MainModule.withModuleDo([&](Module &M) { if (!M.getTargetTriple().empty()) TT = Triple(M.getTargetTriple());