aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineFunction.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-09-14 05:50:57 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-09-14 05:50:57 +0000
commit4f9299552bb907a9be4ae918f92c5754e81cb372 (patch)
tree896e26ebd0578b44b75e5a573bd41493a4898163 /llvm/lib/CodeGen/MachineFunction.cpp
parentdd53fd41cda2f2f1c8b0c5289063c213315e54d7 (diff)
downloadllvm-4f9299552bb907a9be4ae918f92c5754e81cb372.zip
llvm-4f9299552bb907a9be4ae918f92c5754e81cb372.tar.gz
llvm-4f9299552bb907a9be4ae918f92c5754e81cb372.tar.bz2
A MachineConstantPool may have mixed Constant* and MachineConstantPoolValue* values.
llvm-svn: 30316
Diffstat (limited to 'llvm/lib/CodeGen/MachineFunction.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineFunction.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineFunction.cpp b/llvm/lib/CodeGen/MachineFunction.cpp
index e078324..0babf22 100644
--- a/llvm/lib/CodeGen/MachineFunction.cpp
+++ b/llvm/lib/CodeGen/MachineFunction.cpp
@@ -351,6 +351,12 @@ void MachineJumpTableInfo::dump() const { print(std::cerr); }
// MachineConstantPool implementation
//===----------------------------------------------------------------------===//
+const Type *MachineConstantPoolEntry::getType() const {
+ if (isMachineConstantPoolEntry())
+ return Val.MachineCPVal->getType();
+ return Val.ConstVal->getType();
+}
+
MachineConstantPool::~MachineConstantPool() {
for (unsigned i = 0, e = Constants.size(); i != e; ++i)
if (Constants[i].isMachineConstantPoolEntry())
@@ -376,7 +382,7 @@ unsigned MachineConstantPool::getConstantPoolIndex(Constant *C,
unsigned Offset = 0;
if (!Constants.empty()) {
Offset = Constants.back().Offset;
- Offset += TD->getTypeSize(Constants.back().Val.ConstVal->getType());
+ Offset += TD->getTypeSize(Constants.back().getType());
Offset = (Offset+AlignMask)&~AlignMask;
}
@@ -400,7 +406,7 @@ unsigned MachineConstantPool::getConstantPoolIndex(MachineConstantPoolValue *V,
unsigned Offset = 0;
if (!Constants.empty()) {
Offset = Constants.back().Offset;
- Offset += TD->getTypeSize(Constants.back().Val.MachineCPVal->getType());
+ Offset += TD->getTypeSize(Constants.back().getType());
Offset = (Offset+AlignMask)&~AlignMask;
}