Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 1 | //===- SparcInstrInfo.h - Sparc Instruction Information ---------*- C++ -*-===// |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 2 | // |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 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. |
Misha Brukman | b5f662f | 2005-04-21 23:30:14 +0000 | [diff] [blame] | 7 | // |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 10 | // This file contains the Sparc implementation of the TargetInstrInfo class. |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 14 | #ifndef SPARCINSTRUCTIONINFO_H |
| 15 | #define SPARCINSTRUCTIONINFO_H |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 16 | |
| 17 | #include "llvm/Target/TargetInstrInfo.h" |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 18 | #include "SparcRegisterInfo.h" |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 19 | |
| 20 | namespace llvm { |
| 21 | |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 22 | /// SPII - This namespace holds all of the target specific flags that |
Brian Gaeke | 7d7ac63 | 2004-07-16 10:31:59 +0000 | [diff] [blame] | 23 | /// instruction info tracks. |
| 24 | /// |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 25 | namespace SPII { |
Brian Gaeke | 7d7ac63 | 2004-07-16 10:31:59 +0000 | [diff] [blame] | 26 | enum { |
| 27 | Pseudo = (1<<0), |
| 28 | Load = (1<<1), |
| 29 | Store = (1<<2), |
| 30 | DelaySlot = (1<<3) |
| 31 | }; |
Chris Lattner | d74ea2b | 2006-05-24 17:04:05 +0000 | [diff] [blame] | 32 | } |
Brian Gaeke | 7d7ac63 | 2004-07-16 10:31:59 +0000 | [diff] [blame] | 33 | |
Chris Lattner | 6410552 | 2008-01-01 01:03:04 +0000 | [diff] [blame] | 34 | class SparcInstrInfo : public TargetInstrInfoImpl { |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 35 | const SparcRegisterInfo RI; |
Owen Anderson | d10fd97 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 36 | const SparcSubtarget& Subtarget; |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 37 | public: |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 38 | SparcInstrInfo(SparcSubtarget &ST); |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 39 | |
| 40 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 41 | /// such, whenever a client has an instance of instruction info, it should |
| 42 | /// always be able to get register info as well (through this method). |
| 43 | /// |
| 44 | virtual const MRegisterInfo &getRegisterInfo() const { return RI; } |
Chris Lattner | 1d6dc97 | 2004-07-25 06:19:04 +0000 | [diff] [blame] | 45 | |
| 46 | /// Return true if the instruction is a register to register move and |
| 47 | /// leave the source and dest operands in the passed parameters. |
| 48 | /// |
| 49 | virtual bool isMoveInstr(const MachineInstr &MI, |
| 50 | unsigned &SrcReg, unsigned &DstReg) const; |
Chris Lattner | 5ccc722 | 2006-02-03 06:44:54 +0000 | [diff] [blame] | 51 | |
| 52 | /// isLoadFromStackSlot - If the specified machine instruction is a direct |
| 53 | /// load from a stack slot, return the virtual or physical register number of |
| 54 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 55 | /// not, return 0. This predicate must return 0 if the instruction has |
| 56 | /// any side effects other than loading from the stack slot. |
| 57 | virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; |
| 58 | |
| 59 | /// isStoreToStackSlot - If the specified machine instruction is a direct |
| 60 | /// store to a stack slot, return the virtual or physical register number of |
| 61 | /// the source reg along with the FrameIndex of the loaded stack slot. If |
| 62 | /// not, return 0. This predicate must return 0 if the instruction has |
| 63 | /// any side effects other than storing to the stack slot. |
| 64 | virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; |
Chris Lattner | e87146a | 2006-10-24 16:39:19 +0000 | [diff] [blame] | 65 | |
| 66 | |
Evan Cheng | 6ae3626 | 2007-05-18 00:18:17 +0000 | [diff] [blame] | 67 | virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 68 | MachineBasicBlock *FBB, |
| 69 | const std::vector<MachineOperand> &Cond) const; |
Owen Anderson | d10fd97 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 70 | |
| 71 | virtual void copyRegToReg(MachineBasicBlock &MBB, |
| 72 | MachineBasicBlock::iterator I, |
| 73 | unsigned DestReg, unsigned SrcReg, |
| 74 | const TargetRegisterClass *DestRC, |
| 75 | const TargetRegisterClass *SrcRC) const; |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | } |
| 79 | |
| 80 | #endif |