aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2013-01-11 15:29:34 -0800
committerDerek Schuff <dschuff@chromium.org>2013-01-11 15:29:34 -0800
commit0590f4264010a852dc22c9afa16a7df4d004c19a (patch)
tree018cedac9a062788c2fdc337165bbabc946b8d29 /include
parentb770d0e0636a4b5ad61b1ca661caee67576c05fc (diff)
Replace DepLibs bitcode record with metadata
It keeps the same Module interface as the existing/old deplibs feature, but populates the library list from the metadata after reading the bitcode/LL into the Module. Keeping the same module interface will allow us to keep the existing uses (e.g. in the gold plugin) as they are. Internally it still uses the LibraryList variable, but uses it basically as a cache backed by the metadata. BUG= Review URL: https://codereview.chromium.org/11615013
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Module.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h
index bf9ac51693..ae66edc5a6 100644
--- a/include/llvm/Module.h
+++ b/include/llvm/Module.h
@@ -21,6 +21,7 @@
#include "llvm/GlobalVariable.h"
#include "llvm/Metadata.h"
#include "llvm/Support/DataTypes.h"
+#include <vector> // @LOCALMOD
namespace llvm {
@@ -120,7 +121,10 @@ public:
typedef iplist<GlobalAlias> AliasListType;
/// The type for the list of named metadata.
typedef ilist<NamedMDNode> NamedMDListType;
-
+ // @LOCALMOD-BEGIN
+ /// The type for the list of dependent libraries.
+ typedef std::vector<std::string> LibraryListType;
+ // @LOCALMOD-END
/// The Global Variable iterator.
typedef GlobalListType::iterator global_iterator;
/// The Global Variable constant iterator.
@@ -140,7 +144,10 @@ public:
typedef NamedMDListType::iterator named_metadata_iterator;
/// The named metadata constant interators.
typedef NamedMDListType::const_iterator const_named_metadata_iterator;
-
+ // @LOCALMOD-BEGIN
+ /// The Library list iterator.
+ typedef LibraryListType::const_iterator lib_iterator;
+ // @LOCALMOD-END
/// An enumeration for describing the endianess of the target machine.
enum Endianness { AnyEndianness, LittleEndian, BigEndian };
@@ -205,6 +212,8 @@ private:
GlobalListType GlobalList; ///< The Global Variables in the module
FunctionListType FunctionList; ///< The Functions in the module
AliasListType AliasList; ///< The Aliases in the module
+ // @LOCALMOD
+ LibraryListType LibraryList; ///< The Libraries needed by the module
NamedMDListType NamedMDList; ///< The named metadata in the module
std::string GlobalScopeAsm; ///< Inline Asm at global scope.
ValueSymbolTable *ValSymTab; ///< Symbol table for values
@@ -567,8 +576,28 @@ public:
const_iterator end () const { return FunctionList.end(); }
size_t size() const { return FunctionList.size(); }
bool empty() const { return FunctionList.empty(); }
+ // @LOCALMOD-BEGIN
+/// @}
+/// @name Dependent Library Iteration
+/// @{
+
+ /// @brief Get a constant iterator to beginning of dependent library list.
+ inline lib_iterator lib_begin() const { return LibraryList.begin(); }
+ /// @brief Get a constant iterator to end of dependent library list.
+ inline lib_iterator lib_end() const { return LibraryList.end(); }
+ /// @brief Returns the number of items in the list of libraries.
+ inline size_t lib_size() const { return LibraryList.size(); }
+ void convertMetadataToLibraryList();
+ void convertLibraryListToMetadata() const;
+ /// @brief Add a library to the list of dependent libraries
+ void addLibrary(StringRef Lib);
+ /// @brief Remove a library from the list of dependent libraries
+ void removeLibrary(StringRef Lib);
+ /// @brief Get all the libraries
+ inline const LibraryListType& getLibraries() const { return LibraryList; }
/// @}
+ // @LOCALMOD-END
/// @name Alias Iteration
/// @{