The LLVM Compiler Infrastructure

When and where

Time 14 July 2014 - 18 July 2014, 18:00-21:00
Room EG306

Introduction

LLVM is an open-source compiler infrastructure used in many commercial and academic projects . It is written in C++ and it has a very modular design which allows all sorts of tools to be built on top of it: compilers, interpreters, static analyzers and so on.

We intend to introduce you to the world of compilers and related tools by using LLVM as a case study.

At the end of this workshop, you will know:

  • How compilers in general work
  • How to write compiler-based tools using LLVM's libraries
  • What kind of optimizations to expect from a compiler
  • How to write better C code

Topics

The phases of the compilation process

  • Learn what steps the compiler takes in order to translate high level code into machine code

The general structure of LLVM

  • See how LLVM is organized and why

Compiler-based tools

  • Learn how to use various parts of LLVM in order to implement or support tools such as source-to-source translators or editors with syntax highlighting

C tips & tricks

  • Look at what the compiler generates for various snippets of code and see how different constructs help or hinder the compiler

Prerequisites

  • Good knowledge of C/C++

Agenda

Feedback

You can use these forms to tell us what you thought about the content presented each day, what you did or didn't understand, what you'd like us to discuss again the following day etc. Any suggestions or comments are more than welcome.

Participants

Mihnea Dobrescu-Balaur
Adrian Nitu
Gabriel Florentin Balaban
Radu Stoenescu
Ionel Popescu
Dan-Stefan Dragan
Andrei Preda
Nurberdiyev Pudak
Cristina-Ioana Brinza
Albert Zaharovits
Stefan Stamate
Roxana Istrate
Roberta Dobrescu
Calin-Cristian Cruceru
Cozmin Velciu

Required software

The required software will be installed on the stations in the lab, but in case you want to bring your laptop you should try to install the following:

  • LLVM (you can use the instructions here - note that you can generate files for several IDEs using CMake)
  • Something for viewing .dot files (you can use XDot on Linux or GVEdit on Windows)
  • An IDE is recommended
  • Nice to have: LLVM IR syntax highlighting - alternatives include this Eclipse plugin, the vim plugin in the llvm/utils/vim directory and respectively the Emacs plugin in llvm/utils/emacs <note warning>You should use a Debug build of LLVM. If you're not sure, try to run
    clang -S -emit-llvm file.c -o file.ll
    opt -loop-unroll -debug-pass=Structure file.ll -S -o file.ll

You should get an output similar to this:

Pass Arguments:  -targetlibinfo -datalayout -notti -basictti -x86tti -domtree -loops -loop-simplify -lcssa -scalar-evolution -loop-simplify -lcssa -loop-unroll -preverify -verify -print-module
Target Library Information
Data Layout
No target information
Target independent code generator's TTI
X86 Target Transform Info
  ModulePass Manager
    FunctionPass Manager
      Dominator Tree Construction
      Natural Loop Information
      Loop Pass Manager
        Canonicalize natural loops
        Loop-Closed SSA Form Pass
      Scalar Evolution Analysis
      Loop Pass Manager
        Canonicalize natural loops
        Loop-Closed SSA Form Pass
        Unroll loops
      Preliminary module verification
      Module Verifier
    Print module to stderr

</note>

Organizers

Diana Vasile

Bogdan Dițu

Rene Pălălău

sesiuni/compiler.txt · Last modified: 2014/07/15 08:07 by freescale