summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-07-22 21:14:33 +0000
committerChris Lattner <sabre@nondot.org>2010-07-22 21:14:33 +0000
commitdab6888bb1339dd6d259202223c93c0433223f58 (patch)
treee8ead81f9b631c48340d469f3ea722065e146cc1
parente3befc7f4ab735f89c263c82ccb739e6befbb1fd (diff)
downloadbcm5719-llvm-dab6888bb1339dd6d259202223c93c0433223f58.tar.gz
bcm5719-llvm-dab6888bb1339dd6d259202223c93c0433223f58.zip
switch a private implementation of GetFunctionSizeInBytes.
This is probably not the best way to implement "Force LR to be spilled if the Thumb function size is > 2048." do this, it should use the branch shortening infrastructure, but I'm just preserving functionality here. llvm-svn: 109165
-rw-r--r--llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
index 29b8fd43079..31439b4a267 100644
--- a/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMBaseRegisterInfo.cpp
@@ -723,6 +723,19 @@ ARMBaseRegisterInfo::estimateRSStackSizeLimit(MachineFunction &MF) const {
return Limit;
}
+static unsigned GetFunctionSizeInBytes(const MachineFunction &MF,
+ const ARMBaseInstrInfo &TII) {
+ unsigned FnSize = 0;
+ for (MachineFunction::const_iterator MBBI = MF.begin(), E = MF.end();
+ MBBI != E; ++MBBI) {
+ const MachineBasicBlock &MBB = *MBBI;
+ for (MachineBasicBlock::const_iterator I = MBB.begin(),E = MBB.end();
+ I != E; ++I)
+ FnSize += TII.GetInstSizeInBytes(I);
+ }
+ return FnSize;
+}
+
void
ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
RegScavenger *RS) const {
@@ -820,7 +833,7 @@ ARMBaseRegisterInfo::processFunctionBeforeCalleeSavedScan(MachineFunction &MF,
bool ForceLRSpill = false;
if (!LRSpilled && AFI->isThumb1OnlyFunction()) {
- unsigned FnSize = TII.GetFunctionSizeInBytes(MF);
+ unsigned FnSize = GetFunctionSizeInBytes(MF, TII);
// Force LR to be spilled if the Thumb function size is > 2048. This enables
// use of BL to implement far jump. If it turns out that it's not needed
// then the branch fix up path will undo it.
OpenPOWER on IntegriCloud