本文整理汇总了C++中TargetLibraryInfo::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ TargetLibraryInfo::getName方法的具体用法?C++ TargetLibraryInfo::getName怎么用?C++ TargetLibraryInfo::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TargetLibraryInfo
的用法示例。
在下文中一共展示了TargetLibraryInfo::getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: accumulateAndSortLibcalls
// Collect names of runtime library functions. User-defined functions with the
// same names are added to llvm.compiler.used to prevent them from being
// deleted by optimizations.
static void accumulateAndSortLibcalls(std::vector<StringRef> &Libcalls,
const TargetLibraryInfo& TLI,
const Module &Mod,
const TargetMachine &TM) {
// TargetLibraryInfo has info on C runtime library calls on the current
// target.
for (unsigned I = 0, E = static_cast<unsigned>(LibFunc::NumLibFuncs);
I != E; ++I) {
LibFunc::Func F = static_cast<LibFunc::Func>(I);
if (TLI.has(F))
Libcalls.push_back(TLI.getName(F));
}
SmallPtrSet<const TargetLowering *, 1> TLSet;
for (const Function &F : Mod) {
const TargetLowering *Lowering =
TM.getSubtargetImpl(F)->getTargetLowering();
if (Lowering && TLSet.insert(Lowering).second)
// TargetLowering has info on library calls that CodeGen expects to be
// available, both from the C runtime and compiler-rt.
for (unsigned I = 0, E = static_cast<unsigned>(RTLIB::UNKNOWN_LIBCALL);
I != E; ++I)
if (const char *Name =
Lowering->getLibcallName(static_cast<RTLIB::Libcall>(I)))
Libcalls.push_back(Name);
}
array_pod_sort(Libcalls.begin(), Libcalls.end());
Libcalls.erase(std::unique(Libcalls.begin(), Libcalls.end()),
Libcalls.end());
}
示例2: accumulateAndSortLibcalls
static void accumulateAndSortLibcalls(std::vector<StringRef> &Libcalls,
const TargetLibraryInfo& TLI,
const TargetLowering *Lowering)
{
// TargetLibraryInfo has info on C runtime library calls on the current
// target.
for (unsigned I = 0, E = static_cast<unsigned>(LibFunc::NumLibFuncs);
I != E; ++I) {
LibFunc::Func F = static_cast<LibFunc::Func>(I);
if (TLI.has(F))
Libcalls.push_back(TLI.getName(F));
}
// TargetLowering has info on library calls that CodeGen expects to be
// available, both from the C runtime and compiler-rt.
if (Lowering)
for (unsigned I = 0, E = static_cast<unsigned>(RTLIB::UNKNOWN_LIBCALL);
I != E; ++I)
if (const char *Name
= Lowering->getLibcallName(static_cast<RTLIB::Libcall>(I)))
Libcalls.push_back(Name);
array_pod_sort(Libcalls.begin(), Libcalls.end());
Libcalls.erase(std::unique(Libcalls.begin(), Libcalls.end()),
Libcalls.end());
}
示例3: createLibraryFunction
static void createLibraryFunction(llvm::LibFunc::Func funcId,
llvm::FunctionType *funcType, Module* module)
{
TargetLibraryInfo targetLib;
if (targetLib.has(funcId))
{
Function::Create(funcType, Function::ExternalLinkage,
targetLib.getName(funcId), module);
}
else
{
string msg = "native target does not have library function for ";
msg += targetLib.getName(funcId);
throw_llvm_exception(msg);
}
}