xref: /aosp_15_r20/external/llvm/lib/Target/Sparc/SparcInstrInfo.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===-- SparcInstrInfo.h - Sparc 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 Sparc 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_SPARC_SPARCINSTRINFO_H
15*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_SPARC_SPARCINSTRINFO_H
16*9880d681SAndroid Build Coastguard Worker 
17*9880d681SAndroid Build Coastguard Worker #include "SparcRegisterInfo.h"
18*9880d681SAndroid Build Coastguard Worker #include "llvm/Target/TargetInstrInfo.h"
19*9880d681SAndroid Build Coastguard Worker 
20*9880d681SAndroid Build Coastguard Worker #define GET_INSTRINFO_HEADER
21*9880d681SAndroid Build Coastguard Worker #include "SparcGenInstrInfo.inc"
22*9880d681SAndroid Build Coastguard Worker 
23*9880d681SAndroid Build Coastguard Worker namespace llvm {
24*9880d681SAndroid Build Coastguard Worker 
25*9880d681SAndroid Build Coastguard Worker class SparcSubtarget;
26*9880d681SAndroid Build Coastguard Worker 
27*9880d681SAndroid Build Coastguard Worker /// SPII - This namespace holds all of the target specific flags that
28*9880d681SAndroid Build Coastguard Worker /// instruction info tracks.
29*9880d681SAndroid Build Coastguard Worker ///
30*9880d681SAndroid Build Coastguard Worker namespace SPII {
31*9880d681SAndroid Build Coastguard Worker   enum {
32*9880d681SAndroid Build Coastguard Worker     Pseudo = (1<<0),
33*9880d681SAndroid Build Coastguard Worker     Load = (1<<1),
34*9880d681SAndroid Build Coastguard Worker     Store = (1<<2),
35*9880d681SAndroid Build Coastguard Worker     DelaySlot = (1<<3)
36*9880d681SAndroid Build Coastguard Worker   };
37*9880d681SAndroid Build Coastguard Worker }
38*9880d681SAndroid Build Coastguard Worker 
39*9880d681SAndroid Build Coastguard Worker class SparcInstrInfo : public SparcGenInstrInfo {
40*9880d681SAndroid Build Coastguard Worker   const SparcRegisterInfo RI;
41*9880d681SAndroid Build Coastguard Worker   const SparcSubtarget& Subtarget;
42*9880d681SAndroid Build Coastguard Worker   virtual void anchor();
43*9880d681SAndroid Build Coastguard Worker public:
44*9880d681SAndroid Build Coastguard Worker   explicit SparcInstrInfo(SparcSubtarget &ST);
45*9880d681SAndroid Build Coastguard Worker 
46*9880d681SAndroid Build Coastguard Worker   /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info.  As
47*9880d681SAndroid Build Coastguard Worker   /// such, whenever a client has an instance of instruction info, it should
48*9880d681SAndroid Build Coastguard Worker   /// always be able to get register info as well (through this method).
49*9880d681SAndroid Build Coastguard Worker   ///
getRegisterInfo()50*9880d681SAndroid Build Coastguard Worker   const SparcRegisterInfo &getRegisterInfo() const { return RI; }
51*9880d681SAndroid Build Coastguard Worker 
52*9880d681SAndroid Build Coastguard Worker   /// isLoadFromStackSlot - If the specified machine instruction is a direct
53*9880d681SAndroid Build Coastguard Worker   /// load from a stack slot, return the virtual or physical register number of
54*9880d681SAndroid Build Coastguard Worker   /// the destination along with the FrameIndex of the loaded stack slot.  If
55*9880d681SAndroid Build Coastguard Worker   /// not, return 0.  This predicate must return 0 if the instruction has
56*9880d681SAndroid Build Coastguard Worker   /// any side effects other than loading from the stack slot.
57*9880d681SAndroid Build Coastguard Worker   unsigned isLoadFromStackSlot(const MachineInstr &MI,
58*9880d681SAndroid Build Coastguard Worker                                int &FrameIndex) const override;
59*9880d681SAndroid Build Coastguard Worker 
60*9880d681SAndroid Build Coastguard Worker   /// isStoreToStackSlot - If the specified machine instruction is a direct
61*9880d681SAndroid Build Coastguard Worker   /// store to a stack slot, return the virtual or physical register number of
62*9880d681SAndroid Build Coastguard Worker   /// the source reg along with the FrameIndex of the loaded stack slot.  If
63*9880d681SAndroid Build Coastguard Worker   /// not, return 0.  This predicate must return 0 if the instruction has
64*9880d681SAndroid Build Coastguard Worker   /// any side effects other than storing to the stack slot.
65*9880d681SAndroid Build Coastguard Worker   unsigned isStoreToStackSlot(const MachineInstr &MI,
66*9880d681SAndroid Build Coastguard Worker                               int &FrameIndex) const override;
67*9880d681SAndroid Build Coastguard Worker 
68*9880d681SAndroid Build Coastguard Worker   bool analyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB,
69*9880d681SAndroid Build Coastguard Worker                      MachineBasicBlock *&FBB,
70*9880d681SAndroid Build Coastguard Worker                      SmallVectorImpl<MachineOperand> &Cond,
71*9880d681SAndroid Build Coastguard Worker                      bool AllowModify = false) const override;
72*9880d681SAndroid Build Coastguard Worker 
73*9880d681SAndroid Build Coastguard Worker   unsigned RemoveBranch(MachineBasicBlock &MBB) const override;
74*9880d681SAndroid Build Coastguard Worker 
75*9880d681SAndroid Build Coastguard Worker   unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
76*9880d681SAndroid Build Coastguard Worker                         MachineBasicBlock *FBB, ArrayRef<MachineOperand> Cond,
77*9880d681SAndroid Build Coastguard Worker                         const DebugLoc &DL) const override;
78*9880d681SAndroid Build Coastguard Worker 
79*9880d681SAndroid Build Coastguard Worker   bool
80*9880d681SAndroid Build Coastguard Worker   ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const override;
81*9880d681SAndroid Build Coastguard Worker 
82*9880d681SAndroid Build Coastguard Worker   void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
83*9880d681SAndroid Build Coastguard Worker                    const DebugLoc &DL, unsigned DestReg, unsigned SrcReg,
84*9880d681SAndroid Build Coastguard Worker                    bool KillSrc) const override;
85*9880d681SAndroid Build Coastguard Worker 
86*9880d681SAndroid Build Coastguard Worker   void storeRegToStackSlot(MachineBasicBlock &MBB,
87*9880d681SAndroid Build Coastguard Worker                            MachineBasicBlock::iterator MBBI,
88*9880d681SAndroid Build Coastguard Worker                            unsigned SrcReg, bool isKill, int FrameIndex,
89*9880d681SAndroid Build Coastguard Worker                            const TargetRegisterClass *RC,
90*9880d681SAndroid Build Coastguard Worker                            const TargetRegisterInfo *TRI) const override;
91*9880d681SAndroid Build Coastguard Worker 
92*9880d681SAndroid Build Coastguard Worker   void loadRegFromStackSlot(MachineBasicBlock &MBB,
93*9880d681SAndroid Build Coastguard Worker                             MachineBasicBlock::iterator MBBI,
94*9880d681SAndroid Build Coastguard Worker                             unsigned DestReg, int FrameIndex,
95*9880d681SAndroid Build Coastguard Worker                             const TargetRegisterClass *RC,
96*9880d681SAndroid Build Coastguard Worker                             const TargetRegisterInfo *TRI) const override;
97*9880d681SAndroid Build Coastguard Worker 
98*9880d681SAndroid Build Coastguard Worker   unsigned getGlobalBaseReg(MachineFunction *MF) const;
99*9880d681SAndroid Build Coastguard Worker 
100*9880d681SAndroid Build Coastguard Worker   // Lower pseudo instructions after register allocation.
101*9880d681SAndroid Build Coastguard Worker   bool expandPostRAPseudo(MachineInstr &MI) const override;
102*9880d681SAndroid Build Coastguard Worker };
103*9880d681SAndroid Build Coastguard Worker 
104*9880d681SAndroid Build Coastguard Worker }
105*9880d681SAndroid Build Coastguard Worker 
106*9880d681SAndroid Build Coastguard Worker #endif
107