Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

LLVMBuild: Introduce a common section which currently has a list of the

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
  • Loading branch information...
commit b0c594fd422417e1e290da166b566c7bee74644b 1 parent 54d8c7f
Daniel Dunbar authored December 12, 2011
3  LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = bindings docs examples lib projects runtime tools utils
  20
+
18 21
 [component_0]
19 22
 type = Group
20 23
 name = Miscellaneous
3  lib/Analysis/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = IPA
  20
+
18 21
 [component_0]
19 22
 type = Library
20 23
 name = Analysis
3  lib/Bitcode/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = Reader Writer
  20
+
18 21
 [component_0]
19 22
 type = Group
20 23
 name = Bitcode
3  lib/CodeGen/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = AsmPrinter SelectionDAG
  20
+
18 21
 [component_0]
19 22
 type = Library
20 23
 name = CodeGen
3  lib/ExecutionEngine/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = Interpreter JIT MCJIT RuntimeDyld
  20
+
18 21
 [component_0]
19 22
 type = Library
20 23
 name = ExecutionEngine
3  lib/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = Analysis Archive AsmParser Bitcode CodeGen DebugInfo ExecutionEngine Linker MC Object Support TableGen Target Transforms VMCore
  20
+
18 21
 [component_0]
19 22
 type = Group
20 23
 name = Libraries
3  lib/MC/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = MCDisassembler MCParser
  20
+
18 21
 [component_0]
19 22
 type = Library
20 23
 name = MC
3  lib/Target/ARM/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = ARM
3  lib/Target/CBackend/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = CBackend
3  lib/Target/CellSPU/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = CellSPU
3  lib/Target/CppBackend/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = CppBackend
6  lib/Target/Hexagon/LLVMBuild.txt
... ...
@@ -1,4 +1,4 @@
1  
-;===- ./lib/Target/Hexagon/LLVMBuild.txt ----------------------*- Conf -*--===;
  1
+;===- ./lib/Target/Hexagon/LLVMBuild.txt -----------------------*- Conf -*--===;
2 2
 ;
3 3
 ;                     The LLVM Compiler Infrastructure
4 4
 ;
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = Hexagon
@@ -27,4 +30,3 @@ name = HexagonCodeGen
27 30
 parent = Hexagon
28 31
 required_libraries = AsmPrinter CodeGen Core HexagonInfo SelectionDAG Support Target MC
29 32
 add_to_library_groups = Hexagon
30  
-
1  lib/Target/Hexagon/TargetInfo/LLVMBuild.txt
@@ -21,4 +21,3 @@ name = HexagonInfo
21 21
 parent = Hexagon
22 22
 required_libraries = MC Support
23 23
 add_to_library_groups = Hexagon
24  
-
3  lib/Target/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = ARM CBackend CellSPU CppBackend Hexagon MBlaze MSP430 Mips PTX PowerPC Sparc X86 XCore
  20
+
18 21
 ; This is a special group whose required libraries are extended (by llvm-build)
19 22
 ; with the best execution engine (the native JIT, if available, or the
20 23
 ; interpreter).
3  lib/Target/MBlaze/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = MBlaze
3  lib/Target/MSP430/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = InstPrinter MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = MSP430
3  lib/Target/Mips/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = InstPrinter MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = Mips
3  lib/Target/PTX/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = InstPrinter MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = PTX
3  lib/Target/PowerPC/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = InstPrinter MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = PowerPC
3  lib/Target/Sparc/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = Sparc
3  lib/Target/X86/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo Utils
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = X86
3  lib/Target/XCore/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = MCTargetDesc TargetInfo
  20
+
18 21
 [component_0]
19 22
 type = TargetGroup
20 23
 name = XCore
3  lib/Transforms/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = IPO InstCombine Instrumentation Scalar Utils
  20
+
18 21
 [component_0]
19 22
 type = Group
20 23
 name = Transforms
3  tools/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+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
  20
+
18 21
 [component_0]
19 22
 type = Group
20 23
 name = Tools
3  utils/LLVMBuild.txt
@@ -15,6 +15,9 @@
15 15
 ;
16 16
 ;===------------------------------------------------------------------------===;
17 17
 
  18
+[common]
  19
+subdirectories = TableGen unittest
  20
+
18 21
 [component_0]
19 22
 type = Group
20 23
 name = BuildTools
46  utils/llvm-build/llvmbuild/main.py
@@ -214,14 +214,45 @@ def write_components(self, output_path):
214 214
 
215 215
             info_basedir[ci.subpath] = info_basedir.get(ci.subpath, []) + [ci]
216 216
 
  217
+        # Compute the list of subdirectories to scan.
  218
+        subpath_subdirs = {}
  219
+        for ci in self.component_infos:
  220
+            # Ignore root components.
  221
+            if ci.subpath == '/':
  222
+                continue
  223
+
  224
+            # Otherwise, append this subpath to the parent list.
  225
+            parent_path = os.path.dirname(ci.subpath)
  226
+            subpath_subdirs[parent_path] = parent_list = subpath_subdirs.get(
  227
+                parent_path, set())
  228
+            parent_list.add(os.path.basename(ci.subpath))
  229
+
217 230
         # Generate the build files.
218 231
         for subpath, infos in info_basedir.items():
219 232
             # Order the components by name to have a canonical ordering.
220 233
             infos.sort(key = lambda ci: ci.name)
221 234
 
222 235
             # Format the components into llvmbuild fragments.
223  
-            fragments = filter(None, [ci.get_llvmbuild_fragment()
224  
-                                      for ci in infos])
  236
+            fragments = []
  237
+
  238
+            # Add the common fragments.
  239
+            subdirectories = subpath_subdirs.get(subpath)
  240
+            if subdirectories:
  241
+                fragment = """\
  242
+subdirectories = %s
  243
+""" % (" ".join(sorted(subdirectories)),)
  244
+                fragments.append(("common", fragment))
  245
+
  246
+            # Add the component fragments.
  247
+            num_common_fragments = len(fragments)
  248
+            for ci in infos:
  249
+                fragment = ci.get_llvmbuild_fragment()
  250
+                if fragment is None:
  251
+                    continue
  252
+
  253
+                name = "component_%d" % (len(fragments) - num_common_fragments)
  254
+                fragments.append((name, fragment))
  255
+
225 256
             if not fragments:
226 257
                 continue
227 258
 
@@ -242,7 +273,7 @@ def write_components(self, output_path):
242 273
                 if ln.startswith(';'):
243 274
                     comment_block += ln
244 275
                 elif ln.startswith('[') and ln.endswith(']\n'):
245  
-                    comments_map[ln[:-1]] = comment_block
  276
+                    comments_map[ln[1:-2]] = comment_block
246 277
                 else:
247 278
                     comment_block = ""
248 279
             f.close()
@@ -275,15 +306,16 @@ def write_components(self, output_path):
275 306
 ;===------------------------------------------------------------------------===;
276 307
 """ % header_string
277 308
 
278  
-            for i,fragment in enumerate(fragments):
279  
-                name = '[component_%d]' % i
  309
+            # Write out each fragment.each component fragment.
  310
+            for name,fragment in fragments:
280 311
                 comment = comments_map.get(name)
281 312
                 if comment is not None:
282 313
                     f.write(comment)
283  
-                print >>f, name
  314
+                print >>f, "[%s]" % name
284 315
                 f.write(fragment)
285  
-                if fragment is not fragments[-1]:
  316
+                if fragment is not fragments[-1][1]:
286 317
                     print >>f
  318
+
287 319
             f.close()
288 320
 
289 321
     def write_library_table(self, output_path):

0 notes on commit b0c594f

Please sign in to comment.
Something went wrong with that request. Please try again.