diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-07 20:49:59 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-07 20:49:59 +0000 |
commit | 62b7fd136e69426ce2655e4cda3e989ccd83ab6a (patch) | |
tree | 57d9202d4dd7e3d248f5f4c5717d0c55ec62e43f /llvm/lib/Analysis | |
parent | 53a46fb75983cad20b309d920d59d10a6580a332 (diff) | |
download | bcm5719-llvm-62b7fd136e69426ce2655e4cda3e989ccd83ab6a.tar.gz bcm5719-llvm-62b7fd136e69426ce2655e4cda3e989ccd83ab6a.zip |
Change references to the Method class to be references to the Function
class. The Method class is obsolete (renamed) and all references to it
are being converted over to Function.
llvm-svn: 2144
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Analysis/IPA/FindUsedTypes.cpp | 12 | ||||
-rw-r--r-- | llvm/lib/Analysis/IntervalPartition.cpp | 16 | ||||
-rw-r--r-- | llvm/lib/Analysis/PostDominators.cpp | 39 |
4 files changed, 37 insertions, 40 deletions
diff --git a/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp index 0179cbb74c8..d689d93cd44 100644 --- a/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp +++ b/llvm/lib/Analysis/IPA/FindUnsafePointerTypes.cpp @@ -1,4 +1,4 @@ -//===- SafePointerAccess.cpp - Check pointer usage safety -------------------=// +//===- FindUnsafePointerTypes.cpp - Check pointer usage safety --------------=// // // This file defines a pass that can be used to determine, interprocedurally, // which pointer types are accessed unsafely in a program. If there is an @@ -20,7 +20,7 @@ #include "llvm/Assembly/CachedWriter.h" #include "llvm/Type.h" #include "llvm/Instruction.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/Module.h" #include "llvm/Support/InstIterator.h" #include "Support/CommandLine.h" @@ -51,14 +51,10 @@ static inline bool isSafeInstruction(const Instruction *I) { } -// runOnMethod - Inspect the operations that the specified method does on -// values of various types. If they are deemed to be 'unsafe' note that the -// type is not safe to transform. -// bool FindUnsafePointerTypes::run(Module *Mod) { for (Module::iterator MI = Mod->begin(), ME = Mod->end(); MI != ME; ++MI) { - const Method *M = *MI; // We don't need/want write access + const Function *M = *MI; // We don't need/want write access for (const_inst_iterator I = inst_begin(M), E = inst_end(M); I != E; ++I) { const Instruction *Inst = *I; const Type *ITy = Inst->getType(); diff --git a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp index e67fe322f71..5c961d2bebe 100644 --- a/llvm/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/llvm/lib/Analysis/IPA/FindUsedTypes.cpp @@ -1,4 +1,4 @@ -//===- FindUsedTypes.h - Find all Types used by a module --------------------=// +//===- FindUsedTypes.cpp - Find all Types used by a module ------------------=// // // This pass is used to seek out all of the types in use by the program. // @@ -10,7 +10,7 @@ #include "llvm/GlobalVariable.h" #include "llvm/DerivedTypes.h" #include "llvm/Module.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/Instruction.h" #include "llvm/Support/InstIterator.h" @@ -41,7 +41,7 @@ void FindUsedTypes::IncorporateSymbolTable(const SymbolTable *ST) { assert(0 && "Unimp"); } -// doPerMethodWork - This incorporates all types used by the specified method +// run - This incorporates all types used by the specified module // bool FindUsedTypes::run(Module *m) { UsedTypes.clear(); // reset if run multiple times... @@ -54,12 +54,12 @@ bool FindUsedTypes::run(Module *m) { IncorporateType((*I)->getType()); for (Module::iterator MI = m->begin(), ME = m->end(); MI != ME; ++MI) { - const Method *M = *MI; + const Function *M = *MI; if (IncludeSymbolTables && M->hasSymbolTable()) IncorporateSymbolTable(M->getSymbolTable()); // Add symtab first... - // Loop over all of the instructions in the method, adding their return type - // as well as the types of their operands. + // Loop over all of the instructions in the function, adding their return + // type as well as the types of their operands. // for (const_inst_iterator II = inst_begin(M), IE = inst_end(M); II != IE; ++II) { diff --git a/llvm/lib/Analysis/IntervalPartition.cpp b/llvm/lib/Analysis/IntervalPartition.cpp index f524d016f16..197bed26d79 100644 --- a/llvm/lib/Analysis/IntervalPartition.cpp +++ b/llvm/lib/Analysis/IntervalPartition.cpp @@ -1,7 +1,7 @@ //===- IntervalPartition.cpp - Interval Partition module code ----*- C++ -*--=// // // This file contains the definition of the cfg::IntervalPartition class, which -// calculates and represent the interval partition of a method. +// calculates and represent the interval partition of a function. // //===----------------------------------------------------------------------===// @@ -17,7 +17,7 @@ AnalysisID IntervalPartition::ID(AnalysisID::create<IntervalPartition>()); // IntervalPartition Implementation //===----------------------------------------------------------------------===// -// destroy - Reset state back to before method was analyzed +// destroy - Reset state back to before function was analyzed void IntervalPartition::destroy() { for_each(begin(), end(), deleter<cfg::Interval>); IntervalMap.clear(); @@ -50,14 +50,14 @@ void IntervalPartition::updatePredecessors(cfg::Interval *Int) { } // IntervalPartition ctor - Build the first level interval partition for the -// specified method... +// specified function... // -bool IntervalPartition::runOnMethod(Method *M) { +bool IntervalPartition::runOnMethod(Function *M) { assert(M->front() && "Cannot operate on prototypes!"); // Pass false to intervals_begin because we take ownership of it's memory - method_interval_iterator I = intervals_begin(M, false); - assert(I != intervals_end(M) && "No intervals in method!?!?!"); + function_interval_iterator I = intervals_begin(M, false); + assert(I != intervals_end(M) && "No intervals in function!?!?!"); addIntervalToPartition(RootInterval = *I); @@ -80,8 +80,8 @@ bool IntervalPartition::runOnMethod(Method *M) { // distinguish it from a copy constructor. Always pass in false for now. // IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) { - Interval *MethodStart = IP.getRootInterval(); - assert(MethodStart && "Cannot operate on empty IntervalPartitions!"); + Interval *FunctionStart = IP.getRootInterval(); + assert(FunctionStart && "Cannot operate on empty IntervalPartitions!"); // Pass false to intervals_begin because we take ownership of it's memory interval_part_interval_iterator I = intervals_begin(IP, false); diff --git a/llvm/lib/Analysis/PostDominators.cpp b/llvm/lib/Analysis/PostDominators.cpp index 48cc86fcaf5..71ee3d74cf9 100644 --- a/llvm/lib/Analysis/PostDominators.cpp +++ b/llvm/lib/Analysis/PostDominators.cpp @@ -1,12 +1,13 @@ //===- DominatorSet.cpp - Dominator Set Calculation --------------*- C++ -*--=// // -// This file provides a simple class to calculate the dominator set of a method. +// This file provides a simple class to calculate the dominator set of a +// function. // //===----------------------------------------------------------------------===// #include "llvm/Analysis/Dominators.h" #include "llvm/Transforms/UnifyMethodExitNodes.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/Support/CFG.h" #include "Support/DepthFirstIterator.h" #include "Support/STLExtras.h" @@ -21,31 +22,31 @@ using std::set; AnalysisID cfg::DominatorSet::ID(AnalysisID::create<cfg::DominatorSet>()); AnalysisID cfg::DominatorSet::PostDomID(AnalysisID::create<cfg::DominatorSet>()); -bool cfg::DominatorSet::runOnMethod(Method *M) { +bool cfg::DominatorSet::runOnMethod(Function *F) { Doms.clear(); // Reset from the last time we were run... if (isPostDominator()) - calcPostDominatorSet(M); + calcPostDominatorSet(F); else - calcForwardDominatorSet(M); + calcForwardDominatorSet(F); return false; } // calcForwardDominatorSet - This method calculates the forward dominator sets -// for the specified method. +// for the specified function. // -void cfg::DominatorSet::calcForwardDominatorSet(Method *M) { +void cfg::DominatorSet::calcForwardDominatorSet(Function *M) { Root = M->getEntryNode(); assert(pred_begin(Root) == pred_end(Root) && - "Root node has predecessors in method!"); + "Root node has predecessors in function!"); bool Changed; do { Changed = false; DomSetType WorkingSet; - df_iterator<Method*> It = df_begin(M), End = df_end(M); + df_iterator<Function*> It = df_begin(M), End = df_end(M); for ( ; It != End; ++It) { const BasicBlock *BB = *It; pred_const_iterator PI = pred_begin(BB), PEnd = pred_end(BB); @@ -75,19 +76,19 @@ void cfg::DominatorSet::calcForwardDominatorSet(Method *M) { } while (Changed); } -// Postdominator set constructor. This ctor converts the specified method to +// Postdominator set constructor. This ctor converts the specified function to // only have a single exit node (return stmt), then calculates the post -// dominance sets for the method. +// dominance sets for the function. // -void cfg::DominatorSet::calcPostDominatorSet(Method *M) { +void cfg::DominatorSet::calcPostDominatorSet(Function *M) { // Since we require that the unify all exit nodes pass has been run, we know - // that there can be at most one return instruction in the method left. + // that there can be at most one return instruction in the function left. // Get it. // Root = getAnalysis<UnifyMethodExitNodes>().getExitNode(); - if (Root == 0) { // No exit node for the method? Postdomsets are all empty - for (Method::const_iterator MI = M->begin(), ME = M->end(); MI != ME; ++MI) + if (Root == 0) { // No exit node for the function? Postdomsets are all empty + for (Function::const_iterator MI = M->begin(), ME = M->end(); MI!=ME; ++MI) Doms[*MI] = DomSetType(); return; } @@ -207,12 +208,12 @@ void cfg::DominatorTree::reset() { // Given immediate dominators, we can also calculate the dominator tree cfg::DominatorTree::DominatorTree(const ImmediateDominators &IDoms) : DominatorBase(IDoms.getRoot()) { - const Method *M = Root->getParent(); + const Function *M = Root->getParent(); Nodes[Root] = new Node(Root, 0); // Add a node for the root... // Iterate over all nodes in depth first order... - for (df_iterator<const Method*> I = df_begin(M), E = df_end(M); I != E; ++I) { + for (df_iterator<const Function*> I = df_begin(M), E = df_end(M); I!=E; ++I) { const BasicBlock *BB = *I, *IDom = IDoms[*I]; if (IDom != 0) { // Ignore the root node and other nasty nodes @@ -249,7 +250,7 @@ void cfg::DominatorTree::calculate(const DominatorSet &DS) { // current node, and it is our idom! We know that we have already added // a DominatorTree node for our idom, because the idom must be a // predecessor in the depth first order that we are iterating through the - // method. + // function. // DominatorSet::DomSetType::const_iterator I = Dominators.begin(); DominatorSet::DomSetType::const_iterator End = Dominators.end(); @@ -290,7 +291,7 @@ void cfg::DominatorTree::calculate(const DominatorSet &DS) { // chain than the current node, and it is our idom! We know that we have // already added a DominatorTree node for our idom, because the idom must // be a predecessor in the depth first order that we are iterating through - // the method. + // the function. // DominatorSet::DomSetType::const_iterator I = Dominators.begin(); DominatorSet::DomSetType::const_iterator End = Dominators.end(); |