2 //***************************************************************************
7 // Interface to layout of stack frame on target machine.
10 // 11/6/01 - Vikram Adve - Created
11 //**************************************************************************/
13 #ifndef LLVM_CODEGEN_FRAMEINFO_H
14 #define LLVM_CODEGEN_FRAMEINFO_H
16 #include "Support/NonCopyable.h"
20 //************************* Forward Declarations **************************/
22 class MachineCodeForMethod;
26 //*************************** External Classes ****************************/
29 class MachineFrameInfo : public NonCopyableV {
31 const TargetMachine& target;
34 /*ctor*/ MachineFrameInfo(const TargetMachine& tgt) : target(tgt) {}
37 // These methods provide constant parameters of the frame layout.
39 virtual int getStackFrameSizeAlignment () const = 0;
40 virtual int getMinStackFrameSize () const = 0;
41 virtual int getNumFixedOutgoingArgs () const = 0;
42 virtual int getSizeOfEachArgOnStack () const = 0;
43 virtual bool argsOnStackHaveFixedSize () const = 0;
46 // These methods compute offsets using the frame contents for a
47 // particular method. The frame contents are obtained from the
48 // MachineCodeInfoForMethod object for the given method.
49 // The first few methods have default machine-independent implementations.
50 // The rest must be implemented by the machine-specific subclass.
52 virtual int getIncomingArgOffset (MachineCodeForMethod& mcInfo,
53 unsigned argNum) const;
54 virtual int getOutgoingArgOffset (MachineCodeForMethod& mcInfo,
55 unsigned argNum) const;
57 virtual int getFirstIncomingArgOffset (MachineCodeForMethod& mcInfo,
58 bool& growUp) const=0;
59 virtual int getFirstOutgoingArgOffset (MachineCodeForMethod& mcInfo,
60 bool& growUp) const=0;
61 virtual int getFirstOptionalOutgoingArgOffset (MachineCodeForMethod&,
62 bool& growUp) const=0;
63 virtual int getFirstAutomaticVarOffset (MachineCodeForMethod& mcInfo,
64 bool& growUp) const=0;
65 virtual int getRegSpillAreaOffset (MachineCodeForMethod& mcInfo,
66 bool& growUp) const=0;
67 virtual int getTmpAreaOffset (MachineCodeForMethod& mcInfo,
68 bool& growUp) const=0;
69 virtual int getDynamicAreaOffset (MachineCodeForMethod& mcInfo,
70 bool& growUp) const=0;
73 // These methods specify the base register used for each stack area
74 // (generally FP or SP)
76 virtual int getIncomingArgBaseRegNum() const=0;
77 virtual int getOutgoingArgBaseRegNum() const=0;
78 virtual int getOptionalOutgoingArgBaseRegNum() const=0;
79 virtual int getAutomaticVarBaseRegNum() const=0;
80 virtual int getRegSpillAreaBaseRegNum() const=0;
81 virtual int getDynamicAreaBaseRegNum() const=0;