check-clang: Introduce get_llvm_config_props in clang/test/lit.cfg.

In trunk, we can use features as below:

  aarch64-registered-target
  hexagon-registered-target
  msp430-registered-target
  r600-registered-target
  systemz-registered-target
  xcore-registered-target

Each of them, as below, implies corresponding subtargets:

  arm-registered-target   -- arm, thumb
  mips-registered-target  -- mips, mips64, mips64el, mipsel
  nvptx-registered-target -- nvptx, nvptx64
  sparc-registered-target -- sparc, sparcv9
  x86-registered-target   -- x86, x86-64

They will be renamed:

  cppbackend-registered-target -- was "cpp". Unused in trunk.
  powerpc-registered-target -- was "ppc32", "ppc64" and "ppc64le".

The feature "asserts" is also taken from llvm-config.

llvm-svn: 196347
This commit is contained in:
NAKAMURA Takumi 2013-12-04 03:40:56 +00:00
parent 014529f595
commit 67eade63fd
2 changed files with 26 additions and 2 deletions

View File

@ -44,6 +44,7 @@ endif()
if( NOT CLANG_BUILT_STANDALONE )
list(APPEND CLANG_TEST_DEPS
llvm-config
llc opt FileCheck count not llvm-symbolizer
)

View File

@ -324,8 +324,31 @@ if len(llc_props['set_of_targets']) > 0:
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')