Alex Bradbury | 8971842 | 2017-10-19 21:37:38 +0000 | [diff] [blame] | 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 | |
David Blaikie | 1be62f0 | 2017-11-03 22:32:11 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/TargetFrameLowering.h" |
Alex Bradbury | 8971842 | 2017-10-19 21:37:38 +0000 | [diff] [blame] | 18 | |
| 19 | namespace llvm { |
| 20 | class RISCVSubtarget; |
| 21 | |
| 22 | class RISCVFrameLowering : public TargetFrameLowering { |
| 23 | public: |
| 24 | explicit RISCVFrameLowering(const RISCVSubtarget &STI) |
| 25 | : TargetFrameLowering(StackGrowsDown, |
| 26 | /*StackAlignment=*/16, |
| 27 | /*LocalAreaOffset=*/0) {} |
| 28 | |
| 29 | void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
| 30 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
| 31 | |
Alex Bradbury | 660bcce | 2017-12-11 11:53:54 +0000 | [diff] [blame^] | 32 | int getFrameIndexReference(const MachineFunction &MF, int FI, |
| 33 | unsigned &FrameReg) const override; |
| 34 | |
Alex Bradbury | 8971842 | 2017-10-19 21:37:38 +0000 | [diff] [blame] | 35 | bool hasFP(const MachineFunction &MF) const override; |
Alex Bradbury | a337675 | 2017-11-08 13:41:21 +0000 | [diff] [blame] | 36 | |
| 37 | MachineBasicBlock::iterator |
| 38 | eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, |
| 39 | MachineBasicBlock::iterator MI) const override { |
| 40 | return MBB.erase(MI); |
| 41 | } |
Alex Bradbury | 8971842 | 2017-10-19 21:37:38 +0000 | [diff] [blame] | 42 | }; |
| 43 | } |
| 44 | #endif |