aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/CodeGen/MachineConstantPool.h
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-01-31 22:23:14 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-01-31 22:23:14 +0000
commitb8973bd8f50d7321635e1e07b81a880a0828d185 (patch)
tree452842927ad6a1c0969372cef9b984007ac68328 /include/llvm/CodeGen/MachineConstantPool.h
parent259e97cc725011a3c138563d421a4654b082a64c (diff)
Allow the specification of explicit alignments for constant pool entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/CodeGen/MachineConstantPool.h')
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index c2c3399adb..1bbf88d843 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -30,20 +30,23 @@ namespace llvm {
class Constant;
class MachineConstantPool {
- std::vector<Constant*> Constants;
+ std::vector<std::pair<Constant*,unsigned> > Constants;
public:
/// getConstantPoolIndex - Create a new entry in the constant pool or return
- /// an existing one.
+ /// an existing one. User may specify an alignment that is greater than the
+ /// default alignment. If one is not specified, it will be 0.
///
- unsigned getConstantPoolIndex(Constant *C) {
+ unsigned getConstantPoolIndex(Constant *C, unsigned Alignment = 0) {
// 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)
+ if (Constants[i].first == C) {
+ Constants[i].second = std::max(Constants[i].second, Alignment);
return i;
- Constants.push_back(C);
+ }
+ Constants.push_back(std::make_pair(C, Alignment));
return Constants.size()-1;
}
@@ -51,7 +54,9 @@ public:
///
bool isEmpty() const { return Constants.empty(); }
- const std::vector<Constant*> &getConstants() const { return Constants; }
+ const std::vector<std::pair<Constant*,unsigned> > &getConstants() const {
+ return Constants;
+ }
/// print - Used by the MachineFunction printer to print information about
/// stack objects. Implemented in MachineFunction.cpp