26 #define DEBUG_TYPE "partially-inline-libcalls" 28 DEBUG_COUNTER(PILCounter,
"partially-inline-libcalls-transform",
29 "Controls transformations in partially-inline-libcalls");
59 PHINode *Phi = Builder.CreatePHI(Ty, 2);
65 Builder.SetInsertPoint(LibCallBB);
67 Builder.Insert(LibCall);
68 Builder.CreateBr(JoinBB);
75 Builder.SetInsertPoint(&CurrBB);
77 ? Builder.CreateFCmpORD(Call, Call)
80 Builder.CreateCondBr(FCmp, JoinBB, LibCallBB);
112 if (CalledFunc->hasLocalLinkage() ||
145 class PartiallyInlineLibCallsLegacyPass :
public FunctionPass {
149 PartiallyInlineLibCallsLegacyPass() :
FunctionPass(ID) {
165 &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
167 &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
175 "partially-inline-libcalls",
176 "Partially inline calls to library functions",
false,
181 "partially-inline-libcalls",
182 "Partially inline calls to library functions",
false,
false)
185 return new PartiallyInlineLibCallsLegacyPass();
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
void addIncoming(Value *V, BasicBlock *BB)
Add an incoming value to the end of the PHI list.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
NodeTy * getNextNode()
Get the next node, or nullptr for the list tail.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
This class represents lattice values for constants.
This class represents a function call, abstracting a target machine's calling convention.
Analysis pass providing the TargetTransformInfo.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
LLVMContext & getContext() const
Get the context in which this basic block lives.
iterator begin()
Instruction iterator methods.
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
INITIALIZE_PASS_BEGIN(PartiallyInlineLibCallsLegacyPass, "partially-inline-libcalls", "Partially inline calls to library functions", false, false) INITIALIZE_PASS_END(PartiallyInlineLibCallsLegacyPass
This file provides an implementation of debug counters.
DEBUG_COUNTER(PILCounter, "partially-inline-libcalls-transform", "Controls transformations in partially-inline-libcalls")
FunctionPass * createPartiallyInlineLibCallsPass()
Instruction * clone() const
Create a copy of 'this' instruction that is identical in all ways except the following: ...
virtual void getAnalysisUsage(AnalysisUsage &) const
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
Type * getType() const
All values are typed, get the type of this value.
bool has(LibFunc F) const
Tests whether a library function is available.
void replaceAllUsesWith(Value *V)
Change all uses of this to point to a new Value.
Value * getOperand(unsigned i) const
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
static bool runOnFunction(Function &F, bool PostInlining)
A set of analyses that are preserved following a run of a transformation pass.
LLVM Basic Block Representation.
The instances of the Type class are immutable: once they are created, they are never changed...
bool isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
static bool runPartiallyInlineLibCalls(Function &F, TargetLibraryInfo *TLI, const TargetTransformInfo *TTI)
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Represent the analysis usage information of a pass.
FunctionPass class - This class is used to implement most global optimizations.
static BasicBlock * Create(LLVMContext &Context, const Twine &Name="", Function *Parent=nullptr, BasicBlock *InsertBefore=nullptr)
Creates a new BasicBlock.
self_iterator getIterator()
static bool shouldExecute(unsigned CounterName)
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
Iterator for intrusive lists based on ilist_node.
Provides information about what library functions are available for the current target.
static Constant * get(Type *Ty, double V)
This returns a ConstantFP, or a vector containing a splat of a ConstantFP, for the specified value in...
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation.
const Function * getParent() const
Return the enclosing method, or null if none.
bool onlyReadsMemory(unsigned OpNo) const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Analysis pass providing the TargetLibraryInfo.
LLVM Value Representation.
static bool optimizeSQRT(CallInst *Call, Function *CalledFunc, BasicBlock &CurrBB, Function::iterator &BB, const TargetTransformInfo *TTI)
BasicBlock * SplitBlock(BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr, MemorySSAUpdater *MSSAU=nullptr)
Split the specified block at the specified instruction - everything before SplitPt stays in Old and e...
A container for analyses that lazily runs them and caches their results.
void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &)