LLVM 23.0.0git
BuildLibCalls.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "build-libcalls"

Functions

 STATISTIC (NumReadNone, "Number of functions inferred as readnone")
 STATISTIC (NumReadOnly, "Number of functions inferred as readonly")
 STATISTIC (NumWriteOnly, "Number of functions inferred as writeonly")
 STATISTIC (NumArgMemOnly, "Number of functions inferred as argmemonly")
 STATISTIC (NumWriteErrnoMemOnly, "Number of functions inferred as memory(errnomem: write)")
 STATISTIC (NumInaccessibleMemOrArgMemOnly, "Number of functions inferred as inaccessiblemem_or_argmemonly")
 STATISTIC (NumInaccessibleMemOrErrnoMemOnly, "Number of functions inferred as memory(inaccessiblemem: readwrite, " "errnomem: write)")
 STATISTIC (NumInaccessibleMemOrArgMemOrErrnoMemOnly, "Number of functions inferred as memory(argmem: readwrite, " "inaccessiblemem: readwrite, errnomem: write)")
 STATISTIC (NumWriteArgumentMemOrErrnoMemOnly, "Number of functions inferred as memory(argmem: write, errnomem: write)")
 STATISTIC (NumNoUnwind, "Number of functions inferred as nounwind")
 STATISTIC (NumNoCallback, "Number of functions inferred as nocallback")
 STATISTIC (NumNoCapture, "Number of arguments inferred as nocapture")
 STATISTIC (NumWriteOnlyArg, "Number of arguments inferred as writeonly")
 STATISTIC (NumReadOnlyArg, "Number of arguments inferred as readonly")
 STATISTIC (NumNoAlias, "Number of function returns inferred as noalias")
 STATISTIC (NumNoUndef, "Number of function returns inferred as noundef returns")
 STATISTIC (NumReturnedArg, "Number of arguments inferred as returned")
 STATISTIC (NumWillReturn, "Number of functions inferred as willreturn")
 STATISTIC (NumCold, "Number of functions inferred as cold")
 STATISTIC (NumNoReturn, "Number of functions inferred as no return")
 STATISTIC (NumNoSync, "Number of functions inferred as nosync")
static bool setDoesNotAccessMemory (Function &F)
static bool setIsCold (Function &F)
static bool setNoReturn (Function &F)
static bool setMemoryEffects (Function &F, MemoryEffects ME)
static bool setOnlyReadsMemory (Function &F)
static bool setOnlyWritesMemory (Function &F)
static bool setOnlyAccessesArgMemory (Function &F)
static bool setOnlyAccessesInaccessibleMemOrArgMem (Function &F)
static bool setOnlyAccessesInaccessibleMemOrErrnoMem (Function &F)
static bool setOnlyAccessesInaccessibleMemOrArgMemOrErrnoMem (Function &F)
static bool setOnlyWritesErrnoMemory (Function &F)
static bool setOnlyWritesArgMemOrErrnoMem (Function &F)
static bool setDoesNotThrow (Function &F)
static bool setDoesNotCallback (Function &F)
static bool setRetDoesNotAlias (Function &F)
static bool setDoesNotCapture (Function &F, unsigned ArgNo)
static bool setDoesNotAlias (Function &F, unsigned ArgNo)
static bool setDoesNotSync (Function &F)
static bool setOnlyReadsMemory (Function &F, unsigned ArgNo)
static bool setOnlyWritesMemory (Function &F, unsigned ArgNo)
static bool setRetNoUndef (Function &F)
static bool setArgsNoUndef (Function &F)
static bool setArgNoUndef (Function &F, unsigned ArgNo)
static bool setRetAndArgsNoUndef (Function &F)
static bool setReturnedArg (Function &F, unsigned ArgNo)
static bool setNonLazyBind (Function &F)
static bool setDoesNotFreeMemory (Function &F)
static bool setWillReturn (Function &F)
static bool setAlignedAllocParam (Function &F, unsigned ArgNo)
static bool setAllocatedPointerParam (Function &F, unsigned ArgNo)
static bool setAllocSize (Function &F, unsigned ElemSizeArg, std::optional< unsigned > NumElemsArg)
static bool setAllocFamily (Function &F, StringRef Family)
static bool setAllocKind (Function &F, AllocFnKind K)
static void setArgExtAttr (Function &F, unsigned ArgNo, const TargetLibraryInfo &TLI, bool Signed=true)
static void setRetExtAttr (Function &F, const TargetLibraryInfo &TLI, bool Signed=true)
static IntegerTypegetIntTy (IRBuilderBase &B, const TargetLibraryInfo *TLI)
static IntegerTypegetSizeTTy (IRBuilderBase &B, const TargetLibraryInfo *TLI)
static ValueemitLibCall (LibFunc TheLibFunc, Type *ReturnType, ArrayRef< Type * > ParamTypes, ArrayRef< Value * > Operands, IRBuilderBase &B, const TargetLibraryInfo *TLI, bool IsVaArgs=false)
static void appendTypeSuffix (Value *Op, StringRef &Name, SmallString< 20 > &NameBuffer)
 Append a suffix to the function name according to the type of 'Op'.
static ValueemitUnaryFloatFnCallHelper (Value *Op, LibFunc TheLibFunc, StringRef Name, IRBuilderBase &B, const AttributeList &Attrs, const TargetLibraryInfo *TLI)
static ValueemitBinaryFloatFnCallHelper (Value *Op1, Value *Op2, LibFunc TheLibFunc, StringRef Name, IRBuilderBase &B, const AttributeList &Attrs, const TargetLibraryInfo *TLI)

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "build-libcalls"

Definition at line 32 of file BuildLibCalls.cpp.

Function Documentation

◆ appendTypeSuffix()

void appendTypeSuffix ( Value * Op,
StringRef & Name,
SmallString< 20 > & NameBuffer )
static

Append a suffix to the function name according to the type of 'Op'.

Definition at line 1907 of file BuildLibCalls.cpp.

Referenced by llvm::emitBinaryFloatFnCall(), and llvm::emitUnaryFloatFnCall().

◆ emitBinaryFloatFnCallHelper()

◆ emitLibCall()

◆ emitUnaryFloatFnCallHelper()

Value * emitUnaryFloatFnCallHelper ( Value * Op,
LibFunc TheLibFunc,
StringRef Name,
IRBuilderBase & B,
const AttributeList & Attrs,
const TargetLibraryInfo * TLI )
static

◆ getIntTy()

◆ getSizeTTy()

◆ setAlignedAllocParam()

bool setAlignedAllocParam ( Function & F,
unsigned ArgNo )
static

Definition at line 290 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocatedPointerParam()

bool setAllocatedPointerParam ( Function & F,
unsigned ArgNo )
static

Definition at line 297 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocFamily()

bool setAllocFamily ( Function & F,
StringRef Family )
static

Definition at line 313 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocKind()

bool setAllocKind ( Function & F,
AllocFnKind K )
static

Definition at line 320 of file BuildLibCalls.cpp.

References F, and llvm::Attribute::get().

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocSize()

bool setAllocSize ( Function & F,
unsigned ElemSizeArg,
std::optional< unsigned > NumElemsArg )
static

Definition at line 304 of file BuildLibCalls.cpp.

References F, and llvm::Attribute::getWithAllocSizeArgs().

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setArgExtAttr()

void setArgExtAttr ( Function & F,
unsigned ArgNo,
const TargetLibraryInfo & TLI,
bool Signed = true )
static

Definition at line 1457 of file BuildLibCalls.cpp.

References F, llvm::Attribute::None, and Signed.

Referenced by llvm::getOrInsertLibFunc().

◆ setArgNoUndef()

bool setArgNoUndef ( Function & F,
unsigned ArgNo )
static

Definition at line 245 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setArgsNoUndef()

bool setArgsNoUndef ( Function & F)
static

Definition at line 233 of file BuildLibCalls.cpp.

References Changed, and F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and setRetAndArgsNoUndef().

◆ setDoesNotAccessMemory()

bool setDoesNotAccessMemory ( Function & F)
static

Definition at line 66 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotAlias()

bool setDoesNotAlias ( Function & F,
unsigned ArgNo )
static

Definition at line 191 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotCallback()

bool setDoesNotCallback ( Function & F)
static

Definition at line 166 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotCapture()

bool setDoesNotCapture ( Function & F,
unsigned ArgNo )
static

◆ setDoesNotFreeMemory()

bool setDoesNotFreeMemory ( Function & F)
static

Definition at line 275 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotSync()

bool setDoesNotSync ( Function & F)
static

Definition at line 199 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotThrow()

bool setDoesNotThrow ( Function & F)
static

Definition at line 158 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setIsCold()

bool setIsCold ( Function & F)
static

Definition at line 74 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setMemoryEffects()

◆ setNonLazyBind()

bool setNonLazyBind ( Function & F)
static

Definition at line 268 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and lowerObjCCall().

◆ setNoReturn()

bool setNoReturn ( Function & F)
static

Definition at line 82 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setOnlyAccessesArgMemory()

bool setOnlyAccessesArgMemory ( Function & F)
static

◆ setOnlyAccessesInaccessibleMemOrArgMem()

bool setOnlyAccessesInaccessibleMemOrArgMem ( Function & F)
static

◆ setOnlyAccessesInaccessibleMemOrArgMemOrErrnoMem()

bool setOnlyAccessesInaccessibleMemOrArgMemOrErrnoMem ( Function & F)
static

◆ setOnlyAccessesInaccessibleMemOrErrnoMem()

bool setOnlyAccessesInaccessibleMemOrErrnoMem ( Function & F)
static

◆ setOnlyReadsMemory() [1/2]

bool setOnlyReadsMemory ( Function & F)
static

◆ setOnlyReadsMemory() [2/2]

bool setOnlyReadsMemory ( Function & F,
unsigned ArgNo )
static

Definition at line 207 of file BuildLibCalls.cpp.

References F.

◆ setOnlyWritesArgMemOrErrnoMem()

bool setOnlyWritesArgMemOrErrnoMem ( Function & F)
static

◆ setOnlyWritesErrnoMemory()

bool setOnlyWritesErrnoMemory ( Function & F)
static

◆ setOnlyWritesMemory() [1/2]

bool setOnlyWritesMemory ( Function & F)
static

◆ setOnlyWritesMemory() [2/2]

bool setOnlyWritesMemory ( Function & F,
unsigned ArgNo )
static

Definition at line 215 of file BuildLibCalls.cpp.

References F.

◆ setRetAndArgsNoUndef()

bool setRetAndArgsNoUndef ( Function & F)
static

Definition at line 253 of file BuildLibCalls.cpp.

References F, setArgsNoUndef(), and setRetNoUndef().

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setRetDoesNotAlias()

bool setRetDoesNotAlias ( Function & F)
static

Definition at line 174 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setRetExtAttr()

void setRetExtAttr ( Function & F,
const TargetLibraryInfo & TLI,
bool Signed = true )
static

Definition at line 1464 of file BuildLibCalls.cpp.

References F, llvm::Attribute::None, and Signed.

Referenced by llvm::getOrInsertLibFunc().

◆ setRetNoUndef()

bool setRetNoUndef ( Function & F)
static

Definition at line 223 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and setRetAndArgsNoUndef().

◆ setReturnedArg()

bool setReturnedArg ( Function & F,
unsigned ArgNo )
static

Definition at line 260 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setWillReturn()

bool setWillReturn ( Function & F)
static

Definition at line 282 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ STATISTIC() [1/21]

STATISTIC ( NumArgMemOnly ,
"Number of functions inferred as argmemonly"  )

◆ STATISTIC() [2/21]

STATISTIC ( NumCold ,
"Number of functions inferred as cold"  )

◆ STATISTIC() [3/21]

STATISTIC ( NumInaccessibleMemOrArgMemOnly ,
"Number of functions inferred as inaccessiblemem_or_argmemonly"  )

◆ STATISTIC() [4/21]

STATISTIC ( NumInaccessibleMemOrArgMemOrErrnoMemOnly ,
"Number of functions inferred as memory(argmem: readwrite, " "inaccessiblemem: readwrite, errnomem: write)"  )

◆ STATISTIC() [5/21]

STATISTIC ( NumInaccessibleMemOrErrnoMemOnly ,
"Number of functions inferred as memory(inaccessiblemem: readwrite, " "errnomem: write)"  )

◆ STATISTIC() [6/21]

STATISTIC ( NumNoAlias ,
"Number of function returns inferred as noalias"  )

◆ STATISTIC() [7/21]

STATISTIC ( NumNoCallback ,
"Number of functions inferred as nocallback"  )

◆ STATISTIC() [8/21]

STATISTIC ( NumNoCapture ,
"Number of arguments inferred as nocapture"  )

◆ STATISTIC() [9/21]

STATISTIC ( NumNoReturn ,
"Number of functions inferred as no return"  )

◆ STATISTIC() [10/21]

STATISTIC ( NumNoSync ,
"Number of functions inferred as nosync"  )

◆ STATISTIC() [11/21]

STATISTIC ( NumNoUndef ,
"Number of function returns inferred as noundef returns"  )

◆ STATISTIC() [12/21]

STATISTIC ( NumNoUnwind ,
"Number of functions inferred as nounwind"  )

◆ STATISTIC() [13/21]

STATISTIC ( NumReadNone ,
"Number of functions inferred as readnone"  )

◆ STATISTIC() [14/21]

STATISTIC ( NumReadOnly ,
"Number of functions inferred as readonly"  )

◆ STATISTIC() [15/21]

STATISTIC ( NumReadOnlyArg ,
"Number of arguments inferred as readonly"  )

◆ STATISTIC() [16/21]

STATISTIC ( NumReturnedArg ,
"Number of arguments inferred as returned"  )

◆ STATISTIC() [17/21]

STATISTIC ( NumWillReturn ,
"Number of functions inferred as willreturn"  )

◆ STATISTIC() [18/21]

STATISTIC ( NumWriteArgumentMemOrErrnoMemOnly ,
"Number of functions inferred as memory(argmem: write, errnomem: write)"  )

◆ STATISTIC() [19/21]

STATISTIC ( NumWriteErrnoMemOnly ,
"Number of functions inferred as memory(errnomem: write)"  )

◆ STATISTIC() [20/21]

STATISTIC ( NumWriteOnly ,
"Number of functions inferred as writeonly"  )

◆ STATISTIC() [21/21]

STATISTIC ( NumWriteOnlyArg ,
"Number of arguments inferred as writeonly"  )