1 //===- SystemZInstrInfo.h - SystemZ Instruction Information -------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file contains the SystemZ implementation of the TargetInstrInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_SYSTEMZINSTRINFO_H
15 #define LLVM_TARGET_SYSTEMZINSTRINFO_H
18 #include "SystemZRegisterInfo.h"
19 #include "llvm/ADT/IndexedMap.h"
20 #include "llvm/Target/TargetInstrInfo.h"
24 class SystemZTargetMachine;
26 class SystemZInstrInfo : public TargetInstrInfoImpl {
27 const SystemZRegisterInfo RI;
28 SystemZTargetMachine &TM;
29 IndexedMap<unsigned> RegSpillOffsets;
31 explicit SystemZInstrInfo(SystemZTargetMachine &TM);
33 /// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
34 /// such, whenever a client has an instance of instruction info, it should
35 /// always be able to get register info as well (through this method).
37 virtual const SystemZRegisterInfo &getRegisterInfo() const { return RI; }
39 bool copyRegToReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
40 unsigned DestReg, unsigned SrcReg,
41 const TargetRegisterClass *DestRC,
42 const TargetRegisterClass *SrcRC) const;
44 bool isMoveInstr(const MachineInstr& MI,
45 unsigned &SrcReg, unsigned &DstReg,
46 unsigned &SrcSubIdx, unsigned &DstSubIdx) const;
48 virtual void storeRegToStackSlot(MachineBasicBlock &MBB,
49 MachineBasicBlock::iterator MI,
50 unsigned SrcReg, bool isKill,
52 const TargetRegisterClass *RC) const;
53 virtual void loadRegFromStackSlot(MachineBasicBlock &MBB,
54 MachineBasicBlock::iterator MI,
55 unsigned DestReg, int FrameIdx,
56 const TargetRegisterClass *RC) const;
58 virtual bool spillCalleeSavedRegisters(MachineBasicBlock &MBB,
59 MachineBasicBlock::iterator MI,
60 const std::vector<CalleeSavedInfo> &CSI) const;
61 virtual bool restoreCalleeSavedRegisters(MachineBasicBlock &MBB,
62 MachineBasicBlock::iterator MI,
63 const std::vector<CalleeSavedInfo> &CSI) const;
65 virtual unsigned InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
66 MachineBasicBlock *FBB,
67 const SmallVectorImpl<MachineOperand> &Cond) const;
69 const TargetInstrDesc& getBrCond(SystemZCC::CondCodes CC) const;
70 const TargetInstrDesc& getLongDispOpc(unsigned Opc) const;