131d157ae1ac2cd9c787dc3c1d28e64c682803844Jia Liu//===-- MBlazeRegisterInfo.h - MBlaze Register Information Impl -*- C++ -*-===//
2a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//
3a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//                     The LLVM Compiler Infrastructure
4a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//
5a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// This file is distributed under the University of Illinois Open Source
6a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// License. See LICENSE.TXT for details.
7a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//
8a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//===----------------------------------------------------------------------===//
9a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//
10a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// This file contains the MBlaze implementation of the TargetRegisterInfo
11a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck// class.
12a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//
13a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck//===----------------------------------------------------------------------===//
14a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
15a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#ifndef MBLAZEREGISTERINFO_H
16a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#define MBLAZEREGISTERINFO_H
17a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
18a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#include "MBlaze.h"
19a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#include "llvm/Target/TargetRegisterInfo.h"
2073f50d9bc3bd46cc0abeba9bb0d46977ba1aea42Evan Cheng
2173f50d9bc3bd46cc0abeba9bb0d46977ba1aea42Evan Cheng#define GET_REGINFO_HEADER
2273f50d9bc3bd46cc0abeba9bb0d46977ba1aea42Evan Cheng#include "MBlazeGenRegisterInfo.inc"
23a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
24a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Pecknamespace llvm {
25a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckclass MBlazeSubtarget;
26a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckclass TargetInstrInfo;
27a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckclass Type;
28a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
29a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Pecknamespace MBlaze {
300a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck  /// SubregIndex - The index of various sized subregister classes. Note that
310a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck  /// these indices must be kept in sync with the class indices in the
32a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  /// MBlazeRegisterInfo.td file.
33a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  enum SubregIndex {
34a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck    SUBREG_FPEVEN = 1, SUBREG_FPODD = 2
35a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  };
36a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck}
37a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
38a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peckstruct MBlazeRegisterInfo : public MBlazeGenRegisterInfo {
39a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  const MBlazeSubtarget &Subtarget;
40a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  const TargetInstrInfo &TII;
410a67d92938d77b6a8cde6e1676750264b274cebcWesley Peck
42a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  MBlazeRegisterInfo(const MBlazeSubtarget &Subtarget,
43a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck                     const TargetInstrInfo &tii);
44a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
45a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  /// Get PIC indirect call register
46a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  static unsigned getPICCallReg();
47a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
48a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  /// Code Generation virtual methods...
49015f228861ef9b337366f92f637d4e8d624bb006Craig Topper  const uint16_t *getCalleeSavedRegs(const MachineFunction* MF = 0) const;
50a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
51a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  BitVector getReservedRegs(const MachineFunction &MF) const;
52a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
53a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  void eliminateCallFramePseudoInstr(MachineFunction &MF,
54a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck                                     MachineBasicBlock &MBB,
55a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck                                     MachineBasicBlock::iterator I) const;
56a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
57a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  /// Stack Frame Processing Methods
58fcb4a8ead3cd8d9540d5eaa448af5d14a0ee341aJim Grosbach  void eliminateFrameIndex(MachineBasicBlock::iterator II,
59fcb4a8ead3cd8d9540d5eaa448af5d14a0ee341aJim Grosbach                           int SPAdj, RegScavenger *RS = NULL) const;
60a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
61a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  void processFunctionBeforeFrameFinalized(MachineFunction &MF) const;
62a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
63a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  /// Debug information queries.
64a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  unsigned getFrameRegister(const MachineFunction &MF) const;
65a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
66a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  /// Exception handling queries.
67a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  unsigned getEHExceptionRegister() const;
68a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck  unsigned getEHHandlerRegister() const;
69a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck};
70a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
71a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck} // end namespace llvm
72a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck
73a70f28ce7dc85d0075a7d86da5d7987b6e306bc6Wesley Peck#endif
74