llvm-project/llvm/lib/Transforms/Utils/DeclareRuntimeLibcalls.cpp
gulfemsavrun 334e9bf2dd
Revert "RuntimeLibcalls: Generate table of libcall name lengths (#153… (#153864)
…210)"

This reverts commit 9a14b1d254a43dc0d4445c3ffa3d393bca007ba3.

Revert "RuntimeLibcalls: Return StringRef for libcall names (#153209)"

This reverts commit cb1228fbd535b8f9fe78505a15292b0ba23b17de.

Revert "TableGen: Emit statically generated hash table for runtime
libcalls (#150192)"

This reverts commit 769a9058c8d04fc920994f6a5bbb03c8a4fbcd05.

Reverted three changes because of a CMake error while building llvm-nm
as reported in the following PR:
https://github.com/llvm/llvm-project/pull/150192#issuecomment-3192223073
2025-08-15 13:32:27 -07:00

39 lines
1.3 KiB
C++

//===- DeclareRuntimeLibcalls.cpp -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Insert declarations for all runtime library calls known for the target.
//
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Utils/DeclareRuntimeLibcalls.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/RuntimeLibcalls.h"
using namespace llvm;
PreservedAnalyses DeclareRuntimeLibcallsPass::run(Module &M,
ModuleAnalysisManager &MAM) {
RTLIB::RuntimeLibcallsInfo RTLCI(M.getTargetTriple());
LLVMContext &Ctx = M.getContext();
for (RTLIB::LibcallImpl Impl : RTLCI.getLibcallImpls()) {
if (Impl == RTLIB::Unsupported)
continue;
// TODO: Declare with correct type, calling convention, and attributes.
FunctionType *FuncTy =
FunctionType::get(Type::getVoidTy(Ctx), {}, /*IsVarArgs=*/true);
const char *FuncName = RTLCI.getLibcallImplName(Impl);
M.getOrInsertFunction(FuncName, FuncTy);
}
return PreservedAnalyses::none();
}