X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FIR%2FModule.h;h=4e99c4256730c9fc1c1fbcd2e0f567829f010290;hb=d68ad56b3f52878be32ce60b8a6f9c8dce94c34b;hp=d8636dfb123e5b3e33ef90c520a6bed93681f37b;hpb=1bef1cdd9292c25f69b07726499e8bc41c4689c1;p=oota-llvm.git diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h index d8636dfb123..4e99c425673 100644 --- a/include/llvm/IR/Module.h +++ b/include/llvm/IR/Module.h @@ -34,54 +34,6 @@ class LLVMContext; class RandomNumberGenerator; class StructType; -template<> struct ilist_traits - : public SymbolTableListTraits { - - // createSentinel is used to get hold of the node that marks the end of the - // list... (same trick used here as in ilist_traits) - Function *createSentinel() const { - return static_cast(&Sentinel); - } - static void destroySentinel(Function*) {} - - Function *provideInitialHead() const { return createSentinel(); } - Function *ensureHead(Function*) const { return createSentinel(); } - static void noteHead(Function*, Function*) {} - -private: - mutable ilist_node Sentinel; -}; - -template<> struct ilist_traits - : public SymbolTableListTraits { - // createSentinel is used to create a node that marks the end of the list. - GlobalVariable *createSentinel() const { - return static_cast(&Sentinel); - } - static void destroySentinel(GlobalVariable*) {} - - GlobalVariable *provideInitialHead() const { return createSentinel(); } - GlobalVariable *ensureHead(GlobalVariable*) const { return createSentinel(); } - static void noteHead(GlobalVariable*, GlobalVariable*) {} -private: - mutable ilist_node Sentinel; -}; - -template<> struct ilist_traits - : public SymbolTableListTraits { - // createSentinel is used to create a node that marks the end of the list. - GlobalAlias *createSentinel() const { - return static_cast(&Sentinel); - } - static void destroySentinel(GlobalAlias*) {} - - GlobalAlias *provideInitialHead() const { return createSentinel(); } - GlobalAlias *ensureHead(GlobalAlias*) const { return createSentinel(); } - static void noteHead(GlobalAlias*, GlobalAlias*) {} -private: - mutable ilist_node Sentinel; -}; - template<> struct ilist_traits : public ilist_default_traits { // createSentinel is used to get hold of a node that marks the end of @@ -96,6 +48,7 @@ template<> struct ilist_traits static void noteHead(NamedMDNode*, NamedMDNode*) {} void addNodeToList(NamedMDNode *) {} void removeNodeFromList(NamedMDNode *) {} + private: mutable ilist_node Sentinel; }; @@ -116,11 +69,11 @@ class Module { /// @{ public: /// The type for the list of global variables. - typedef iplist GlobalListType; + typedef SymbolTableList GlobalListType; /// The type for the list of functions. - typedef iplist FunctionListType; + typedef SymbolTableList FunctionListType; /// The type for the list of aliases. - typedef iplist AliasListType; + typedef SymbolTableList AliasListType; /// The type for the list of named metadata. typedef ilist NamedMDListType; /// The type of the comdat "symbol" table. @@ -249,7 +202,7 @@ public: /// Get the data layout string for the module's target platform. This is /// equivalent to getDataLayout()->getStringRepresentation(). - const std::string getDataLayoutStr() const { + const std::string &getDataLayoutStr() const { return DL.getStringRepresentation(); } @@ -328,6 +281,11 @@ public: /// registered in this LLVMContext. void getMDKindNames(SmallVectorImpl &Result) const; + /// Populate client supplied SmallVector with the bundle tags registered in + /// this LLVMContext. The bundle tags are ordered by increasing bundle IDs. + /// \see LLVMContext::getOperandBundleTagID + void getOperandBundleTags(SmallVectorImpl &Result) const; + /// Return the type with the specified name, or null if there is none by that /// name. StructType *getTypeByName(StringRef Name) const; @@ -512,28 +470,28 @@ public: const GlobalListType &getGlobalList() const { return GlobalList; } /// Get the Module's list of global variables. GlobalListType &getGlobalList() { return GlobalList; } - static iplist Module::*getSublistAccess(GlobalVariable*) { + static GlobalListType Module::*getSublistAccess(GlobalVariable*) { return &Module::GlobalList; } /// Get the Module's list of functions (constant). const FunctionListType &getFunctionList() const { return FunctionList; } /// Get the Module's list of functions. FunctionListType &getFunctionList() { return FunctionList; } - static iplist Module::*getSublistAccess(Function*) { + static FunctionListType Module::*getSublistAccess(Function*) { return &Module::FunctionList; } /// Get the Module's list of aliases (constant). const AliasListType &getAliasList() const { return AliasList; } /// Get the Module's list of aliases. AliasListType &getAliasList() { return AliasList; } - static iplist Module::*getSublistAccess(GlobalAlias*) { + static AliasListType Module::*getSublistAccess(GlobalAlias*) { return &Module::AliasList; } /// Get the Module's list of named metadata (constant). const NamedMDListType &getNamedMDList() const { return NamedMDList; } /// Get the Module's list of named metadata. NamedMDListType &getNamedMDList() { return NamedMDList; } - static ilist Module::*getSublistAccess(NamedMDNode*) { + static NamedMDListType Module::*getSublistAccess(NamedMDNode*) { return &Module::NamedMDList; } /// Get the symbol table of global variable and function identifiers @@ -646,11 +604,12 @@ public: /// uselistorder directives so that use-lists can be recreated when reading /// the assembly. void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW, - bool ShouldPreserveUseListOrder = false) const; + bool ShouldPreserveUseListOrder = false, + bool IsForDebug = false) const; /// Dump the module to stderr (for debugging). void dump() const; - + /// This function causes all the subinstructions to "let go" of all references /// that they are maintaining. This allows one to 'delete' a whole class at /// a time, even though there may be circular references... first all @@ -666,6 +625,10 @@ public: /// \brief Returns the Dwarf Version by checking module flags. unsigned getDwarfVersion() const; + /// \brief Returns the CodeView Version by checking module flags. + /// Returns zero if not present in module. + unsigned getCodeViewFlag() const; + /// @} /// @name Utility functions for querying and setting PIC level /// @{ @@ -693,7 +656,7 @@ DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef) inline Module *unwrap(LLVMModuleProviderRef MP) { return reinterpret_cast(MP); } - + } // End llvm namespace #endif