[llvm-commits] [llvm] r83016 - in /llvm/trunk: include/llvm/Metadata.h include/llvm/Support/IRBuilder.h lib/AsmParser/LLParser.cpp lib/AsmParser/LLParser.h lib/Bitcode/Reader/BitcodeReader.cpp lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp lib/VMCore/Metadata.cpp
Devang Patel
dpatel at apple.com
Mon Sep 28 14:14:56 PDT 2009
Author: dpatel
Date: Mon Sep 28 16:14:55 2009
New Revision: 83016
URL: http://llvm.org/viewvc/llvm-project?rev=83016&view=rev
Log:
Do not use global typedef for MDKindID.
Modified:
llvm/trunk/include/llvm/Metadata.h
llvm/trunk/include/llvm/Support/IRBuilder.h
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/AsmParser/LLParser.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.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=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Metadata.h (original)
+++ llvm/trunk/include/llvm/Metadata.h Mon Sep 28 16:14:55 2009
@@ -307,13 +307,9 @@
/// Metadata -
/// Metadata manages metadata used in a context.
-/// MDKindID - This id identifies metadata kind the metadata store. Valid
-/// ID values are 1 or higher. This ID is set by RegisterMDKind.
-typedef unsigned MDKindID;
-
class Metadata {
public:
- typedef std::pair<MDKindID, WeakVH> MDPairTy;
+ typedef std::pair<unsigned, WeakVH> MDPairTy;
typedef SmallVector<MDPairTy, 2> MDMapTy;
typedef DenseMap<const Instruction *, MDMapTy> MDStoreTy;
friend class BitcodeReader;
@@ -328,21 +324,21 @@
public:
/// RegisterMDKind - Register a new metadata kind and return its ID.
/// A metadata kind can be registered only once.
- MDKindID RegisterMDKind(const char *Name);
+ unsigned RegisterMDKind(const char *Name);
/// getMDKind - Return metadata kind. If the requested metadata kind
/// is not registered then return 0.
- MDKindID getMDKind(const char *Name);
+ unsigned getMDKind(const char *Name);
/// getMD - Get the metadata of given kind attached with an Instruction.
/// If the metadata is not found then return 0.
- MDNode *getMD(MDKindID Kind, const Instruction *Inst);
+ MDNode *getMD(unsigned Kind, const Instruction *Inst);
/// getMDs - Get the metadata attached with an Instruction.
const MDMapTy *getMDs(const Instruction *Inst);
/// setMD - Attach the metadata of given kind with an Instruction.
- void setMD(MDKindID Kind, MDNode *Node, Instruction *Inst);
+ void setMD(unsigned Kind, MDNode *Node, Instruction *Inst);
/// getHandlerNames - Get handler names. This is used by bitcode
/// writer.
Modified: llvm/trunk/include/llvm/Support/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/IRBuilder.h?rev=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/Support/IRBuilder.h Mon Sep 28 16:14:55 2009
@@ -61,7 +61,7 @@
class IRBuilder : public Inserter {
BasicBlock *BB;
BasicBlock::iterator InsertPt;
- MDKindID MDKind;
+ unsigned MDKind;
MDNode *CurDbgLocation;
LLVMContext &Context;
T Folder;
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Sep 28 16:14:55 2009
@@ -2657,7 +2657,7 @@
// Set metadata attached with this instruction.
Metadata &TheMetadata = M->getContext().getMetadata();
- for (SmallVector<std::pair<MDKindID, MDNode *>, 2>::iterator
+ for (SmallVector<std::pair<unsigned, MDNode *>, 2>::iterator
MDI = MDsOnInst.begin(), MDE = MDsOnInst.end(); MDI != MDE; ++MDI)
TheMetadata.setMD(MDI->first, MDI->second, Inst);
MDsOnInst.clear();
Modified: llvm/trunk/lib/AsmParser/LLParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.h?rev=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.h (original)
+++ llvm/trunk/lib/AsmParser/LLParser.h Mon Sep 28 16:14:55 2009
@@ -48,7 +48,7 @@
/// MetadataCache - This map keeps track of parsed metadata constants.
std::map<unsigned, MetadataBase *> MetadataCache;
std::map<unsigned, std::pair<MetadataBase *, LocTy> > ForwardRefMDNodes;
- SmallVector<std::pair<MDKindID, MDNode *>, 2> MDsOnInst;
+ SmallVector<std::pair<unsigned, MDNode *>, 2> MDsOnInst;
struct UpRefRecord {
/// Loc - This is the location of the upref.
LocTy Loc;
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Mon Sep 28 16:14:55 2009
@@ -836,7 +836,7 @@
return Error("Invalid METADATA_KIND record");
SmallString<8> Name;
Name.resize(RecordLength-1);
- MDKindID Kind = Record[0];
+ unsigned Kind = Record[0];
for (unsigned i = 1; i != RecordLength; ++i)
Name[i-1] = Record[i];
Metadata &TheMetadata = Context.getMetadata();
@@ -1580,7 +1580,7 @@
return Error ("Invalid METADATA_ATTACHMENT reader!");
Instruction *Inst = InstructionList[Record[0]];
for (unsigned i = 1; i != RecordLength; i = i+2) {
- MDKindID Kind = Record[i];
+ unsigned Kind = Record[i];
Value *Node = MDValueList.getValueFwdRef(Record[i+1]);
TheMetadata.setMD(Kind, cast<MDNode>(Node), Inst);
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Sep 28 16:14:55 2009
@@ -373,7 +373,7 @@
BasicBlock::iterator End) {
SDL->setCurrentBasicBlock(BB);
Metadata &TheMetadata = LLVMBB->getParent()->getContext().getMetadata();
- MDKindID MDDbgKind = TheMetadata.getMDKind("dbg");
+ unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
// Lower all of the non-terminator instructions. If a call is emitted
// as a tail call, cease emitting nodes for this block.
@@ -656,7 +656,7 @@
);
Metadata &TheMetadata = Fn.getContext().getMetadata();
- MDKindID MDDbgKind = TheMetadata.getMDKind("dbg");
+ unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
// Iterate over all basic blocks in the function.
for (Function::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) {
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=83016&r1=83015&r2=83016&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Sep 28 16:14:55 2009
@@ -259,8 +259,8 @@
/// RegisterMDKind - Register a new metadata kind and return its ID.
/// A metadata kind can be registered only once.
-MDKindID Metadata::RegisterMDKind(const char *Name) {
- MDKindID Count = MDHandlerNames.size();
+unsigned Metadata::RegisterMDKind(const char *Name) {
+ unsigned Count = MDHandlerNames.size();
StringMap<unsigned>::iterator I = MDHandlerNames.find(Name);
assert(I == MDHandlerNames.end() && "Already registered MDKind!");
MDHandlerNames[Name] = Count + 1;
@@ -269,7 +269,7 @@
/// getMDKind - Return metadata kind. If the requested metadata kind
/// is not registered then return 0.
-MDKindID Metadata::getMDKind(const char *Name) {
+unsigned Metadata::getMDKind(const char *Name) {
StringMap<unsigned>::iterator I = MDHandlerNames.find(Name);
if (I == MDHandlerNames.end())
return 0;
@@ -278,7 +278,7 @@
}
/// setMD - Attach the metadata of given kind with an Instruction.
-void Metadata::setMD(MDKindID MDKind, MDNode *Node, Instruction *Inst) {
+void Metadata::setMD(unsigned MDKind, MDNode *Node, Instruction *Inst) {
MDStoreTy::iterator I = MetadataStore.find(Inst);
Inst->HasMetadata = true;
if (I == MetadataStore.end()) {
@@ -295,7 +295,7 @@
/// getMD - Get the metadata of given kind attached with an Instruction.
/// If the metadata is not found then return 0.
-MDNode *Metadata::getMD(MDKindID MDKind, const Instruction *Inst) {
+MDNode *Metadata::getMD(unsigned MDKind, const Instruction *Inst) {
MDNode *Node = NULL;
MDStoreTy::iterator I = MetadataStore.find(Inst);
if (I == MetadataStore.end())
More information about the llvm-commits
mailing list