LLVM
15.0.0git
|
#include "llvm/Transforms/Utils/BuildLibCalls.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/TypeSize.h"
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 (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 (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 | setOnlyWritesMemory (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 | 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, 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 | markRegisterParameterAttributes (Function *F) |
static Value * | emitLibCall (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 Value * | emitUnaryFloatFnCallHelper (Value *Op, LibFunc TheLibFunc, StringRef Name, IRBuilderBase &B, const AttributeList &Attrs, const TargetLibraryInfo *TLI) |
static Value * | emitBinaryFloatFnCallHelper (Value *Op1, Value *Op2, LibFunc TheLibFunc, StringRef Name, IRBuilderBase &B, const AttributeList &Attrs, const TargetLibraryInfo *TLI) |
#define DEBUG_TYPE "build-libcalls" |
Definition at line 30 of file BuildLibCalls.cpp.
|
static |
Append a suffix to the function name according to the type of 'Op'.
Definition at line 1631 of file BuildLibCalls.cpp.
Referenced by llvm::emitBinaryFloatFnCall(), and llvm::emitUnaryFloatFnCall().
|
static |
Definition at line 1693 of file BuildLibCalls.cpp.
References assert(), Attrs, B, Callee, F, llvm::FunctionCallee::getCallee(), llvm::getOrInsertLibFunc(), llvm::Value::getType(), llvm::inferNonMandatoryLibFuncAttrs(), M, llvm::CallBase::setAttributes(), llvm::CallBase::setCallingConv(), and llvm::Value::stripPointerCasts().
Referenced by llvm::emitBinaryFloatFnCall().
|
static |
Definition at line 1421 of file BuildLibCalls.cpp.
References B, Callee, F, llvm::FunctionType::get(), llvm::FunctionCallee::getCallee(), llvm::TargetLibraryInfo::getName(), llvm::getOrInsertLibFunc(), llvm::inferNonMandatoryLibFuncAttrs(), llvm::isLibFuncEmittable(), M, Operands, llvm::CallBase::setCallingConv(), and llvm::Value::stripPointerCasts().
Referenced by llvm::emitBCmp(), llvm::emitMemCCpy(), llvm::emitMemChr(), llvm::emitMemCmp(), llvm::emitMemPCpy(), llvm::emitSNPrintf(), llvm::emitSPrintf(), llvm::emitStpCpy(), llvm::emitStpNCpy(), llvm::emitStrCat(), llvm::emitStrChr(), llvm::emitStrCpy(), llvm::emitStrDup(), llvm::emitStrLCat(), llvm::emitStrLCpy(), llvm::emitStrLen(), llvm::emitStrNCat(), llvm::emitStrNCmp(), llvm::emitStrNCpy(), llvm::emitVSNPrintf(), and llvm::emitVSPrintf().
|
static |
Definition at line 1645 of file BuildLibCalls.cpp.
References assert(), Attrs, B, Callee, F, llvm::FunctionCallee::getCallee(), llvm::getOrInsertLibFunc(), M, llvm::CallBase::setAttributes(), llvm::CallBase::setCallingConv(), and llvm::Value::stripPointerCasts().
Referenced by llvm::emitUnaryFloatFnCall().
|
static |
Definition at line 1246 of file BuildLibCalls.cpp.
References assert(), llvm::CallingConv::C, DL, F, M, N, T, and llvm::CallingConv::X86_StdCall.
Referenced by llvm::getOrInsertLibFunc().
|
static |
Definition at line 219 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 226 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
Definition at line 242 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 249 of file BuildLibCalls.cpp.
References F, and llvm::Attribute::get().
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 233 of file BuildLibCalls.cpp.
References F, and llvm::Attribute::getWithAllocSizeArgs().
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 1238 of file BuildLibCalls.cpp.
References F, llvm::TargetLibraryInfo::getExtAttrForI32Param(), llvm::Attribute::None, and Signed.
Referenced by llvm::getOrInsertLibFunc().
|
static |
Definition at line 174 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 162 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and setRetAndArgsNoUndef().
|
static |
Definition at line 51 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and setOnlyWritesMemory().
|
static |
Definition at line 128 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 120 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 204 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 104 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 197 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and lowerObjCCall().
|
static |
Definition at line 88 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 96 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 59 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 67 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 136 of file BuildLibCalls.cpp.
References F.
|
static |
Definition at line 75 of file BuildLibCalls.cpp.
References F, and setDoesNotAccessMemory().
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 144 of file BuildLibCalls.cpp.
References F.
|
static |
Definition at line 182 of file BuildLibCalls.cpp.
References F, setArgsNoUndef(), and setRetNoUndef().
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 112 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 152 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs(), and setRetAndArgsNoUndef().
|
static |
Definition at line 189 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
|
static |
Definition at line 211 of file BuildLibCalls.cpp.
References F.
Referenced by llvm::inferNonMandatoryLibFuncAttrs().
STATISTIC | ( | NumInaccessibleMemOrArgMemOnly | , |
"Number of functions inferred as inaccessiblemem_or_argmemonly" | |||
) |