[llvm-commits] CVS: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
Evan Cheng
evan.cheng at apple.com
Wed Jan 31 17:10:03 PST 2007
Changes in directory llvm/lib/Target/ARM:
ARMConstantIslandPass.cpp updated: 1.18 -> 1.19
---
Log message:
Pessmistically assume the .align 2 before the first constpool entry adds
two bytes padding.
---
Diffs of the changes: (+12 -2)
ARMConstantIslandPass.cpp | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
Index: llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
diff -u llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.18 llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.19
--- llvm/lib/Target/ARM/ARMConstantIslandPass.cpp:1.18 Wed Jan 31 17:35:18 2007
+++ llvm/lib/Target/ARM/ARMConstantIslandPass.cpp Wed Jan 31 19:09:47 2007
@@ -339,6 +339,13 @@
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 @@
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"
More information about the llvm-commits
mailing list