================ @@ -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"; ---------------- arsenm wrote:
I have some later patches that use it, but I'm not sure they are posted yet. Right now it's used for avoiding the soft float compare type special case table, but eventually it will also be useful for libcall recognize 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