Remove dead member variables of SparcV9SchedInfo and TargetSchedInfo
[oota-llvm.git] / lib / Target / SparcV9 / SparcV9FrameInfo.cpp
1 //===-- SparcV9.cpp - General implementation file for the SparcV9 Target ------===//
2 // 
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 // 
8 //===----------------------------------------------------------------------===//
9 // 
10 // Interface to stack frame layout info for the UltraSPARC.  Starting offsets
11 // for each area of the stack frame are aligned at a multiple of
12 // getStackFrameSizeAlignment().
13 // 
14 //===----------------------------------------------------------------------===//
15
16 #include "llvm/CodeGen/MachineFunction.h"
17 #include "llvm/CodeGen/MachineFunctionInfo.h"
18 #include "llvm/Target/TargetFrameInfo.h"
19 #include "SparcV9FrameInfo.h"
20
21 using namespace llvm;
22
23 int
24 SparcV9FrameInfo::getFirstAutomaticVarOffset(MachineFunction&, bool& pos) const {
25   pos = false;                          // static stack area grows downwards
26   return StaticAreaOffsetFromFP;
27 }
28
29 int
30 SparcV9FrameInfo::getRegSpillAreaOffset(MachineFunction& mcInfo, bool& pos) const 
31 {
32   // ensure no more auto vars are added
33   mcInfo.getInfo()->freezeAutomaticVarsArea();
34   
35   pos = false;                          // static stack area grows downwards
36   unsigned autoVarsSize = mcInfo.getInfo()->getAutomaticVarsSize();
37   return StaticAreaOffsetFromFP - autoVarsSize; 
38 }
39
40 int SparcV9FrameInfo::getTmpAreaOffset(MachineFunction& mcInfo, bool& pos) const {
41   MachineFunctionInfo *MFI = mcInfo.getInfo();
42   MFI->freezeAutomaticVarsArea();     // ensure no more auto vars are added
43   MFI->freezeSpillsArea();            // ensure no more spill slots are added
44   
45   pos = false;                          // static stack area grows downwards
46   unsigned autoVarsSize = MFI->getAutomaticVarsSize();
47   unsigned spillAreaSize = MFI->getRegSpillsSize();
48   int offset = autoVarsSize + spillAreaSize;
49   return StaticAreaOffsetFromFP - offset;
50 }
51
52 int
53 SparcV9FrameInfo::getDynamicAreaOffset(MachineFunction& mcInfo, bool& pos) const {
54   // Dynamic stack area grows downwards starting at top of opt-args area.
55   // The opt-args, required-args, and register-save areas are empty except
56   // during calls and traps, so they are shifted downwards on each
57   // dynamic-size alloca.
58   pos = false;
59   unsigned optArgsSize = mcInfo.getInfo()->getMaxOptionalArgsSize();
60   if (int extra = optArgsSize % getStackFrameSizeAlignment())
61     optArgsSize += (getStackFrameSizeAlignment() - extra);
62   int offset = optArgsSize + FirstOptionalOutgoingArgOffsetFromSP;
63   assert((offset - OFFSET) % getStackFrameSizeAlignment() == 0);
64   return offset;
65 }