From 169d2bd06003c39970bc94c99669a34b61bb7e45 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 8 Apr 2013 18:41:23 +0000 Subject: Vendor import of llvm trunk r178860: http://llvm.org/svn/llvm-project/llvm/trunk@178860 --- lib/Bitcode/Writer/ValueEnumerator.h | 52 +++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 19 deletions(-) (limited to 'lib/Bitcode/Writer/ValueEnumerator.h') diff --git a/lib/Bitcode/Writer/ValueEnumerator.h b/lib/Bitcode/Writer/ValueEnumerator.h index 75468e6..0af6164c 100644 --- a/lib/Bitcode/Writer/ValueEnumerator.h +++ b/lib/Bitcode/Writer/ValueEnumerator.h @@ -16,7 +16,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Attributes.h" +#include "llvm/IR/Attributes.h" #include namespace llvm { @@ -29,7 +29,7 @@ class Function; class Module; class MDNode; class NamedMDNode; -class AttrListPtr; +class AttributeSet; class ValueSymbolTable; class MDSymbolTable; class raw_ostream; @@ -51,15 +51,19 @@ private: ValueList MDValues; SmallVector FunctionLocalMDs; ValueMapType MDValueMap; - - typedef DenseMap AttributeMapType; + + typedef DenseMap AttributeGroupMapType; + AttributeGroupMapType AttributeGroupMap; + std::vector AttributeGroups; + + typedef DenseMap AttributeMapType; AttributeMapType AttributeMap; - std::vector Attributes; - + std::vector Attribute; + /// GlobalBasicBlockIDs - This map memoizes the basic block ID's referenced by /// the "getGlobalBasicBlockID" method. mutable DenseMap GlobalBasicBlockIDs; - + typedef DenseMap InstructionMapType; InstructionMapType InstructionMap; unsigned InstructionCount; @@ -67,7 +71,7 @@ private: /// BasicBlocks - This contains all the basic blocks for the currently /// incorporated function. Their reverse mapping is stored in ValueMap. std::vector BasicBlocks; - + /// When a function is incorporated, this is the size of the Values list /// before incorporation. unsigned NumModuleValues; @@ -98,33 +102,43 @@ public: unsigned getInstructionID(const Instruction *I) const; void setInstructionID(const Instruction *I); - unsigned getAttributeID(const AttrListPtr &PAL) const { + unsigned getAttributeID(AttributeSet PAL) const { if (PAL.isEmpty()) return 0; // Null maps to zero. - AttributeMapType::const_iterator I = AttributeMap.find(PAL.getRawPointer()); + AttributeMapType::const_iterator I = AttributeMap.find(PAL); assert(I != AttributeMap.end() && "Attribute not in ValueEnumerator!"); return I->second; } + unsigned getAttributeGroupID(AttributeSet PAL) const { + if (PAL.isEmpty()) return 0; // Null maps to zero. + AttributeGroupMapType::const_iterator I = AttributeGroupMap.find(PAL); + assert(I != AttributeGroupMap.end() && "Attribute not in ValueEnumerator!"); + return I->second; + } + /// getFunctionConstantRange - Return the range of values that corresponds to /// function-local constants. void getFunctionConstantRange(unsigned &Start, unsigned &End) const { Start = FirstFuncConstantID; End = FirstInstID; } - + const ValueList &getValues() const { return Values; } const ValueList &getMDValues() const { return MDValues; } - const SmallVector &getFunctionLocalMDValues() const { + const SmallVector &getFunctionLocalMDValues() const { return FunctionLocalMDs; } const TypeList &getTypes() const { return Types; } const std::vector &getBasicBlocks() const { - return BasicBlocks; + return BasicBlocks; + } + const std::vector &getAttributes() const { + return Attribute; } - const std::vector &getAttributes() const { - return Attributes; + const std::vector &getAttributeGroups() const { + return AttributeGroups; } - + /// getGlobalBasicBlockID - This returns the function-specific ID for the /// specified basic block. This is relatively expensive information, so it /// should only be used by rare constructs such as address-of-label. @@ -138,7 +152,7 @@ public: private: void OptimizeConstants(unsigned CstStart, unsigned CstEnd); - + void EnumerateMDNodeOperands(const MDNode *N); void EnumerateMetadata(const Value *MD); void EnumerateFunctionLocalMetadata(const MDNode *N); @@ -146,8 +160,8 @@ private: void EnumerateValue(const Value *V); void EnumerateType(Type *T); void EnumerateOperandType(const Value *V); - void EnumerateAttributes(const AttrListPtr &PAL); - + void EnumerateAttributes(AttributeSet PAL); + void EnumerateValueSymbolTable(const ValueSymbolTable &ST); void EnumerateNamedMetadata(const Module *M); }; -- cgit v1.1