Jia Liu | b22310f | 2012-02-18 12:03:15 +0000 | [diff] [blame] | 1 | //===-- SparcInstrInfo.h - Sparc Instruction Information --------*- C++ -*-===// |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | f3ebc3f | 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. |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the Sparc implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SPARCINSTRUCTIONINFO_H |
| 15 | #define SPARCINSTRUCTIONINFO_H |
| 16 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 17 | #include "SparcRegisterInfo.h" |
Craig Topper | b25fda9 | 2012-03-17 18:46:09 +0000 | [diff] [blame] | 18 | #include "llvm/Target/TargetInstrInfo.h" |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 19 | |
Evan Cheng | 703a0fb | 2011-07-01 17:57:27 +0000 | [diff] [blame] | 20 | #define GET_INSTRINFO_HEADER |
| 21 | #include "SparcGenInstrInfo.inc" |
| 22 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 23 | namespace llvm { |
| 24 | |
| 25 | /// SPII - This namespace holds all of the target specific flags that |
| 26 | /// instruction info tracks. |
| 27 | /// |
| 28 | namespace SPII { |
| 29 | enum { |
| 30 | Pseudo = (1<<0), |
| 31 | Load = (1<<1), |
| 32 | Store = (1<<2), |
| 33 | DelaySlot = (1<<3) |
| 34 | }; |
Chris Lattner | aa237256 | 2006-05-24 17:04:05 +0000 | [diff] [blame] | 35 | } |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 36 | |
Evan Cheng | 703a0fb | 2011-07-01 17:57:27 +0000 | [diff] [blame] | 37 | class SparcInstrInfo : public SparcGenInstrInfo { |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 38 | const SparcRegisterInfo RI; |
Owen Anderson | 7a73ae9 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 39 | const SparcSubtarget& Subtarget; |
Juergen Ributzka | d12ccbd | 2013-11-19 00:57:56 +0000 | [diff] [blame] | 40 | virtual void anchor(); |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 41 | public: |
Dan Gohman | c60c67f | 2008-03-25 22:06:05 +0000 | [diff] [blame] | 42 | explicit SparcInstrInfo(SparcSubtarget &ST); |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 43 | |
| 44 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 45 | /// such, whenever a client has an instance of instruction info, it should |
| 46 | /// always be able to get register info as well (through this method). |
| 47 | /// |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 48 | const SparcRegisterInfo &getRegisterInfo() const { return RI; } |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 49 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 50 | /// isLoadFromStackSlot - If the specified machine instruction is a direct |
| 51 | /// load from a stack slot, return the virtual or physical register number of |
| 52 | /// the destination along with the FrameIndex of the loaded stack slot. If |
| 53 | /// not, return 0. This predicate must return 0 if the instruction has |
| 54 | /// any side effects other than loading from the stack slot. |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 55 | unsigned isLoadFromStackSlot(const MachineInstr *MI, |
| 56 | int &FrameIndex) const override; |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 57 | |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 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. |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 63 | unsigned isStoreToStackSlot(const MachineInstr *MI, |
| 64 | int &FrameIndex) const override; |
Venkatraman Govindaraju | 1b0e2cb | 2011-01-16 03:15:11 +0000 | [diff] [blame] | 65 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 66 | bool AnalyzeBranch(MachineBasicBlock &MBB, MachineBasicBlock *&TBB, |
| 67 | MachineBasicBlock *&FBB, |
| 68 | SmallVectorImpl<MachineOperand> &Cond, |
| 69 | bool AllowModify = false) const override ; |
Venkatraman Govindaraju | 1b0e2cb | 2011-01-16 03:15:11 +0000 | [diff] [blame] | 70 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 71 | unsigned RemoveBranch(MachineBasicBlock &MBB) const override; |
Venkatraman Govindaraju | 1b0e2cb | 2011-01-16 03:15:11 +0000 | [diff] [blame] | 72 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 73 | unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 74 | MachineBasicBlock *FBB, |
| 75 | const SmallVectorImpl<MachineOperand> &Cond, |
| 76 | DebugLoc DL) const override; |
Owen Anderson | 7a73ae9 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 77 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 78 | void copyPhysReg(MachineBasicBlock &MBB, |
| 79 | MachineBasicBlock::iterator I, DebugLoc DL, |
| 80 | unsigned DestReg, unsigned SrcReg, |
| 81 | bool KillSrc) const override; |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 82 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 83 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 84 | MachineBasicBlock::iterator MBBI, |
| 85 | unsigned SrcReg, bool isKill, int FrameIndex, |
| 86 | const TargetRegisterClass *RC, |
| 87 | const TargetRegisterInfo *TRI) const override; |
Owen Anderson | eee1460 | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 88 | |
Craig Topper | b0c941b | 2014-04-29 07:57:13 +0000 | [diff] [blame] | 89 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 90 | MachineBasicBlock::iterator MBBI, |
| 91 | unsigned DestReg, int FrameIndex, |
| 92 | const TargetRegisterClass *RC, |
| 93 | const TargetRegisterInfo *TRI) const override; |
Venkatraman Govindaraju | a54533ed | 2013-06-04 18:33:25 +0000 | [diff] [blame] | 94 | |
Chris Lattner | 840c700 | 2009-09-15 17:46:24 +0000 | [diff] [blame] | 95 | unsigned getGlobalBaseReg(MachineFunction *MF) const; |
Chris Lattner | 158e1f5 | 2006-02-05 05:50:24 +0000 | [diff] [blame] | 96 | }; |
| 97 | |
| 98 | } |
| 99 | |
| 100 | #endif |