15f613dfdSUlrich Weigand //===- SystemZConstantPoolValue.h - SystemZ constant-pool value -*- C++ -*-===//
25f613dfdSUlrich Weigand //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65f613dfdSUlrich Weigand //
75f613dfdSUlrich Weigand //===----------------------------------------------------------------------===//
85f613dfdSUlrich Weigand 
9a7c40ef0SBenjamin Kramer #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
10a7c40ef0SBenjamin Kramer #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
115f613dfdSUlrich Weigand 
125f613dfdSUlrich Weigand #include "llvm/CodeGen/MachineConstantPool.h"
135f613dfdSUlrich Weigand #include "llvm/Support/ErrorHandling.h"
145f613dfdSUlrich Weigand 
155f613dfdSUlrich Weigand namespace llvm {
165f613dfdSUlrich Weigand 
175f613dfdSUlrich Weigand class GlobalValue;
185f613dfdSUlrich Weigand 
195f613dfdSUlrich Weigand namespace SystemZCP {
205f613dfdSUlrich Weigand enum SystemZCPModifier {
217db6918eSUlrich Weigand   TLSGD,
227db6918eSUlrich Weigand   TLSLDM,
237db6918eSUlrich Weigand   DTPOFF,
245f613dfdSUlrich Weigand   NTPOFF
255f613dfdSUlrich Weigand };
26c231269fSRichard Sandiford } // end namespace SystemZCP
275f613dfdSUlrich Weigand 
285f613dfdSUlrich Weigand /// A SystemZ-specific constant pool value.  At present, the only
297db6918eSUlrich Weigand /// defined constant pool values are module IDs or offsets of
307db6918eSUlrich Weigand /// thread-local variables (written x@TLSGD, x@TLSLDM, x@DTPOFF,
317db6918eSUlrich Weigand /// or x@NTPOFF).
325f613dfdSUlrich Weigand class SystemZConstantPoolValue : public MachineConstantPoolValue {
335f613dfdSUlrich Weigand   const GlobalValue *GV;
345f613dfdSUlrich Weigand   SystemZCP::SystemZCPModifier Modifier;
355f613dfdSUlrich Weigand 
365f613dfdSUlrich Weigand protected:
375f613dfdSUlrich Weigand   SystemZConstantPoolValue(const GlobalValue *GV,
385f613dfdSUlrich Weigand                            SystemZCP::SystemZCPModifier Modifier);
395f613dfdSUlrich Weigand 
405f613dfdSUlrich Weigand public:
415f613dfdSUlrich Weigand   static SystemZConstantPoolValue *
425f613dfdSUlrich Weigand     Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier);
435f613dfdSUlrich Weigand 
445f613dfdSUlrich Weigand   // Override MachineConstantPoolValue.
45b4d67b59SRichard Sandiford   int getExistingMachineCPValue(MachineConstantPool *CP,
46*8c72b027SCraig Topper                                 Align Alignment) override;
47b4d67b59SRichard Sandiford   void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
48b4d67b59SRichard Sandiford   void print(raw_ostream &O) const override;
495f613dfdSUlrich Weigand 
505f613dfdSUlrich Weigand   // Access SystemZ-specific fields.
getGlobalValue()515f613dfdSUlrich Weigand   const GlobalValue *getGlobalValue() const { return GV; }
getModifier()525f613dfdSUlrich Weigand   SystemZCP::SystemZCPModifier getModifier() const { return Modifier; }
535f613dfdSUlrich Weigand };
545f613dfdSUlrich Weigand 
55c231269fSRichard Sandiford } // end namespace llvm
565f613dfdSUlrich Weigand 
575f613dfdSUlrich Weigand #endif
58