Anton Korobeynikov | 2f93128 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 1 | //==-- ARMTargetFrameLowering.h - Define frame lowering for ARM --*- C++ -*-==// |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 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_ARM_ARMFRAMELOWERING_H |
| 15 | #define LLVM_LIB_TARGET_ARM_ARMFRAMELOWERING_H |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 16 | |
Anton Korobeynikov | 2f93128 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 17 | #include "llvm/Target/TargetFrameLowering.h" |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 18 | |
| 19 | namespace llvm { |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 20 | class ARMSubtarget; |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 21 | |
Anton Korobeynikov | 2f93128 | 2011-01-10 12:39:04 +0000 | [diff] [blame] | 22 | class ARMFrameLowering : public TargetFrameLowering { |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 23 | protected: |
| 24 | const ARMSubtarget &STI; |
| 25 | |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 26 | public: |
Eric Christopher | 45fb7b6 | 2014-06-26 19:29:59 +0000 | [diff] [blame] | 27 | explicit ARMFrameLowering(const ARMSubtarget &sti); |
Anton Korobeynikov | f7183ed | 2010-11-15 00:06:54 +0000 | [diff] [blame] | 28 | |
| 29 | /// emitProlog/emitEpilog - These methods insert prolog and epilog code into |
| 30 | /// the function. |
Quentin Colombet | 61b305e | 2015-05-05 17:38:16 +0000 | [diff] [blame] | 31 | void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 32 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override; |
Anton Korobeynikov | 0eecf5d | 2010-11-18 21:19:35 +0000 | [diff] [blame] | 33 | |
Anton Korobeynikov | d08fbd1 | 2010-11-27 23:05:03 +0000 | [diff] [blame] | 34 | bool spillCalleeSavedRegisters(MachineBasicBlock &MBB, |
| 35 | MachineBasicBlock::iterator MI, |
| 36 | const std::vector<CalleeSavedInfo> &CSI, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 37 | const TargetRegisterInfo *TRI) const override; |
Anton Korobeynikov | d08fbd1 | 2010-11-27 23:05:03 +0000 | [diff] [blame] | 38 | |
| 39 | bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 40 | MachineBasicBlock::iterator MI, |
Krzysztof Parzyszek | bea30c6 | 2017-08-10 16:17:32 +0000 | [diff] [blame] | 41 | std::vector<CalleeSavedInfo> &CSI, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 42 | const TargetRegisterInfo *TRI) const override; |
Anton Korobeynikov | d08fbd1 | 2010-11-27 23:05:03 +0000 | [diff] [blame] | 43 | |
Akira Hatanaka | ddf76aa | 2015-05-23 01:14:08 +0000 | [diff] [blame] | 44 | bool noFramePointerElim(const MachineFunction &MF) const override; |
| 45 | |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 46 | bool hasFP(const MachineFunction &MF) const override; |
| 47 | bool hasReservedCallFrame(const MachineFunction &MF) const override; |
| 48 | bool canSimplifyCallFramePseudos(const MachineFunction &MF) const override; |
Anton Korobeynikov | 4687778 | 2010-11-20 15:59:32 +0000 | [diff] [blame] | 49 | int getFrameIndexReference(const MachineFunction &MF, int FI, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 50 | unsigned &FrameReg) const override; |
| 51 | int ResolveFrameIndexReference(const MachineFunction &MF, int FI, |
Anton Korobeynikov | 4687778 | 2010-11-20 15:59:32 +0000 | [diff] [blame] | 52 | unsigned &FrameReg, int SPAdj) const; |
Anton Korobeynikov | 4687778 | 2010-11-20 15:59:32 +0000 | [diff] [blame] | 53 | |
Matthias Braun | 0256486 | 2015-07-14 17:17:13 +0000 | [diff] [blame] | 54 | void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs, |
| 55 | RegScavenger *RS) const override; |
Anton Korobeynikov | 7283b8d | 2010-11-27 23:05:25 +0000 | [diff] [blame] | 56 | |
Quentin Colombet | 61b305e | 2015-05-05 17:38:16 +0000 | [diff] [blame] | 57 | void adjustForSegmentedStacks(MachineFunction &MF, |
| 58 | MachineBasicBlock &MBB) const override; |
Oliver Stannard | b14c625 | 2014-04-02 16:10:33 +0000 | [diff] [blame] | 59 | |
Quentin Colombet | 8cb95b8 | 2015-11-18 00:40:54 +0000 | [diff] [blame] | 60 | /// Returns true if the target will correctly handle shrink wrapping. |
| 61 | bool enableShrinkWrapping(const MachineFunction &MF) const override { |
| 62 | return true; |
| 63 | } |
| 64 | |
Anton Korobeynikov | d08fbd1 | 2010-11-27 23:05:03 +0000 | [diff] [blame] | 65 | private: |
Anton Korobeynikov | d08fbd1 | 2010-11-27 23:05:03 +0000 | [diff] [blame] | 66 | void emitPushInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, |
Jim Grosbach | 5fccad8 | 2010-12-09 18:31:13 +0000 | [diff] [blame] | 67 | const std::vector<CalleeSavedInfo> &CSI, unsigned StmOpc, |
| 68 | unsigned StrOpc, bool NoGap, |
Jakob Stoklund Olesen | 0965585 | 2011-12-23 00:36:18 +0000 | [diff] [blame] | 69 | bool(*Func)(unsigned, bool), unsigned NumAlignedDPRCS2Regs, |
Anton Korobeynikov | e7410dd | 2011-03-05 18:43:32 +0000 | [diff] [blame] | 70 | unsigned MIFlags = 0) const; |
Evan Cheng | 775ead3 | 2010-12-07 23:08:38 +0000 | [diff] [blame] | 71 | void emitPopInst(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, |
Krzysztof Parzyszek | bea30c6 | 2017-08-10 16:17:32 +0000 | [diff] [blame] | 72 | std::vector<CalleeSavedInfo> &CSI, unsigned LdmOpc, |
Jim Grosbach | 5fccad8 | 2010-12-09 18:31:13 +0000 | [diff] [blame] | 73 | unsigned LdrOpc, bool isVarArg, bool NoGap, |
Jakob Stoklund Olesen | 0965585 | 2011-12-23 00:36:18 +0000 | [diff] [blame] | 74 | bool(*Func)(unsigned, bool), |
| 75 | unsigned NumAlignedDPRCS2Regs) const; |
Eli Bendersky | 8da8716 | 2013-02-21 20:05:00 +0000 | [diff] [blame] | 76 | |
Hans Wennborg | e1a2e90 | 2016-03-31 18:33:38 +0000 | [diff] [blame] | 77 | MachineBasicBlock::iterator |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 78 | eliminateCallFramePseudoInstr(MachineFunction &MF, |
| 79 | MachineBasicBlock &MBB, |
| 80 | MachineBasicBlock::iterator MI) const override; |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 81 | }; |
| 82 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 83 | } // End llvm namespace |
Rafael Espindola | bf8e751 | 2006-08-16 14:43:33 +0000 | [diff] [blame] | 84 | |
| 85 | #endif |