SlideShare una empresa de Scribd logo
1 de 55
Descargar para leer sin conexión
Introduction to the LLVM
    Compiler System
            Chris Lattner
         llvm.org Architect

        November 4, 2008
       ACAT’08 - Erice, Sicily
What is the LLVM Project?
• Collection of industrial strength compiler technology
  ■ Optimizer and Code Generator
  ■ llvm-gcc and Clang Front-ends

  ■ MSIL and .NET Virtual Machines




                                                          http://llvm.org
What is the LLVM Project?
• Collection of industrial strength compiler technology
  ■ Optimizer and Code Generator
  ■ llvm-gcc and Clang Front-ends

  ■ MSIL and .NET Virtual Machines




• Open Source Project with many contributors
  ■   Industry, Research Groups, Individuals




 http://llvm.org/


                                                          http://llvm.org
Why New Compilers?




                     http://llvm.org
Why New Compilers?
• Existing Open Source C Compilers have Stagnated!




                                                     http://llvm.org
Why New Compilers?
• Existing Open Source C Compilers have Stagnated!

• How?
  ■ Based on decades old code generation technology
  ■ No modern techniques like cross-file optimization and JIT codegen

  ■ Aging code bases: difficult to learn, hard to change substantially

  ■ Can’t be reused in other applications

  ■ Keep getting slower with every release




                                                            http://llvm.org
What I want!




               http://llvm.org
What I want!
• A set of production-quality reusable libraries:
  ■ ... which implement the best known techniques drawing from
    modern literature
  ■ ... which focus on compile time

  ■ ... and performance of the generated code




• Ideally support many different languages and applications!




                                                          http://llvm.org
LLVM Vision and Approach
 • Primary mission: build a set of modular compiler components:
   ■ Reduces the time & cost to construct a particular compiler
   ■ Components are shared across different compilers

   ■ Allows choice of the right component for the job




           X86    PPC     CBE      clang    GCC     LTO      ...

                    Code
       DWARF Target              JIT   Optzn linker       IPO      ...
                    gen

   BC IO   LL IO System   Core     Support xforms analysis      GC       ...
                                                                         http://llvm.org
LLVM Vision and Approach
 • Primary mission: build a set of modular compiler components:
   ■  Reduces the time & cost to construct a particular compiler
    ■ Components are shared across different compilers

    ■ Allows choice of the right component for the job


 • Secondary mission: Build compilers out of these components
    ■ ... for example, a truly great C compiler

    ■ ... for example, a runtime specialization engine




           X86    PPC     CBE      clang    GCC     LTO      ...

                    Code
       DWARF Target              JIT   Optzn linker       IPO      ...
                    gen

   BC IO   LL IO System   Core     Support xforms analysis      GC       ...
                                                                         http://llvm.org
Talk Overview
• Intro and Motivation
• LLVM as a C and C++ Compiler
• Other LLVM Capabilities
• Going Forward




                                 http://llvm.org
LLVM-GCC 4.2
• C, C++, Objective C, Ada and Fortran
• Standard GCC command line options
• Supports almost all GCC language features and extensions
• Supports many targets, including X86, X86-64, PowerPC, etc.
• Extremely compatible with GCC 4.2




                                                          http://llvm.org
LLVM-GCC 4.2
• C, C++, Objective C, Ada and Fortran
• Standard GCC command line options
• Supports almost all GCC language features and extensions
• Supports many targets, including X86, X86-64, PowerPC, etc.
• Extremely compatible with GCC 4.2




    What does it mean to be both LLVM and GCC?
                                                          http://llvm.org
LLVM GCC 4.2 Design
• Replace GCC optimizer and code generator with LLVM
  ■   Reuses GCC parser and runtime libraries




        C
      C++         GCC 4.2                       GCC Code
                 Front-end     GCC Optimizer    Generator    .s file
       ...
                                 GCC 4.2




                                                            http://llvm.org
LLVM GCC 4.2 Design
• Replace GCC optimizer and code generator with LLVM
  ■   Reuses GCC parser and runtime libraries



        C
                  GCC 4.2                       LLVM Code
      C++        Front-end     LLVM Optimizer   Generator    .s file
       ...
                              LLVM GCC 4.2
        C
      C++         GCC 4.2                       GCC Code
                 Front-end     GCC Optimizer    Generator    .s file
       ...
                                  GCC 4.2




                                                            http://llvm.org
Linking LLVM and GCC compiled code
 • Safe to mix and match .o files between compilers
 • Safe to call into libraries built with other compilers


                               .o files
a.c        gcc -O2


b.c      llvm-gcc -O3




                            Disk Storage


                                                            http://llvm.org
Linking LLVM and GCC compiled code
 • Safe to mix and match .o files between compilers
 • Safe to call into libraries built with other compilers


                               .o files
a.c        gcc -O2


b.c      llvm-gcc -O3




                            Disk Storage


                                                            http://llvm.org
Linking LLVM and GCC compiled code
 • Safe to mix and match .o files between compilers
 • Safe to call into libraries built with other compilers


                               .o files
a.c        gcc -O2


b.c      llvm-gcc -O3
                                                    Linker   exe




                            Disk Storage


                                                             http://llvm.org
Potential Impact of LLVM Optimizer
• Generated Code
  ■   How fast does the code run?




                                     http://llvm.org
Potential Impact of LLVM Optimizer
• Generated Code
  ■   How fast does the code run?


• Compile Times
  ■   How fast can we get code from the compiler?




                                                    http://llvm.org
Potential Impact of LLVM Optimizer
• Generated Code
  ■   How fast does the code run?


• Compile Times
  ■   How fast can we get code from the compiler?


• New Features




                                                    http://llvm.org
Potential Impact of LLVM Optimizer
• Generated Code
  ■   How fast does the code run?


• Compile Times
  ■   How fast can we get code from the compiler?


• New Features


        Link Time Optimization

                                                    http://llvm.org
New Feature: Link Time Optimization
 • Optimize (e.g. inline, constant fold, etc) across files with -O4
 • Optimize across language boundaries too!


                               .o files
a.c        gcc -O3


b.c      llvm-gcc -O4
                                                     Linker      exe




                             Disk Storage


                                                                 http://llvm.org
New Feature: Link Time Optimization
 • Optimize (e.g. inline, constant fold, etc) across files with -O4
 • Optimize across language boundaries too!


                               .o files
a.c        gcc -O3


b.c      llvm-gcc -O4
                                                     Linker      exe
c.c      llvm-gcc -O4



                             Disk Storage


                                                                 http://llvm.org
New Feature: Link Time Optimization
 • Optimize (e.g. inline, constant fold, etc) across files with -O4
 • Optimize across language boundaries too!


                               .o files
a.c        gcc -O3


b.c      llvm-gcc -O4
                                                      Linker       exe
c.c      llvm-gcc -O4
                                                     LLVM Link
                                                  Time Optimizer


                             Disk Storage


                                                                   http://llvm.org
New Feature: Link Time Optimization
 • Optimize (e.g. inline, constant fold, etc) across files with -O4
 • Optimize across language boundaries too!


                               .o files
a.c        gcc -O3


b.c      llvm-gcc -O4
                                                      Linker       exe
c.c      llvm-gcc -O4
                                                     LLVM Link
                                                  Time Optimizer
d.cpp    llvm-g++ -O4
                             Disk Storage


                                                                   http://llvm.org
SPEC INT 2000 Compile Time
    In seconds: Lower is Better




          Optimization Level      http://llvm.org
SPEC INT 2000 Compile Time
200s
                         In seconds: Lower is Better
                                                     187s
               GCC 4.2
               LLVM GCC 4.2                164s
160s

                               133s

120s

                   90s
       79s
 80s



 40s



  0s
         -O0       -O0 -g        -O1          -O2      -O3   -O4: LTO
                                Optimization Level                  http://llvm.org
SPEC INT 2000 Compile Time
200s
                         In seconds: Lower is Better
                                                            187s
               GCC 4.2
               LLVM GCC 4.2                   164s
160s
                                                                               144s
                                133s                               131s
                                                     126s
120s                                   112s

                          97s
                   90s
       79s
 80s         74s




 40s



  0s
         -O0       -O0 -g         -O1          -O2            -O3         -O4: LTO
                                 Optimization Level                              http://llvm.org
SPEC INT 2000 Compile Time
200s
                         In seconds: Lower is Better
                                                            187s
               GCC 4.2
               LLVM GCC 4.2                   164s
160s
                                                                                144s
                                133s
                                                     126s
                                                                   131s   Faster than
120s                                                                      GCC at -O2!
                                       112s
                                                    42% Faster
                          97s                         at -O3!
                   90s
       79s
                                          30% Faster
 80s         74s
                                18% Faster at -O2!
                                  at -O1!

 40s



  0s
         -O0       -O0 -g         -O1          -O2            -O3          -O4: LTO
                                 Optimization Level                               http://llvm.org
SPEC 2000 Execution Time
Relative to GCC -O2: Lower is Faster

                                  GCC 4.2
                                  LLVM GCC 4.2




           Optimization Level           http://llvm.org
SPEC 2000 Execution Time
       Relative to GCC -O2: Lower is Faster
100%

                                            GCC 4.2
                    96.3%                   LLVM GCC 4.2
95%



90%



85%



80%



75%
       -O2               -O3           -O4 (LTO)
                  Optimization Level               http://llvm.org
SPEC 2000 Execution Time
        Relative to GCC -O2: Lower is Faster
100%

                                                 GCC 4.2
                         96.3%                   LLVM GCC 4.2
95%            95.1%

       5% Faster                  92.5%

90%     at -O2!
                          4% Faster
                           at -O3!

85%



80%



75%
         -O2                  -O3           -O4 (LTO)
                       Optimization Level               http://llvm.org
SPEC 2000 Execution Time
        Relative to GCC -O2: Lower is Faster
100%

                                                 GCC 4.2
                         96.3%                   LLVM GCC 4.2
95%            95.1%

       5% Faster                  92.5%

90%     at -O2!
                          4% Faster
                           at -O3!

85%
                                            20% Faster
                                             than -O3!
80%                                               80.3%




75%
         -O2                  -O3           -O4 (LTO)
                       Optimization Level                 http://llvm.org
llvm-gcc 4.2 Summary
• Drop in replacement for GCC 4.2
  ■ Compatible with GCC command line options and languages
  ■ Works with existing makefiles (e.g. “make CC=llvm-gcc”)




• Benefits of LLVM Optimizer and Code Generator
  ■ Much faster optimizer: ~30-40% at -O3 in most cases
  ■ Slightly better codegen at a given level: ~5-10% on x86/x86-64

  ■ Link-Time Optimization at -O4: optimize across source files




                                                            http://llvm.org
Talk Overview
• Intro and Motivation
• LLVM as a C and C++ Compiler
• Other LLVM Capabilities
• LLVM Going Forward




                                 http://llvm.org
LLVM For Compiler Hackers
• LLVM is a great target for new languages
  ■ Well defined, simple to program for
  ■ Easy to retarget existing compiler to use LLVM backend




• LLVM supports Just-In-Time optimization and compilation
  ■ Optimize code at runtime based on dynamic information
  ■ Easy to retarget existing bytecode interpreter to LLVM JIT

  ■ Great for performance, not just for traditional “compilers”




                                                              http://llvm.org
Colorspace Conversion JIT Optimization
 • Code to convert from one color format to another:
   ■ e.g. BGRA 444R -> RGBA 8888
   ■ Hundreds of combinations, importance depends on input

  for each pixel {
    switch (infmt) {
    case RGBA 5551:
      R = (*in >> 11) & C
      G = (*in >> 6) & C
      B = (*in >> 1) & C
    ... }
    switch (outfmt) {
    case RGB888:
      *outptr = R << 16 |
                 G << 8 ...
    }
  }




                                                       http://llvm.org
Colorspace Conversion JIT Optimization
 • Code to convert from one color format to another:
   ■ e.g. BGRA 444R -> RGBA 8888
   ■ Hundreds of combinations, importance depends on input

  for each pixel {                         for each pixel {
    switch (infmt) {                         R = (*in >> 11) & C;
    case RGBA 5551:                          G = (*in >> 6) & C;
      R = (*in >> 11) & C                    B = (*in >> 1) & C;
      G = (*in >> 6) & C      Run-time       *outptr = R << 16 |
      B = (*in >> 1) & C                               G << 8 ...
                              specialize
    ... }                                  }
    switch (outfmt) {
    case RGB888:
      *outptr = R << 16 |                    Compiler optimizes
                 G << 8 ...                  shifts and masking
    }
  }




                                                                http://llvm.org
Colorspace Conversion JIT Optimization
 • Code to convert from one color format to another:
    ■ e.g. BGRA 444R -> RGBA 8888
    ■ Hundreds of combinations, importance depends on input

  for each pixel {                              for each pixel {
    switch (infmt) {                              R = (*in >> 11) & C;
    case RGBA 5551:                               G = (*in >> 6) & C;
      R = (*in >> 11) & C                         B = (*in >> 1) & C;
      G = (*in >> 6) & C          Run-time        *outptr = R << 16 |
      B = (*in >> 1) & C                                    G << 8 ...
                                  specialize
    ... }                                       }
    switch (outfmt) {
    case RGB888:
      *outptr = R << 16 |                         Compiler optimizes
                 G << 8 ...                       shifts and masking
    }
  }


  Speedup depends on src/dest format:
   5.4x speedup on average, 19.3x max speedup: (13.3MB/s to 257.7MB/s)
                                                                         http://llvm.org
Another example: RegEx Compilation
• Many regex’s are matched millions of times:
  ■  Match time is critical
• Common regex engines ‘compile’ to ‘bytecode’ and interpret:
   ■ regcomp/regexec




• Why not compile to native code? Partial Evaluation!
  ■ regcomp compiles regex to a native function
  ■ Much faster matching, could even vectorize common idioms




• Excellent way to handle multiple different Unicode encodings



                                                          http://llvm.org
Talk Overview
• Intro and Motivation
• LLVM as a C and C++ Compiler
• Other LLVM Capabilities
• LLVM Going Forward




                                 http://llvm.org
LLVM Going Forward
• More of the same...




                        http://llvm.org
LLVM Going Forward
• More of the same...
  ■ Even faster optimizer
  ■ Even better optimizations

  ■ More features for non-C languages

  ■ Debug Info Improvements

  ■ Many others...




                                        http://llvm.org
LLVM Going Forward
• More of the same...
  ■ Even faster optimizer
  ■ Even better optimizations

  ■ More features for non-C languages

  ■ Debug Info Improvements

  ■ Many others...




          Better tools for source level analysis
                  of C/C++ programs!

                                                   http://llvm.org
Clang Frontend: What is it?
• C, Objective-C, and C++ front-end

• Aggressive project with many goals...
  ■ Compatibility with GCC
  ■ Fast compilation

  ■ Expressive error messages




• Host for a broad range of source-level tools



                                                 http://llvm.org
Clang Frontend: What is it?
 • C, Objective-C, and C++ front-end

 • Aggressive project with many goals...
    ■ Compatibility with GCC
    ■ Fast compilation

    ■ Expressive error messages


t.c:6:49: error: invalid operands to binary expression ('int' and 'struct A')
  return intArg + func(intArg ? ((someA.X+40) + someA) / 42 : someA.X));
                                 ~~~~~~~~~~~~ ^ ~~~~~



 • Host for a broad range of source-level tools



                                                                   http://llvm.org
Clang Frontend: What is it?
 • C, Objective-C, and C++ front-end

 • Aggressive project with many goals...
    ■ Compatibility with GCC
    ■ Fast compilation

    ■ Expressive error messages


t.c:6:49: error: invalid operands to binary expression ('int' and 'struct A')
  return intArg + func(intArg ? ((someA.X+40) + someA) / 42 : someA.X));
                                 ~~~~~~~~~~~~ ^ ~~~~~



 • Host for a broad range of source-level tools



                                                                   http://llvm.org
Clang Compile Time
PostgreSQL -fsyntax-only Time: 665K lines of C code in 619 files




                                                           http://llvm.org
Clang Compile Time
PostgreSQL -fsyntax-only Time: 665K lines of C code in 619 files


                 49s




                    GCC 4.2            clang               http://llvm.org
Clang Compile Time
PostgreSQL -fsyntax-only Time: 665K lines of C code in 619 files


                 49s




                                    2.3x faster

                                         21s




                    GCC 4.2            clang               http://llvm.org
LLVM Overview
 • New compiler architecture built with reusable components
   ■ Retarget existing languages to JIT or static compilation
   ■ Many optimizations and supported targets




                                                            http://llvm.org
LLVM Overview
 • New compiler architecture built with reusable components
   ■ Retarget existing languages to JIT or static compilation
   ■ Many optimizations and supported targets




 • llvm-gcc: drop in GCC-compatible compiler
   ■ Better & faster optimizer
   ■ Production quality




                                                            http://llvm.org
LLVM Overview
 • New compiler architecture built with reusable components
   ■ Retarget existing languages to JIT or static compilation
   ■ Many optimizations and supported targets




 • llvm-gcc: drop in GCC-compatible compiler
   ■ Better & faster optimizer
   ■ Production quality




 • Clang front-end: C/ObjC/C++ front-end
   ■ Several times faster than GCC
   ■ Much better end-user features (warnings/errors)




                                                            http://llvm.org
LLVM Overview
 • New compiler architecture built with reusable components
   ■ Retarget existing languages to JIT or static compilation
   ■ Many optimizations and supported targets




 • llvm-gcc: drop in GCC-compatible compiler
   ■ Better & faster optimizer                 Come join us at:
   ■ Production quality
                                               http://llvm.org
                                               http://clang.llvm.org
 • Clang front-end: C/ObjC/C++ front-end
   ■ Several times faster than GCC
   ■ Much better end-user features (warnings/errors)




 • LLVM 2.4 release this week!
                                                            http://llvm.org

Más contenido relacionado

La actualidad más candente

How to write a TableGen backend
How to write a TableGen backendHow to write a TableGen backend
How to write a TableGen backendMin-Yih Hsu
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingViller Hsiao
 
DWARF Data Representation
DWARF Data RepresentationDWARF Data Representation
DWARF Data RepresentationWang Hsiangkai
 
Tensorflow Lite and ARM Compute Library
Tensorflow Lite and ARM Compute LibraryTensorflow Lite and ARM Compute Library
Tensorflow Lite and ARM Compute LibraryKobe Yu
 
Integrated Register Allocation introduction
Integrated Register Allocation introductionIntegrated Register Allocation introduction
Integrated Register Allocation introductionShiva Chen
 
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
BPF  & Cilium - Turning Linux into a Microservices-aware Operating SystemBPF  & Cilium - Turning Linux into a Microservices-aware Operating System
BPF & Cilium - Turning Linux into a Microservices-aware Operating SystemThomas Graf
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scriptingvceder
 
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...Linaro
 
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security
Cilium - Bringing the BPF Revolution to Kubernetes Networking and SecurityCilium - Bringing the BPF Revolution to Kubernetes Networking and Security
Cilium - Bringing the BPF Revolution to Kubernetes Networking and SecurityThomas Graf
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixBrendan Gregg
 
A hands-on introduction to the ELF Object file format
A hands-on introduction to the ELF Object file formatA hands-on introduction to the ELF Object file format
A hands-on introduction to the ELF Object file formatrety61
 
SFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driverSFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driverLinaro
 
Gotchas using Terraform in a secure delivery pipeline
Gotchas using Terraform in a secure delivery pipelineGotchas using Terraform in a secure delivery pipeline
Gotchas using Terraform in a secure delivery pipelineAnton Babenko
 
Accelerating Virtual Machine Access with the Storage Performance Development ...
Accelerating Virtual Machine Access with the Storage Performance Development ...Accelerating Virtual Machine Access with the Storage Performance Development ...
Accelerating Virtual Machine Access with the Storage Performance Development ...Michelle Holley
 

La actualidad más candente (20)

A Peek into TFRT
A Peek into TFRTA Peek into TFRT
A Peek into TFRT
 
How to write a TableGen backend
How to write a TableGen backendHow to write a TableGen backend
How to write a TableGen backend
 
Meet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracingMeet cute-between-ebpf-and-tracing
Meet cute-between-ebpf-and-tracing
 
DWARF Data Representation
DWARF Data RepresentationDWARF Data Representation
DWARF Data Representation
 
Tensorflow Lite and ARM Compute Library
Tensorflow Lite and ARM Compute LibraryTensorflow Lite and ARM Compute Library
Tensorflow Lite and ARM Compute Library
 
Integrated Register Allocation introduction
Integrated Register Allocation introductionIntegrated Register Allocation introduction
Integrated Register Allocation introduction
 
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
BPF  & Cilium - Turning Linux into a Microservices-aware Operating SystemBPF  & Cilium - Turning Linux into a Microservices-aware Operating System
BPF & Cilium - Turning Linux into a Microservices-aware Operating System
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
HKG18-411 - Introduction to OpenAMP which is an open source solution for hete...
 
淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道 淺談探索 Linux 系統設計之道
淺談探索 Linux 系統設計之道
 
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security
Cilium - Bringing the BPF Revolution to Kubernetes Networking and SecurityCilium - Bringing the BPF Revolution to Kubernetes Networking and Security
Cilium - Bringing the BPF Revolution to Kubernetes Networking and Security
 
eBPF Workshop
eBPF WorkshopeBPF Workshop
eBPF Workshop
 
Kernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at NetflixKernel Recipes 2017: Using Linux perf at Netflix
Kernel Recipes 2017: Using Linux perf at Netflix
 
A hands-on introduction to the ELF Object file format
A hands-on introduction to the ELF Object file formatA hands-on introduction to the ELF Object file format
A hands-on introduction to the ELF Object file format
 
Qemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System EmulationQemu JIT Code Generator and System Emulation
Qemu JIT Code Generator and System Emulation
 
SFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driverSFO15-200: Linux kernel generic TEE driver
SFO15-200: Linux kernel generic TEE driver
 
Gotchas using Terraform in a secure delivery pipeline
Gotchas using Terraform in a secure delivery pipelineGotchas using Terraform in a secure delivery pipeline
Gotchas using Terraform in a secure delivery pipeline
 
C Programming - Refresher - Part I
C Programming - Refresher - Part I C Programming - Refresher - Part I
C Programming - Refresher - Part I
 
Accelerating Virtual Machine Access with the Storage Performance Development ...
Accelerating Virtual Machine Access with the Storage Performance Development ...Accelerating Virtual Machine Access with the Storage Performance Development ...
Accelerating Virtual Machine Access with the Storage Performance Development ...
 
Memory model
Memory modelMemory model
Memory model
 

Destacado

Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvmTao He
 
Clang Analyzer Tool Review
Clang Analyzer Tool ReviewClang Analyzer Tool Review
Clang Analyzer Tool ReviewDoug Schuster
 
英語での効果的な研究プレゼンのコツと技法ワークショップ
英語での効果的な研究プレゼンのコツと技法ワークショップ英語での効果的な研究プレゼンのコツと技法ワークショップ
英語での効果的な研究プレゼンのコツと技法ワークショップ英文校正エディテージ
 
Homework1 presentation
Homework1 presentationHomework1 presentation
Homework1 presentationJames Donnelly
 
How to personally brand yourself - The Marketing Muse 360
How to personally brand yourself   - The Marketing Muse 360 How to personally brand yourself   - The Marketing Muse 360
How to personally brand yourself - The Marketing Muse 360 The Marketing Muse 360
 
研究成果の発表に効果的な図表の使い方
研究成果の発表に効果的な図表の使い方研究成果の発表に効果的な図表の使い方
研究成果の発表に効果的な図表の使い方英文校正エディテージ
 
Bioequvalence and bioavailbility by Manoj Pandey
Bioequvalence and bioavailbility  by Manoj PandeyBioequvalence and bioavailbility  by Manoj Pandey
Bioequvalence and bioavailbility by Manoj Pandeymanoj_lko
 
インパクトファクターとジャーナルの名声を評価するその他の指標
インパクトファクターとジャーナルの名声を評価するその他の指標インパクトファクターとジャーナルの名声を評価するその他の指標
インパクトファクターとジャーナルの名声を評価するその他の指標英文校正エディテージ
 
優れたタイトルとアブストラクト、適切なキーワード選び
優れたタイトルとアブストラクト、適切なキーワード選び優れたタイトルとアブストラクト、適切なキーワード選び
優れたタイトルとアブストラクト、適切なキーワード選び英文校正エディテージ
 
[Editage Seminar] Common language mistakes made by Japanese authors and essen...
[Editage Seminar] Common language mistakes made by Japanese authors and essen...[Editage Seminar] Common language mistakes made by Japanese authors and essen...
[Editage Seminar] Common language mistakes made by Japanese authors and essen...英文校正エディテージ
 
Report text elephant vina 9c 32
Report text elephant vina 9c 32Report text elephant vina 9c 32
Report text elephant vina 9c 32Vina Herlinasari
 
Sequence learning under incidental conditions [poster]
Sequence learning under incidental conditions [poster]Sequence learning under incidental conditions [poster]
Sequence learning under incidental conditions [poster]Fayme Yeates
 
llvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Pythonllvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Pythonmdevan
 

Destacado (20)

LLVM Overview
LLVM OverviewLLVM Overview
LLVM Overview
 
Introduction to llvm
Introduction to llvmIntroduction to llvm
Introduction to llvm
 
Clang Analyzer Tool Review
Clang Analyzer Tool ReviewClang Analyzer Tool Review
Clang Analyzer Tool Review
 
英語での効果的な研究プレゼンのコツと技法ワークショップ
英語での効果的な研究プレゼンのコツと技法ワークショップ英語での効果的な研究プレゼンのコツと技法ワークショップ
英語での効果的な研究プレゼンのコツと技法ワークショップ
 
Homework1 presentation
Homework1 presentationHomework1 presentation
Homework1 presentation
 
How to personally brand yourself - The Marketing Muse 360
How to personally brand yourself   - The Marketing Muse 360 How to personally brand yourself   - The Marketing Muse 360
How to personally brand yourself - The Marketing Muse 360
 
研究成果の発表に効果的な図表の使い方
研究成果の発表に効果的な図表の使い方研究成果の発表に効果的な図表の使い方
研究成果の発表に効果的な図表の使い方
 
Cep 812
Cep 812Cep 812
Cep 812
 
уцмр
уцмруцмр
уцмр
 
Bioequvalence and bioavailbility by Manoj Pandey
Bioequvalence and bioavailbility  by Manoj PandeyBioequvalence and bioavailbility  by Manoj Pandey
Bioequvalence and bioavailbility by Manoj Pandey
 
уцмр
уцмруцмр
уцмр
 
インパクトファクターとジャーナルの名声を評価するその他の指標
インパクトファクターとジャーナルの名声を評価するその他の指標インパクトファクターとジャーナルの名声を評価するその他の指標
インパクトファクターとジャーナルの名声を評価するその他の指標
 
優れたタイトルとアブストラクト、適切なキーワード選び
優れたタイトルとアブストラクト、適切なキーワード選び優れたタイトルとアブストラクト、適切なキーワード選び
優れたタイトルとアブストラクト、適切なキーワード選び
 
[Editage Seminar] Common language mistakes made by Japanese authors and essen...
[Editage Seminar] Common language mistakes made by Japanese authors and essen...[Editage Seminar] Common language mistakes made by Japanese authors and essen...
[Editage Seminar] Common language mistakes made by Japanese authors and essen...
 
Report text elephant vina 9c 32
Report text elephant vina 9c 32Report text elephant vina 9c 32
Report text elephant vina 9c 32
 
LLVM introduction
LLVM introductionLLVM introduction
LLVM introduction
 
Sequence learning under incidental conditions [poster]
Sequence learning under incidental conditions [poster]Sequence learning under incidental conditions [poster]
Sequence learning under incidental conditions [poster]
 
Pnomics-2015-FINAL-kbs
Pnomics-2015-FINAL-kbsPnomics-2015-FINAL-kbs
Pnomics-2015-FINAL-kbs
 
CogSci2014-kbs-2
CogSci2014-kbs-2CogSci2014-kbs-2
CogSci2014-kbs-2
 
llvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Pythonllvm-py: Writing Compilers In Python
llvm-py: Writing Compilers In Python
 

Similar a Introduction to the LLVM Compiler System

차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVMJung Kim
 
Docker and the K computer
Docker and the K computerDocker and the K computer
Docker and the K computerPeter Bryzgalov
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMSherif Mousa
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3aminmesbahi
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Ahmed El-Arabawy
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesCharlie Gracie
 
[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly
[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly
[COSCUP 2021] LLVM Project: The Good, The Bad, and The UglyMin-Yih Hsu
 
C Programming[Sample]
C Programming[Sample]C Programming[Sample]
C Programming[Sample]Mostafa Ali
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019corehard_by
 
computer languages
computer languagescomputer languages
computer languagesRajendran
 
Understanding how C program works
Understanding how C program worksUnderstanding how C program works
Understanding how C program worksMindBridgeTech
 
State of Builder and Buildkit by Tonis Tiigi (Docker)
State of Builder and Buildkit by Tonis Tiigi (Docker)State of Builder and Buildkit by Tonis Tiigi (Docker)
State of Builder and Buildkit by Tonis Tiigi (Docker)Docker, Inc.
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterHossam Hassan
 

Similar a Introduction to the LLVM Compiler System (20)

Os Lattner
Os LattnerOs Lattner
Os Lattner
 
Linux programming
Linux programmingLinux programming
Linux programming
 
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
차세대컴파일러, VM의미래: 애플 오픈소스 LLVM
 
Docker and the K computer
Docker and the K computerDocker and the K computer
Docker and the K computer
 
Building Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARMBuilding Embedded Linux Full Tutorial for ARM
Building Embedded Linux Full Tutorial for ARM
 
.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3.NET Core, ASP.NET Core Course, Session 3
.NET Core, ASP.NET Core Course, Session 3
 
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
 
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot RuntimesJfokus 2016 - A JVMs Journey into Polyglot Runtimes
Jfokus 2016 - A JVMs Journey into Polyglot Runtimes
 
[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly
[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly
[COSCUP 2021] LLVM Project: The Good, The Bad, and The Ugly
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 
C Programming[Sample]
C Programming[Sample]C Programming[Sample]
C Programming[Sample]
 
Embedded Linux on ARM
Embedded Linux on ARMEmbedded Linux on ARM
Embedded Linux on ARM
 
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
The Hitchhiker's Guide to Faster Builds. Viktor Kirilov. CoreHard Spring 2019
 
computer languages
computer languagescomputer languages
computer languages
 
Embedded Operating System - Linux
Embedded Operating System - LinuxEmbedded Operating System - Linux
Embedded Operating System - Linux
 
Understanding how C program works
Understanding how C program worksUnderstanding how C program works
Understanding how C program works
 
State of Builder and Buildkit by Tonis Tiigi (Docker)
State of Builder and Buildkit by Tonis Tiigi (Docker)State of Builder and Buildkit by Tonis Tiigi (Docker)
State of Builder and Buildkit by Tonis Tiigi (Docker)
 
Best DotNet Training in Delhi
Best   DotNet Training  in DelhiBest   DotNet Training  in Delhi
Best DotNet Training in Delhi
 
Python programming 2nd
Python programming 2ndPython programming 2nd
Python programming 2nd
 
Embedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals masterEmbedded c c++ programming fundamentals master
Embedded c c++ programming fundamentals master
 

Último

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Último (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

Introduction to the LLVM Compiler System

  • 1. Introduction to the LLVM Compiler System Chris Lattner llvm.org Architect November 4, 2008 ACAT’08 - Erice, Sicily
  • 2. What is the LLVM Project? • Collection of industrial strength compiler technology ■ Optimizer and Code Generator ■ llvm-gcc and Clang Front-ends ■ MSIL and .NET Virtual Machines http://llvm.org
  • 3. What is the LLVM Project? • Collection of industrial strength compiler technology ■ Optimizer and Code Generator ■ llvm-gcc and Clang Front-ends ■ MSIL and .NET Virtual Machines • Open Source Project with many contributors ■ Industry, Research Groups, Individuals http://llvm.org/ http://llvm.org
  • 4. Why New Compilers? http://llvm.org
  • 5. Why New Compilers? • Existing Open Source C Compilers have Stagnated! http://llvm.org
  • 6. Why New Compilers? • Existing Open Source C Compilers have Stagnated! • How? ■ Based on decades old code generation technology ■ No modern techniques like cross-file optimization and JIT codegen ■ Aging code bases: difficult to learn, hard to change substantially ■ Can’t be reused in other applications ■ Keep getting slower with every release http://llvm.org
  • 7. What I want! http://llvm.org
  • 8. What I want! • A set of production-quality reusable libraries: ■ ... which implement the best known techniques drawing from modern literature ■ ... which focus on compile time ■ ... and performance of the generated code • Ideally support many different languages and applications! http://llvm.org
  • 9. LLVM Vision and Approach • Primary mission: build a set of modular compiler components: ■ Reduces the time & cost to construct a particular compiler ■ Components are shared across different compilers ■ Allows choice of the right component for the job X86 PPC CBE clang GCC LTO ... Code DWARF Target JIT Optzn linker IPO ... gen BC IO LL IO System Core Support xforms analysis GC ... http://llvm.org
  • 10. LLVM Vision and Approach • Primary mission: build a set of modular compiler components: ■ Reduces the time & cost to construct a particular compiler ■ Components are shared across different compilers ■ Allows choice of the right component for the job • Secondary mission: Build compilers out of these components ■ ... for example, a truly great C compiler ■ ... for example, a runtime specialization engine X86 PPC CBE clang GCC LTO ... Code DWARF Target JIT Optzn linker IPO ... gen BC IO LL IO System Core Support xforms analysis GC ... http://llvm.org
  • 11. Talk Overview • Intro and Motivation • LLVM as a C and C++ Compiler • Other LLVM Capabilities • Going Forward http://llvm.org
  • 12. LLVM-GCC 4.2 • C, C++, Objective C, Ada and Fortran • Standard GCC command line options • Supports almost all GCC language features and extensions • Supports many targets, including X86, X86-64, PowerPC, etc. • Extremely compatible with GCC 4.2 http://llvm.org
  • 13. LLVM-GCC 4.2 • C, C++, Objective C, Ada and Fortran • Standard GCC command line options • Supports almost all GCC language features and extensions • Supports many targets, including X86, X86-64, PowerPC, etc. • Extremely compatible with GCC 4.2 What does it mean to be both LLVM and GCC? http://llvm.org
  • 14. LLVM GCC 4.2 Design • Replace GCC optimizer and code generator with LLVM ■ Reuses GCC parser and runtime libraries C C++ GCC 4.2 GCC Code Front-end GCC Optimizer Generator .s file ... GCC 4.2 http://llvm.org
  • 15. LLVM GCC 4.2 Design • Replace GCC optimizer and code generator with LLVM ■ Reuses GCC parser and runtime libraries C GCC 4.2 LLVM Code C++ Front-end LLVM Optimizer Generator .s file ... LLVM GCC 4.2 C C++ GCC 4.2 GCC Code Front-end GCC Optimizer Generator .s file ... GCC 4.2 http://llvm.org
  • 16. Linking LLVM and GCC compiled code • Safe to mix and match .o files between compilers • Safe to call into libraries built with other compilers .o files a.c gcc -O2 b.c llvm-gcc -O3 Disk Storage http://llvm.org
  • 17. Linking LLVM and GCC compiled code • Safe to mix and match .o files between compilers • Safe to call into libraries built with other compilers .o files a.c gcc -O2 b.c llvm-gcc -O3 Disk Storage http://llvm.org
  • 18. Linking LLVM and GCC compiled code • Safe to mix and match .o files between compilers • Safe to call into libraries built with other compilers .o files a.c gcc -O2 b.c llvm-gcc -O3 Linker exe Disk Storage http://llvm.org
  • 19. Potential Impact of LLVM Optimizer • Generated Code ■ How fast does the code run? http://llvm.org
  • 20. Potential Impact of LLVM Optimizer • Generated Code ■ How fast does the code run? • Compile Times ■ How fast can we get code from the compiler? http://llvm.org
  • 21. Potential Impact of LLVM Optimizer • Generated Code ■ How fast does the code run? • Compile Times ■ How fast can we get code from the compiler? • New Features http://llvm.org
  • 22. Potential Impact of LLVM Optimizer • Generated Code ■ How fast does the code run? • Compile Times ■ How fast can we get code from the compiler? • New Features Link Time Optimization http://llvm.org
  • 23. New Feature: Link Time Optimization • Optimize (e.g. inline, constant fold, etc) across files with -O4 • Optimize across language boundaries too! .o files a.c gcc -O3 b.c llvm-gcc -O4 Linker exe Disk Storage http://llvm.org
  • 24. New Feature: Link Time Optimization • Optimize (e.g. inline, constant fold, etc) across files with -O4 • Optimize across language boundaries too! .o files a.c gcc -O3 b.c llvm-gcc -O4 Linker exe c.c llvm-gcc -O4 Disk Storage http://llvm.org
  • 25. New Feature: Link Time Optimization • Optimize (e.g. inline, constant fold, etc) across files with -O4 • Optimize across language boundaries too! .o files a.c gcc -O3 b.c llvm-gcc -O4 Linker exe c.c llvm-gcc -O4 LLVM Link Time Optimizer Disk Storage http://llvm.org
  • 26. New Feature: Link Time Optimization • Optimize (e.g. inline, constant fold, etc) across files with -O4 • Optimize across language boundaries too! .o files a.c gcc -O3 b.c llvm-gcc -O4 Linker exe c.c llvm-gcc -O4 LLVM Link Time Optimizer d.cpp llvm-g++ -O4 Disk Storage http://llvm.org
  • 27. SPEC INT 2000 Compile Time In seconds: Lower is Better Optimization Level http://llvm.org
  • 28. SPEC INT 2000 Compile Time 200s In seconds: Lower is Better 187s GCC 4.2 LLVM GCC 4.2 164s 160s 133s 120s 90s 79s 80s 40s 0s -O0 -O0 -g -O1 -O2 -O3 -O4: LTO Optimization Level http://llvm.org
  • 29. SPEC INT 2000 Compile Time 200s In seconds: Lower is Better 187s GCC 4.2 LLVM GCC 4.2 164s 160s 144s 133s 131s 126s 120s 112s 97s 90s 79s 80s 74s 40s 0s -O0 -O0 -g -O1 -O2 -O3 -O4: LTO Optimization Level http://llvm.org
  • 30. SPEC INT 2000 Compile Time 200s In seconds: Lower is Better 187s GCC 4.2 LLVM GCC 4.2 164s 160s 144s 133s 126s 131s Faster than 120s GCC at -O2! 112s 42% Faster 97s at -O3! 90s 79s 30% Faster 80s 74s 18% Faster at -O2! at -O1! 40s 0s -O0 -O0 -g -O1 -O2 -O3 -O4: LTO Optimization Level http://llvm.org
  • 31. SPEC 2000 Execution Time Relative to GCC -O2: Lower is Faster GCC 4.2 LLVM GCC 4.2 Optimization Level http://llvm.org
  • 32. SPEC 2000 Execution Time Relative to GCC -O2: Lower is Faster 100% GCC 4.2 96.3% LLVM GCC 4.2 95% 90% 85% 80% 75% -O2 -O3 -O4 (LTO) Optimization Level http://llvm.org
  • 33. SPEC 2000 Execution Time Relative to GCC -O2: Lower is Faster 100% GCC 4.2 96.3% LLVM GCC 4.2 95% 95.1% 5% Faster 92.5% 90% at -O2! 4% Faster at -O3! 85% 80% 75% -O2 -O3 -O4 (LTO) Optimization Level http://llvm.org
  • 34. SPEC 2000 Execution Time Relative to GCC -O2: Lower is Faster 100% GCC 4.2 96.3% LLVM GCC 4.2 95% 95.1% 5% Faster 92.5% 90% at -O2! 4% Faster at -O3! 85% 20% Faster than -O3! 80% 80.3% 75% -O2 -O3 -O4 (LTO) Optimization Level http://llvm.org
  • 35. llvm-gcc 4.2 Summary • Drop in replacement for GCC 4.2 ■ Compatible with GCC command line options and languages ■ Works with existing makefiles (e.g. “make CC=llvm-gcc”) • Benefits of LLVM Optimizer and Code Generator ■ Much faster optimizer: ~30-40% at -O3 in most cases ■ Slightly better codegen at a given level: ~5-10% on x86/x86-64 ■ Link-Time Optimization at -O4: optimize across source files http://llvm.org
  • 36. Talk Overview • Intro and Motivation • LLVM as a C and C++ Compiler • Other LLVM Capabilities • LLVM Going Forward http://llvm.org
  • 37. LLVM For Compiler Hackers • LLVM is a great target for new languages ■ Well defined, simple to program for ■ Easy to retarget existing compiler to use LLVM backend • LLVM supports Just-In-Time optimization and compilation ■ Optimize code at runtime based on dynamic information ■ Easy to retarget existing bytecode interpreter to LLVM JIT ■ Great for performance, not just for traditional “compilers” http://llvm.org
  • 38. Colorspace Conversion JIT Optimization • Code to convert from one color format to another: ■ e.g. BGRA 444R -> RGBA 8888 ■ Hundreds of combinations, importance depends on input for each pixel { switch (infmt) { case RGBA 5551: R = (*in >> 11) & C G = (*in >> 6) & C B = (*in >> 1) & C ... } switch (outfmt) { case RGB888: *outptr = R << 16 | G << 8 ... } } http://llvm.org
  • 39. Colorspace Conversion JIT Optimization • Code to convert from one color format to another: ■ e.g. BGRA 444R -> RGBA 8888 ■ Hundreds of combinations, importance depends on input for each pixel { for each pixel { switch (infmt) { R = (*in >> 11) & C; case RGBA 5551: G = (*in >> 6) & C; R = (*in >> 11) & C B = (*in >> 1) & C; G = (*in >> 6) & C Run-time *outptr = R << 16 | B = (*in >> 1) & C G << 8 ... specialize ... } } switch (outfmt) { case RGB888: *outptr = R << 16 | Compiler optimizes G << 8 ... shifts and masking } } http://llvm.org
  • 40. Colorspace Conversion JIT Optimization • Code to convert from one color format to another: ■ e.g. BGRA 444R -> RGBA 8888 ■ Hundreds of combinations, importance depends on input for each pixel { for each pixel { switch (infmt) { R = (*in >> 11) & C; case RGBA 5551: G = (*in >> 6) & C; R = (*in >> 11) & C B = (*in >> 1) & C; G = (*in >> 6) & C Run-time *outptr = R << 16 | B = (*in >> 1) & C G << 8 ... specialize ... } } switch (outfmt) { case RGB888: *outptr = R << 16 | Compiler optimizes G << 8 ... shifts and masking } } Speedup depends on src/dest format: 5.4x speedup on average, 19.3x max speedup: (13.3MB/s to 257.7MB/s) http://llvm.org
  • 41. Another example: RegEx Compilation • Many regex’s are matched millions of times: ■ Match time is critical • Common regex engines ‘compile’ to ‘bytecode’ and interpret: ■ regcomp/regexec • Why not compile to native code? Partial Evaluation! ■ regcomp compiles regex to a native function ■ Much faster matching, could even vectorize common idioms • Excellent way to handle multiple different Unicode encodings http://llvm.org
  • 42. Talk Overview • Intro and Motivation • LLVM as a C and C++ Compiler • Other LLVM Capabilities • LLVM Going Forward http://llvm.org
  • 43. LLVM Going Forward • More of the same... http://llvm.org
  • 44. LLVM Going Forward • More of the same... ■ Even faster optimizer ■ Even better optimizations ■ More features for non-C languages ■ Debug Info Improvements ■ Many others... http://llvm.org
  • 45. LLVM Going Forward • More of the same... ■ Even faster optimizer ■ Even better optimizations ■ More features for non-C languages ■ Debug Info Improvements ■ Many others... Better tools for source level analysis of C/C++ programs! http://llvm.org
  • 46. Clang Frontend: What is it? • C, Objective-C, and C++ front-end • Aggressive project with many goals... ■ Compatibility with GCC ■ Fast compilation ■ Expressive error messages • Host for a broad range of source-level tools http://llvm.org
  • 47. Clang Frontend: What is it? • C, Objective-C, and C++ front-end • Aggressive project with many goals... ■ Compatibility with GCC ■ Fast compilation ■ Expressive error messages t.c:6:49: error: invalid operands to binary expression ('int' and 'struct A') return intArg + func(intArg ? ((someA.X+40) + someA) / 42 : someA.X)); ~~~~~~~~~~~~ ^ ~~~~~ • Host for a broad range of source-level tools http://llvm.org
  • 48. Clang Frontend: What is it? • C, Objective-C, and C++ front-end • Aggressive project with many goals... ■ Compatibility with GCC ■ Fast compilation ■ Expressive error messages t.c:6:49: error: invalid operands to binary expression ('int' and 'struct A') return intArg + func(intArg ? ((someA.X+40) + someA) / 42 : someA.X)); ~~~~~~~~~~~~ ^ ~~~~~ • Host for a broad range of source-level tools http://llvm.org
  • 49. Clang Compile Time PostgreSQL -fsyntax-only Time: 665K lines of C code in 619 files http://llvm.org
  • 50. Clang Compile Time PostgreSQL -fsyntax-only Time: 665K lines of C code in 619 files 49s GCC 4.2 clang http://llvm.org
  • 51. Clang Compile Time PostgreSQL -fsyntax-only Time: 665K lines of C code in 619 files 49s 2.3x faster 21s GCC 4.2 clang http://llvm.org
  • 52. LLVM Overview • New compiler architecture built with reusable components ■ Retarget existing languages to JIT or static compilation ■ Many optimizations and supported targets http://llvm.org
  • 53. LLVM Overview • New compiler architecture built with reusable components ■ Retarget existing languages to JIT or static compilation ■ Many optimizations and supported targets • llvm-gcc: drop in GCC-compatible compiler ■ Better & faster optimizer ■ Production quality http://llvm.org
  • 54. LLVM Overview • New compiler architecture built with reusable components ■ Retarget existing languages to JIT or static compilation ■ Many optimizations and supported targets • llvm-gcc: drop in GCC-compatible compiler ■ Better & faster optimizer ■ Production quality • Clang front-end: C/ObjC/C++ front-end ■ Several times faster than GCC ■ Much better end-user features (warnings/errors) http://llvm.org
  • 55. LLVM Overview • New compiler architecture built with reusable components ■ Retarget existing languages to JIT or static compilation ■ Many optimizations and supported targets • llvm-gcc: drop in GCC-compatible compiler ■ Better & faster optimizer Come join us at: ■ Production quality http://llvm.org http://clang.llvm.org • Clang front-end: C/ObjC/C++ front-end ■ Several times faster than GCC ■ Much better end-user features (warnings/errors) • LLVM 2.4 release this week! http://llvm.org