SystemZRegisterInfo.h revision 1d09d56fe1e3f3faadd4bf4ccf3e585ddb3c3b07
1//===-- SystemZRegisterInfo.h - SystemZ register 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#ifndef SystemZREGISTERINFO_H
11#define SystemZREGISTERINFO_H
12
13#include "SystemZ.h"
14#include "llvm/Target/TargetRegisterInfo.h"
15
16#define GET_REGINFO_HEADER
17#include "SystemZGenRegisterInfo.inc"
18
19namespace llvm {
20
21namespace SystemZ {
22  // Return the subreg to use for referring to the even and odd registers
23  // in a GR128 pair.  Is32Bit says whether we want a GR32 or GR64.
24  inline unsigned even128(bool Is32bit) {
25    return Is32bit ? subreg_32bit : subreg_high;
26  }
27  inline unsigned odd128(bool Is32bit) {
28    return Is32bit ? subreg_low32 : subreg_low;
29  }
30}
31
32class SystemZSubtarget;
33class SystemZInstrInfo;
34
35struct SystemZRegisterInfo : public SystemZGenRegisterInfo {
36private:
37  SystemZTargetMachine &TM;
38  const SystemZInstrInfo &TII;
39
40public:
41  SystemZRegisterInfo(SystemZTargetMachine &tm, const SystemZInstrInfo &tii);
42
43  // Override TargetRegisterInfo.h.
44  virtual bool requiresRegisterScavenging(const MachineFunction &MF) const
45    LLVM_OVERRIDE {
46    return true;
47  }
48  virtual bool requiresFrameIndexScavenging(const MachineFunction &MF) const
49    LLVM_OVERRIDE {
50    return true;
51  }
52  virtual const uint16_t *getCalleeSavedRegs(const MachineFunction *MF = 0)
53    const LLVM_OVERRIDE;
54  virtual BitVector getReservedRegs(const MachineFunction &MF)
55    const LLVM_OVERRIDE;
56  virtual bool saveScavengerRegister(MachineBasicBlock &MBB,
57                                     MachineBasicBlock::iterator SaveMBBI,
58                                     MachineBasicBlock::iterator &UseMBBI,
59                                     const TargetRegisterClass *RC,
60                                     unsigned Reg) const LLVM_OVERRIDE;
61  virtual void eliminateFrameIndex(MachineBasicBlock::iterator MI,
62                                   int SPAdj, unsigned FIOperandNum,
63                                   RegScavenger *RS) const LLVM_OVERRIDE;
64  virtual unsigned getFrameRegister(const MachineFunction &MF) const
65    LLVM_OVERRIDE;
66};
67
68} // end namespace llvm
69
70#endif
71