Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.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 (NumInaccessibleMemOnly, "Number of functions inferred as inaccessiblememonly")
 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 (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")
static bool setDoesNotAccessMemory (Function &F)
static bool setIsCold (Function &F)
static bool setNoReturn (Function &F)
static bool setMemoryEffects (Function &F, MemoryEffects ME)
static bool setOnlyAccessesInaccessibleMemory (Function &F)
static bool setOnlyReadsMemory (Function &F)
static bool setOnlyWritesMemory (Function &F)
static bool setOnlyAccessesArgMemory (Function &F)
static bool setOnlyAccessesInaccessibleMemOrArgMem (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 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 1850 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 268 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocatedPointerParam()

bool setAllocatedPointerParam ( Function & F,
unsigned ArgNo )
static

Definition at line 275 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocFamily()

bool setAllocFamily ( Function & F,
StringRef Family )
static

Definition at line 291 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setAllocKind()

bool setAllocKind ( Function & F,
AllocFnKind K )
static

Definition at line 298 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 282 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 1400 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 223 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setArgsNoUndef()

bool setArgsNoUndef ( Function & F)
static

Definition at line 211 of file BuildLibCalls.cpp.

References Changed, and F.

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

◆ setDoesNotAccessMemory()

bool setDoesNotAccessMemory ( Function & F)
static

Definition at line 61 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotAlias()

bool setDoesNotAlias ( Function & F,
unsigned ArgNo )
static

Definition at line 177 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotCallback()

bool setDoesNotCallback ( Function & F)
static

Definition at line 152 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 253 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setDoesNotThrow()

bool setDoesNotThrow ( Function & F)
static

Definition at line 144 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setIsCold()

bool setIsCold ( Function & F)
static

Definition at line 69 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setMemoryEffects()

◆ setNonLazyBind()

bool setNonLazyBind ( Function & F)
static

Definition at line 246 of file BuildLibCalls.cpp.

References F.

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

◆ setNoReturn()

bool setNoReturn ( Function & F)
static

Definition at line 77 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setOnlyAccessesArgMemory()

bool setOnlyAccessesArgMemory ( Function & F)
static

◆ setOnlyAccessesInaccessibleMemOrArgMem()

bool setOnlyAccessesInaccessibleMemOrArgMem ( Function & F)
static

◆ setOnlyAccessesInaccessibleMemory()

bool setOnlyAccessesInaccessibleMemory ( Function & F)
static

◆ setOnlyReadsMemory() [1/2]

bool setOnlyReadsMemory ( Function & F)
static

◆ setOnlyReadsMemory() [2/2]

bool setOnlyReadsMemory ( Function & F,
unsigned ArgNo )
static

Definition at line 185 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 193 of file BuildLibCalls.cpp.

References F.

◆ setRetAndArgsNoUndef()

bool setRetAndArgsNoUndef ( Function & F)
static

Definition at line 231 of file BuildLibCalls.cpp.

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

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setRetDoesNotAlias()

bool setRetDoesNotAlias ( Function & F)
static

Definition at line 160 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 1407 of file BuildLibCalls.cpp.

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

Referenced by llvm::getOrInsertLibFunc().

◆ setRetNoUndef()

bool setRetNoUndef ( Function & F)
static

Definition at line 201 of file BuildLibCalls.cpp.

References F.

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

◆ setReturnedArg()

bool setReturnedArg ( Function & F,
unsigned ArgNo )
static

Definition at line 238 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ setWillReturn()

bool setWillReturn ( Function & F)
static

Definition at line 260 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferNonMandatoryLibFuncAttrs().

◆ STATISTIC() [1/19]

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

◆ STATISTIC() [2/19]

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

◆ STATISTIC() [3/19]

STATISTIC ( NumInaccessibleMemOnly ,
"Number of functions inferred as inaccessiblememonly"  )

◆ STATISTIC() [4/19]

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

◆ STATISTIC() [5/19]

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

◆ STATISTIC() [6/19]

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

◆ STATISTIC() [7/19]

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

◆ STATISTIC() [8/19]

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

◆ STATISTIC() [9/19]

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

◆ STATISTIC() [10/19]

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

◆ STATISTIC() [11/19]

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

◆ STATISTIC() [12/19]

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

◆ STATISTIC() [13/19]

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

◆ STATISTIC() [14/19]

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

◆ STATISTIC() [15/19]

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

◆ STATISTIC() [16/19]

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

◆ STATISTIC() [17/19]

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

◆ STATISTIC() [18/19]

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

◆ STATISTIC() [19/19]

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