LLVM: lib/CodeGen/TargetFrameLoweringImpl.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

27

28using namespace llvm;

29

31

38

43

44

45

46

47

63

64

65

66

67

68

71 int FI) const {

72

73

76}

77

82

86 CalleeSaves.resize(TRI.getNumRegs());

87

90 return;

91

93 CalleeSaves.set(Info.getReg());

94}

95

100

101

102

103

104 SavedRegs.resize(TRI.getNumRegs());

105

106

107 const MCPhysReg *CSRegs = nullptr;

108

109

110

111

115 CSRegs = TRI.getIPRACSRegs(&MF);

116 else

118

119

120 if (!CSRegs || CSRegs[0] == 0)

121 return;

122

123

125 return;

126

127

128

129

130

131

132

133

138 return;

139

140

143 for (unsigned i = 0; CSRegs[i]; ++i) {

144 unsigned Reg = CSRegs[i];

145 if (CallsUnwindInit || MRI.isPhysRegModified(Reg))

146 SavedRegs.set(Reg);

147 }

148}

149

153 return false;

154

157 !RegInfo->hasStackRealignment(MF);

158}

159

161 if (F.hasLocalLinkage() || F.hasAddressTaken() ||

162 F.hasFnAttribute(Attribute::NoRecurse))

163 return false;

164

165 for (const User *U : F.users())

167 if (CB->isTailCall())

168 return false;

169 return true;

170}

171

175

180

186

191

193

198 } else {

200 TII->storeRegToStackSlot(SaveBlock, MI, Reg, true, CS.getFrameIdx(), RC,

202 }

203}

204

213 } else {

216 assert(MI != MBB.begin() && "loadRegFromStackSlot didn't insert any code!");

217 }

218}

unsigned const MachineRegisterInfo * MRI

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

const TargetInstrInfo & TII

This file contains the simple types necessary to represent the attributes associated with functions a...

This file implements the BitVector class.

Register const TargetRegisterInfo * TRI

void resize(unsigned N, bool t=false)

resize - Grow or shrink the bitvector.

The CalleeSavedInfo class tracks the information need to locate where a callee saved register is in t...

bool isSpilledToReg() const

MCRegister getReg() const

MCRegister getDstReg() const

bool hasFnAttribute(Attribute::AttrKind Kind) const

Return true if the function has the attribute.

bool usesWindowsCFI() const

Wrapper class representing physical registers. Should be passed by value.

MachineInstrBundleIterator< MachineInstr > iterator

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

uint64_t getStackSize() const

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

int64_t getOffsetAdjustment() const

Return the correction for frame offsets.

bool isCalleeSavedInfoValid() const

Has the callee saved info been calculated yet?

const std::vector< CalleeSavedInfo > & getCalleeSavedInfo() const

Returns a reference to call saved info vector for the current function.

bool hasStackObjects() const

Return true if there are any stack objects in this function.

int64_t getObjectOffset(int ObjectIdx) const

Return the assigned stack offset of the specified object from the incoming stack pointer.

const TargetSubtargetInfo & getSubtarget() const

getSubtarget - Return the subtarget for which this machine code is being compiled.

bool needsFrameMoves() const

True if this function needs frame moves for debug or exceptions.

MachineFrameInfo & getFrameInfo()

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

bool callsUnwindInit() const

MachineRegisterInfo & getRegInfo()

getRegInfo - Return information about the registers currently in use.

Function & getFunction()

Return the LLVM function that this machine code represents.

const TargetMachine & getTarget() const

getTarget - Return the target machine this machine code is compiled with

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

Add a new virtual register operand.

MachineRegisterInfo - Keep track of information for virtual and physical registers,...

LLVM_ABI const MCPhysReg * getCalleeSavedRegs() const

Returns list of callee saved registers.

Wrapper class representing virtual and physical registers.

constexpr unsigned id() const

StackOffset holds a fixed and a scalable offset in bytes.

int64_t getFixed() const

Returns the fixed component of the stack.

bool hasFP(const MachineFunction &MF) const

hasFP - Return true if the specified function should have a dedicated frame pointer register.

virtual bool allocateScavengingFrameIndexesNearIncomingSP(const MachineFunction &MF) const

Control the placement of special register scavenging spill slots when allocating a stack frame.

Definition TargetFrameLoweringImpl.cpp:150

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

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

Definition TargetFrameLoweringImpl.cpp:96

virtual bool enableCalleeSaveSkip(const MachineFunction &MF) const

Returns true if the target can safely skip saving callee-saved registers for noreturn nounwind functi...

Definition TargetFrameLoweringImpl.cpp:32

void restoreCalleeSavedRegister(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, const CalleeSavedInfo &CS, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const

Definition TargetFrameLoweringImpl.cpp:205

void spillCalleeSavedRegister(MachineBasicBlock &SaveBlock, MachineBasicBlock::iterator MI, const CalleeSavedInfo &CS, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const

spillCalleeSavedRegister - Default implementation for spilling a single callee saved register.

Definition TargetFrameLoweringImpl.cpp:187

virtual Register getInitialCFARegister(const MachineFunction &MF) const

Return initial CFA register value i.e.

Definition TargetFrameLoweringImpl.cpp:177

virtual void getCalleeSaves(const MachineFunction &MF, BitVector &SavedRegs) const

Returns the callee-saved registers as computed by determineCalleeSaves in the BitVector SavedRegs.

Definition TargetFrameLoweringImpl.cpp:83

int getOffsetOfLocalArea() const

getOffsetOfLocalArea - This method returns the offset of the local area from the stack pointer on ent...

virtual DwarfFrameBase getDwarfFrameBase(const MachineFunction &MF) const

Return the frame base information to be encoded in the DWARF subprogram debug info.

Definition TargetFrameLoweringImpl.cpp:182

virtual bool needsFrameIndexResolution(const MachineFunction &MF) const

Definition TargetFrameLoweringImpl.cpp:78

virtual bool isProfitableForNoCSROpt(const Function &F) const

Check if the no-CSR optimisation is profitable for the given function.

static bool isSafeForNoCSROpt(const Function &F)

Check if given function is safe for not having callee saved registers.

Definition TargetFrameLoweringImpl.cpp:160

virtual bool enableCFIFixup(const MachineFunction &MF) const

Returns true if we may need to fix the unwind information for the function.

Definition TargetFrameLoweringImpl.cpp:39

virtual ~TargetFrameLowering()

virtual StackOffset getFrameIndexReferenceFromSP(const MachineFunction &MF, int FI) const

getFrameIndexReferenceFromSP - This method returns the offset from the stack pointer to the slot of t...

Definition TargetFrameLoweringImpl.cpp:70

virtual int getInitialCFAOffset(const MachineFunction &MF) const

Return initial CFA offset value i.e.

Definition TargetFrameLoweringImpl.cpp:172

virtual StackOffset getFrameIndexReference(const MachineFunction &MF, int FI, Register &FrameReg) const

getFrameIndexReference - This method should return the base register and offset used to reference a f...

Definition TargetFrameLoweringImpl.cpp:49

TargetInstrInfo - Interface to description of machine instruction set.

const MCAsmInfo * getMCAsmInfo() const

Return target specific asm information.

unsigned EnableIPRA

This flag enables InterProcedural Register Allocation (IPRA).

TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...

virtual bool useFPForScavengingIndex(const MachineFunction &MF) const

Returns true if the target wants to use frame pointer based accesses to spill to the scavenger emerge...

virtual Register getFrameRegister(const MachineFunction &MF) const =0

Debug information queries.

virtual const TargetRegisterInfo * getRegisterInfo() const =0

Return the target's register information.

#define llvm_unreachable(msg)

Marks that the current location is not supposed to be reachable.

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.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

unsigned getKillRegState(bool B)

uint16_t MCPhysReg

An unsigned integer type large enough to represent all physical registers, but not necessarily virtua...