xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/SystemZ/SystemZConstantPoolValue.h (revision e25152834cdf3b353892835a4f3b157e066a8ed4)
10b57cec5SDimitry Andric //===- SystemZConstantPoolValue.h - SystemZ constant-pool value -*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric 
90b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
100b57cec5SDimitry Andric #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
110b57cec5SDimitry Andric 
120b57cec5SDimitry Andric #include "llvm/CodeGen/MachineConstantPool.h"
130b57cec5SDimitry Andric #include "llvm/Support/ErrorHandling.h"
140b57cec5SDimitry Andric 
150b57cec5SDimitry Andric namespace llvm {
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric class GlobalValue;
180b57cec5SDimitry Andric 
190b57cec5SDimitry Andric namespace SystemZCP {
200b57cec5SDimitry Andric enum SystemZCPModifier {
210b57cec5SDimitry Andric   TLSGD,
220b57cec5SDimitry Andric   TLSLDM,
230b57cec5SDimitry Andric   DTPOFF,
240b57cec5SDimitry Andric   NTPOFF
250b57cec5SDimitry Andric };
260b57cec5SDimitry Andric } // end namespace SystemZCP
270b57cec5SDimitry Andric 
280b57cec5SDimitry Andric /// A SystemZ-specific constant pool value.  At present, the only
290b57cec5SDimitry Andric /// defined constant pool values are module IDs or offsets of
300b57cec5SDimitry Andric /// thread-local variables (written x@TLSGD, x@TLSLDM, x@DTPOFF,
310b57cec5SDimitry Andric /// or x@NTPOFF).
320b57cec5SDimitry Andric class SystemZConstantPoolValue : public MachineConstantPoolValue {
330b57cec5SDimitry Andric   const GlobalValue *GV;
340b57cec5SDimitry Andric   SystemZCP::SystemZCPModifier Modifier;
350b57cec5SDimitry Andric 
360b57cec5SDimitry Andric protected:
370b57cec5SDimitry Andric   SystemZConstantPoolValue(const GlobalValue *GV,
380b57cec5SDimitry Andric                            SystemZCP::SystemZCPModifier Modifier);
390b57cec5SDimitry Andric 
400b57cec5SDimitry Andric public:
410b57cec5SDimitry Andric   static SystemZConstantPoolValue *
420b57cec5SDimitry Andric     Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier);
430b57cec5SDimitry Andric 
440b57cec5SDimitry Andric   // Override MachineConstantPoolValue.
450b57cec5SDimitry Andric   int getExistingMachineCPValue(MachineConstantPool *CP,
46*5ffd83dbSDimitry Andric                                 Align Alignment) override;
470b57cec5SDimitry Andric   void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
480b57cec5SDimitry Andric   void print(raw_ostream &O) const override;
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric   // Access SystemZ-specific fields.
getGlobalValue()510b57cec5SDimitry Andric   const GlobalValue *getGlobalValue() const { return GV; }
getModifier()520b57cec5SDimitry Andric   SystemZCP::SystemZCPModifier getModifier() const { return Modifier; }
530b57cec5SDimitry Andric };
540b57cec5SDimitry Andric 
550b57cec5SDimitry Andric } // end namespace llvm
560b57cec5SDimitry Andric 
570b57cec5SDimitry Andric #endif
58