diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-02-04 06:47:17 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-02-04 06:47:17 +0000 | 
| commit | bd3ad751f091a68f866a266b4a6846525a66e45b (patch) | |
| tree | 8164be8ea20f41624128df17a67fed3a1187599f /llvm | |
| parent | 47b65a1025b7044ae03d2099df6347ad413c31ff (diff) | |
| download | bcm5719-llvm-bd3ad751f091a68f866a266b4a6846525a66e45b.tar.gz bcm5719-llvm-bd3ad751f091a68f866a266b4a6846525a66e45b.zip  | |
Eliminate ModuleAnalyzer.  It's old code that is not going to be used in the near future
llvm-svn: 1679
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Analysis/ModuleAnalyzer.h | 84 | ||||
| -rw-r--r-- | llvm/lib/Analysis/ModuleAnalyzer.cpp | 101 | 
2 files changed, 0 insertions, 185 deletions
diff --git a/llvm/include/llvm/Analysis/ModuleAnalyzer.h b/llvm/include/llvm/Analysis/ModuleAnalyzer.h deleted file mode 100644 index 8493becc640..00000000000 --- a/llvm/include/llvm/Analysis/ModuleAnalyzer.h +++ /dev/null @@ -1,84 +0,0 @@ -//===-- llvm/Analysis/ModuleAnalyzer.h - Module analysis driver --*- C++ -*-==// -// -// This class provides a nice interface to traverse a module in a predictable -// way.  This is used by the AssemblyWriter, BytecodeWriter, and SlotCalculator -// to do analysis of a module. -// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_ANALYSIS_MODULEANALYZER_H -#define LLVM_ANALYSIS_MODULEANALYZER_H - -#include <set> - -class Type; -class Module; -class Method; -class BasicBlock; -class Instruction; -class MethodType; -class MethodArgument; - -class ModuleAnalyzer { -  ModuleAnalyzer(const ModuleAnalyzer &);                   // do not impl -  const ModuleAnalyzer &operator=(const ModuleAnalyzer &);  // do not impl -public: -  ModuleAnalyzer() {} -  virtual ~ModuleAnalyzer() {} -   -protected: -  // processModule - Driver function to call all of my subclasses virtual  -  // methods.  Commonly called by derived type's constructor. -  // -  bool processModule(const Module *M); - -  // processType - This callback occurs when an derived type is discovered -  // at the class level. This activity occurs when processing a constant pool. -  // -  virtual bool processType(const Type *Ty) { return false; } - -  // processMethods - The default implementation of this method loops through  -  // all of the methods in the module and processModule's them. -  // -  virtual bool processMethods(const Module *M); - -  // visitMethod - This member is called after the constant pool has been  -  // processed.  The default implementation of this is a noop. -  // -  virtual bool visitMethod(const Method *M) { return false; } - -  //===--------------------------------------------------------------------===// -  //  Stages of processing Method level information -  // - -  // processMethod - Process all aspects of a method. -  // -  virtual bool processMethod(const Method *M); - -  // processMethodArgument - This member is called for every argument that  -  // is passed into the method. -  // -  virtual bool processMethodArgument(const MethodArgument *MA) { return false; } - -  // processBasicBlock - This member is called for each basic block in a methd. -  // -  virtual bool processBasicBlock(const BasicBlock *BB); - -  //===--------------------------------------------------------------------===// -  //  Stages of processing BasicBlock level information -  // - -  // preProcessInstruction - This member is called for each Instruction in a  -  // method before processInstruction. -  // -  virtual bool preProcessInstruction(const Instruction *I); - -  // processInstruction - This member is called for each Instruction in a method -  // -  virtual bool processInstruction(const Instruction *I) { return false; } - -private: -  bool handleType(std::set<const Type *> &TypeSet, const Type *T); -}; - -#endif diff --git a/llvm/lib/Analysis/ModuleAnalyzer.cpp b/llvm/lib/Analysis/ModuleAnalyzer.cpp deleted file mode 100644 index dc07512cb57..00000000000 --- a/llvm/lib/Analysis/ModuleAnalyzer.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//===-- llvm/Analysis/ModuleAnalyzer.cpp - Module analysis driver ----------==// -// -// This class provides a nice interface to traverse a module in a predictable -// way.  This is used by the AssemblyWriter, BytecodeWriter, and SlotCalculator -// to do analysis of a module. -// -//===----------------------------------------------------------------------===// - -#include "llvm/Analysis/ModuleAnalyzer.h" -#include "llvm/Method.h" -#include "llvm/Module.h" -#include "llvm/BasicBlock.h" -#include "llvm/DerivedTypes.h" -#include "Support/STLExtras.h" -#include <map> -#include <iostream> -using std::set; - -// processModule - Driver function to call all of my subclasses virtual methods. -// -bool ModuleAnalyzer::processModule(const Module *M) { -  return processMethods(M); -} - -inline bool ModuleAnalyzer::handleType(set<const Type *> &TypeSet,  -				       const Type *T) { -  if (!T->isDerivedType()) return false;    // Boring boring types... -  if (TypeSet.count(T) != 0) return false;  // Already found this type... -  TypeSet.insert(T);                        // Add it to the set -   -  // Recursively process interesting types... -  switch (T->getPrimitiveID()) { -  case Type::MethodTyID: { -    const MethodType *MT = (const MethodType *)T; -    if (handleType(TypeSet, MT->getReturnType())) return true; -    const MethodType::ParamTypes &Params = MT->getParamTypes(); - -    for (MethodType::ParamTypes::const_iterator I = Params.begin(); -	 I != Params.end(); ++I) -      if (handleType(TypeSet, *I)) return true; -    break; -  } - -  case Type::ArrayTyID: -    if (handleType(TypeSet, ((const ArrayType *)T)->getElementType())) -      return true; -    break; - -  case Type::StructTyID: { -    const StructType *ST = cast<const StructType>(T); -    const StructType::ElementTypes &Elements = ST->getElementTypes(); -    for (StructType::ElementTypes::const_iterator I = Elements.begin(); -	 I != Elements.end(); ++I) -      if (handleType(TypeSet, *I)) return true; -    break; -  } - -  case Type::PointerTyID: -    if (handleType(TypeSet, cast<const PointerType>(T)->getElementType())) -      return true; -    break; - -  default: -    std::cerr << "ModuleAnalyzer::handleType, type unknown: '"  -              << T->getName() << "'\n"; -    break; -  } - -  return processType(T); -} - - -bool ModuleAnalyzer::processMethods(const Module *M) { -  return apply_until(M->begin(), M->end(), -		     bind_obj(this, &ModuleAnalyzer::processMethod)); -} - -bool ModuleAnalyzer::processMethod(const Method *M) { -  // Loop over the arguments, processing them... -  if (apply_until(M->getArgumentList().begin(), M->getArgumentList().end(), -		  bind_obj(this, &ModuleAnalyzer::processMethodArgument))) -    return true; - -  // Loop over all the basic blocks, in order... -  return apply_until(M->begin(), M->end(), -		     bind_obj(this, &ModuleAnalyzer::processBasicBlock)); -} - -bool ModuleAnalyzer::processBasicBlock(const BasicBlock *BB) { -  // Process all of the instructions in the basic block -  BasicBlock::const_iterator Inst = BB->begin(); -  for (; Inst != BB->end(); Inst++) { -    if (preProcessInstruction(*Inst) || processInstruction(*Inst)) return true; -  } -  return false; -} - -bool ModuleAnalyzer::preProcessInstruction(const Instruction *I) { -   -  return false; -}  | 

