LLVM 24.0.0git
SPIRVMachineFunctionInfo.cpp
Go to the documentation of this file.
1//===-- SPIRVMachineFunctionInfo.cpp - SPIR-V machine function info -------===//
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
10#include "SPIRVGlobalRegistry.h"
11#include "SPIRVSubtarget.h"
12
13using namespace llvm;
14
16 const llvm::MachineFunction &MF) {
17 const auto &ST = MF.getSubtarget<SPIRVSubtarget>();
18 const TargetRegisterInfo *TRI = ST.getRegisterInfo();
19 const SPIRVGlobalRegistry *GR = ST.getSPIRVGlobalRegistry();
20 for (auto [Reg, TypeReg] : GR->getVRegTypeIDs(MF)) {
21 SPIRVVRegType &Entry = VRegTypes.emplace_back();
22 raw_string_ostream(Entry.Reg.Value) << printReg(Reg, TRI);
23 raw_string_ostream(Entry.Type.Value) << printReg(TypeReg, TRI);
24 }
25}
26
Register const TargetRegisterInfo * TRI
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
SmallVector< std::pair< Register, Register > > getVRegTypeIDs(const MachineFunction &MF) const
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
A raw_ostream that writes to an std::string.
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI Printable printReg(Register Reg, const TargetRegisterInfo *TRI=nullptr, unsigned SubIdx=0, const MachineRegisterInfo *MRI=nullptr)
Prints virtual and physical registers with or without a TRI instance.
This class should be specialized by any type that needs to be converted to/from a YAML mapping.
Definition YAMLTraits.h:63
void mappingImpl(yaml::IO &YamlIO) override