[llvm-commits] [llvm] r94243 - in /llvm/trunk: include/llvm/Metadata.h lib/AsmParser/LLParser.h lib/Bitcode/Writer/ValueEnumerator.cpp lib/Bitcode/Writer/ValueEnumerator.h lib/CodeGen/AsmPrinter/DwarfDebug.cpp lib/Linker/LinkModules.cpp lib/VMCore/Metadata.cpp
Devang Patel
dpatel at apple.com
Fri Jan 22 14:52:10 PST 2010
Author: dpatel
Date: Fri Jan 22 16:52:10 2010
New Revision: 94243
URL: http://llvm.org/viewvc/llvm-project?rev=94243&view=rev
Log:
Remove MetadataBase class because it is not adding significant value.
Modified:
llvm/trunk/include/llvm/Metadata.h
llvm/trunk/lib/AsmParser/LLParser.h
llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp
llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/Linker/LinkModules.cpp
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/include/llvm/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Metadata.h?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Metadata.h (original)
+++ llvm/trunk/include/llvm/Metadata.h Fri Jan 22 16:52:10 2010
@@ -31,26 +31,10 @@
//===----------------------------------------------------------------------===//
-// MetadataBase - A base class for MDNode and MDString.
-class MetadataBase : public Value {
-protected:
- MetadataBase(const Type *Ty, unsigned scid)
- : Value(Ty, scid) {}
-
-public:
-
- /// Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const MetadataBase *) { return true; }
- static bool classof(const Value *V) {
- return V->getValueID() == MDStringVal || V->getValueID() == MDNodeVal;
- }
-};
-
-//===----------------------------------------------------------------------===//
/// MDString - a single uniqued string.
/// These are used to efficiently contain a byte sequence for metadata.
/// MDString is always unnamd.
-class MDString : public MetadataBase {
+class MDString : public Value {
MDString(const MDString &); // DO NOT IMPLEMENT
StringRef Str;
@@ -87,7 +71,7 @@
//===----------------------------------------------------------------------===//
/// MDNode - a tuple of other values.
-class MDNode : public MetadataBase, public FoldingSetNode {
+class MDNode : public Value, public FoldingSetNode {
MDNode(const MDNode &); // DO NOT IMPLEMENT
void operator=(const MDNode &); // DO NOT IMPLEMENT
friend class MDNodeOperand;
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Fri Jan 22 16:52:10 2010
@@ -29,7 +29,6 @@
class Instruction;
class Constant;
class GlobalValue;
- class MetadataBase;
class MDString;
class MDNode;
Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp (original)
+++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.cpp Fri Jan 22 16:52:10 2010
@@ -140,7 +140,7 @@
}
unsigned ValueEnumerator::getValueID(const Value *V) const {
- if (isa<MetadataBase>(V)) {
+ if (isa<MDNode>(V) || isa<MDString>(V)) {
ValueMapType::const_iterator I = MDValueMap.find(V);
assert(I != MDValueMap.end() && "Value not in slotcalculator!");
return I->second-1;
@@ -229,7 +229,8 @@
MDValueMap[MD] = Values.size();
}
-void ValueEnumerator::EnumerateMetadata(const MetadataBase *MD) {
+void ValueEnumerator::EnumerateMetadata(const Value *MD) {
+ assert(isa<MDNode>(MD) || isa<MDString>(MD) && "Invalid metadata kind");
// Check to see if it's already in!
unsigned &MDValueID = MDValueMap[MD];
if (MDValueID) {
@@ -262,8 +263,8 @@
void ValueEnumerator::EnumerateValue(const Value *V) {
assert(!V->getType()->isVoidTy() && "Can't insert void values!");
- if (const MetadataBase *MB = dyn_cast<MetadataBase>(V))
- return EnumerateMetadata(MB);
+ if (isa<MDNode>(V) || isa<MDString>(V))
+ return EnumerateMetadata(V);
else if (const NamedMDNode *NMD = dyn_cast<NamedMDNode>(V))
return EnumerateNamedMDNode(NMD);
Modified: llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h (original)
+++ llvm/trunk/lib/Bitcode/Writer/ValueEnumerator.h Fri Jan 22 16:52:10 2010
@@ -127,7 +127,7 @@
private:
void OptimizeConstants(unsigned CstStart, unsigned CstEnd);
- void EnumerateMetadata(const MetadataBase *MD);
+ void EnumerateMetadata(const Value *MD);
void EnumerateNamedMDNode(const NamedMDNode *NMD);
void EnumerateValue(const Value *V);
void EnumerateType(const Type *T);
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Jan 22 16:52:10 2010
@@ -1910,8 +1910,7 @@
MachineModuleInfo::VariableDbgInfoMapTy &VMap = MMI->getVariableDbgInfo();
for (MachineModuleInfo::VariableDbgInfoMapTy::iterator VI = VMap.begin(),
VE = VMap.end(); VI != VE; ++VI) {
- MetadataBase *MB = VI->first;
- MDNode *Var = dyn_cast_or_null<MDNode>(MB);
+ MDNode *Var = VI->first;
if (!Var) continue;
DIVariable DV (Var);
std::pair< unsigned, MDNode *> VP = VI->second;
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Fri Jan 22 16:52:10 2010
@@ -392,7 +392,7 @@
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
llvm_unreachable("Unknown type of derived type constant value!");
}
- } else if (isa<MetadataBase>(In)) {
+ } else if (isa<MDNode>(In) || isa<MDString>(In)) {
Result = const_cast<Value*>(In);
} else if (isa<InlineAsm>(In)) {
Result = const_cast<Value*>(In);
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=94243&r1=94242&r2=94243&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Fri Jan 22 16:52:10 2010
@@ -28,7 +28,7 @@
//
MDString::MDString(LLVMContext &C, StringRef S)
- : MetadataBase(Type::getMetadataTy(C), Value::MDStringVal), Str(S) {}
+ : Value(Type::getMetadataTy(C), Value::MDStringVal), Str(S) {}
MDString *MDString::get(LLVMContext &Context, StringRef Str) {
LLVMContextImpl *pImpl = Context.pImpl;
@@ -93,7 +93,7 @@
MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
bool isFunctionLocal)
-: MetadataBase(Type::getMetadataTy(C), Value::MDNodeVal) {
+: Value(Type::getMetadataTy(C), Value::MDNodeVal) {
NumOperands = NumVals;
if (isFunctionLocal)
More information about the llvm-commits
mailing list