-
Notifications
You must be signed in to change notification settings - Fork 8
/
EpiphanyMachineFunctionInfo.h
149 lines (120 loc) · 5.41 KB
/
EpiphanyMachineFunctionInfo.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//=- EpiphanyMachineFuctionInfo.h - Epiphany machine function info -*- C++ -*-==//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares Epiphany-specific per-machine-function information.
//
//===----------------------------------------------------------------------===//
#ifndef EPIPHANYMACHINEFUNCTIONINFO_H
#define EPIPHANYMACHINEFUNCTIONINFO_H
#include "llvm/CodeGen/MachineFunction.h"
namespace llvm {
/// This class is derived from MachineFunctionInfo and contains private Epiphany
/// target-specific information for each MachineFunction.
class EpiphanyMachineFunctionInfo : public MachineFunctionInfo {
virtual void anchor();
/// Number of bytes of arguments this function has on the stack. If the callee
/// is expected to restore the argument stack this should be a multiple of 16,
/// all usable during a tail call.
///
/// The alternative would forbid tail call optimisation in some cases: if we
/// want to transfer control from a function with 8-bytes of stack-argument
/// space to a function with 16-bytes then misalignment of this value would
/// make a stack adjustment necessary, which could not be undone by the
/// callee.
unsigned BytesInStackArgArea;
/// The number of bytes to restore to deallocate space for incoming
/// arguments. Canonically 0 in the C calling convention, but non-zero when
/// callee is expected to pop the args.
unsigned ArgumentStackToRestore;
/// If the stack needs to be adjusted on frame entry in two stages, this
/// records the size of the first adjustment just prior to storing
/// callee-saved registers. The callee-saved slots are addressed assuming
/// SP == <incoming-SP> - InitialStackAdjust.
unsigned InitialStackAdjust;
/// Number of local-dynamic TLS accesses.
unsigned NumLocalDynamics;
/// @see Epiphany Procedure Call Standard, B.3
///
/// The Frame index of the area where LowerFormalArguments puts the
/// general-purpose registers that might contain variadic parameters.
int VariadicGPRIdx;
/// @see Epiphany Procedure Call Standard, B.3
///
/// The size of the frame object used to store the general-purpose registers
/// which might contain variadic arguments. This is the offset from
/// VariadicGPRIdx to what's stored in __gr_top.
unsigned VariadicGPRSize;
/// @see Epiphany Procedure Call Standard, B.3
///
/// The Frame index of the area where LowerFormalArguments puts the
/// floating-point registers that might contain variadic parameters.
int VariadicFPRIdx;
/// @see Epiphany Procedure Call Standard, B.3
///
/// The size of the frame object used to store the floating-point registers
/// which might contain variadic arguments. This is the offset from
/// VariadicFPRIdx to what's stored in __vr_top.
unsigned VariadicFPRSize;
/// @see Epiphany Procedure Call Standard, B.3
///
/// The Frame index of an object pointing just past the last known stacked
/// argument on entry to a variadic function. This goes into the __stack field
/// of the va_list type.
int VariadicStackIdx;
/// The offset of the frame pointer from the stack pointer on function
/// entry. This is expected to be negative.
int FramePointerOffset;
public:
EpiphanyMachineFunctionInfo()
: BytesInStackArgArea(0),
ArgumentStackToRestore(0),
InitialStackAdjust(0),
NumLocalDynamics(0),
VariadicGPRIdx(0),
VariadicGPRSize(0),
VariadicFPRIdx(0),
VariadicFPRSize(0),
VariadicStackIdx(0),
FramePointerOffset(0) {}
explicit EpiphanyMachineFunctionInfo(MachineFunction &MF)
: BytesInStackArgArea(0),
ArgumentStackToRestore(0),
InitialStackAdjust(0),
NumLocalDynamics(0),
VariadicGPRIdx(0),
VariadicGPRSize(0),
VariadicFPRIdx(0),
VariadicFPRSize(0),
VariadicStackIdx(0),
FramePointerOffset(0) {}
unsigned getBytesInStackArgArea() const { return BytesInStackArgArea; }
void setBytesInStackArgArea (unsigned bytes) { BytesInStackArgArea = bytes;}
unsigned getArgumentStackToRestore() const { return ArgumentStackToRestore; }
void setArgumentStackToRestore(unsigned bytes) {
ArgumentStackToRestore = bytes;
}
unsigned getInitialStackAdjust() const { return InitialStackAdjust; }
void setInitialStackAdjust(unsigned bytes) { InitialStackAdjust = bytes; }
unsigned getNumLocalDynamicTLSAccesses() const { return NumLocalDynamics; }
void incNumLocalDynamicTLSAccesses() { ++NumLocalDynamics; }
int getVariadicGPRIdx() const { return VariadicGPRIdx; }
void setVariadicGPRIdx(int Idx) { VariadicGPRIdx = Idx; }
unsigned getVariadicGPRSize() const { return VariadicGPRSize; }
void setVariadicGPRSize(unsigned Size) { VariadicGPRSize = Size; }
int getVariadicFPRIdx() const { return VariadicFPRIdx; }
void setVariadicFPRIdx(int Idx) { VariadicFPRIdx = Idx; }
unsigned getVariadicFPRSize() const { return VariadicFPRSize; }
void setVariadicFPRSize(unsigned Size) { VariadicFPRSize = Size; }
int getVariadicStackIdx() const { return VariadicStackIdx; }
void setVariadicStackIdx(int Idx) { VariadicStackIdx = Idx; }
int getFramePointerOffset() const { return FramePointerOffset; }
void setFramePointerOffset(int Idx) { FramePointerOffset = Idx; }
};
} // End llvm namespace
#endif