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
19 class MachineFunction;
21 struct TargetFrameInfo {
23 StackGrowsUp, // Adding to the stack increases the stack address
24 StackGrowsDown // Adding to the stack decreases the stack address
27 StackDirection StackDir;
28 unsigned StackAlignment;
31 TargetFrameInfo(StackDirection D, unsigned StackAl, int LAO)
32 : StackDir(D), StackAlignment(StackAl), LocalAreaOffset(LAO) {}
34 // These methods return information that describes the abstract stack layout
35 // of the target machine.
37 /// getStackGrowthDirection - Return the direction the stack grows
39 StackDirection getStackGrowthDirection() const { return StackDir; }
41 /// getStackAlignment - This method returns the number of bytes that the stack
42 /// pointer must be aligned to. Typically, this is the largest alignment for
43 /// any data object in the target.
45 unsigned getStackAlignment() const { return StackAlignment; }
47 /// getOffsetOfLocalArea - This method returns the offset of the local area
48 /// from the stack pointer on entrance to a function.
50 int getOffsetOfLocalArea() const { return LocalAreaOffset; }
52 //===--------------------------------------------------------------------===//
53 // These methods provide details of the stack frame used by Sparc, thus they
54 // are Sparc specific.
55 //===--------------------------------------------------------------------===//
57 virtual int getStackFrameSizeAlignment () const { abort(); }
58 virtual int getMinStackFrameSize () const { abort(); }
59 virtual int getNumFixedOutgoingArgs () const { abort(); }
60 virtual int getSizeOfEachArgOnStack () const { abort(); }
61 virtual bool argsOnStackHaveFixedSize () const { abort(); }
63 // This method adjusts a stack offset to meet alignment rules of target.
64 virtual int adjustAlignment(int unalignedOffset, bool growUp,
65 unsigned align) const { abort(); }
67 // These methods compute offsets using the frame contents for a particular
68 // function. The frame contents are obtained from the MachineFunction object
69 // for the given function. The rest must be implemented by the
70 // machine-specific subclass.
72 virtual int getIncomingArgOffset (MachineFunction& mcInfo,
73 unsigned argNum)const{abort();}
74 virtual int getOutgoingArgOffset (MachineFunction& mcInfo,
75 unsigned argNum)const{abort();}
77 virtual int getFirstIncomingArgOffset (MachineFunction& mcInfo,
78 bool& growUp) const { abort();}
79 virtual int getFirstOutgoingArgOffset (MachineFunction& mcInfo,
80 bool& growUp) const {abort();}
81 virtual int getFirstOptionalOutgoingArgOffset (MachineFunction&,
82 bool& growUp) const {abort();}
83 virtual int getFirstAutomaticVarOffset (MachineFunction& mcInfo,
84 bool& growUp) const {abort();}
85 virtual int getRegSpillAreaOffset (MachineFunction& mcInfo,
86 bool& growUp) const {abort();}
87 virtual int getTmpAreaOffset (MachineFunction& mcInfo,
88 bool& growUp) const {abort();}
89 virtual int getDynamicAreaOffset (MachineFunction& mcInfo,
90 bool& growUp) const {abort();}
93 // These methods specify the base register used for each stack area
94 // (generally FP or SP)
96 virtual int getIncomingArgBaseRegNum() const { abort(); }
97 virtual int getOutgoingArgBaseRegNum() const { abort(); }
98 virtual int getOptionalOutgoingArgBaseRegNum() const { abort(); }
99 virtual int getAutomaticVarBaseRegNum() const { abort(); }
100 virtual int getRegSpillAreaBaseRegNum() const { abort(); }
101 virtual int getDynamicAreaBaseRegNum() const { abort(); }
104 } // End llvm namespace