blob: 9bf9d7fe5b39e8eed6e7e50c2e2ae460c4edba7c [file] [log] [blame]
//===- SPIRVRegisterBankInfo.cpp ------------------------------*- C++ -*---===//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// This file implements the targeting of the RegisterBankInfo class for SPIR-V.
#include "SPIRVRegisterBankInfo.h"
#include "SPIRVRegisterInfo.h"
#include "llvm/CodeGen/RegisterBank.h"
#include ""
#include ""
using namespace llvm;
// This required for .td selection patterns to work or we'd end up with RegClass
// checks being redundant as all the classes would be mapped to the same bank.
const RegisterBank &
SPIRVRegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
LLT Ty) const {
switch (RC.getID()) {
case SPIRV::TYPERegClassID:
return SPIRV::TYPERegBank;
case SPIRV::pIDRegClassID:
case SPIRV::IDRegClassID:
return SPIRV::IDRegBank;
case SPIRV::fIDRegClassID:
return SPIRV::fIDRegBank;
case SPIRV::vIDRegClassID:
return SPIRV::vIDRegBank;
case SPIRV::vfIDRegClassID:
return SPIRV::vfIDRegBank;
case SPIRV::ANYIDRegClassID:
case SPIRV::ANYRegClassID:
return SPIRV::IDRegBank;
llvm_unreachable("Unknown register class");