LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AMDGPURegisterInfo.cpp
Go to the documentation of this file.
1 //===-- AMDGPURegisterInfo.cpp - AMDGPU Register Information -------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file
11 /// \brief Parent TargetRegisterInfo class common to all hw codegen targets.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "AMDGPURegisterInfo.h"
16 #include "AMDGPUTargetMachine.h"
17 
18 using namespace llvm;
19 
22  TM(tm)
23  { }
24 
25 //===----------------------------------------------------------------------===//
26 // Function handling callbacks - Functions are a seldom used feature of GPUS, so
27 // they are not supported at this time.
28 //===----------------------------------------------------------------------===//
29 
30 const uint16_t AMDGPURegisterInfo::CalleeSavedReg = AMDGPU::NoRegister;
31 
33  const {
34  return &CalleeSavedReg;
35 }
36 
38  int SPAdj,
39  unsigned FIOperandNum,
40  RegScavenger *RS) const {
41  assert(!"Subroutines not supported yet");
42 }
43 
45  assert(!"Subroutines not supported yet");
46  return 0;
47 }
48 
49 unsigned AMDGPURegisterInfo::getSubRegFromChannel(unsigned Channel) const {
50  static const unsigned SubRegs[] = {
51  AMDGPU::sub0, AMDGPU::sub1, AMDGPU::sub2, AMDGPU::sub3, AMDGPU::sub4,
52  AMDGPU::sub5, AMDGPU::sub6, AMDGPU::sub7, AMDGPU::sub8, AMDGPU::sub9,
53  AMDGPU::sub10, AMDGPU::sub11, AMDGPU::sub12, AMDGPU::sub13, AMDGPU::sub14,
54  AMDGPU::sub15
55  };
56 
57  assert (Channel < array_lengthof(SubRegs));
58  return SubRegs[Channel];
59 }
60 
61 unsigned AMDGPURegisterInfo::getIndirectSubReg(unsigned IndirectIndex) const {
62 
63  return getSubRegFromChannel(IndirectIndex);
64 }
65 
66 #define GET_REGINFO_TARGET_DESC
67 #include "AMDGPUGenRegisterInfo.inc"
unsigned getIndirectSubReg(unsigned IndirectIndex) const
const uint16_t * getCalleeSavedRegs(const MachineFunction *MF) const
TargetRegisterInfo interface that is implemented by all hw codegen targets.
size_t array_lengthof(T(&)[N])
Find the length of an array.
Definition: STLExtras.h:250
bundle_iterator< MachineInstr, instr_iterator > iterator
unsigned getSubRegFromChannel(unsigned Channel) const
The AMDGPU TargetMachine interface definition for hw codgen targets.
static const uint16_t CalleeSavedReg
unsigned getFrameRegister(const MachineFunction &MF) const
AMDGPURegisterInfo(TargetMachine &tm)
void eliminateFrameIndex(MachineBasicBlock::iterator MI, int SPAdj, unsigned FIOperandNum, RegScavenger *RS) const