| 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 |  | 
| Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 32 | MachineBasicBlock::iterator | 
| Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 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 |  | 
| James Y Knight | 667395f | 2015-08-21 04:17:56 +0000 | [diff] [blame] | 42 | int getFrameIndexReference(const MachineFunction &MF, int FI, | 
|  | 43 | unsigned &FrameReg) const override; | 
| James Y Knight | 3602286 | 2015-08-26 17:57:51 +0000 | [diff] [blame] | 44 |  | 
|  | 45 | /// targetHandlesStackFrameRounding - Returns true if the target is | 
|  | 46 | /// responsible for rounding up the stack frame (probably at emitPrologue | 
|  | 47 | /// time). | 
|  | 48 | bool targetHandlesStackFrameRounding() const override { return true; } | 
|  | 49 |  | 
| Venkatraman Govindaraju | ca0fe2f5 | 2013-05-29 04:46:31 +0000 | [diff] [blame] | 50 | private: | 
| Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 51 | // Remap input registers to output registers for leaf procedure. | 
| Venkatraman Govindaraju | ca0fe2f5 | 2013-05-29 04:46:31 +0000 | [diff] [blame] | 52 | void remapRegsForLeafProc(MachineFunction &MF) const; | 
|  | 53 |  | 
| Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 54 | // Returns true if MF is a leaf procedure. | 
| Venkatraman Govindaraju | ca0fe2f5 | 2013-05-29 04:46:31 +0000 | [diff] [blame] | 55 | bool isLeafProc(MachineFunction &MF) const; | 
| Venkatraman Govindaraju | 1116868 | 2013-11-24 20:23:25 +0000 | [diff] [blame] | 56 |  | 
|  | 57 |  | 
|  | 58 | // Emits code for adjusting SP in function prologue/epilogue. | 
|  | 59 | void emitSPAdjustment(MachineFunction &MF, | 
|  | 60 | MachineBasicBlock &MBB, | 
|  | 61 | MachineBasicBlock::iterator MBBI, | 
|  | 62 | int NumBytes, unsigned ADDrr, unsigned ADDri) const; | 
|  | 63 |  | 
| Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 64 | }; | 
|  | 65 |  | 
| Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 66 | } // End llvm namespace | 
| Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 67 |  | 
|  | 68 | #endif |