mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 06:33:24 +00:00
Actually share constants local to a function!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9417 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c8893fcc71
commit
d97487d1e0
@ -30,10 +30,15 @@ class MachineConstantPool {
|
||||
public:
|
||||
|
||||
/// getConstantPoolIndex - Create a new entry in the constant pool or return
|
||||
/// an existing one. This should eventually allow sharing of duplicate
|
||||
/// objects in the constant pool, but this is adequate for now.
|
||||
/// an existing one.
|
||||
///
|
||||
unsigned getConstantPoolIndex(Constant *C) {
|
||||
// Check to see if we already have this constant.
|
||||
//
|
||||
// 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] == C)
|
||||
return i;
|
||||
Constants.push_back(C);
|
||||
return Constants.size()-1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user