blob: 96507b104cf494189a6c3a4eef68ec388bba2ead (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
//===-- R600RegisterInfo.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 "R600RegisterInfo.h"
#include "AMDGPUTargetMachine.h"
using namespace llvm;
R600RegisterInfo::R600RegisterInfo(AMDGPUTargetMachine &tm,
const TargetInstrInfo &tii)
: AMDGPURegisterInfo(tm, tii),
TM(tm),
TII(tii)
{ }
BitVector R600RegisterInfo::getReservedRegs(const MachineFunction &MF) const
{
BitVector Reserved(getNumRegs());
Reserved.set(AMDIL::ZERO);
Reserved.set(AMDIL::HALF);
Reserved.set(AMDIL::ONE);
Reserved.set(AMDIL::ONE_INT);
Reserved.set(AMDIL::NEG_HALF);
Reserved.set(AMDIL::NEG_ONE);
Reserved.set(AMDIL::PV_X);
Reserved.set(AMDIL::ALU_LITERAL_X);
for (TargetRegisterClass::iterator I = AMDIL::R600_CReg32RegClass.begin(),
E = AMDIL::R600_CReg32RegClass.end(); I != E; ++I) {
Reserved.set(*I);
}
for (MachineFunction::const_iterator BB = MF.begin(),
BB_E = MF.end(); BB != BB_E; ++BB) {
const MachineBasicBlock &MBB = *BB;
for (MachineBasicBlock::const_iterator I = MBB.begin(), E = MBB.end();
I != E; ++I) {
const MachineInstr &MI = *I;
if (MI.getOpcode() == AMDIL::RESERVE_REG) {
if (!TargetRegisterInfo::isVirtualRegister(MI.getOperand(0).getReg())) {
Reserved.set(MI.getOperand(0).getReg());
}
}
}
}
return Reserved;
}
const TargetRegisterClass *
R600RegisterInfo::getISARegClass(const TargetRegisterClass * rc) const
{
switch (rc->getID()) {
case AMDIL::GPRV4F32RegClassID:
case AMDIL::GPRV4I32RegClassID:
return &AMDIL::R600_Reg128RegClass;
case AMDIL::GPRF32RegClassID:
case AMDIL::GPRI32RegClassID:
return &AMDIL::R600_Reg32RegClass;
default: return rc;
}
}
unsigned R600RegisterInfo::getHWRegIndex(unsigned reg) const
{
switch(reg) {
case AMDIL::ZERO: return 248;
case AMDIL::ONE:
case AMDIL::NEG_ONE: return 249;
case AMDIL::ONE_INT: return 250;
case AMDIL::HALF:
case AMDIL::NEG_HALF: return 252;
case AMDIL::ALU_LITERAL_X: return 253;
default: return getHWRegIndexGen(reg);
}
}
unsigned R600RegisterInfo::getHWRegChan(unsigned reg) const
{
switch(reg) {
case AMDIL::ZERO:
case AMDIL::ONE:
case AMDIL::ONE_INT:
case AMDIL::NEG_ONE:
case AMDIL::HALF:
case AMDIL::NEG_HALF:
case AMDIL::ALU_LITERAL_X:
return 0;
default: return getHWRegChanGen(reg);
}
}
#include "R600HwRegInfo.include"
|