1 //===-- llvm/Target/TargetFrameInfo.h ---------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // Interface to describe the layout of a stack frame on the target machine.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_TARGETFRAMEINFO_H
15 #define LLVM_TARGET_TARGETFRAMEINFO_H
21 class MachineFunction;
23 struct TargetFrameInfo {
25 StackGrowsUp, // Adding to the stack increases the stack address
26 StackGrowsDown // Adding to the stack decreases the stack address
29 StackDirection StackDir;
30 unsigned StackAlignment;
33 TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO)
34 : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {}
36 // These methods return information that describes the abstract stack layout
37 // of the target machine.
39 /// getStackGrowthDirection - Return the direction the stack grows
41 StackDirection getStackGrowthDirection() const { return StackDir; }
43 /// getStackAlignment - This method returns the number of bytes that the stack
44 /// pointer must be aligned to. Typically, this is the largest alignment for
45 /// any data object in the target.
47 unsigned getStackAlignment() const { return StackAlignment; }
49 /// getOffsetOfLocalArea - This method returns the offset of the local area
50 /// from the stack pointer on entrance to a function.
52 int getOffsetOfLocalArea() const { return LocalAreaOffset; }
54 //===--------------------------------------------------------------------===//
55 // These methods provide details of the stack frame used by Sparc, thus they
56 // are Sparc specific.
57 //===--------------------------------------------------------------------===//
59 virtual int getStackFrameSizeAlignment () const { abort(); }
60 virtual int getMinStackFrameSize () const { abort(); }
61 virtual int getNumFixedOutgoingArgs () const { abort(); }
62 virtual int getSizeOfEachArgOnStack () const { abort(); }
63 virtual bool argsOnStackHaveFixedSize () const { abort(); }
65 // This method adjusts a stack offset to meet alignment rules of target.
66 virtual int adjustAlignment(int unalignedOffset, bool growUp,
67 unsigned align) const { abort(); }
69 // These methods compute offsets using the frame contents for a particular
70 // function. The frame contents are obtained from the MachineFunction object
71 // for the given function. The rest must be implemented by the
72 // machine-specific subclass.
74 virtual int getIncomingArgOffset (MachineFunction& mcInfo,
75 unsigned argNum)const{abort();}
76 virtual int getOutgoingArgOffset (MachineFunction& mcInfo,
77 unsigned argNum)const{abort();}
79 virtual int getFirstIncomingArgOffset (MachineFunction& mcInfo,
80 bool& growUp) const { abort();}
81 virtual int getFirstOutgoingArgOffset (MachineFunction& mcInfo,
82 bool& growUp) const {abort();}
83 virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&,
84 bool& growUp) const {abort();}
85 virtual int getFirstAutomaticVarOffset (MachineFunction& mcInfo,
86 bool& growUp) const {abort();}
87 virtual int getRegSpillAreaOffset (MachineFunction& mcInfo,
88 bool& growUp) const {abort();}
89 virtual int getTmpAreaOffset (MachineFunction& mcInfo,
90 bool& growUp) const {abort();}
91 virtual int getDynamicAreaOffset (MachineFunction& mcInfo,
92 bool& growUp) const {abort();}
95 // These methods specify the base register used for each stack area
96 // (generally FP or SP)
98 virtual int getIncomingArgBaseRegNum() const { abort(); }
99 virtual int getOutgoingArgBaseRegNum() const { abort(); }
100 virtual int getOptionalOutgoingArgBaseRegNum() const { abort(); }
101 virtual int getAutomaticVarBaseRegNum() const { abort(); }
102 virtual int getRegSpillAreaBaseRegNum() const { abort(); }
103 virtual int getDynamicAreaBaseRegNum() const { abort(); }
106 } // End llvm namespace