Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 1 | //===- MipsRegisterInfo.h - Mips Register Information Impl ------*- C++ -*-===// |
| 2 | // |
| 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. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains the Mips implementation of the MRegisterInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef MIPSREGISTERINFO_H |
| 15 | #define MIPSREGISTERINFO_H |
| 16 | |
| 17 | #include "llvm/Target/MRegisterInfo.h" |
| 18 | #include "MipsGenRegisterInfo.h.inc" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | class TargetInstrInfo; |
| 23 | class Type; |
| 24 | |
| 25 | struct MipsRegisterInfo : public MipsGenRegisterInfo { |
| 26 | const TargetInstrInfo &TII; |
| 27 | |
| 28 | MipsRegisterInfo(const TargetInstrInfo &tii); |
| 29 | |
Bruno Cardoso Lopes | 51195af | 2007-08-28 05:13:42 +0000 | [diff] [blame] | 30 | /// getRegisterNumbering - Given the enum value for some register, e.g. |
| 31 | /// Mips::RA, return the number that it corresponds to (e.g. 31). |
| 32 | static unsigned getRegisterNumbering(unsigned RegEnum); |
| 33 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 34 | /// Code Generation virtual methods... |
| 35 | void storeRegToStackSlot(MachineBasicBlock &MBB, |
| 36 | MachineBasicBlock::iterator MBBI, |
Evan Cheng | d64b5c8 | 2007-12-05 03:14:33 +0000 | [diff] [blame] | 37 | unsigned SrcReg, bool isKill, int FrameIndex, |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 38 | const TargetRegisterClass *RC) const; |
| 39 | |
Evan Cheng | d64b5c8 | 2007-12-05 03:14:33 +0000 | [diff] [blame] | 40 | void storeRegToAddr(MachineFunction &MF, unsigned SrcReg, bool isKill, |
Evan Cheng | f0a0cdd | 2007-10-18 22:40:57 +0000 | [diff] [blame] | 41 | SmallVectorImpl<MachineOperand> &Addr, |
Evan Cheng | 66f0f64 | 2007-10-05 01:32:41 +0000 | [diff] [blame] | 42 | const TargetRegisterClass *RC, |
Evan Cheng | 58184e6 | 2007-10-18 21:29:24 +0000 | [diff] [blame] | 43 | SmallVectorImpl<MachineInstr*> &NewMIs) const; |
Evan Cheng | 66f0f64 | 2007-10-05 01:32:41 +0000 | [diff] [blame] | 44 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 45 | void loadRegFromStackSlot(MachineBasicBlock &MBB, |
| 46 | MachineBasicBlock::iterator MBBI, |
| 47 | unsigned DestReg, int FrameIndex, |
| 48 | const TargetRegisterClass *RC) const; |
| 49 | |
Evan Cheng | 66f0f64 | 2007-10-05 01:32:41 +0000 | [diff] [blame] | 50 | void loadRegFromAddr(MachineFunction &MF, unsigned DestReg, |
Evan Cheng | f0a0cdd | 2007-10-18 22:40:57 +0000 | [diff] [blame] | 51 | SmallVectorImpl<MachineOperand> &Addr, |
Evan Cheng | 66f0f64 | 2007-10-05 01:32:41 +0000 | [diff] [blame] | 52 | const TargetRegisterClass *RC, |
Evan Cheng | 58184e6 | 2007-10-18 21:29:24 +0000 | [diff] [blame] | 53 | SmallVectorImpl<MachineInstr*> &NewMIs) const; |
Evan Cheng | 66f0f64 | 2007-10-05 01:32:41 +0000 | [diff] [blame] | 54 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 55 | void reMaterialize(MachineBasicBlock &MBB, MachineBasicBlock::iterator MI, |
| 56 | unsigned DestReg, const MachineInstr *Orig) const; |
| 57 | |
Evan Cheng | aee4af6 | 2007-12-02 08:30:39 +0000 | [diff] [blame] | 58 | MachineInstr* foldMemoryOperand(MachineInstr* MI, |
| 59 | SmallVectorImpl<unsigned> &Ops, |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 60 | int FrameIndex) const; |
| 61 | |
Evan Cheng | e62f97c | 2007-12-01 02:07:52 +0000 | [diff] [blame] | 62 | MachineInstr* foldMemoryOperand(MachineInstr* MI, |
Evan Cheng | aee4af6 | 2007-12-02 08:30:39 +0000 | [diff] [blame] | 63 | SmallVectorImpl<unsigned> &Ops, |
Evan Cheng | e62f97c | 2007-12-01 02:07:52 +0000 | [diff] [blame] | 64 | MachineInstr* LoadMI) const { |
| 65 | return 0; |
| 66 | } |
Evan Cheng | 35b35c5 | 2007-08-30 05:52:20 +0000 | [diff] [blame] | 67 | |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 68 | void copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator MBBI, |
| 69 | unsigned DestReg, unsigned SrcReg, |
Evan Cheng | 9efce63 | 2007-09-26 06:25:56 +0000 | [diff] [blame] | 70 | const TargetRegisterClass *DestRC, |
| 71 | const TargetRegisterClass *SrcRC) const; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 72 | |
| 73 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 74 | const unsigned *getCalleeSavedRegs(const MachineFunction* MF = 0) const; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 75 | |
Evan Cheng | 64d80e3 | 2007-07-19 01:14:50 +0000 | [diff] [blame] | 76 | const TargetRegisterClass* const* |
| 77 | getCalleeSavedRegClasses(const MachineFunction* MF = 0) const; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 78 | |
| 79 | BitVector getReservedRegs(const MachineFunction &MF) const; |
| 80 | |
| 81 | bool hasFP(const MachineFunction &MF) const; |
| 82 | |
| 83 | void eliminateCallFramePseudoInstr(MachineFunction &MF, |
| 84 | MachineBasicBlock &MBB, |
| 85 | MachineBasicBlock::iterator I) const; |
| 86 | |
Bruno Cardoso Lopes | 51195af | 2007-08-28 05:13:42 +0000 | [diff] [blame] | 87 | /// Stack Frame Processing Methods |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 88 | void eliminateFrameIndex(MachineBasicBlock::iterator II, |
| 89 | int SPAdj, RegScavenger *RS = NULL) const; |
| 90 | |
| 91 | void processFunctionBeforeFrameFinalized(MachineFunction &MF) const; |
| 92 | |
| 93 | void emitPrologue(MachineFunction &MF) const; |
| 94 | void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const; |
| 95 | |
Bruno Cardoso Lopes | 51195af | 2007-08-28 05:13:42 +0000 | [diff] [blame] | 96 | /// Debug information queries. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 97 | unsigned getRARegister() const; |
| 98 | unsigned getFrameRegister(MachineFunction &MF) const; |
| 99 | |
Bruno Cardoso Lopes | 51195af | 2007-08-28 05:13:42 +0000 | [diff] [blame] | 100 | /// Exception handling queries. |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 101 | unsigned getEHExceptionRegister() const; |
| 102 | unsigned getEHHandlerRegister() const; |
Anton Korobeynikov | f191c80 | 2007-11-11 19:50:10 +0000 | [diff] [blame] | 103 | |
Dale Johannesen | b97aec6 | 2007-11-13 19:13:01 +0000 | [diff] [blame] | 104 | int getDwarfRegNum(unsigned RegNum, bool isEH) const; |
Bruno Cardoso Lopes | 972f589 | 2007-06-06 07:42:06 +0000 | [diff] [blame] | 105 | }; |
| 106 | |
| 107 | } // end namespace llvm |
| 108 | |
| 109 | #endif |