Rename some GC classes so that their roll will hopefully be clearer.
[oota-llvm.git] / include / llvm / CodeGen / MachineConstantPool.h
index 1878b527276f6a04e95b7d824380308b3e2f9e3e..ba491ce2556cdefe28eb368db4ea4a22d83a54d0 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.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -15,7 +15,9 @@
 #ifndef LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 #define LLVM_CODEGEN_MACHINECONSTANTPOOL_H
 
-#include "llvm/CodeGen/SelectionDAGCSEMap.h"
+#include "llvm/ADT/FoldingSet.h"
+#include "llvm/Support/Streams.h"
+#include <cassert>
 #include <vector>
 #include <iosfwd>
 
@@ -25,6 +27,7 @@ class AsmPrinter;
 class Constant;
 class TargetData;
 class TargetMachine;
+class Type;
 class MachineConstantPool;
 
 /// Abstract base class for all machine specific constantpool value subclasses.
@@ -33,8 +36,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.
   ///
@@ -43,11 +46,12 @@ public:
   virtual int getExistingMachineCPValue(MachineConstantPool *CP,
                                         unsigned Alignment) = 0;
 
-  virtual void AddSelectionDAGCSEId(SelectionDAGCSEMap::NodeID *Id) = 0;
+  virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID) = 0;
 
   /// print - Implement operator<<...
   ///
   virtual void print(std::ostream &O) const = 0;
+  void print(std::ostream *O) const { if (O) print(*O); }
 };
 
 inline std::ostream &operator<<(std::ostream &OS,
@@ -60,7 +64,8 @@ inline std::ostream &operator<<(std::ostream &OS,
 /// It contains a pointer to the value and an offset from the start of
 /// the constant pool.
 /// @brief An entry in a MachineConstantPool
-struct MachineConstantPoolEntry {
+class MachineConstantPoolEntry {
+public:
   /// The constant itself.
   union {
     Constant *ConstVal;
@@ -110,7 +115,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
@@ -133,6 +139,7 @@ public:
   /// constant pool objects.  Implemented in MachineFunction.cpp
   ///
   void print(std::ostream &OS) const;
+  void print(std::ostream *OS) const { if (OS) print(*OS); }
 
   /// dump - Call print(std::cerr) to be called from the debugger.
   ///