Adding bindings for target triple and data layout.
[oota-llvm.git] / include / llvm / Value.h
index fc65e74c56ea06e190ea9e38728d4c3241190f8b..67af6edb8f98a6475636038f8125b0c5709372eb 100644 (file)
@@ -30,6 +30,7 @@ class BasicBlock;
 class GlobalValue;
 class Function;
 class GlobalVariable;
+class GlobalAlias;
 class InlineAsm;
 class ValueSymbolTable;
 class TypeSymbolTable;
@@ -87,9 +88,23 @@ public:
 
   // All values can potentially be named...
   inline bool hasName() const { return Name != 0; }
+  ValueName *getValueName() const { return Name; }
+
+  /// getNameStart - Return a pointer to a null terminated string for this name.
+  /// Note that names can have null characters within the string as well as at
+  /// their end.  This always returns a non-null pointer.
+  const char *getNameStart() const;
+  
+  /// getNameLen - Return the length of the string, correctly handling nul
+  /// characters embedded into them.
+  unsigned getNameLen() const;
+
+  /// getName()/getNameStr() - Return the name of the specified value, 
+  /// *constructing a string* to hold it.  Because these are guaranteed to
+  /// construct a string, they are very expensive and should be avoided.
   std::string getName() const { return getNameStr(); }
   std::string getNameStr() const;
-  ValueName *getValueName() const { return Name; }
+
 
   void setName(const std::string &name);
   void setName(const char *Name, unsigned NameLen);
@@ -160,6 +175,7 @@ public:
     ArgumentVal,              // This is an instance of Argument
     BasicBlockVal,            // This is an instance of BasicBlock
     FunctionVal,              // This is an instance of Function
+    GlobalAliasVal,           // This is an instance of GlobalAlias
     GlobalVariableVal,        // This is an instance of GlobalVariable
     UndefValueVal,            // This is an instance of UndefValue
     ConstantExprVal,          // This is an instance of ConstantExpr
@@ -248,8 +264,11 @@ template <> inline bool isa_impl<Function, Value>(const Value &Val) {
 template <> inline bool isa_impl<GlobalVariable, Value>(const Value &Val) {
   return Val.getValueID() == Value::GlobalVariableVal;
 }
+template <> inline bool isa_impl<GlobalAlias, Value>(const Value &Val) {
+  return Val.getValueID() == Value::GlobalAliasVal;
+}
 template <> inline bool isa_impl<GlobalValue, Value>(const Value &Val) {
-  return isa<GlobalVariable>(Val) || isa<Function>(Val);
+  return isa<GlobalVariable>(Val) || isa<Function>(Val) || isa<GlobalAlias>(Val);
 }
 
 } // End llvm namespace