summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2018-02-23 20:13:03 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2018-02-23 20:13:03 +0000
commitae87f86ec4da5afc28e66a5248e359607d6f3436 (patch)
tree6ffc2c57a94b4db762e5106f2cf5bf0e6235e441 /llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
parent1246a8d6e7466f39a6719debd0fce484b397f9ef (diff)
downloadbcm5719-llvm-ae87f86ec4da5afc28e66a5248e359607d6f3436.tar.gz
bcm5719-llvm-ae87f86ec4da5afc28e66a5248e359607d6f3436.zip
[WebAssembly] Fix macro metaprogram to not duplicate code as much.
No functionality change intended. llvm-svn: 325947
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
index d4d41520666..e2b518104d1 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp
@@ -465,15 +465,19 @@ ManagedStatic<RuntimeLibcallSignatureTable> RuntimeLibcallSignatures;
struct StaticLibcallNameMap {
StringMap<RTLIB::Libcall> Map;
StaticLibcallNameMap() {
-#define HANDLE_LIBCALL(code, name) \
- if ((const char *)name && \
- RuntimeLibcallSignatures->Table[RTLIB::code] != unsupported) { \
- assert(Map.find(StringRef::withNullAsEmpty(name)) == Map.end() && \
- "duplicate libcall names in name map"); \
- Map[StringRef::withNullAsEmpty(name)] = RTLIB::code; \
- }
+ static constexpr std::pair<const char *, RTLIB::Libcall> NameLibcalls[] = {
+#define HANDLE_LIBCALL(code, name) {(const char *)name, RTLIB::code},
#include "llvm/CodeGen/RuntimeLibcalls.def"
#undef HANDLE_LIBCALL
+ };
+ for (const auto &NameLibcall : NameLibcalls) {
+ if (NameLibcall.first != nullptr &&
+ RuntimeLibcallSignatures->Table[NameLibcall.second] != unsupported) {
+ assert(Map.find(NameLibcall.first) == Map.end() &&
+ "duplicate libcall names in name map");
+ Map[NameLibcall.first] = NameLibcall.second;
+ }
+ }
}
};
OpenPOWER on IntegriCloud