LLVM  3.7.0
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  RCW.RegWeight = 0;
25  RCW.WeightLimit = 0;
26 }
27 
29  BitVector Reserved(getNumRegs());
30 
31  const R600InstrInfo *TII =
32  static_cast<const R600InstrInfo *>(MF.getSubtarget().getInstrInfo());
33 
34  Reserved.set(AMDGPU::ZERO);
35  Reserved.set(AMDGPU::HALF);
36  Reserved.set(AMDGPU::ONE);
37  Reserved.set(AMDGPU::ONE_INT);
38  Reserved.set(AMDGPU::NEG_HALF);
39  Reserved.set(AMDGPU::NEG_ONE);
40  Reserved.set(AMDGPU::PV_X);
41  Reserved.set(AMDGPU::ALU_LITERAL_X);
42  Reserved.set(AMDGPU::ALU_CONST);
43  Reserved.set(AMDGPU::PREDICATE_BIT);
44  Reserved.set(AMDGPU::PRED_SEL_OFF);
45  Reserved.set(AMDGPU::PRED_SEL_ZERO);
46  Reserved.set(AMDGPU::PRED_SEL_ONE);
47  Reserved.set(AMDGPU::INDIRECT_BASE_ADDR);
48 
49  for (TargetRegisterClass::iterator I = AMDGPU::R600_AddrRegClass.begin(),
50  E = AMDGPU::R600_AddrRegClass.end(); I != E; ++I) {
51  Reserved.set(*I);
52  }
53 
54  TII->reserveIndirectRegisters(Reserved, MF);
55 
56  return Reserved;
57 }
58 
59 unsigned R600RegisterInfo::getHWRegChan(unsigned reg) const {
60  return this->getEncodingValue(reg) >> HW_CHAN_SHIFT;
61 }
62 
63 unsigned R600RegisterInfo::getHWRegIndex(unsigned Reg) const {
64  return GET_REG_INDEX(getEncodingValue(Reg));
65 }
66 
68  MVT VT) const {
69  switch(VT.SimpleTy) {
70  default:
71  case MVT::i32: return &AMDGPU::R600_TReg32RegClass;
72  }
73 }
74 
76  const TargetRegisterClass *RC) const {
77  return RCW;
78 }
79 
82 
83  switch (Reg) {
84  case AMDGPU::OQAP:
85  case AMDGPU::OQBP:
86  case AMDGPU::AR_X:
87  return false;
88  default:
89  return true;
90  }
91 }
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:240
BitVector & set()
Definition: BitVector.h:218
Interface definition for R600InstrInfo.
unsigned getHWRegChan(unsigned reg) const
get the HW encoding for a register's channel.
static bool isVirtualRegister(unsigned Reg)
isVirtualRegister - Return true if the specified register number is in the virtual register namespace...
const_iterator begin(StringRef path)
Get begin iterator over path.
Definition: Path.cpp:232
Interface definition for R600RegisterInfo.
const TargetRegisterClass * getCFGStructurizerRegClass(MVT VT) const override
get the register class of the specified type to use in the CFGStructurizer
Each TargetRegisterClass has a per register weight, and weight limit which must be less than the limi...
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
const HexagonInstrInfo * TII
#define HW_CHAN_SHIFT
Definition: R600Defines.h:57
Reg
All possible values of the reg field in the ModR/M byte.
SimpleValueType SimpleTy
MVT - Machine Value Type.
unsigned getHWRegIndex(unsigned Reg) const override
The AMDGPU TargetMachine interface definition for hw codgen targets.
bool isPhysRegLiveAcrossClauses(unsigned Reg) const
void reserveIndirectRegisters(BitVector &Reserved, const MachineFunction &MF) const
Reserve the registers that may be accesed using indirect addressing.
const RegClassWeight & getRegClassWeight(const TargetRegisterClass *RC) const override
BitVector getReservedRegs(const MachineFunction &MF) const override
#define I(x, y, z)
Definition: MD5.cpp:54
virtual const TargetInstrInfo * getInstrInfo() const
#define GET_REG_INDEX(reg)
Definition: R600Defines.h:60