mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 21:32:39 +00:00
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
This commit is contained in:
parent
74b7d27ab1
commit
69a9563969
@ -30,10 +30,20 @@ namespace llvm {
|
|||||||
|
|
||||||
class Constant;
|
class Constant;
|
||||||
|
|
||||||
class MachineConstantPool {
|
/// MachineConstantPoolEntry - One entry in the constant pool.
|
||||||
std::vector<std::pair<Constant*,unsigned> > Constants;
|
///
|
||||||
public:
|
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<MachineConstantPoolEntry> Constants;
|
||||||
|
public:
|
||||||
/// getConstantPoolIndex - Create a new entry in the constant pool or return
|
/// 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 an alignment in bytes for the object.
|
||||||
///
|
///
|
||||||
@ -44,9 +54,9 @@ public:
|
|||||||
//
|
//
|
||||||
// FIXME, this could be made much more efficient for large constant pools.
|
// FIXME, this could be made much more efficient for large constant pools.
|
||||||
for (unsigned i = 0, e = Constants.size(); i != e; ++i)
|
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;
|
return i;
|
||||||
Constants.push_back(std::make_pair(C, Alignment));
|
Constants.push_back(MachineConstantPoolEntry(C, Alignment));
|
||||||
return Constants.size()-1;
|
return Constants.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +64,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool isEmpty() const { return Constants.empty(); }
|
bool isEmpty() const { return Constants.empty(); }
|
||||||
|
|
||||||
const std::vector<std::pair<Constant*,unsigned> > &getConstants() const {
|
const std::vector<MachineConstantPoolEntry> &getConstants() const {
|
||||||
return Constants;
|
return Constants;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user