LLVM  8.0.1
SystemZConstantPoolValue.cpp
Go to the documentation of this file.
1 //===-- SystemZConstantPoolValue.cpp - SystemZ constant-pool value --------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
11 #include "llvm/ADT/FoldingSet.h"
12 #include "llvm/IR/DerivedTypes.h"
13 #include "llvm/IR/GlobalValue.h"
15 
16 using namespace llvm;
17 
21  : MachineConstantPoolValue(gv->getType()), GV(gv), Modifier(modifier) {}
22 
26  return new SystemZConstantPoolValue(GV, Modifier);
27 }
28 
31  unsigned AlignMask = Alignment - 1;
32  const std::vector<MachineConstantPoolEntry> &Constants = CP->getConstants();
33  for (unsigned I = 0, E = Constants.size(); I != E; ++I) {
34  if (Constants[I].isMachineConstantPoolEntry() &&
35  (Constants[I].getAlignment() & AlignMask) == 0) {
36  auto *ZCPV =
37  static_cast<SystemZConstantPoolValue *>(Constants[I].Val.MachineCPVal);
38  if (ZCPV->GV == GV && ZCPV->Modifier == Modifier)
39  return I;
40  }
41  }
42  return -1;
43 }
44 
46  ID.AddPointer(GV);
47  ID.AddInteger(Modifier);
48 }
49 
51  O << GV << "@" << int(Modifier);
52 }
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
Definition: FoldingSet.cpp:52
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:24
SystemZConstantPoolValue(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)
void addSelectionDAGCSEId(FoldingSetNodeID &ID) override
void AddInteger(signed I)
Definition: FoldingSet.cpp:61
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:306
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:46
A SystemZ-specific constant pool value.
static SystemZConstantPoolValue * Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)