diff options
47 files changed, 633 insertions, 633 deletions
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 5236435d20..15a27e7a47 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -1,10 +1,10 @@ //===- AliasAnalysis.cpp - Generic Alias Analysis Interface Implementation -==// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements the generic AliasAnalysis interface which is used as the diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp index 86fbbe63b2..8c8cb3e1d4 100644 --- a/lib/Analysis/AliasAnalysisCounter.cpp +++ b/lib/Analysis/AliasAnalysisCounter.cpp @@ -1,10 +1,10 @@ //===- AliasAnalysisCounter.cpp - Alias Analysis Query Counter ------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements a pass which can be used to count how many alias queries @@ -67,7 +67,7 @@ namespace { printLine("mod/ref", MR, MRSum); std::cerr << " Mod/Ref Analysis Counter Summary: " << NoMR*100/MRSum<< "%/" - << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/" + << JustRef*100/MRSum << "%/" << JustMod*100/MRSum << "%/" << MR*100/MRSum <<"%\n\n"; } } @@ -96,8 +96,8 @@ namespace { bool onlyReadsMemory(Function *F) { return getAnalysis<AliasAnalysis>().onlyReadsMemory(F); } - - + + // Forwarding functions: just delegate to a real AA implementation, counting // the number of responses... AliasResult alias(const Value *V1, unsigned V1Size, @@ -118,11 +118,11 @@ ModulePass *llvm::createAliasAnalysisCounterPass() { return new AliasAnalysisCounter(); } -AliasAnalysis::AliasResult +AliasAnalysis::AliasResult AliasAnalysisCounter::alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { AliasResult R = getAnalysis<AliasAnalysis>().alias(V1, V1Size, V2, V2Size); - + const char *AliasString; switch (R) { default: assert(0 && "Unknown alias type!"); @@ -142,7 +142,7 @@ AliasAnalysisCounter::alias(const Value *V1, unsigned V1Size, return R; } -AliasAnalysis::ModRefResult +AliasAnalysis::ModRefResult AliasAnalysisCounter::getModRefInfo(CallSite CS, Value *P, unsigned Size) { ModRefResult R = getAnalysis<AliasAnalysis>().getModRefInfo(CS, P, Size); diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index c4ec8db3e1..f42fde8997 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -1,10 +1,10 @@ //===- AliasAnalysisEvaluator.cpp - Alias Analysis Accuracy Evaluator -----===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements a simple N^2 alias analysis accuracy evaluator. @@ -54,16 +54,16 @@ namespace { AU.addRequired<AliasAnalysis>(); AU.setPreservesAll(); } - - bool doInitialization(Module &M) { - NoAlias = MayAlias = MustAlias = 0; + + bool doInitialization(Module &M) { + NoAlias = MayAlias = MustAlias = 0; NoModRef = Mod = Ref = ModRef = 0; if (PrintAll) { PrintNoAlias = PrintMayAlias = PrintMustAlias = true; PrintNoModRef = PrintMod = PrintRef = PrintModRef = true; } - return false; + return false; } bool runOnFunction(Function &F); @@ -85,7 +85,7 @@ static inline void PrintResults(const char *Msg, bool P, Value *V1, Value *V2, } } -static inline void +static inline void PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, Module *M) { if (P) { @@ -99,7 +99,7 @@ bool AAEval::runOnFunction(Function &F) { AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); const TargetData &TD = AA.getTargetData(); - + std::set<Value *> Pointers; std::set<CallSite> CallSites; @@ -157,16 +157,16 @@ bool AAEval::runOnFunction(Function &F) { } // Mod/ref alias analysis: compare all pairs of calls and values - for (std::set<CallSite>::iterator C = CallSites.begin(), + for (std::set<CallSite>::iterator C = CallSites.begin(), Ce = CallSites.end(); C != Ce; ++C) { Instruction *I = C->getInstruction(); - + for (std::set<Value *>::iterator V = Pointers.begin(), Ve = Pointers.end(); V != Ve; ++V) { unsigned Size = 0; const Type *ElTy = cast<PointerType>((*V)->getType())->getElementType(); if (ElTy->isSized()) Size = TD.getTypeSize(ElTy); - + switch (AA.getModRefInfo(*C, *V, Size)) { case AliasAnalysis::NoModRef: PrintModRefResults("NoModRef", PrintNoModRef, I, *V, F.getParent()); @@ -185,7 +185,7 @@ bool AAEval::runOnFunction(Function &F) { } } } - + return false; } @@ -199,7 +199,7 @@ bool AAEval::doFinalization(Module &M) { std::cerr << "===== Alias Analysis Evaluator Report =====\n"; if (AliasSum == 0) { std::cerr << " Alias Analysis Evaluator Summary: No pointers!\n"; - } else { + } else { std::cerr << " " << AliasSum << " Total Alias Queries Performed\n"; std::cerr << " " << NoAlias << " no alias responses "; PrintPercent(NoAlias, AliasSum); @@ -207,8 +207,8 @@ bool AAEval::doFinalization(Module &M) { PrintPercent(MayAlias, AliasSum); std::cerr << " " << MustAlias << " must alias responses "; PrintPercent(MustAlias, AliasSum); - std::cerr << " Alias Analysis Evaluator Pointer Alias Summary: " - << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" + std::cerr << " Alias Analysis Evaluator Pointer Alias Summary: " + << NoAlias*100/AliasSum << "%/" << MayAlias*100/AliasSum << "%/" << MustAlias*100/AliasSum << "%\n"; } @@ -226,8 +226,8 @@ bool AAEval::doFinalization(Module &M) { PrintPercent(Ref, ModRefSum); std::cerr << " " << ModRef << " mod & ref responses "; PrintPercent(ModRef, ModRefSum); - std::cerr << " Alias Analysis Evaluator Mod/Ref Summary: " - << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" + std::cerr << " Alias Analysis Evaluator Mod/Ref Summary: " + << NoModRef*100/ModRefSum << "%/" << Mod*100/ModRefSum << "%/" << Ref*100/ModRefSum << "%/" << ModRef*100/ModRefSum << "%\n"; } diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp index 73baf4a1b1..9ae4044b0e 100644 --- a/lib/Analysis/AliasSetTracker.cpp +++ b/lib/Analysis/AliasSetTracker.cpp @@ -1,14 +1,14 @@ //===- AliasSetTracker.cpp - Alias Sets Tracker implementation-------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements the AliasSetTracker and AliasSet classes. -// +// //===----------------------------------------------------------------------===// #include "llvm/Analysis/AliasSetTracker.h" @@ -53,7 +53,7 @@ void AliasSet::mergeSetIn(AliasSet &AS, AliasSetTracker &AST) { CallSites.insert(CallSites.end(), AS.CallSites.begin(), AS.CallSites.end()); AS.CallSites.clear(); } - + AS.Forward = this; // Forward across AS now... addRef(); // AS is now pointing to us... @@ -506,7 +506,7 @@ void AliasSet::print(std::ostream &OS) const { for (unsigned i = 0, e = CallSites.size(); i != e; ++i) { if (i) OS << ", "; WriteAsOperand(OS, CallSites[i].getCalledValue()); - } + } } OS << "\n"; } diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 98508a8c14..ece6ce5a6f 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -1,10 +1,10 @@ //===- BasicAliasAnalysis.cpp - Local Alias Analysis Impl -----------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines the default implementation of the Alias Analysis interface @@ -39,7 +39,7 @@ namespace { virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<TargetData>(); } - + virtual void initializePass() { TD = &getAnalysis<TargetData>(); } @@ -53,7 +53,7 @@ namespace { std::vector<PointerAccessInfo> *Info) { return UnknownModRefBehavior; } - + virtual void getArgumentAccesses(Function *F, CallSite CS, std::vector<PointerAccessInfo> &Info) { assert(0 && "This method may not be called on this function!"); @@ -72,7 +72,7 @@ namespace { virtual void deleteValue(Value *V) {} virtual void copyValue(Value *From, Value *To) {} }; - + // Register this pass... RegisterOpt<NoAA> U("no-aa", "No Alias Analysis (always returns 'may' alias)"); @@ -106,7 +106,7 @@ namespace { virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS, std::vector<PointerAccessInfo> *Info); - + private: // CheckGEPInstructions - Check two GEP instructions with known // must-aliasing base pointers. This checks to see if the index expressions @@ -117,7 +117,7 @@ namespace { const Type *BasePtr2Ty, std::vector<Value*> &GEP2Ops, unsigned G2Size); }; - + // Register this pass... RegisterOpt<BasicAliasAnalysis> X("basicaa", "Basic Alias Analysis (default AA impl)"); @@ -144,7 +144,7 @@ static const Value *getUnderlyingObject(const Value *V) { // If we are at some type of object... return it. if (hasUniqueAddress(V) || isa<Argument>(V)) return V; - + // Traverse through different addressing mechanisms... if (const Instruction *I = dyn_cast<Instruction>(V)) { if (isa<CastInst>(I) || isa<GetElementPtrInst>(I)) @@ -307,7 +307,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, if (!isa<Argument>(O1) && isa<ConstantPointerNull>(V2)) return NoAlias; // Unique values don't alias null - if (isa<GlobalVariable>(O1) || + if (isa<GlobalVariable>(O1) || (isa<AllocationInst>(O1) && !cast<AllocationInst>(O1)->isArrayAllocation())) if (cast<PointerType>(O1->getType())->getElementType()->isSized()) { @@ -351,12 +351,12 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, do { BasePtr1 = cast<User>(BasePtr1)->getOperand(0); } while (isGEP(BasePtr1) && - cast<User>(BasePtr1)->getOperand(1) == + cast<User>(BasePtr1)->getOperand(1) == Constant::getNullValue(cast<User>(BasePtr1)->getOperand(1)->getType())); do { BasePtr2 = cast<User>(BasePtr2)->getOperand(0); } while (isGEP(BasePtr2) && - cast<User>(BasePtr2)->getOperand(1) == + cast<User>(BasePtr2)->getOperand(1) == Constant::getNullValue(cast<User>(BasePtr2)->getOperand(1)->getType())); // Do the base pointers alias? @@ -423,7 +423,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, if (ConstantFound) { if (V2Size <= 1 && V1Size <= 1) // Just pointer check? return NoAlias; - + // Otherwise we have to check to see that the distance is more than // the size of the argument... build an index vector that is equal to // the arguments provided, except substitute 0's for any variable @@ -443,7 +443,7 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, } } } - + return MayAlias; } @@ -503,7 +503,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, // If so, return mustalias. if (UnequalOper == MinOperands) { if (GEP1Ops.size() < GEP2Ops.size()) std::swap(GEP1Ops, GEP2Ops); - + bool AllAreZeros = true; for (unsigned i = UnequalOper; i != MaxOperands; ++i) if (!isa<Constant>(GEP1Ops[i]) || @@ -514,7 +514,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, if (AllAreZeros) return MustAlias; } - + // So now we know that the indexes derived from the base pointers, // which are known to alias, are different. We can still determine a // no-alias result if there are differing constant pairs in the index @@ -530,7 +530,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, for (; FirstConstantOper != MinOperands; ++FirstConstantOper) { const Value *G1Oper = GEP1Ops[FirstConstantOper]; const Value *G2Oper = GEP2Ops[FirstConstantOper]; - + if (G1Oper != G2Oper) // Found non-equal constant indexes... if (Constant *G1OC = dyn_cast<ConstantInt>(const_cast<Value*>(G1Oper))) if (Constant *G2OC = dyn_cast<ConstantInt>(const_cast<Value*>(G2Oper))){ @@ -555,7 +555,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, } BasePtr1Ty = cast<CompositeType>(BasePtr1Ty)->getTypeAtIndex(G1Oper); } - + // No shared constant operands, and we ran out of common operands. At this // point, the GEP instructions have run through all of their operands, and we // haven't found evidence that there are any deltas between the GEP's. @@ -585,13 +585,13 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, // Now crop off any constants from the end... GEP1Ops.resize(MinOperands); int64_t Offset2 = TD.getIndexedOffset(GEPPointerTy, GEP1Ops); - + // If the tail provided a bit enough offset, return noalias! if ((uint64_t)(Offset2-Offset1) >= SizeMax) return NoAlias; } } - + // Couldn't find anything useful. return MayAlias; } @@ -604,7 +604,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, // Advance BasePtr[12]Ty over this first differing constant operand. BasePtr2Ty = cast<CompositeType>(BasePtr1Ty)->getTypeAtIndex(GEP2Ops[FirstConstantOper]); BasePtr1Ty = cast<CompositeType>(BasePtr1Ty)->getTypeAtIndex(GEP1Ops[FirstConstantOper]); - + // We are going to be using TargetData::getIndexedOffset to determine the // offset that each of the GEP's is reaching. To do this, we have to convert // all variable references to constant references. To do this, we convert the @@ -614,7 +614,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, GEP1Ops[i] = GEP2Ops[i] = Constant::getNullValue(Type::UIntTy); // We know that GEP1Ops[FirstConstantOper] & GEP2Ops[FirstConstantOper] are ok - + // Loop over the rest of the operands... for (unsigned i = FirstConstantOper+1; i != MaxOperands; ++i) { const Value *Op1 = i < GEP1Ops.size() ? GEP1Ops[i] : 0; @@ -631,7 +631,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) if (Op1C->getRawValue() >= AT->getNumElements()) return MayAlias; // Be conservative with out-of-range accesses - + } else { // GEP1 is known to produce a value less than GEP2. To be // conservatively correct, we must assume the largest possible @@ -647,7 +647,7 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, GEP1Ops[i] = ConstantSInt::get(Type::LongTy,AT->getNumElements()-1); } } - + if (Op2) { if (const ConstantInt *Op2C = dyn_cast<ConstantInt>(Op2)) { // If this is an array index, make sure the array element is in range. @@ -674,14 +674,14 @@ CheckGEPInstructions(const Type* BasePtr1Ty, std::vector<Value*> &GEP1Ops, BasePtr2Ty = 0; } } - + if (GEPPointerTy->getElementType()->isSized()) { int64_t Offset1 = getTargetData().getIndexedOffset(GEPPointerTy, GEP1Ops); int64_t Offset2 = getTargetData().getIndexedOffset(GEPPointerTy, GEP2Ops); assert(Offset1<Offset2 && "There is at least one different constant here!"); if ((uint64_t)(Offset2-Offset1) >= SizeMax) { - //std::cerr << "Determined that these two GEP's don't alias [" + //std::cerr << "Determined that these two GEP's don't alias [" // << SizeMax << " bytes]: \n" << *GEP1 << *GEP2; return NoAlias; } @@ -706,11 +706,11 @@ static const char *DoesntAccessMemoryTable[] = { "abs", "labs", "llabs", "imaxabs", "fabs", "fabsf", "fabsl", "trunc", "truncf", "truncl", "ldexp", - + "atan", "atanf", "atanl", "atan2", "atan2f", "atan2l", "cbrt", "cos", "cosf", "cosl", "cosh", "coshf", "coshl", - "exp", "expf", "expl", + "exp", "expf", "expl", "hypot", "sin", "sinf", "sinl", "sinh", "sinhf", "sinhl", "tan", "tanf", "tanl", "tanh", "tanhf", "tanhl", @@ -723,9 +723,9 @@ static const char *DoesntAccessMemoryTable[] = { "iswalnum", "iswalpha", "iswcntrl", "iswdigit", "iswgraph", "iswlower", "iswprint", "iswpunct", "iswspace", "iswupper", "iswxdigit", - "iswctype", "towctrans", "towlower", "towupper", + "iswctype", "towctrans", "towlower", "towupper", - "btowc", "wctob", + "btowc", "wctob", "isinf", "isnan", "finite", @@ -744,16 +744,16 @@ static const unsigned DAMTableSize = static const char *OnlyReadsMemoryTable[] = { "atoi", "atol", "atof", "atoll", "atoq", "a64l", - "bcmp", "memcmp", "memchr", "memrchr", "wmemcmp", "wmemchr", + "bcmp", "memcmp", "memchr", "memrchr", "wmemcmp", "wmemchr", // Strings "strcmp", "strcasecmp", "strcoll", "strncmp", "strncasecmp", - "strchr", "strcspn", "strlen", "strpbrk", "strrchr", "strspn", "strstr", + "strchr", "strcspn", "strlen", "strpbrk", "strrchr", "strspn", "strstr", "index", "rindex", // Wide char strings "wcschr", "wcscmp", "wcscoll", "wcscspn", "wcslen", "wcsncmp", "wcspbrk", - "wcsrchr", "wcsspn", "wcsstr", + "wcsrchr", "wcsspn", "wcsstr", // glibc "alphasort", "alphasort64", "versionsort", "versionsort64", @@ -768,8 +768,8 @@ static const char *OnlyReadsMemoryTable[] = { static const unsigned ORMTableSize = sizeof(OnlyReadsMemoryTable)/sizeof(OnlyReadsMemoryTable[0]); - -AliasAnalysis::ModRefBehavior + +AliasAnalysis::ModRefBehavior BasicAliasAnalysis::getModRefBehavior(Function *F, CallSite CS, std::vector<PointerAccessInfo> *Info) { if (!F->isExternal()) return UnknownModRefBehavior; @@ -789,7 +789,7 @@ BasicAliasAnalysis::getModRefBehavior(Function *F, CallSite CS, F->getName().c_str(), StringCompare()); if (Ptr != DoesntAccessMemoryTable+DAMTableSize && *Ptr == F->getName()) return DoesNotAccessMemory; - + Ptr = std::lower_bound(OnlyReadsMemoryTable, OnlyReadsMemoryTable+ORMTableSize, F->getName().c_str(), StringCompare()); diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp index c19bbad55c..53b40ec502 100644 --- a/lib/Analysis/CFGPrinter.cpp +++ b/lib/Analysis/CFGPrinter.cpp @@ -1,10 +1,10 @@ //===- CFGPrinter.cpp - DOT printer for the control flow graph ------------===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file defines a '-print-cfg' analysis pass, which emits the @@ -92,7 +92,7 @@ namespace { std::string Filename = "cfg." + F.getName() + ".dot"; std::cerr << "Writing '" << Filename << "'..."; std::ofstream File(Filename.c_str()); - + if (File.good()) WriteGraph(File, (const Function*)&F); else @@ -102,7 +102,7 @@ namespace { } void print(std::ostream &OS, const Module* = 0) const {} - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } @@ -120,7 +120,7 @@ namespace { return false; } void print(std::ostream &OS, const Module* = 0) const {} - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); } @@ -140,7 +140,7 @@ void Function::viewCFG() const { std::string Filename = "/tmp/cfg." + getName() + ".dot"; std::cerr << "Writing '" << Filename << "'... "; std::ofstream F(Filename.c_str()); - + if (!F.good()) { std::cerr << " error opening file for writing!\n"; return; diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp index 4f244b3a36..aa5144437d 100644 --- a/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -1,10 +1,10 @@ //===- BottomUpClosure.cpp - Compute bottom-up interprocedural closure ----===// -// +// // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. -// +// //===----------------------------------------------------------------------===// // // This file implements the BUDataStructures class, which represents the @@ -26,7 +26,7 @@ namespace { Statistic<> MaxSCC("budatastructure", "Maximum SCC Size in Call Graph"); Statistic<> NumBUInlines("budatastructures", "Number of graphs inlined"); Statistic<> NumCallEdges("budatastructures", "Number of 'actual' call edges"); - + RegisterAnalysis<BUDataStructures> X("budatastructure", "Bottom-up Data Structure Analysis"); } @@ -48,23 +48,23 @@ static void BuildGlobalECs(DSGraph &GG, std::set<GlobalValue*> &ECGlobals) { GlobalValue *First = GVs[0]; for (unsigned i = 1, e = GVs.size(); i != e; ++i) GlobalECs.unionSets(First, |