Down-scale slot index distance to save bits.
[oota-llvm.git] / include / llvm / IR / GlobalValue.h
index 246e00becfeb8a855925d25bcb12838e49ffb51d..1dc99cfaa412e70b39a70e3c7f95faacfae6a509 100644 (file)
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef LLVM_GLOBALVALUE_H
-#define LLVM_GLOBALVALUE_H
+#ifndef LLVM_IR_GLOBALVALUE_H
+#define LLVM_IR_GLOBALVALUE_H
 
 #include "llvm/IR/Constant.h"
+#include "llvm/IR/DerivedTypes.h"
 
 namespace llvm {
 
@@ -105,7 +106,7 @@ public:
 
   /// getType - Global values are always pointers.
   inline PointerType *getType() const {
-    return reinterpret_cast<PointerType*>(User::getType());
+    return cast<PointerType>(User::getType());
   }
 
   static LinkageTypes getLinkOnceLinkage(bool ODR) {
@@ -238,6 +239,15 @@ public:
   /// create a GlobalValue) from the GlobalValue Src to this one.
   virtual void copyAttributesFrom(const GlobalValue *Src);
 
+  /// getRealLinkageName - If special LLVM prefix that is used to inform the asm
+  /// printer to not emit usual symbol prefix before the symbol name is used
+  /// then return linkage name after skipping this special LLVM prefix.
+  static StringRef getRealLinkageName(StringRef Name) {
+    if (!Name.empty() && Name[0] == '\1')
+      return Name.substr(1);
+    return Name;
+  }
+
 /// @name Materialization
 /// Materialization is used to construct functions only as they're needed. This
 /// is useful to reduce memory usage in LLVM or parsing work done by the