further simplify EmitAlignment by eliminating the
authorChris Lattner <sabre@nondot.org>
Wed, 28 Apr 2010 01:08:40 +0000 (01:08 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 28 Apr 2010 01:08:40 +0000 (01:08 +0000)
ForcedAlignBits argument, tweaking the single client of it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102484 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 43643fc9fee22ec7819dce0d4aee3ba7024721d0..5a1e7f18d2bdfa6292af071a442dd43b1bfe13d0 100644 (file)
@@ -204,17 +204,13 @@ namespace llvm {
     /// two boundary.  For example, if you pass in 3 here, you will get an 8
     /// byte alignment.  If a global value is specified, and if that global has
     /// 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.
+    /// alignment request.
     ///
     /// The algorithm is:
     ///     Align = NumBits;
-    ///     if (GV && GV->hasalignment) Align = GV->getalignment();
-    ///     Align = std::max(Align, ForcedAlignBits);
+    ///     if (GV && GV->hasalignment) Align = GV->getAlignment();
     ///
-    void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0,
-                       unsigned ForcedAlignBits = 0) const;
+    void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const;
     
     /// EmitBasicBlockStart - This method prints the label for the specified
     /// MachineBasicBlock, an alignment (if present) and a comment describing
index 5f8c804f5b60a39566f277f23d08a0ceab724f78..aa6e2b25f8e4d074bd171b10a16b6db227752e55 100644 (file)
@@ -1154,14 +1154,11 @@ void AsmPrinter::EmitLabelOffsetDifference(const MCSymbol *Hi, uint64_t Offset,
 //
 // The algorithm is:
 //     Align = NumBits;
-//     if (GV && GV->hasalignment) Align = GV->getalignment();
-//     Align = std::max(Align, ForcedAlignBits);
+//     if (GV && GV->hasalignment) Align = GV->getAlignment();
 //
-void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV,
-                               unsigned ForcedAlignBits) const {
+void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
   if (GV && GV->getAlignment())
     NumBits = Log2_32(GV->getAlignment());
-  NumBits = std::max(NumBits, ForcedAlignBits);
   
   if (NumBits == 0) return;   // No need to emit alignment.
   
index 1c5d624f4c3b9d93dac7ec8530ebe626a0b7c7fb..c100c590135eb06b70ae2e4fb27be6f66accbb90 100644 (file)
@@ -148,7 +148,7 @@ void XCoreAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
     llvm_unreachable("Unknown linkage type!");
   }
 
-  EmitAlignment(Align, GV, 2);
+  EmitAlignment(Align > 2 ? Align : 2, GV);
   
   unsigned Size = TD->getTypeAllocSize(C->getType());
   if (GV->isThreadLocal()) {