[PPC64LE] Teach swap optimization about the doubleword splat idiom
[oota-llvm.git] / lib / IR / LLVMContextImpl.h
index 95292509f505b3bb228d838d673b8b6065ce666f..cbbf11e334c4dbf73c5f00c9da4f4ba7f266a5c8 100644 (file)
@@ -472,19 +472,20 @@ template <> struct MDNodeKeyImpl<DICompileUnit> {
   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)
+                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) {}
+        ImportedEntities(ImportedEntities), DWOId(DWOId) {}
   MDNodeKeyImpl(const DICompileUnit *N)
       : SourceLanguage(N->getSourceLanguage()), File(N->getRawFile()),
         Producer(N->getProducer()), IsOptimized(N->isOptimized()),
@@ -494,7 +495,7 @@ template <> struct MDNodeKeyImpl<DICompileUnit> {
         RetainedTypes(N->getRawRetainedTypes()),
         Subprograms(N->getRawSubprograms()),
         GlobalVariables(N->getRawGlobalVariables()),
-        ImportedEntities(N->getRawImportedEntities()) {}
+        ImportedEntities(N->getRawImportedEntities()), DWOId(N->getDWOId()) {}
 
   bool isKeyOf(const DICompileUnit *RHS) const {
     return SourceLanguage == RHS->getSourceLanguage() &&
@@ -507,13 +508,14 @@ template <> struct MDNodeKeyImpl<DICompileUnit> {
            RetainedTypes == RHS->getRawRetainedTypes() &&
            Subprograms == RHS->getRawSubprograms() &&
            GlobalVariables == RHS->getRawGlobalVariables() &&
-           ImportedEntities == RHS->getRawImportedEntities();
+           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);
+                        ImportedEntities, DWOId);
   }
 };
 
@@ -649,6 +651,35 @@ template <> struct MDNodeKeyImpl<DINamespace> {
   }
 };
 
+template <> struct MDNodeKeyImpl<DIModule> {
+  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<DITemplateTypeParameter> {
   StringRef Name;
   Metadata *Type;
@@ -920,6 +951,8 @@ public:
   DenseMap<Value *, ValueAsMetadata *> ValuesAsMetadata;
   DenseMap<Metadata *, MetadataAsValue *> MetadataAsValues;
 
+  DenseMap<const Value*, ValueName*> ValueNames;
+
 #define HANDLE_MDNODE_LEAF(CLASS) DenseSet<CLASS *, CLASS##Info> CLASS##s;
 #include "llvm/IR/Metadata.def"