summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-01-30 08:22:33 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-01-30 08:22:33 +0000
commit95b85e34ffa30f041a0e4d15524d29e32fb04aad (patch)
tree38de69d7d1c540c353262b96dae8bd3f9492666c /llvm
parent0e083d0161bbfcf5b1e481e6fc1cc29d023b93d6 (diff)
downloadbcm5719-llvm-95b85e34ffa30f041a0e4d15524d29e32fb04aad.tar.gz
bcm5719-llvm-95b85e34ffa30f041a0e4d15524d29e32fb04aad.zip
Copy and paste bug.
llvm-svn: 33658
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Target/ARM/ARMInstrInfo.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMInstrInfo.cpp b/llvm/lib/Target/ARM/ARMInstrInfo.cpp
index 86b55a6c546..6adf645e493 100644
--- a/llvm/lib/Target/ARM/ARMInstrInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMInstrInfo.cpp
@@ -444,6 +444,8 @@ unsigned ARM::GetInstSize(MachineInstr *MI) {
// If this machine instr is an inline asm, measure it.
if (MI->getOpcode() == ARM::INLINEASM)
return TAI->getInlineAsmLength(MI->getOperand(0).getSymbolName());
+ if (MI->getOpcode() == ARM::LABEL)
+ return 0;
assert(0 && "Unknown or unset size field for instr!");
break;
case ARMII::Size8Bytes: return 8; // Arm instruction x 2.
@@ -457,13 +459,21 @@ unsigned ARM::GetInstSize(MachineInstr *MI) {
return MI->getOperand(2).getImm();
case ARM::BR_JTr:
case ARM::BR_JTm:
- case ARM::BR_JTadd: {
+ case ARM::BR_JTadd:
+ case ARM::tBR_JTr: {
// These are jumptable branches, i.e. a branch followed by an inlined
// jumptable. The size is 4 + 4 * number of entries.
unsigned JTI = MI->getOperand(MI->getNumOperands()-2).getJumpTableIndex();
MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
assert(JTI < JT.size());
+ // Thumb instructions are 2 byte aligned, but JT entries are 4 byte
+ // 4 aligned. The assembler / linker may add 2 byte padding just before
+ // the JT entries. Use + 4 even for tBR_JTr to purposely over-estimate
+ // the size the jumptable.
+ // 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.
return getNumJTEntries(JT, JTI) * 4 + 4;
}
default:
OpenPOWER on IntegriCloud