LLVM API Documentation
00001 //===-- AMDGPURegisterInfo.cpp - AMDGPU Register Information -------------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 /// \file 00011 /// \brief Parent TargetRegisterInfo class common to all hw codegen targets. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #include "AMDGPURegisterInfo.h" 00016 #include "AMDGPUTargetMachine.h" 00017 00018 using namespace llvm; 00019 00020 AMDGPURegisterInfo::AMDGPURegisterInfo(const AMDGPUSubtarget &st) 00021 : AMDGPUGenRegisterInfo(0), 00022 ST(st) 00023 { } 00024 00025 //===----------------------------------------------------------------------===// 00026 // Function handling callbacks - Functions are a seldom used feature of GPUS, so 00027 // they are not supported at this time. 00028 //===----------------------------------------------------------------------===// 00029 00030 const MCPhysReg AMDGPURegisterInfo::CalleeSavedReg = AMDGPU::NoRegister; 00031 00032 const MCPhysReg* 00033 AMDGPURegisterInfo::getCalleeSavedRegs(const MachineFunction *MF) const { 00034 return &CalleeSavedReg; 00035 } 00036 00037 void AMDGPURegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI, 00038 int SPAdj, 00039 unsigned FIOperandNum, 00040 RegScavenger *RS) const { 00041 llvm_unreachable("Subroutines not supported yet"); 00042 } 00043 00044 unsigned AMDGPURegisterInfo::getFrameRegister(const MachineFunction &MF) const { 00045 assert(!"Subroutines not supported yet"); 00046 return 0; 00047 } 00048 00049 unsigned AMDGPURegisterInfo::getSubRegFromChannel(unsigned Channel) const { 00050 static const unsigned SubRegs[] = { 00051 AMDGPU::sub0, AMDGPU::sub1, AMDGPU::sub2, AMDGPU::sub3, AMDGPU::sub4, 00052 AMDGPU::sub5, AMDGPU::sub6, AMDGPU::sub7, AMDGPU::sub8, AMDGPU::sub9, 00053 AMDGPU::sub10, AMDGPU::sub11, AMDGPU::sub12, AMDGPU::sub13, AMDGPU::sub14, 00054 AMDGPU::sub15 00055 }; 00056 00057 assert(Channel < array_lengthof(SubRegs)); 00058 return SubRegs[Channel]; 00059 } 00060 00061 unsigned AMDGPURegisterInfo::getIndirectSubReg(unsigned IndirectIndex) const { 00062 00063 return getSubRegFromChannel(IndirectIndex); 00064 } 00065 00066 #define GET_REGINFO_TARGET_DESC 00067 #include "AMDGPUGenRegisterInfo.inc"