1fa63f976522bd4faf19249e8c9ac4d3edda498d9Tom Stellard//===-- R600RegisterInfo.h - R600 Register Info Interface ------*- C++ -*--===//
2a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//
3a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//                     The LLVM Compiler Infrastructure
4a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//
5a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard// This file is distributed under the University of Illinois Open Source
6a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard// License. See LICENSE.TXT for details.
7a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//
8a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//===----------------------------------------------------------------------===//
9a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//
10fa63f976522bd4faf19249e8c9ac4d3edda498d9Tom Stellard// Interface definition for R600RegisterInfo
11a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//
12a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard//===----------------------------------------------------------------------===//
13a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
14a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard#ifndef R600REGISTERINFO_H_
15a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard#define R600REGISTERINFO_H_
16a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
17a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard#include "AMDGPUTargetMachine.h"
183a0187b1b53eca3143286a5ae7917cd71117b902Tom Stellard#include "AMDGPURegisterInfo.h"
19a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
20a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellardnamespace llvm {
21a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
22bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellardclass R600TargetMachine;
23bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellardclass TargetInstrInfo;
24a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
25bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellardstruct R600RegisterInfo : public AMDGPURegisterInfo
26bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard{
27bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  AMDGPUTargetMachine &TM;
28bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  const TargetInstrInfo &TII;
29a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
30bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  R600RegisterInfo(AMDGPUTargetMachine &tm, const TargetInstrInfo &tii);
31a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
32bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  virtual BitVector getReservedRegs(const MachineFunction &MF) const;
33bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard
34bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// getISARegClass - rc is an AMDIL reg class.  This function returns the
35bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// R600 reg class that is equivalent to the given AMDIL reg class.
36bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  virtual const TargetRegisterClass * getISARegClass(
37bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard    const TargetRegisterClass * rc) const;
38bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard
39bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// getHWRegIndex - get the HW encoding for a register.
40bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  unsigned getHWRegIndex(unsigned reg) const;
41bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard
42bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// getHWRegChan - get the HW encoding for a register's channel.
43bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  unsigned getHWRegChan(unsigned reg) const;
44a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
45d6c2d3722d795381d3cdf11fe00f63780ad0725aTom Stellard  /// getCFGStructurizerRegClass - get the register class of the specified
46d6c2d3722d795381d3cdf11fe00f63780ad0725aTom Stellard  /// type to use in the CFGStructurizer
47d6c2d3722d795381d3cdf11fe00f63780ad0725aTom Stellard  virtual const TargetRegisterClass * getCFGStructurizerRegClass(MVT VT) const;
48d6c2d3722d795381d3cdf11fe00f63780ad0725aTom Stellard
4905882985757e655f5298af483c881008d45e6249Tom Stellard  /// getSubRegFromChannel - Return the sub reg enum value for the given
5005882985757e655f5298af483c881008d45e6249Tom Stellard  /// Channel (e.g. getSubRegFromChannel(0) -> AMDGPU::sel_x)
5105882985757e655f5298af483c881008d45e6249Tom Stellard  unsigned getSubRegFromChannel(unsigned Channel) const;
5205882985757e655f5298af483c881008d45e6249Tom Stellard
53a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellardprivate:
54bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// getHWRegIndexGen - Generated function returns a register's encoding
55bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  unsigned getHWRegIndexGen(unsigned reg) const;
56bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// getHWRegChanGen - Generated function returns a register's channel
57bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  /// encoding.
58bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard  unsigned getHWRegChanGen(unsigned reg) const;
59bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard};
60bcfc97dbf40c256ed59c2424e0c55b845f0f2569Tom Stellard
61a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard} // End namespace llvm
62a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard
63a75c6163e605f35b14f26930dd9227e4f337ec9eTom Stellard#endif // AMDIDSAREGISTERINFO_H_
64