PGO: llvm-profdata: tool for merging profiles
[oota-llvm.git] / test / lit.cfg
index 4262545e3d0e41dc15643ec73bab49270673934d..ac8d4497f09110ec3002dfe4a754195263406126 100644 (file)
@@ -156,6 +156,12 @@ if re.search(r'cygwin|mingw32|win32', config.host_triple):
   lli_mcjit += ' -mtriple='+config.host_triple+'-elf'
 config.substitutions.append( ('%lli_mcjit', lli_mcjit) )
 
+# Similarly, have a macro to use llc with DWARF even when the host is win32.
+llc_dwarf = 'llc'
+if re.search(r'win32', config.target_triple):
+  llc_dwarf += ' -mtriple='+config.target_triple.replace('-win32', '-mingw32')
+config.substitutions.append( ('%llc_dwarf', llc_dwarf) )
+
 # Provide a substition for those tests that need to run the jit to obtain data
 # but simply want use the currently considered most reliable jit for platform
 # FIXME: ppc32 is not ready for mcjit.
@@ -188,6 +194,7 @@ else:
 config.substitutions.append( ('%ocamlopt', config.ocamlopt_executable) )
 config.substitutions.append( ('%llvmshlibdir', config.llvm_shlib_dir) )
 config.substitutions.append( ('%shlibext', config.llvm_shlib_ext) )
+config.substitutions.append( ('%exeext', config.llvm_exe_ext) )
 
 # For each occurrence of an llvm tool name as its own word, replace it
 # with the full path to the build directory holding that tool.  This
@@ -204,35 +211,54 @@ else:
 # Regex to reject matching a hyphen
 NOHYPHEN = r"(?<!-)"
 
-for pattern in [r"\bbugpoint\b(?!-)",   r"(?<!/|-)\bclang\b(?!-)",
+for pattern in [r"\bbugpoint\b(?!-)",
+                r"(?<!/|-)\bclang\b(?!-)",
                 r"\bgold\b",
                 # Match llc but not -llc
                 NOHYPHEN + r"\bllc\b",
                 r"\blli\b",
-                r"\bllvm-ar\b",         r"\bllvm-as\b",
-                r"\bllvm-bcanalyzer\b", r"\bllvm-config\b",
-                r"\bllvm-cov\b",        r"\bllvm-diff\b",
-                r"\bllvm-dis\b",        r"\bllvm-dwarfdump\b",
-                r"\bllvm-extract\b",    r"\bllvm-jistlistener\b",
-                r"\bllvm-link\b",       r"\bllvm-mc\b",
-                r"\bllvm-nm\b",         r"\bllvm-objdump\b",
-                r"\bllvm-prof\b",       r"\bllvm-ranlib\b",
-                r"\bllvm-rtdyld\b",     r"\bllvm-shlib\b",
-                r"\bllvm-size\b",       r"\bllvm-readobj\b",
+                r"\bllvm-PerfectShuffle\b",
+                r"\bllvm-ar\b",
+                r"\bllvm-as\b",
+                r"\bllvm-bcanalyzer\b",
+                r"\bllvm-config\b",
+                r"\bllvm-cov\b",
+                r"\bllvm-diff\b",
+                r"\bllvm-dis\b",
+                r"\bllvm-dwarfdump\b",
+                r"\bllvm-extract\b",
+                r"\bllvm-jistlistener\b",
+                r"\bllvm-link\b",
+                r"\bllvm-lto\b",
+                r"\bllvm-mc\b",
+                r"\bllvm-mcmarkup\b",
+                r"\bllvm-nm\b",
+                r"\bllvm-objdump\b",
+                r"\bllvm-profdata\b",
+                r"\bllvm-ranlib\b",
+                r"\bllvm-readobj\b",
+                r"\bllvm-rtdyld\b",
+                r"\bllvm-shlib\b",
+                r"\bllvm-size\b",
+                r"\bllvm-tblgen\b",
+                r"\bllvm-c-test\b",
                 # Match llvmc but not -llvmc
                 NOHYPHEN + r"\bllvmc\b",
-                r"\bllvm-lto\b",
                 # Match lto but not -lto
                 NOHYPHEN + r"\blto\b",
-                                        # Don't match '.opt', '-opt',
-                                        # '^opt' or '/opt'.
-                r"\bmacho-dump\b",      r"(?<!\.|-|\^|/)\bopt\b",
-                r"\bllvm-tblgen\b",     r"\bFileCheck\b",
-                r"\bFileUpdate\b",      r"\bc-index-test\b",
-                r"\bfpcmp\b",           r"\bllvm-PerfectShuffle\b",
+                r"\bmacho-dump\b",
+                # Don't match '.opt', '-opt', '^opt' or '/opt'.
+                r"(?<!\.|-|\^|/)\bopt\b",
+                r"\bFileCheck\b",
+                r"\bFileUpdate\b",
+                r"\bc-index-test\b",
+                r"\bfpcmp\b",
+                r"\bobj2yaml\b",
+                r"\byaml2obj\b",
                 # Handle these specially as they are strings searched
                 # for during testing.
-                r"\| \bcount\b",         r"\| \bnot\b"]:
+                r"\| \bcount\b",
+                r"\| \bnot\b"]:
     # Extract the tool name from the pattern.  This relies on the tool
     # name being surrounded by \b word match operators.  If the
     # pattern starts with "| ", include it in the string to be
@@ -282,21 +308,24 @@ if config.have_zlib == "1":
     config.available_features.add("zlib")
 
 # Native compilation: host arch == target arch
-if config.host_arch in config.target_triple:
+# FIXME: Consider cases that target can be executed
+# even if host_triple were different from target_triple.
+if config.host_triple == config.target_triple:
     config.available_features.add("native")
 
-# llc knows whether he is compiled with -DNDEBUG.
+# Ask llvm-config about assertion mode.
 import subprocess
 try:
-    llc_cmd = subprocess.Popen([os.path.join(llvm_tools_dir, 'llc'), '-version'],
-                           stdout = subprocess.PIPE)
+    llvm_config_cmd = subprocess.Popen(
+        [os.path.join(llvm_tools_dir, 'llvm-config'), '--assertion-mode'],
+        stdout = subprocess.PIPE)
 except OSError:
-    print("Could not find llc in " + llvm_tools_dir)
+    print("Could not find llvm-config in " + llvm_tools_dir)
     exit(42)
 
-if re.search(r'with assertions', llc_cmd.stdout.read().decode('ascii')):
+if re.search(r'ON', llvm_config_cmd.stdout.read().decode('ascii')):
     config.available_features.add('asserts')
-llc_cmd.wait()
+llvm_config_cmd.wait()
 
 if 'darwin' == sys.platform:
     try: