Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- SparcFrameLowering.h - Define frame lowering for Sparc --*- C++ -*-===// |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 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 | // |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H |
| 15 | #define LLVM_LIB_TARGET_SPARC_SPARCFRAMELOWERING_H |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 16 | |
| 17 | #include "Sparc.h" |
Anton Korobeynikov | 2f93128 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetFrameLowering.h" |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 21 | |
Eric Christopher | 55414d4 | 2014-06-26 22:33:50 +0000 | [diff] [blame] | 22 | class SparcSubtarget; |
Anton Korobeynikov | 2f93128 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 23 | class SparcFrameLowering : public TargetFrameLowering { |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 24 | public: |
Eric Christopher | 55414d4 | 2014-06-26 22:33:50 +0000 | [diff] [blame] | 25 | explicit SparcFrameLowering(const SparcSubtarget &ST); |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 26 | |
| 27 | /// emitProlog/emitEpilog - These methods insert prolog and epilog code into |
| 28 | /// the function. |
Quentin Colombet | 61b305e | 2015-05-05 17:38:16 +0000 | [diff] [blame] | 29 | void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 30 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Anton Korobeynikov | 0eecf5d | 2010-11-18 21:19:35 +0000 | [diff] [blame] | 31 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 32 | void |
| 33 | eliminateCallFramePseudoInstr(MachineFunction &MF, |
| 34 | MachineBasicBlock &MBB, |
| 35 | MachineBasicBlock::iterator I) const override; |
Eli Bendersky | 8da8716 | 2013-02-21 20:05:00 +0000 | [diff] [blame] | 36 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 37 | bool hasReservedCallFrame(const MachineFunction &MF) const override; |
| 38 | bool hasFP(const MachineFunction &MF) const override; |
Matthias Braun | 0256486 | 2015-07-14 17:17:13 +0000 | [diff] [blame^] | 39 | void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, |
| 40 | RegScavenger *RS = nullptr) const override; |
Venkatraman Govindaraju | ca0fe2f5 | 2013-05-29 04:46:31 +0000 | [diff] [blame] | 41 | |
| 42 | private: |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 43 | // Remap input registers to output registers for leaf procedure. |
Venkatraman Govindaraju | ca0fe2f5 | 2013-05-29 04:46:31 +0000 | [diff] [blame] | 44 | void remapRegsForLeafProc(MachineFunction &MF) const; |
| 45 | |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 46 | // Returns true if MF is a leaf procedure. |
Venkatraman Govindaraju | ca0fe2f5 | 2013-05-29 04:46:31 +0000 | [diff] [blame] | 47 | bool isLeafProc(MachineFunction &MF) const; |
Venkatraman Govindaraju | 1116868 | 2013-11-24 20:23:25 +0000 | [diff] [blame] | 48 | |
| 49 | |
| 50 | // Emits code for adjusting SP in function prologue/epilogue. |
| 51 | void emitSPAdjustment(MachineFunction &MF, |
| 52 | MachineBasicBlock &MBB, |
| 53 | MachineBasicBlock::iterator MBBI, |
| 54 | int NumBytes, unsigned ADDrr, unsigned ADDri) const; |
| 55 | |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 58 | } // End llvm namespace |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 59 | |
| 60 | #endif |