Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 1 | //===-- BPFFrameLowering.h - Define frame lowering for BPF -----*- 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 BPF-specific bits of TargetFrameLowering class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_LIB_TARGET_BPF_BPFFRAMELOWERING_H |
| 15 | #define LLVM_LIB_TARGET_BPF_BPFFRAMELOWERING_H |
| 16 | |
David Blaikie | 1be62f0 | 2017-11-03 22:32:11 +0000 | [diff] [blame] | 17 | #include "llvm/CodeGen/TargetFrameLowering.h" |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 18 | |
| 19 | namespace llvm { |
| 20 | class BPFSubtarget; |
| 21 | |
| 22 | class BPFFrameLowering : public TargetFrameLowering { |
| 23 | public: |
| 24 | explicit BPFFrameLowering(const BPFSubtarget &sti) |
| 25 | : TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 8, 0) {} |
| 26 | |
Quentin Colombet | 61b305e | 2015-05-05 17:38:16 +0000 | [diff] [blame] | 27 | void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 28 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
| 29 | |
| 30 | bool hasFP(const MachineFunction &MF) const override; |
Matthias Braun | 0256486 | 2015-07-14 17:17:13 +0000 | [diff] [blame] | 31 | void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, |
| 32 | RegScavenger *RS) const override; |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 33 | |
Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 34 | MachineBasicBlock::iterator |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 35 | eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB, |
| 36 | MachineBasicBlock::iterator MI) const override { |
Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 37 | return MBB.erase(MI); |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 38 | } |
| 39 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 40 | } |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 41 | #endif |