LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
R600RegisterInfo.cpp
Go to the documentation of this file.
1 //===-- R600RegisterInfo.cpp - R600 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 R600 implementation of the TargetRegisterInfo class.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "R600RegisterInfo.h"
16 #include "AMDGPUTargetMachine.h"
17 #include "R600Defines.h"
18 #include "R600InstrInfo.h"
20 
21 using namespace llvm;
22 
24 : AMDGPURegisterInfo(tm),
25  TM(tm)
26  { RCW.RegWeight = 0; RCW.WeightLimit = 0;}
27 
29  BitVector Reserved(getNumRegs());
30 
31  const R600InstrInfo *TII = static_cast<const R600InstrInfo*>(TM.getInstrInfo());
32 
33  Reserved.set(AMDGPU::ZERO);
34  Reserved.set(AMDGPU::HALF);
35  Reserved.set(AMDGPU::ONE);
36  Reserved.set(AMDGPU::ONE_INT);
37  Reserved.set(AMDGPU::NEG_HALF);
38  Reserved.set(AMDGPU::NEG_ONE);
39  Reserved.set(AMDGPU::PV_X);
40  Reserved.set(AMDGPU::ALU_LITERAL_X);
41  Reserved.set(AMDGPU::ALU_CONST);
42  Reserved.set(AMDGPU::PREDICATE_BIT);
43  Reserved.set(AMDGPU::PRED_SEL_OFF);
44  Reserved.set(AMDGPU::PRED_SEL_ZERO);
45  Reserved.set(AMDGPU::PRED_SEL_ONE);
46  Reserved.set(AMDGPU::INDIRECT_BASE_ADDR);
47 
48  for (TargetRegisterClass::iterator I = AMDGPU::R600_AddrRegClass.begin(),
49  E = AMDGPU::R600_AddrRegClass.end(); I != E; ++I) {
50  Reserved.set(*I);
51  }
52 
53  TII->reserveIndirectRegisters(Reserved, MF);
54 
55  return Reserved;
56 }
57 
58 const TargetRegisterClass *
60  switch (rc->getID()) {
61  case AMDGPU::GPRF32RegClassID:
62  case AMDGPU::GPRI32RegClassID:
63  return &AMDGPU::R600_Reg32RegClass;
64  default: return rc;
65  }
66 }
67 
68 unsigned R600RegisterInfo::getHWRegChan(unsigned reg) const {
69  return this->getEncodingValue(reg) >> HW_CHAN_SHIFT;
70 }
71 
72 unsigned R600RegisterInfo::getHWRegIndex(unsigned Reg) const {
73  return GET_REG_INDEX(getEncodingValue(Reg));
74 }
75 
77  MVT VT) const {
78  switch(VT.SimpleTy) {
79  default:
80  case MVT::i32: return &AMDGPU::R600_TReg32RegClass;
81  }
82 }
83 
85  const TargetRegisterClass *RC) const {
86  return RCW;
87 }
88 
91 
92  switch (Reg) {
93  case AMDGPU::OQAP:
94  case AMDGPU::OQBP:
95  case AMDGPU::AR_X:
96  return false;
97  default:
98  return true;
99  }
100 }
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:181
BitVector & set()
Definition: BitVector.h:236
virtual const TargetRegisterClass * getISARegClass(const TargetRegisterClass *RC) const
Interface definition for R600InstrInfo.
unsigned getHWRegChan(unsigned reg) const
get the HW encoding for a register's channel.
static bool isVirtualRegister(unsigned Reg)
const_iterator begin(StringRef path)
Get begin iterator over path.
Definition: Path.cpp:173
Interface definition for R600RegisterInfo.
virtual BitVector getReservedRegs(const MachineFunction &MF) const
const HexagonInstrInfo * TII
#define HW_CHAN_SHIFT
Definition: R600Defines.h:57
SimpleValueType SimpleTy
Definition: ValueTypes.h:161
R600RegisterInfo(AMDGPUTargetMachine &tm)
virtual const AMDGPUInstrInfo * getInstrInfo() const
virtual const TargetRegisterClass * getCFGStructurizerRegClass(MVT VT) const
get the register class of the specified type to use in the CFGStructurizer
The AMDGPU TargetMachine interface definition for hw codgen targets.
virtual unsigned getHWRegIndex(unsigned Reg) const
virtual bool isPhysRegLiveAcrossClauses(unsigned Reg) const
AMDGPUTargetMachine & TM
void reserveIndirectRegisters(BitVector &Reserved, const MachineFunction &MF) const
Reserve the registers that may be accesed using indirect addressing.
#define I(x, y, z)
Definition: MD5.cpp:54
#define GET_REG_INDEX(reg)
Definition: R600Defines.h:60
virtual const RegClassWeight & getRegClassWeight(const TargetRegisterClass *RC) const