make EmitAlignment work the way Chris says it should

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36368 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2007-04-23 19:58:54 +00:00
parent d127c1b5f3
commit 19f5469be4

View File

@ -579,8 +579,10 @@ void AsmPrinter::EmitString(const std::string &String) const {
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// EmitAlignment - Emit an alignment directive to the specified power of two. // EmitAlignment - Emit an alignment directive to the specified power of two.
// Use the maximum of the specified alignment and the alignment from the
// specified GlobalValue (if any).
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const { void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV) const {
if (GV && GV->getAlignment()) if (GV && GV->getAlignment() && Log2_32(GV->getAlignment()) > NumBits)
NumBits = Log2_32(GV->getAlignment()); NumBits = Log2_32(GV->getAlignment());
if (NumBits == 0) return; // No need to emit alignment. if (NumBits == 0) return; // No need to emit alignment.
if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits; if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits;