summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeon/SIRegisterInfo.cpp
blob: da2ec36a7733949d0695304a49dc4d173fc00286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//===-- SIRegisterInfo.cpp - TODO: Add brief description -------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// TODO: Add full description
//
//===----------------------------------------------------------------------===//


#include "SIRegisterInfo.h"
#include "AMDGPUTargetMachine.h"
#include "AMDGPUUtil.h"

using namespace llvm;

SIRegisterInfo::SIRegisterInfo(AMDGPUTargetMachine &tm,
    const TargetInstrInfo &tii)
: AMDGPURegisterInfo(tm, tii),
  TM(tm),
  TII(tii)
  { }

BitVector SIRegisterInfo::getReservedRegs(const MachineFunction &MF) const
{
  BitVector Reserved(getNumRegs());
  return Reserved;
}

unsigned SIRegisterInfo::getBinaryCode(unsigned reg) const
{
  switch (reg) {
    case AMDIL::M0: return 124;
    case AMDIL::SREG_LIT_0: return 128;
    default: return getHWRegNum(reg);
  }
}

bool SIRegisterInfo::isBaseRegClass(unsigned regClassID) const
{
  switch (regClassID) {
  default: return true;
  case AMDIL::AllReg_32RegClassID:
  case AMDIL::AllReg_64RegClassID:
    return false;
  }
}

const TargetRegisterClass *
SIRegisterInfo::getISARegClass(const TargetRegisterClass * rc) const
{
  switch (rc->getID()) {
  case AMDIL::GPRF32RegClassID:
    return &AMDIL::VReg_32RegClass;
  case AMDIL::GPRV4F32RegClassID:
  case AMDIL::GPRV4I32RegClassID:
    return &AMDIL::VReg_128RegClass;
  default: return rc;
  }
}

#include "SIRegisterGetHWRegNum.inc"