Lines Matching refs:Function
84 bool OptimizeEmptyGlobalCXXDtors(Function *CXAAtExitFn);
141 /// null/false. When the first accessing function is noticed, it is recorded.
142 /// When a second different accessing function is noticed,
144 const Function *AccessingFunction;
207 const Function *F = I->getParent()->getParent();
1017 /// OptimizeGlobalAddressOfMalloc - This function takes the specified global
1544 // end of the function as they are unlikely to be executed.
1659 /// TryToOptimizeStoreOfMallocToGlobal - This function is called when we see a
1942 // If this is a first class global and has only one accessing function
1943 // and this function is main (which we know is not recursive we can make
1945 // in this function.
2062 /// function, changing them to FastCC.
2063 static void ChangeCalleesToFastCall(Function *F) {
2085 static void RemoveNestAttribute(Function *F) {
2099 Function *F = FI++;
2111 // If this function has C calling conventions, is not a varargs
2112 // function, and is only called directly, promote it to use the Fast
2122 // The function is not used by a trampoline intrinsic, so it is safe
2175 // Must have a function or null ptr.
2176 if (!isa<Function>(CS->getOperand(1)))
2190 static std::vector<Function*> ParseGlobalCtors(GlobalVariable *GV) {
2192 return std::vector<Function*>();
2194 std::vector<Function*> Result;
2198 Result.push_back(dyn_cast<Function>(CS->getOperand(1)));
2206 const std::vector<Function*> &Ctors) {
2276 /// This function should be called if C was not found (but just got inserted)
2487 /// EvaluateFunction - Evaluate a call to function F, returning true if
2489 /// arguments for the function.
2490 bool EvaluateFunction(Function *F, Constant *&RetVal,
2521 /// here. The back of the vector contains the current function and the stack
2528 SmallVector<Function*, 4> CallStack;
2807 // Resolve function pointers.
2808 Function *Callee = dyn_cast<Function>(getVal(CS.getCalledValue()));
2810 DEBUG(dbgs() << "Can not resolve function pointer.\n");
2819 // If this is a function we can constant fold, do it.
2822 DEBUG(dbgs() << "Constant folded function call. Result: " <<
2825 DEBUG(dbgs() << "Can not constant fold function call.\n");
2830 DEBUG(dbgs() << "Can not constant fold vararg function call.\n");
2838 DEBUG(dbgs() << "Failed to evaluate function.\n");
2845 DEBUG(dbgs() << "Successfully evaluated function. Result: " <<
2848 DEBUG(dbgs() << "Successfully evaluated function. Result: 0\n\n");
2912 /// EvaluateFunction - Evaluate a call to function F, returning true if
2914 /// arguments for the function.
2915 bool Evaluator::EvaluateFunction(Function *F, Constant *&RetVal,
2917 // Check to see if this function is already executing (recursion). If so,
2926 for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E;
2958 // executed the new block before. If so, we have a looping function,
2976 /// EvaluateStaticConstructor - Evaluate static constructors in the function, if
2978 static bool EvaluateStaticConstructor(Function *F, const DataLayout *TD,
2980 // Call the function.
2988 DEBUG(dbgs() << "FULLY EVALUATED GLOBAL CTOR FUNCTION '"
3007 std::vector<Function*> Ctors = ParseGlobalCtors(GCL);
3013 Function *F = Ctors[i];
3101 static Function *FindCXAAtExit(Module &M, TargetLibraryInfo *TLI) {
3105 Function *Fn = M.getFunction(TLI->getName(LibFunc::cxa_atexit));
3112 // Checking that the function has the right return type, the right number of
3124 /// cxxDtorIsEmpty - Returns whether the given function is an empty C++
3127 /// the code so we only look for a function with a single basic block, where
3130 static bool cxxDtorIsEmpty(const Function &Fn,
3131 SmallPtrSet<const Function *, 8> &CalledFunctions) {
3148 const Function *CalledFn = CI->getCalledFunction();
3153 SmallPtrSet<const Function *, 8> NewCalledFunctions(CalledFunctions);
3170 bool GlobalOpt::OptimizeEmptyGlobalCXXDtors(Function *CXAAtExitFn) {
3174 /// destruction on exit, a termination function is registered as follows:
3183 // This pass will look for calls to __cxa_atexit where the function is trivial
3187 for (Function::use_iterator I = CXAAtExitFn->use_begin(),
3196 Function *DtorFn =
3197 dyn_cast<Function>(CI->getArgOperand(0)->stripPointerCasts());
3201 SmallPtrSet<const Function *, 8> CalledFunctions;
3226 Function *CXAAtExitFn = FindCXAAtExit(M, TLI);