diff options
| author | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
| commit | 95fbfc9be5d2842a945c04a20fe6244df9b10e18 (patch) | |
| tree | 00f80558d11aa5805e6d6f290663c6da44e5e6ef /llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp | |
| parent | a9ba028b98ffd53d9c7d00ca7563d74810fcf6e7 (diff) | |
| parent | 17e8465a3eb0cae48b9f62d27fd26f2b070f1f9b (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/MaskRay/spr/main.move-relocation-specifier-constants-to-aarch64
Created using spr 1.3.5-bogner
[skip ci]
Diffstat (limited to 'llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp')
| -rw-r--r-- | llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp index d5c4532824c0..4548a7520b3b 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyRuntimeLibcallSignatures.cpp @@ -528,25 +528,19 @@ RuntimeLibcallSignatureTable &getRuntimeLibcallSignatures() { // constructor for use with a static variable struct StaticLibcallNameMap { StringMap<RTLIB::Libcall> Map; - StaticLibcallNameMap() { - static const std::pair<const char *, RTLIB::Libcall> NameLibcalls[] = { -#define HANDLE_LIBCALL(code, name) {(const char *)name, RTLIB::code}, -#define LIBCALL_NO_NAME nullptr -#include "llvm/IR/RuntimeLibcalls.def" -#undef HANDLE_LIBCALL -#undef LIBCALL_NO_NAME - }; - for (const auto &NameLibcall : NameLibcalls) { - if (NameLibcall.first != nullptr && - getRuntimeLibcallSignatures().Table[NameLibcall.second] != - unsupported) { - assert(!Map.contains(NameLibcall.first) && + StaticLibcallNameMap(const Triple &TT) { + // FIXME: This is broken if there are ever different triples compiled with + // different libcalls. + RTLIB::RuntimeLibcallsInfo RTCI(TT); + for (RTLIB::Libcall LC : RTLIB::libcalls()) { + const char *NameLibcall = RTCI.getLibcallName(LC); + if (NameLibcall != nullptr && + getRuntimeLibcallSignatures().Table[LC] != unsupported) { + assert(!Map.contains(NameLibcall) && "duplicate libcall names in name map"); - Map[NameLibcall.first] = NameLibcall.second; + Map[NameLibcall] = LC; } } - - Map["emscripten_return_address"] = RTLIB::RETURN_ADDRESS; } }; @@ -942,7 +936,7 @@ void WebAssembly::getLibcallSignature(const WebAssemblySubtarget &Subtarget, StringRef Name, SmallVectorImpl<wasm::ValType> &Rets, SmallVectorImpl<wasm::ValType> &Params) { - static StaticLibcallNameMap LibcallNameMap; + static StaticLibcallNameMap LibcallNameMap(Subtarget.getTargetTriple()); auto &Map = LibcallNameMap.Map; auto Val = Map.find(Name); #ifndef NDEBUG |
