2012-12-11 21:25:42 +00:00
|
|
|
//===-- SIRegisterInfo.cpp - SI Register Information ---------------------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
/// \file
|
|
|
|
/// \brief SI implementation of the TargetRegisterInfo class.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
|
|
|
|
#include "SIRegisterInfo.h"
|
|
|
|
#include "AMDGPUTargetMachine.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2013-06-07 20:28:55 +00:00
|
|
|
SIRegisterInfo::SIRegisterInfo(AMDGPUTargetMachine &tm)
|
|
|
|
: AMDGPURegisterInfo(tm),
|
|
|
|
TM(tm)
|
2012-12-11 21:25:42 +00:00
|
|
|
{ }
|
|
|
|
|
|
|
|
BitVector SIRegisterInfo::getReservedRegs(const MachineFunction &MF) const {
|
|
|
|
BitVector Reserved(getNumRegs());
|
|
|
|
return Reserved;
|
|
|
|
}
|
|
|
|
|
2013-03-26 14:04:02 +00:00
|
|
|
unsigned SIRegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC,
|
|
|
|
MachineFunction &MF) const {
|
|
|
|
return RC->getNumRegs();
|
|
|
|
}
|
|
|
|
|
2012-12-11 21:25:42 +00:00
|
|
|
const TargetRegisterClass *
|
|
|
|
SIRegisterInfo::getISARegClass(const TargetRegisterClass * rc) const {
|
|
|
|
switch (rc->getID()) {
|
|
|
|
case AMDGPU::GPRF32RegClassID:
|
|
|
|
return &AMDGPU::VReg_32RegClass;
|
|
|
|
default: return rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const TargetRegisterClass * SIRegisterInfo::getCFGStructurizerRegClass(
|
|
|
|
MVT VT) const {
|
|
|
|
switch(VT.SimpleTy) {
|
|
|
|
default:
|
|
|
|
case MVT::i32: return &AMDGPU::VReg_32RegClass;
|
|
|
|
}
|
|
|
|
}
|
2013-08-06 23:08:18 +00:00
|
|
|
|
|
|
|
const TargetRegisterClass *SIRegisterInfo::getPhysRegClass(unsigned Reg) const {
|
|
|
|
assert(!TargetRegisterInfo::isVirtualRegister(Reg));
|
|
|
|
|
|
|
|
const TargetRegisterClass *BaseClasses[] = {
|
|
|
|
&AMDGPU::VReg_32RegClass,
|
|
|
|
&AMDGPU::SReg_32RegClass,
|
|
|
|
&AMDGPU::VReg_64RegClass,
|
|
|
|
&AMDGPU::SReg_64RegClass,
|
|
|
|
&AMDGPU::SReg_128RegClass,
|
|
|
|
&AMDGPU::SReg_256RegClass
|
|
|
|
};
|
|
|
|
|
|
|
|
for (unsigned i = 0, e = sizeof(BaseClasses) /
|
|
|
|
sizeof(const TargetRegisterClass*); i != e; ++i) {
|
|
|
|
if (BaseClasses[i]->contains(Reg)) {
|
|
|
|
return BaseClasses[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2013-08-14 23:24:24 +00:00
|
|
|
|
|
|
|
bool SIRegisterInfo::isSGPRClass(const TargetRegisterClass *RC) const {
|
|
|
|
if (!RC) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return RC == &AMDGPU::SReg_32RegClass ||
|
|
|
|
RC == &AMDGPU::SReg_64RegClass ||
|
|
|
|
RC == &AMDGPU::SReg_128RegClass ||
|
|
|
|
RC == &AMDGPU::SReg_256RegClass ||
|
|
|
|
RC == &AMDGPU::SReg_512RegClass;
|
|
|
|
}
|