25 #define DEBUG_TYPE "partially-inline-libcalls" 53 PHINode *Phi = Builder.CreatePHI(Ty, 2);
59 Builder.SetInsertPoint(LibCallBB);
61 Builder.Insert(LibCall);
62 Builder.CreateBr(JoinBB);
69 Builder.SetInsertPoint(&CurrBB);
71 ? Builder.CreateFCmpORD(Call, Call)
74 Builder.CreateCondBr(FCmp, JoinBB, LibCallBB);
106 if (CalledFunc->hasLocalLinkage() ||
139 class PartiallyInlineLibCallsLegacyPass :
public FunctionPass {
143 PartiallyInlineLibCallsLegacyPass() :
FunctionPass(ID) {
159 &getAnalysis<TargetLibraryInfoWrapperPass>().getTLI();
161 &getAnalysis<TargetTransformInfoWrapperPass>().getTTI(F);
169 "partially-inline-libcalls",
170 "Partially inline calls to library functions",
false,
175 "partially-inline-libcalls",
176 "Partially inline calls to library functions",
false,
false)
179 return new PartiallyInlineLibCallsLegacyPass();
SymbolTableList< Instruction >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
Function * getCalledFunction() const
Return the function called, or null if this is an indirect function invocation.
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.
void addAttribute(unsigned i, Attribute::AttrKind Kind)
adds the attribute to the list of attributes.
Compute iterated dominance frontiers using a linear time algorithm.
BasicBlock * SplitBlock(BasicBlock *Old, Instruction *SplitPt, DominatorTree *DT=nullptr, LoopInfo *LI=nullptr)
Split the specified block at the specified instruction - everything before SplitPt stays in Old and e...
This class represents a function call, abstracting a target machine's calling convention.
Analysis pass providing the TargetTransformInfo.
LLVMContext & getContext() const
Get the context in which this basic block lives.
bool onlyReadsMemory() const
Determine if the call does not access or only reads memory.
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
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 isNoBuiltin() const
Return true if the call should not be treated as a call to a builtin.
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.
static PreservedAnalyses none()
Convenience factory function for the empty preserved set.
Value * getOperand(unsigned i_nocapture) const
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...
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 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.
const Function * getParent() const
Return the enclosing method, or null if none.
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)
A container for analyses that lazily runs them and caches their results.
void initializePartiallyInlineLibCallsLegacyPassPass(PassRegistry &)
const TerminatorInst * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...