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 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source 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 | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 34 | class SparcInstrInfo : public TargetInstrInfo { |
| 35 | const SparcRegisterInfo RI; |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 36 | public: |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 37 | SparcInstrInfo(SparcSubtarget &ST); |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 38 | |
| 39 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 40 | /// such, whenever a client has an instance of instruction info, it should |
| 41 | /// always be able to get register info as well (through this method). |
| 42 | /// |
| 43 | virtual const MRegisterInfo &getRegisterInfo() const { return RI; } |
Chris Lattner | 1d6dc97 | 2004-07-25 06:19:04 +0000 | [diff] [blame] | 44 | |
| 45 | /// Return true if the instruction is a register to register move and |
| 46 | /// leave the source and dest operands in the passed parameters. |
| 47 | /// |
| 48 | virtual bool isMoveInstr(const MachineInstr &MI, |
| 49 | unsigned &SrcReg, unsigned &DstReg) const; |
Chris Lattner | 5ccc722 | 2006-02-03 06:44:54 +0000 | [diff] [blame] | 50 | |
| 51 | /// isLoadFromStackSlot - If the specified machine instruction is a direct |
| 52 | /// load from a stack slot, return the virtual or physical register number of |
| 53 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 54 | /// not, return 0. This predicate must return 0 if the instruction has |
| 55 | /// any side effects other than loading from the stack slot. |
| 56 | virtual unsigned isLoadFromStackSlot(MachineInstr *MI, int &FrameIndex) const; |
| 57 | |
| 58 | /// isStoreToStackSlot - If the specified machine instruction is a direct |
| 59 | /// store to a stack slot, return the virtual or physical register number of |
| 60 | /// the source reg along with the FrameIndex of the loaded stack slot. If |
| 61 | /// not, return 0. This predicate must return 0 if the instruction has |
| 62 | /// any side effects other than storing to the stack slot. |
| 63 | virtual unsigned isStoreToStackSlot(MachineInstr *MI, int &FrameIndex) const; |
Chris Lattner | e87146a | 2006-10-24 16:39:19 +0000 | [diff] [blame^] | 64 | |
| 65 | |
| 66 | virtual void InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 67 | MachineBasicBlock *FBB, |
| 68 | const std::vector<MachineOperand> &Cond) const; |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 69 | }; |
| 70 | |
| 71 | } |
| 72 | |
| 73 | #endif |