Trim unnecessary #includes.
[oota-llvm.git] / lib / Target / ARM / ARMConstantPoolValue.h
1 //===- ARMConstantPoolValue.h - ARM constantpool 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 //
10 // This file implements the ARM specific constantpool value class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_TARGET_ARM_CONSTANTPOOLVALUE_H
15 #define LLVM_TARGET_ARM_CONSTANTPOOLVALUE_H
16
17 #include "llvm/CodeGen/MachineConstantPool.h"
18
19 namespace llvm {
20
21 class GlobalValue;
22
23 namespace ARMCP {
24   enum ARMCPKind {
25     CPValue,
26     CPNonLazyPtr,
27     CPStub
28   };
29 }
30
31 /// ARMConstantPoolValue - ARM specific constantpool value. This is used to
32 /// represent PC relative displacement between the address of the load
33 /// instruction and the global value being loaded, i.e. (&GV-(LPIC+8)).
34 class ARMConstantPoolValue : public MachineConstantPoolValue {
35   GlobalValue *GV;         // GlobalValue being loaded.
36   const char *S;           // ExtSymbol being loaded.
37   unsigned LabelId;        // Label id of the load.
38   ARMCP::ARMCPKind Kind;   // non_lazy_ptr or stub?
39   unsigned char PCAdjust;  // Extra adjustment if constantpool is pc relative.
40                            // 8 for ARM, 4 for Thumb.
41   const char *Modifier;    // GV modifier i.e. (&GV(modifier)-(LPIC+8))
42   bool AddCurrentAddress;
43
44 public:
45   ARMConstantPoolValue(GlobalValue *gv, unsigned id,
46                        ARMCP::ARMCPKind Kind = ARMCP::CPValue,
47                        unsigned char PCAdj = 0, const char *Modifier = NULL,
48                        bool AddCurrentAddress = false);
49   ARMConstantPoolValue(const char *s, unsigned id,
50                        ARMCP::ARMCPKind Kind = ARMCP::CPValue,
51                        unsigned char PCAdj = 0, const char *Modifier = NULL,
52                        bool AddCurrentAddress = false);
53   ARMConstantPoolValue(GlobalValue *GV, ARMCP::ARMCPKind Kind,
54                        const char *Modifier);
55
56
57   GlobalValue *getGV() const { return GV; }
58   const char *getSymbol() const { return S; }
59   const char *getModifier() const { return Modifier; }
60   bool hasModifier() const { return Modifier != NULL; }
61   bool mustAddCurrentAddress() const { return AddCurrentAddress; }
62   unsigned getLabelId() const { return LabelId; }
63   bool isNonLazyPointer() const { return Kind == ARMCP::CPNonLazyPtr; }
64   bool isStub() const { return Kind == ARMCP::CPStub; }
65   unsigned char getPCAdjustment() const { return PCAdjust; }
66
67   virtual int getExistingMachineCPValue(MachineConstantPool *CP,
68                                         unsigned Alignment);
69
70   virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID);
71
72   virtual void print(std::ostream &O) const;
73 };
74   
75 }
76
77 #endif