The LLVM Directory Layout

LLVM is organized as a series of libraries, along with several tools that make use of them. This modular design is one of its greatest strengths, because it allows developers to easily build new tools based on existing functionality (and these tools can link only with the specific libraries that they need to use).

Looking through the LLVM source directory, you will come across three important directories that reflect this organization: include, lib and tools.

The include directory contains, as the name suggests, the header files used by LLVM components. Some of these headers (the ones in the llvm-c directory) are intended to offer a C interface to the LLVM libraries - they can also be used from within any other language that can interoperate with C but not with C++.

The lib and tools directories contain the heart of LLVM: the language- and target-independent optimizer as well as a number of supported backends (at the time of this writing, there are 12 supported architectures plus the C++ backend). They too have very suggestive names. You may find interesting the lib/Transforms directory, which contains a plethora of optimizations, the lib/Analysis directory, which contains analyses that support the optimizations, and the lib/Target directory, which isolates architecture-specific details.

An overview of (most of) the tools that come with LLVM by default can be found here. Notice, in particular, opt, which provides a way to run the optimizer independently of the front-end or back-end, llc, which compiles LLVM source files, and lli, which interprets them. Clang, a C / C++ / Objective-C front end, is also usually placed in the tools directory and comes with a similar hierarchy as that of LLVM.

LDAP: couldn't connect to LDAP server
sesiuni/compiler/layout.txt · Last modified: 2014/07/13 21:26 by apicus