X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FDarwinTargetAsmInfo.cpp;h=cc05c09c5170a1b401706e4317e49f11410b98de;hb=dd64c417c0ef73345222eca60154289c1ad62a09;hp=20866d7617e1b07c0578b9b0f9cf90454cb78d6d;hpb=585457e37effc1f065281d0dad7858305b304fcb;p=oota-llvm.git diff --git a/lib/Target/DarwinTargetAsmInfo.cpp b/lib/Target/DarwinTargetAsmInfo.cpp index 20866d7617e..cc05c09c517 100644 --- a/lib/Target/DarwinTargetAsmInfo.cpp +++ b/lib/Target/DarwinTargetAsmInfo.cpp @@ -24,8 +24,8 @@ using namespace llvm; -DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) { - DTM = &TM; +DarwinTargetAsmInfo::DarwinTargetAsmInfo(const TargetMachine &TM) + : TargetAsmInfo(TM) { CStringSection_ = getUnnamedSection("\t.cstring", SectionFlags::Mergeable | SectionFlags::Strings); @@ -61,7 +61,7 @@ DarwinTargetAsmInfo::emitUsedDirectiveFor(const GlobalValue* GV, Mangler *Mang) const { if (GV==0) return false; - if (GV->hasInternalLinkage() && !isa(GV) && + if (GV->hasLocalLinkage() && !isa(GV) && ((strlen(getPrivateGlobalPrefix()) != 0 && Mang->getValueName(GV).substr(0,strlen(getPrivateGlobalPrefix())) == getPrivateGlobalPrefix()) || @@ -76,7 +76,7 @@ const Section* DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { SectionKind::Kind Kind = SectionKindForGlobal(GV); bool isWeak = GV->mayBeOverridden(); - bool isNonStatic = (DTM->getRelocationModel() != Reloc::Static); + bool isNonStatic = TM.getRelocationModel() != Reloc::Static; switch (Kind) { case SectionKind::Text: @@ -108,17 +108,17 @@ DarwinTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const { } // FIXME: Do we have any extra special weird cases? + return NULL; } const Section* DarwinTargetAsmInfo::MergeableStringSection(const GlobalVariable *GV) const { - const TargetData *TD = DTM->getTargetData(); + const TargetData *TD = TM.getTargetData(); Constant *C = cast(GV)->getInitializer(); - const Type *Type = cast(C)->getType()->getElementType(); + const Type *Ty = cast(C->getType())->getElementType(); - unsigned Size = TD->getABITypeSize(Type); + unsigned Size = TD->getTypePaddedSize(Ty); if (Size) { - const TargetData *TD = DTM->getTargetData(); unsigned Align = TD->getPreferredAlignment(GV); if (Align <= 32) return getCStringSection_(); @@ -136,9 +136,9 @@ DarwinTargetAsmInfo::MergeableConstSection(const GlobalVariable *GV) const { inline const Section* DarwinTargetAsmInfo::MergeableConstSection(const Type *Ty) const { - const TargetData *TD = DTM->getTargetData(); + const TargetData *TD = TM.getTargetData(); - unsigned Size = TD->getABITypeSize(Ty); + unsigned Size = TD->getTypePaddedSize(Ty); if (Size == 4) return FourByteConstantSection; else if (Size == 8) @@ -155,7 +155,7 @@ DarwinTargetAsmInfo::SelectSectionForMachineConst(const Type *Ty) const { // Handle weird special case, when compiling PIC stuff. if (S == getReadOnlySection() && - DTM->getRelocationModel() != Reloc::Static) + TM.getRelocationModel() != Reloc::Static) return ConstDataSection; return S;