Rename MDNode.h header. It defines MDnode and other metadata classes.

New name is Metadata.h.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77370 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2009-07-28 21:49:47 +00:00
parent 7cc2c406d0
commit 0a9f7b9c3e
21 changed files with 66 additions and 55 deletions

View File

@ -1,4 +1,4 @@
//===-- llvm/Metadata.h - Constant class subclass definitions ---*- C++ -*-===//
//===-- llvm/Metadata.h - Metadata definitions ------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -8,13 +8,8 @@
//===----------------------------------------------------------------------===//
//
/// @file
/// This file contains the declarations for the subclasses of Constant,
/// which represent the different flavors of constant values that live in LLVM.
/// Note that Constants are immutable (once created they never change) and are
/// fully shared by structural equivalence. This means that two structurally
/// equivalent constants will always have the same address. Constant's are
/// created on demand as needed and never deleted: thus clients don't have to
/// worry about the lifetime of the objects.
/// This file contains the declarations for metadata subclasses.
/// They represent the different flavors of metadata that live in LLVM.
//
//===----------------------------------------------------------------------===//

View File

@ -19,7 +19,7 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/Operator.h"
#include "llvm/ValueSymbolTable.h"

View File

@ -18,7 +18,7 @@
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/Operator.h"
#include "llvm/AutoUpgrade.h"

View File

@ -19,7 +19,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/Instructions.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/Operator.h"
#include "llvm/TypeSymbolTable.h"

View File

@ -14,7 +14,7 @@
#include "ValueEnumerator.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/TypeSymbolTable.h"
#include "llvm/ValueSymbolTable.h"

View File

@ -21,7 +21,7 @@
#include "ARMMachineFunctionInfo.h"
#include "llvm/Constants.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineModuleInfo.h"

View File

@ -17,7 +17,7 @@
#include "AlphaInstrInfo.h"
#include "AlphaTargetMachine.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Type.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/AsmPrinter.h"

View File

@ -19,7 +19,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"

View File

@ -22,7 +22,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"

View File

@ -24,7 +24,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"

View File

@ -19,7 +19,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DwarfWriter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"

View File

@ -23,7 +23,7 @@
#include "llvm/CallingConv.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Type.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"

View File

@ -19,7 +19,7 @@
#include "llvm/GlobalValue.h"
#include "llvm/Instruction.h"
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;

View File

@ -24,7 +24,7 @@
#include "llvm/Instruction.h"
#include "llvm/Instructions.h"
#include "llvm/Operator.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/TypeSymbolTable.h"

View File

@ -17,6 +17,7 @@ add_llvm_library(LLVMCore
LLVMContextImpl.cpp
LeakDetector.cpp
Mangler.cpp
Metadata.cpp
Module.cpp
ModuleProvider.cpp
Pass.cpp

View File

@ -17,7 +17,6 @@
#include "llvm/DerivedTypes.h"
#include "llvm/GlobalValue.h"
#include "llvm/Instructions.h"
#include "llvm/MDNode.h"
#include "llvm/Module.h"
#include "llvm/Operator.h"
#include "llvm/ADT/FoldingSet.h"
@ -1225,20 +1224,6 @@ void UndefValue::destroyConstant() {
destroyConstantImpl();
}
//---- MDNode::get() implementation
//
MDNode::MDNode(Value*const* Vals, unsigned NumVals)
: MetadataBase(Type::MetadataTy, Value::MDNodeVal) {
for (unsigned i = 0; i != NumVals; ++i)
Node.push_back(WeakVH(Vals[i]));
}
void MDNode::Profile(FoldingSetNodeID &ID) const {
for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I)
ID.AddPointer(*I);
}
//---- ConstantExpr::get() implementations...
//
@ -2296,18 +2281,3 @@ void ConstantExpr::replaceUsesOfWithOnConstant(Value *From, Value *ToV,
destroyConstant();
}
void MDNode::replaceElement(Value *From, Value *To) {
SmallVector<Value*, 4> Values;
Values.reserve(getNumElements()); // Build replacement array...
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
Value *Val = getElement(i);
if (Val == From) Val = To;
Values.push_back(Val);
}
MDNode *Replacement =
getType()->getContext().getMDNode(&Values[0], Values.size());
assert(Replacement != this && "I didn't contain From!");
uncheckedReplaceAllUsesWith(Replacement);
}

View File

@ -16,7 +16,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instruction.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Support/ManagedStatic.h"
#include "LLVMContextImpl.h"
#include <cstdarg>

View File

@ -16,7 +16,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/LLVMContext.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
using namespace llvm;
static char getValType(ConstantAggregateZero *CPZ) { return 0; }

45
lib/VMCore/Metadata.cpp Normal file
View File

@ -0,0 +1,45 @@
//===-- Metadata.cpp - Implement Metadata classes -------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the Metadata classes.
//
//===----------------------------------------------------------------------===//
#include "llvm/Metadata.h"
using namespace llvm;
//===----------------------------------------------------------------------===//
//MDNode implementation
//
MDNode::MDNode(Value*const* Vals, unsigned NumVals)
: MetadataBase(Type::MetadataTy, Value::MDNodeVal) {
for (unsigned i = 0; i != NumVals; ++i)
Node.push_back(WeakVH(Vals[i]));
}
void MDNode::Profile(FoldingSetNodeID &ID) const {
for (const_elem_iterator I = elem_begin(), E = elem_end(); I != E; ++I)
ID.AddPointer(*I);
}
void MDNode::replaceElement(Value *From, Value *To) {
SmallVector<Value*, 4> Values;
Values.reserve(getNumElements()); // Build replacement array...
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
Value *Val = getElement(i);
if (Val == From) Val = To;
Values.push_back(Val);
}
MDNode *Replacement =
getType()->getContext().getMDNode(&Values[0], Values.size());
assert(Replacement != this && "I didn't contain From!");
uncheckedReplaceAllUsesWith(Replacement);
}

View File

@ -18,7 +18,7 @@
#include "llvm/Instructions.h"
#include "llvm/Operator.h"
#include "llvm/Module.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Debug.h"

View File

@ -45,7 +45,7 @@
#include "llvm/DerivedTypes.h"
#include "llvm/InlineAsm.h"
#include "llvm/IntrinsicInst.h"
#include "llvm/MDNode.h"
#include "llvm/Metadata.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Pass.h"