[llvm-branch-commits] [llvm-branch] r156863 - in /llvm/branches/release_31: ./ CMakeLists.txt Makefile.config.in Makefile.rules docs/LLVMBuild.html lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt tools/llvm-config/llvm-config.cpp utils/llvm-build/llvmbuild/componentinfo.py utils/llvm-build/llvmbuild/main.py utils/unittest/LLVMBuild.txt

Bill Wendling isanbard at gmail.com
Tue May 15 15:06:09 PDT 2012


Author: void
Date: Tue May 15 17:06:08 2012
New Revision: 156863

URL: http://llvm.org/viewvc/llvm-project?rev=156863&view=rev
Log:
Merge in 156319 156837 156838.

Modified:
    llvm/branches/release_31/   (props changed)
    llvm/branches/release_31/CMakeLists.txt
    llvm/branches/release_31/Makefile.config.in
    llvm/branches/release_31/Makefile.rules
    llvm/branches/release_31/docs/LLVMBuild.html
    llvm/branches/release_31/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt
    llvm/branches/release_31/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt
    llvm/branches/release_31/tools/llvm-config/llvm-config.cpp
    llvm/branches/release_31/utils/llvm-build/llvmbuild/componentinfo.py
    llvm/branches/release_31/utils/llvm-build/llvmbuild/main.py
    llvm/branches/release_31/utils/unittest/LLVMBuild.txt

Propchange: llvm/branches/release_31/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue May 15 17:06:08 2012
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155166,155230,155284-155288,155307,155342,155466,155536,155668,155749,155809,155813,155817-155818,155844,155895,155902,155954,155984
+/llvm/trunk:155166,155230,155284-155288,155307,155342,155466,155536,155668,155749,155809,155813,155817-155818,155844,155895,155902,155954,155984,156319,156837-156838

Modified: llvm/branches/release_31/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/CMakeLists.txt?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/CMakeLists.txt (original)
+++ llvm/branches/release_31/CMakeLists.txt Tue May 15 17:06:08 2012
@@ -268,11 +268,21 @@
   "${LLVM_BINARY_DIR}/tools/llvm-config/LibraryDependencies.inc")
 set(LLVMBUILDCMAKEFRAG
   "${LLVM_BINARY_DIR}/LLVMBuild.cmake")
+
+# Create the list of optional components that are enabled
+if (LLVM_USE_INTEL_JITEVENTS)
+  set(LLVMOPTIONALCOMPONENTS IntelJITEvents)
+endif (LLVM_USE_INTEL_JITEVENTS)
+if (LLVM_USE_OPROFILE)
+  set(LLVMOPTIONALCOMPONENTS ${LLVMOPTIONALCOMPONENTS} OProfileJIT)
+endif (LLVM_USE_OPROFILE)
+
 message(STATUS "Constructing LLVMBuild project information")
 execute_process(
   COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
             --native-target "${LLVM_NATIVE_ARCH}"
             --enable-targets "${LLVM_TARGETS_TO_BUILD}"
+            --enable-optional-components "${LLVMOPTIONALCOMPONENTS}"
             --write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC}
             --write-cmake-fragment ${LLVMBUILDCMAKEFRAG}
             ERROR_VARIABLE LLVMBUILDOUTPUT

Modified: llvm/branches/release_31/Makefile.config.in
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/Makefile.config.in?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/Makefile.config.in (original)
+++ llvm/branches/release_31/Makefile.config.in Tue May 15 17:06:08 2012
@@ -351,3 +351,10 @@
 
 # Flags to control building support for OProfile JIT API
 USE_OPROFILE := @USE_OPROFILE@
+
+ifeq ($(USE_INTEL_JITEVENTS), 1)
+  OPTIONAL_COMPONENTS += IntelJITEvents
+endif
+ifeq ($(USE_OPROFILE), 1)
+  OPTIONAL_COMPONENTS += OProfileJIT
+endif

Modified: llvm/branches/release_31/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/Makefile.rules?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/Makefile.rules (original)
+++ llvm/branches/release_31/Makefile.rules Tue May 15 17:06:08 2012
@@ -100,6 +100,7 @@
 	$(Verb) $(LLVMBuildTool) \
 	  --native-target "$(TARGET_NATIVE_ARCH)" \
 	  --enable-targets "$(TARGETS_TO_BUILD)" \
+	  --enable-optional-components "$(OPTIONAL_COMPONENTS)" \
 	  --write-library-table $(LLVMConfigLibraryDependenciesInc) \
 	  --write-make-fragment $(LLVMBuildMakeFrag)
 

Modified: llvm/branches/release_31/docs/LLVMBuild.html
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/docs/LLVMBuild.html?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/docs/LLVMBuild.html (original)
+++ llvm/branches/release_31/docs/LLVMBuild.html Tue May 15 17:06:08 2012
@@ -272,6 +272,11 @@
           components. For example, the <i>X86</i> target might define a library
           group for all of the <i>X86</i> components. That library group might
           then be included in the <i>all-targets</i> library group.</p></li>
+
+        <li><i>installed</i> <b>[optional]</b> <b>[boolean]</b>
+          <p>Whether this library is installed. Libraries that are not installed
+          are only reported by <tt>llvm-config</tt> when it is run as part of a
+          development directory.</p></li>
       </ul>
     </li>
 

Modified: llvm/branches/release_31/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt (original)
+++ llvm/branches/release_31/lib/ExecutionEngine/IntelJITEvents/LLVMBuild.txt Tue May 15 17:06:08 2012
@@ -18,6 +18,6 @@
 [common]
 
 [component_0]
-type = Library
+type = OptionalLibrary
 name = IntelJITEvents
 parent = ExecutionEngine

Modified: llvm/branches/release_31/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt (original)
+++ llvm/branches/release_31/lib/ExecutionEngine/OProfileJIT/LLVMBuild.txt Tue May 15 17:06:08 2012
@@ -18,6 +18,6 @@
 [common]
 
 [component_0]
-type = Library
+type = OptionalLibrary
 name = OProfileJIT
 parent = ExecutionEngine

Modified: llvm/branches/release_31/tools/llvm-config/llvm-config.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/tools/llvm-config/llvm-config.cpp?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/tools/llvm-config/llvm-config.cpp (original)
+++ llvm/branches/release_31/tools/llvm-config/llvm-config.cpp Tue May 15 17:06:08 2012
@@ -54,7 +54,8 @@
 static void VisitComponent(StringRef Name,
                            const StringMap<AvailableComponent*> &ComponentMap,
                            std::set<AvailableComponent*> &VisitedComponents,
-                           std::vector<StringRef> &RequiredLibs) {
+                           std::vector<StringRef> &RequiredLibs,
+                           bool IncludeNonInstalled) {
   // Lookup the component.
   AvailableComponent *AC = ComponentMap.lookup(Name);
   assert(AC && "Invalid component name!");
@@ -65,10 +66,14 @@
     return;
   }
 
+  // Only include non-installed components if requested.
+  if (!AC->IsInstalled && !IncludeNonInstalled)
+    return;
+
   // Otherwise, visit all the dependencies.
   for (unsigned i = 0; AC->RequiredLibraries[i]; ++i) {
     VisitComponent(AC->RequiredLibraries[i], ComponentMap, VisitedComponents,
-                   RequiredLibs);
+                   RequiredLibs, IncludeNonInstalled);
   }
 
   // Add to the required library list.
@@ -83,8 +88,11 @@
 /// \param Components - The names of the components to find libraries for.
 /// \param RequiredLibs [out] - On return, the ordered list of libraries that
 /// are required to link the given components.
+/// \param IncludeNonInstalled - Whether non-installed components should be
+/// reported.
 void ComputeLibsForComponents(const std::vector<StringRef> &Components,
-                              std::vector<StringRef> &RequiredLibs) {
+                              std::vector<StringRef> &RequiredLibs,
+                              bool IncludeNonInstalled) {
   std::set<AvailableComponent*> VisitedComponents;
 
   // Build a map of component names to information.
@@ -107,7 +115,7 @@
     }
 
     VisitComponent(ComponentLower, ComponentMap, VisitedComponents,
-                   RequiredLibs);
+                   RequiredLibs, IncludeNonInstalled);
   }
 
   // The list is now ordered with leafs first, we want the libraries to printed
@@ -278,6 +286,10 @@
         PrintLibFiles = true;
       } else if (Arg == "--components") {
         for (unsigned j = 0; j != array_lengthof(AvailableComponents); ++j) {
+          // Only include non-installed components when in a development tree.
+          if (!AvailableComponents[j].IsInstalled && !IsInDevelopmentTree)
+            continue;
+
           OS << ' ';
           OS << AvailableComponents[j].Name;
         }
@@ -310,7 +322,8 @@
 
     // Construct the list of all the required libraries.
     std::vector<StringRef> RequiredLibs;
-    ComputeLibsForComponents(Components, RequiredLibs);
+    ComputeLibsForComponents(Components, RequiredLibs,
+                             /*IncludeNonInstalled=*/IsInDevelopmentTree);
 
     for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
       StringRef Lib = RequiredLibs[i];

Modified: llvm/branches/release_31/utils/llvm-build/llvmbuild/componentinfo.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/utils/llvm-build/llvmbuild/componentinfo.py?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/utils/llvm-build/llvmbuild/componentinfo.py (original)
+++ llvm/branches/release_31/utils/llvm-build/llvmbuild/componentinfo.py Tue May 15 17:06:08 2012
@@ -68,6 +68,21 @@
     def get_llvmbuild_fragment(self):
         abstract
 
+    def get_parent_target_group(self):
+        """get_parent_target_group() -> ComponentInfo or None
+
+        Return the nearest parent target group (if any), or None if the
+        component is not part of any target group.
+        """
+
+        # If this is a target group, return it.
+        if self.type_name == 'TargetGroup':
+            return self
+
+        # Otherwise recurse on the parent, if any.
+        if self.parent_instance:
+            return self.parent_instance.get_parent_target_group()
+
 class GroupComponentInfo(ComponentInfo):
     """
     Group components have no semantics as far as the build system are concerned,
@@ -95,16 +110,22 @@
     type_name = 'Library'
 
     @staticmethod
-    def parse(subpath, items):
+    def parse_items(items):
         kwargs = ComponentInfo.parse_items(items)
         kwargs['library_name'] = items.get_optional_string('library_name')
         kwargs['required_libraries'] = items.get_list('required_libraries')
         kwargs['add_to_library_groups'] = items.get_list(
             'add_to_library_groups')
+        kwargs['installed'] = items.get_optional_bool('installed', True)
+        return kwargs
+
+    @staticmethod
+    def parse(subpath, items):
+        kwargs = LibraryComponentInfo.parse_items(items)
         return LibraryComponentInfo(subpath, **kwargs)
 
     def __init__(self, subpath, name, dependencies, parent, library_name,
-                 required_libraries, add_to_library_groups):
+                 required_libraries, add_to_library_groups, installed):
         ComponentInfo.__init__(self, subpath, name, dependencies, parent)
 
         # If given, the name to use for the library instead of deriving it from
@@ -119,6 +140,9 @@
         # considered part of.
         self.add_to_library_groups = list(add_to_library_groups)
 
+        # Whether or not this library is installed.
+        self.installed = installed
+
     def get_component_references(self):
         for r in ComponentInfo.get_component_references(self):
             yield r
@@ -140,6 +164,8 @@
         if self.add_to_library_groups:
             print >>result, 'add_to_library_groups = %s' % ' '.join(
                 self.add_to_library_groups)
+        if not self.installed:
+            print >>result, 'installed = 0'
         return result.getvalue()
 
     def get_library_name(self):
@@ -165,6 +191,20 @@
     def get_llvmconfig_component_name(self):
         return self.get_library_name().lower()
 
+class OptionalLibraryComponentInfo(LibraryComponentInfo):
+    type_name = "OptionalLibrary"
+
+    @staticmethod
+    def parse(subpath, items):
+      kwargs = LibraryComponentInfo.parse_items(items)
+      return OptionalLibraryComponentInfo(subpath, **kwargs)
+
+    def __init__(self, subpath, name, dependencies, parent, library_name,
+                 required_libraries, add_to_library_groups, installed):
+      LibraryComponentInfo.__init__(self, subpath, name, dependencies, parent,
+                                    library_name, required_libraries,
+                                    add_to_library_groups, installed)
+
 class LibraryGroupComponentInfo(ComponentInfo):
     type_name = 'LibraryGroup'
 
@@ -375,7 +415,7 @@
     for t in (GroupComponentInfo,
               LibraryComponentInfo, LibraryGroupComponentInfo,
               ToolComponentInfo, BuildToolComponentInfo,
-              TargetGroupComponentInfo))
+              TargetGroupComponentInfo, OptionalLibraryComponentInfo))
 def load_from_path(path, subpath):
     # Load the LLVMBuild.txt file as an .ini format file.
     parser = ConfigParser.RawConfigParser()

Modified: llvm/branches/release_31/utils/llvm-build/llvmbuild/main.py
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/utils/llvm-build/llvmbuild/main.py?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/utils/llvm-build/llvmbuild/main.py (original)
+++ llvm/branches/release_31/utils/llvm-build/llvmbuild/main.py Tue May 15 17:06:08 2012
@@ -312,15 +312,26 @@
 
             f.close()
 
-    def write_library_table(self, output_path):
+    def write_library_table(self, output_path, enabled_optional_components):
         # Write out the mapping from component names to required libraries.
         #
         # We do this in topological order so that we know we can append the
         # dependencies for added library groups.
         entries = {}
         for c in self.ordered_component_infos:
+            # Skip optional components which are not enabled.
+            if c.type_name == 'OptionalLibrary' \
+                and c.name not in enabled_optional_components:
+                continue
+
+            # Skip target groups which are not enabled.
+            tg = c.get_parent_target_group()
+            if tg and not tg.enabled:
+                continue
+
             # Only certain components are in the table.
-            if c.type_name not in ('Library', 'LibraryGroup', 'TargetGroup'):
+            if c.type_name not in ('Library', 'OptionalLibrary', \
+                                   'LibraryGroup', 'TargetGroup'):
                 continue
 
             # Compute the llvm-config "component name". For historical reasons,
@@ -328,10 +339,12 @@
             llvmconfig_component_name = c.get_llvmconfig_component_name()
             
             # Get the library name, or None for LibraryGroups.
-            if c.type_name == 'Library':
+            if c.type_name == 'Library' or c.type_name == 'OptionalLibrary':
                 library_name = c.get_prefixed_library_name()
+                is_installed = c.installed
             else:
                 library_name = None
+                is_installed = True
 
             # Get the component names of all the required libraries.
             required_llvmconfig_component_names = [
@@ -344,7 +357,8 @@
 
             # Add the entry.
             entries[c.name] = (llvmconfig_component_name, library_name,
-                               required_llvmconfig_component_names)
+                               required_llvmconfig_component_names,
+                               is_installed)
 
         # Convert to a list of entries and sort by name.
         entries = entries.values()
@@ -352,16 +366,16 @@
         # Create an 'all' pseudo component. We keep the dependency list small by
         # only listing entries that have no other dependents.
         root_entries = set(e[0] for e in entries)
-        for _,_,deps in entries:
+        for _,_,deps,_ in entries:
             root_entries -= set(deps)
-        entries.append(('all', None, root_entries))
+        entries.append(('all', None, root_entries, True))
 
         entries.sort()
 
         # Compute the maximum number of required libraries, plus one so there is
         # always a sentinel.
         max_required_libraries = max(len(deps)
-                                     for _,_,deps in entries) + 1
+                                     for _,_,deps,_ in entries) + 1
 
         # Write out the library table.
         make_install_dir(os.path.dirname(output_path))
@@ -382,18 +396,21 @@
         print >>f, '  /// The name of the library for this component (or NULL).'
         print >>f, '  const char *Library;'
         print >>f, ''
+        print >>f, '  /// Whether the component is installed.'
+        print >>f, '  bool IsInstalled;'
+        print >>f, ''
         print >>f, '\
   /// The list of libraries required when linking this component.'
         print >>f, '  const char *RequiredLibraries[%d];' % (
             max_required_libraries)
         print >>f, '} AvailableComponents[%d] = {' % len(entries)
-        for name,library_name,required_names in entries:
+        for name,library_name,required_names,is_installed in entries:
             if library_name is None:
                 library_name_as_cstr = '0'
             else:
                 library_name_as_cstr = '"lib%s.a"' % library_name
-            print >>f, '  { "%s", %s, { %s } },' % (
-                name, library_name_as_cstr,
+            print >>f, '  { "%s", %s, %d, { %s } },' % (
+                name, library_name_as_cstr, is_installed,
                 ', '.join('"%s"' % dep
                           for dep in required_names))
         print >>f, '};'
@@ -778,6 +795,11 @@
                       help=("Enable the given space or semi-colon separated "
                             "list of targets, or all targets if not present"),
                       action="store", default=None)
+    group.add_option("", "--enable-optional-components",
+                      dest="optional_components", metavar="NAMES",
+                      help=("Enable the given space or semi-colon separated "
+                            "list of optional components"),
+                      action="store", default=None)
     parser.add_option_group(group)
 
     (opts, args) = parser.parse_args()
@@ -819,7 +841,8 @@
 
     # Write out the required library table, if requested.
     if opts.write_library_table:
-        project_info.write_library_table(opts.write_library_table)
+        project_info.write_library_table(opts.write_library_table,
+                                         opts.optional_components)
 
     # Write out the make fragment, if requested.
     if opts.write_make_fragment:

Modified: llvm/branches/release_31/utils/unittest/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_31/utils/unittest/LLVMBuild.txt?rev=156863&r1=156862&r2=156863&view=diff
==============================================================================
--- llvm/branches/release_31/utils/unittest/LLVMBuild.txt (original)
+++ llvm/branches/release_31/utils/unittest/LLVMBuild.txt Tue May 15 17:06:08 2012
@@ -20,9 +20,11 @@
 name = gtest
 parent = Libraries
 required_libraries = Support
+installed = 0
 
 [component_1]
 type = Library
 name = gtest_main
 parent = Libraries
 required_libraries = gtest
+installed = 0





More information about the llvm-branch-commits mailing list