mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-22 20:43:44 +02:00
6f27d8c6b3
Summary: MCTargetDesc/AMDGPUMCTargetDesc.h contains enums for all the instuction and register defintions, which are huge so we only want to include them where needed. This will also make it easier if we want to split the R600 and GCN definitions into separate tablegenerated files. I was unable to remove AMDGPUMCTargetDesc.h from SIMachineFunctionInfo.h because it uses some enums from the header to initialize default values for the SIMachineFunction class, so I ended up having to remove includes of SIMachineFunctionInfo.h from headers too. Reviewers: arsenm, nhaehnle Reviewed By: nhaehnle Subscribers: MatzeB, kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, javed.absar, llvm-commits Differential Revision: https://reviews.llvm.org/D46272 llvm-svn: 332930
90 lines
2.8 KiB
C++
90 lines
2.8 KiB
C++
//===-- AMDGPURegisterInfo.cpp - AMDGPU Register Information -------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
/// \file
|
|
/// Parent TargetRegisterInfo class common to all hw codegen targets.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "AMDGPURegisterInfo.h"
|
|
#include "AMDGPUTargetMachine.h"
|
|
#include "SIMachineFunctionInfo.h"
|
|
#include "SIRegisterInfo.h"
|
|
#include "MCTargetDesc/AMDGPUMCTargetDesc.h"
|
|
|
|
using namespace llvm;
|
|
|
|
AMDGPURegisterInfo::AMDGPURegisterInfo() : AMDGPUGenRegisterInfo(0) {}
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
// Function handling callbacks - Functions are a seldom used feature of GPUS, so
|
|
// they are not supported at this time.
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
unsigned AMDGPURegisterInfo::getSubRegFromChannel(unsigned Channel) {
|
|
static const unsigned SubRegs[] = {
|
|
AMDGPU::sub0, AMDGPU::sub1, AMDGPU::sub2, AMDGPU::sub3, AMDGPU::sub4,
|
|
AMDGPU::sub5, AMDGPU::sub6, AMDGPU::sub7, AMDGPU::sub8, AMDGPU::sub9,
|
|
AMDGPU::sub10, AMDGPU::sub11, AMDGPU::sub12, AMDGPU::sub13, AMDGPU::sub14,
|
|
AMDGPU::sub15
|
|
};
|
|
|
|
assert(Channel < array_lengthof(SubRegs));
|
|
return SubRegs[Channel];
|
|
}
|
|
|
|
void AMDGPURegisterInfo::reserveRegisterTuples(BitVector &Reserved, unsigned Reg) const {
|
|
MCRegAliasIterator R(Reg, this, true);
|
|
|
|
for (; R.isValid(); ++R)
|
|
Reserved.set(*R);
|
|
}
|
|
|
|
#define GET_REGINFO_TARGET_DESC
|
|
#include "AMDGPUGenRegisterInfo.inc"
|
|
|
|
// Forced to be here by one .inc
|
|
const MCPhysReg *SIRegisterInfo::getCalleeSavedRegs(
|
|
const MachineFunction *MF) const {
|
|
CallingConv::ID CC = MF->getFunction().getCallingConv();
|
|
switch (CC) {
|
|
case CallingConv::C:
|
|
case CallingConv::Fast:
|
|
case CallingConv::Cold:
|
|
return CSR_AMDGPU_HighRegs_SaveList;
|
|
default: {
|
|
// Dummy to not crash RegisterClassInfo.
|
|
static const MCPhysReg NoCalleeSavedReg = AMDGPU::NoRegister;
|
|
return &NoCalleeSavedReg;
|
|
}
|
|
}
|
|
}
|
|
|
|
const MCPhysReg *
|
|
SIRegisterInfo::getCalleeSavedRegsViaCopy(const MachineFunction *MF) const {
|
|
return nullptr;
|
|
}
|
|
|
|
const uint32_t *SIRegisterInfo::getCallPreservedMask(const MachineFunction &MF,
|
|
CallingConv::ID CC) const {
|
|
switch (CC) {
|
|
case CallingConv::C:
|
|
case CallingConv::Fast:
|
|
case CallingConv::Cold:
|
|
return CSR_AMDGPU_HighRegs_RegMask;
|
|
default:
|
|
return nullptr;
|
|
}
|
|
}
|
|
|
|
unsigned SIRegisterInfo::getFrameRegister(const MachineFunction &MF) const {
|
|
const SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
|
|
return FuncInfo->getFrameOffsetReg();
|
|
}
|