Patch up omissions in DebugLoc propagation.
[oota-llvm.git] / lib / Target / Mips / MipsTargetAsmInfo.cpp
index f8a14c66da12a742c5db0d8e570615737200278e..7566f41eaf62fd824a11fff543c74628d195a156 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "MipsTargetAsmInfo.h"
 #include "MipsTargetMachine.h"
+#include "llvm/GlobalVariable.h"
 
 using namespace llvm;
 
@@ -29,38 +30,45 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM):
   PrivateGlobalPrefix         = "$";
   JumpTableDataSection        = "\t.rdata";
   CommentString               = "#";
-  ReadOnlySection             = "\t.rdata";
   ZeroDirective               = "\t.space\t";
   BSSSection                  = "\t.section\t.bss";
   CStringSection              = ".rodata.str";
-  FourByteConstantSection     = "\t.section\t.rodata.cst4,\"aM\",@progbits,4";
 
   if (!Subtarget->hasABICall()) {
     JumpTableDirective = "\t.word\t";
     SmallDataSection = getNamedSection("\t.sdata", SectionFlags::Writeable);
-    SmallBSSSection = getNamedSection("\t.sbss", SectionFlags::Writeable | 
+    SmallBSSSection = getNamedSection("\t.sbss",
+                                      SectionFlags::Writeable |
                                       SectionFlags::BSS);
-  } else 
+  } else
     JumpTableDirective = "\t.gpword\t";
 
 }
 
-SectionKind::Kind
-MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
+unsigned MipsTargetAsmInfo::
+SectionFlagsForGlobal(const GlobalValue *GV, const char* Name) const {
+  unsigned Flags = ELFTargetAsmInfo::SectionFlagsForGlobal(GV, Name);
+  // Mask out Small Section flag bit, Mips doesnt support 's' section symbol
+  // for its small sections.
+  return (Flags & (~SectionFlags::Small));
+}
+
+SectionKind::Kind MipsTargetAsmInfo::
+SectionKindForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind K = ELFTargetAsmInfo::SectionKindForGlobal(GV);
 
   if (Subtarget->hasABICall())
     return K;
 
-  if (K != SectionKind::Data && K != SectionKind::BSS && 
+  if (K != SectionKind::Data && K != SectionKind::BSS &&
       K != SectionKind::RODataMergeConst)
     return K;
 
   if (isa<GlobalVariable>(GV)) {
-    const TargetData *TD = ETM->getTargetData();
-    unsigned Size = TD->getABITypeSize(GV->getType()->getElementType());
+    const TargetData *TD = TM.getTargetData();
+    unsigned Size = TD->getTypePaddedSize(GV->getType()->getElementType());
     unsigned Threshold = Subtarget->getSSectionThreshold();
-     
+
     if (Size > 0 && Size <= Threshold) {
       if (K == SectionKind::BSS)
         return SectionKind::SmallBSS;
@@ -72,12 +80,12 @@ MipsTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
   return K;
 }
 
-const Section*
-MipsTargetAsmInfo::SelectSectionForGlobal(const GlobalValue *GV) const {
+const Section* MipsTargetAsmInfo::
+SelectSectionForGlobal(const GlobalValue *GV) const {
   SectionKind::Kind K = SectionKindForGlobal(GV);
   const GlobalVariable *GVA = dyn_cast<GlobalVariable>(GV);
 
-  if (GVA && (!GVA->isWeakForLinker()))
+  if (GVA && (!GVA->mayBeOverridden()))
     switch (K) {
       case SectionKind::SmallData:
         return getSmallDataSection();