Add some cleanup to the DataLayout changes requested by Chandler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166607 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Micah Villmow
2012-10-24 18:36:13 +00:00
parent 199063ea37
commit b52fb87617
11 changed files with 38 additions and 27 deletions

View File

@@ -385,8 +385,8 @@ void AsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
// - __tlv_bootstrap - used to make sure support exists
// - spare pointer, used when mapped by the runtime
// - pointer to mangled symbol above with initializer
unsigned AS = GV->getType()->getAddressSpace();
unsigned PtrSize = TD->getPointerSizeInBits(AS)/8;
assert(GV->getType()->isPointerTy() && "GV must be a pointer type!");
unsigned PtrSize = TD->getTypeSizeInBits(GV->getType())/8;
OutStreamer.EmitSymbolValue(GetExternalSymbolSymbol("_tlv_bootstrap"),
PtrSize, 0);
OutStreamer.EmitIntValue(0, PtrSize, 0);
@@ -1481,9 +1481,9 @@ static const MCExpr *lowerConstant(const Constant *CV, AsmPrinter &AP) {
if (Offset == 0)
return Base;
unsigned AS = cast<PointerType>(CE->getType())->getAddressSpace();
assert(CE->getType()->isPointerTy() && "We must have a pointer type!");
// Truncate/sext the offset to the pointer size.
unsigned Width = TD.getPointerSizeInBits(AS);
unsigned Width = TD.getTypeSizeInBits(CE->getType());
if (Width < 64)
Offset = SignExtend64(Offset, Width);