2004-08-06 16:58:48 +00:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
llvmc - The LLVM Compiler Driver
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
B<llvmc> [I<options>] [I<filenames>...]
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2005-07-20 21:06:37 +00:00
|
|
|
B<llvmc> is a configurable driver for invoking other LLVM (and non-LLVM) tools
|
|
|
|
in order to compile, optimize and link software for multiple languages. For
|
|
|
|
those familiar with FSF's B<gcc> tool, it is very similar. B<llvmc> has the
|
|
|
|
following goals:
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=over
|
|
|
|
|
2005-07-20 21:06:37 +00:00
|
|
|
=item * provide a single point of access to the LLVM tool set,
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2005-07-20 21:06:37 +00:00
|
|
|
=item * hide the complexities of the LLVM tools through a single interface,
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2005-07-20 21:06:37 +00:00
|
|
|
=item * make integration of existing non-LLVM tools simple,
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2005-07-20 21:06:37 +00:00
|
|
|
=item * extend the capabilities of minimal front ends, and
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2005-07-20 21:06:37 +00:00
|
|
|
=item * make the interface for compiling consistent for all languages.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
The tool itself does nothing with a user's program. It merely invokes other
|
|
|
|
tools to get the compilation tasks done.
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
The options supported by B<llvmc> generalize the compilation process and
|
|
|
|
provide a consistent and simple interface for multiple programming languages.
|
|
|
|
This makes it easier for developers to get their software compiled with LLVM.
|
|
|
|
Without B<llvmc>, developers would need to understand how to invoke the
|
|
|
|
front-end compiler, optimizer, assembler, and linker in order to compile their
|
|
|
|
programs. B<llvmc>'s sole mission is to trivialize that process.
|
|
|
|
|
2004-08-06 16:58:48 +00:00
|
|
|
=head2 Basic Operation
|
|
|
|
|
|
|
|
B<llvmc> always takes the following basic actions:
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item * Command line options and filenames are collected.
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
The command line options provide the marching orders to B<llvmc> on what actions
|
|
|
|
it should perform. This is the I<request> the user is making of B<llvmc> and it
|
|
|
|
is interpreted first.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=item * Configuration files are read.
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
Based on the options and the suffixes of the filenames presented, a set of
|
2004-08-09 03:10:39 +00:00
|
|
|
configuration files are read to configure the actions B<llvmc> will take.
|
|
|
|
Configuration files are provided by either LLVM or the front end compiler tools
|
|
|
|
that B<llvmc> invokes. Users generally don't need to be concerned with the
|
|
|
|
contents of the configuration files.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=item * Determine actions to take.
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
The tool chain needed to complete the task is determined. This is the primary
|
|
|
|
work of B<llvmc>. It breaks the request specified by the command line options
|
|
|
|
into a set of basic actions to be done:
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=over
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-09 03:10:39 +00:00
|
|
|
=item * Pre-processing: gathering/filtering compiler input (optional).
|
2004-08-06 22:28:47 +00:00
|
|
|
|
2004-08-09 03:10:39 +00:00
|
|
|
=item * Translation: source language to bytecode conversion.
|
2004-08-06 22:28:47 +00:00
|
|
|
|
2004-08-09 03:10:39 +00:00
|
|
|
=item * Assembly: bytecode to native code conversion.
|
2004-08-06 22:28:47 +00:00
|
|
|
|
2004-08-09 03:10:39 +00:00
|
|
|
=item * Optimization: conversion of bytecode to something that runs faster.
|
2004-08-06 22:28:47 +00:00
|
|
|
|
2004-08-09 03:10:39 +00:00
|
|
|
=item * Linking: combining multiple bytecodes to produce executable program.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=back
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=item * Execute actions.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
The actions determined previously are executed sequentially and then
|
|
|
|
B<llvmc> terminates.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=back
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=head1 OPTIONS
|
|
|
|
|
|
|
|
=head2 Control Options
|
|
|
|
|
|
|
|
Control options tell B<llvmc> what to do at a high level. The
|
|
|
|
following control options are defined:
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item B<-c> or B<--compile>
|
|
|
|
|
|
|
|
This option specifies that the linking phase is not to be run. All
|
|
|
|
previous phases, if applicable will run. This is generally how a given
|
|
|
|
bytecode file is compiled and optimized for a source language module.
|
|
|
|
|
|
|
|
=item B<-k> or B<--link> or default
|
|
|
|
|
|
|
|
This option (or the lack of any control option) specifies that all stages
|
|
|
|
of compilation, optimization, and linking should be attempted. Source files
|
|
|
|
specified on the command line will be compiled and linked with objects and
|
|
|
|
libraries also specified.
|
|
|
|
|
2005-04-22 02:12:41 +00:00
|
|
|
=item B<-S>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
This option specifies that compilation should end in the creation of
|
|
|
|
an LLVM assembly file that can be later converted to an LLVM object
|
|
|
|
file.
|
|
|
|
|
2005-04-22 02:12:41 +00:00
|
|
|
=item B<-E>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
This option specifies that no compilation or linking should be
|
2004-08-06 22:56:49 +00:00
|
|
|
performed. Only pre-processing, if applicable to the language being
|
2004-08-06 16:58:48 +00:00
|
|
|
compiled, is performed. For languages that support it, this will
|
|
|
|
result in the output containing the raw input to the compiler.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head2 Optimization Options
|
|
|
|
|
|
|
|
Optimization with B<llvmc> is based on goals and specified with
|
|
|
|
the following -O options. The specific details of which
|
|
|
|
optimizations run is controlled by the configuration files because
|
|
|
|
each source language will have different needs.
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item B<-O1> or B<-O0> (default, fast compilation)
|
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
Only those optimizations that will hasten the compilation (mostly by reducing
|
2004-08-06 16:58:48 +00:00
|
|
|
the output) are applied. In general these are extremely fast and simple
|
|
|
|
optimizations that reduce emitted code size. The goal here is not to make the
|
|
|
|
resulting program fast but to make the compilation fast. If not specified,
|
|
|
|
this is the default level of optimization.
|
|
|
|
|
|
|
|
=item B<-O2> (basic optimization)
|
|
|
|
|
|
|
|
This level of optimization specifies a balance between generating good code
|
2004-08-06 22:56:49 +00:00
|
|
|
that will execute reasonably quickly and not spending too much time optimizing
|
2004-08-06 16:58:48 +00:00
|
|
|
the code to get there. For example, this level of optimization may include
|
2004-08-06 22:56:49 +00:00
|
|
|
things like global common subexpression elimination, aggressive dead code
|
2004-08-06 16:58:48 +00:00
|
|
|
elimination, and scalar replication.
|
|
|
|
|
|
|
|
=item B<-O3> (aggressive optimization)
|
|
|
|
|
|
|
|
This level of optimization aggressively optimizes each set of files compiled
|
|
|
|
together. However, no link-time inter-procedural optimization is performed.
|
|
|
|
This level implies all the optimizations of the B<-O1> and B<-O2> optimization
|
2004-08-06 22:56:49 +00:00
|
|
|
levels, and should also provide loop optimizations and compile time
|
2004-08-06 16:58:48 +00:00
|
|
|
inter-procedural optimizations. Essentially, this level tries to do as much
|
|
|
|
as it can with the input it is given but doesn't do any link time IPO.
|
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
=item B<-O4> (link time optimization)
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
In addition to the previous three levels of optimization, this level of
|
|
|
|
optimization aggressively optimizes each program at link time. It employs
|
|
|
|
basic analysis and basic link-time inter-procedural optimizations,
|
|
|
|
considering the program as a whole.
|
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
=item B<-O5> (aggressive link time optimization)
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
This is the same as B<-O4> except it employs aggressive analyses and
|
|
|
|
aggressive inter-procedural optimization.
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=item B<-O6> (profile guided optimization: not implemented)
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
This is the same as B<-O5> except that it employs profile-guided
|
|
|
|
re-optimization of the program after it has executed. Note that this implies
|
|
|
|
a single level of re-optimization based on runtime profile analysis. Once
|
2004-08-06 16:58:48 +00:00
|
|
|
the re-optimization has completed, the profiling instrumentation is
|
|
|
|
removed and final optimizations are employed.
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=item B<-O7> (lifelong optimization: not implemented)
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
This is the same as B<-O5> and similar to B<-O6> except that re-optimization
|
2004-08-06 16:58:48 +00:00
|
|
|
is performed through the life of the program. That is, each run will update
|
2004-08-06 22:56:49 +00:00
|
|
|
the profile by which future re-optimizations are directed.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head2 Input Options
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item B<-l> I<LIBRARY>
|
|
|
|
|
|
|
|
This option instructs B<llvmc> to locate a library named I<LIBRARY> and search
|
|
|
|
it for unresolved symbols when linking the program.
|
|
|
|
|
|
|
|
=item B<-L> F<path>
|
|
|
|
|
|
|
|
This option instructs B<llvmc> to add F<path> to the list of places in which
|
|
|
|
the linker will
|
|
|
|
|
|
|
|
=item B<-x> I<LANGUAGE>
|
|
|
|
|
|
|
|
This option instructs B<llvmc> to regard the following input files as
|
|
|
|
containing programs in the language I<LANGUAGE>. Normally, input file languages
|
|
|
|
are identified by their suffix but this option will override that default
|
|
|
|
behavior. The B<-x> option stays in effect until the end of the options or
|
|
|
|
a new B<-x> option is encountered.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head2 Output Options
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item B<-m>I<arch>
|
|
|
|
|
|
|
|
This option selects the back end code generator to use. The I<arch> portion
|
|
|
|
of the option names the back end to use.
|
|
|
|
|
|
|
|
=item B<--native>
|
|
|
|
|
|
|
|
Normally, B<llvmc> produces bytecode files at most stages of compilation.
|
|
|
|
With this option, B<llvmc> will arrange for native object files to be
|
|
|
|
generated with the B<-c> option, native assembly files to be generated
|
|
|
|
with the B<-S> option, and native executables to be generated with the
|
|
|
|
B<--link> option. In the case of the B<-E> option, the output will not
|
|
|
|
differ as there is no I<native> version of pre-processed output.
|
|
|
|
|
|
|
|
=item B<-o> F<filename>
|
|
|
|
|
|
|
|
Specify the output file name. The contents of the file depend on other
|
|
|
|
options.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head2 Information Options
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
=item B<-n> or B<--no-op>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
This option tells B<llvmc> to do everything but actually execute the
|
|
|
|
resulting tools. In combination with the B<-v> option, this causes B<llvmc>
|
|
|
|
to merely print out what it would have done.
|
|
|
|
|
|
|
|
=item B<-v> or B<--verbose>
|
|
|
|
|
|
|
|
This option will cause B<llvmc> to print out (on standard output) each of the
|
|
|
|
actions it takes to accomplish the objective. The output will immediately
|
|
|
|
precede the invocation of other tools.
|
|
|
|
|
|
|
|
=item B<--stats>
|
|
|
|
|
|
|
|
Print all statistics gathered during the compilation to the standard error.
|
|
|
|
Note that this option is merely passed through to the sub-tools to do with
|
|
|
|
as they please.
|
|
|
|
|
|
|
|
=item B<--time-passes>
|
|
|
|
|
|
|
|
Record the amount of time needed for each optimization pass and print it
|
|
|
|
to standard error. Like B<--stats> this option is just passed through to
|
|
|
|
the sub-tools to do with as they please.
|
|
|
|
|
|
|
|
=item B<--time-programs>
|
|
|
|
|
|
|
|
Record the amount of time each program (compilation tool) takes and print
|
|
|
|
it to the standard error.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
|
|
|
=head2 Language Specific Options
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
2005-04-22 02:12:41 +00:00
|
|
|
=item B<-T,pre>=I<options>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-07 16:30:14 +00:00
|
|
|
Pass an arbitrary option to the pre-processor.
|
|
|
|
|
|
|
|
=item B<-T,opt>=I<options>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
Pass an arbitrary option to the optimizer.
|
|
|
|
|
2005-04-22 02:12:41 +00:00
|
|
|
=item B<-T,lnk>=I<options>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
Pass an arbitrary option to the linker.
|
|
|
|
|
2004-08-07 16:30:14 +00:00
|
|
|
=item B<-T,asm>=I<options>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
2004-08-06 22:56:49 +00:00
|
|
|
Pass an arbitrary option to the code generator.
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=back
|
|
|
|
|
2005-04-22 02:16:19 +00:00
|
|
|
=head2 C/C++ Specific Options
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=over
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=item B<-I>F<path>
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
This option is just passed through to a C or C++ front end compiler to tell it
|
|
|
|
where include files can be found.
|
|
|
|
|
2005-04-22 02:12:41 +00:00
|
|
|
=item B<-D>F<symbol>
|
|
|
|
|
|
|
|
This option is just passed through to a C or C++ front end compiler to tell it
|
|
|
|
to define a symbol.
|
|
|
|
|
2004-08-06 16:58:48 +00:00
|
|
|
=back
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=head2 Miscellaneous Options
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
|
|
|
=item B<--help>
|
|
|
|
|
|
|
|
Print a summary of command line options.
|
|
|
|
|
2005-02-18 18:00:53 +00:00
|
|
|
=item B<--version>
|
2004-08-06 22:28:47 +00:00
|
|
|
|
2005-02-18 18:00:53 +00:00
|
|
|
This option will cause B<llvmc> to print out its version number and terminate.
|
2004-08-06 22:28:47 +00:00
|
|
|
|
|
|
|
=back
|
|
|
|
|
2004-08-06 16:58:48 +00:00
|
|
|
=head2 Advanced Options
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
You better know what you're doing if you use these options. Improper use
|
|
|
|
of these options can produce drastically wrong results.
|
|
|
|
|
2004-08-06 16:58:48 +00:00
|
|
|
=over
|
|
|
|
|
2005-04-22 02:12:41 +00:00
|
|
|
=item B<--config-dir> F<dirname>
|
|
|
|
|
|
|
|
This option tells B<llvmc> to read configuration data from the I<directory>
|
|
|
|
named F<dirname>. Data from such directories will be read in the order
|
|
|
|
specified on the command line after all other standard configuration files have
|
|
|
|
been read. This allows users or groups of users to conveniently create
|
|
|
|
their own configuration directories in addition to the standard ones to which
|
|
|
|
they may not have write access.
|
|
|
|
|
|
|
|
|
|
|
|
=head2 Unimplemented Options
|
|
|
|
|
|
|
|
The options below are not currently implemented in B<llvmc> but will be
|
|
|
|
eventually. They are documented here as "future design".
|
|
|
|
|
|
|
|
=over
|
|
|
|
|
2004-08-06 22:28:47 +00:00
|
|
|
=item B<--show-config> I<[suffixes...]>
|
|
|
|
|
|
|
|
When this option is given, the only action taken by B<llvmc> is to show its
|
|
|
|
final configuration state in the form of a configuration file. No compilation
|
|
|
|
tasks will be conducted when this option is given; processing will stop once
|
|
|
|
the configuration has been printed. The optional (comma separated) list of
|
|
|
|
suffixes controls what is printed. Without any suffixes, the configuration
|
|
|
|
for all languages is printed. With suffixes, only the languages pertaining
|
|
|
|
to those file suffixes will be printed. The configuration information is
|
|
|
|
printed after all command line options and configuration files have been
|
|
|
|
read and processed. This allows the user to verify that the correct
|
|
|
|
configuration data has been read by B<llvmc>.
|
|
|
|
|
|
|
|
=item B<--config> :I<section>:I<name>=I<value>
|
|
|
|
|
|
|
|
This option instructs B<llvmc> to accept I<value> as the value for configuration
|
|
|
|
item I<name> in the section named I<section>. This is a quick way to override
|
|
|
|
a configuration item on the command line without resorting to changing the
|
|
|
|
configuration files.
|
|
|
|
|
|
|
|
=item B<--config-only-from> F<dirname>
|
|
|
|
|
|
|
|
This option tells B<llvmc> to skip the normal processing of configuration
|
|
|
|
files and only configure from the contents of the F<dirname> directory. Multiple
|
|
|
|
B<--config-only-from> options may be given in which case the directories are
|
|
|
|
read in the order given on the command line.
|
|
|
|
|
2004-08-06 16:58:48 +00:00
|
|
|
=item B<--emit-raw-code>
|
|
|
|
|
|
|
|
No optimization is done whatsoever. The compilers invoked by B<llvmc> with
|
|
|
|
this option given will be instructed to produce raw, unoptimized code. This
|
|
|
|
option is useful only to front end language developers and therefore does not
|
|
|
|
participate in the list of B<-O> options. This is distinctly different from
|
|
|
|
the B<-O0> option (a synonym for B<-O1>) because those optimizations will
|
|
|
|
reduce code size to make compilation faster. With B<--emit-raw-code>, only
|
|
|
|
the full raw code produced by the compiler will be generated.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
2004-08-07 16:30:14 +00:00
|
|
|
|
2004-08-06 16:58:48 +00:00
|
|
|
=head1 EXIT STATUS
|
|
|
|
|
|
|
|
If B<llvmc> succeeds, it will exit with 0. Otherwise, if an error
|
|
|
|
occurs, it will exit with a non-zero value and no compilation actions
|
|
|
|
will be taken. If one of the compilation tools returns a non-zero
|
|
|
|
status, pending actions will be discarded and B<llvmc> will return the
|
|
|
|
same result code as the failing compilation tool.
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
L<gccas|gccas>, L<gccld|gccld>, L<llvm-as|llvm-as>, L<llvm-dis|llvm-dis>,
|
|
|
|
L<llc|llc>, L<llvm-link|llvm-link>
|
|
|
|
|
|
|
|
=head1 AUTHORS
|
|
|
|
|
2006-03-14 05:42:07 +00:00
|
|
|
Maintained by the LLVM Team (L<http://llvm.org>).
|
2004-08-06 16:58:48 +00:00
|
|
|
|
|
|
|
=cut
|