#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Module.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/TargetParser/Triple.h"
usingnamespacellvm;
static cl::opt<TargetLibraryInfoImpl::VectorLibrary> ClVectorLibrary(
"vector-library", cl::Hidden, cl::desc("Vector functions library"),
cl::init(TargetLibraryInfoImpl::NoLibrary),
cl::values(clEnumValN(TargetLibraryInfoImpl::NoLibrary, "none",
"No vector functions library"),
clEnumValN(TargetLibraryInfoImpl::Accelerate, "Accelerate",
"Accelerate framework"),
clEnumValN(TargetLibraryInfoImpl::DarwinLibSystemM,
"Darwin_libsystem_m", "Darwin libsystem_m"),
clEnumValN(TargetLibraryInfoImpl::LIBMVEC_X86, "LIBMVEC-X86",
"GLIBC Vector Math library"),
clEnumValN(TargetLibraryInfoImpl::MASSV, "MASSV",
"IBM MASS vector library"),
clEnumValN(TargetLibraryInfoImpl::SVML, "SVML",
"Intel SVML library"),
clEnumValN(TargetLibraryInfoImpl::SLEEFGNUABI, "sleefgnuabi",
"SIMD Library for Evaluating Elementary Functions"),
clEnumValN(TargetLibraryInfoImpl::ArmPL, "ArmPL",
"Arm Performance Libraries"),
clEnumValN(TargetLibraryInfoImpl::AMDLIBM, "AMDLIBM",
"AMD vector math library")));
StringLiteral const TargetLibraryInfoImpl::StandardNames[LibFunc::NumLibFuncs] = …;
std::string VecDesc::getVectorFunctionABIVariantString() const { … }
enum FuncArgTypeID : char { … };
FuncProtoTy;
static const FuncProtoTy Signatures[] = …;
static_assert …;
static bool hasSinCosPiStret(const Triple &T) { … }
static bool hasBcmp(const Triple &TT) { … }
static bool isCallingConvCCompatible(CallingConv::ID CC, StringRef TT,
FunctionType *FuncTy) { … }
bool TargetLibraryInfoImpl::isCallingConvCCompatible(CallBase *CI) { … }
bool TargetLibraryInfoImpl::isCallingConvCCompatible(Function *F) { … }
static void initializeBase(TargetLibraryInfoImpl &TLI, const Triple &T) { … }
static void initializeLibCalls(TargetLibraryInfoImpl &TLI, const Triple &T,
ArrayRef<StringLiteral> StandardNames) { … }
static void initialize(TargetLibraryInfoImpl &TLI, const Triple &T,
ArrayRef<StringLiteral> StandardNames) { … }
TargetLibraryInfoImpl::TargetLibraryInfoImpl() { … }
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const Triple &T) { … }
TargetLibraryInfoImpl::TargetLibraryInfoImpl(const TargetLibraryInfoImpl &TLI)
: … { … }
TargetLibraryInfoImpl::TargetLibraryInfoImpl(TargetLibraryInfoImpl &&TLI)
: … { … }
TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(const TargetLibraryInfoImpl &TLI) { … }
TargetLibraryInfoImpl &TargetLibraryInfoImpl::operator=(TargetLibraryInfoImpl &&TLI) { … }
static StringRef sanitizeFunctionName(StringRef funcName) { … }
static DenseMap<StringRef, LibFunc>
buildIndexMap(ArrayRef<StringLiteral> StandardNames) { … }
bool TargetLibraryInfoImpl::getLibFunc(StringRef funcName, LibFunc &F) const { … }
static bool matchType(FuncArgTypeID ArgTy, const Type *Ty, unsigned IntBits,
unsigned SizeTBits) { … }
static bool isValidProtoForSizeReturningNew(const FunctionType &FTy, LibFunc F,
const Module &M,
int SizeTSizeBits) { … }
bool TargetLibraryInfoImpl::isValidProtoForLibFunc(const FunctionType &FTy,
LibFunc F,
const Module &M) const { … }
bool TargetLibraryInfoImpl::getLibFunc(const Function &FDecl,
LibFunc &F) const { … }
bool TargetLibraryInfoImpl::getLibFunc(unsigned int Opcode, Type *Ty,
LibFunc &F) const { … }
void TargetLibraryInfoImpl::disableAllFunctions() { … }
static bool compareByScalarFnName(const VecDesc &LHS, const VecDesc &RHS) { … }
static bool compareByVectorFnName(const VecDesc &LHS, const VecDesc &RHS) { … }
static bool compareWithScalarFnName(const VecDesc &LHS, StringRef S) { … }
void TargetLibraryInfoImpl::addVectorizableFunctions(ArrayRef<VecDesc> Fns) { … }
static const VecDesc VecFuncs_Accelerate[] = …;
static const VecDesc VecFuncs_DarwinLibSystemM[] = …;
static const VecDesc VecFuncs_LIBMVEC_X86[] = …;
static const VecDesc VecFuncs_MASSV[] = …;
static const VecDesc VecFuncs_SVML[] = …;
static const VecDesc VecFuncs_SLEEFGNUABI_VF2[] = …;
static const VecDesc VecFuncs_SLEEFGNUABI_VF4[] = …;
static const VecDesc VecFuncs_SLEEFGNUABI_VFScalable[] = …;
static const VecDesc VecFuncs_ArmPL[] = …;
const VecDesc VecFuncs_AMDLIBM[] = …;
void TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib(
enum VectorLibrary VecLib, const llvm::Triple &TargetTriple) { … }
bool TargetLibraryInfoImpl::isFunctionVectorizable(StringRef funcName) const { … }
StringRef TargetLibraryInfoImpl::getVectorizedFunction(StringRef F,
const ElementCount &VF,
bool Masked) const { … }
const VecDesc *
TargetLibraryInfoImpl::getVectorMappingInfo(StringRef F, const ElementCount &VF,
bool Masked) const { … }
TargetLibraryInfo TargetLibraryAnalysis::run(const Function &F,
FunctionAnalysisManager &) { … }
unsigned TargetLibraryInfoImpl::getWCharSize(const Module &M) const { … }
unsigned TargetLibraryInfoImpl::getSizeTSize(const Module &M) const { … }
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass()
: … { … }
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(const Triple &T)
: … { … }
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(
const TargetLibraryInfoImpl &TLIImpl)
: … { … }
TargetLibraryInfoWrapperPass::TargetLibraryInfoWrapperPass(
const TargetLibraryInfo &TLIOther)
: … { … }
AnalysisKey TargetLibraryAnalysis::Key;
INITIALIZE_PASS(…)
char TargetLibraryInfoWrapperPass::ID = …;
void TargetLibraryInfoWrapperPass::anchor() { … }
void TargetLibraryInfoImpl::getWidestVF(StringRef ScalarF,
ElementCount &FixedVF,
ElementCount &ScalableVF) const { … }