Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- Thumb2InstrInfo.h - Thumb-2 Instruction Information -----*- C++ -*-===// |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +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 | // This file contains the Thumb-2 implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 14 | #ifndef LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H |
| 15 | #define LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 16 | |
Craig Topper | 07720d8 | 2012-03-25 23:49:58 +0000 | [diff] [blame] | 17 | #include "ARMBaseInstrInfo.h" |
Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 18 | #include "ThumbRegisterInfo.h" |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
Evan Cheng | 2d51c7c | 2010-06-18 23:09:54 +0000 | [diff] [blame] | 21 | class ARMSubtarget; |
| 22 | class ScheduleHazardRecognizer; |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 23 | |
| 24 | class Thumb2InstrInfo : public ARMBaseInstrInfo { |
Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 25 | ThumbRegisterInfo RI; |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 26 | public: |
| 27 | explicit Thumb2InstrInfo(const ARMSubtarget &STI); |
| 28 | |
Hans Wennborg | 9b9a535 | 2017-04-21 21:48:41 +0000 | [diff] [blame] | 29 | /// Return the noop instruction to use for a noop. |
| 30 | void getNoop(MCInst &NopInst) const override; |
Jim Grosbach | 617f84dd | 2012-02-28 23:53:30 +0000 | [diff] [blame] | 31 | |
David Goodwin | af7451b | 2009-07-08 16:09:28 +0000 | [diff] [blame] | 32 | // Return the non-pre/post incrementing version of 'Opc'. Return 0 |
| 33 | // if there is not such an opcode. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 34 | unsigned getUnindexedOpcode(unsigned Opc) const override; |
David Goodwin | af7451b | 2009-07-08 16:09:28 +0000 | [diff] [blame] | 35 | |
Evan Cheng | 2d51c7c | 2010-06-18 23:09:54 +0000 | [diff] [blame] | 36 | void ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 37 | MachineBasicBlock *NewDest) const override; |
Evan Cheng | 2d51c7c | 2010-06-18 23:09:54 +0000 | [diff] [blame] | 38 | |
Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 39 | bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 40 | MachineBasicBlock::iterator MBBI) const override; |
Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 41 | |
Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 42 | void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
| 43 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 44 | bool KillSrc) const override; |
Anton Korobeynikov | c5df7e2 | 2009-07-16 23:26:06 +0000 | [diff] [blame] | 45 | |
Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 46 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 47 | MachineBasicBlock::iterator MBBI, |
| 48 | unsigned SrcReg, bool isKill, int FrameIndex, |
Evan Cheng | efb126a | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 49 | const TargetRegisterClass *RC, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 50 | const TargetRegisterInfo *TRI) const override; |
Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 51 | |
| 52 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 53 | MachineBasicBlock::iterator MBBI, |
| 54 | unsigned DestReg, int FrameIndex, |
Evan Cheng | efb126a | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 55 | const TargetRegisterClass *RC, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 56 | const TargetRegisterInfo *TRI) const override; |
Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 57 | |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 58 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 59 | /// such, whenever a client has an instance of instruction info, it should |
| 60 | /// always be able to get register info as well (through this method). |
| 61 | /// |
Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 62 | const ThumbRegisterInfo &getRegisterInfo() const override { return RI; } |
Akira Hatanaka | e5b6e0d | 2014-07-25 19:31:34 +0000 | [diff] [blame] | 63 | |
| 64 | private: |
Rafael Espindola | 82f4631 | 2016-06-28 15:18:26 +0000 | [diff] [blame] | 65 | void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override; |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 66 | }; |
Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 67 | |
| 68 | /// getITInstrPredicate - Valid only in Thumb2 mode. This function is identical |
| 69 | /// to llvm::getInstrPredicate except it returns AL for conditional branch |
| 70 | /// instructions which are "predicated", but are not in IT blocks. |
Duncan P. N. Exon Smith | 6307eb5 | 2016-02-23 02:46:52 +0000 | [diff] [blame] | 71 | ARMCC::CondCodes getITInstrPredicate(const MachineInstr &MI, unsigned &PredReg); |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 72 | } |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 73 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 74 | #endif |