Move TypeFinder.h into the IR tree, it clearly belongs with the IR library.
authorChandler Carruth <chandlerc@gmail.com>
Mon, 7 Jan 2013 15:43:51 +0000 (15:43 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 7 Jan 2013 15:43:51 +0000 (15:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171749 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/TypeFinder.h [new file with mode: 0644]
include/llvm/TypeFinder.h [deleted file]
lib/IR/AsmWriter.cpp
lib/IR/TypeFinder.cpp
lib/Linker/LinkModules.cpp
lib/Transforms/IPO/StripSymbols.cpp
lib/Transforms/Utils/MetaRenamer.cpp

diff --git a/include/llvm/IR/TypeFinder.h b/include/llvm/IR/TypeFinder.h
new file mode 100644 (file)
index 0000000..cea66a4
--- /dev/null
@@ -0,0 +1,78 @@
+//===-- llvm/IR/TypeFinder.h - Class to find used struct types --*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the declaration of the TypeFinder class. 
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_IR_TYPEFINDER_H
+#define LLVM_IR_TYPEFINDER_H
+
+#include "llvm/ADT/DenseSet.h"
+#include <vector>
+
+namespace llvm {
+
+class MDNode;
+class Module;
+class StructType;
+class Type;
+class Value;
+
+/// TypeFinder - Walk over a module, identifying all of the types that are
+/// used by the module.
+class TypeFinder {
+  // To avoid walking constant expressions multiple times and other IR
+  // objects, we keep several helper maps.
+  DenseSet<const Value*> VisitedConstants;
+  DenseSet<Type*> VisitedTypes;
+
+  std::vector<StructType*> StructTypes;
+  bool OnlyNamed;
+
+public:
+  TypeFinder() : OnlyNamed(false) {}
+
+  void run(const Module &M, bool onlyNamed);
+  void clear();
+
+  typedef std::vector<StructType*>::iterator iterator;
+  typedef std::vector<StructType*>::const_iterator const_iterator;
+
+  iterator begin() { return StructTypes.begin(); }
+  iterator end() { return StructTypes.end(); }
+
+  const_iterator begin() const { return StructTypes.begin(); }
+  const_iterator end() const { return StructTypes.end(); }
+
+  bool empty() const { return StructTypes.empty(); }
+  size_t size() const { return StructTypes.size(); }
+  iterator erase(iterator I, iterator E) { return StructTypes.erase(I, E); }
+
+  StructType *&operator[](unsigned Idx) { return StructTypes[Idx]; }
+
+private:
+  /// incorporateType - This method adds the type to the list of used
+  /// structures if it's not in there already.
+  void incorporateType(Type *Ty);
+
+  /// incorporateValue - This method is used to walk operand lists finding types
+  /// hiding in constant expressions and other operands that won't be walked in
+  /// other ways.  GlobalValues, basic blocks, instructions, and inst operands
+  /// are all explicitly enumerated.
+  void incorporateValue(const Value *V);
+
+  /// incorporateMDNode - This method is used to walk the operands of an MDNode
+  /// to find types hiding within.
+  void incorporateMDNode(const MDNode *V);
+};
+
+} // end llvm namespace
+
+#endif
diff --git a/include/llvm/TypeFinder.h b/include/llvm/TypeFinder.h
deleted file mode 100644 (file)
index 5d80705..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-//===-- llvm/TypeFinder.h - Class for finding used struct types -*- C++ -*-===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains the declaration of the TypeFinder class. 
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_TYPEFINDER_H
-#define LLVM_TYPEFINDER_H
-
-#include "llvm/ADT/DenseSet.h"
-#include <vector>
-
-namespace llvm {
-
-class MDNode;
-class Module;
-class StructType;
-class Type;
-class Value;
-
-/// TypeFinder - Walk over a module, identifying all of the types that are
-/// used by the module.
-class TypeFinder {
-  // To avoid walking constant expressions multiple times and other IR
-  // objects, we keep several helper maps.
-  DenseSet<const Value*> VisitedConstants;
-  DenseSet<Type*> VisitedTypes;
-
-  std::vector<StructType*> StructTypes;
-  bool OnlyNamed;
-
-public:
-  TypeFinder() : OnlyNamed(false) {}
-
-  void run(const Module &M, bool onlyNamed);
-  void clear();
-
-  typedef std::vector<StructType*>::iterator iterator;
-  typedef std::vector<StructType*>::const_iterator const_iterator;
-
-  iterator begin() { return StructTypes.begin(); }
-  iterator end() { return StructTypes.end(); }
-
-  const_iterator begin() const { return StructTypes.begin(); }
-  const_iterator end() const { return StructTypes.end(); }
-
-  bool empty() const { return StructTypes.empty(); }
-  size_t size() const { return StructTypes.size(); }
-  iterator erase(iterator I, iterator E) { return StructTypes.erase(I, E); }
-
-  StructType *&operator[](unsigned Idx) { return StructTypes[Idx]; }
-
-private:
-  /// incorporateType - This method adds the type to the list of used
-  /// structures if it's not in there already.
-  void incorporateType(Type *Ty);
-
-  /// incorporateValue - This method is used to walk operand lists finding types
-  /// hiding in constant expressions and other operands that won't be walked in
-  /// other ways.  GlobalValues, basic blocks, instructions, and inst operands
-  /// are all explicitly enumerated.
-  void incorporateValue(const Value *V);
-
-  /// incorporateMDNode - This method is used to walk the operands of an MDNode
-  /// to find types hiding within.
-  void incorporateMDNode(const MDNode *V);
-};
-
-} // end llvm namespace
-
-#endif
index 4d2affcad0a5c0fff30908a14f3d76ef00dbbd84..1c46a9414ae4c9f6a75a6442609fb1c2f492c12a 100644 (file)
@@ -30,6 +30,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Operator.h"
+#include "llvm/IR/TypeFinder.h"
 #include "llvm/IR/ValueSymbolTable.h"
 #include "llvm/Support/CFG.h"
 #include "llvm/Support/Debug.h"
@@ -37,7 +38,6 @@
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/FormattedStream.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/TypeFinder.h"
 #include <algorithm>
 #include <cctype>
 using namespace llvm;
index f2e4f11b24c9c4a74446b36a9487e08f185862fb..d5e620350705460e748a0c54835d14267a2bbb9a 100644 (file)
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/TypeFinder.h"
+#include "llvm/IR/TypeFinder.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/DerivedTypes.h"
index bc512b46bc2b3ad566c871c783623d2e9f597efa..e973919de393a47c90c5ba14c1fe2c8dd703d1e0 100644 (file)
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/TypeFinder.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/Transforms/Utils/Cloning.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
-#include "llvm/TypeFinder.h"
 #include <cctype>
 using namespace llvm;
 
index 707fc6c331929d8df18e1c464f1b2a67750c9c77..5f8681ff454e427c5d34c657b32c7d39148dc241 100644 (file)
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Instructions.h"
 #include "llvm/IR/Module.h"
+#include "llvm/IR/TypeFinder.h"
 #include "llvm/IR/ValueSymbolTable.h"
 #include "llvm/Pass.h"
 #include "llvm/Transforms/Utils/Local.h"
-#include "llvm/TypeFinder.h"
 using namespace llvm;
 
 namespace {
index 2715aa08bc500172571dad2ea112df203c28096f..d519fb754877e47f725dcbe9a8226761a542fe3b 100644 (file)
@@ -20,8 +20,8 @@
 #include "llvm/IR/Function.h"
 #include "llvm/IR/Module.h"
 #include "llvm/IR/Type.h"
+#include "llvm/IR/TypeFinder.h"
 #include "llvm/Pass.h"
-#include "llvm/TypeFinder.h"
 using namespace llvm;
 
 namespace {