Evan Cheng | a8e2989 | 2007-01-19 07:51:42 +0000 | [diff] [blame^] | 1 | //===- ARMConstantPoolValue.h - ARM constantpool value ----------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 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. |
| 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 | /// ARMConstantPoolValue - ARM specific constantpool value. This is used to |
| 22 | /// represent PC relative displacement between the address of the load |
| 23 | /// instruction and the global value being loaded, i.e. (&GV-(LPIC+8)). |
| 24 | class ARMConstantPoolValue : public MachineConstantPoolValue { |
| 25 | GlobalValue *GV; // GlobalValue being loaded. |
| 26 | unsigned LabelId; // Label id of the load. |
| 27 | bool isNonLazyPtr; // True if loading a Mac OS X non_lazy_ptr stub. |
| 28 | unsigned char PCAdjust; // Extra adjustment if constantpool is pc relative. |
| 29 | // 8 for ARM, 4 for Thumb. |
| 30 | |
| 31 | public: |
| 32 | ARMConstantPoolValue(GlobalValue *gv, unsigned id, bool isNonLazy = false, |
| 33 | unsigned char PCAdj = 0); |
| 34 | |
| 35 | GlobalValue *getGV() const { return GV; } |
| 36 | unsigned getLabelId() const { return LabelId; } |
| 37 | bool isNonLazyPointer() const { return isNonLazyPtr; } |
| 38 | unsigned char getPCAdjustment() const { return PCAdjust; } |
| 39 | |
| 40 | virtual int getExistingMachineCPValue(MachineConstantPool *CP, |
| 41 | unsigned Alignment); |
| 42 | |
| 43 | virtual void AddSelectionDAGCSEId(FoldingSetNodeID &ID); |
| 44 | |
| 45 | virtual void print(std::ostream &O) const; |
| 46 | }; |
| 47 | |
| 48 | } |
| 49 | |
| 50 | #endif |