add a new MCAsmStreamer::GetCommentOS method to simplify stuff
[oota-llvm.git] / lib / CodeGen / AsmPrinter / AsmPrinter.cpp
index d439fb6e3c1b3fee39f73af04cce1c1871d421e8..3f0a9def7fe3c1de0d3779aee55370c9cf08883b 100644 (file)
@@ -50,6 +50,15 @@ static cl::opt<cl::boolOrDefault>
 AsmVerbose("asm-verbose", cl::desc("Add comments to directives."),
            cl::init(cl::BOU_UNSET));
 
+static bool getVerboseAsm(bool VDef) {
+  switch (AsmVerbose) {
+  default:
+  case cl::BOU_UNSET: return VDef;
+  case cl::BOU_TRUE:  return true;
+  case cl::BOU_FALSE: return false;
+  }      
+}
+
 char AsmPrinter::ID = 0;
 AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
                        const MCAsmInfo *T, bool VDef)
@@ -59,15 +68,12 @@ AsmPrinter::AsmPrinter(formatted_raw_ostream &o, TargetMachine &tm,
     OutContext(*new MCContext()),
     // FIXME: Pass instprinter to streamer.
     OutStreamer(*createAsmStreamer(OutContext, O, *T,
-                                   TM.getTargetData()->isLittleEndian(), 0)),
+                                   TM.getTargetData()->isLittleEndian(),
+                                   getVerboseAsm(VDef), 0)),
 
     LastMI(0), LastFn(0), Counter(~0U), PrevDLT(NULL) {
   DW = 0; MMI = 0;
-  switch (AsmVerbose) {
-  case cl::BOU_UNSET: VerboseAsm = VDef;  break;
-  case cl::BOU_TRUE:  VerboseAsm = true;  break;
-  case cl::BOU_FALSE: VerboseAsm = false; break;
-  }
+  VerboseAsm = getVerboseAsm(VDef);
 }
 
 AsmPrinter::~AsmPrinter() {
@@ -700,9 +706,7 @@ void AsmPrinter::EOL() const {
 void AsmPrinter::EOL(const Twine &Comment) const {
   if (VerboseAsm && !Comment.isTriviallyEmpty()) {
     O.PadToColumn(MAI->getCommentColumn());
-    O << MAI->getCommentString()
-      << ' '
-      << Comment;
+    O << MAI->getCommentString() << ' ' << Comment;
   }
   O << '\n';
 }
@@ -784,39 +788,25 @@ void AsmPrinter::EmitSLEB128Bytes(int Value) const {
 /// EmitInt8 - Emit a byte directive and value.
 ///
 void AsmPrinter::EmitInt8(int Value) const {
-  O << MAI->getData8bitsDirective();
-  PrintHex(Value & 0xFF);
+  OutStreamer.EmitIntValue(Value, 1, 0/*addrspace*/);
 }
 
 /// EmitInt16 - Emit a short directive and value.
 ///
 void AsmPrinter::EmitInt16(int Value) const {
-  O << MAI->getData16bitsDirective();
-  PrintHex(Value & 0xFFFF);
+  OutStreamer.EmitIntValue(Value, 2, 0/*addrspace*/);
 }
 
 /// EmitInt32 - Emit a long directive and value.
 ///
 void AsmPrinter::EmitInt32(int Value) const {
-  O << MAI->getData32bitsDirective();
-  PrintHex(Value);
+  OutStreamer.EmitIntValue(Value, 4, 0/*addrspace*/);
 }
 
 /// EmitInt64 - Emit a long long directive and value.
 ///
 void AsmPrinter::EmitInt64(uint64_t Value) const {
-  if (MAI->getData64bitsDirective()) {
-    O << MAI->getData64bitsDirective();
-    PrintHex(Value);
-  } else {
-    if (TM.getTargetData()->isBigEndian()) {
-      EmitInt32(unsigned(Value >> 32)); O << '\n';
-      EmitInt32(unsigned(Value));
-    } else {
-      EmitInt32(unsigned(Value)); O << '\n';
-      EmitInt32(unsigned(Value >> 32));
-    }
-  }
+  OutStreamer.EmitIntValue(Value, 8, 0/*addrspace*/);
 }
 
 /// toOctal - Convert the low order bits of X into an octal digit.
@@ -1102,8 +1092,7 @@ static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
 
 static void EmitGlobalConstantVector(const ConstantVector *CV,
                                      unsigned AddrSpace, AsmPrinter &AP) {
-  const VectorType *VTy = CV->getType();
-  for (unsigned i = 0, e = VTy->getNumElements(); i != e; ++i)
+  for (unsigned i = 0, e = CV->getType()->getNumElements(); i != e; ++i)
     AP.EmitGlobalConstant(CV->getOperand(i), AddrSpace);
 }
 
@@ -1112,62 +1101,52 @@ static void EmitGlobalConstantStruct(const ConstantStruct *CS,
   // Print the fields in successive locations. Pad to align if needed!
   const TargetData *TD = AP.TM.getTargetData();
   unsigned Size = TD->getTypeAllocSize(CS->getType());
-  const StructLayout *cvsLayout = TD->getStructLayout(CS->getType());
+  const StructLayout *Layout = TD->getStructLayout(CS->getType());
   uint64_t SizeSoFar = 0;
   for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) {
-    const Constant *field = CS->getOperand(i);
+    const Constant *Field = CS->getOperand(i);
 
     // Check if padding is needed and insert one or more 0s.
-    uint64_t fieldSize = TD->getTypeAllocSize(field->getType());
-    uint64_t padSize = ((i == e-1 ? Size : cvsLayout->getElementOffset(i+1))
-                        - cvsLayout->getElementOffset(i)) - fieldSize;
-    SizeSoFar += fieldSize + padSize;
+    uint64_t FieldSize = TD->getTypeAllocSize(Field->getType());
+    uint64_t PadSize = ((i == e-1 ? Size : Layout->getElementOffset(i+1))
+                        - Layout->getElementOffset(i)) - FieldSize;
+    SizeSoFar += FieldSize + PadSize;
 
     // Now print the actual field value.
-    AP.EmitGlobalConstant(field, AddrSpace);
+    AP.EmitGlobalConstant(Field, AddrSpace);
 
     // Insert padding - this may include padding to increase the size of the
     // current field up to the ABI size (if the struct is not packed) as well
     // as padding to ensure that the next field starts at the right offset.
-    AP.OutStreamer.EmitZeros(padSize, AddrSpace);
+    AP.OutStreamer.EmitZeros(PadSize, AddrSpace);
   }
-  assert(SizeSoFar == cvsLayout->getSizeInBytes() &&
+  assert(SizeSoFar == Layout->getSizeInBytes() &&
          "Layout of constant struct may be incorrect!");
 }
 
-void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP,
-                                      unsigned AddrSpace) {
+static void EmitGlobalConstantFP(const ConstantFP *CFP, unsigned AddrSpace,
+                                 AsmPrinter &AP) {
   // FP Constants are printed as integer constants to avoid losing
-  // precision...
-  const TargetData &TD = *TM.getTargetData();
+  // precision.
   if (CFP->getType()->isDoubleTy()) {
-    if (VerboseAsm) {
-      double Val = CFP->getValueAPF().convertToDouble();  // for comment only
-      O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << " double " << Val << '\n';
+    if (AP.VerboseAsm) {
+      double Val = CFP->getValueAPF().convertToDouble();
+      AP.OutStreamer.GetCommentOS() << "double " << Val << '\n';
     }
 
-    uint64_t i = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
-    if (MAI->getData64bitsDirective(AddrSpace)) {
-      O << MAI->getData64bitsDirective(AddrSpace) << i << '\n';
-    } else if (TD.isBigEndian()) {
-      O << MAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32)  << '\n';
-      O << MAI->getData32bitsDirective(AddrSpace) << unsigned(i) << '\n';
-    } else {
-      O << MAI->getData32bitsDirective(AddrSpace) << unsigned(i) << '\n';
-      O << MAI->getData32bitsDirective(AddrSpace) << unsigned(i >> 32) << '\n';
-    }
+    uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
+    AP.OutStreamer.EmitIntValue(Val, 8, AddrSpace);
     return;
   }
   
   if (CFP->getType()->isFloatTy()) {
-    if (VerboseAsm) {
+    if (AP.VerboseAsm) {
       float Val = CFP->getValueAPF().convertToFloat();  // for comment only
-      O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << " float " << Val << '\n';
+      AP.O.PadToColumn(AP.MAI->getCommentColumn());
+      AP.O << AP.MAI->getCommentString() << " float " << Val << '\n';
     }
-    O << MAI->getData32bitsDirective(AddrSpace)
-      << CFP->getValueAPF().bitcastToAPInt().getZExtValue() << '\n';
+    uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
+    AP.OutStreamer.EmitIntValue(Val, 4, AddrSpace);
     return;
   }
   
@@ -1176,32 +1155,29 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP,
     // api needed to prevent premature destruction
     APInt API = CFP->getValueAPF().bitcastToAPInt();
     const uint64_t *p = API.getRawData();
-    if (VerboseAsm) {
+    if (AP.VerboseAsm) {
       // Convert to double so we can print the approximate val as a comment.
       APFloat DoubleVal = CFP->getValueAPF();
       bool ignored;
       DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven,
                         &ignored);
-      O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << " x86_fp80 ~= "
-        << DoubleVal.convertToDouble() << '\n';
+      AP.O.PadToColumn(AP.MAI->getCommentColumn());
+      AP.O << AP.MAI->getCommentString() << " x86_fp80 ~= "
+           << DoubleVal.convertToDouble() << '\n';
     }
     
-    if (TD.isBigEndian()) {
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]) << '\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48)<<'\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32)<<'\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16)<<'\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0])      <<'\n';
+    if (AP.TM.getTargetData()->isBigEndian()) {
+      AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
+      AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
     } else {
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0]) << '\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 16)<<'\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 32)<<'\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[0] >> 48)<<'\n';
-      O << MAI->getData16bitsDirective(AddrSpace) << uint16_t(p[1]) << '\n';
+      AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
+      AP.OutStreamer.EmitIntValue(p[1], 2, AddrSpace);
     }
-    OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
-                            TD.getTypeStoreSize(CFP->getType()), AddrSpace);
+    
+    // Emit the tail padding for the long double.
+    const TargetData &TD = *AP.TM.getTargetData();
+    AP.OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
+                             TD.getTypeStoreSize(CFP->getType()), AddrSpace);
     return;
   }
   
@@ -1211,22 +1187,18 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP,
   // premature destruction.
   APInt API = CFP->getValueAPF().bitcastToAPInt();
   const uint64_t *p = API.getRawData();
-  if (TD.isBigEndian()) {
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32)<<'\n';
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0])<<'\n';
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32)<<'\n';
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1])<<'\n';
-   } else {
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1])<<'\n';
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[1] >> 32)<<'\n';
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0])<<'\n';
-    O << MAI->getData32bitsDirective(AddrSpace) << uint32_t(p[0] >> 32)<<'\n';
+  if (AP.TM.getTargetData()->isBigEndian()) {
+    AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
+    AP.OutStreamer.EmitIntValue(p[1], 8, AddrSpace);
+  } else {
+    AP.OutStreamer.EmitIntValue(p[1], 8, AddrSpace);
+    AP.OutStreamer.EmitIntValue(p[0], 8, AddrSpace);
   }
 }
 
-void AsmPrinter::EmitGlobalConstantLargeInt(const ConstantInt *CI,
-                                            unsigned AddrSpace) {
-  const TargetData *TD = TM.getTargetData();
+static void EmitGlobalConstantLargeInt(const ConstantInt *CI,
+                                       unsigned AddrSpace, AsmPrinter &AP) {
+  const TargetData *TD = AP.TM.getTargetData();
   unsigned BitWidth = CI->getBitWidth();
   assert((BitWidth & 63) == 0 && "only support multiples of 64-bits");
 
@@ -1235,51 +1207,38 @@ void AsmPrinter::EmitGlobalConstantLargeInt(const ConstantInt *CI,
   // quantities at a time.
   const uint64_t *RawData = CI->getValue().getRawData();
   for (unsigned i = 0, e = BitWidth / 64; i != e; ++i) {
-    uint64_t Val;
-    if (TD->isBigEndian())
-      Val = RawData[e - i - 1];
-    else
-      Val = RawData[i];
-
-    if (MAI->getData64bitsDirective(AddrSpace)) {
-      O << MAI->getData64bitsDirective(AddrSpace) << Val << '\n';
-      continue;
-    }
-
-    // Emit two 32-bit chunks, order depends on endianness.
-    unsigned FirstChunk = unsigned(Val), SecondChunk = unsigned(Val >> 32);
-    const char *FirstName = " least", *SecondName = " most";
-    if (TD->isBigEndian()) {
-      std::swap(FirstChunk, SecondChunk);
-      std::swap(FirstName, SecondName);
-    }
-    
-    O << MAI->getData32bitsDirective(AddrSpace) << FirstChunk;
-    if (VerboseAsm) {
-      O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString()
-        << FirstName << " significant half of i64 " << Val;
-    }
-    O << '\n';
-    
-    O << MAI->getData32bitsDirective(AddrSpace) << SecondChunk;
-    if (VerboseAsm) {
-      O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString()
-        << SecondName << " significant half of i64 " << Val;
-    }
-    O << '\n';
+    uint64_t Val = TD->isBigEndian() ? RawData[e - i - 1] : RawData[i];
+    AP.OutStreamer.EmitIntValue(Val, 8, AddrSpace);
   }
 }
 
 /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
 void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
-  const TargetData *TD = TM.getTargetData();
-  const Type *type = CV->getType();
-  unsigned Size = TD->getTypeAllocSize(type);
-
-  if (CV->isNullValue() || isa<UndefValue>(CV))
+  if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV)) {
+    uint64_t Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
     return OutStreamer.EmitZeros(Size, AddrSpace);
+  }
+
+  if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
+    unsigned Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
+    switch (Size) {
+    case 1:
+    case 2:
+    case 4:
+    case 8:
+      if (VerboseAsm) {
+        O.PadToColumn(MAI->getCommentColumn());
+        O << MAI->getCommentString() << " 0x";
+        O.write_hex(CI->getZExtValue());
+        O << '\n';
+      }
+      OutStreamer.EmitIntValue(CI->getZExtValue(), Size, AddrSpace);
+      return;
+    default:
+      EmitGlobalConstantLargeInt(CI, AddrSpace, *this);
+      return;
+    }
+  }
   
   if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
     return EmitGlobalConstantArray(CVA, AddrSpace, *this);
@@ -1288,36 +1247,36 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
     return EmitGlobalConstantStruct(CVS, AddrSpace, *this);
 
   if (const ConstantFP *CFP = dyn_cast<ConstantFP>(CV))
-    return EmitGlobalConstantFP(CFP, AddrSpace);
-  
-  if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
-    // If we can directly emit an 8-byte constant, do it.
-    if (Size == 8)
-      if (const char *Data64Dir = MAI->getData64bitsDirective(AddrSpace)) {
-        O << Data64Dir << CI->getZExtValue() << '\n';
-        return;
-      }
-
-    // Small integers are handled below; large integers are handled here.
-    if (Size > 4) {
-      EmitGlobalConstantLargeInt(CI, AddrSpace);
-      return;
-    }
-  }
+    return EmitGlobalConstantFP(CFP, AddrSpace, *this);
   
   if (const ConstantVector *V = dyn_cast<ConstantVector>(CV))
     return EmitGlobalConstantVector(V, AddrSpace, *this);
 
-  printDataDirective(type, AddrSpace);
-  EmitConstantValueOnly(CV);
-  if (VerboseAsm) {
-    if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
-      SmallString<40> S;
-      CI->getValue().toStringUnsigned(S, 16);
-      O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << " 0x" << S.str();
+  if (isa<ConstantPointerNull>(CV)) {
+    unsigned Size = TM.getTargetData()->getTypeAllocSize(CV->getType());
+    OutStreamer.EmitIntValue(0, Size, AddrSpace);
+    return;
+  }
+  
+  // Otherwise, it must be a ConstantExpr.  Emit the data directive, then emit
+  // the expression value.
+  switch (TM.getTargetData()->getTypeAllocSize(CV->getType())) {
+  case 0: return;
+  case 1: O << MAI->getData8bitsDirective(AddrSpace); break;
+  case 2: O << MAI->getData16bitsDirective(AddrSpace); break;
+  case 4: O << MAI->getData32bitsDirective(AddrSpace); break;
+  case 8:
+    if (const char *Dir = MAI->getData64bitsDirective(AddrSpace)) {
+      O << Dir;
+      break;
     }
+    // FALL THROUGH.
+  default:
+    llvm_unreachable("Target cannot handle given data directive width!");
+    return;
   }
+  
+  EmitConstantValueOnly(CV);
   O << '\n';
 }
 
@@ -1373,19 +1332,17 @@ void AsmPrinter::processDebugLoc(const MachineInstr *MI,
   if (CurDLT.getScope().isNull())
     return;
 
-  if (BeforePrintingInsn) {
-    if (CurDLT.getNode() != PrevDLT) {
-      unsigned L = DW->RecordSourceLine(CurDLT.getLineNumber(), 
-                                        CurDLT.getColumnNumber(),
-                                        CurDLT.getScope().getNode());
-      printLabel(L);
-      O << '\n';
-      DW->BeginScope(MI, L);
-      PrevDLT = CurDLT.getNode();
-    }
-  } else {
+  if (!BeforePrintingInsn) {
     // After printing instruction
     DW->EndScope(MI);
+  } else if (CurDLT.getNode() != PrevDLT) {
+    unsigned L = DW->RecordSourceLine(CurDLT.getLineNumber(), 
+                                      CurDLT.getColumnNumber(),
+                                      CurDLT.getScope().getNode());
+    printLabel(L);
+    O << '\n';
+    DW->BeginScope(MI, L);
+    PrevDLT = CurDLT.getNode();
   }
 }
 
@@ -1712,14 +1669,12 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
   // forward references to labels without knowing what their numbers
   // will be.
   if (MBB->hasAddressTaken()) {
-    O << *GetBlockAddressSymbol(MBB->getBasicBlock()->getParent(),
-                                MBB->getBasicBlock());
-    O << ':';
+    const BasicBlock *BB = MBB->getBasicBlock();
+    OutStreamer.EmitLabel(GetBlockAddressSymbol(BB->getParent(), BB));
     if (VerboseAsm) {
       O.PadToColumn(MAI->getCommentColumn());
-      O << MAI->getCommentString() << " Address Taken";
+      O << MAI->getCommentString() << " Address Taken" << '\n';
     }
-    O << '\n';
   }
 
   // Print the main label for the block.
@@ -1727,9 +1682,7 @@ void AsmPrinter::EmitBasicBlockStart(const MachineBasicBlock *MBB) const {
     if (VerboseAsm)
       O << MAI->getCommentString() << " BB#" << MBB->getNumber() << ':';
   } else {
-    O << *GetMBBSymbol(MBB->getNumber()) << ':';
-    if (!VerboseAsm)
-      O << '\n';
+    OutStreamer.EmitLabel(GetMBBSymbol(MBB->getNumber()));
   }
   
   // Print some comments to accompany the label.
@@ -1773,49 +1726,6 @@ void AsmPrinter::printPICJumpTableSetLabel(unsigned uid, unsigned uid2,
     << '_' << uid << '_' << uid2 << '\n';
 }
 
-/// printDataDirective - This method prints the asm directive for the
-/// specified type.
-void AsmPrinter::printDataDirective(const Type *type, unsigned AddrSpace) {
-  const TargetData *TD = TM.getTargetData();
-  switch (type->getTypeID()) {
-  case Type::FloatTyID: case Type::DoubleTyID:
-  case Type::X86_FP80TyID: case Type::FP128TyID: case Type::PPC_FP128TyID:
-    assert(0 && "Should have already output floating point constant.");
-  default:
-    assert(0 && "Can't handle printing this type of thing");
-  case Type::IntegerTyID: {
-    unsigned BitWidth = cast<IntegerType>(type)->getBitWidth();
-    if (BitWidth <= 8)
-      O << MAI->getData8bitsDirective(AddrSpace);
-    else if (BitWidth <= 16)
-      O << MAI->getData16bitsDirective(AddrSpace);
-    else if (BitWidth <= 32)
-      O << MAI->getData32bitsDirective(AddrSpace);
-    else if (BitWidth <= 64) {
-      assert(MAI->getData64bitsDirective(AddrSpace) &&
-             "Target cannot handle 64-bit constant exprs!");
-      O << MAI->getData64bitsDirective(AddrSpace);
-    } else {
-      llvm_unreachable("Target cannot handle given data directive width!");
-    }
-    break;
-  }
-  case Type::PointerTyID:
-    if (TD->getPointerSize() == 8) {
-      assert(MAI->getData64bitsDirective(AddrSpace) &&
-             "Target cannot handle 64-bit pointer exprs!");
-      O << MAI->getData64bitsDirective(AddrSpace);
-    } else if (TD->getPointerSize() == 2) {
-      O << MAI->getData16bitsDirective(AddrSpace);
-    } else if (TD->getPointerSize() == 1) {
-      O << MAI->getData8bitsDirective(AddrSpace);
-    } else {
-      O << MAI->getData32bitsDirective(AddrSpace);
-    }
-    break;
-  }
-}
-
 void AsmPrinter::printVisibility(const MCSymbol *Sym,
                                  unsigned Visibility) const {
   if (Visibility == GlobalValue::HiddenVisibility) {