LLVM  10.0.0svn
Go to the documentation of this file.
1 //===-- RISCVFrameLowering.h - Define frame lowering for RISCV -*- C++ -*--===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This class implements RISCV-specific bits of TargetFrameLowering class.
10 //
11 //===----------------------------------------------------------------------===//
18 namespace llvm {
19 class RISCVSubtarget;
22 public:
25  /*StackAlignment=*/Align(16),
26  /*LocalAreaOffset=*/0),
27  STI(STI) {}
29  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
30  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
32  int getFrameIndexReference(const MachineFunction &MF, int FI,
33  unsigned &FrameReg) const override;
35  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
36  RegScavenger *RS) const override;
39  RegScavenger *RS) const override;
41  bool hasFP(const MachineFunction &MF) const override;
43  bool hasReservedCallFrame(const MachineFunction &MF) const override;
46  MachineBasicBlock::iterator MI) const override;
48  // Get the first stack adjustment amount for SplitSPAdjust.
49  // Return 0 if we don't want to to split the SP adjustment in prologue and
50  // epilogue.
51  uint64_t getFirstSPAdjustAmount(const MachineFunction &MF) const;
53 protected:
56 private:
57  void determineFrameLayout(MachineFunction &MF) const;
58  void adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
59  const DebugLoc &DL, Register DestReg, Register SrcReg,
60  int64_t Val, MachineInstr::MIFlag Flag) const;
61 };
62 }
63 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:23
bool hasFP(const MachineFunction &MF) const override
hasFP - Return true if the specified function should have a dedicated frame pointer register...
int getFrameIndexReference(const MachineFunction &MF, int FI, unsigned &FrameReg) const override
getFrameIndexReference - This method should return the base register and offset used to reference a f...
MachineBasicBlock::iterator eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, MachineBasicBlock::iterator MI) const override
This method is called during prolog/epilog code insertion to eliminate call frame setup and destroy p...
A debug info location.
Definition: DebugLoc.h:33
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, RegScavenger *RS) const override
This method determines which of the registers reported by TargetRegisterInfo::getCalleeSavedRegs() sh...
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:131
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
RISCVFrameLowering(const RISCVSubtarget &STI)
uint64_t getFirstSPAdjustAmount(const MachineFunction &MF) const
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:40
Information about stack frame layout on the target.
bool hasReservedCallFrame(const MachineFunction &MF) const override
hasReservedCallFrame - Under normal circumstances, when a frame pointer is not required, we reserve argument space for call sites in the function immediately on entry to the current function.
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override
emitProlog/emitEpilog - These methods insert prolog and epilog code into the function.
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override
const RISCVSubtarget & STI
IRTranslator LLVM IR MI
Wrapper class representing virtual and physical registers.
Definition: Register.h:19