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