LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
30  switch (Modifier) {
31  case SystemZCP::NTPOFF:
32  // May require a relocation, but the relocations are always resolved
33  // by the static linker.
34  return 1;
35  }
36  llvm_unreachable("Unknown modifier");
37 }
38 
41  unsigned AlignMask = Alignment - 1;
42  const std::vector<MachineConstantPoolEntry> &Constants = CP->getConstants();
43  for (unsigned I = 0, E = Constants.size(); I != E; ++I) {
44  if (Constants[I].isMachineConstantPoolEntry() &&
45  (Constants[I].getAlignment() & AlignMask) == 0) {
47  static_cast<SystemZConstantPoolValue *>(Constants[I].Val.MachineCPVal);
48  if (ZCPV->GV == GV && ZCPV->Modifier == Modifier)
49  return I;
50  }
51  }
52  return -1;
53 }
54 
56  ID.AddPointer(GV);
57  ID.AddInteger(Modifier);
58 }
59 
61  O << GV << "@" << int(Modifier);
62 }
void AddPointer(const void *Ptr)
Definition: FoldingSet.cpp:52
The machine constant pool.
SystemZConstantPoolValue(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)
virtual void addSelectionDAGCSEId(FoldingSetNodeID &ID) LLVM_OVERRIDE
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Definition: Function.cpp:657
#define llvm_unreachable(msg)
void AddInteger(signed I)
Definition: FoldingSet.cpp:60
ID
LLVM Calling Convention Representation.
Definition: CallingConv.h:26
virtual unsigned getRelocationInfo() const LLVM_OVERRIDE
virtual int getExistingMachineCPValue(MachineConstantPool *CP, unsigned Alignment) LLVM_OVERRIDE
#define I(x, y, z)
Definition: MD5.cpp:54
virtual void print(raw_ostream &O) const LLVM_OVERRIDE
print - Implement operator<<
const std::vector< MachineConstantPoolEntry > & getConstants() const
static SystemZConstantPoolValue * Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier)