[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h

Chris Lattner lattner at cs.uiuc.edu
Wed Feb 8 20:22:01 PST 2006



Changes in directory llvm/include/llvm/CodeGen:

MachineConstantPool.h updated: 1.12 -> 1.13
---
Log message:

Use a MachineConstantPoolEntry struct instead of a pair to hold 
constant pool entries.


---
Diffs of the changes:  (+15 -5)

 MachineConstantPool.h |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)


Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.12 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.13
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.12	Wed Feb  8 20:25:42 2006
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h	Wed Feb  8 22:21:49 2006
@@ -30,10 +30,20 @@
 
 class Constant;
 
+/// MachineConstantPoolEntry - One entry in the constant pool.
+///
+struct MachineConstantPoolEntry {
+  /// Val - The constant itself.
+  Constant *Val;
+  /// Alignment - The alignment of the constant.
+  unsigned Alignment;
+  
+  MachineConstantPoolEntry(Constant *V, unsigned A) : Val(V), Alignment(A) {}
+};
+  
 class MachineConstantPool {
-  std::vector<std::pair<Constant*,unsigned> > Constants;
+  std::vector<MachineConstantPoolEntry> Constants;
 public:
-
   /// getConstantPoolIndex - Create a new entry in the constant pool or return
   /// an existing one.  User must specify an alignment in bytes for the object.
   ///
@@ -44,9 +54,9 @@
     //
     // FIXME, this could be made much more efficient for large constant pools.
     for (unsigned i = 0, e = Constants.size(); i != e; ++i)
-      if (Constants[i].first == C && Constants[i].second >= Alignment)
+      if (Constants[i].Val == C && Constants[i].Alignment >= Alignment)
         return i;
-    Constants.push_back(std::make_pair(C, Alignment));
+    Constants.push_back(MachineConstantPoolEntry(C, Alignment));
     return Constants.size()-1;
   }
 
@@ -54,7 +64,7 @@
   ///
   bool isEmpty() const { return Constants.empty(); }
 
-  const std::vector<std::pair<Constant*,unsigned> > &getConstants() const {
+  const std::vector<MachineConstantPoolEntry> &getConstants() const {
     return Constants;
   }
 






More information about the llvm-commits mailing list