X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FLLVMContextImpl.h;h=ae987e65bcb16ac615151274833096031adc1d47;hb=7db3980c5f97eb21bdcb58955ec7ed5e67ceda55;hp=3a573362b4114f5dd379a3b1bb18d2198a8cde2f;hpb=bd84bdb2bebb9cdf4bdf03a9f2041c7a64da2552;p=oota-llvm.git diff --git a/lib/IR/LLVMContextImpl.h b/lib/IR/LLVMContextImpl.h index 3a573362b41..ae987e65bcb 100644 --- a/lib/IR/LLVMContextImpl.h +++ b/lib/IR/LLVMContextImpl.h @@ -458,67 +458,6 @@ template <> struct MDNodeKeyImpl { unsigned getHashValue() const { return hash_combine(Filename, Directory); } }; -template <> struct MDNodeKeyImpl { - unsigned SourceLanguage; - Metadata *File; - StringRef Producer; - bool IsOptimized; - StringRef Flags; - unsigned RuntimeVersion; - StringRef SplitDebugFilename; - unsigned EmissionKind; - Metadata *EnumTypes; - Metadata *RetainedTypes; - Metadata *Subprograms; - Metadata *GlobalVariables; - Metadata *ImportedEntities; - uint64_t DWOId; - - MDNodeKeyImpl(unsigned SourceLanguage, Metadata *File, StringRef Producer, - bool IsOptimized, StringRef Flags, unsigned RuntimeVersion, - StringRef SplitDebugFilename, unsigned EmissionKind, - Metadata *EnumTypes, Metadata *RetainedTypes, - Metadata *Subprograms, Metadata *GlobalVariables, - Metadata *ImportedEntities, uint64_t DWOId) - : SourceLanguage(SourceLanguage), File(File), Producer(Producer), - IsOptimized(IsOptimized), Flags(Flags), RuntimeVersion(RuntimeVersion), - SplitDebugFilename(SplitDebugFilename), EmissionKind(EmissionKind), - EnumTypes(EnumTypes), RetainedTypes(RetainedTypes), - Subprograms(Subprograms), GlobalVariables(GlobalVariables), - ImportedEntities(ImportedEntities), DWOId(DWOId) {} - MDNodeKeyImpl(const DICompileUnit *N) - : SourceLanguage(N->getSourceLanguage()), File(N->getRawFile()), - Producer(N->getProducer()), IsOptimized(N->isOptimized()), - Flags(N->getFlags()), RuntimeVersion(N->getRuntimeVersion()), - SplitDebugFilename(N->getSplitDebugFilename()), - EmissionKind(N->getEmissionKind()), EnumTypes(N->getRawEnumTypes()), - RetainedTypes(N->getRawRetainedTypes()), - Subprograms(N->getRawSubprograms()), - GlobalVariables(N->getRawGlobalVariables()), - ImportedEntities(N->getRawImportedEntities()), DWOId(N->getDWOId()) {} - - bool isKeyOf(const DICompileUnit *RHS) const { - return SourceLanguage == RHS->getSourceLanguage() && - File == RHS->getRawFile() && Producer == RHS->getProducer() && - IsOptimized == RHS->isOptimized() && Flags == RHS->getFlags() && - RuntimeVersion == RHS->getRuntimeVersion() && - SplitDebugFilename == RHS->getSplitDebugFilename() && - EmissionKind == RHS->getEmissionKind() && - EnumTypes == RHS->getRawEnumTypes() && - RetainedTypes == RHS->getRawRetainedTypes() && - Subprograms == RHS->getRawSubprograms() && - GlobalVariables == RHS->getRawGlobalVariables() && - ImportedEntities == RHS->getRawImportedEntities() && - DWOId == RHS->getDWOId(); - } - unsigned getHashValue() const { - return hash_combine(SourceLanguage, File, Producer, IsOptimized, Flags, - RuntimeVersion, SplitDebugFilename, EmissionKind, - EnumTypes, RetainedTypes, Subprograms, GlobalVariables, - ImportedEntities, DWOId); - } -}; - template <> struct MDNodeKeyImpl { Metadata *Scope; StringRef Name; @@ -534,7 +473,6 @@ template <> struct MDNodeKeyImpl { unsigned VirtualIndex; unsigned Flags; bool IsOptimized; - Metadata *Function; Metadata *TemplateParams; Metadata *Declaration; Metadata *Variables; @@ -544,15 +482,15 @@ template <> struct MDNodeKeyImpl { bool IsLocalToUnit, bool IsDefinition, unsigned ScopeLine, Metadata *ContainingType, unsigned Virtuality, unsigned VirtualIndex, unsigned Flags, bool IsOptimized, - Metadata *Function, Metadata *TemplateParams, - Metadata *Declaration, Metadata *Variables) + Metadata *TemplateParams, Metadata *Declaration, + Metadata *Variables) : Scope(Scope), Name(Name), LinkageName(LinkageName), File(File), Line(Line), Type(Type), IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition), ScopeLine(ScopeLine), ContainingType(ContainingType), Virtuality(Virtuality), VirtualIndex(VirtualIndex), Flags(Flags), IsOptimized(IsOptimized), - Function(Function), TemplateParams(TemplateParams), - Declaration(Declaration), Variables(Variables) {} + TemplateParams(TemplateParams), Declaration(Declaration), + Variables(Variables) {} MDNodeKeyImpl(const DISubprogram *N) : Scope(N->getRawScope()), Name(N->getName()), LinkageName(N->getLinkageName()), File(N->getRawFile()), @@ -561,7 +499,6 @@ template <> struct MDNodeKeyImpl { ScopeLine(N->getScopeLine()), ContainingType(N->getRawContainingType()), Virtuality(N->getVirtuality()), VirtualIndex(N->getVirtualIndex()), Flags(N->getFlags()), IsOptimized(N->isOptimized()), - Function(N->getRawFunction()), TemplateParams(N->getRawTemplateParams()), Declaration(N->getRawDeclaration()), Variables(N->getRawVariables()) {} @@ -576,7 +513,6 @@ template <> struct MDNodeKeyImpl { Virtuality == RHS->getVirtuality() && VirtualIndex == RHS->getVirtualIndex() && Flags == RHS->getFlags() && IsOptimized == RHS->isOptimized() && - Function == RHS->getRawFunction() && TemplateParams == RHS->getRawTemplateParams() && Declaration == RHS->getRawDeclaration() && Variables == RHS->getRawVariables(); @@ -584,7 +520,7 @@ template <> struct MDNodeKeyImpl { unsigned getHashValue() const { return hash_combine(Scope, Name, LinkageName, File, Line, Type, IsLocalToUnit, IsDefinition, ScopeLine, ContainingType, - Virtuality, VirtualIndex, Flags, IsOptimized, Function, + Virtuality, VirtualIndex, Flags, IsOptimized, TemplateParams, Declaration, Variables); } }; @@ -651,6 +587,35 @@ template <> struct MDNodeKeyImpl { } }; +template <> struct MDNodeKeyImpl { + Metadata *Scope; + StringRef Name; + StringRef ConfigurationMacros; + StringRef IncludePath; + StringRef ISysRoot; + MDNodeKeyImpl(Metadata *Scope, StringRef Name, + StringRef ConfigurationMacros, + StringRef IncludePath, + StringRef ISysRoot) + : Scope(Scope), Name(Name), ConfigurationMacros(ConfigurationMacros), + IncludePath(IncludePath), ISysRoot(ISysRoot) {} + MDNodeKeyImpl(const DIModule *N) + : Scope(N->getRawScope()), Name(N->getName()), + ConfigurationMacros(N->getConfigurationMacros()), + IncludePath(N->getIncludePath()), ISysRoot(N->getISysRoot()) {} + + bool isKeyOf(const DIModule *RHS) const { + return Scope == RHS->getRawScope() && Name == RHS->getName() && + ConfigurationMacros == RHS->getConfigurationMacros() && + IncludePath == RHS->getIncludePath() && + ISysRoot == RHS->getISysRoot(); + } + unsigned getHashValue() const { + return hash_combine(Scope, Name, + ConfigurationMacros, IncludePath, ISysRoot); + } +}; + template <> struct MDNodeKeyImpl { StringRef Name; Metadata *Type; @@ -730,7 +695,6 @@ template <> struct MDNodeKeyImpl { }; template <> struct MDNodeKeyImpl { - unsigned Tag; Metadata *Scope; StringRef Name; Metadata *File; @@ -739,23 +703,23 @@ template <> struct MDNodeKeyImpl { unsigned Arg; unsigned Flags; - MDNodeKeyImpl(unsigned Tag, Metadata *Scope, StringRef Name, Metadata *File, - unsigned Line, Metadata *Type, unsigned Arg, unsigned Flags) - : Tag(Tag), Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), - Arg(Arg), Flags(Flags) {} + MDNodeKeyImpl(Metadata *Scope, StringRef Name, Metadata *File, unsigned Line, + Metadata *Type, unsigned Arg, unsigned Flags) + : Scope(Scope), Name(Name), File(File), Line(Line), Type(Type), Arg(Arg), + Flags(Flags) {} MDNodeKeyImpl(const DILocalVariable *N) - : Tag(N->getTag()), Scope(N->getRawScope()), Name(N->getName()), - File(N->getRawFile()), Line(N->getLine()), Type(N->getRawType()), - Arg(N->getArg()), Flags(N->getFlags()) {} + : Scope(N->getRawScope()), Name(N->getName()), File(N->getRawFile()), + Line(N->getLine()), Type(N->getRawType()), Arg(N->getArg()), + Flags(N->getFlags()) {} bool isKeyOf(const DILocalVariable *RHS) const { - return Tag == RHS->getTag() && Scope == RHS->getRawScope() && - Name == RHS->getName() && File == RHS->getRawFile() && - Line == RHS->getLine() && Type == RHS->getRawType() && - Arg == RHS->getArg() && Flags == RHS->getFlags(); + return Scope == RHS->getRawScope() && Name == RHS->getName() && + File == RHS->getRawFile() && Line == RHS->getLine() && + Type == RHS->getRawType() && Arg == RHS->getArg() && + Flags == RHS->getFlags(); } unsigned getHashValue() const { - return hash_combine(Tag, Scope, Name, File, Line, Type, Arg, Flags); + return hash_combine(Scope, Name, File, Line, Type, Arg, Flags); } }; @@ -828,6 +792,49 @@ template <> struct MDNodeKeyImpl { } }; +template <> struct MDNodeKeyImpl { + unsigned MIType; + unsigned Line; + StringRef Name; + StringRef Value; + + MDNodeKeyImpl(unsigned MIType, unsigned Line, StringRef Name, StringRef Value) + : MIType(MIType), Line(Line), Name(Name), Value(Value) {} + MDNodeKeyImpl(const DIMacro *N) + : MIType(N->getMacinfoType()), Line(N->getLine()), Name(N->getName()), + Value(N->getValue()) {} + + bool isKeyOf(const DIMacro *RHS) const { + return MIType == RHS->getMacinfoType() && Line == RHS->getLine() && + Name == RHS->getName() && Value == RHS->getValue(); + } + unsigned getHashValue() const { + return hash_combine(MIType, Line, Name, Value); + } +}; + +template <> struct MDNodeKeyImpl { + unsigned MIType; + unsigned Line; + Metadata *File; + Metadata *Elements; + + MDNodeKeyImpl(unsigned MIType, unsigned Line, Metadata *File, + Metadata *Elements) + : MIType(MIType), Line(Line), File(File), Elements(Elements) {} + MDNodeKeyImpl(const DIMacroFile *N) + : MIType(N->getMacinfoType()), Line(N->getLine()), File(N->getRawFile()), + Elements(N->getRawElements()) {} + + bool isKeyOf(const DIMacroFile *RHS) const { + return MIType == RHS->getMacinfoType() && Line == RHS->getLine() && + File == RHS->getRawFile() && File == RHS->getRawElements(); + } + unsigned getHashValue() const { + return hash_combine(MIType, Line, File, Elements); + } +}; + /// \brief DenseMapInfo for MDNode subclasses. template struct MDNodeInfo { typedef MDNodeKeyImpl KeyTy; @@ -924,7 +931,8 @@ public: DenseMap ValueNames; -#define HANDLE_MDNODE_LEAF(CLASS) DenseSet CLASS##s; +#define HANDLE_MDNODE_LEAF_UNIQUABLE(CLASS) \ + DenseSet CLASS##s; #include "llvm/IR/Metadata.def" // MDNodes may be uniqued or not uniqued. When they're not uniqued, they @@ -959,8 +967,10 @@ public: ConstantInt *TheTrueVal; ConstantInt *TheFalseVal; + std::unique_ptr TheNoneToken; + // Basic type instances. - Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy; + Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy, TokenTy; Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy; IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty; @@ -1004,20 +1014,30 @@ public: /// instructions in different blocks at the same location. DenseMap, unsigned> DiscriminatorTable; + typedef DenseMap FunctionDataMapTy; + /// \brief Mapping from a function to its prefix data, which is stored as the /// operand of an unparented ReturnInst so that the prefix data has a Use. - typedef DenseMap PrefixDataMapTy; - PrefixDataMapTy PrefixDataMap; + FunctionDataMapTy PrefixDataMap; /// \brief Mapping from a function to its prologue data, which is stored as /// the operand of an unparented ReturnInst so that the prologue data has a /// Use. - typedef DenseMap PrologueDataMapTy; - PrologueDataMapTy PrologueDataMap; + FunctionDataMapTy PrologueDataMap; int getOrAddScopeRecordIdxEntry(MDNode *N, int ExistingIdx); int getOrAddScopeInlinedAtIdxEntry(MDNode *Scope, MDNode *IA,int ExistingIdx); + /// \brief A set of interned tags for operand bundles. The StringMap maps + /// bundle tags to their IDs. + /// + /// \see LLVMContext::getOperandBundleTagID + StringMap BundleTagCache; + + StringMapEntry *getOrInsertBundleTag(StringRef Tag); + void getOperandBundleTags(SmallVectorImpl &Tags) const; + uint32_t getOperandBundleTagID(StringRef Tag) const; + LLVMContextImpl(LLVMContext &C); ~LLVMContextImpl();