diff options
Diffstat (limited to 'lib')
45 files changed, 627 insertions, 674 deletions
diff --git a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp b/lib/Analysis/IPA/FindUnsafePointerTypes.cpp index 0179cbb74c..d689d93cd4 100644 --- a/lib/Analysis/IPA/FindUnsafePointerTypes.cpp +++ b/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/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp index e67fe322f7..5c961d2beb 100644 --- a/lib/Analysis/IPA/FindUsedTypes.cpp +++ b/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/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp index f524d016f1..197bed26d7 100644 --- a/lib/Analysis/IntervalPartition.cpp +++ b/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/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp index 48cc86fcaf..71ee3d74cf 100644 --- a/lib/Analysis/PostDominators.cpp +++ b/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(); diff --git a/lib/Bytecode/Writer/InstructionWriter.cpp b/lib/Bytecode/Writer/InstructionWriter.cpp index 0be903aad0..c32c6b476f 100644 --- a/lib/Bytecode/Writer/InstructionWriter.cpp +++ b/lib/Bytecode/Writer/InstructionWriter.cpp @@ -11,7 +11,7 @@ #include "WriterInternals.h" #include "llvm/Module.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/BasicBlock.h" #include "llvm/Instruction.h" #include "llvm/DerivedTypes.h" @@ -52,7 +52,7 @@ static void outputInstructionFormat0(const Instruction *I, } -// outputInstrVarArgsCall - Output the obsurdly annoying varargs method calls. +// outputInstrVarArgsCall - Output the obsurdly annoying varargs function calls. // This are more annoying than most because the signature of the call does not // tell us anything about the types of the arguments in the varargs portion. // Because of this, we encode (as type 0) all of the argument types explicitly @@ -71,10 +71,10 @@ static void outputInstrVarArgsCall(const Instruction *I, unsigned NumArgs = I->getNumOperands(); output_vbr(NumArgs*2, Out); - // TODO: Don't need to emit types for the fixed types of the varargs method + // TODO: Don't need to emit types for the fixed types of the varargs function // prototype... - // The type for the method has already been emitted in the type field of the + // The type for the function has already been emitted in the type field of the // instruction. Just emit the slot # now. int Slot = Table.getValSlot(I->getOperand(0)); assert(Slot >= 0 && "No slot number for value!?!?"); diff --git a/lib/Bytecode/Writer/SlotCalculator.cpp b/lib/Bytecode/Writer/SlotCalculator.cpp index 43a4591cb8..9c59f12047 100644 --- a/lib/Bytecode/Writer/SlotCalculator.cpp +++ b/lib/Bytecode/Writer/SlotCalculator.cpp @@ -11,7 +11,7 @@ #include "llvm/Analysis/SlotCalculator.h" #include "llvm/Analysis/ConstantsScanner.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/GlobalVariable.h" #include "llvm/Module.h" #include "llvm/BasicBlock.h" @@ -45,7 +45,7 @@ SlotCalculator::SlotCalculator(const Module *M, bool IgnoreNamed) { processModule(); } -SlotCalculator::SlotCalculator(const Method *M, bool IgnoreNamed) { +SlotCalculator::SlotCalculator(const Function *M, bool IgnoreNamed) { IgnoreNamedNodes = IgnoreNamed; TheModule = M ? M->getParent() : 0; @@ -64,7 +64,7 @@ SlotCalculator::SlotCalculator(const Method *M, bool IgnoreNamed) { } -// processModule - Process all of the module level method declarations and +// processModule - Process all of the module level function declarations and // types that are available. // void SlotCalculator::processModule() { @@ -83,10 +83,10 @@ void SlotCalculator::processModule() { for_each(TheModule->gbegin(), TheModule->gend(), bind_obj(this, &SlotCalculator::insertValue)); - // Scavenge the types out of the methods, then add the methods themselves to - // the value table... + // Scavenge the types out of the functions, then add the functions themselves + // to the value table... // - for_each(TheModule->begin(), TheModule->end(), // Insert methods... + for_each(TheModule->begin(), TheModule->end(), // Insert functions... bind_obj(this, &SlotCalculator::insertValue)); // Insert constants that are named at module level into the slot pool so that @@ -119,28 +119,28 @@ void SlotCalculator::processSymbolTableConstants(const SymbolTable *ST) { } -void SlotCalculator::incorporateMethod(const Method *M) { +void SlotCalculator::incorporateMethod(const Function *M) { assert(ModuleLevel.size() == 0 && "Module already incorporated!"); - SC_DEBUG("begin processMethod!\n"); + SC_DEBUG("begin processFunction!\n"); - // Save the Table state before we process the method... + // Save the Table state before we process the function... for (unsigned i = 0; i < Table.size(); ++i) ModuleLevel.push_back(Table[i].size()); - SC_DEBUG("Inserting method arguments\n"); + SC_DEBUG("Inserting function arguments\n"); - // Iterate over method arguments, adding them to the value table... + // Iterate over function arguments, adding them to the value table... for_each(M->getArgumentList().begin(), M->getArgumentList().end(), bind_obj(this, &SlotCalculator::insertValue)); - // Iterate over all of the instructions in the method, looking for constant + // Iterate over all of the instructions in the function, looking for constant // values that are referenced. Add these to the value pools before any // nonconstant values. This will be turned into the constant pool for the // bytecode writer. // if (!IgnoreNamedNodes) { // Assembly writer does not need this! - SC_DEBUG("Inserting method constants:\n"; + SC_DEBUG("Inserting function constants:\n"; for (constant_iterator I = constant_begin(M), E = constant_end(M); I != E; ++I) { cerr << " " << I->getType()->getDescription() @@ -148,7 +148,7 @@ void SlotCalculator::incorporateMethod(const Method *M) { }); // Emit all of the constants that are being used by the instructions in the - // method... + // function... for_each(constant_begin(M), constant_end(M), bind_obj(this, &SlotCalculator::insertValue)); @@ -179,18 +179,18 @@ void SlotCalculator::incorporateMethod(const Method *M) { processSymbolTable(M->getSymbolTable()); } - SC_DEBUG("end processMethod!\n"); + SC_DEBUG("end processFunction!\n"); } void SlotCalculator::purgeMethod() { assert(ModuleLevel.size() != 0 && "Module not incorporated!"); unsigned NumModuleTypes = ModuleLevel.size(); - SC_DEBUG("begin purgeMethod!\n"); + SC_DEBUG("begin purgeFunction!\n"); // First, remove values from existing type planes for (unsigned i = 0; i < NumModuleTypes; ++i) { - unsigned ModuleSize = ModuleLevel[i]; // Size of plane before method came + unsigned ModuleSize = ModuleLevel[i]; // Size of plane before function came TypePlane &CurPlane = Table[i]; //SC_DEBUG("Processing Plane " <<i<< " of size " << CurPlane.size() <<endl); @@ -207,7 +207,7 @@ void SlotCalculator::purgeMethod() { // We don't need this state anymore, free it up. ModuleLevel.clear(); - // Next, remove any type planes defined by the method... + // Next, remove any type planes defined by the function... while (NumModuleTypes != Table.size()) { TypePlane &Plane = Table.back(); SC_DEBUG("Removing Plane " << (Table.size()-1) << " of size " @@ -220,7 +220,7 @@ void SlotCalculator::purgeMethod() { Table.pop_back(); // Nuke the plane, we don't like it. } - SC_DEBUG("end purgeMethod!\n"); + SC_DEBUG("end purgeFunction!\n"); } int SlotCalculator::getValSlot(const Value *D) const { @@ -337,9 +337,9 @@ int SlotCalculator::doInsertVal(const Value *D) { SC_DEBUG(" Inserting value [" << Ty << "] = " << D << " slot=" << DestSlot << " ["); - // G = Global, C = Constant, T = Type, M = Method, o = other + // G = Global, C = Constant, T = Type, F = Function, o = other SC_DEBUG((isa<GlobalVariable>(D) ? "G" : (isa<Constant>(D) ? "C" : - (isa<Type>(D) ? "T" : (isa<Method>(D) ? "M" : "o"))))); + (isa<Type>(D) ? "T" : (isa<Function>(D) ? "F" : "o"))))); SC_DEBUG("]\n"); return (int)DestSlot; } diff --git a/lib/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp index e67ba93f20..daf4a49bb8 100644 --- a/lib/CodeGen/InstrSched/SchedGraph.cpp +++ b/lib/CodeGen/InstrSched/SchedGraph.cpp @@ -20,7 +20,7 @@ #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/BasicBlock.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/iOther.h" #include "Support/StringExtras.h" #include "Support/STLExtras.h" @@ -955,9 +955,9 @@ SchedGraph::buildGraph(const TargetMachine& target) // /*ctor*/ -SchedGraphSet::SchedGraphSet(const Method* _method, +SchedGraphSet::SchedGraphSet(const Function* _function, const TargetMachine& target) : - method(_method) + method(_function) { buildGraphsForMethod(method, target); } @@ -975,23 +975,23 @@ SchedGraphSet::~SchedGraphSet() void SchedGraphSet::dump() const { - cerr << "======== Sched graphs for method `" << method->getName() + cerr << "======== Sched graphs for function `" << method->getName() << "' ========\n\n"; for (const_iterator I=begin(); I != end(); ++I) (*I)->dump(); - cerr << "\n====== End graphs for method `" << method->getName() + cerr << "\n====== End graphs for function `" << method->getName() << "' ========\n\n"; } void -SchedGraphSet::buildGraphsForMethod(const Method *method, +SchedGraphSet::buildGraphsForMethod(const Function *F, const TargetMachine& target) { - for (Method::const_iterator BI = method->begin(); BI != method->end(); ++BI) - this->addGraph(new SchedGraph(*BI, target)); + for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI) + addGraph(new SchedGraph(*BI, target)); } diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp index 3efc527470..1eb507a695 100644 --- a/lib/CodeGen/InstrSelection/InstrSelection.cpp +++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp @@ -23,7 +23,7 @@ #include "llvm/Target/MachineRegInfo.h" #include "llvm/Target/TargetMachine.h" #include "llvm/BasicBlock.h" -#include "llvm/Method.h" +#include "llvm/Function.h" #include "llvm/iPHINode.h" #include "Support/CommandLine.h" #include <iostream> @@ -60,7 +60,7 @@ static void PostprocessMachineCodeForTree(InstructionNode* instrNode, short* nts, TargetMachine &target); -static void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target); +static void InsertCode4AllPhisInMeth(Function *F, TargetMachine &target); @@ -73,25 +73,23 @@ static void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target); //--------------------------------------------------------------------------- bool -SelectInstructionsForMethod(Method* method, TargetMachine &target) +SelectInstructionsForMethod(Function *F, TargetMachine &target) { bool failed = false; // // Build the instruction trees to be given as inputs to BURG. // - InstrForest instrForest(method); + InstrForest instrForest(F); if (SelectDebugLevel >= Select_DebugInstTrees) { - cerr << "\n\n*** Input to instruction selection for method " - << (method->hasName()? method->getName() : "") - << "\n\n"; - method->dump(); + cerr << "\n\n*** Input to instruction selection for function " + << F->getName() << "\n\n"; + F->dump(); - cerr << "\n\n*** Instruction trees for method " - << (method->hasName()? method->getName() : "") - << "\n\n"; + cerr << "\n\n*** Instruction trees for function " + << F->getName() << "\n\n"; instrForest.dump(); } @@ -125,7 +123,7 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target) // // Record instructions in the vector for each basic block // - for (Method::iterator BI = method->begin(); BI != method->end(); ++BI) + for (Function::iterator BI = F->begin(), BE = F->end(); BI != BE; ++BI) { MachineCodeForBasicBlock& bbMvec = (*BI)->getMachineInstrVec(); for (BasicBlock::iterator II = (*BI)->begin(); II != (*BI)->end(); ++II) @@ -137,13 +135,13 @@ SelectInstructionsForMethod(Method* method, TargetMachine &target) } // Insert phi elimination code -- added by Ruchira - InsertCode4AllPhisInMeth(method, target); + InsertCode4AllPhisInMeth(F, target); if (SelectDebugLevel >= Select_PrintMachineCode) { cerr << "\n*** Machine instructions after INSTRUCTION SELECTION\n"; - MachineCodeForMethod::get(method).dump(); + MachineCodeForMethod::get(F).dump(); } return false; @@ -190,11 +188,11 @@ InsertPhiElimInstructions(BasicBlock *BB, const vector<MachineInstr*>& CpVec) //------------------------------------------------------------------------- void -InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) +InsertCode4AllPhisInMeth(Function *F, TargetMachine &target) { - // for all basic blocks in method + // for all basic blocks in function // - for (Method::iterator BI = method->begin(); BI != method->end(); ++BI) { + for (Function::iterator BI = F->begin(); BI != F->end(); ++BI) { BasicBlock *BB = *BI; const BasicBlock::InstListType &InstList = BB->getInstList(); @@ -236,9 +234,7 @@ InsertCode4AllPhisInMeth(Method *method, TargetMachine &target) else break; // since PHI nodes can only be at the top } // for each Phi Instr in BB - - } // for all BBs in method - + } // for all BBs in fu |