<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [LLVMdev] llvmc for PIC16</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Thanks a lot.<BR>
This is a great help.<BR>
<BR>
- Sanjiv<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: llvmdev-bounces@cs.uiuc.edu on behalf of Mikhail Glushenkov<BR>
Sent: Sun 6/7/2009 12:49 PM<BR>
To: llvmdev@cs.uiuc.edu<BR>
Subject: Re: [LLVMdev] llvmc for PIC16<BR>
<BR>
Hi Sanjiv,<BR>
<BR>
Sanjiv Gupta <sanjiv.gupta <at> microchip.com> writes:<BR>
<BR>
> The salient features that we want to have in the driver are:<BR>
> [...]<BR>
<BR>
As promised, I've implemented a basic compiler driver for the<BR>
PIC16 toolchain. It's under tools/llvmc/examples/mcc16.<BR>
<BR>
Some examples illustrating the features you requested: <BR>
<BR>
> 2. If the user has specified to generate the final executable, then<BR>
> llvm-ld should run on all the .bc files generated by clang and create a<BR>
> single optimized .bc file for further tools.<BR>
<BR>
$ mcc16 -dry-run foo.c bar.c<BR>
clang-cc foo.c -o /tmp/llvm_6ibgr9/foo.bc<BR>
clang-cc bar.c -o /tmp/llvm_6ibgr9/bar.bc<BR>
llvm-ld /tmp/llvm_6ibgr9/foo.bc /tmp/llvm_6ibgr9/bar.bc \<BR>
-o /tmp/llvm_6ibgr9/tmp.bc<BR>
llc -f /tmp/llvm_6ibgr9/tmp.bc -o /tmp/llvm_6ibgr9/tmp.s<BR>
native-as /tmp/llvm_6ibgr9/tmp.s -o /tmp/llvm_6ibgr9/tmp.o<BR>
native-ld /tmp/llvm_6ibgr9/tmp.o -o a.out<BR>
<BR>
> 3. -Wo <options> - pass optimizations to the llvm-ld<BR>
> 4. mcc16 -Wl <options> - pass options to native linker.<BR>
> 5. mcc16 -Wa <options> - pass options to native assembler.<BR>
<BR>
$ mcc16 -dry-run -Wo,-opt1 -Wllc,-opt2 -Wa,-opt3 -Wl,-opt4 foo.c<BR>
clang-cc foo.c -o /tmp/llvm_92HLCj/foo.bc<BR>
llvm-ld -opt1 /tmp/llvm_92HLCj/foo.bc -o /tmp/llvm_92HLCj/tmp.bc<BR>
llc -opt2 -f /tmp/llvm_92HLCj/tmp.bc -o /tmp/llvm_92HLCj/tmp.s<BR>
native-as -opt3 /tmp/llvm_92HLCj/tmp.s -o /tmp/llvm_92HLCj/tmp.o<BR>
native-ld -opt4 /tmp/llvm_92HLCj/tmp.o -o a.out<BR>
<BR>
> $ mcc16 -S foo.c<BR>
<BR>
$ mcc16 -dry-run -S foo.c<BR>
clang-cc foo.c -o /tmp/llvm_0uiDCR/foo.bc<BR>
llvm-ld /tmp/llvm_0uiDCR/foo.bc -o /tmp/llvm_0uiDCR/foo.bc<BR>
llc -f /tmp/llvm_0uiDCR/foo.bc -o foo.s<BR>
<BR>
> $ mcc16 -S foo.c bar.c<BR>
<BR>
$ mcc16 -dry-run -S foo.c bar.c<BR>
clang-cc foo.c -o /tmp/llvm_1zAqik/foo.bc<BR>
llvm-ld /tmp/llvm_1zAqik/foo.bc -o /tmp/llvm_1zAqik/foo.bc<BR>
llc -f /tmp/llvm_1zAqik/foo.bc -o foo.s<BR>
clang-cc bar.c -o /tmp/llvm_1zAqik/bar.bc<BR>
llvm-ld /tmp/llvm_1zAqik/bar.bc -o /tmp/llvm_1zAqik/bar.bc<BR>
llc -f /tmp/llvm_1zAqik/bar.bc -o bar.s<BR>
<BR>
> ** Use of -g causes llvm-ld to run with -disable-opt<BR>
> $ mcc16 -S -g foo.c<BR>
<BR>
$ mcc16 -dry-run -S -g foo.c <BR>
clang-cc foo.c -o /tmp/llvm_oQFmVn/foo.bc<BR>
llvm-ld -disable-opt /tmp/llvm_oQFmVn/foo.bc -o /tmp/llvm_oQFmVn/foo.bc<BR>
llc -f /tmp/llvm_oQFmVn/foo.bc -o foo.s<BR>
<BR>
> ** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc.<BR>
> $ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c<BR>
<BR>
$ mcc16 -dry-run -S -g -I ../include -pre-RA-sched=list-burr foo.c<BR>
clang-cc -I ../include foo.c -o /tmp/llvm_5VxNFQ/foo.bc<BR>
llvm-ld -disable-opt /tmp/llvm_5VxNFQ/foo.bc -o /tmp/llvm_5VxNFQ/foo.bc<BR>
llc -pre-RA-sched list-burr -f /tmp/llvm_5VxNFQ/foo.bc -o foo.s<BR>
<BR>
This should be enough to get you started.<BR>
<BR>
I'm always happy to answer any further questions you may have. If<BR>
you want to e-mail me privately, please use the.dead.shall.rise<BR>
<at_sign> gmail dot com for now (our provider problems weren't<BR>
resolved yet).<BR>
<BR>
_______________________________________________<BR>
LLVM Developers mailing list<BR>
LLVMdev@cs.uiuc.edu <A HREF="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</A><BR>
<A HREF="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A><BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>