diff options
Diffstat (limited to 'include/llvm/Analysis')
29 files changed, 198 insertions, 198 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h index 0857190c5c..c63d9908e2 100644 --- a/include/llvm/Analysis/AliasAnalysis.h +++ b/include/llvm/Analysis/AliasAnalysis.h @@ -1,10 +1,10 @@ //===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===// -// +// // 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 generic AliasAnalysis interface, which is used as the @@ -50,7 +50,7 @@ protected: /// called multiple times. /// void InitializeAliasAnalysis(Pass *P); - + // getAnalysisUsage - All alias analysis implementations should invoke this // directly (using AliasAnalysis::getAnalysisUsage(AU)) to make sure that // TargetData is required by the pass. @@ -108,8 +108,8 @@ public: /// bits which may be or'd together. /// enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 }; - - + + /// ModRefBehavior - Summary of how a function affects memory in the program. /// Loads from constant globals are not considered memory accesses for this /// interface. Also, functions may freely modify stack space local to their @@ -120,14 +120,14 @@ public: // // This property corresponds to the GCC 'const' attribute. DoesNotAccessMemory, - + // AccessesArguments - This function accesses function arguments in // non-volatile and well known ways, but does not access any other memory. // // Clients may call getArgumentAccesses to get specific information about // how pointer arguments are used. AccessesArguments, - + // AccessesArgumentsAndGlobals - This function has accesses function // arguments and global variables in non-volatile and well-known ways, but // does not access any other memory. @@ -135,18 +135,18 @@ public: // Clients may call getArgumentAccesses to get specific information about // how pointer arguments and globals are used. AccessesArgumentsAndGlobals, - + // OnlyReadsMemory - This function does not perform any non-local stores or // volatile loads, but may read from any memory location. // // This property corresponds to the GCC 'pure' attribute. OnlyReadsMemory, - + // UnknownModRefBehavior - This indicates that the function could not be // classified into one of the behaviors above. UnknownModRefBehavior }; - + /// PointerAccessInfo - This struct is used to return results for pointers, /// globals, and the return value of a function. struct PointerAccessInfo { @@ -154,11 +154,11 @@ public: /// the function, a GlobalVariable, or null, corresponding to the return /// value for the function. Value *V; - + /// ModRefInfo - Whether the pointer is loaded or stored to/from. /// ModRefResult ModRefInfo; - + /// AccessType - Specific fine-grained access information for the argument. /// If none of these classifications is general enough, the /// getModRefBehavior method should not return AccessesArguments*. If a @@ -168,25 +168,25 @@ public: /// ScalarAccess - The pointer is dereferenced. /// ScalarAccess, - + /// ArrayAccess - The pointer is indexed through as an array of elements. /// ArrayAccess, - + /// ElementAccess ?? P->F only? - + /// CallsThrough - Indirect calls are made through the specified function /// pointer. CallsThrough, }; - }; - + }; + /// getModRefBehavior - Return the behavior of the specified function if /// called from the specified call site. The call site may be null in which /// case the most generic behavior of this function should be returned. virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS, std::vector<PointerAccessInfo> *Info = 0); - + /// doesNotAccessMemory - If the specified function is known to never read or /// write memory, return true. If the function only reads from known-constant /// memory, it is also legal to return true. Functions that unwind the stack diff --git a/include/llvm/Analysis/AliasSetTracker.h b/include/llvm/Analysis/AliasSetTracker.h index cf8c558c12..2f693d41f8 100644 --- a/include/llvm/Analysis/AliasSetTracker.h +++ b/include/llvm/Analysis/AliasSetTracker.h @@ -1,17 +1,17 @@ //===- llvm/Analysis/AliasSetTracker.h - Build Alias Sets -------*- C++ -*-===// -// +// // 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 two classes: AliasSetTracker and AliasSet. These interface // are used to classify a collection of pointer references into a maximal number // of disjoint sets. Each AliasSet object constructed by the AliasSetTracker // object refers to memory disjoint from the other sets. -// +// //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_ALIASSETTRACKER_H @@ -58,7 +58,7 @@ class AliasSet { unsigned getSize() const { return Size; } - AliasSet *getAliasSet(AliasSetTracker &AST) { + AliasSet *getAliasSet(AliasSetTracker &AST) { assert(AS && "No AliasSet yet!"); if (AS->Forward) { AliasSet *OldAS = AS; @@ -163,7 +163,7 @@ public: HashNodePair *CurNode; public: iterator(HashNodePair *CN = 0) : CurNode(CN) {} - + bool operator==(const iterator& x) const { return CurNode == x.CurNode; } @@ -173,7 +173,7 @@ public: CurNode = I.CurNode; return *this; } - + value_type &operator*() const { assert(CurNode && "Dereferencing AliasSet.end()!"); return *CurNode; @@ -182,14 +182,14 @@ public: Value *getPointer() const { return CurNode->first; } unsigned getSize() const { return CurNode->second.getSize(); } - + iterator& operator++() { // Preincrement assert(CurNode && "Advancing past AliasSet.end()!"); CurNode = CurNode->second.getNext(); return *this; } iterator operator++(int) { // Postincrement - iterator tmp = *this; ++*this; return tmp; + iterator tmp = *this; ++*this; return tmp; } }; @@ -306,7 +306,7 @@ public: AliasSet *getAliasSetForPointerIfExists(Value *P, unsigned Size) { return findAliasSetForPointer(P, Size); } - + /// containsPointer - Return true if the specified location is represented by /// this alias set, false otherwise. This does not modify the AST object or /// alias sets. diff --git a/include/llvm/Analysis/CFGPrinter.h b/include/llvm/Analysis/CFGPrinter.h index fb3fbdda79..3567db1c71 100644 --- a/include/llvm/Analysis/CFGPrinter.h +++ b/include/llvm/Analysis/CFGPrinter.h @@ -1,10 +1,10 @@ //===-- CFGPrinter.h - CFG printer external interface ------------*- C++ -*-===// -// +// // 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 external functions that can be called to explicitly diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h index 446ea500d4..fee5147761 100644 --- a/include/llvm/Analysis/CallGraph.h +++ b/include/llvm/Analysis/CallGraph.h @@ -1,13 +1,13 @@ //===- CallGraph.h - Build a Module's call graph ----------------*- C++ -*-===// -// +// // 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 interface is used to build and manipulate a call graph, which is a very +// This interface is used to build and manipulate a call graph, which is a very // useful tool for interprocedural optimization. // // Every function in a module is represented as a node in the call graph. The diff --git a/include/llvm/Analysis/ConstantsScanner.h b/include/llvm/Analysis/ConstantsScanner.h index 48c0bd0875..bf0772dbf1 100644 --- a/include/llvm/Analysis/ConstantsScanner.h +++ b/include/llvm/Analysis/ConstantsScanner.h @@ -1,10 +1,10 @@ //==- llvm/Analysis/ConstantsScanner.h - Iterate over constants -*- C++ -*-===// -// +// // 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 class implements an iterator to walk through the constants referenced by @@ -48,7 +48,7 @@ public: : InstI(inst_end(F)), OpIdx(0) { } - inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx && + inline bool operator==(const _Self& x) const { return OpIdx == x.OpIdx && InstI == x.InstI; } inline bool operator!=(const _Self& x) const { return !operator==(x); } @@ -75,7 +75,7 @@ public: } inline _Self operator++(int) { // Postincrement - _Self tmp = *this; ++*this; return tmp; + _Self tmp = *this; ++*this; return tmp; } inline bool atEnd() const { return InstI.atEnd(); } diff --git a/include/llvm/Analysis/DataStructure/DSGraph.h b/include/llvm/Analysis/DataStructure/DSGraph.h index 430a7bf281..f38b59eb06 100644 --- a/include/llvm/Analysis/DataStructure/DSGraph.h +++ b/include/llvm/Analysis/DataStructure/DSGraph.h @@ -1,10 +1,10 @@ //===- DSGraph.h - Represent a collection of data structures ----*- C++ -*-===// -// +// // 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 header defines the data structure graph (DSGraph) and the @@ -25,14 +25,14 @@ namespace llvm { class GlobalValue; //===----------------------------------------------------------------------===// -/// DSScalarMap - An instance of this class is used to keep track of all of +/// DSScalarMap - An instance of this class is used to keep track of all of /// which DSNode each scalar in a function points to. This is specialized to -/// keep track of globals with nodes in the function, and to keep track of the +/// keep track of globals with nodes in the function, and to keep track of the /// unique DSNodeHandle being used by the scalar map. /// -/// This class is crucial to the efficiency of DSA with some large SCC's. In +/// This class is crucial to the efficiency of DSA with some large SCC's. In /// these cases, the cost of iterating over the scalar map dominates the cost -/// of DSA. In all of these cases, the DSA phase is really trying to identify +/// of DSA. In all of these cases, the DSA phase is really trying to identify /// globals or unique node handles active in the function. /// class DSScalarMap { @@ -48,7 +48,7 @@ public: EquivalenceClasses<GlobalValue*> &getGlobalECs() const { return GlobalECs; } - // Compatibility methods: provide an interface compatible with a map of + // Compatibility methods: provide an interface compatible with a map of // Value* to DSNodeHandle's. typedef ValueMapTy::const_iterator const_iterator; typedef ValueMapTy::iterator iterator; @@ -142,11 +142,11 @@ public: return ValueMap.insert(std::make_pair(V, DSNodeHandle())).first->second; } - void erase(iterator I) { + void erase(iterator I) { assert(I != ValueMap.end() && "Cannot erase end!"); if (GlobalValue *GV = dyn_cast<GlobalValue>(I->first)) GlobalSet.erase(GV); - ValueMap.erase(I); + ValueMap.erase(I); } void clear() { @@ -555,7 +555,7 @@ public: if (CloneFlags & DSGraph::StripIncompleteBit) BitsToKeep &= ~DSNode::Incomplete; } - + DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH); void merge(const DSNodeHandle &NH, const DSNodeHandle &SrcNH); diff --git a/include/llvm/Analysis/DataStructure/DSGraphTraits.h b/include/llvm/Analysis/DataStructure/DSGraphTraits.h index 5f8b8d0ade..6febf34625 100644 --- a/include/llvm/Analysis/DataStructure/DSGraphTraits.h +++ b/include/llvm/Analysis/DataStructure/DSGraphTraits.h @@ -1,10 +1,10 @@ //===- DSGraphTraits.h - Provide generic graph interface --------*- C++ -*-===// -// +// // 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 provides GraphTraits specializations for the DataStructure graph @@ -28,7 +28,7 @@ class DSNodeIterator : public forward_iterator<const DSNode, ptrdiff_t> { friend class DSNode; NodeTy * const Node; unsigned Offset; - + typedef DSNodeIterator<NodeTy> _Self; DSNodeIterator(NodeTy *N) : Node(N), Offset(0) {} // begin iterator @@ -56,7 +56,7 @@ public: Offset = I.Offset; return *this; } - + pointer operator*() const { if (Node->isDeadNode()) return Node->getForwardNode(); @@ -64,13 +64,13 @@ public: return Node->getLink(Offset).getNode(); } pointer operator->() const { return operator*(); } - + _Self& operator++() { // Preincrement Offset += (1 << DS::PointerShift); return *this; } _Self operator++(int) { // Postincrement - _Self tmp = *this; ++*this; return tmp; + _Self tmp = *this; ++*this; return tmp; } unsigned getOffset() const { return Offset; } diff --git a/include/llvm/Analysis/DataStructure/DSNode.h b/include/llvm/Analysis/DataStructure/DSNode.h index 10394ddd06..7ae167efdb 100644 --- a/include/llvm/Analysis/DataStructure/DSNode.h +++ b/include/llvm/Analysis/DataStructure/DSNode.h @@ -1,10 +1,10 @@ //===- DSNode.h - Node definition for datastructure graphs ------*- C++ -*-===// -// +// // 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. -// +// //===----------------------------------------------------------------------===// // // Data structure graph nodes and some implementation of DSNodeHandle. @@ -84,7 +84,7 @@ public: AllocaNode = 1 << 0, // This node was allocated with alloca HeapNode = 1 << 1, // This node was allocated with malloc GlobalNode = 1 << 2, // This node was allocated by a global var decl - UnknownNode = 1 << 3, // This node points to unknown allocated memory + UnknownNode = 1 << 3, // This node points to unknown allocated memory Incomplete = 1 << 4, // This node may not be complete Modified = 1 << 5, // This node is modified in this context @@ -97,7 +97,7 @@ public: Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode, }; - + /// NodeType - A union of the above bits. "Shadow" nodes do not add any flags /// to the nodes in the data structure graph, so it is possible to have nodes /// with a value of 0 for their NodeType. @@ -105,7 +105,7 @@ public: private: unsigned short NodeType; public: - + /// DSNode ctor - Create a node of the specified type, inserting it into the /// specified graph. /// diff --git a/include/llvm/Analysis/DataStructure/DSSupport.h b/include/llvm/Analysis/DataStructure/DSSupport.h index e4eb21bc23..2fc52db25f 100644 --- a/include/llvm/Analysis/DataStructure/DSSupport.h +++ b/include/llvm/Analysis/DataStructure/DSSupport.h @@ -1,10 +1,10 @@ //===- DSSupport.h - Support for datastructure graphs -----------*- C++ -*-===// -// +// // 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. -// +// //===----------------------------------------------------------------------===// // // Support for graph nodes, call sites, and types. @@ -161,7 +161,7 @@ namespace llvm { /// DSCallSite - Representation of a call site via its call instruction, /// the DSNode handle for the callee function (or function pointer), and /// the DSNode handles for the function arguments. -/// +/// class DSCallSite { CallSite Site; // Actual call site Function *CalleeF; // The function called (direct call) diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index 32299473f4..e110d581db 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -1,10 +1,10 @@ //===- DataStructure.h - Build data structure graphs ------------*- C++ -*-===// -// +// // 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. -// +// //===----------------------------------------------------------------------===// // // Implement the LLVM data structure analysis library. @@ -82,7 +82,7 @@ public: /// releaseMemory - if the pass pipeline is done with this pass, we can /// release our memory... - /// + /// virtual void releaseMemory(); /// getAnalysisUsage - This obviously provides a data structure graph. @@ -177,7 +177,7 @@ private: DSGraph &getOrCreateGraph(Function *F); unsigned calculateGraphs(Function *F, std::vector<Function*> &Stack, - unsigned &NextID, + unsigned &NextID, hash_map<Function*, unsigned> &ValMap); }; @@ -313,7 +313,7 @@ struct CompleteBUDataStructures : public BUDataStructures { private: unsigned calculateSCCGraphs(DSGraph &FG, std::vector<DSGraph*> &Stack, - unsigned &NextID, + unsigned &NextID, hash_map<DSGraph*, unsigned> &ValMap); DSGraph &getOrCreateGraph(Function &F); void processGraph(DSGraph &G); @@ -327,99 +327,99 @@ private: /// struct EquivClassGraphs : public ModulePass { CompleteBUDataStructures *CBU; - + DSGraph *GlobalsGraph; - + // DSInfo - one graph for each function. hash_map<const Function*, DSGraph*> DSInfo; - + /// ActualCallees - The actual functions callable from indirect call sites. /// std::set<std::pair<Instruction*, Function*> > ActualCallees; - + // Equivalence class where functions that can potentially be called via the // same function pointer are in the same class. EquivalenceClasses<Function*> FuncECs; - + /// OneCalledFunction - For each indirect call, we keep track of one /// target of the call. This is used to find equivalence class called by /// a call site. std::map<DSNode*, Function *> OneCalledFunction; - + /// GlobalECs - The equivalence classes for each global value that is merged /// with other global values in the DSGraphs. EquivalenceClasses<GlobalValue*> GlobalECs; - + public: /// EquivClassGraphs - Computes the equivalence classes and then the /// folded DS graphs for each class. - /// + /// virtual bool runOnModule(Module &M); - + /// print - Print out the analysis results... /// void print(std::ostream &O, const Module *M) const; - + EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; } - + /// getDSGraph - Return the data structure graph for the specified function. /// This returns the folded graph. The folded graph is the same as the CBU - /// graph iff the function is in a singleton equivalence class AND all its + /// graph iff the function is in a singleton equivalence class AND all its /// callees also have the same folded graph as the CBU graph. - /// + /// DSGraph &getDSGraph(const Function &F) const { hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F); assert(I != DSInfo.end() && "No graph computed for that function!"); return *I->second; } - + bool hasGraph(const Function &F) const { return DSInfo.find(&F) != DSInfo.end(); } - + /// ContainsDSGraphFor - Return true if we have a graph for the specified /// function. bool ContainsDSGraphFor(const Function &F) const { return DSInfo.find(&F) != DSInfo.end(); } - + /// getSomeCalleeForCallSite - Return any one callee function at /// a call site. - /// + /// Function *getSomeCalleeForCallSite(const CallSite &CS) const; - + DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } - + typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy; const ActualCalleesTy &getActualCallees() const { return ActualCallees; } - + typedef ActualCalleesTy::const_iterator callee_iterator; callee_iterator callee_begin(Instruction *I) const { return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0)); } - + callee_iterator callee_end(Instruction *I) const { I = (Instruction*)((char*)I + 1); return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0)); } - + virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.setPreservesAll(); AU.addRequired<CompleteBUDataStructures>(); } - + private: void buildIndirectFunctionSets(Module &M); - + unsigned processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack, - unsigned &NextID, + unsigned &NextID, std::map<DSGraph*, unsigned> &ValMap); void processGraph(DSGraph &FG); - + DSGraph &getOrCreateGraph(Function &F); }; diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index c901911495..74ac293af7 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/include/llvm/Analysis/Dominators.h @@ -1,10 +1,10 @@ //===- llvm/Analysis/Dominators.h - Dominator Info Calculation --*- C++ -*-===// -// +// // 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 following classes: @@ -13,13 +13,13 @@ // 2. DominatorSet: Calculates the [reverse] dominator set for a function // 3. DominatorTree: Represent the ImmediateDominator as an explicit tree // structure. -// 4. DominanceFrontier: Calculate and hold the dominance frontier for a +// 4. DominanceFrontier: Calculate and hold the dominance frontier for a // function. // // These data structures are listed in increasing order of complexity. It -// takes longer to calculate the dominator frontier, for example, than the +// takes longer to calculate the dominator frontier, for example, than the // ImmediateDominator mapping. -// +// //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_DOMINATORS_H @@ -140,9 +140,9 @@ private: unsigned Semi; unsigned Size; BasicBlock *Label, *Parent, *Child, *Ancestor; - + std::vector<BasicBlock*> Bucket; - + InfoRec() : Semi(0), Size(0), Label(0), Parent(0), Child(0), Ancestor(0){} }; @@ -306,7 +306,7 @@ public: inline Node *getIDom() const { return IDom; } inline const std::vector<Node*> &getChildren() const { return Children; } - /// dominates - Returns true iff this dominates N. Note that this is not a + /// dominates - Returns true iff this dominates N. Note that this is not a /// constant time operation! /// inline bool dominates(const Node *N) const { diff --git a/include/llvm/Analysis/Expressions.h b/include/llvm/Analysis/Expressions.h index 8b02b14538..b04d787929 100644 --- a/include/llvm/Analysis/Expressions.h +++ b/include/llvm/Analysis/Expressions.h @@ -1,17 +1,17 @@ //===- llvm/Analysis/Expressions.h - Expression Analysis Utils --*- C++ -*-===// -// +// // 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 package of expression analysis utilties: // // ClassifyExpr: Analyze an expression to determine the complexity of the // expression, and which other variables it depends on. -// +// //===----------------------------------------------------------------------===// #ifndef LLVM_ANALYSIS_EXPRESSIONS_H diff --git a/include/llvm/Analysis/FindUnsafePointerTypes.h b/include/llvm/Analysis/FindUnsafePointerTypes.h index 2d453f087a..d1f2709325 100644 --- a/include/llvm/Analysis/FindUnsafePointerTypes.h +++ b/include/llvm/Analysis/FindUnsafePointerTypes.h @@ -1,13 +1,13 @@ //===- llvm/Analysis/FindUnsafePointerTypes.h - Unsafe pointers -*- C++ -*-===// -// +// // 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. -// +// //===----------------------------------------------------------------------===// // -// Th |