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