blob: a71b595560d2f168d0cbffc651048dbe4ec04d85 [file] [log] [blame]
Ulrich Weigand5f613df2013-05-06 16:15:19 +00001//===- 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
Benjamin Kramera7c40ef2014-08-13 16:26:38 +000010#ifndef LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
11#define LLVM_LIB_TARGET_SYSTEMZ_SYSTEMZCONSTANTPOOLVALUE_H
Ulrich Weigand5f613df2013-05-06 16:15:19 +000012
13#include "llvm/CodeGen/MachineConstantPool.h"
14#include "llvm/Support/ErrorHandling.h"
15
16namespace llvm {
17
18class GlobalValue;
19
20namespace SystemZCP {
Richard Sandifordc2312692014-03-06 10:38:30 +000021enum SystemZCPModifier {
Ulrich Weigand7db69182015-02-18 09:13:27 +000022 TLSGD,
23 TLSLDM,
24 DTPOFF,
Richard Sandifordc2312692014-03-06 10:38:30 +000025 NTPOFF
26};
27} // end namespace SystemZCP
Ulrich Weigand5f613df2013-05-06 16:15:19 +000028
29/// A SystemZ-specific constant pool value. At present, the only
Ulrich Weigand7db69182015-02-18 09:13:27 +000030/// 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).
Ulrich Weigand5f613df2013-05-06 16:15:19 +000033class SystemZConstantPoolValue : public MachineConstantPoolValue {
34 const GlobalValue *GV;
35 SystemZCP::SystemZCPModifier Modifier;
36
37protected:
38 SystemZConstantPoolValue(const GlobalValue *GV,
39 SystemZCP::SystemZCPModifier Modifier);
40
41public:
42 static SystemZConstantPoolValue *
43 Create(const GlobalValue *GV, SystemZCP::SystemZCPModifier Modifier);
44
45 // Override MachineConstantPoolValue.
Richard Sandifordb4d67b52014-03-06 12:03:36 +000046 int getExistingMachineCPValue(MachineConstantPool *CP,
47 unsigned Alignment) override;
48 void addSelectionDAGCSEId(FoldingSetNodeID &ID) override;
49 void print(raw_ostream &O) const override;
Ulrich Weigand5f613df2013-05-06 16:15:19 +000050
51 // Access SystemZ-specific fields.
52 const GlobalValue *getGlobalValue() const { return GV; }
53 SystemZCP::SystemZCPModifier getModifier() const { return Modifier; }
54};
55
Richard Sandifordc2312692014-03-06 10:38:30 +000056} // end namespace llvm
Ulrich Weigand5f613df2013-05-06 16:15:19 +000057
58#endif