Skip to content

Latest commit

 

History

History

utils

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Test suite scripts

Automated LLVM builds

The install.sh script downloads and compiles a release of LLVM, along with extra Clang tools and the LLVM test suite. Targeted version can be edited in the code. If the script is interrupting, restarting it will gracefully resume the build.

% install.sh 

The script can normally be used to rebuild after editing source files, but don't take my word for it. Just run ninja in the llvm directory.

Basic usage

These scripts are used to build programs of the LLVM test suite. They are typically used as arguments to the configure.py script from the testsuite directory. A test suite that builds all its programs with O3.sh, for instance, is configured from the testsuite directory with:

% ./configure.py -d O3/ -s O3.sh

There is no need to reconfigure the test suite if 03.sh is modified, but the build will need to be cleaned.

Provided test suite scripts

The default scripts are as follow:

  • O0.sh, O1.sh, O2.sh, O3.sh: Compile the test program with -O0, -O1, -O2 or -O3 respectively.
  • Lots of scripts are generated by the configure-fast.py script fro mthe testsuite directory to just apply a sequence of passes.
  • The script extractor.sh compiles bitcodes and copies them to another external directory. This can be used to make a database of bitcodes.

Writing test suite scripts

A test suite script can do anything with its input program, but eventually it must compile it to an object file so that the Ninja target of the test suite is updated and performance can be measured later.

Utility functions and variable definitions are provided in testsuite-scripts/tools/ts.sh; it is heavily recommended to source this file at the beginning of any test suite script. (Note: using $0 is bad taste in general but fine here because the rule rewriter of the test suite configuration script sets the script name explicitly and with an absolute path.)

. $(dirname $0)/tools/ts.sh

What the test suite script must do is build $in, which is either a bitcode file or a C/C++ source file, into $out, which is an object file. The trivial way to do it, using the ts.sh utilities, is:

# Compile $in into bitcode
ts_compile

# Optimize the bitcode (optional)
ts_opt -O1 -whatever

# Assemble the bitcode to object code
ts_link

Which is exactly what happens in Ox.sh.

Utility functions in ts.sh

TODO. Some have parameters, others don't.