LLVM  8.0.1
RISCVFrameLowering.h
Go to the documentation of this file.
1 //===-- RISCVFrameLowering.h - Define frame lowering for RISCV -*- C++ -*--===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This class implements RISCV-specific bits of TargetFrameLowering class.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H
15 #define LLVM_LIB_TARGET_RISCV_RISCVFRAMELOWERING_H
16 
18 
19 namespace llvm {
20 class RISCVSubtarget;
21 
23 public:
26  /*StackAlignment=*/16,
27  /*LocalAreaOffset=*/0),
28  STI(STI) {}
29 
30  void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
31  void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
32 
33  int getFrameIndexReference(const MachineFunction &MF, int FI,
34  unsigned &FrameReg) const override;
35 
36  void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
37  RegScavenger *RS) const override;
38 
40  RegScavenger *RS) const override;
41 
42  bool hasFP(const MachineFunction &MF) const override;
43 
44  bool hasReservedCallFrame(const MachineFunction &MF) const override;
47  MachineBasicBlock::iterator MI) const override;
48 
49 protected:
51 
52 private:
53  void determineFrameLayout(MachineFunction &MF) const;
54  void adjustReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI,
55  const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
56  int64_t Val, MachineInstr::MIFlag Flag) const;
57 };
58 }
59 #endif
This class represents lattice values for constants.
Definition: AllocatorList.h:24
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:34
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:118
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