LLVMBuild: Introduce a common section which currently has a list of the
authorDaniel Dunbar <daniel@zuster.org>
Mon, 12 Dec 2011 22:45:54 +0000 (22:45 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Mon, 12 Dec 2011 22:45:54 +0000 (22:45 +0000)
subdirectories to traverse into.
 - Originally I wanted to avoid this and just autoscan, but this has one key
   flaw in that new subdirectories can not automatically trigger a rerun of the
   llvm-build tool. This is particularly a pain when switching back and forth
   between trees where one has added a subdirectory, as the dependencies will
   tend to be wrong. This will also eliminates FIXME implicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146436 91177308-0d34-0410-b5e6-96231b3b80d8

26 files changed:
LLVMBuild.txt
lib/Analysis/LLVMBuild.txt
lib/Bitcode/LLVMBuild.txt
lib/CodeGen/LLVMBuild.txt
lib/ExecutionEngine/LLVMBuild.txt
lib/LLVMBuild.txt
lib/MC/LLVMBuild.txt
lib/Target/ARM/LLVMBuild.txt
lib/Target/CBackend/LLVMBuild.txt
lib/Target/CellSPU/LLVMBuild.txt
lib/Target/CppBackend/LLVMBuild.txt
lib/Target/Hexagon/LLVMBuild.txt
lib/Target/Hexagon/TargetInfo/LLVMBuild.txt
lib/Target/LLVMBuild.txt
lib/Target/MBlaze/LLVMBuild.txt
lib/Target/MSP430/LLVMBuild.txt
lib/Target/Mips/LLVMBuild.txt
lib/Target/PTX/LLVMBuild.txt
lib/Target/PowerPC/LLVMBuild.txt
lib/Target/Sparc/LLVMBuild.txt
lib/Target/X86/LLVMBuild.txt
lib/Target/XCore/LLVMBuild.txt
lib/Transforms/LLVMBuild.txt
tools/LLVMBuild.txt
utils/LLVMBuild.txt
utils/llvm-build/llvmbuild/main.py

index 63ca344908a6357c8b81958d4b5917f2f188f7ec..e763fd2afee2b4afbdc7266dd6aedaff68e5c1cf 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = bindings docs examples lib projects runtime tools utils
+
 [component_0]
 type = Group
 name = Miscellaneous
index eddcc170bb60741a74db7c87e5793146a333c2d1..a8a8079d1e5a2b18664e56a7dbb7c17e07d68eee 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = IPA
+
 [component_0]
 type = Library
 name = Analysis
index ffea08ae4eb2f70c85d2222c303a47dd8b447c9f..af9936bbe82967efad3dc7635d4a0f1cebdf5c8a 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = Reader Writer
+
 [component_0]
 type = Group
 name = Bitcode
index 60334c6ffb90a8f03c3bd5db912374bb609120d3..fee0347ea6592d0c6514dea24e5ac5a6a41f817e 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = AsmPrinter SelectionDAG
+
 [component_0]
 type = Library
 name = CodeGen
index f16c98574feafc7c14e40bbceb877a8a5b32f001..d4269692c7cd9fc607d69c7fbb502a0d2181e376 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = Interpreter JIT MCJIT RuntimeDyld
+
 [component_0]
 type = Library
 name = ExecutionEngine
index 50fb23c6178d66290d47686ca0ea975f890f55b5..e22b8cd406b243d970602f78cf9cc3525de19886 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = Analysis Archive AsmParser Bitcode CodeGen DebugInfo ExecutionEngine Linker MC Object Support TableGen Target Transforms VMCore
+
 [component_0]
 type = Group
 name = Libraries
index c8cc3d51aad0b86a15b86c6084b41c7e299db0b9..f35dbe4d5d350b6382c33ec5a775cedc8483117f 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = MCDisassembler MCParser
+
 [component_0]
 type = Library
 name = MC
index de7af054ab278d36ce0ecdc1f25187492e2a59ef..fd4b3a33de1adfa40bd0fb5a1ca2255c5effbae7 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = ARM
index ce9327a62b4f47a608c4dd113bc279fa5787c77f..e64feb0e6050df13e022c7824bad62c6ac4d8a86 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = TargetInfo
+
 [component_0]
 type = TargetGroup
 name = CBackend
index 4071fa68fc25226177e48998f37c7afe5289ce66..277620bf4e5930f9a0d6e47ea4ef8faa776999b8 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = CellSPU
index 49358309dd0e323c89032f801edbeeda4714f6d9..122b5e7502fc515ec5d28e39ed4ad2a1ad6ff27f 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = TargetInfo
+
 [component_0]
 type = TargetGroup
 name = CppBackend
index a9524dbfb40e0004518abe2f05d729f314a99e87..ed64aaa6d17843207486dc366c9efc305a192d96 100644 (file)
@@ -1,4 +1,4 @@
-;===- ./lib/Target/Hexagon/LLVMBuild.txt ----------------------*- Conf -*--===;
+;===- ./lib/Target/Hexagon/LLVMBuild.txt -----------------------*- Conf -*--===;
 ;
 ;                     The LLVM Compiler Infrastructure
 ;
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = TargetInfo
+
 [component_0]
 type = TargetGroup
 name = Hexagon
@@ -27,4 +30,3 @@ name = HexagonCodeGen
 parent = Hexagon
 required_libraries = AsmPrinter CodeGen Core HexagonInfo SelectionDAG Support Target MC
 add_to_library_groups = Hexagon
-
index b5d0972f15d783d92490fd21dac78e72d32db34d..7b87be3e05a8c43f2cbee4ab03466afae8537f62 100644 (file)
@@ -21,4 +21,3 @@ name = HexagonInfo
 parent = Hexagon
 required_libraries = MC Support
 add_to_library_groups = Hexagon
-
index 358cbc81d578a519241f9b3b318ffd622e4e1ad1..5a42ca5efb084ef40fedacfd2e156e141a05b707 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = ARM CBackend CellSPU CppBackend Hexagon MBlaze MSP430 Mips PTX PowerPC Sparc X86 XCore
+
 ; This is a special group whose required libraries are extended (by llvm-build)
 ; with the best execution engine (the native JIT, if available, or the
 ; interpreter).
index 426e98ff80740b8aef457d47fcd6592e0fc396d1..0b290076a4e9920cece0d4daea18fbab908b68bc 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = MBlaze
index 7cd4b7c713e80402e2cae75cf16d400a870dfac1..51d9702ac56005825037f7711e5759dd32f3d4ec 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = InstPrinter MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = MSP430
index 7609e788df51b4e019f1379213f76de422066b72..bcd32bc0005ed823c8e1b270b5a10ab0e11f0e61 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = InstPrinter MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = Mips
index 5cf694ca35158391ff3bd1a09a38d9e3e36df211..15a1eb532837108c3fb1215fb900efdebd71ce15 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = InstPrinter MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = PTX
index 6287ce2a4a96e9f4a8b2f41479d1e95393e3e2aa..95fac5471ec714404a0fd39988a4517c790217b6 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = InstPrinter MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = PowerPC
index 320ba839a9e8db6bce7546c4c7f3597128006fb1..fe20d2f4bd155517e66b4e731523374b1e4e8f56 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = Sparc
index ac7a3cd21da4aca6fb80a20d67426be9622cd689..87305e0e5f5ca1b65181ab5d5068c9cc88b844c6 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo Utils
+
 [component_0]
 type = TargetGroup
 name = X86
index 35eb4f32abfbb8f2a718aad76bcc04087bba5413..53b4a9e3f5f79dee88486fe8579070940997cb06 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = MCTargetDesc TargetInfo
+
 [component_0]
 type = TargetGroup
 name = XCore
index 255e0409edfb12320550217e263ab598d4eae257..b2ef49a4c63b7bb5b2647534d5c863718c3eeffa 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = IPO InstCombine Instrumentation Scalar Utils
+
 [component_0]
 type = Group
 name = Transforms
index 195546be486d885ccfa8970eb5005693f0b36b35..aba990f52114068d485be9ead2aac87e9753c0ee 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = bugpoint llc lli llvm-ar llvm-as llvm-bcanalyzer llvm-cov llvm-diff llvm-dis llvm-dwarfdump llvm-extract llvm-ld llvm-link llvm-mc llvm-nm llvm-objdump llvm-prof llvm-ranlib llvm-rtdyld llvm-size llvm-stub macho-dump opt
+
 [component_0]
 type = Group
 name = Tools
index 3fc90e9389bb24d0e202352264e38332da487975..382bfd31447b42ba55d8029965d1ad261eeb2769 100644 (file)
@@ -15,6 +15,9 @@
 ;
 ;===------------------------------------------------------------------------===;
 
+[common]
+subdirectories = TableGen unittest
+
 [component_0]
 type = Group
 name = BuildTools
index 550c7403034d6eea00d7314baca0bee2ea64e3ca..279a10f5f199743dfa643f1597bc3feb4237ab16 100644 (file)
@@ -214,14 +214,45 @@ class LLVMProjectInfo(object):
 
             info_basedir[ci.subpath] = info_basedir.get(ci.subpath, []) + [ci]
 
+        # Compute the list of subdirectories to scan.
+        subpath_subdirs = {}
+        for ci in self.component_infos:
+            # Ignore root components.
+            if ci.subpath == '/':
+                continue
+
+            # Otherwise, append this subpath to the parent list.
+            parent_path = os.path.dirname(ci.subpath)
+            subpath_subdirs[parent_path] = parent_list = subpath_subdirs.get(
+                parent_path, set())
+            parent_list.add(os.path.basename(ci.subpath))
+
         # Generate the build files.
         for subpath, infos in info_basedir.items():
             # Order the components by name to have a canonical ordering.
             infos.sort(key = lambda ci: ci.name)
 
             # Format the components into llvmbuild fragments.
-            fragments = filter(None, [ci.get_llvmbuild_fragment()
-                                      for ci in infos])
+            fragments = []
+
+            # Add the common fragments.
+            subdirectories = subpath_subdirs.get(subpath)
+            if subdirectories:
+                fragment = """\
+subdirectories = %s
+""" % (" ".join(sorted(subdirectories)),)
+                fragments.append(("common", fragment))
+
+            # Add the component fragments.
+            num_common_fragments = len(fragments)
+            for ci in infos:
+                fragment = ci.get_llvmbuild_fragment()
+                if fragment is None:
+                    continue
+
+                name = "component_%d" % (len(fragments) - num_common_fragments)
+                fragments.append((name, fragment))
+
             if not fragments:
                 continue
 
@@ -242,7 +273,7 @@ class LLVMProjectInfo(object):
                 if ln.startswith(';'):
                     comment_block += ln
                 elif ln.startswith('[') and ln.endswith(']\n'):
-                    comments_map[ln[:-1]] = comment_block
+                    comments_map[ln[1:-2]] = comment_block
                 else:
                     comment_block = ""
             f.close()
@@ -275,15 +306,16 @@ class LLVMProjectInfo(object):
 ;===------------------------------------------------------------------------===;
 """ % header_string
 
-            for i,fragment in enumerate(fragments):
-                name = '[component_%d]' % i
+            # Write out each fragment.each component fragment.
+            for name,fragment in fragments:
                 comment = comments_map.get(name)
                 if comment is not None:
                     f.write(comment)
-                print >>f, name
+                print >>f, "[%s]" % name
                 f.write(fragment)
-                if fragment is not fragments[-1]:
+                if fragment is not fragments[-1][1]:
                     print >>f
+
             f.close()
 
     def write_library_table(self, output_path):