e5f1bb18581ba61e5bd12fd7113b43f9f00bee04
[oota-llvm.git] / lib / Target / SystemZ / SystemZConstantPoolValue.h
1 //===- SystemZConstantPoolValue.h - SystemZ constant-pool value -*- C++ -*-===//
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
10 #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
11 #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
12
13 #include "llvm/CodeGen/MachineConstantPool.h"
14 #include "llvm/Support/ErrorHandling.h"
15
16 namespace llvm {
17
18 class GlobalValue;
19
20 namespace SystemZCP {
21 enum SystemZCPModifier {
22   TLSGD,
23   TLSLDM,
24   DTPOFF,
25   NTPOFF
26 };
27 } // end namespace SystemZCP
28
29 /// A SystemZ-specific constant pool value.  At present, the only
30 /// defined constant pool values are module IDs or offsets of
31 /// thread-local variables (written x@TLSGD, x@TLSLDM, x@DTPOFF,
32 /// or x@NTPOFF).
33 class SystemZConstantPoolValue : public MachineConstantPoolValue {
34   const GlobalValue *GV;
35   SystemZCP::SystemZCPModifier Modifier;
36
37 protected:
38   SystemZConstantPoolValue(const GlobalValue *GV,
39                            SystemZCP::SystemZCPModifier Modifier);
40
41 public:
42   static SystemZConstantPoolValue *
43     Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier);
44
45   // Override MachineConstantPoolValue.
46   unsigned getRelocationInfo() const override;
47   int getExistingMachineCPValue(MachineConstantPool *CP,
48                                 unsigned Alignment) override;
49   void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
50   void print(raw_ostream &O) const override;
51
52   // Access SystemZ-specific fields.
53   const GlobalValue *getGlobalValue() const { return GV; }
54   SystemZCP::SystemZCPModifier getModifier() const { return Modifier; }
55 };
56
57 } // end namespace llvm
58
59 #endif