LLVM  16.0.0git
SPIRVRegisterBankInfo.cpp
Go to the documentation of this file.
1 //===- SPIRVRegisterBankInfo.cpp ------------------------------*- C++ -*---===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the targeting of the RegisterBankInfo class for SPIR-V.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "SPIRVRegisterBankInfo.h"
14 #include "SPIRVRegisterInfo.h"
16 
17 #define GET_REGINFO_ENUM
18 #include "SPIRVGenRegisterInfo.inc"
19 
20 #define GET_TARGET_REGBANK_IMPL
21 #include "SPIRVGenRegisterBank.inc"
22 
23 using namespace llvm;
24 
25 // This required for .td selection patterns to work or we'd end up with RegClass
26 // checks being redundant as all the classes would be mapped to the same bank.
27 const RegisterBank &
29  LLT Ty) const {
30  switch (RC.getID()) {
31  case SPIRV::TYPERegClassID:
32  return SPIRV::TYPERegBank;
33  case SPIRV::pIDRegClassID:
34  case SPIRV::IDRegClassID:
35  return SPIRV::IDRegBank;
36  case SPIRV::fIDRegClassID:
37  return SPIRV::fIDRegBank;
38  case SPIRV::vIDRegClassID:
39  return SPIRV::vIDRegBank;
40  case SPIRV::vfIDRegClassID:
41  return SPIRV::vfIDRegBank;
42  case SPIRV::ANYIDRegClassID:
43  case SPIRV::ANYRegClassID:
44  return SPIRV::IDRegBank;
45  }
46  llvm_unreachable("Unknown register class");
47 }
llvm::TargetRegisterClass::getID
unsigned getID() const
Return the register class ID number.
Definition: TargetRegisterInfo.h:75
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::RegisterBank
This class implements the register bank concept.
Definition: RegisterBank.h:28
llvm::TargetRegisterClass
Definition: TargetRegisterInfo.h:46
SPIRVRegisterInfo.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::SPIRVRegisterBankInfo::getRegBankFromRegClass
const RegisterBank & getRegBankFromRegClass(const TargetRegisterClass &RC, LLT Ty) const override
Get a register bank that covers RC.
Definition: SPIRVRegisterBankInfo.cpp:28
SPIRVRegisterBankInfo.h
RegisterBank.h
llvm::LLT
Definition: LowLevelTypeImpl.h:39