LLVM  14.0.0git
Macros | Functions
BuildLibCalls.cpp File Reference
#include "llvm/Transforms/Utils/BuildLibCalls.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Analysis/MemoryBuiltins.h"
Include dependency graph for BuildLibCalls.cpp:

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 (NumArgMemOnly, "Number of functions inferred as argmemonly")
 
 STATISTIC (NumInaccessibleMemOrArgMemOnly, "Number of functions inferred as inaccessiblemem_or_argmemonly")
 
 STATISTIC (NumNoUnwind, "Number of functions inferred as nounwind")
 
 STATISTIC (NumNoCapture, "Number of arguments inferred as nocapture")
 
 STATISTIC (NumWriteOnlyArg, "Number of arguments inferred as writeonly")
 
 STATISTIC (NumSExtArg, "Number of arguments inferred as signext")
 
 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")
 
static bool setDoesNotAccessMemory (Function &F)
 
static bool setOnlyAccessesInaccessibleMemory (Function &F)
 
static bool setOnlyReadsMemory (Function &F)
 
static bool setOnlyAccessesArgMemory (Function &F)
 
static bool setOnlyAccessesInaccessibleMemOrArgMem (Function &F)
 
static bool setDoesNotThrow (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 setSignExtendedArg (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 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'. More...
 
static ValueemitUnaryFloatFnCallHelper (Value *Op, StringRef Name, IRBuilderBase &B, const AttributeList &Attrs)
 
static ValueemitBinaryFloatFnCallHelper (Value *Op1, Value *Op2, StringRef Name, IRBuilderBase &B, const AttributeList &Attrs, const TargetLibraryInfo *TLI=nullptr)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "build-libcalls"

Definition at line 29 of file BuildLibCalls.cpp.

Function Documentation

◆ appendTypeSuffix()

static 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 1432 of file BuildLibCalls.cpp.

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

◆ emitBinaryFloatFnCallHelper()

static Value* emitBinaryFloatFnCallHelper ( Value Op1,
Value Op2,
StringRef  Name,
IRBuilderBase B,
const AttributeList Attrs,
const TargetLibraryInfo TLI = nullptr 
)
static

◆ emitLibCall()

static Value* emitLibCall ( LibFunc  TheLibFunc,
Type ReturnType,
ArrayRef< Type * >  ParamTypes,
ArrayRef< Value * >  Operands,
IRBuilderBase B,
const TargetLibraryInfo TLI,
bool  IsVaArgs = false 
)
static

◆ emitUnaryFloatFnCallHelper()

static Value* emitUnaryFloatFnCallHelper ( Value Op,
StringRef  Name,
IRBuilderBase B,
const AttributeList Attrs 
)
static

◆ setArgNoUndef()

static bool setArgNoUndef ( Function F,
unsigned  ArgNo 
)
static

Definition at line 168 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setArgsNoUndef()

static bool setArgsNoUndef ( Function F)
static

Definition at line 156 of file BuildLibCalls.cpp.

References F.

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

◆ setDoesNotAccessMemory()

static bool setDoesNotAccessMemory ( Function F)
static

Definition at line 50 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setDoesNotAlias()

static bool setDoesNotAlias ( Function F,
unsigned  ArgNo 
)
static

Definition at line 114 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setDoesNotCapture()

static bool setDoesNotCapture ( Function F,
unsigned  ArgNo 
)
static

Definition at line 106 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setDoesNotFreeMemory()

static bool setDoesNotFreeMemory ( Function F)
static

Definition at line 198 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setDoesNotThrow()

static bool setDoesNotThrow ( Function F)
static

Definition at line 90 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setNonLazyBind()

static bool setNonLazyBind ( Function F)
static

Definition at line 191 of file BuildLibCalls.cpp.

References F.

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

◆ setOnlyAccessesArgMemory()

static bool setOnlyAccessesArgMemory ( Function F)
static

Definition at line 74 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setOnlyAccessesInaccessibleMemOrArgMem()

static bool setOnlyAccessesInaccessibleMemOrArgMem ( Function F)
static

Definition at line 82 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setOnlyAccessesInaccessibleMemory()

static bool setOnlyAccessesInaccessibleMemory ( Function F)
static

Definition at line 58 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setOnlyReadsMemory() [1/2]

static bool setOnlyReadsMemory ( Function F)
static

Definition at line 66 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setOnlyReadsMemory() [2/2]

static bool setOnlyReadsMemory ( Function F,
unsigned  ArgNo 
)
static

Definition at line 122 of file BuildLibCalls.cpp.

References F.

◆ setOnlyWritesMemory()

static bool setOnlyWritesMemory ( Function F,
unsigned  ArgNo 
)
static

Definition at line 130 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setRetAndArgsNoUndef()

static bool setRetAndArgsNoUndef ( Function F)
static

Definition at line 176 of file BuildLibCalls.cpp.

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

Referenced by llvm::inferLibFuncAttributes().

◆ setRetDoesNotAlias()

static bool setRetDoesNotAlias ( Function F)
static

Definition at line 98 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setRetNoUndef()

static bool setRetNoUndef ( Function F)
static

Definition at line 146 of file BuildLibCalls.cpp.

References F.

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

◆ setReturnedArg()

static bool setReturnedArg ( Function F,
unsigned  ArgNo 
)
static

Definition at line 183 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setSignExtendedArg()

static bool setSignExtendedArg ( Function F,
unsigned  ArgNo 
)
static

Definition at line 138 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ setWillReturn()

static bool setWillReturn ( Function F)
static

Definition at line 205 of file BuildLibCalls.cpp.

References F.

Referenced by llvm::inferLibFuncAttributes().

◆ STATISTIC() [1/14]

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

◆ STATISTIC() [2/14]

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

◆ STATISTIC() [3/14]

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

◆ STATISTIC() [4/14]

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

◆ STATISTIC() [5/14]

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

◆ STATISTIC() [6/14]

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

◆ STATISTIC() [7/14]

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

◆ STATISTIC() [8/14]

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

◆ STATISTIC() [9/14]

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

◆ STATISTIC() [10/14]

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

◆ STATISTIC() [11/14]

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

◆ STATISTIC() [12/14]

STATISTIC ( NumSExtArg  ,
"Number of arguments inferred as signext"   
)

◆ STATISTIC() [13/14]

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

◆ STATISTIC() [14/14]

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