eliminate AsmPrinter::EmitZeros: just use MCStreamer directly.
authorChris Lattner <sabre@nondot.org>
Tue, 19 Jan 2010 21:51:22 +0000 (21:51 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 19 Jan 2010 21:51:22 +0000 (21:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93918 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/AsmPrinter.h
include/llvm/MC/MCStreamer.h
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp

index 4d03d42b499ae0c6a81e879b351c7a78a3606df1..07f2ae5c96e8c7db87c0a581fd94a9fc6c686fdc 100644 (file)
@@ -377,10 +377,6 @@ namespace llvm {
     /// EmitGlobalConstant - Print a general LLVM constant to the .s file.
     void EmitGlobalConstant(const Constant* CV, unsigned AddrSpace = 0);
     
-    /// EmitZeros - Emit a block of zeros.
-    ///
-    void EmitZeros(uint64_t NumZeros, unsigned AddrSpace = 0) const;
-
     /// EmitString - Emit a zero-byte-terminated string constant.
     ///
     virtual void EmitString(const ConstantArray *CVA) const;
index 5b51916e764b890209e64e8207637a8829d150d0..be66a624073ad07606281b69de3cbb446e39e444 100644 (file)
@@ -174,6 +174,12 @@ namespace llvm {
     virtual void EmitFill(uint64_t NumBytes, uint8_t FillValue,
                           unsigned AddrSpace);
     
+    /// EmitZeros - Emit NumBytes worth of zeros.  This is a convenience
+    /// function that just wraps EmitFill.
+    void EmitZeros(uint64_t NumBytes, unsigned AddrSpace) {
+      EmitFill(NumBytes, 0, AddrSpace);
+    }
+
     
     /// EmitValueToAlignment - Emit some number of copies of @param Value until
     /// the byte alignment @param ByteAlignment is reached.
index 03672411f4e08a0035b7bbe7ae55d39950e29768..2e576b323a67299dc8aff2bd1dccb4b52d73e1f2 100644 (file)
@@ -1058,12 +1058,6 @@ void AsmPrinter::EmitConstantValueOnly(const Constant *CV) {
   }
 }
 
-/// EmitZeros - Emit a block of zeros.
-///
-void AsmPrinter::EmitZeros(uint64_t NumZeros, unsigned AddrSpace) const {
-  OutStreamer.EmitFill(NumZeros, 0, AddrSpace);
-}
-
 /// printAsCString - Print the specified array as a C compatible string, only if
 /// the predicate isString is true.
 ///
@@ -1134,7 +1128,7 @@ static void EmitGlobalConstantStruct(const ConstantStruct *CS,
     // 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.EmitZeros(padSize, AddrSpace);
+    AP.OutStreamer.EmitZeros(padSize, AddrSpace);
   }
   assert(SizeSoFar == cvsLayout->getSizeInBytes() &&
          "Layout of constant struct may be incorrect!");
@@ -1283,9 +1277,8 @@ void AsmPrinter::EmitGlobalConstantFP(const ConstantFP *CFP,
       }
       O << '\n';
     }
-    LLVMContext &Context = CFP->getContext();
-    EmitZeros(TD.getTypeAllocSize(Type::getX86_FP80Ty(Context)) -
-              TD.getTypeStoreSize(Type::getX86_FP80Ty(Context)), AddrSpace);
+    OutStreamer.EmitZeros(TD.getTypeAllocSize(CFP->getType()) -
+                            TD.getTypeStoreSize(CFP->getType()), AddrSpace);
     return;
   }
   
@@ -1412,7 +1405,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV, unsigned AddrSpace) {
   unsigned Size = TD->getTypeAllocSize(type);
 
   if (CV->isNullValue() || isa<UndefValue>(CV))
-    return EmitZeros(Size, AddrSpace);
+    return OutStreamer.EmitZeros(Size, AddrSpace);
   
   if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
     return EmitGlobalConstantArray(CVA, AddrSpace, *this);
index 301a0e9c43967eaa74aabce8e1801328880388ab..115d041a70c1d20f80c0c7e537e2d143e563a991 100644 (file)
@@ -174,15 +174,13 @@ void XCoreAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
   
   EmitGlobalConstant(C);
   if (GV->isThreadLocal()) {
-    for (unsigned i = 1; i < MaxThreads; ++i) {
+    for (unsigned i = 1; i < MaxThreads; ++i)
       EmitGlobalConstant(C);
-    }
-  }
-  if (Size < 4) {
-    // The ABI requires that unsigned scalar types smaller than 32 bits
-    // are are padded to 32 bits.
-    EmitZeros(4 - Size);
   }
+  // The ABI requires that unsigned scalar types smaller than 32 bits
+  // are are padded to 32 bits.
+  if (Size < 4)
+    OutStreamer.EmitZeros(4 - Size, 0);
   
   // Mark the end of the global
   O << "\t.cc_bottom " << *GVSym << ".data\n";