Add an ARMConstantPool class for external symbols. This will split out the support...
[oota-llvm.git] / lib / Target / ARM / ARMConstantPoolValue.h
index fea43790c0e6e86607669e2af9f1fe99b28a3ed4..4ced33ab2c3725a16f8eb58337605650e78bc9c3 100644 (file)
@@ -63,6 +63,9 @@ protected:
                        unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
                        bool AddCurrentAddress);
 
+  ARMConstantPoolValue(LLVMContext &C, unsigned id, ARMCP::ARMCPKind Kind,
+                       unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
+                       bool AddCurrentAddress);
 public:
   ARMConstantPoolValue(LLVMContext &C, const MachineBasicBlock *mbb,unsigned id,
                        ARMCP::ARMCPKind Kind = ARMCP::CPValue,
@@ -73,7 +76,7 @@ public:
                        unsigned char PCAdj = 0,
                        ARMCP::ARMCPModifier Modifier = ARMCP::no_modifier,
                        bool AddCurrentAddress = false);
-  ~ARMConstantPoolValue();
+  virtual ~ARMConstantPoolValue();
 
   const char *getSymbol() const { return S; }
   const MachineBasicBlock *getMBB() const;
@@ -166,6 +169,42 @@ public:
   static bool classof(const ARMConstantPoolConstant *) { return true; }
 };
 
+/// ARMConstantPoolSymbol - ARM-specific constantpool values for external
+/// symbols.
+class ARMConstantPoolSymbol : public ARMConstantPoolValue {
+  const char *S;                // ExtSymbol being loaded.
+
+  ARMConstantPoolSymbol(LLVMContext &C, const char *s, unsigned id,
+                        unsigned char PCAdj, ARMCP::ARMCPModifier Modifier,
+                        bool AddCurrentAddress);
+
+public:
+  ~ARMConstantPoolSymbol();
+
+  static ARMConstantPoolSymbol *Create(LLVMContext &C, const char *s,
+                                       unsigned ID, unsigned char PCAdj,
+                                       ARMCP::ARMCPModifier Modifier,
+                                       bool AddCurrentAddress);
+
+  const char *getSymbol() const { return S; }
+
+  virtual int getExistingMachineCPValue(MachineConstantPool *CP,
+                                        unsigned Alignment);
+
+  virtual void addSelectionDAGCSEId(FoldingSetNodeID &ID);
+
+  /// hasSameValue - Return true if this ARM constpool value can share the same
+  /// constantpool entry as another ARM constpool value.
+  virtual bool hasSameValue(ARMConstantPoolValue *ACPV);
+
+  virtual void print(raw_ostream &O) const;
+
+  static bool classof(const ARMConstantPoolValue *ACPV) {
+    return ACPV->isExtSymbol();
+  }
+  static bool classof(const ARMConstantPoolSymbol *) { return true; }
+};
+
 } // End llvm namespace
 
 #endif