diff options
| author | Chris Lattner <sabre@nondot.org> | 2005-11-14 19:00:06 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2005-11-14 19:00:06 +0000 |
| commit | dd8eeed096b636195cc4eba6b5c705c217a9a17d (patch) | |
| tree | 0a7c6afafab92b43bc7c657ac88da44e067713c0 | |
| parent | 0aacd2ab9ba8daab865ecdf015be6b07f222043b (diff) | |
| download | bcm5719-llvm-dd8eeed096b636195cc4eba6b5c705c217a9a17d.tar.gz bcm5719-llvm-dd8eeed096b636195cc4eba6b5c705c217a9a17d.zip | |
Teach emitAlignment to handle explicit alignment requests by globals.
llvm-svn: 24354
| -rw-r--r-- | llvm/include/llvm/CodeGen/AsmPrinter.h | 5 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter.cpp | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h b/llvm/include/llvm/CodeGen/AsmPrinter.h index e6b7fccd07a..1a207271031 100644 --- a/llvm/include/llvm/CodeGen/AsmPrinter.h +++ b/llvm/include/llvm/CodeGen/AsmPrinter.h @@ -137,8 +137,9 @@ namespace llvm { /// emitAlignment - Emit an alignment directive to the specified power of /// two boundary. For example, if you pass in 3 here, you will get an 8 - /// byte alignment. - void emitAlignment(unsigned NumBits) const; + /// byte alignment. If a global value is specified, and if that global has + /// an explicit alignment requested, it will override the alignment request. + void emitAlignment(unsigned NumBits, const GlobalValue *GV = 0) const; /// emitZeros - Emit a block of zeros. /// diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp index 452cc0583ed..a6028e43de8 100644 --- a/llvm/lib/CodeGen/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter.cpp @@ -35,7 +35,9 @@ void AsmPrinter::setupMachineFunction(MachineFunction &MF) { } // emitAlignment - Emit an alignment directive to the specified power of two. -void AsmPrinter::emitAlignment(unsigned NumBits) const { +void AsmPrinter::emitAlignment(unsigned NumBits, const GlobalValue *GV) const { + if (GV && GV->getAlignment()) + NumBits = Log2_32(GV->getAlignment()); if (NumBits == 0) return; // No need to emit alignment. if (AlignmentIsInBytes) NumBits = 1 << NumBits; O << AlignDirective << NumBits << "\n"; |

