1 //===- ARMConstantPoolValue.h - ARM constantpool value ----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Evan Cheng and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the ARM specific constantpool value class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_ARM_CONSTANTPOOLVALUE_H
15 #define LLVM_TARGET_ARM_CONSTANTPOOLVALUE_H
17 #include "llvm/CodeGen/MachineConstantPool.h"
29 /// ARMConstantPoolValue - ARM specific constantpool value. This is used to
30 /// represent PC relative displacement between the address of the load
31 /// instruction and the global value being loaded, i.e. (&GV-(LPIC+8)).
32 class ARMConstantPoolValue : public MachineConstantPoolValue {
33 GlobalValue *GV; // GlobalValue being loaded.
34 const char *S; // ExtSymbol being loaded.
35 unsigned LabelId; // Label id of the load.
36 ARMCP::ARMCPKind Kind; // non_lazy_ptr or stub?
37 unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative.
38 // 8 for ARM, 4 for Thumb.
41 ARMConstantPoolValue(GlobalValue *gv, unsigned id,
42 ARMCP::ARMCPKind Kind = ARMCP::CPValue,
43 unsigned char PCAdj = 0);
44 ARMConstantPoolValue(const char *s, unsigned id,
45 ARMCP::ARMCPKind Kind = ARMCP::CPValue,
46 unsigned char PCAdj = 0);
48 GlobalValue *getGV() const { return GV; }
49 const char *getSymbol() const { return S; }
50 unsigned getLabelId() const { return LabelId; }
51 bool isNonLazyPointer() const { return Kind == ARMCP::CPNonLazyPtr; }
52 bool isStub() const { return Kind == ARMCP::CPStub; }
53 unsigned char getPCAdjustment() const { return PCAdjust; }
55 virtual int getExistingMachineCPValue(MachineConstantPool *CP,
58 virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID);
60 virtual void print(std::ostream &O) const;