Jia Liu | 31d157a | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- SPUInstrInfo.h - Cell SPU Instruction Information -------*- C++ -*-===// |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 4ee451d | 2007-12-29 20:36:04 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Scott Michel | 2466c37 | 2007-12-05 01:40:25 +0000 | [diff] [blame] | 10 | // This file contains the CellSPU implementation of the TargetInstrInfo class. |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SPU_INSTRUCTIONINFO_H |
| 15 | #define SPU_INSTRUCTIONINFO_H |
| 16 | |
| 17 | #include "SPU.h" |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 18 | #include "SPURegisterInfo.h" |
Craig Topper | 79aa341 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 19 | #include "llvm/Target/TargetInstrInfo.h" |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 20 | |
Evan Cheng | 4db3cff | 2011-07-01 17:57:27 +0000 | [diff] [blame] | 21 | #define GET_INSTRINFO_HEADER |
| 22 | #include "SPUGenInstrInfo.inc" |
| 23 | |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 24 | namespace llvm { |
| 25 | //! Cell SPU instruction information class |
Evan Cheng | 4db3cff | 2011-07-01 17:57:27 +0000 | [diff] [blame] | 26 | class SPUInstrInfo : public SPUGenInstrInfo { |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 27 | SPUTargetMachine &TM; |
| 28 | const SPURegisterInfo RI; |
| 29 | public: |
Dan Gohman | 950a4c4 | 2008-03-25 22:06:05 +0000 | [diff] [blame] | 30 | explicit SPUInstrInfo(SPUTargetMachine &tm); |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 31 | |
| 32 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 33 | /// such, whenever a client has an instance of instruction info, it should |
| 34 | /// always be able to get register info as well (through this method). |
| 35 | /// |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 36 | virtual const SPURegisterInfo &getRegisterInfo() const { return RI; } |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 37 | |
Andrew Trick | 2da8bc8 | 2010-12-24 05:03:26 +0000 | [diff] [blame] | 38 | ScheduleHazardRecognizer * |
| 39 | CreateTargetHazardRecognizer(const TargetMachine *TM, |
| 40 | const ScheduleDAG *DAG) const; |
| 41 | |
Dan Gohman | cbad42c | 2008-11-18 19:49:32 +0000 | [diff] [blame] | 42 | unsigned isLoadFromStackSlot(const MachineInstr *MI, |
| 43 | int &FrameIndex) const; |
| 44 | unsigned isStoreToStackSlot(const MachineInstr *MI, |
| 45 | int &FrameIndex) const; |
Scott Michel | 52d0001 | 2009-01-03 00:27:53 +0000 | [diff] [blame] | 46 | |
Jakob Stoklund Olesen | 377b7b7 | 2010-07-11 07:31:03 +0000 | [diff] [blame] | 47 | virtual void copyPhysReg(MachineBasicBlock &MBB, |
| 48 | MachineBasicBlock::iterator I, DebugLoc DL, |
| 49 | unsigned DestReg, unsigned SrcReg, |
| 50 | bool KillSrc) const; |
Scott Michel | 52d0001 | 2009-01-03 00:27:53 +0000 | [diff] [blame] | 51 | |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 52 | //! Store a register to a stack slot, based on its register class. |
| 53 | virtual void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 54 | MachineBasicBlock::iterator MBBI, |
| 55 | unsigned SrcReg, bool isKill, int FrameIndex, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 56 | const TargetRegisterClass *RC, |
| 57 | const TargetRegisterInfo *TRI) const; |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 58 | |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 59 | //! Load a register from a stack slot, based on its register class. |
| 60 | virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 61 | MachineBasicBlock::iterator MBBI, |
| 62 | unsigned DestReg, int FrameIndex, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 63 | const TargetRegisterClass *RC, |
| 64 | const TargetRegisterInfo *TRI) const; |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 65 | |
Scott Michel | 52d0001 | 2009-01-03 00:27:53 +0000 | [diff] [blame] | 66 | //! Reverses a branch's condition, returning false on success. |
| 67 | virtual |
| 68 | bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const; |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 69 | |
| 70 | virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, |
Scott Michel | 19c10e6 | 2009-01-26 03:37:41 +0000 | [diff] [blame] | 71 | MachineBasicBlock *&FBB, |
Evan Cheng | dc54d31 | 2009-02-09 07:14:22 +0000 | [diff] [blame] | 72 | SmallVectorImpl<MachineOperand> &Cond, |
| 73 | bool AllowModify) const; |
Scott Michel | 52d0001 | 2009-01-03 00:27:53 +0000 | [diff] [blame] | 74 | |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 75 | virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; |
Scott Michel | 52d0001 | 2009-01-03 00:27:53 +0000 | [diff] [blame] | 76 | |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 77 | virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
Stuart Hastings | 3bf9125 | 2010-06-17 22:43:56 +0000 | [diff] [blame] | 78 | MachineBasicBlock *FBB, |
| 79 | const SmallVectorImpl<MachineOperand> &Cond, |
| 80 | DebugLoc DL) const; |
Scott Michel | aedc637 | 2008-12-10 00:15:19 +0000 | [diff] [blame] | 81 | }; |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | #endif |