Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit b0c594f

Browse files
committed
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
1 parent 54d8c7f commit b0c594f

File tree

26 files changed

+112
-10
lines changed

26 files changed

+112
-10
lines changed

LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = bindings docs examples lib projects runtime tools utils
20+
1821
[component_0]
1922
type = Group
2023
name = Miscellaneous

lib/Analysis/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = IPA
20+
1821
[component_0]
1922
type = Library
2023
name = Analysis

lib/Bitcode/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = Reader Writer
20+
1821
[component_0]
1922
type = Group
2023
name = Bitcode

lib/CodeGen/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = AsmPrinter SelectionDAG
20+
1821
[component_0]
1922
type = Library
2023
name = CodeGen

lib/ExecutionEngine/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = Interpreter JIT MCJIT RuntimeDyld
20+
1821
[component_0]
1922
type = Library
2023
name = ExecutionEngine

lib/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = Analysis Archive AsmParser Bitcode CodeGen DebugInfo ExecutionEngine Linker MC Object Support TableGen Target Transforms VMCore
20+
1821
[component_0]
1922
type = Group
2023
name = Libraries

lib/MC/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = MCDisassembler MCParser
20+
1821
[component_0]
1922
type = Library
2023
name = MC

lib/Target/ARM/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = ARM

lib/Target/CBackend/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = CBackend

lib/Target/CellSPU/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = CellSPU

lib/Target/CppBackend/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = CppBackend

lib/Target/Hexagon/LLVMBuild.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;===- ./lib/Target/Hexagon/LLVMBuild.txt ----------------------*- Conf -*--===;
1+
;===- ./lib/Target/Hexagon/LLVMBuild.txt -----------------------*- Conf -*--===;
22
;
33
; The LLVM Compiler Infrastructure
44
;
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = Hexagon
@@ -27,4 +30,3 @@ name = HexagonCodeGen
2730
parent = Hexagon
2831
required_libraries = AsmPrinter CodeGen Core HexagonInfo SelectionDAG Support Target MC
2932
add_to_library_groups = Hexagon
30-

lib/Target/Hexagon/TargetInfo/LLVMBuild.txt

-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ name = HexagonInfo
2121
parent = Hexagon
2222
required_libraries = MC Support
2323
add_to_library_groups = Hexagon
24-

lib/Target/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = ARM CBackend CellSPU CppBackend Hexagon MBlaze MSP430 Mips PTX PowerPC Sparc X86 XCore
20+
1821
; This is a special group whose required libraries are extended (by llvm-build)
1922
; with the best execution engine (the native JIT, if available, or the
2023
; interpreter).

lib/Target/MBlaze/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = MBlaze

lib/Target/MSP430/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = InstPrinter MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = MSP430

lib/Target/Mips/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = InstPrinter MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = Mips

lib/Target/PTX/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = InstPrinter MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = PTX

lib/Target/PowerPC/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = InstPrinter MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = PowerPC

lib/Target/Sparc/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = Sparc

lib/Target/X86/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = AsmParser Disassembler InstPrinter MCTargetDesc TargetInfo Utils
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = X86

lib/Target/XCore/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = MCTargetDesc TargetInfo
20+
1821
[component_0]
1922
type = TargetGroup
2023
name = XCore

lib/Transforms/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = IPO InstCombine Instrumentation Scalar Utils
20+
1821
[component_0]
1922
type = Group
2023
name = Transforms

tools/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

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+
1821
[component_0]
1922
type = Group
2023
name = Tools

utils/LLVMBuild.txt

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
;
1616
;===------------------------------------------------------------------------===;
1717

18+
[common]
19+
subdirectories = TableGen unittest
20+
1821
[component_0]
1922
type = Group
2023
name = BuildTools

utils/llvm-build/llvmbuild/main.py

+39-7
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,45 @@ def write_components(self, output_path):
214214

215215
info_basedir[ci.subpath] = info_basedir.get(ci.subpath, []) + [ci]
216216

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+
217230
# Generate the build files.
218231
for subpath, infos in info_basedir.items():
219232
# Order the components by name to have a canonical ordering.
220233
infos.sort(key = lambda ci: ci.name)
221234

222235
# 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+
225256
if not fragments:
226257
continue
227258

@@ -242,7 +273,7 @@ def write_components(self, output_path):
242273
if ln.startswith(';'):
243274
comment_block += ln
244275
elif ln.startswith('[') and ln.endswith(']\n'):
245-
comments_map[ln[:-1]] = comment_block
276+
comments_map[ln[1:-2]] = comment_block
246277
else:
247278
comment_block = ""
248279
f.close()
@@ -275,15 +306,16 @@ def write_components(self, output_path):
275306
;===------------------------------------------------------------------------===;
276307
""" % header_string
277308

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:
280311
comment = comments_map.get(name)
281312
if comment is not None:
282313
f.write(comment)
283-
print >>f, name
314+
print >>f, "[%s]" % name
284315
f.write(fragment)
285-
if fragment is not fragments[-1]:
316+
if fragment is not fragments[-1][1]:
286317
print >>f
318+
287319
f.close()
288320

289321
def write_library_table(self, output_path):

0 commit comments

Comments
 (0)