| 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 | // |
| Chandler Carruth | 2946cd7 | 2019-01-19 08:50:56 +0000 | [diff] [blame] | 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file contains the Thumb-2 implementation of the TargetInstrInfo class. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 13 | #ifndef LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H |
| 14 | #define LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 15 | |
| Craig Topper | 07720d8 | 2012-03-25 23:49:58 +0000 | [diff] [blame] | 16 | #include "ARMBaseInstrInfo.h" |
| Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 17 | #include "ThumbRegisterInfo.h" |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 18 | |
| 19 | namespace llvm { |
| Evan Cheng | 2d51c7c | 2010-06-18 23:09:54 +0000 | [diff] [blame] | 20 | class ARMSubtarget; |
| 21 | class ScheduleHazardRecognizer; |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 22 | |
| 23 | class Thumb2InstrInfo : public ARMBaseInstrInfo { |
| Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 24 | ThumbRegisterInfo RI; |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 25 | public: |
| 26 | explicit Thumb2InstrInfo(const ARMSubtarget &STI); |
| 27 | |
| Hans Wennborg | 9b9a535 | 2017-04-21 21:48:41 +0000 | [diff] [blame] | 28 | /// Return the noop instruction to use for a noop. |
| 29 | void getNoop(MCInst &NopInst) const override; |
| Jim Grosbach | 617f84dd | 2012-02-28 23:53:30 +0000 | [diff] [blame] | 30 | |
| David Goodwin | af7451b | 2009-07-08 16:09:28 +0000 | [diff] [blame] | 31 | // Return the non-pre/post incrementing version of 'Opc'. Return 0 |
| 32 | // if there is not such an opcode. |
| Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 33 | unsigned getUnindexedOpcode(unsigned Opc) const override; |
| David Goodwin | af7451b | 2009-07-08 16:09:28 +0000 | [diff] [blame] | 34 | |
| Evan Cheng | 2d51c7c | 2010-06-18 23:09:54 +0000 | [diff] [blame] | 35 | void ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail, |
| Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 36 | MachineBasicBlock *NewDest) const override; |
| Evan Cheng | 2d51c7c | 2010-06-18 23:09:54 +0000 | [diff] [blame] | 37 | |
| Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 38 | bool isLegalToSplitMBBAt(MachineBasicBlock &MBB, |
| Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 39 | MachineBasicBlock::iterator MBBI) const override; |
| Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 40 | |
| Benjamin Kramer | bdc4956 | 2016-06-12 15:39:02 +0000 | [diff] [blame] | 41 | void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I, |
| 42 | const DebugLoc &DL, unsigned DestReg, unsigned SrcReg, |
| Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 43 | bool KillSrc) const override; |
| Anton Korobeynikov | c5df7e2 | 2009-07-16 23:26:06 +0000 | [diff] [blame] | 44 | |
| Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 45 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 46 | MachineBasicBlock::iterator MBBI, |
| 47 | unsigned SrcReg, bool isKill, int FrameIndex, |
| Evan Cheng | efb126a | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 48 | const TargetRegisterClass *RC, |
| Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 49 | const TargetRegisterInfo *TRI) const override; |
| Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 50 | |
| 51 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 52 | MachineBasicBlock::iterator MBBI, |
| 53 | unsigned DestReg, int FrameIndex, |
| Evan Cheng | efb126a | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 54 | const TargetRegisterClass *RC, |
| Craig Topper | 6bc27bf | 2014-03-10 02:09:33 +0000 | [diff] [blame] | 55 | const TargetRegisterInfo *TRI) const override; |
| Evan Cheng | c47e109 | 2009-07-27 03:14:20 +0000 | [diff] [blame] | 56 | |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 57 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 58 | /// such, whenever a client has an instance of instruction info, it should |
| 59 | /// always be able to get register info as well (through this method). |
| 60 | /// |
| Eric Christopher | ae32649 | 2015-03-12 22:48:50 +0000 | [diff] [blame] | 61 | const ThumbRegisterInfo &getRegisterInfo() const override { return RI; } |
| Akira Hatanaka | e5b6e0d | 2014-07-25 19:31:34 +0000 | [diff] [blame] | 62 | |
| 63 | private: |
| Rafael Espindola | 82f4631 | 2016-06-28 15:18:26 +0000 | [diff] [blame] | 64 | void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override; |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 65 | }; |
| Evan Cheng | 37bb617 | 2010-06-22 01:18:16 +0000 | [diff] [blame] | 66 | |
| 67 | /// getITInstrPredicate - Valid only in Thumb2 mode. This function is identical |
| 68 | /// to llvm::getInstrPredicate except it returns AL for conditional branch |
| 69 | /// 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] | 70 | ARMCC::CondCodes getITInstrPredicate(const MachineInstr &MI, unsigned &PredReg); |
| Sjoerd Meijer | 3058a62 | 2019-06-14 11:46:05 +0000 | [diff] [blame] | 71 | |
| 72 | // getVPTInstrPredicate: VPT analogue of that, plus a helper function |
| 73 | // corresponding to MachineInstr::findFirstPredOperandIdx. |
| 74 | int findFirstVPTPredOperandIdx(const MachineInstr &MI); |
| 75 | ARMVCC::VPTCodes getVPTInstrPredicate(const MachineInstr &MI, |
| 76 | unsigned &PredReg); |
| Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 77 | } |
| David Goodwin | ade05a3 | 2009-07-02 22:18:33 +0000 | [diff] [blame] | 78 | |
| Benjamin Kramer | a7c40ef | 2014-08-13 16:26:38 +0000 | [diff] [blame] | 79 | #endif |