else:
lit_config.fatal('No Targets Registered with the LLVM Tools!')
-if llc_props['enable_assertions']:
- config.available_features.add('asserts')
+# Returns set of available features, registered-target(s) and asserts.
+def get_llvm_config_props():
+ set_of_features = set()
+
+ cmd = subprocess.Popen(
+ [
+ os.path.join(llvm_tools_dir, 'llvm-config'),
+ '--assertion-mode',
+ '--targets-built',
+ ],
+ stdout=subprocess.PIPE
+ )
+ # 1st line corresponds to --assertion-mode, "ON" or "OFF".
+ line = cmd.stdout.readline().strip().decode('ascii')
+ if line == "ON":
+ set_of_features.add('asserts')
+
+ # 2nd line corresponds to --targets-built, like;
+ # AArch64 ARM CppBackend X86
+ for arch in cmd.stdout.readline().decode('ascii').split():
+ set_of_features.add(arch.lower() + '-registered-target')
+
+ return set_of_features
+
+config.available_features.update(get_llvm_config_props())
if lit.util.which('xmllint'):
config.available_features.add('xmllint')