1 //===- PIC16ConstantPoolValue.h - PIC16 constantpool value ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the PIC16 specific constantpool value class.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_TARGET_PIC16_CONSTANTPOOLVALUE_H
15 #define LLVM_TARGET_PIC16_CONSTANTPOOLVALUE_H
17 #include "llvm/CodeGen/MachineConstantPool.h"
31 /// PIC16ConstantPoolValue - PIC16 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 PIC16ConstantPoolValue : public MachineConstantPoolValue {
35 GlobalValue *GV; // GlobalValue being loaded.
36 const char *S; // ExtSymbol being loaded.
37 unsigned LabelId; // Label id of the load.
38 PIC16CP::PIC16CPKind Kind; // non_lazy_ptr or stub?
39 unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative.
41 const char *Modifier; // GV modifier i.e. (&GV(modifier)-(LPIC+8))
42 bool AddCurrentAddress;
45 PIC16ConstantPoolValue(GlobalValue *gv, unsigned id,
46 PIC16CP::PIC16CPKind Kind = PIC16CP::CPValue,
47 unsigned char PCAdj = 0, const char *Modifier = NULL,
48 bool AddCurrentAddress = false);
49 PIC16ConstantPoolValue(const char *s, unsigned id,
50 PIC16CP::PIC16CPKind Kind = PIC16CP::CPValue,
51 unsigned char PCAdj = 0, const char *Modifier = NULL,
52 bool AddCurrentAddress = false);
53 PIC16ConstantPoolValue(GlobalValue *GV, PIC16CP::PIC16CPKind Kind,
54 const char *Modifier);
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 == PIC16CP::CPNonLazyPtr; }
64 bool isStub() const { return Kind == PIC16CP::CPStub; }
65 unsigned char getPCAdjustment() const { return PCAdjust; }
67 virtual int getExistingMachineCPValue(MachineConstantPool *CP,
70 virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID);
72 virtual void print(raw_ostream &O) const;