diff options
author | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2022-06-29 14:29:33 +0200 |
---|---|---|
committer | Nicolai Hähnle <nicolai.haehnle@amd.com> | 2022-07-10 09:15:08 +0200 |
commit | e6f1f062457c928c18a88c612f39d9e168f65a85 (patch) | |
tree | b90f5190cbeabf748e143602c280c37567d78850 /llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp | |
parent | da6a14b91ad999327b41a9040577273591e4ad1d (diff) | |
download | llvm-e6f1f062457c928c18a88c612f39d9e168f65a85.zip llvm-e6f1f062457c928c18a88c612f39d9e168f65a85.tar.gz llvm-e6f1f062457c928c18a88c612f39d9e168f65a85.tar.bz2 |
ManagedStatic: remove many straightforward uses in llvm
Bulk remove many of the more trivial uses of ManagedStatic in the llvm
directory, either by defining a new getter function or, in many cases,
moving the static variable directly into the only function that uses it.
Differential Revision: https://reviews.llvm.org/D129120
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp')
-rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp index 388c0f9..0b3e534 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp @@ -21,7 +21,6 @@ #include "WebAssemblyRuntimeLibcallSignatures.h" #include "WebAssemblySubtarget.h" #include "llvm/CodeGen/RuntimeLibcalls.h" -#include "llvm/Support/ManagedStatic.h" using namespace llvm; @@ -482,10 +481,13 @@ struct RuntimeLibcallSignatureTable { } }; -ManagedStatic<RuntimeLibcallSignatureTable> RuntimeLibcallSignatures; +RuntimeLibcallSignatureTable &getRuntimeLibcallSignatures() { + static RuntimeLibcallSignatureTable RuntimeLibcallSignatures; + return RuntimeLibcallSignatures; +} // Maps libcall names to their RTLIB::Libcall number. Builds the map in a -// constructor for use with ManagedStatic +// constructor for use with a static variable struct StaticLibcallNameMap { StringMap<RTLIB::Libcall> Map; StaticLibcallNameMap() { @@ -496,7 +498,8 @@ struct StaticLibcallNameMap { }; for (const auto &NameLibcall : NameLibcalls) { if (NameLibcall.first != nullptr && - RuntimeLibcallSignatures->Table[NameLibcall.second] != unsupported) { + getRuntimeLibcallSignatures().Table[NameLibcall.second] != + unsupported) { assert(Map.find(NameLibcall.first) == Map.end() && "duplicate libcall names in name map"); Map[NameLibcall.first] = NameLibcall.second; @@ -523,7 +526,7 @@ void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget, wasm::ValType PtrTy = Subtarget.hasAddr64() ? wasm::ValType::I64 : wasm::ValType::I32; - auto &Table = RuntimeLibcallSignatures->Table; + auto &Table = getRuntimeLibcallSignatures().Table; switch (Table[LC]) { case func: break; @@ -885,14 +888,14 @@ void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget, } } -static ManagedStatic<StaticLibcallNameMap> LibcallNameMap; // TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unsed // other than here, just roll its logic into this version. void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget, StringRef Name, SmallVectorImpl<wasm::ValType> &Rets, SmallVectorImpl<wasm::ValType> &Params) { - auto &Map = LibcallNameMap->Map; + static StaticLibcallNameMap LibcallNameMap; + auto &Map = LibcallNameMap.Map; auto Val = Map.find(Name); #ifndef NDEBUG if (Val == Map.end()) { |