diff --git a/docs/LLVMBuild.html b/docs/LLVMBuild.html index bb1883a12c5..1616b2d4593 100644 --- a/docs/LLVMBuild.html +++ b/docs/LLVMBuild.html @@ -134,7 +134,7 @@ $ROOT of project trees for things which can be checked out separately. --> -

LLVMBuild Format Reference

+

LLVMBuild Format Reference

@@ -151,11 +151,12 @@ $ROOT of project trees for things which can be checked out separately. --> ; Properties are declared using '=' and are contained in the previous section. ; -; We support simple scalar values and list values, where items are separated by -; spaces. There is no support for quoting, and so property values may not contain -; spaces. +; We support simple string and boolean scalar values and list values, where +; items are separated by spaces. There is no support for quoting, and so +; property values may not contain spaces. property_name = property_value list_property_name = value_1 value_2 ... value_n +boolean_property_name = 1 (or 0)
@@ -281,6 +282,21 @@ required_libraries = Archive BitReader Core Support TransformUtils +
  • type = TargetGroup +

    TargetGroup components are an extension of LibraryGroups, specifically + for defining LLVM targets (which are handled specially in a few + places).

    + +

    The name of the component should always be the name of the target.

    + +

    Components with this type use the LibraryGroup properties in addition + to:

    + +
  • +
  • type = Tool

    Tool components define standalone command line tools which should be built from the source code in the component directory and linked.

    diff --git a/lib/Target/ARM/LLVMBuild.txt b/lib/Target/ARM/LLVMBuild.txt index a7f209cf6e6..cfac6ac51ba 100644 --- a/lib/Target/ARM/LLVMBuild.txt +++ b/lib/Target/ARM/LLVMBuild.txt @@ -16,10 +16,11 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = ARM parent = Target add_to_library_groups = all-targets +has_jit = 1 [component_1] type = Library diff --git a/lib/Target/CBackend/LLVMBuild.txt b/lib/Target/CBackend/LLVMBuild.txt index 1bc5ea1070a..7cd420bfe02 100644 --- a/lib/Target/CBackend/LLVMBuild.txt +++ b/lib/Target/CBackend/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = CBackend parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/CellSPU/LLVMBuild.txt b/lib/Target/CellSPU/LLVMBuild.txt index 03e592cd7af..e8db9f3f84d 100644 --- a/lib/Target/CellSPU/LLVMBuild.txt +++ b/lib/Target/CellSPU/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = CellSPU parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/CppBackend/LLVMBuild.txt b/lib/Target/CppBackend/LLVMBuild.txt index 9602f57f9ef..447795f3b88 100644 --- a/lib/Target/CppBackend/LLVMBuild.txt +++ b/lib/Target/CppBackend/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = CppBackend parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/MBlaze/LLVMBuild.txt b/lib/Target/MBlaze/LLVMBuild.txt index 7bea2687612..b953e3df305 100644 --- a/lib/Target/MBlaze/LLVMBuild.txt +++ b/lib/Target/MBlaze/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = MBlaze parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/MSP430/LLVMBuild.txt b/lib/Target/MSP430/LLVMBuild.txt index 3081146e68f..8b0b1f6534d 100644 --- a/lib/Target/MSP430/LLVMBuild.txt +++ b/lib/Target/MSP430/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = MSP430 parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/Mips/LLVMBuild.txt b/lib/Target/Mips/LLVMBuild.txt index b9d9abf9366..bcec4a9661f 100644 --- a/lib/Target/Mips/LLVMBuild.txt +++ b/lib/Target/Mips/LLVMBuild.txt @@ -16,10 +16,11 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = Mips parent = Target add_to_library_groups = all-targets +has_jit = 1 [component_1] type = Library diff --git a/lib/Target/PTX/LLVMBuild.txt b/lib/Target/PTX/LLVMBuild.txt index 2d24524d2e2..27119c2a3e7 100644 --- a/lib/Target/PTX/LLVMBuild.txt +++ b/lib/Target/PTX/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = PTX parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/PowerPC/LLVMBuild.txt b/lib/Target/PowerPC/LLVMBuild.txt index 4a93587bdc7..3c439f37738 100644 --- a/lib/Target/PowerPC/LLVMBuild.txt +++ b/lib/Target/PowerPC/LLVMBuild.txt @@ -16,10 +16,11 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = PowerPC parent = Target add_to_library_groups = all-targets +has_jit = 1 [component_1] type = Library diff --git a/lib/Target/Sparc/LLVMBuild.txt b/lib/Target/Sparc/LLVMBuild.txt index 21cd91fa0b8..f59cc2eec42 100644 --- a/lib/Target/Sparc/LLVMBuild.txt +++ b/lib/Target/Sparc/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = Sparc parent = Target add_to_library_groups = all-targets diff --git a/lib/Target/X86/LLVMBuild.txt b/lib/Target/X86/LLVMBuild.txt index b0958f3825e..7f48a9e485c 100644 --- a/lib/Target/X86/LLVMBuild.txt +++ b/lib/Target/X86/LLVMBuild.txt @@ -16,10 +16,11 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = X86 parent = Target add_to_library_groups = all-targets +has_jit = 1 [component_1] type = Library diff --git a/lib/Target/XCore/LLVMBuild.txt b/lib/Target/XCore/LLVMBuild.txt index 321f25fa292..41943c36906 100644 --- a/lib/Target/XCore/LLVMBuild.txt +++ b/lib/Target/XCore/LLVMBuild.txt @@ -16,7 +16,7 @@ ;===------------------------------------------------------------------------===; [component_0] -type = LibraryGroup +type = TargetGroup name = XCore parent = Target add_to_library_groups = all-targets diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py index fb455710b6a..00b8ac52a94 100644 --- a/utils/llvm-build/llvmbuild/componentinfo.py +++ b/utils/llvm-build/llvmbuild/componentinfo.py @@ -188,6 +188,60 @@ class LibraryGroupComponentInfo(ComponentInfo): def get_llvmconfig_component_name(self): return self.name.lower() +class TargetGroupComponentInfo(ComponentInfo): + type_name = 'TargetGroup' + + @staticmethod + def parse(subpath, items): + kwargs = ComponentInfo.parse_items(items, has_dependencies = False) + kwargs['required_libraries'] = items.get_list('required_libraries') + kwargs['add_to_library_groups'] = items.get_list( + 'add_to_library_groups') + kwargs['has_jit'] = items.get_optional_bool('has_jit', False) + return TargetGroupComponentInfo(subpath, **kwargs) + + def __init__(self, subpath, name, parent, required_libraries = [], + add_to_library_groups = [], has_jit = False): + ComponentInfo.__init__(self, subpath, name, [], parent) + + # The names of the library components which are required when linking + # with this component. + self.required_libraries = list(required_libraries) + + # The names of the library group components this component should be + # considered part of. + self.add_to_library_groups = list(add_to_library_groups) + + # Whether or not this target supports the JIT. + self.has_jit = bool(has_jit) + + def get_component_references(self): + for r in ComponentInfo.get_component_references(self): + yield r + for r in self.required_libraries: + yield ('required library', r) + for r in self.add_to_library_groups: + yield ('library group', r) + + def get_llvmbuild_fragment(self): + result = StringIO.StringIO() + print >>result, 'type = %s' % self.type_name + print >>result, 'name = %s' % self.name + print >>result, 'parent = %s' % self.parent + if self.required_libraries: + print >>result, 'required_libraries = %s' % ' '.join( + self.required_libraries) + if self.add_to_library_groups: + print >>result, 'add_to_library_groups = %s' % ' '.join( + self.add_to_library_groups) + if self.has_jit: + print >>result, 'has_jit = %s' % ' '.join( + int(self.has_jit)) + return result.getvalue() + + def get_llvmconfig_component_name(self): + return self.name.lower() + class ToolComponentInfo(ComponentInfo): type_name = 'Tool' @@ -255,11 +309,27 @@ class IniFormatParser(dict): raise ParseError("missing value for required string: %r" % key) return value + def get_optional_bool(self, key, default = None): + value = self.get_optional_string(key) + if not value: + return default + if value not in ('0', '1'): + raise ParseError("invalid value(%r) for boolean property: %r" % ( + value, key)) + return bool(int(value)) + + def get_bool(self, key): + value = self.get_optional_bool(key) + if value is None: + raise ParseError("missing value for required boolean: %r" % key) + return value + _component_type_map = dict( (t.type_name, t) for t in (GroupComponentInfo, LibraryComponentInfo, LibraryGroupComponentInfo, - ToolComponentInfo, BuildToolComponentInfo)) + ToolComponentInfo, BuildToolComponentInfo, + TargetGroupComponentInfo)) def load_from_path(path, subpath): # Load the LLVMBuild.txt file as an .ini format file. parser = ConfigParser.RawConfigParser() diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py index 2a9ef5d9073..cc4617d9b99 100644 --- a/utils/llvm-build/llvmbuild/main.py +++ b/utils/llvm-build/llvmbuild/main.py @@ -242,8 +242,8 @@ class LLVMProjectInfo(object): # dependencies for added library groups. entries = {} for c in self.ordered_component_infos: - # Only Library and LibraryGroup components are in the table. - if c.type_name not in ('Library', 'LibraryGroup'): + # Only certain components are in the table. + if c.type_name not in ('Library', 'LibraryGroup', 'TargetGroup'): continue # Compute the llvm-config "component name". For historical reasons, @@ -251,10 +251,10 @@ class LLVMProjectInfo(object): llvmconfig_component_name = c.get_llvmconfig_component_name() # Get the library name, or None for LibraryGroups. - if c.type_name == 'LibraryGroup': - library_name = None - else: + if c.type_name == 'Library': library_name = c.get_library_name() + else: + library_name = None # Get the component names of all the required libraries. required_llvmconfig_component_names = [