LLVM  9.0.0svn
SystemZConstantPoolValue.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8 
10 #include "llvm/ADT/FoldingSet.h"
11 #include "llvm/IR/DerivedTypes.h"
12 #include "llvm/IR/GlobalValue.h"
14 
15 using namespace llvm;
16 
20  : MachineConstantPoolValue(gv->getType()), GV(gv), Modifier(modifier) {}
21 
25  return new SystemZConstantPoolValue(GV, Modifier);
26 }
27 
30  unsigned AlignMask = Alignment - 1;
31  const std::vector<MachineConstantPoolEntry> &Constants = CP->getConstants();
32  for (unsigned I = 0, E = Constants.size(); I != E; ++I) {
33  if (Constants[I].isMachineConstantPoolEntry() &&
34  (Constants[I].getAlignment() & AlignMask) == 0) {
35  auto *ZCPV =
36  static_cast<SystemZConstantPoolValue *>(Constants[I].Val.MachineCPVal);
37  if (ZCPV->GV == GV && ZCPV->Modifier == Modifier)
38  return I;
39  }
40  }
41  return -1;
42 }
43 
45  ID.AddPointer(GV);
46  ID.AddInteger(Modifier);
47 }
48 
50  O << GV << "@" << int(Modifier);
51 }
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
Definition: FoldingSet.cpp:51
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
This class represents lattice values for constants.
Definition: AllocatorList.h:23
SystemZConstantPoolValue(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
void AddInteger(signed I)
Definition: FoldingSet.cpp:60
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:305
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) override
Abstract base class for all machine specific constantpool value subclasses.
static wasm::ValType getType(const TargetRegisterClass *RC)
const std::vector< MachineConstantPoolEntry > & getConstants() const
void print(raw_ostream &O) const override
print - Implement operator<<
#define I(x, y, z)
Definition: MD5.cpp:58
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:45
A SystemZ-specific constant pool value.
static SystemZConstantPoolValue * Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)