[LLVMdev] how to compile several files at ipa level using LLVM?

Tianwei tianwei.sheng at gmail.com
Wed Sep 5 01:02:32 PDT 2007


Hi,all:
  I download the 2.0 source and compile the llvm-gcc and llvm source code
successfully. now  try to compile the following two files using linking time
optimization:
a.c:
#include <stdio.h>
extern foo(int *x);
int main()
{
  int x = 5;
  foo(&x);
  printf("x = %d\n",x);
}

b.c:
void  foo(int *x)
{
  *x = 8;
}

now after reading  some tutorial and documents, I use the following steps to
get the result:
1. llvm-gcc -O3 -emit-llvm a.c -c -o a.bc
2.llvm-gcc -O3 -emit-llvm b.c -c -o b.bc
3. llvm-link -o final.bc a.bc b.bc
4.lli final.bc
  x =  8

I want to know what's the standard process to compile programs at
inter-procedural level?  for example, how can I write the config file in
SPEC CPU2000 if I want to
compile them at "-O3 -ipo", is there any way as intel compiler did? or is
there any document for this?

thanks very much.


tianwei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070905/c2b58caf/attachment.html>


More information about the llvm-dev mailing list