Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

llvm and install time optimization

Based on LLVM official page, it is possible to have install-time optimization, based on my understanding, which first compiles to bytecode on build machine before distribution, and then on target machines, converts the bytecode to native code when installing.

Is there any real world example on this feature? More specifically, I am wondering if it is possible to take an arbitrary open source C/C++ project which uses autoconf (i.e. typically built and installed by ./configure && make && make install), and

  1. on build machine, by running ./configure && make in a special way (e.g. setting some environment variables, or even modify the configure.ac or some other autoconf files) so that it generates executable and libraries as byte code;
  2. I transfer the build tree to target machine, and run make install in a special way so that it installs all files as usual, but converts byte code to native code for executable and libraries.
like image 594
Kan Li Avatar asked Mar 22 '14 11:03

Kan Li


People also ask

What is LLVM optimization?

LLVM divides the entire compilation process into three steps: Frontend: Convert the high-level language to IR. Middle-End: Perform optimization in the IR layer. Backend: Convert the IR into the assembly language of the corresponding hardware platform.

How link time optimization works?

What is Link Time Optimization (LTO) Link Time Optimization is a form of interprocedural optimization that is performed at the time of linking application code. Without LTO, Arm® Compiler for Linux compiles and optimizes each source file independently of one another, then links them to form the executable.

What is LTO LLVM?

LLVM features powerful intermodular optimizations which can be used at link time. Link Time Optimization (LTO) is another name for intermodular optimization when performed during the link stage. This document describes the interface and design between the LTO optimizer and the linker.

What is full LTO?

LTO (Link Time Optimization) achieves better runtime performance through whole-program analysis and cross-module optimization. However, monolithic LTO implements this by merging all input into a single module, which is not scalable in time or memory, and also prevents fast incremental compiles.


1 Answers

As @delnan indicated, this isn't possible in general. LLVM is a target independent IR, but it is not portable.

There have been a few attempts to construct a portable IR, PNaCl among them, but these are different from LLVM.

like image 108
Chandler Carruth Avatar answered Sep 17 '22 22:09

Chandler Carruth