xref: /aosp_15_r20/external/llvm/lib/Target/SystemZ/SystemZConstantPoolValue.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker //===- SystemZConstantPoolValue.h - SystemZ constant-pool value -*- C++ -*-===//
2*9880d681SAndroid Build Coastguard Worker //
3*9880d681SAndroid Build Coastguard Worker //                     The LLVM Compiler Infrastructure
4*9880d681SAndroid Build Coastguard Worker //
5*9880d681SAndroid Build Coastguard Worker // This file is distributed under the University of Illinois Open Source
6*9880d681SAndroid Build Coastguard Worker // License. See LICENSE.TXT for details.
7*9880d681SAndroid Build Coastguard Worker //
8*9880d681SAndroid Build Coastguard Worker //===----------------------------------------------------------------------===//
9*9880d681SAndroid Build Coastguard Worker 
10*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
11*9880d681SAndroid Build Coastguard Worker #define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
12*9880d681SAndroid Build Coastguard Worker 
13*9880d681SAndroid Build Coastguard Worker #include "llvm/CodeGen/MachineConstantPool.h"
14*9880d681SAndroid Build Coastguard Worker #include "llvm/Support/ErrorHandling.h"
15*9880d681SAndroid Build Coastguard Worker 
16*9880d681SAndroid Build Coastguard Worker namespace llvm {
17*9880d681SAndroid Build Coastguard Worker 
18*9880d681SAndroid Build Coastguard Worker class GlobalValue;
19*9880d681SAndroid Build Coastguard Worker 
20*9880d681SAndroid Build Coastguard Worker namespace SystemZCP {
21*9880d681SAndroid Build Coastguard Worker enum SystemZCPModifier {
22*9880d681SAndroid Build Coastguard Worker   TLSGD,
23*9880d681SAndroid Build Coastguard Worker   TLSLDM,
24*9880d681SAndroid Build Coastguard Worker   DTPOFF,
25*9880d681SAndroid Build Coastguard Worker   NTPOFF
26*9880d681SAndroid Build Coastguard Worker };
27*9880d681SAndroid Build Coastguard Worker } // end namespace SystemZCP
28*9880d681SAndroid Build Coastguard Worker 
29*9880d681SAndroid Build Coastguard Worker /// A SystemZ-specific constant pool value.  At present, the only
30*9880d681SAndroid Build Coastguard Worker /// defined constant pool values are module IDs or offsets of
31*9880d681SAndroid Build Coastguard Worker /// thread-local variables (written x@TLSGD, x@TLSLDM, x@DTPOFF,
32*9880d681SAndroid Build Coastguard Worker /// or x@NTPOFF).
33*9880d681SAndroid Build Coastguard Worker class SystemZConstantPoolValue : public MachineConstantPoolValue {
34*9880d681SAndroid Build Coastguard Worker   const GlobalValue *GV;
35*9880d681SAndroid Build Coastguard Worker   SystemZCP::SystemZCPModifier Modifier;
36*9880d681SAndroid Build Coastguard Worker 
37*9880d681SAndroid Build Coastguard Worker protected:
38*9880d681SAndroid Build Coastguard Worker   SystemZConstantPoolValue(const GlobalValue *GV,
39*9880d681SAndroid Build Coastguard Worker                            SystemZCP::SystemZCPModifier Modifier);
40*9880d681SAndroid Build Coastguard Worker 
41*9880d681SAndroid Build Coastguard Worker public:
42*9880d681SAndroid Build Coastguard Worker   static SystemZConstantPoolValue *
43*9880d681SAndroid Build Coastguard Worker     Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier);
44*9880d681SAndroid Build Coastguard Worker 
45*9880d681SAndroid Build Coastguard Worker   // Override MachineConstantPoolValue.
46*9880d681SAndroid Build Coastguard Worker   int getExistingMachineCPValue(MachineConstantPool *CP,
47*9880d681SAndroid Build Coastguard Worker                                 unsigned Alignment) override;
48*9880d681SAndroid Build Coastguard Worker   void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
49*9880d681SAndroid Build Coastguard Worker   void print(raw_ostream &O) const override;
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker   // Access SystemZ-specific fields.
getGlobalValue()52*9880d681SAndroid Build Coastguard Worker   const GlobalValue *getGlobalValue() const { return GV; }
getModifier()53*9880d681SAndroid Build Coastguard Worker   SystemZCP::SystemZCPModifier getModifier() const { return Modifier; }
54*9880d681SAndroid Build Coastguard Worker };
55*9880d681SAndroid Build Coastguard Worker 
56*9880d681SAndroid Build Coastguard Worker } // end namespace llvm
57*9880d681SAndroid Build Coastguard Worker 
58*9880d681SAndroid Build Coastguard Worker #endif
59