LLVM: lib/Target/Lanai/LanaiFrameLowering.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

14

21

22using namespace llvm;

23

24

25void LanaiFrameLowering::determineFrameLayout(MachineFunction &MF) const {

27 const LanaiRegisterInfo *LRI = STI.getRegisterInfo();

28

29

31

32

33 Align StackAlign =

35

36

38

39

40

42 MaxCallFrameSize = alignTo(MaxCallFrameSize, StackAlign);

43

44

46

47

49 FrameSize += MaxCallFrameSize;

50

51

52 FrameSize = alignTo(FrameSize, StackAlign);

53

54

56}

57

58

59

60

61void LanaiFrameLowering::replaceAdjDynAllocPseudo(MachineFunction &MF) const {

62 const LanaiInstrInfo &LII = *STI.getInstrInfo();

64

65 for (MachineBasicBlock &MBB : MF) {

67 if (MI.getOpcode() == Lanai::ADJDYNALLOC) {

69 Register Dst = MI.getOperand(0).getReg();

70 Register Src = MI.getOperand(1).getReg();

71

74 .addImm(MaxCallFrameSize);

75 MI.eraseFromParent();

76 }

77 }

78 }

79}

80

81

82

83

84

87 assert(&MF.front() == &MBB && "Shrink-wrapping not yet supported");

88

92

93

94

96

97

98 determineFrameLayout(MF);

99

100

101

103

104

105

112

113

114

119

120

121

122 if (StackSize != 0) {

127 }

128

129

131 replaceAdjDynAllocPseudo(MF);

132}

133

137

138 return MBB.erase(I);

139}

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

188

193

197

198

201

202

205

209 }

210}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL

MachineBasicBlock MachineBasicBlock::iterator MBBI

Promote Memory to Register

void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override

Definition LanaiFrameLowering.cpp:171

void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override

emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.

Definition LanaiFrameLowering.cpp:85

const LanaiSubtarget & STI

MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator I) const override

This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...

Definition LanaiFrameLowering.cpp:134

void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const override

This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...

Definition LanaiFrameLowering.cpp:189

MachineInstrBundleIterator< MachineInstr > iterator

The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.

void setMaxCallFrameSize(uint64_t S)

LLVM_ABI int CreateFixedObject(uint64_t Size, int64_t SPOffset, bool IsImmutable, bool isAliased=false)

Create a new object at a fixed location on the stack.

bool hasVarSizedObjects() const

This method may be called any time after instruction selection is complete to determine if the stack ...

uint64_t getStackSize() const

Return the number of bytes that must be allocated to hold all of the fixed size frame objects.

bool adjustsStack() const

Return true if this function adjusts the stack – e.g., when calling another function.

Align getMaxAlign() const

Return the alignment in bytes that this function must be aligned to, which is greater than the defaul...

uint64_t getMaxCallFrameSize() const

Return the maximum size of a call frame that must be allocated for an outgoing function call.

void setStackSize(uint64_t Size)

Set the size of the stack.

MachineFrameInfo & getFrameInfo()

getFrameInfo - Return the frame info object for the current function.

const MachineBasicBlock & front() const

const MachineInstrBuilder & setMIFlag(MachineInstr::MIFlag Flag) const

const MachineInstrBuilder & addImm(int64_t Val) const

Add a new immediate operand.

const MachineInstrBuilder & addReg(Register RegNo, unsigned flags=0, unsigned SubReg=0) const

Add a new virtual register operand.

virtual bool hasReservedCallFrame(const MachineFunction &MF) const

hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required,...

virtual void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS=nullptr) const

This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...

Align getStackAlign() const

getStackAlignment - This method returns the number of bytes to which the stack pointer must be aligne...

constexpr char Align[]

Key for Kernel::Arg::Metadata::mAlign.

static unsigned makePreOp(unsigned AluOp)

This is an optimization pass for GlobalISel generic memory operations.

MachineInstrBuilder BuildMI(MachineFunction &MF, const MIMetadata &MIMD, const MCInstrDesc &MCID)

Builder interface. Specify how to create the initial instruction itself.

iterator_range< early_inc_iterator_impl< detail::IterOfRange< RangeT > > > make_early_inc_range(RangeT &&Range)

Make a range that does early increment to allow mutation of the underlying range without disrupting i...

uint64_t alignTo(uint64_t Size, Align A)

Returns a multiple of A needed to store Size bytes.

Register getBaseRegister() const

bool hasBasePointer(const MachineFunction &MF) const