summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachOWriter.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2007-11-05 00:04:43 +0000
committerDuncan Sands <baldrick@free.fr>2007-11-05 00:04:43 +0000
commitca0ed744852a7d9625572fbb793f65e81225a3e8 (patch)
treededf204008d224f4537fd9262cacd8b640ab4d35 /lib/CodeGen/MachOWriter.cpp
parent83430bce1d21c8095438ed591cb9c72b5c666a07 (diff)
downloadllvm-ca0ed744852a7d9625572fbb793f65e81225a3e8.tar.gz
llvm-ca0ed744852a7d9625572fbb793f65e81225a3e8.tar.bz2
llvm-ca0ed744852a7d9625572fbb793f65e81225a3e8.tar.xz
Eliminate the remaining uses of getTypeSize. This
should only effect x86 when using long double. Now 12/16 bytes are output for long double globals (the exact amount depends on the alignment). This brings globals in line with the rest of LLVM: the space reserved for an object is now always the ABI size. One tricky point is that only 10 bytes should be output for long double if it is a field in a packed struct, which is the reason for the additional argument to EmitGlobalConstant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43688 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachOWriter.cpp')
-rw-r--r--lib/CodeGen/MachOWriter.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index 0c743759da..9389088f20 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/lib/CodeGen/MachOWriter.cpp
@@ -259,7 +259,7 @@ void MachOCodeEmitter::emitConstantPool(MachineConstantPool *MCP) {
// "giant object for PIC" optimization.
for (unsigned i = 0, e = CP.size(); i != e; ++i) {
const Type *Ty = CP[i].getType();
- unsigned Size = TM.getTargetData()->getTypeSize(Ty);
+ unsigned Size = TM.getTargetData()->getABITypeSize(Ty);
MachOWriter::MachOSection *Sec = MOW.getConstSection(CP[i].Val.ConstVal);
OutputBuffer SecDataOut(Sec->SectionData, is64Bit, isLittleEndian);
@@ -333,7 +333,7 @@ MachOWriter::~MachOWriter() {
void MachOWriter::AddSymbolToSection(MachOSection *Sec, GlobalVariable *GV) {
const Type *Ty = GV->getType()->getElementType();
- unsigned Size = TM.getTargetData()->getTypeSize(Ty);
+ unsigned Size = TM.getTargetData()->getABITypeSize(Ty);
unsigned Align = GV->getAlignment();
if (Align == 0)
Align = TM.getTargetData()->getPrefTypeAlignment(Ty);
@@ -380,7 +380,7 @@ void MachOWriter::AddSymbolToSection(MachOSection *Sec, GlobalVariable *GV) {
void MachOWriter::EmitGlobal(GlobalVariable *GV) {
const Type *Ty = GV->getType()->getElementType();
- unsigned Size = TM.getTargetData()->getTypeSize(Ty);
+ unsigned Size = TM.getTargetData()->getABITypeSize(Ty);
bool NoInit = !GV->hasInitializer();
// If this global has a zero initializer, it is part of the .bss or common
@@ -803,7 +803,8 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
if (isa<UndefValue>(PC)) {
continue;
} else if (const ConstantVector *CP = dyn_cast<ConstantVector>(PC)) {
- unsigned ElementSize = TD->getTypeSize(CP->getType()->getElementType());
+ unsigned ElementSize =
+ TD->getABITypeSize(CP->getType()->getElementType());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
WorkList.push_back(CPair(CP->getOperand(i), PA+i*ElementSize));
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(PC)) {
@@ -904,9 +905,10 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
abort();
}
} else if (isa<ConstantAggregateZero>(PC)) {
- memset((void*)PA, 0, (size_t)TD->getTypeSize(PC->getType()));
+ memset((void*)PA, 0, (size_t)TD->getABITypeSize(PC->getType()));
} else if (const ConstantArray *CPA = dyn_cast<ConstantArray>(PC)) {
- unsigned ElementSize = TD->getTypeSize(CPA->getType()->getElementType());
+ unsigned ElementSize =
+ TD->getABITypeSize(CPA->getType()->getElementType());
for (unsigned i = 0, e = CPA->getNumOperands(); i != e; ++i)
WorkList.push_back(CPair(CPA->getOperand(i), PA+i*ElementSize));
} else if (const ConstantStruct *CPS = dyn_cast<ConstantStruct>(PC)) {