[llvm] 76400d2 - [WebAssembly] Move getLibcallSignature into WebAssembly namespace (NFC) (#85171)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 10:16:04 PDT 2024
Author: Heejin Ahn
Date: 2024-03-14T10:16:00-07:00
New Revision: 76400d2979c92cc0393628dea50e26374d559775
URL: https://github.com/llvm/llvm-project/commit/76400d2979c92cc0393628dea50e26374d559775
DIFF: https://github.com/llvm/llvm-project/commit/76400d2979c92cc0393628dea50e26374d559775.diff
LOG: [WebAssembly] Move getLibcallSignature into WebAssembly namespace (NFC) (#85171)
These are Wasm only functions so they are better be within `WebAssembly`
namespace rather than the `llvm` namespace which includes the whole
LLVM.
Also this removes `extern` keywords which are not strictly necessary.
Added:
Modified:
llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h
Removed:
################################################################################
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
index fb949d4b19a3e1..03897b551ecaee 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp
@@ -264,7 +264,7 @@ MCSymbol *WebAssemblyAsmPrinter::getOrCreateWasmSymbol(StringRef Name) {
Params.push_back(AddrType);
} else { // Function symbols
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
- getLibcallSignature(Subtarget, Name, Returns, Params);
+ WebAssembly::getLibcallSignature(Subtarget, Name, Returns, Params);
}
auto Signature = std::make_unique<wasm::WasmSignature>(std::move(Returns),
std::move(Params));
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
index 3e2e029695ab6f..1896ac631d96e5 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
@@ -524,10 +524,10 @@ struct StaticLibcallNameMap {
} // end anonymous namespace
-void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
- RTLIB::Libcall LC,
- SmallVectorImpl<wasm::ValType> &Rets,
- SmallVectorImpl<wasm::ValType> &Params) {
+void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
+ RTLIB::Libcall LC,
+ SmallVectorImpl<wasm::ValType> &Rets,
+ SmallVectorImpl<wasm::ValType> &Params) {
assert(Rets.empty());
assert(Params.empty());
@@ -889,10 +889,10 @@ void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
// TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unused
// 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) {
+void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
+ StringRef Name,
+ SmallVectorImpl<wasm::ValType> &Rets,
+ SmallVectorImpl<wasm::ValType> &Params) {
static StaticLibcallNameMap LibcallNameMap;
auto &Map = LibcallNameMap.Map;
auto Val = Map.find(Name);
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h
index f7a94aa20bd463..ff6515d5bf4e67 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h
@@ -22,16 +22,18 @@ namespace llvm {
class WebAssemblySubtarget;
-extern void getLibcallSignature(const WebAssemblySubtarget &Subtarget,
- RTLIB::Libcall LC,
- SmallVectorImpl<wasm::ValType> &Rets,
- SmallVectorImpl<wasm::ValType> &Params);
+namespace WebAssembly {
-extern void getLibcallSignature(const WebAssemblySubtarget &Subtarget,
- StringRef Name,
- SmallVectorImpl<wasm::ValType> &Rets,
- SmallVectorImpl<wasm::ValType> &Params);
+void getLibcallSignature(const WebAssemblySubtarget &Subtarget,
+ RTLIB::Libcall LC,
+ SmallVectorImpl<wasm::ValType> &Rets,
+ SmallVectorImpl<wasm::ValType> &Params);
+void getLibcallSignature(const WebAssemblySubtarget &Subtarget, StringRef Name,
+ SmallVectorImpl<wasm::ValType> &Rets,
+ SmallVectorImpl<wasm::ValType> &Params);
+
+} // end namespace WebAssembly
} // end namespace llvm
#endif
More information about the llvm-commits
mailing list