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 | |
Jim Grosbach | 617f84dd | 2012-02-28 23:53:30 +0000 | [diff] [blame] | 29 | /// getNoopForMachoTarget - Return the noop instruction to use for a noop. |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 30 | void getNoopForMachoTarget(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 | |
Jakob Stoklund Olesen | d7b3300 | 2010-07-11 06:33:54 +0000 | [diff] [blame] | 42 | void copyPhysReg(MachineBasicBlock &MBB, |
| 43 | MachineBasicBlock::iterator I, DebugLoc DL, |
| 44 | unsigned DestReg, unsigned SrcReg, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 45 | bool KillSrc) const override; |
Anton Korobeynikov | c5df7e2 | 2009-07-16 23:26:06 +0000 | [diff] [blame] | 46 | |
Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 47 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 48 | MachineBasicBlock::iterator MBBI, |
| 49 | unsigned SrcReg, bool isKill, int FrameIndex, |
Evan Cheng | efb126a | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 50 | const TargetRegisterClass *RC, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 51 | const TargetRegisterInfo *TRI) const override; |
Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 52 | |
| 53 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 54 | MachineBasicBlock::iterator MBBI, |
| 55 | unsigned DestReg, int FrameIndex, |
Evan Cheng | efb126a | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 56 | const TargetRegisterClass *RC, |
Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 57 | const TargetRegisterInfo *TRI) const override; |
Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 58 | |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 59 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 60 | /// such, whenever a client has an instance of instruction info, it should |
| 61 | /// always be able to get register info as well (through this method). |
| 62 | /// |
Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 63 | const ThumbRegisterInfo &getRegisterInfo() const override { return RI; } |
Akira Hatanaka | e5b6e0d | 2014-07-25 19:31:34 +0000 | [diff] [blame] | 64 | |
| 65 | private: |
| 66 | void expandLoadStackGuard(MachineBasicBlock::iterator MI, |
| 67 | Reloc::Model RM) const override; |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 68 | }; |
Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 69 | |
| 70 | /// getITInstrPredicate - Valid only in Thumb2 mode. This function is identical |
| 71 | /// to llvm::getInstrPredicate except it returns AL for conditional branch |
| 72 | /// instructions which are "predicated", but are not in IT blocks. |
| 73 | ARMCC::CondCodes getITInstrPredicate(const MachineInstr *MI, unsigned &PredReg); |
| 74 | |
| 75 | |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 76 | } |
David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 77 | |
Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 78 | #endif |