Coder Social home page Coder Social logo

snsystems / llvm-prepo Goto Github PK

View Code? Open in Web Editor NEW
6.0 7.0 0.0 298.14 MB

Program repository project has moved to https://github.com/SNSystems/llvm-project-prepo

License: Other

CMake 0.20% Shell 0.04% Go 0.06% C++ 33.34% OCaml 0.13% Python 0.39% C 0.36% Objective-C 0.01% LLVM 47.52% Assembly 17.89% Roff 0.01% Logos 0.01% Perl 0.01% Emacs Lisp 0.01% Batchfile 0.01% Vim Script 0.01% HTML 0.01% PHP 0.01% CSS 0.01% Dockerfile 0.01%
llvm llvm-prepo program-repository

llvm-prepo's Introduction

LLVM with Program Repository Support

This git repository contains a copy of LLVM (forked from commit 57bb7d2d7058512fff60f58c343aad15eae64afb) 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 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. The early implementation demonstrated there has its own Github repository: 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.

Building the Compiler

The process to follow is similar to that for a conventional build of Clang+LLVM, but with with the Clang and LLVM sources coming from different repositories and an extra step to get the pstore back-end.

  1. Clone llvm-prepo (this repository):

     $ git clone https://github.com/SNSystems/llvm-prepo.git
    
  2. Clone clang-prepo (forked from commit d6aa2b1c1a49068f3c8d5405083fde4118d75e4f):

     $ cd llvm-prepo/tools
     $ git clone https://github.com/SNSystems/clang-prepo.git clang
     $ cd -
    
  3. Clone pstore:

     $ cd llvm-prepo/tools
     $ 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.

  4. Build LLVM as normal.

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. 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

Low Level Virtual Machine (LLVM)

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.