Introduce MetadataBase, a base class for MDString and MDNode.

Derive MDString directly from MetadataBase. 
Introduce new bitcode block to hold metadata.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76759 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel
2009-07-22 17:43:22 +00:00
parent dbe77cfa0b
commit e54abc90fe
16 changed files with 231 additions and 130 deletions

View File

@@ -715,58 +715,6 @@ public:
return V->getValueID() == UndefValueVal;
}
};
//===----------------------------------------------------------------------===//
/// MDString - a single uniqued string.
/// These are used to efficiently contain a byte sequence for metadata.
///
class MDString : public Constant {
MDString(const MDString &); // DO NOT IMPLEMENT
void *operator new(size_t, unsigned); // DO NOT IMPLEMENT
MDString(const char *begin, const char *end);
const char *StrBegin, *StrEnd;
friend class LLVMContextImpl;
protected:
// allocate space for exactly zero operands
void *operator new(size_t s) {
return User::operator new(s, 0);
}
public:
/// size() - The length of this string.
///
intptr_t size() const { return StrEnd - StrBegin; }
/// begin() - Pointer to the first byte of the string.
///
const char *begin() const { return StrBegin; }
/// end() - Pointer to one byte past the end of the string.
///
const char *end() const { return StrEnd; }
/// getType() specialization - Type is always MetadataTy.
///
inline const Type *getType() const {
return Type::MetadataTy;
}
/// isNullValue - Return true if this is the value that would be returned by
/// getNullValue. This always returns false because getNullValue will never
/// produce metadata.
virtual bool isNullValue() const {
return false;
}
virtual void destroyConstant();
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const MDString *) { return true; }
static bool classof(const Value *V) {
return V->getValueID() == MDStringVal;
}
};
} // End llvm namespace
#endif