Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 1 | //===- AlphaInstrInfo.h - Alpha Instruction Information ---------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 081ce94 | 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. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the Alpha implementation of the TargetInstrInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef ALPHAINSTRUCTIONINFO_H |
| 15 | #define ALPHAINSTRUCTIONINFO_H |
| 16 | |
| 17 | #include "llvm/Target/TargetInstrInfo.h" |
| 18 | #include "AlphaRegisterInfo.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
Chris Lattner | d2fd6db | 2008-01-01 01:03:04 +0000 | [diff] [blame] | 22 | class AlphaInstrInfo : public TargetInstrInfoImpl { |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 23 | const AlphaRegisterInfo RI; |
| 24 | public: |
| 25 | AlphaInstrInfo(); |
| 26 | |
| 27 | /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As |
| 28 | /// such, whenever a client has an instance of instruction info, it should |
| 29 | /// always be able to get register info as well (through this method). |
| 30 | /// |
Dan Gohman | b41dfba | 2008-05-14 01:58:56 +0000 | [diff] [blame] | 31 | virtual const AlphaRegisterInfo &getRegisterInfo() const { return RI; } |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 32 | |
Evan Cheng | f97496a | 2009-01-20 19:12:24 +0000 | [diff] [blame] | 33 | /// Return true if the instruction is a register to register move and return |
| 34 | /// the source and dest operands and their sub-register indices by reference. |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 35 | virtual bool isMoveInstr(const MachineInstr &MI, |
Evan Cheng | f97496a | 2009-01-20 19:12:24 +0000 | [diff] [blame] | 36 | unsigned &SrcReg, unsigned &DstReg, |
| 37 | unsigned &SrcSubIdx, unsigned &DstSubIdx) const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 38 | |
Dan Gohman | 90feee2 | 2008-11-18 19:49:32 +0000 | [diff] [blame] | 39 | virtual unsigned isLoadFromStackSlot(const MachineInstr *MI, |
| 40 | int &FrameIndex) const; |
| 41 | virtual unsigned isStoreToStackSlot(const MachineInstr *MI, |
| 42 | int &FrameIndex) const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 43 | |
| 44 | virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB, |
| 45 | MachineBasicBlock *FBB, |
Owen Anderson | d131b5b | 2008-08-14 22:49:33 +0000 | [diff] [blame] | 46 | const SmallVectorImpl<MachineOperand> &Cond) const; |
Owen Anderson | 9fa72d9 | 2008-08-26 18:03:31 +0000 | [diff] [blame] | 47 | virtual bool copyRegToReg(MachineBasicBlock &MBB, |
Owen Anderson | 8f2c893 | 2007-12-31 06:32:00 +0000 | [diff] [blame] | 48 | MachineBasicBlock::iterator MI, |
| 49 | unsigned DestReg, unsigned SrcReg, |
| 50 | const TargetRegisterClass *DestRC, |
| 51 | const TargetRegisterClass *SrcRC) const; |
Owen Anderson | 8187543 | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 52 | virtual void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 53 | MachineBasicBlock::iterator MBBI, |
| 54 | unsigned SrcReg, bool isKill, int FrameIndex, |
| 55 | const TargetRegisterClass *RC) const; |
| 56 | |
Owen Anderson | 8187543 | 2008-01-01 21:11:32 +0000 | [diff] [blame] | 57 | virtual void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 58 | MachineBasicBlock::iterator MBBI, |
| 59 | unsigned DestReg, int FrameIndex, |
| 60 | const TargetRegisterClass *RC) const; |
Owen Anderson | 9a184ef | 2008-01-07 01:35:02 +0000 | [diff] [blame] | 61 | |
Dan Gohman | edc83d6 | 2008-12-03 18:43:12 +0000 | [diff] [blame] | 62 | virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, |
| 63 | MachineInstr* MI, |
| 64 | const SmallVectorImpl<unsigned> &Ops, |
| 65 | int FrameIndex) const; |
Owen Anderson | 9a184ef | 2008-01-07 01:35:02 +0000 | [diff] [blame] | 66 | |
Dan Gohman | edc83d6 | 2008-12-03 18:43:12 +0000 | [diff] [blame] | 67 | virtual MachineInstr* foldMemoryOperandImpl(MachineFunction &MF, |
| 68 | MachineInstr* MI, |
| 69 | const SmallVectorImpl<unsigned> &Ops, |
| 70 | MachineInstr* LoadMI) const { |
Owen Anderson | 9a184ef | 2008-01-07 01:35:02 +0000 | [diff] [blame] | 71 | return 0; |
| 72 | } |
| 73 | |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 74 | bool AnalyzeBranch(MachineBasicBlock &MBB,MachineBasicBlock *&TBB, |
| 75 | MachineBasicBlock *&FBB, |
Evan Cheng | eac3164 | 2009-02-09 07:14:22 +0000 | [diff] [blame] | 76 | SmallVectorImpl<MachineOperand> &Cond, |
| 77 | bool AllowModify) const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 78 | unsigned RemoveBranch(MachineBasicBlock &MBB) const; |
| 79 | void insertNoop(MachineBasicBlock &MBB, |
| 80 | MachineBasicBlock::iterator MI) const; |
Dan Gohman | 46b948e | 2008-10-16 01:49:15 +0000 | [diff] [blame] | 81 | bool BlockHasNoFallThrough(const MachineBasicBlock &MBB) const; |
Owen Anderson | d131b5b | 2008-08-14 22:49:33 +0000 | [diff] [blame] | 82 | bool ReverseBranchCondition(SmallVectorImpl<MachineOperand> &Cond) const; |
Dan Gohman | 40653f3 | 2009-06-03 20:30:14 +0000 | [diff] [blame] | 83 | |
| 84 | /// getGlobalBaseReg - Return a virtual register initialized with the |
| 85 | /// the global base register value. Output instructions required to |
| 86 | /// initialize the register in the function entry block, if necessary. |
| 87 | /// |
| 88 | unsigned getGlobalBaseReg(MachineFunction *MF) const; |
| 89 | |
| 90 | /// getGlobalRetAddr - Return a virtual register initialized with the |
| 91 | /// the global return address register value. Output instructions required to |
| 92 | /// initialize the register in the function entry block, if necessary. |
| 93 | /// |
| 94 | unsigned getGlobalRetAddr(MachineFunction *MF) const; |
Dan Gohman | f17a25c | 2007-07-18 16:29:46 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
| 97 | } |
| 98 | |
| 99 | #endif |