blob: 6c680dfc4697b82a70f4dcebc3af61a912e3fab4 [file] [edit]
//===-- AMDGPUMachineInstrs.cpp -*- C++ -*---------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
/// Convenience wrappers and helpers for AMDGPU-specific machine instructions.
//
//===----------------------------------------------------------------------===//
#include "AMDGPUMachineInstrs.h"
#include "GCNSubtarget.h"
#include "SIMachineFunctionInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
using namespace llvm;
using namespace AMDGPUMI;
unsigned VLoadStoreIdxInst::getNumIndexableVGPRs(const MachineFunction &MF) {
const GCNSubtarget &ST = MF.getSubtarget<GCNSubtarget>();
unsigned DynamicVGPRBlockSize =
MF.getInfo<SIMachineFunctionInfo>()->getDynamicVGPRBlockSize();
return std::min(ST.getAddressableNumArchVGPRs(),
ST.getAddressableNumVGPRs(DynamicVGPRBlockSize));
}
bool VLoadStoreIdxInst::isSupportedBitWidth(unsigned Bits) {
return AMDGPU::getVLdStIdxOpcodeInfoByKey(Bits, /*IsStore=*/false,
/*IsGPRIdx=*/false) != nullptr;
}