diff options
| author | Evan Cheng <evan.cheng@apple.com> | 2009-07-31 18:35:56 +0000 |
|---|---|---|
| committer | Evan Cheng <evan.cheng@apple.com> | 2009-07-31 18:35:56 +0000 |
| commit | 2ee6e2d788b7fc1a6869740da53c52174be25179 (patch) | |
| tree | 6b5414875879df8ef211d92bdd68399616150ebc | |
| parent | 58ccf8dee03d7cf79468a774979ad065c5f945ac (diff) | |
| download | external_llvm-2ee6e2d788b7fc1a6869740da53c52174be25179.zip external_llvm-2ee6e2d788b7fc1a6869740da53c52174be25179.tar.gz external_llvm-2ee6e2d788b7fc1a6869740da53c52174be25179.tar.bz2 | |
Until we have a "ALIGN" pseudo instruction, have asm printer emitted a .align
to ensure the instruction that follows a TBB (when the number of table entries
is odd) is 2-byte aligned.
Patch by Sandeep Patel.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77705 91177308-0d34-0410-b5e6-96231b3b80d8
| -rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 7 | ||||
| -rw-r--r-- | test/CodeGen/Thumb2/thumb2-tbb.ll | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index a80a88e..5feafb4 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -988,6 +988,13 @@ void ARMAsmPrinter::printJT2BlockOperand(const MachineInstr *MI, int OpNum) { if (i != e-1) O << '\n'; } + + // Make sure the instruction that follows TBB is 2-byte aligned. + // FIXME: Constant island pass should insert an "ALIGN" instruction instead. + if (ByteOffset && (JTBBs.size() & 1)) { + O << '\n'; + EmitAlignment(1); + } } void ARMAsmPrinter::printTBAddrMode(const MachineInstr *MI, int OpNum) { diff --git a/test/CodeGen/Thumb2/thumb2-tbb.ll b/test/CodeGen/Thumb2/thumb2-tbb.ll index c0347c7..9437233 100644 --- a/test/CodeGen/Thumb2/thumb2-tbb.ll +++ b/test/CodeGen/Thumb2/thumb2-tbb.ll @@ -5,6 +5,7 @@ define void @bar(i32 %n.u) { entry: ; CHECK: bar: ; CHECK: tbb +; CHECK: .align 1 switch i32 %n.u, label %bb12 [i32 1, label %bb i32 2, label %bb6 i32 4, label %bb7 i32 5, label %bb8 i32 6, label %bb10 i32 7, label %bb1 i32 8, label %bb3 i32 9, label %bb4 i32 10, label %bb9 i32 11, label %bb2 i32 12, label %bb5 i32 13, label %bb11 ] bb: |
