LLVM
8.0.1
|
LibCallSimplifier - This class implements a collection of optimizations that replace well formed calls to library functions with a more optimal form. More...
#include "llvm/Transforms/Utils/SimplifyLibCalls.h"
Public Member Functions | |
LibCallSimplifier (const DataLayout &DL, const TargetLibraryInfo *TLI, OptimizationRemarkEmitter &ORE, function_ref< void(Instruction *, Value *)> Replacer=&replaceAllUsesWithDefault, function_ref< void(Instruction *)> Eraser=&eraseFromParentDefault) | |
Value * | optimizeCall (CallInst *CI) |
optimizeCall - Take the given call instruction and return a more optimal value to replace the instruction with or 0 if a more optimal form can't be found. More... | |
LibCallSimplifier - This class implements a collection of optimizations that replace well formed calls to library functions with a more optimal form.
For example, replacing 'printf("Hello!")' with 'puts("Hello!")'.
Definition at line 72 of file SimplifyLibCalls.h.
LibCallSimplifier::LibCallSimplifier | ( | const DataLayout & | DL, |
const TargetLibraryInfo * | TLI, | ||
OptimizationRemarkEmitter & | ORE, | ||
function_ref< void(Instruction *, Value *)> | Replacer = &replaceAllUsesWithDefault , |
||
function_ref< void(Instruction *)> | Eraser = &eraseFromParentDefault |
||
) |
Definition at line 2686 of file SimplifyLibCalls.cpp.
References B, llvm::IRBuilder< T, Inserter >::CreateGEP(), llvm::IRBuilder< T, Inserter >::CreateInBoundsGEP(), llvm::IRBuilder< T, Inserter >::CreateIntCast(), llvm::IRBuilderBase::CreateMemCpy(), llvm::IRBuilderBase::CreateMemMove(), llvm::IRBuilderBase::CreateMemSet(), llvm::emitMemCpyChk(), llvm::emitStrCpy(), llvm::emitStrLen(), llvm::emitStrNCpy(), llvm::ConstantInt::get(), llvm::CallBase::getArgOperand(), llvm::CallBase::getCalledFunction(), llvm::Value::getContext(), llvm::Module::getDataLayout(), llvm::IRBuilderBase::getInt8Ty(), llvm::DataLayout::getIntPtrType(), llvm::Instruction::getModule(), llvm::Value::getName(), llvm::GetStringLength(), I, Name, llvm::MipsISD::Ret, and llvm::StringRef::substr().
optimizeCall - Take the given call instruction and return a more optimal value to replace the instruction with or 0 if a more optimal form can't be found.
Note that the returned value may be equal to the instruction being optimized. In this case all other instructions that use the given instruction were modified and the given instruction is dead. The call must not be an indirect call.
Definition at line 2555 of file SimplifyLibCalls.cpp.
References llvm::dyn_cast(), EnableUnsafeFPShrink, llvm::Intrinsic::exp2, llvm::CallBase::getCalledFunction(), llvm::CallBase::getOperandBundlesAsDefs(), ignoreCallingConv(), isCallingConvCCompatible(), llvm::Instruction::isFast(), llvm::CallBase::isNoBuiltin(), llvm::Intrinsic::log, llvm::Intrinsic::pow, llvm::Value::replaceAllUsesWith(), and llvm::Intrinsic::sqrt.
Referenced by isSafeToEliminateVarargsCast().