LLVM 20.0.0git
Macros | Typedefs | Enumerations | Functions | Variables
TargetLibraryInfo.cpp File Reference
#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"
#include "llvm/Analysis/TargetLibraryInfo.def"
#include "llvm/Analysis/VecFuncs.def"

Go to the source code of this file.

Macros

#define TLI_DEFINE_STRING
 
#define TLI_DEFINE_SIG
 
#define TLI_DEFINE_ACCELERATE_VECFUNCS
 
#define TLI_DEFINE_DARWIN_LIBSYSTEM_M_VECFUNCS
 
#define TLI_DEFINE_LIBMVEC_X86_VECFUNCS
 
#define TLI_DEFINE_MASSV_VECFUNCS
 
#define TLI_DEFINE_SVML_VECFUNCS
 
#define TLI_DEFINE_SLEEFGNUABI_VF2_VECFUNCS
 
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, VABI_PREFIX)    {SCAL, VEC, VF, /* MASK = */ false, VABI_PREFIX},
 
#define TLI_DEFINE_SLEEFGNUABI_VF4_VECFUNCS
 
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, VABI_PREFIX)    {SCAL, VEC, VF, /* MASK = */ false, VABI_PREFIX},
 
#define TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS
 
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MASK, VABI_PREFIX)    {SCAL, VEC, VF, MASK, VABI_PREFIX},
 
#define TLI_DEFINE_ARMPL_VECFUNCS
 
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MASK, VABI_PREFIX)    {SCAL, VEC, VF, MASK, VABI_PREFIX},
 
#define TLI_DEFINE_AMDLIBM_VECFUNCS
 
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MASK, VABI_PREFIX)    {SCAL, VEC, VF, MASK, VABI_PREFIX},
 

Typedefs

typedef std::array< FuncArgTypeID, 8 > FuncProtoTy
 

Enumerations

enum  FuncArgTypeID : char {
  Void = 0 , Bool , Int16 , Int32 ,
  Int , IntPlus , Long , IntX ,
  Int64 , LLong , SizeT , SSizeT ,
  Flt , Dbl , LDbl , Floating ,
  Ptr , Struct , Ellip , Same
}
 

Functions

static bool hasSinCosPiStret (const Triple &T)
 
static bool hasBcmp (const Triple &TT)
 
static bool isCallingConvCCompatible (CallingConv::ID CC, StringRef TT, FunctionType *FuncTy)
 
static void initializeBase (TargetLibraryInfoImpl &TLI, const Triple &T)
 
static void initializeLibCalls (TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
 Initialize the set of available library functions based on the specified target triple.
 
static void initialize (TargetLibraryInfoImpl &TLI, const Triple &T, ArrayRef< StringLiteral > StandardNames)
 Initialize the set of available library functions based on the specified target triple.
 
static StringRef sanitizeFunctionName (StringRef funcName)
 
static DenseMap< StringRef, LibFuncbuildIndexMap (ArrayRef< StringLiteral > StandardNames)
 
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)
 
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)
 

Variables

static cl::opt< TargetLibraryInfoImpl::VectorLibraryClVectorLibrary ("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")))
 
static const FuncProtoTy Signatures []
 
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 []
 

Macro Definition Documentation

◆ TLI_DEFINE_ACCELERATE_VECFUNCS

#define TLI_DEFINE_ACCELERATE_VECFUNCS

◆ TLI_DEFINE_AMDLIBM_VECFUNCS

#define TLI_DEFINE_AMDLIBM_VECFUNCS

◆ TLI_DEFINE_ARMPL_VECFUNCS

#define TLI_DEFINE_ARMPL_VECFUNCS

◆ TLI_DEFINE_DARWIN_LIBSYSTEM_M_VECFUNCS

#define TLI_DEFINE_DARWIN_LIBSYSTEM_M_VECFUNCS

◆ TLI_DEFINE_LIBMVEC_X86_VECFUNCS

#define TLI_DEFINE_LIBMVEC_X86_VECFUNCS

◆ TLI_DEFINE_MASSV_VECFUNCS

#define TLI_DEFINE_MASSV_VECFUNCS

◆ TLI_DEFINE_SIG

#define TLI_DEFINE_SIG

◆ TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS

#define TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS

◆ TLI_DEFINE_SLEEFGNUABI_VF2_VECFUNCS

#define TLI_DEFINE_SLEEFGNUABI_VF2_VECFUNCS

◆ TLI_DEFINE_SLEEFGNUABI_VF4_VECFUNCS

#define TLI_DEFINE_SLEEFGNUABI_VF4_VECFUNCS

◆ TLI_DEFINE_STRING

#define TLI_DEFINE_STRING

◆ TLI_DEFINE_SVML_VECFUNCS

#define TLI_DEFINE_SVML_VECFUNCS

◆ TLI_DEFINE_VECFUNC [1/5]

#define TLI_DEFINE_VECFUNC (   SCAL,
  VEC,
  VF,
  MASK,
  VABI_PREFIX 
)     {SCAL, VEC, VF, MASK, VABI_PREFIX},

◆ TLI_DEFINE_VECFUNC [2/5]

#define TLI_DEFINE_VECFUNC (   SCAL,
  VEC,
  VF,
  MASK,
  VABI_PREFIX 
)     {SCAL, VEC, VF, MASK, VABI_PREFIX},

◆ TLI_DEFINE_VECFUNC [3/5]

#define TLI_DEFINE_VECFUNC (   SCAL,
  VEC,
  VF,
  MASK,
  VABI_PREFIX 
)     {SCAL, VEC, VF, MASK, VABI_PREFIX},

◆ TLI_DEFINE_VECFUNC [4/5]

#define TLI_DEFINE_VECFUNC (   SCAL,
  VEC,
  VF,
  VABI_PREFIX 
)     {SCAL, VEC, VF, /* MASK = */ false, VABI_PREFIX},

◆ TLI_DEFINE_VECFUNC [5/5]

#define TLI_DEFINE_VECFUNC (   SCAL,
  VEC,
  VF,
  VABI_PREFIX 
)     {SCAL, VEC, VF, /* MASK = */ false, VABI_PREFIX},

Typedef Documentation

◆ FuncProtoTy

typedef std::array<FuncArgTypeID, 8> FuncProtoTy

Definition at line 83 of file TargetLibraryInfo.cpp.

Enumeration Type Documentation

◆ FuncArgTypeID

Enumerator
Void 
Bool 
Int16 
Int32 
Int 
IntPlus 
Long 
IntX 
Int64 
LLong 
SizeT 
SSizeT 
Flt 
Dbl 
LDbl 
Floating 
Ptr 
Struct 
Ellip 
Same 

Definition at line 60 of file TargetLibraryInfo.cpp.

Function Documentation

◆ buildIndexMap()

static DenseMap< StringRef, LibFunc > buildIndexMap ( ArrayRef< StringLiteral StandardNames)
static

◆ compareByScalarFnName()

static bool compareByScalarFnName ( const VecDesc LHS,
const VecDesc RHS 
)
static

Definition at line 1240 of file TargetLibraryInfo.cpp.

References LHS, and RHS.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctions().

◆ compareByVectorFnName()

static bool compareByVectorFnName ( const VecDesc LHS,
const VecDesc RHS 
)
static

Definition at line 1244 of file TargetLibraryInfo.cpp.

References LHS, and RHS.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctions().

◆ compareWithScalarFnName()

static bool compareWithScalarFnName ( const VecDesc LHS,
StringRef  S 
)
static

◆ hasBcmp()

static bool hasBcmp ( const Triple TT)
static

Definition at line 111 of file TargetLibraryInfo.cpp.

Referenced by initializeLibCalls().

◆ hasSinCosPiStret()

static bool hasSinCosPiStret ( const Triple T)
static

Definition at line 93 of file TargetLibraryInfo.cpp.

References llvm::Triple::x86.

Referenced by initializeLibCalls().

◆ initialize()

static void initialize ( TargetLibraryInfoImpl TLI,
const Triple T,
ArrayRef< StringLiteral StandardNames 
)
static

◆ initializeBase()

static void initializeBase ( TargetLibraryInfoImpl TLI,
const Triple T 
)
static

◆ initializeLibCalls()

static void initializeLibCalls ( TargetLibraryInfoImpl TLI,
const Triple T,
ArrayRef< StringLiteral StandardNames 
)
static

◆ isCallingConvCCompatible()

static bool isCallingConvCCompatible ( CallingConv::ID  CC,
StringRef  TT,
FunctionType FuncTy 
)
static

◆ isValidProtoForSizeReturningNew()

static bool isValidProtoForSizeReturningNew ( const FunctionType FTy,
LibFunc  F,
const Module M,
int  SizeTSizeBits 
)
static

◆ matchType()

static bool matchType ( FuncArgTypeID  ArgTy,
const Type Ty,
unsigned  IntBits,
unsigned  SizeTBits 
)
static

◆ sanitizeFunctionName()

static StringRef sanitizeFunctionName ( StringRef  funcName)
static

Variable Documentation

◆ ClVectorLibrary

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"))) ( "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"))   
)
static

Referenced by initializeLibCalls().

◆ Signatures

const FuncProtoTy Signatures[]
static
Initial value:
= {
#define TLI_DEFINE_SIG
}

Definition at line 85 of file TargetLibraryInfo.cpp.

Referenced by llvm::BalancedPartitioning::moveGain().

◆ VecFuncs_Accelerate

const VecDesc VecFuncs_Accelerate[]
static
Initial value:
= {
#define TLI_DEFINE_ACCELERATE_VECFUNCS
}

Definition at line 1260 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_AMDLIBM

const VecDesc VecFuncs_AMDLIBM[]
Initial value:
= {
#define TLI_DEFINE_AMDLIBM_VECFUNCS
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MASK, VABI_PREFIX)
}

Definition at line 1320 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_ArmPL

const VecDesc VecFuncs_ArmPL[]
static
Initial value:
= {
#define TLI_DEFINE_ARMPL_VECFUNCS
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MASK, VABI_PREFIX)
}

Definition at line 1312 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_DarwinLibSystemM

const VecDesc VecFuncs_DarwinLibSystemM[]
static
Initial value:
= {
#define TLI_DEFINE_DARWIN_LIBSYSTEM_M_VECFUNCS
}

Definition at line 1266 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_LIBMVEC_X86

const VecDesc VecFuncs_LIBMVEC_X86[]
static
Initial value:
= {
#define TLI_DEFINE_LIBMVEC_X86_VECFUNCS
}

Definition at line 1272 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_MASSV

const VecDesc VecFuncs_MASSV[]
static
Initial value:
= {
#define TLI_DEFINE_MASSV_VECFUNCS
}

Definition at line 1278 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_SLEEFGNUABI_VF2

const VecDesc VecFuncs_SLEEFGNUABI_VF2[]
static
Initial value:
= {
#define TLI_DEFINE_SLEEFGNUABI_VF2_VECFUNCS
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, VABI_PREFIX)
}

Definition at line 1290 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_SLEEFGNUABI_VF4

const VecDesc VecFuncs_SLEEFGNUABI_VF4[]
static
Initial value:
= {
#define TLI_DEFINE_SLEEFGNUABI_VF4_VECFUNCS
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, VABI_PREFIX)
}

Definition at line 1297 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_SLEEFGNUABI_VFScalable

const VecDesc VecFuncs_SLEEFGNUABI_VFScalable[]
static
Initial value:
= {
#define TLI_DEFINE_SLEEFGNUABI_SCALABLE_VECFUNCS
#define TLI_DEFINE_VECFUNC(SCAL, VEC, VF, MASK, VABI_PREFIX)
}

Definition at line 1304 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().

◆ VecFuncs_SVML

const VecDesc VecFuncs_SVML[]
static
Initial value:
= {
#define TLI_DEFINE_SVML_VECFUNCS
}

Definition at line 1284 of file TargetLibraryInfo.cpp.

Referenced by llvm::TargetLibraryInfoImpl::addVectorizableFunctionsFromVecLib().