LLVM  9.0.0svn
RISCVFrameLowering.h
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 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H
14 #define LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H
15 
17 
18 namespace llvm {
19 class RISCVSubtarget;
20 
22 public:
25  /*StackAlignment=*/16,
26  /*LocalAreaOffset=*/0),
27  STI(STI) {}
28 
29  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
30  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
31 
32  int getFrameIndexReference(const MachineFunction &MF, int FI,
33  unsigned &FrameReg) const override;
34 
35  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
36  RegScavenger *RS) const override;
37 
39  RegScavenger *RS) const override;
40 
41  bool hasFP(const MachineFunction &MF) const override;
42 
43  bool hasReservedCallFrame(const MachineFunction &MF) const override;
46  MachineBasicBlock::iterator MI) const override;
47 
48 protected:
50 
51 private:
52  void determineFrameLayout(MachineFunction &MF) const;
53  void adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
54  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
55  int64_t Val, MachineInstr::MIFlag Flag) const;
56 };
57 }
58 #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...
Flag
These should be considered private to the implementation of the MCInstrDesc class.
Definition: MCInstrDesc.h:117
void processFunctionBeforeFrameFinalized(MachineFunction &MF, RegScavenger *RS) const override
processFunctionBeforeFrameFinalized - This method is called immediately before the specified function...
RISCVFrameLowering(const RISCVSubtarget &STI)
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