aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-02-01 01:09:47 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-02-01 01:09:47 +0000
commit2021abe154e3cac523755b74fc5e62a2c9dad1fc (patch)
tree8b722e64f533e5310b1625fe528d5e8fd66647eb
parent5b49ab999623a0bc3ca4f2484bd4adfcbf9eb16a (diff)
Pessmistically assume the .align 2 before the first constpool entry adds
two bytes padding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33734 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 93115288b9..e54f7f9772 100644
--- a/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -339,6 +339,13 @@ void ARMConstantIslands::InitialFunctionScan(MachineFunction &Fn,
break;
}
}
+
+ // In thumb mode, if this block is a constpool island, pessmisticly assume
+ // it needs to be padded by two byte so it's aligned on 4 byte boundary.
+ if (AFI->isThumbFunction() &&
+ MBB.begin()->getOpcode() == ARM::CONSTPOOL_ENTRY)
+ MBBSize += 2;
+
BBSizes.push_back(MBBSize);
}
}
@@ -465,8 +472,11 @@ bool ARMConstantIslands::CPEIsInRange(MachineInstr *MI, MachineInstr *CPEMI,
unsigned MaxDisp) {
unsigned PCAdj = AFI->isThumbFunction() ? 4 : 8;
unsigned UserOffset = GetOffsetOf(MI) + PCAdj;
- unsigned CPEOffset = GetOffsetOf(CPEMI);
-
+ // In thumb mode, pessmisticly assumes the .align 2 before the first CPE
+ // in the island adds two byte padding.
+ unsigned AlignAdj = AFI->isThumbFunction() ? 2 : 0;
+ unsigned CPEOffset = GetOffsetOf(CPEMI) + AlignAdj;
+
DEBUG(std::cerr << "User of CPE#" << CPEMI->getOperand(0).getImm()
<< " max delta=" << MaxDisp
<< " at offset " << int(UserOffset-CPEOffset) << "\t"