Initial support for carrying MachineInstrs in SUnits.
[oota-llvm.git] / include / llvm / CodeGen / MachineConstantPool.h
index 6bb2665985ece2be7035cc241eb916932c530baf..280d54dbf804bb34e64af83bbf8958a7599a13cd 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
 #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 
 #include "llvm/ADT/FoldingSet.h"
-#include "llvm/CodeGen/SelectionDAGNodes.h"
-#include "llvm/Support/Streams.h"
+#include <cassert>
 #include <vector>
-#include <iosfwd>
 
 namespace llvm {
 
@@ -27,7 +25,9 @@ class AsmPrinter;
 class Constant;
 class TargetData;
 class TargetMachine;
+class Type;
 class MachineConstantPool;
+class raw_ostream;
 
 /// Abstract base class for all machine specific constantpool value subclasses.
 ///
@@ -35,8 +35,8 @@ class MachineConstantPoolValue {
   const Type *Ty;
 
 public:
-  MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
-  virtual ~MachineConstantPoolValue() {};
+  explicit MachineConstantPoolValue(const Type *ty) : Ty(ty) {}
+  virtual ~MachineConstantPoolValue() {}
 
   /// getType - get type of this MachineConstantPoolValue.
   ///
@@ -47,24 +47,16 @@ public:
 
   virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID) = 0;
 
-  /// print - Implement operator<<...
-  ///
-  void print(llvm_ostream &O) const {
-    if (O.stream()) print(*O.stream());
-  }
-  virtual void print(std::ostream &O) const = 0;
+  /// print - Implement operator<<
+  virtual void print(raw_ostream &O) const = 0;
 };
 
-inline llvm_ostream &operator<<(llvm_ostream &OS,
-                                const MachineConstantPoolValue &V) {
-  V.print(OS);
-  return OS;
-}
-inline std::ostream &operator<<(std::ostream &OS,
-                                const MachineConstantPoolValue &V) {
+inline raw_ostream &operator<<(raw_ostream &OS,
+                               const MachineConstantPoolValue &V) {
   V.print(OS);
   return OS;
 }
+  
 
 /// This class is a data container for one entry in a MachineConstantPool.
 /// It contains a pointer to the value and an offset from the start of
@@ -121,7 +113,8 @@ class MachineConstantPool {
   std::vector<MachineConstantPoolEntry> Constants; ///< The pool of constants.
 public:
   /// @brief The only constructor.
-  MachineConstantPool(const TargetData *td) : TD(td), PoolAlignment(1) {}
+  explicit MachineConstantPool(const TargetData *td)
+    : TD(td), PoolAlignment(1) {}
   ~MachineConstantPool();
     
   /// getConstantPoolAlignment - Return the log2 of the alignment required by
@@ -129,7 +122,8 @@ public:
   unsigned getConstantPoolAlignment() const { return PoolAlignment; }
   
   /// getConstantPoolIndex - Create a new entry in the constant pool or return
-  /// an existing one.  User must specify an alignment in bytes for the object.
+  /// an existing one.  User must specify the log2 of the minimum required
+  /// alignment for the object.
   unsigned getConstantPoolIndex(Constant *C, unsigned Alignment);
   unsigned getConstantPoolIndex(MachineConstantPoolValue *V,unsigned Alignment);
   
@@ -143,13 +137,9 @@ public:
   /// print - Used by the MachineFunction printer to print information about
   /// constant pool objects.  Implemented in MachineFunction.cpp
   ///
-  void print(llvm_ostream &OS) const {
-    if (OS.stream()) print(*OS.stream());
-  }
-  void print(std::ostream &OS) const;
+  void print(raw_ostream &OS) const;
 
-  /// dump - Call print(std::cerr) to be called from the debugger.
-  ///
+  /// dump - Call print(cerr) to be called from the debugger.
   void dump() const;
 };