================ @@ -235,29 +247,57 @@ void RuntimeLibcallEmitter::emitGetInitRuntimeLibcallNames( // TODO: Emit libcall names as string offset table. OS << "#ifdef GET_INIT_RUNTIME_LIBCALL_NAMES\n" - "const char *const " + "const RTLIB::LibcallImpl " "llvm::RTLIB::RuntimeLibcallsInfo::" - "DefaultLibcallRoutineNames[RTLIB::UNKNOWN_LIBCALL + 1] = {\n"; + "DefaultLibcallImpls[RTLIB::UNKNOWN_LIBCALL + 1] = {\n"; for (const RuntimeLibcall &LibCall : RuntimeLibcallDefList) { auto I = LibCallToDefaultImpl.find(&LibCall); - if (I == LibCallToDefaultImpl.end()) - OS << " nullptr,"; - else { + if (I == LibCallToDefaultImpl.end()) { + OS << " RTLIB::Unsupported,"; + } else { const RuntimeLibcallImpl *LibCallImpl = I->second; OS << " "; - LibCallImpl->emitQuotedLibcallFuncName(OS); - OS << ','; + LibCallImpl->emitEnumEntry(OS); + OS << ","; } OS << " // "; LibCall.emitEnumEntry(OS); OS << '\n'; } - OS << " nullptr // RTLIB::UNKNOWN_LIBCALL\n" + OS << " RTLIB::Unsupported\n" "};\n\n"; + // Emit the implementation names + OS << "const char *const llvm::RTLIB::RuntimeLibcallsInfo::" + "LibCallImplNames[RTLIB::NumLibcallImpls] = {\n" + " nullptr, // RTLIB::Unsupported\n"; + + for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) { + OS << " \"" << LibCallImpl.getLibcallFuncName() << "\", // "; + LibCallImpl.emitEnumEntry(OS); + OS << '\n'; + } + + OS << "};\n\n"; + + // Emit the reverse mapping from implementation libraries to RTLIB::Libcall + OS << "const RTLIB::Libcall llvm::RTLIB::RuntimeLibcallsInfo::" + "ImplToLibcall[RTLIB::NumLibcallImpls] = {\n" + " RTLIB::UNKNOWN_LIBCALL, // RTLIB::Unsupported\n"; + + for (const RuntimeLibcallImpl &LibCallImpl : RuntimeLibcallImplDefList) { + const RuntimeLibcall *Provides = LibCallImpl.getProvides(); + OS << " "; + Provides->emitEnumEntry(OS); + OS << ", // "; + LibCallImpl.emitEnumEntry(OS); + OS << '\n'; + } + OS << "};\n\n"; ---------------- nikic wrote:
What do we need this for? It seems to be unused in this patch. Does it get used further up the stack? https://github.com/llvm/llvm-project/pull/144973 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits