aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-29 09:01:33 +0000
committerChris Lattner <sabre@nondot.org>2009-12-29 09:01:33 +0000
commit081134741b40b342fb2f85722c9cea5d412489a8 (patch)
tree73cd43fda7814ed745c3c31de92ff8c7bbf93721 /include
parente3e38ea9fb70cbd8cc33111589c92c0a61674679 (diff)
downloadexternal_llvm-081134741b40b342fb2f85722c9cea5d412489a8.zip
external_llvm-081134741b40b342fb2f85722c9cea5d412489a8.tar.gz
external_llvm-081134741b40b342fb2f85722c9cea5d412489a8.tar.bz2
Final step in the metadata API restructuring: move the
getMDKindID/getMDKindNames methods to LLVMContext (and add convenience methods to Module), eliminating MetadataContext. Move the state that it maintains out to LLVMContext. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92259 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instruction.h2
-rw-r--r--include/llvm/LLVMContext.h20
-rw-r--r--include/llvm/Metadata.h23
-rw-r--r--include/llvm/Module.h11
-rw-r--r--include/llvm/Value.h1
5 files changed, 25 insertions, 32 deletions
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index d7161cf..d45da97 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -22,7 +22,6 @@ namespace llvm {
class LLVMContext;
class MDNode;
-class MetadataContextImpl;
template<typename ValueSubClass, typename ItemParentClass>
class SymbolTableListTraits;
@@ -316,7 +315,6 @@ private:
return Value::getSubclassDataFromValue();
}
- friend class MetadataContextImpl;
void setHasMetadata(bool V) {
setValueSubclassData((getSubclassDataFromValue() & ~HasMetadataBit) |
(V ? HasMetadataBit : 0));
diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h
index b9ffeb0..6d36d5e 100644
--- a/include/llvm/LLVMContext.h
+++ b/include/llvm/LLVMContext.h
@@ -18,7 +18,8 @@
namespace llvm {
class LLVMContextImpl;
-class MetadataContext;
+class StringRef;
+template <typename T> class SmallVectorImpl;
/// This is an important class for using LLVM in a threaded context. It
/// (opaquely) owns and manages the core "global" data of LLVM's core
@@ -31,14 +32,23 @@ class LLVMContext {
void operator=(LLVMContext&);
public:
- LLVMContextImpl* const pImpl;
- MetadataContext &getMetadata();
+ LLVMContextImpl *const pImpl;
LLVMContext();
~LLVMContext();
+
+ /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
+ /// This ID is uniqued across modules in the current LLVMContext.
+ unsigned getMDKindID(StringRef Name) const;
+
+ /// getMDKindNames - Populate client supplied SmallVector with the name for
+ /// custom metadata IDs registered in this LLVMContext. ID #0 is not used,
+ /// so it is filled in as an empty string.
+ void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
};
-/// FOR BACKWARDS COMPATIBILITY - Returns a global context.
-extern LLVMContext& getGlobalContext();
+/// getGlobalContext - Returns a global context. This is for LLVM clients that
+/// only care about operating on a single thread.
+extern LLVMContext &getGlobalContext();
}
diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h
index c25ce22..86eba35 100644
--- a/include/llvm/Metadata.h
+++ b/include/llvm/Metadata.h
@@ -25,7 +25,6 @@ class Constant;
class Instruction;
class LLVMContext;
class Module;
-class MetadataContextImpl;
template <typename T> class SmallVectorImpl;
//===----------------------------------------------------------------------===//
@@ -204,28 +203,6 @@ public:
}
};
-//===----------------------------------------------------------------------===//
-/// MetadataContext - MetadataContext handles uniquing and assignment of IDs for
-/// custom metadata types.
-///
-class MetadataContext {
- MetadataContext(MetadataContext&); // DO NOT IMPLEMENT
- void operator=(MetadataContext&); // DO NOT IMPLEMENT
-
- MetadataContextImpl *const pImpl;
- friend class Instruction;
-public:
- MetadataContext();
- ~MetadataContext();
-
- /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
- unsigned getMDKindID(StringRef Name) const;
-
- /// getMDKindNames - Populate client supplied SmallVector with the name for
- /// each custom metadata ID. ID #0 is not used, so it is filled in as empty.
- void getMDKindNames(SmallVectorImpl<StringRef> &) const;
-};
-
} // end llvm namespace
#endif
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index 895ee01..9a8b53a 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -184,7 +184,7 @@ public:
/// Get the global data context.
/// @returns LLVMContext - a container for LLVM's global information
- LLVMContext& getContext() const { return Context; }
+ LLVMContext &getContext() const { return Context; }
/// Get any module-scope inline assembly blocks.
/// @returns a string containing the module-scope inline assembly blocks.
@@ -222,6 +222,15 @@ public:
/// if a global with the specified name is not found.
GlobalValue *getNamedValue(StringRef Name) const;
+ /// getMDKindID - Return a unique non-zero ID for the specified metadata kind.
+ /// This ID is uniqued across modules in the current LLVMContext.
+ unsigned getMDKindID(StringRef Name) const;
+
+ /// getMDKindNames - Populate client supplied SmallVector with the name for
+ /// custom metadata IDs registered in this LLVMContext. ID #0 is not used,
+ /// so it is filled in as an empty string.
+ void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
+
/// @}
/// @name Function Accessors
/// @{
diff --git a/include/llvm/Value.h b/include/llvm/Value.h
index 1be6ffd..4d94a30 100644
--- a/include/llvm/Value.h
+++ b/include/llvm/Value.h
@@ -41,7 +41,6 @@ class raw_ostream;
class AssemblyAnnotationWriter;
class ValueHandleBase;
class LLVMContext;
-class MetadataContextImpl;
class Twine;
//===----------------------------------------------------------------------===//