Make the Node member of SUnit private, and add accessors.
[oota-llvm.git] / include / llvm / Module.h
index 56207a0af27f35f8e3612be8e17f30ccdf1c3f61..09eba81b4ebeefaf4db4a6bcad252d7a110f2f63 100644 (file)
@@ -229,6 +229,15 @@ public:
     return getGlobalVariable(Name, true);
   }
 
+  /// getOrInsertGlobal - Look up the specified global in the module symbol
+  /// table.
+  ///   1. If it does not exist, add a declaration of the global and return it.
+  ///   2. Else, the global exists but has the wrong type: return the function
+  ///      with a constantexpr cast to the right type.
+  ///   3. Finally, if the existing global is the correct delclaration, return
+  ///      the existing global.
+  Constant *getOrInsertGlobal(const std::string &Name, const Type *Ty);
+
 /// @}
 /// @name Global Alias Accessors
 /// @{
@@ -350,15 +359,11 @@ public:
 /// @name Utility functions for printing and dumping Module objects
 /// @{
 public:
-  /// Print the module to an output stream
-  void print(std::ostream &OS) const { print(OS, 0); }
-  void print(std::ostream *OS) const { if (OS) print(*OS); }
   /// Print the module to an output stream with AssemblyAnnotationWriter.
+  void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const;
   void print(std::ostream &OS, AssemblyAnnotationWriter *AAW) const;
-  void print(std::ostream *OS, AssemblyAnnotationWriter *AAW) const {
-    if (OS) print(*OS, AAW);
-  }
-  /// Dump the module to std::cerr (for debugging).
+  
+  /// Dump the module to stderr (for debugging).
   void dump() const;
   /// This function causes all the subinstructions to "let go" of all references
   /// that they are maintaining.  This allows one to 'delete' a whole class at
@@ -385,9 +390,14 @@ public:
 
 /// An iostream inserter for modules.
 inline std::ostream &operator<<(std::ostream &O, const Module &M) {
-  M.print(O);
+  M.print(O, 0);
+  return O;
+}
+inline raw_ostream &operator<<(raw_ostream &O, const Module &M) {
+  M.print(O, 0);
   return O;
 }
+  
 
 inline ValueSymbolTable *
 ilist_traits<Function>::getSymTab(Module *M) {