91b29760080771c8b839e1b22031a2100233ab66
[oota-llvm.git] / lib / Target / XCore / XCoreMachineFunctionInfo.cpp
1 //===-- XCoreMachineFuctionInfo.cpp - XCore machine function info ---------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #include "XCoreMachineFunctionInfo.h"
11
12 using namespace llvm;
13
14 void XCoreFunctionInfo::anchor() { }
15
16 bool XCoreFunctionInfo::isLargeFrame(const MachineFunction &MF) const {
17   if (CachedEStackSize == -1) {
18     CachedEStackSize = MF.getFrameInfo()->estimateStackSize(MF);
19   }
20   // isLargeFrame() is used when deciding if spill slots should be added to
21   // allow eliminateFrameIndex() to scavenge registers.
22   // This is only required when there is no FP and offsets are greater than
23   // ~256KB (~64Kwords). Thus only for code run on the emulator!
24   //
25   // The arbitrary value of 0xf000 allows frames of up to ~240KB before spill
26   // slots are added for the use of eliminateFrameIndex() register scavenging.
27   // For frames less than 240KB, it is assumed that there will be less than
28   // 16KB of function arguments.
29   return CachedEStackSize > 0xf000;
30 }