[llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineConstantPool.h
Chris Lattner
lattner at cs.uiuc.edu
Thu Oct 23 11:30:01 PDT 2003
Changes in directory llvm/include/llvm/CodeGen:
MachineConstantPool.h updated: 1.2 -> 1.3
---
Log message:
Actually share constants local to a function!
---
Diffs of the changes: (+7 -2)
Index: llvm/include/llvm/CodeGen/MachineConstantPool.h
diff -u llvm/include/llvm/CodeGen/MachineConstantPool.h:1.2 llvm/include/llvm/CodeGen/MachineConstantPool.h:1.3
--- llvm/include/llvm/CodeGen/MachineConstantPool.h:1.2 Mon Oct 20 15:19:23 2003
+++ llvm/include/llvm/CodeGen/MachineConstantPool.h Thu Oct 23 11:29:12 2003
@@ -30,10 +30,15 @@
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;
}
More information about the llvm-commits
mailing list