LLVM 23.0.0git
SPIRVTypeInst.cpp
Go to the documentation of this file.
1//===-- SPIRVTypeInst.cpp - SPIR-V Type Instruction -------------*- 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// Implementation associated to SPIRVTypeInst.h.
10//
11//===----------------------------------------------------------------------===//
12
13#include "SPIRVTypeInst.h"
14#include "SPIRVInstrInfo.h"
15
16namespace llvm {
17[[maybe_unused]] static bool definesATypeRegister(const MachineInstr &MI) {
18 const MachineRegisterInfo &MRI = MI.getMF()->getRegInfo();
19 return MRI.getRegClass(MI.getOperand(0).getReg()) == &SPIRV::TYPERegClass;
20}
21
22SPIRVTypeInst::SPIRVTypeInst(const MachineInstr *MI) : MI(MI) {
23 // A SPIRV Type whose result is not a type is invalid.
24 assert(!MI || definesATypeRegister(*MI));
25}
26} // namespace llvm
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
IRTranslator LLVM IR MI
Representation of each machine instruction.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This is an optimization pass for GlobalISel generic memory operations.
Definition Types.h:26
static bool definesATypeRegister(const MachineInstr &MI)