[llvm-commits] [llvm] r40500 - in /llvm/trunk: include/llvm/CodeGen/AsmPrinter.h lib/CodeGen/AsmPrinter.cpp

Evan Cheng evan.cheng at apple.com
Wed Jul 25 16:35:08 PDT 2007


Author: evancheng
Date: Wed Jul 25 18:35:07 2007
New Revision: 40500

URL: http://llvm.org/viewvc/llvm-project?rev=40500&view=rev
Log:
EmitAlignment() also emits optional fill value.

Modified:
    llvm/trunk/include/llvm/CodeGen/AsmPrinter.h
    llvm/trunk/lib/CodeGen/AsmPrinter.cpp

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

==============================================================================
--- llvm/trunk/include/llvm/CodeGen/AsmPrinter.h (original)
+++ llvm/trunk/include/llvm/CodeGen/AsmPrinter.h Wed Jul 25 18:35:07 2007
@@ -251,7 +251,9 @@
     /// an explicit alignment requested, it will unconditionally override the
     /// alignment request.  However, if ForcedAlignBits is specified, this value
     /// has final say: the ultimate alignment will be the max of ForcedAlignBits
-    /// and the alignment computed with NumBits and the global.
+    /// and the alignment computed with NumBits and the global. If UseFillExpr
+    /// is true, it also emits an optional second value FillValue which the
+    /// assembler uses to fill gaps to match alignment.
     ///
     /// The algorithm is:
     ///     Align = NumBits;
@@ -259,7 +261,8 @@
     ///     Align = std::max(Align, ForcedAlignBits);
     ///
     void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0,
-                       unsigned ForcedAlignBits = 0) const;
+                       unsigned ForcedAlignBits = 0, bool UseFillExpr = false,
+                       unsigned FillValue = 0) const;
 
   protected:
     /// EmitZeros - Emit a block of zeros.

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

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter.cpp Wed Jul 25 18:35:07 2007
@@ -621,14 +621,17 @@
 //     Align = std::max(Align, ForcedAlignBits);
 //
 void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV,
-                               unsigned ForcedAlignBits) const {
+                               unsigned ForcedAlignBits, bool UseFillExpr,
+                               unsigned FillValue) const {
   if (GV && GV->getAlignment())
     NumBits = Log2_32(GV->getAlignment());
   NumBits = std::max(NumBits, ForcedAlignBits);
   
   if (NumBits == 0) return;   // No need to emit alignment.
   if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits;
-  O << TAI->getAlignDirective() << NumBits << "\n";
+  O << TAI->getAlignDirective() << NumBits;
+  if (UseFillExpr) O << ",0x" << std::hex << FillValue << std::dec;
+  O << "\n";
 }
 
     





More information about the llvm-commits mailing list