mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-02 07:32:52 +00:00
fix alignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32337 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
555d8d6f4b
commit
1c411dee4f
@ -292,7 +292,7 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
|
|||||||
std::string name = Mang->getValueName(I);
|
std::string name = Mang->getValueName(I);
|
||||||
Constant *C = I->getInitializer();
|
Constant *C = I->getInitializer();
|
||||||
unsigned Size = TD->getTypeSize(C->getType());
|
unsigned Size = TD->getTypeSize(C->getType());
|
||||||
unsigned Align = TD->getTypeAlignment(C->getType());
|
unsigned Align = Log2_32(TD->getTypeAlignment(C->getType()));
|
||||||
|
|
||||||
if (C->isNullValue() &&
|
if (C->isNullValue() &&
|
||||||
!I->hasSection() &&
|
!I->hasSection() &&
|
||||||
@ -302,8 +302,8 @@ bool ARMAsmPrinter::doFinalization(Module &M) {
|
|||||||
if (I->hasInternalLinkage())
|
if (I->hasInternalLinkage())
|
||||||
O << "\t.local " << name << "\n";
|
O << "\t.local " << name << "\n";
|
||||||
|
|
||||||
O << "\t.comm " << name << "," << TD->getTypeSize(C->getType())
|
O << "\t.comm " << name << "," << Size
|
||||||
<< "," << (unsigned)TD->getTypeAlignment(C->getType());
|
<< "," << (unsigned)Align;
|
||||||
O << "\n";
|
O << "\n";
|
||||||
} else {
|
} else {
|
||||||
switch (I->getLinkage()) {
|
switch (I->getLinkage()) {
|
||||||
|
12
test/CodeGen/ARM/align.ll
Normal file
12
test/CodeGen/ARM/align.ll
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm &&
|
||||||
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep align.*1 | wc | grep 1 &&
|
||||||
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep align.*2 | wc | grep 2 &&
|
||||||
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep align.*3 | wc | grep 2
|
||||||
|
|
||||||
|
%a = global bool true
|
||||||
|
%b = global sbyte 1
|
||||||
|
%c = global short 2
|
||||||
|
%d = global int 3
|
||||||
|
%e = global long 4
|
||||||
|
%f = global float 5.0
|
||||||
|
%g = global double 6.0
|
@ -5,7 +5,7 @@
|
|||||||
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*257" | wc -l | grep 1 &&
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep ".word.*257" | wc -l | grep 1 &&
|
||||||
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-1073741761" | wc -l | grep 1 &&
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #-1073741761" | wc -l | grep 1 &&
|
||||||
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 &&
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "mov r0, #1008" | wc -l | grep 1 &&
|
||||||
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\.comm.*a,4,4" | wc -l | grep 1
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=arm | grep "\.comm.*a,4,2" | wc -l | grep 1
|
||||||
|
|
||||||
%a = internal global int 0
|
%a = internal global int 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user