Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 1 | //===- SPUInstrInfo.h - Cell SPU Instruction Information --------*- C++ -*-===// |
| 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" |
| 18 | #include "llvm/Target/TargetInstrInfo.h" |
| 19 | #include "SPURegisterInfo.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | //! Cell SPU instruction information class |
Chris Lattner | 6410552 | 2008-01-01 01:03:04 +0000 | [diff] [blame] | 23 | class SPUInstrInfo : public TargetInstrInfoImpl { |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 24 | SPUTargetMachine &TM; |
| 25 | const SPURegisterInfo RI; |
| 26 | public: |
| 27 | SPUInstrInfo(SPUTargetMachine &tm); |
| 28 | |
| 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). |
| 32 | /// |
| 33 | virtual const MRegisterInfo &getRegisterInfo() const { return RI; } |
| 34 | |
| 35 | /// getPointerRegClass - Return the register class to use to hold pointers. |
| 36 | /// This is used for addressing modes. |
| 37 | virtual const TargetRegisterClass *getPointerRegClass() const; |
| 38 | |
| 39 | // Return true if the instruction is a register to register move and |
| 40 | // leave the source and dest operands in the passed parameters. |
| 41 | // |
| 42 | virtual bool isMoveInstr(const MachineInstr& MI, |
| 43 | unsigned& sourceReg, |
| 44 | unsigned& destReg) const; |
| 45 | |
| 46 | unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; |
| 47 | unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; |
Owen Anderson | d10fd97 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 48 | |
| 49 | virtual void copyRegToReg(MachineBasicBlock &MBB, |
| 50 | MachineBasicBlock::iterator MI, |
| 51 | unsigned DestReg, unsigned SrcReg, |
| 52 | const TargetRegisterClass *DestRC, |
| 53 | const TargetRegisterClass *SrcRC) const; |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame^] | 54 | |
| 55 | //! Store a register to a stack slot, based on its register class. |
| 56 | virtual void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 57 | MachineBasicBlock::iterator MBBI, |
| 58 | unsigned SrcReg, bool isKill, int FrameIndex, |
| 59 | const TargetRegisterClass *RC) const; |
| 60 | |
| 61 | //! Store a register to an address, based on its register class |
| 62 | virtual void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, |
| 63 | SmallVectorImpl<MachineOperand> &Addr, |
| 64 | const TargetRegisterClass *RC, |
| 65 | SmallVectorImpl<MachineInstr*> &NewMIs) const; |
| 66 | |
| 67 | //! Load a register from a stack slot, based on its register class. |
| 68 | virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 69 | MachineBasicBlock::iterator MBBI, |
| 70 | unsigned DestReg, int FrameIndex, |
| 71 | const TargetRegisterClass *RC) const; |
| 72 | |
| 73 | //! Loqad a register from an address, based on its register class |
| 74 | virtual void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, |
| 75 | SmallVectorImpl<MachineOperand> &Addr, |
| 76 | const TargetRegisterClass *RC, |
| 77 | SmallVectorImpl<MachineInstr*> &NewMIs) const; |
Scott Michel | 6637752 | 2007-12-04 22:35:58 +0000 | [diff] [blame] | 78 | }; |
| 79 | } |
| 80 | |
| 81 | #endif |