[llvm-commits] [llvm] r93918 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h include/llvm/MC/MCStreamer.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp

Chris Lattner sabre at nondot.org
Tue Jan 19 13:51:23 PST 2010


Author: lattner
Date: Tue Jan 19 15:51:22 2010
New Revision: 93918

URL: http://llvm.org/viewvc/llvm-project?rev=93918&view=rev
Log:
eliminate AsmPrinter::EmitZeros: just use MCStreamer directly.

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

Modified: llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/AsmPrinter.h?rev=93918&r1=93917&r2=93918&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Tue Jan 19 15:51:22 2010
@@ -377,10 +377,6 @@
     /// 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;

Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=93918&r1=93917&r2=93918&view=diff

==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Jan 19 15:51:22 2010
@@ -174,6 +174,12 @@
     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.

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=93918&r1=93917&r2=93918&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jan 19 15:51:22 2010
@@ -1058,12 +1058,6 @@
   }
 }
 
-/// 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 @@
     // 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 @@
       }
       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 @@
   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);

Modified: llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp?rev=93918&r1=93917&r2=93918&view=diff

==============================================================================
--- llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/XCore/AsmPrinter/XCoreAsmPrinter.cpp Tue Jan 19 15:51:22 2010
@@ -174,15 +174,13 @@
   
   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";





More information about the llvm-commits mailing list