blob: 275ffeeb513d7d10e68b9fb5b5068130022a2890 [file] [log] [blame]
Akira Hatanakab7fa3c92012-07-31 21:49:49 +00001//===-- MipsSEInstrInfo.h - Mips32/64 Instruction Information ---*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file contains the Mips32/64 implementation of the TargetInstrInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef MIPSSEINSTRUCTIONINFO_H
15#define MIPSSEINSTRUCTIONINFO_H
16
17#include "MipsInstrInfo.h"
18#include "MipsAnalyzeImmediate.h"
Akira Hatanakacb37e132012-07-31 23:41:32 +000019#include "MipsSERegisterInfo.h"
Akira Hatanakab7fa3c92012-07-31 21:49:49 +000020
21namespace llvm {
22
23class MipsSEInstrInfo : public MipsInstrInfo {
Akira Hatanakacb37e132012-07-31 23:41:32 +000024 const MipsSERegisterInfo RI;
Akira Hatanakab7fa3c92012-07-31 21:49:49 +000025 bool IsN64;
Akira Hatanakacb37e132012-07-31 23:41:32 +000026
Akira Hatanakab7fa3c92012-07-31 21:49:49 +000027public:
28 explicit MipsSEInstrInfo(MipsTargetMachine &TM);
29
Akira Hatanakacb37e132012-07-31 23:41:32 +000030 virtual const MipsRegisterInfo &getRegisterInfo() const;
31
Akira Hatanakab7fa3c92012-07-31 21:49:49 +000032 /// isLoadFromStackSlot - If the specified machine instruction is a direct
33 /// load from a stack slot, return the virtual or physical register number of
34 /// the destination along with the FrameIndex of the loaded stack slot. If
35 /// not, return 0. This predicate must return 0 if the instruction has
36 /// any side effects other than loading from the stack slot.
37 virtual unsigned isLoadFromStackSlot(const MachineInstr *MI,
38 int &FrameIndex) const;
39
40 /// isStoreToStackSlot - If the specified machine instruction is a direct
41 /// store to a stack slot, return the virtual or physical register number of
42 /// the source reg along with the FrameIndex of the loaded stack slot. If
43 /// not, return 0. This predicate must return 0 if the instruction has
44 /// any side effects other than storing to the stack slot.
45 virtual unsigned isStoreToStackSlot(const MachineInstr *MI,
46 int &FrameIndex) const;
47
48 virtual void copyPhysReg(MachineBasicBlock &MBB,
49 MachineBasicBlock::iterator MI, DebugLoc DL,
50 unsigned DestReg, unsigned SrcReg,
51 bool KillSrc) const;
52
53 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MBBI,
55 unsigned SrcReg, bool isKill, int FrameIndex,
56 const TargetRegisterClass *RC,
57 const TargetRegisterInfo *TRI) const;
58
59 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
60 MachineBasicBlock::iterator MBBI,
61 unsigned DestReg, int FrameIndex,
62 const TargetRegisterClass *RC,
63 const TargetRegisterInfo *TRI) const;
64
65 virtual bool expandPostRAPseudo(MachineBasicBlock::iterator MI) const;
66
67 virtual unsigned GetOppositeBranchOpc(unsigned Opc) const;
68
69private:
70 virtual unsigned GetAnalyzableBrOpc(unsigned Opc) const;
71
72 void ExpandRetRA(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
73 unsigned Opc) const;
74 void ExpandExtractElementF64(MachineBasicBlock &MBB,
75 MachineBasicBlock::iterator I) const;
76 void ExpandBuildPairF64(MachineBasicBlock &MBB,
77 MachineBasicBlock::iterator I) const;
78};
79
80}
81
82#endif