1 //===-- llvm/CodeGen/MachineFrameInfo.h -------------------------*- C++ -*-===//
3 // Interface to layout of stack frame on target machine.
5 //===----------------------------------------------------------------------===//
7 #ifndef LLVM_CODEGEN_FRAMEINFO_H
8 #define LLVM_CODEGEN_FRAMEINFO_H
10 #include "Support/NonCopyable.h"
13 class MachineFunction;
16 struct MachineFrameInfo : public NonCopyableV {
17 const TargetMachine ⌖
20 MachineFrameInfo(const TargetMachine& tgt) : target(tgt) {}
22 // These methods provide constant parameters of the frame layout.
24 virtual int getStackFrameSizeAlignment () const = 0;
25 virtual int getMinStackFrameSize () const = 0;
26 virtual int getNumFixedOutgoingArgs () const = 0;
27 virtual int getSizeOfEachArgOnStack () const = 0;
28 virtual bool argsOnStackHaveFixedSize () const = 0;
30 // This method adjusts a stack offset to meet alignment rules of target.
32 virtual int adjustAlignment (int unalignedOffset,
34 unsigned int align) const {
35 return unalignedOffset + (growUp? +1:-1)*(unalignedOffset % align);
38 // These methods compute offsets using the frame contents for a
39 // particular method. The frame contents are obtained from the
40 // MachineCodeInfoForMethod object for the given method.
41 // The first few methods have default machine-independent implementations.
42 // The rest must be implemented by the machine-specific subclass.
44 virtual int getIncomingArgOffset (MachineFunction& mcInfo,
45 unsigned argNum) const;
46 virtual int getOutgoingArgOffset (MachineFunction& mcInfo,
47 unsigned argNum) const;
49 virtual int getFirstIncomingArgOffset (MachineFunction& mcInfo,
50 bool& growUp) const=0;
51 virtual int getFirstOutgoingArgOffset (MachineFunction& mcInfo,
52 bool& growUp) const=0;
53 virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&,
54 bool& growUp) const=0;
55 virtual int getFirstAutomaticVarOffset (MachineFunction& mcInfo,
56 bool& growUp) const=0;
57 virtual int getRegSpillAreaOffset (MachineFunction& mcInfo,
58 bool& growUp) const=0;
59 virtual int getTmpAreaOffset (MachineFunction& mcInfo,
60 bool& growUp) const=0;
61 virtual int getDynamicAreaOffset (MachineFunction& mcInfo,
62 bool& growUp) const=0;
65 // These methods specify the base register used for each stack area
66 // (generally FP or SP)
68 virtual int getIncomingArgBaseRegNum() const=0;
69 virtual int getOutgoingArgBaseRegNum() const=0;
70 virtual int getOptionalOutgoingArgBaseRegNum() const=0;
71 virtual int getAutomaticVarBaseRegNum() const=0;
72 virtual int getRegSpillAreaBaseRegNum() const=0;
73 virtual int getDynamicAreaBaseRegNum() const=0;