diff options
author | Devang Patel <dpatel@apple.com> | 2009-07-28 21:49:47 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2009-07-28 21:49:47 +0000 |
commit | 0a9f7b9c3ebe7d0ec033462e1a7c9101279956f9 (patch) | |
tree | 9bddc13cdc61792a453dbcf675fd2ab642545d5d /lib | |
parent | 7cc2c406d0c82bcf329048ced643ec77fcae60e6 (diff) | |
download | external_llvm-0a9f7b9c3ebe7d0ec033462e1a7c9101279956f9.zip external_llvm-0a9f7b9c3ebe7d0ec033462e1a7c9101279956f9.tar.gz external_llvm-0a9f7b9c3ebe7d0ec033462e1a7c9101279956f9.tar.bz2 |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AsmParser/LLParser.cpp | 2 | ||||
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 2 | ||||
-rw-r--r-- | lib/Bitcode/Writer/BitcodeWriter.cpp | 2 | ||||
-rw-r--r-- | lib/Bitcode/Writer/ValueEnumerator.cpp | 2 | ||||
-rw-r--r-- | lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp | 2 | ||||
-rw-r--r-- | lib/Transforms/Utils/ValueMapper.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/AsmWriter.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lib/VMCore/Constants.cpp | 30 | ||||
-rw-r--r-- | lib/VMCore/LLVMContext.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/LLVMContextImpl.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Metadata.cpp | 45 | ||||
-rw-r--r-- | lib/VMCore/Value.cpp | 2 | ||||
-rw-r--r-- | lib/VMCore/Verifier.cpp | 2 |
20 files changed, 63 insertions, 47 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 4302537..b2d2b51 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -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" diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index ed2e303..21c4e69 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -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" diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index fd09ede..eb634ef 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -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" diff --git a/lib/Bitcode/Writer/ValueEnumerator.cpp b/lib/Bitcode/Writer/ValueEnumerator.cpp index 38784ec..302791a 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.cpp +++ b/lib/Bitcode/Writer/ValueEnumerator.cpp @@ -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" diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp index d82b758..c7f9383 100644 --- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp +++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp @@ -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" diff --git a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp index a37dee7..a88396c 100644 --- a/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp +++ b/lib/Target/Alpha/AsmPrinter/AlphaAsmPrinter.cpp @@ -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" diff --git a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp index e53543c..bdf0808 100644 --- a/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp +++ b/lib/Target/CellSPU/AsmPrinter/SPUAsmPrinter.cpp @@ -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" diff --git a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp index d0f0487..d1fec14 100644 --- a/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp +++ b/lib/Target/Mips/AsmPrinter/MipsAsmPrinter.cpp @@ -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" diff --git a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp index a1b0780..97d4f7a 100644 --- a/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp +++ b/lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp @@ -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" diff --git a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp index 7569eee..a4eba87 100644 --- a/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp +++ b/lib/Target/Sparc/AsmPrinter/SparcAsmPrinter.cpp @@ -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" diff --git a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp index a93510b..4b6fe36 100644 --- a/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp +++ b/lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp @@ -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" diff --git a/lib/Transforms/Utils/ValueMapper.cpp b/lib/Transforms/Utils/ValueMapper.cpp index 3bef812..2d8332f 100644 --- a/lib/Transforms/Utils/ValueMapper.cpp +++ b/lib/Transforms/Utils/ValueMapper.cpp @@ -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; diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp index 8242d81..f813d85 100644 --- a/lib/VMCore/AsmWriter.cpp +++ b/lib/VMCore/AsmWriter.cpp @@ -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" diff --git a/lib/VMCore/CMakeLists.txt b/lib/VMCore/CMakeLists.txt index a1f7ab1..b263449 100644 --- a/lib/VMCore/CMakeLists.txt +++ b/lib/VMCore/CMakeLists.txt @@ -17,6 +17,7 @@ add_llvm_library(LLVMCore LLVMContextImpl.cpp LeakDetector.cpp Mangler.cpp + Metadata.cpp Module.cpp ModuleProvider.cpp Pass.cpp diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp index 31a82e5..92b76b9 100644 --- a/lib/VMCore/Constants.cpp +++ b/lib/VMCore/Constants.cpp @@ -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); -} diff --git a/lib/VMCore/LLVMContext.cpp b/lib/VMCore/LLVMContext.cpp index 14a891f..30343dc 100644 --- a/lib/VMCore/LLVMContext.cpp +++ b/lib/VMCore/LLVMContext.cpp @@ -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> diff --git a/lib/VMCore/LLVMContextImpl.cpp b/lib/VMCore/LLVMContextImpl.cpp index 5efc1eb..23d8ca3 100644 --- a/lib/VMCore/LLVMContextImpl.cpp +++ b/lib/VMCore/LLVMContextImpl.cpp @@ -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; } diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp new file mode 100644 index 0000000..a7d69a4 --- /dev/null +++ b/lib/VMCore/Metadata.cpp @@ -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); +} diff --git a/lib/VMCore/Value.cpp b/lib/VMCore/Value.cpp index 10e62ff..af13973 100644 --- a/lib/VMCore/Value.cpp +++ b/lib/VMCore/Value.cpp @@ -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" diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp index f900dca..06bc9e7 100644 --- a/lib/VMCore/Verifier.cpp +++ b/lib/VMCore/Verifier.cpp @@ -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" |