Skip to content

Commit 76400d2

Browse files
authored
[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.
1 parent f2d02ce commit 76400d2

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ MCSymbol *WebAssemblyAsmPrinter::getOrCreateWasmSymbol(StringRef Name) {
264264
Params.push_back(AddrType);
265265
} else { // Function symbols
266266
WasmSym->setType(wasm::WASM_SYMBOL_TYPE_FUNCTION);
267-
getLibcallSignature(Subtarget, Name, Returns, Params);
267+
WebAssembly::getLibcallSignature(Subtarget, Name, Returns, Params);
268268
}
269269
auto Signature = std::make_unique<wasm::WasmSignature>(std::move(Returns),
270270
std::move(Params));

llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -524,10 +524,10 @@ struct StaticLibcallNameMap {
524524

525525
} // end anonymous namespace
526526

527-
void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
528-
RTLIB::Libcall LC,
529-
SmallVectorImpl<wasm::ValType> &Rets,
530-
SmallVectorImpl<wasm::ValType> &Params) {
527+
void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
528+
RTLIB::Libcall LC,
529+
SmallVectorImpl<wasm::ValType> &Rets,
530+
SmallVectorImpl<wasm::ValType> &Params) {
531531
assert(Rets.empty());
532532
assert(Params.empty());
533533

@@ -889,10 +889,10 @@ void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
889889

890890
// TODO: If the RTLIB::Libcall-taking flavor of GetSignature remains unused
891891
// other than here, just roll its logic into this version.
892-
void llvm::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
893-
StringRef Name,
894-
SmallVectorImpl<wasm::ValType> &Rets,
895-
SmallVectorImpl<wasm::ValType> &Params) {
892+
void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget,
893+
StringRef Name,
894+
SmallVectorImpl<wasm::ValType> &Rets,
895+
SmallVectorImpl<wasm::ValType> &Params) {
896896
static StaticLibcallNameMap LibcallNameMap;
897897
auto &Map = LibcallNameMap.Map;
898898
auto Val = Map.find(Name);

llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ namespace llvm {
2222

2323
class WebAssemblySubtarget;
2424

25-
extern void getLibcallSignature(const WebAssemblySubtarget &Subtarget,
26-
RTLIB::Libcall LC,
27-
SmallVectorImpl<wasm::ValType> &Rets,
28-
SmallVectorImpl<wasm::ValType> &Params);
25+
namespace WebAssembly {
2926

30-
extern void getLibcallSignature(const WebAssemblySubtarget &Subtarget,
31-
StringRef Name,
32-
SmallVectorImpl<wasm::ValType> &Rets,
33-
SmallVectorImpl<wasm::ValType> &Params);
27+
void getLibcallSignature(const WebAssemblySubtarget &Subtarget,
28+
RTLIB::Libcall LC,
29+
SmallVectorImpl<wasm::ValType> &Rets,
30+
SmallVectorImpl<wasm::ValType> &Params);
3431

32+
void getLibcallSignature(const WebAssemblySubtarget &Subtarget, StringRef Name,
33+
SmallVectorImpl<wasm::ValType> &Rets,
34+
SmallVectorImpl<wasm::ValType> &Params);
35+
36+
} // end namespace WebAssembly
3537
} // end namespace llvm
3638

3739
#endif

0 commit comments

Comments
 (0)