[LLVMdev] running a module pass via opt on multiple bitcode files
John Criswell
criswell at illinois.edu
Thu Sep 22 14:08:31 PDT 2011
On 9/22/11 4:04 PM, Jinwook Shin wrote:
> Thanks John. I appreciate your help.
De nada.
>
> I have taken the libLTO approach and it worked like a charm :) For
> those who wanted to achieve the same thing, below are the steps I've
> taken.
>
> John -- a small question: I thought I wouldn't need to touch
> Makefiles at all, but that wasn't the case. Could you take a look at
> Step 4) and tell me what you think? Thanks!
A properly written project will allow the person compiling the software
to easily change the compiler and the compiler/linker flags used.
For example, autoconf-based configure scripts usually use the following
environment variables:
CC - C compiler
CXX - C++ compiler
CFLAGS - compiler flags
LDFLAGS - linker flags
So, you would do the following in sh/ksh syntax:
CC=llvm-gcc
CXX=llvm-g++
CFLAGS="-emit-llvm"
export CC
export CXX
export CFLAGS
./configure
>
> 1) Create your own libLTO and add your pass to it. Do a code diff
> between /safecode/tools/LTO/LTOCodeGenerator.cpp
> and /llvm/tools/lto/LTOCodeGenerator.cpp to figure out what changes
> are needed to do this.
> 2) Make a backup copy of the original linker /usr/lib/libLTO.dylib.
> 3) Copy your libLTO.dylib to /usr/lib.
> 4) Open Makefiles in your target project and change CC and CFLAGS as
> follows:
> CC=llvm-gcc
> CFLAGS=-emit-llvm …
> 5) Build the project with LLVM.
-- John T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110922/2c6c2150/attachment.html>
More information about the llvm-dev
mailing list