Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Rgal/update readmes (#1)
Browse files Browse the repository at this point in the history
* Update README files for new monorepo and flat project structure

Moved all details of the Program Repository project to top level
README.md and reverted "llvm" one to the upstream version.

* Move pstore to top level .gitignore
  • Loading branch information
rgal committed Feb 21, 2019
1 parent d5377bf commit d626e9d
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 76 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pstore, which is tracked independently.
pstore/
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
# LLVM with Program Repository Support

This git repository contains a copy of LLVM (forked from commit 7b5565418f4d6e113ba805dad40d471d23bca6f6) with work-in-progress modifications to output to a Program Repository.

The changes are to add support for the program repository that was first shown at the [2016 US LLVM Developers’ meeting](https://llvm.org/devmtg/2016-11/) in the talk catchily titled “Demo of a repository for statically compiled programs”. You can relive the highs and lows by [watching it on YouTube](https://youtu.be/-pL94rqyQ6c). The early implementation demonstrated there has its [own Github repository](https://github.com/SNSystems/Toy-tools): in essence, this work re-implements the same thing in LLVM to give you the anticipated build-time improvements in a C++ compiler targeting Linux. Further documentation can be found on the [project wiki](https://github.com/SNSystems/llvm-project-prepo/wiki).

## Building the Compiler

The process to follow is similar to that for a conventional build of Clang+LLVM, but with an extra step to get the [pstore](https://github.com/SNSystems/pstore) back-end.

1. Clone llvm-project-prepo (this repository):

$ git clone https://github.com/SNSystems/llvm-project-prepo.git

1. Clone [pstore](https://github.com/SNSystems/pstore):

$ cd llvm-project-prepo
$ git clone https://github.com/SNSystems/pstore.git
$ cd -

Ultimately, we envisage supporting multiple database back-ends to fit different needs, but there’s currently a hard dependency on the pstore (“Program Store”) key/value store as a back-end.


1. Build LLVM as [normal](https://llvm.org/docs/CMake.html) enabling the clang and pstore subprojects (e.g.):

$ cmake -G "Ninja" -DLLVM_ENABLE_PROJECTS="clang;pstore" -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF ../llvm
$ ninja

## Using the Program Repository

### Compiling
The program-repository is implemented as a new object-file format (“repo”) in LLVM. To use it, you need to request it explicitly in the target triple:

$ clang -target x86_64-pc-linux-gnu-repo -c -o test.o test.c

Note that this is the only triple that we’re currently supporting (i.e. targeting X86-64 Linux).

Furthermore, the path to the program-repository database itself is set using an environment variable `REPOFILE`; it that variable is not set, it defaults to `./clang.db` (eventually, you’d expect to be able to specify this path with a command-line switch).

The command-line above will write the object code for `test.c` to the program-repository and emit a “ticket file” `test.o`. This tiny file contains a key to the real data in the database.

### Linking
A program-repository aware linker is very much on the project’s [“TODO” list](wiki/Limitations#missing-features). Until that happens, there's a `repo2obj` tool in the project tree. This generates a traditional ELF file from a repository ticket file. Using it is simple:

$ clang -target x86_64-pc-linux-gnu-repo -c -o test.o test.c
$ repo2obj test.o -o test.o.elf

The first step compiles the source file `test.c` to the repository, the second will produce a file `test.o.elf` which can be fed to a traditional ELF linker.

$ clang -o test test.o.elf
$ ./test

# The LLVM Compiler Infrastructure

This directory and its subdirectories contain source code for LLVM,
Expand Down
2 changes: 0 additions & 2 deletions llvm/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ tools/llgo
tools/polly
# avrlit, which is tracked independently.
tools/avrlit
# pstore, which is tracked independently.
tools/pstore
# Sphinx build tree, if building in-source dir.
docs/_build
# VS2017 and VSCode config files.
Expand Down
74 changes: 0 additions & 74 deletions llvm/README.md

This file was deleted.

18 changes: 18 additions & 0 deletions llvm/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.rst for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.

0 comments on commit d626e9d

Please sign in to comment.