xref: /aosp_15_r20/external/llvm/lib/Target/ARM/Thumb2InstrInfo.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- Thumb2InstrInfo.h - Thumb-2 Instruction Information -----*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker //
10*9880d681SAndroid Build Coastguard Worker // This file contains the Thumb-2 implementation of the TargetInstrInfo class.
11*9880d681SAndroid Build Coastguard Worker //
12*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
13*9880d681SAndroid Build Coastguard Worker 
14*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "ARMBaseInstrInfo.h"
18*9880d681SAndroid Build Coastguard Worker #include "ThumbRegisterInfo.h"
19*9880d681SAndroid Build Coastguard Worker 
20*9880d681SAndroid Build Coastguard Worker namespace llvm {
21*9880d681SAndroid Build Coastguard Worker class ARMSubtarget;
22*9880d681SAndroid Build Coastguard Worker class ScheduleHazardRecognizer;
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker class Thumb2InstrInfo : public ARMBaseInstrInfo {
25*9880d681SAndroid Build Coastguard Worker   ThumbRegisterInfo RI;
26*9880d681SAndroid Build Coastguard Worker public:
27*9880d681SAndroid Build Coastguard Worker   explicit Thumb2InstrInfo(const ARMSubtarget &STI);
28*9880d681SAndroid Build Coastguard Worker 
29*9880d681SAndroid Build Coastguard Worker   /// getNoopForMachoTarget - Return the noop instruction to use for a noop.
30*9880d681SAndroid Build Coastguard Worker   void getNoopForMachoTarget(MCInst &NopInst) const override;
31*9880d681SAndroid Build Coastguard Worker 
32*9880d681SAndroid Build Coastguard Worker   // Return the non-pre/post incrementing version of 'Opc'. Return 0
33*9880d681SAndroid Build Coastguard Worker   // if there is not such an opcode.
34*9880d681SAndroid Build Coastguard Worker   unsigned getUnindexedOpcode(unsigned Opc) const override;
35*9880d681SAndroid Build Coastguard Worker 
36*9880d681SAndroid Build Coastguard Worker   void ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
37*9880d681SAndroid Build Coastguard Worker                                MachineBasicBlock *NewDest) const override;
38*9880d681SAndroid Build Coastguard Worker 
39*9880d681SAndroid Build Coastguard Worker   bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
40*9880d681SAndroid Build Coastguard Worker                            MachineBasicBlock::iterator MBBI) const override;
41*9880d681SAndroid Build Coastguard Worker 
42*9880d681SAndroid Build Coastguard Worker   void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
43*9880d681SAndroid Build Coastguard Worker                    const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
44*9880d681SAndroid Build Coastguard Worker                    bool KillSrc) const override;
45*9880d681SAndroid Build Coastguard Worker 
46*9880d681SAndroid Build Coastguard Worker   void storeRegToStackSlot(MachineBasicBlock &MBB,
47*9880d681SAndroid Build Coastguard Worker                            MachineBasicBlock::iterator MBBI,
48*9880d681SAndroid Build Coastguard Worker                            unsigned SrcReg, bool isKill, int FrameIndex,
49*9880d681SAndroid Build Coastguard Worker                            const TargetRegisterClass *RC,
50*9880d681SAndroid Build Coastguard Worker                            const TargetRegisterInfo *TRI) const override;
51*9880d681SAndroid Build Coastguard Worker 
52*9880d681SAndroid Build Coastguard Worker   void loadRegFromStackSlot(MachineBasicBlock &MBB,
53*9880d681SAndroid Build Coastguard Worker                             MachineBasicBlock::iterator MBBI,
54*9880d681SAndroid Build Coastguard Worker                             unsigned DestReg, int FrameIndex,
55*9880d681SAndroid Build Coastguard Worker                             const TargetRegisterClass *RC,
56*9880d681SAndroid Build Coastguard Worker                             const TargetRegisterInfo *TRI) const override;
57*9880d681SAndroid Build Coastguard Worker 
58*9880d681SAndroid Build Coastguard Worker   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
59*9880d681SAndroid Build Coastguard Worker   /// such, whenever a client has an instance of instruction info, it should
60*9880d681SAndroid Build Coastguard Worker   /// always be able to get register info as well (through this method).
61*9880d681SAndroid Build Coastguard Worker   ///
getRegisterInfo()62*9880d681SAndroid Build Coastguard Worker   const ThumbRegisterInfo &getRegisterInfo() const override { return RI; }
63*9880d681SAndroid Build Coastguard Worker 
64*9880d681SAndroid Build Coastguard Worker private:
65*9880d681SAndroid Build Coastguard Worker   void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override;
66*9880d681SAndroid Build Coastguard Worker };
67*9880d681SAndroid Build Coastguard Worker 
68*9880d681SAndroid Build Coastguard Worker /// getITInstrPredicate - Valid only in Thumb2 mode. This function is identical
69*9880d681SAndroid Build Coastguard Worker /// to llvm::getInstrPredicate except it returns AL for conditional branch
70*9880d681SAndroid Build Coastguard Worker /// instructions which are "predicated", but are not in IT blocks.
71*9880d681SAndroid Build Coastguard Worker ARMCC::CondCodes getITInstrPredicate(const MachineInstr &MI, unsigned &PredReg);
72*9880d681SAndroid Build Coastguard Worker }
73*9880d681SAndroid Build Coastguard Worker 
74*9880d681SAndroid Build Coastguard Worker #endif
75