Demo Info

Hints and Advice

  • The generated LLVM code will be easier to read if
    you use stdio (e.g., printf) than iostreams (e.g., std::cout).
  • Unused inline functions and methods are not generated. Instead
    of ‘class foo { void bar() {}};‘,
    try writing ‘class foo { void bar(); }; void foo::bar() {}‘.
  • If you want to try out a file that uses non-standard header files, you should
    preprocess it (e.g., with the -save-temps or -E options to
    gcc) then upload the result.

Source language

Select the type of source code you want to compile. If you upload a file you
don’t need this as the language is detected from the file extension.

Optimization level

Standard:
Select this option to run a standard set of LLVM optimizations.
LTO:
Select this option to run the LLVM link-time optimizer, which is designed to
optimize across files in your application. Since the demo page doesn’t allow
you to upload multiple files at once, and does not link in any libraries, we
configured the demo page optimizer to assume there are no calls
coming in from outside the source file, allowing it to optimize more
aggressively.
Note that you have to define ‘main’ in your program for this
to make much of a difference.
None:
Select this option to turn off all optimizations.

Show detailed pass statistics

Select this option to enable compilation timings and statistics from various
optimizers.

Demangle C++ names with C++ filt

Select this option if you want to run the target output code through “c++filt”,
which converts ‘mangled’ C++ names to their unmangled version.
Note that target code produced will not be lexically valid, but it will
be easier to understand.

Target

Select the target you want to output code for. Generally a target uses the
llc tool to output machine assembly
code. However, a few special targets exists:

LLVM assembly:
Select this option to run the LLVM dissambler
(llvm-dis tool) to show the LLVM IR.
LLVM C++ API code:
Select this option to auto generate the C++ API calls that could be used to
create the .bc file.

Analyze generated bytecode

Select this option to run the llvm-bcanalyzer tool
on the generated bytecode, which introspects into the format of the .bc file
itself.