Rename PaddedSize to AllocSize, in the hope that this
[oota-llvm.git] / lib / Target / PIC16 / PIC16TargetAsmInfo.cpp
index ac4039baf7666d6460dae0ce1becfd529e1abdfb..8c1daac3845ef24d410da804b41fb1633c385b2d 100644 (file)
@@ -72,7 +72,7 @@ PIC16TargetAsmInfo::getBSSSectionForGlobal(const GlobalVariable *GV) const {
   // Find how much space this global needs.
   const TargetData *TD = TM.getTargetData();
   const Type *Ty = C->getType(); 
-  unsigned ValSize = TD->getTypePaddedSize(Ty);
+  unsigned ValSize = TD->getTypeAllocSize(Ty);
  
   // Go through all BSS Sections and assign this variable
   // to the first available section having enough space.
@@ -87,7 +87,7 @@ PIC16TargetAsmInfo::getBSSSectionForGlobal(const GlobalVariable *GV) const {
   // No BSS section spacious enough was found. Crate a new one.
   if (! FoundBSS) {
     char *name = new char[32];
-    sprintf (name, "udata.%d.# UDATA", BSSSections.size());
+    sprintf (name, "udata.%d.# UDATA", (int)BSSSections.size());
     const Section *NewSection = getNamedSection (name);
 
     FoundBSS = new PIC16Section(NewSection);
@@ -118,7 +118,7 @@ PIC16TargetAsmInfo::getIDATASectionForGlobal(const GlobalVariable *GV) const {
   // Find how much space this global needs.
   const TargetData *TD = TM.getTargetData();
   const Type *Ty = C->getType(); 
-  unsigned ValSize = TD->getTypePaddedSize(Ty);
+  unsigned ValSize = TD->getTypeAllocSize(Ty);
  
   // Go through all IDATA Sections and assign this variable
   // to the first available section having enough space.
@@ -133,7 +133,7 @@ PIC16TargetAsmInfo::getIDATASectionForGlobal(const GlobalVariable *GV) const {
   // No IDATA section spacious enough was found. Crate a new one.
   if (! FoundIDATA) {
     char *name = new char[32];
-    sprintf (name, "idata.%d.# IDATA", IDATASections.size());
+    sprintf (name, "idata.%d.# IDATA", (int)IDATASections.size());
     const Section *NewSection = getNamedSection (name);
 
     FoundIDATA = new PIC16Section(NewSection);
@@ -192,7 +192,7 @@ void PIC16TargetAsmInfo::SetSectionForGVs(Module &M) {
     // variable and should not be printed in global data section.
     std::string name = I->getName();
     if (name.find(".auto.") != std::string::npos
-      || name.find(".arg.") != std::string::npos)
+      || name.find(".args.") != std::string::npos)
       continue;
     int AddrSpace = I->getType()->getAddressSpace();
 
@@ -202,58 +202,6 @@ void PIC16TargetAsmInfo::SetSectionForGVs(Module &M) {
 }
 
 
-// Helper routine.
-// Func name starts after prefix and followed by a .
-static std::string getFuncNameForSym(const std::string &Sym, 
-                                      PIC16ABINames::IDs PrefixType) {
-
-  const char *prefix = getIDName (PIC16ABINames::PREFIX_SYMBOL);
-
-  // This name may or may not start with prefix;
-  // Func names start after prfix in that case.
-  size_t func_name_start = 0;
-  if (Sym.find(prefix, 0, strlen(prefix)) != std::string::npos)
-    func_name_start = strlen(prefix);
-
-  // Position of the . after func name.
-  size_t func_name_end = Sym.find ('.', func_name_start);
-
-  return Sym.substr (func_name_start, func_name_end);
-}
-
-// Helper routine to create a section name given the section prefix
-// and func name.
-static std::string
-getSectionNameForFunc (const std::string &Fname,
-                       const PIC16ABINames::IDs sec_id) {
-  std::string sec_id_string = getIDName (sec_id);
-  return sec_id_string + "." + Fname + ".#";
-}
-
-
-// Get the section for the given external symbol names.
-// This function is meant for only mangled external symbol names.
-std::string 
-llvm::getSectionNameForSym(const std::string &Sym) {
-  std::string SectionName;
-
-  PIC16ABINames::IDs id = getID (Sym);
-  std::string Fname = getFuncNameForSym (Sym, id);
-
-  switch (id) {
-    default : assert (0 && "Could not determine external symbol type");
-    case PIC16ABINames::FUNC_FRAME: 
-    case PIC16ABINames::FUNC_RET: 
-    case PIC16ABINames::FUNC_TEMPS: 
-    case PIC16ABINames::FUNC_ARGS:  {
-      return getSectionNameForFunc (Fname, PIC16ABINames::FRAME_SECTION);
-    }
-    case PIC16ABINames::FUNC_AUTOS: { 
-      return getSectionNameForFunc (Fname, PIC16ABINames::AUTOS_SECTION);
-    }
-  }
-}
-
 PIC16TargetAsmInfo::~PIC16TargetAsmInfo() {
   
   for (unsigned i = 0; i < BSSSections.size(); i++) {