summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2009-08-01 06:13:52 +0000
committerEvan Cheng <evan.cheng@apple.com>2009-08-01 06:13:52 +0000
commite64f48ba8b51f54bf0f1d1a53e33e5a314d04466 (patch)
treeb352defb26d9c9d38f8882de323a69767e0a9b3c /llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
parent769f940655255f2929f10c553743a1764ef0e629 (diff)
downloadbcm5719-llvm-e64f48ba8b51f54bf0f1d1a53e33e5a314d04466.tar.gz
bcm5719-llvm-e64f48ba8b51f54bf0f1d1a53e33e5a314d04466.zip
Workaround a couple of Darwin assembler bugs.
llvm-svn: 77781
Diffstat (limited to 'llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
index 84fad70c15e..8dca6efbe84 100644
--- a/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
@@ -466,9 +466,14 @@ unsigned ARMBaseInstrInfo::GetInstSizeInBytes(const MachineInstr *MI) const {
// FIXME: If we know the size of the function is less than (1 << 16) *2
// bytes, we can use 16-bit entries instead. Then there won't be an
// alignment issue.
- unsigned InstSize = (Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT)
- ? 2 : 4;
- return getNumJTEntries(JT, JTI) * EntrySize + InstSize;
+ unsigned InstSize = (Opc == ARM::tBR_JTr || Opc == ARM::t2BR_JT) ? 2 : 4;
+ unsigned NumEntries = getNumJTEntries(JT, JTI);
+ if (Opc == ARM::t2TBB && (NumEntries & 1))
+ // Make sure the instruction that follows TBB is 2-byte aligned.
+ // FIXME: Constant island pass should insert an "ALIGN" instruction
+ // instead.
+ ++NumEntries;
+ return NumEntries * EntrySize + InstSize;
}
default:
// Otherwise, pseudo-instruction sizes are zero.
OpenPOWER on IntegriCloud