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 | |
Evan Cheng | 4db3cff | 2011-07-01 17:57:27 +0000 | [diff] [blame^] | 20 | #define GET_INSTRINFO_HEADER |
| 21 | #include "SparcGenInstrInfo.inc" |
| 22 | |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 23 | namespace llvm { |
| 24 | |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 25 | /// SPII - This namespace holds all of the target specific flags that |
Brian Gaeke | 7d7ac63 | 2004-07-16 10:31:59 +0000 | [diff] [blame] | 26 | /// instruction info tracks. |
| 27 | /// |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 28 | namespace SPII { |
Brian Gaeke | 7d7ac63 | 2004-07-16 10:31:59 +0000 | [diff] [blame] | 29 | enum { |
| 30 | Pseudo = (1<<0), |
| 31 | Load = (1<<1), |
| 32 | Store = (1<<2), |
| 33 | DelaySlot = (1<<3) |
| 34 | }; |
Chris Lattner | d74ea2b | 2006-05-24 17:04:05 +0000 | [diff] [blame] | 35 | } |
Brian Gaeke | 7d7ac63 | 2004-07-16 10:31:59 +0000 | [diff] [blame] | 36 | |
Evan Cheng | 4db3cff | 2011-07-01 17:57:27 +0000 | [diff] [blame^] | 37 | class SparcInstrInfo : public SparcGenInstrInfo { |
Chris Lattner | 7c90f73 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 38 | const SparcRegisterInfo RI; |
Owen Anderson | d10fd97 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 39 | const SparcSubtarget& Subtarget; |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 40 | public: |
Dan Gohman | 950a4c4 | 2008-03-25 22:06:05 +0000 | [diff] [blame] | 41 | explicit SparcInstrInfo(SparcSubtarget &ST); |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 42 | |
| 43 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 44 | /// such, whenever a client has an instance of instruction info, it should |
| 45 | /// always be able to get register info as well (through this method). |
| 46 | /// |
Dan Gohman | c9f5f3f | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 47 | virtual const SparcRegisterInfo &getRegisterInfo() const { return RI; } |
Chris Lattner | 1d6dc97 | 2004-07-25 06:19:04 +0000 | [diff] [blame] | 48 | |
Chris Lattner | 5ccc722 | 2006-02-03 06:44:54 +0000 | [diff] [blame] | 49 | /// isLoadFromStackSlot - If the specified machine instruction is a direct |
| 50 | /// load from a stack slot, return the virtual or physical register number of |
| 51 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 52 | /// not, return 0. This predicate must return 0 if the instruction has |
| 53 | /// any side effects other than loading from the stack slot. |
Dan Gohman | cbad42c | 2008-11-18 19:49:32 +0000 | [diff] [blame] | 54 | virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, |
| 55 | int &FrameIndex) const; |
Chris Lattner | 5ccc722 | 2006-02-03 06:44:54 +0000 | [diff] [blame] | 56 | |
| 57 | /// isStoreToStackSlot - If the specified machine instruction is a direct |
| 58 | /// store to a stack slot, return the virtual or physical register number of |
| 59 | /// the source reg along with the FrameIndex of the loaded stack slot. If |
| 60 | /// not, return 0. This predicate must return 0 if the instruction has |
| 61 | /// any side effects other than storing to the stack slot. |
Dan Gohman | cbad42c | 2008-11-18 19:49:32 +0000 | [diff] [blame] | 62 | virtual unsigned isStoreToStackSlot(const MachineInstr *MI, |
| 63 | int &FrameIndex) const; |
Venkatraman Govindaraju | c1a6283 | 2011-01-16 03:15:11 +0000 | [diff] [blame] | 64 | |
| 65 | |
| 66 | virtual bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, |
| 67 | MachineBasicBlock *&FBB, |
| 68 | SmallVectorImpl<MachineOperand> &Cond, |
| 69 | bool AllowModify = false) const ; |
| 70 | |
| 71 | virtual unsigned RemoveBranch(MachineBasicBlock &MBB) const; |
| 72 | |
Evan Cheng | 6ae3626 | 2007-05-18 00:18:17 +0000 | [diff] [blame] | 73 | virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 74 | MachineBasicBlock *FBB, |
Stuart Hastings | 3bf9125 | 2010-06-17 22:43:56 +0000 | [diff] [blame] | 75 | const SmallVectorImpl<MachineOperand> &Cond, |
| 76 | DebugLoc DL) const; |
Owen Anderson | d10fd97 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 77 | |
Jakob Stoklund Olesen | 8e18a1a | 2010-07-11 07:56:09 +0000 | [diff] [blame] | 78 | virtual void copyPhysReg(MachineBasicBlock &MBB, |
| 79 | MachineBasicBlock::iterator I, DebugLoc DL, |
| 80 | unsigned DestReg, unsigned SrcReg, |
| 81 | bool KillSrc) const; |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 82 | |
| 83 | virtual void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 84 | MachineBasicBlock::iterator MBBI, |
| 85 | unsigned SrcReg, bool isKill, int FrameIndex, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 86 | const TargetRegisterClass *RC, |
| 87 | const TargetRegisterInfo *TRI) const; |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 88 | |
Owen Anderson | f6372aa | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 89 | virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 90 | MachineBasicBlock::iterator MBBI, |
| 91 | unsigned DestReg, int FrameIndex, |
Evan Cheng | 746ad69 | 2010-05-06 19:06:44 +0000 | [diff] [blame] | 92 | const TargetRegisterClass *RC, |
| 93 | const TargetRegisterInfo *TRI) const; |
Owen Anderson | 43dbe05 | 2008-01-07 01:35:02 +0000 | [diff] [blame] | 94 | |
Chris Lattner | db486a6 | 2009-09-15 17:46:24 +0000 | [diff] [blame] | 95 | unsigned getGlobalBaseReg(MachineFunction *MF) const; |
Brian Gaeke | e785e53 | 2004-02-25 19:28:19 +0000 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | } |
| 99 | |
| 100 | #endif |