Add gfx950 mfma instructions to ROCDL dialect (#123361)
[llvm-project.git] / llvm / lib / Target / SystemZ / SystemZConstantPoolValue.cpp
blobfce6393969a2d013a23182c78fccb19c2d844a3a
1 //===-- SystemZConstantPoolValue.cpp - SystemZ constant-pool value --------===//
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 //===----------------------------------------------------------------------===//
9 #include "SystemZConstantPoolValue.h"
10 #include "llvm/ADT/FoldingSet.h"
11 #include "llvm/IR/GlobalValue.h"
12 #include "llvm/Support/raw_ostream.h"
14 using namespace llvm;
16 SystemZConstantPoolValue::
17 SystemZConstantPoolValue(const GlobalValue *gv,
18 SystemZCP::SystemZCPModifier modifier)
19 : MachineConstantPoolValue(gv->getType()), GV(gv), Modifier(modifier) {}
21 SystemZConstantPoolValue *
22 SystemZConstantPoolValue::Create(const GlobalValue *GV,
23 SystemZCP::SystemZCPModifier Modifier) {
24 return new SystemZConstantPoolValue(GV, Modifier);
27 int SystemZConstantPoolValue::getExistingMachineCPValue(MachineConstantPool *CP,
28 Align Alignment) {
29 const std::vector<MachineConstantPoolEntry> &Constants = CP->getConstants();
30 for (unsigned I = 0, E = Constants.size(); I != E; ++I) {
31 if (Constants[I].isMachineConstantPoolEntry() &&
32 Constants[I].getAlign() >= Alignment) {
33 auto *ZCPV =
34 static_cast<SystemZConstantPoolValue *>(Constants[I].Val.MachineCPVal);
35 if (ZCPV->GV == GV && ZCPV->Modifier == Modifier)
36 return I;
39 return -1;
42 void SystemZConstantPoolValue::addSelectionDAGCSEId(FoldingSetNodeID &ID) {
43 ID.AddPointer(GV);
44 ID.AddInteger(Modifier);
47 void SystemZConstantPoolValue::print(raw_ostream &O) const {
48 O << GV << "@" << int(Modifier);