1 //===- SPUInstrInfo.h - Cell SPU Instruction Information --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the CellSPU implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef SPU_INSTRUCTIONINFO_H
15 #define SPU_INSTRUCTIONINFO_H
18 #include "llvm/Target/TargetInstrInfo.h"
19 #include "SPURegisterInfo.h"
22 //! Cell SPU instruction information class
23 class SPUInstrInfo
: public TargetInstrInfoImpl
{
25 const SPURegisterInfo RI
;
27 explicit SPUInstrInfo(SPUTargetMachine
&tm
);
29 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
30 /// such, whenever a client has an instance of instruction info, it should
31 /// always be able to get register info as well (through this method).
33 virtual const SPURegisterInfo
&getRegisterInfo() const { return RI
; }
35 ScheduleHazardRecognizer
*
36 CreateTargetHazardRecognizer(const TargetMachine
*TM
,
37 const ScheduleDAG
*DAG
) const;
39 unsigned isLoadFromStackSlot(const MachineInstr
*MI
,
40 int &FrameIndex
) const;
41 unsigned isStoreToStackSlot(const MachineInstr
*MI
,
42 int &FrameIndex
) const;
44 virtual void copyPhysReg(MachineBasicBlock
&MBB
,
45 MachineBasicBlock::iterator I
, DebugLoc DL
,
46 unsigned DestReg
, unsigned SrcReg
,
49 //! Store a register to a stack slot, based on its register class.
50 virtual void storeRegToStackSlot(MachineBasicBlock
&MBB
,
51 MachineBasicBlock::iterator MBBI
,
52 unsigned SrcReg
, bool isKill
, int FrameIndex
,
53 const TargetRegisterClass
*RC
,
54 const TargetRegisterInfo
*TRI
) const;
56 //! Load a register from a stack slot, based on its register class.
57 virtual void loadRegFromStackSlot(MachineBasicBlock
&MBB
,
58 MachineBasicBlock::iterator MBBI
,
59 unsigned DestReg
, int FrameIndex
,
60 const TargetRegisterClass
*RC
,
61 const TargetRegisterInfo
*TRI
) const;
63 //! Reverses a branch's condition, returning false on success.
65 bool ReverseBranchCondition(SmallVectorImpl
<MachineOperand
> &Cond
) const;
67 virtual bool AnalyzeBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*&TBB
,
68 MachineBasicBlock
*&FBB
,
69 SmallVectorImpl
<MachineOperand
> &Cond
,
70 bool AllowModify
) const;
72 virtual unsigned RemoveBranch(MachineBasicBlock
&MBB
) const;
74 virtual unsigned InsertBranch(MachineBasicBlock
&MBB
, MachineBasicBlock
*TBB
,
75 MachineBasicBlock
*FBB
,
76 const SmallVectorImpl
<MachineOperand
> &Cond
,