[llvm-commits] [llvm] r94582 - in /llvm/trunk: include/llvm/MC/MCAsmInfo.h lib/MC/MCAsmInfo.cpp lib/MC/MCAsmInfoCOFF.cpp lib/MC/MCAsmInfoDarwin.cpp lib/MC/MCAsmStreamer.cpp lib/Target/ARM/ARMMCAsmInfo.cpp test/CodeGen/ARM/align.ll test/CodeGen/ARM/globals.ll
Rafael Espindola
rafael.espindola at gmail.com
Tue Jan 26 12:21:44 PST 2010
Author: rafael
Date: Tue Jan 26 14:21:43 2010
New Revision: 94582
URL: http://llvm.org/viewvc/llvm-project?rev=94582&view=rev
Log:
Emit .comm alignment in bytes but .align in powers of 2 for ARM ELF.
Original patch by Sandeep Patel and updated by me.
Modified:
llvm/trunk/include/llvm/MC/MCAsmInfo.h
llvm/trunk/lib/MC/MCAsmInfo.cpp
llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp
llvm/trunk/test/CodeGen/ARM/align.ll
llvm/trunk/test/CodeGen/ARM/globals.ll
Modified: llvm/trunk/include/llvm/MC/MCAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmInfo.h?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmInfo.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmInfo.h Tue Jan 26 14:21:43 2010
@@ -181,6 +181,10 @@
/// directive.
bool HasLCOMMDirective; // Defaults to false.
+ /// COMMDirectiveAlignmentIsInBytes - True is COMMDirective's optional
+ /// alignment is to be specified in bytes instead of log2(n).
+ bool COMMDirectiveAlignmentIsInBytes; // Defaults to true;
+
/// HasDotTypeDotSizeDirective - True if the target has .type and .size
/// directives, this is true for most ELF targets.
bool HasDotTypeDotSizeDirective; // Defaults to true.
@@ -378,6 +382,9 @@
}
bool hasLCOMMDirective() const { return HasLCOMMDirective; }
bool hasDotTypeDotSizeDirective() const {return HasDotTypeDotSizeDirective;}
+ bool getCOMMDirectiveAlignmentIsInBytes() const {
+ return COMMDirectiveAlignmentIsInBytes;
+ }
bool hasSingleParameterDotFile() const { return HasSingleParameterDotFile; }
bool hasNoDeadStrip() const { return HasNoDeadStrip; }
const char *getWeakRefDirective() const { return WeakRefDirective; }
Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Tue Jan 26 14:21:43 2010
@@ -51,6 +51,7 @@
GlobalDirective = "\t.globl\t";
SetDirective = 0;
HasLCOMMDirective = false;
+ COMMDirectiveAlignmentIsInBytes = true;
HasDotTypeDotSizeDirective = true;
HasSingleParameterDotFile = true;
HasNoDeadStrip = false;
Modified: llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoCOFF.cpp Tue Jan 26 14:21:43 2010
@@ -18,6 +18,7 @@
MCAsmInfoCOFF::MCAsmInfoCOFF() {
GlobalPrefix = "_";
+ COMMDirectiveAlignmentIsInBytes = false;
HasLCOMMDirective = true;
HasDotTypeDotSizeDirective = false;
HasSingleParameterDotFile = false;
@@ -36,4 +37,3 @@
SupportsDebugInformation = true;
DwarfSectionOffsetDirective = "\t.secrel32\t";
}
-
Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Tue Jan 26 14:21:43 2010
@@ -26,6 +26,7 @@
HasSubsectionsViaSymbols = true;
AlignmentIsInBytes = false;
+ COMMDirectiveAlignmentIsInBytes = false;
InlineAsmStart = " InlineAsm Start";
InlineAsmEnd = " InlineAsm End";
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Jan 26 14:21:43 2010
@@ -282,7 +282,7 @@
unsigned ByteAlignment) {
OS << "\t.comm\t" << *Symbol << ',' << Size;
if (ByteAlignment != 0) {
- if (MAI.getAlignmentIsInBytes())
+ if (MAI.getCOMMDirectiveAlignmentIsInBytes())
OS << ',' << ByteAlignment;
else
OS << ',' << Log2_32(ByteAlignment);
Modified: llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMMCAsmInfo.cpp Tue Jan 26 14:21:43 2010
@@ -52,6 +52,9 @@
}
ARMELFMCAsmInfo::ARMELFMCAsmInfo() {
+ // ".comm align is in bytes but .align is pow-2."
+ AlignmentIsInBytes = false;
+
Data64bitsDirective = 0;
CommentString = "@";
Modified: llvm/trunk/test/CodeGen/ARM/align.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/align.ll?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/align.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/align.ll Tue Jan 26 14:21:43 2010
@@ -8,31 +8,31 @@
; no alignment
@c = global i16 2
-;ELF: .align 2
+;ELF: .align 1
;ELF: c:
;DARWIN: .align 1
;DARWIN: _c:
@d = global i32 3
-;ELF: .align 4
+;ELF: .align 2
;ELF: d:
;DARWIN: .align 2
;DARWIN: _d:
@e = global i64 4
-;ELF: .align 8
+;ELF: .align 3
;ELF: e
;DARWIN: .align 2
;DARWIN: _e:
@f = global float 5.0
-;ELF: .align 4
+;ELF: .align 2
;ELF: f:
;DARWIN: .align 2
;DARWIN: _f:
@g = global double 6.0
-;ELF: .align 8
+;ELF: .align 3
;ELF: g:
;DARWIN: .align 2
;DARWIN: _g:
Modified: llvm/trunk/test/CodeGen/ARM/globals.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/globals.ll?rev=94582&r1=94581&r2=94582&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/globals.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/globals.ll Tue Jan 26 14:21:43 2010
@@ -67,9 +67,9 @@
; LinuxPIC: ldr r0, [r0]
; LinuxPIC: bx lr
-; LinuxPIC: .align 4
+; LinuxPIC: .align 2
; LinuxPIC: .LCPI1_0:
; LinuxPIC: .long _GLOBAL_OFFSET_TABLE_-(.LPC1_0+8)
-; LinuxPIC: .align 4
+; LinuxPIC: .align 2
; LinuxPIC: .LCPI1_1:
; LinuxPIC: .long G(GOT)
More information about the llvm-commits
mailing list