From 69a9563969156f9ea4345d21673f350ee237d4da Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 9 Feb 2006 04:21:49 +0000 Subject: [PATCH] Use a MachineConstantPoolEntry struct instead of a pair to hold constant pool entries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26075 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineConstantPool.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h index 2ac6e148b34..bcfa40c18cb 100644 --- a/include/llvm/CodeGen/MachineConstantPool.h +++ b/include/llvm/CodeGen/MachineConstantPool.h @@ -30,10 +30,20 @@ namespace llvm { 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 > Constants; + std::vector 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 @@ public: // // 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 @@ public: /// bool isEmpty() const { return Constants.empty(); } - const std::vector > &getConstants() const { + const std::vector &getConstants() const { return Constants; }