xref: /freebsd/contrib/llvm-project/llvm/lib/Target/SPIRV/SPIRVRegisterBankInfo.cpp (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
181ad6265SDimitry Andric //===- SPIRVRegisterBankInfo.cpp ------------------------------*- C++ -*---===//
281ad6265SDimitry Andric //
381ad6265SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
481ad6265SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
581ad6265SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
681ad6265SDimitry Andric //
781ad6265SDimitry Andric //===----------------------------------------------------------------------===//
881ad6265SDimitry Andric //
981ad6265SDimitry Andric // This file implements the targeting of the RegisterBankInfo class for SPIR-V.
1081ad6265SDimitry Andric //
1181ad6265SDimitry Andric //===----------------------------------------------------------------------===//
1281ad6265SDimitry Andric 
1381ad6265SDimitry Andric #include "SPIRVRegisterBankInfo.h"
1481ad6265SDimitry Andric #include "SPIRVRegisterInfo.h"
1581ad6265SDimitry Andric #include "llvm/CodeGen/RegisterBank.h"
1681ad6265SDimitry Andric 
1781ad6265SDimitry Andric #define GET_REGINFO_ENUM
1881ad6265SDimitry Andric #include "SPIRVGenRegisterInfo.inc"
1981ad6265SDimitry Andric 
2081ad6265SDimitry Andric #define GET_TARGET_REGBANK_IMPL
2181ad6265SDimitry Andric #include "SPIRVGenRegisterBank.inc"
2281ad6265SDimitry Andric 
2381ad6265SDimitry Andric using namespace llvm;
2481ad6265SDimitry Andric 
2581ad6265SDimitry Andric // This required for .td selection patterns to work or we'd end up with RegClass
2681ad6265SDimitry Andric // checks being redundant as all the classes would be mapped to the same bank.
2781ad6265SDimitry Andric const RegisterBank &
getRegBankFromRegClass(const TargetRegisterClass & RC,LLT Ty) const2881ad6265SDimitry Andric SPIRVRegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
2981ad6265SDimitry Andric                                               LLT Ty) const {
30*0fca6ea1SDimitry Andric   if (RC.getID() == SPIRV::TYPERegClassID)
3181ad6265SDimitry Andric     return SPIRV::TYPERegBank;
3281ad6265SDimitry Andric   return SPIRV::IDRegBank;
3381ad6265SDimitry Andric }
34