================
@@ -528,23 +528,20 @@ 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},
-#include "llvm/IR/RuntimeLibcalls.def"
-#undef HANDLE_LIBCALL
- };
- 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 (int I = 0; I < RTLIB::UNKNOWN_LIBCALL; ++I) {
+ RTLIB::Libcall LC = static_cast<RTLIB::Libcall>(I);
+ 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;
----------------
arsenm wrote:
RuntimeLibcallsInfo directly sets this, this was already moved in the parent PR
https://github.com/llvm/llvm-project/pull/143054
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits