> I'll be happy to answer any further questions you may have, feel free to e-mail > me directly (though right now our mail server is down) >The salient features that we want to have in the driver are: 1. llvm-ld will be used as "The Optimizer". 2. If the user has specified to generate the final executable, then llvm-ld should run on all the .bc files generated by clang and create a single optimized .bc file for further tools. 3. -Wo <options> - pass optimizations to the llvm-ld 4. mcc16 -Wl <options> - pass options to native linker. 5. mcc16 -Wa <options> - pass options to native assembler. Here are some example command lines and sample command invocations as to what should be done. $ mcc16 -S foo.c // [clang-cc foo.c] -> foo.bc // [llvm-ld foo.bc] -> foo.opt.bc // [llc foo.opt.bc] -> foo.s $ mcc16 -S foo.c bar.c // [clang-cc foo.c] -> foo.bc // [llvm-ld foo.bc] -> foo.opt.bc // [llc foo.opt.bc] -> foo.s // [clang-cc bar.c] -> bar.bc // [llvm-ld bar.bc] -> bar.opt.bc // [llc bar.opt.bc] -> bar.s ** Use of -g causes llvm-ld to run with -disable-opt $ mcc16 -S -g foo.c // [clang-cc foo.c] -> foo.bc // [llvm-ld -disable-opt foo.bc] -> foo.opt.bc // [llc foo.opt.bc] -> foo.s ** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc. $ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c // [clang-cc -I ../include foo.c] -> foo.bc // [llvm-ld -disable-opt foo.bc] -> foo.opt.bc // [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s ** -Wo passes options to llvm-ld $ mcc16 -Wo=opt1,opt2 -S -I ../include -pre-RA-sched=list-burr foo.c // [clang-cc -I ../include foo.c] -> foo.bc // [llvm-ld -opt1 -opt2 foo.bc] -> foo.opt.bc // [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s ** -Wa passes options to native as. $ mcc16 -c foo.c -Wa=opt1 // [clang-cc foo.c] -> foo.bc // [llvm-ld foo.bc] -> foo.opt.bc // [llc foo.opt.bc] -> foo.s // [native-as -opt1 foo.s] -> foo.o $ mcc16 -Wo=opt1 -Wl=opt2 -Wa=opt3 foo.c bar.c // [clang-cc foo.c] -> foo.bc // [clang-cc bar.c] -> bar.bc // [llvm-ld -opt1 foo.bc bar.bc] -> a.out.bc // [llc a.out.bc] -> a.out.s // [native-as -opt3 a.out.s] -> a.out.o // [native-ld -opt2 a.out.o] -> a.out Is this achievable by a tablegen based driver ? - Sanjiv
Hi Sanjiv, Sanjiv Gupta <sanjiv.gupta <at> microchip.com> writes:> The salient features that we want to have in the driver are: > [...] > > Is this achievable by a tablegen based driver ?Yes - in fact, I think I'll just write a basic mcc16 driver myself over this weekend - it'll make a great addition to the examples and a nice starting point for you to work on.
Hi Sanjiv, Sanjiv Gupta <sanjiv.gupta <at> microchip.com> writes:> The salient features that we want to have in the driver are: > [...]As promised, I've implemented a basic compiler driver for the PIC16 toolchain. It's under tools/llvmc/examples/mcc16. Some examples illustrating the features you requested:> 2. If the user has specified to generate the final executable, then > llvm-ld should run on all the .bc files generated by clang and create a > single optimized .bc file for further tools.$ mcc16 -dry-run foo.c bar.c clang-cc foo.c -o /tmp/llvm_6ibgr9/foo.bc clang-cc bar.c -o /tmp/llvm_6ibgr9/bar.bc llvm-ld /tmp/llvm_6ibgr9/foo.bc /tmp/llvm_6ibgr9/bar.bc \ -o /tmp/llvm_6ibgr9/tmp.bc llc -f /tmp/llvm_6ibgr9/tmp.bc -o /tmp/llvm_6ibgr9/tmp.s native-as /tmp/llvm_6ibgr9/tmp.s -o /tmp/llvm_6ibgr9/tmp.o native-ld /tmp/llvm_6ibgr9/tmp.o -o a.out> 3. -Wo <options> - pass optimizations to the llvm-ld > 4. mcc16 -Wl <options> - pass options to native linker. > 5. mcc16 -Wa <options> - pass options to native assembler.$ mcc16 -dry-run -Wo,-opt1 -Wllc,-opt2 -Wa,-opt3 -Wl,-opt4 foo.c clang-cc foo.c -o /tmp/llvm_92HLCj/foo.bc llvm-ld -opt1 /tmp/llvm_92HLCj/foo.bc -o /tmp/llvm_92HLCj/tmp.bc llc -opt2 -f /tmp/llvm_92HLCj/tmp.bc -o /tmp/llvm_92HLCj/tmp.s native-as -opt3 /tmp/llvm_92HLCj/tmp.s -o /tmp/llvm_92HLCj/tmp.o native-ld -opt4 /tmp/llvm_92HLCj/tmp.o -o a.out> $ mcc16 -S foo.c$ mcc16 -dry-run -S foo.c clang-cc foo.c -o /tmp/llvm_0uiDCR/foo.bc llvm-ld /tmp/llvm_0uiDCR/foo.bc -o /tmp/llvm_0uiDCR/foo.bc llc -f /tmp/llvm_0uiDCR/foo.bc -o foo.s> $ mcc16 -S foo.c bar.c$ mcc16 -dry-run -S foo.c bar.c clang-cc foo.c -o /tmp/llvm_1zAqik/foo.bc llvm-ld /tmp/llvm_1zAqik/foo.bc -o /tmp/llvm_1zAqik/foo.bc llc -f /tmp/llvm_1zAqik/foo.bc -o foo.s clang-cc bar.c -o /tmp/llvm_1zAqik/bar.bc llvm-ld /tmp/llvm_1zAqik/bar.bc -o /tmp/llvm_1zAqik/bar.bc llc -f /tmp/llvm_1zAqik/bar.bc -o bar.s> ** Use of -g causes llvm-ld to run with -disable-opt > $ mcc16 -S -g foo.c$ mcc16 -dry-run -S -g foo.c clang-cc foo.c -o /tmp/llvm_oQFmVn/foo.bc llvm-ld -disable-opt /tmp/llvm_oQFmVn/foo.bc -o /tmp/llvm_oQFmVn/foo.bc llc -f /tmp/llvm_oQFmVn/foo.bc -o foo.s> ** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc. > $ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c$ mcc16 -dry-run -S -g -I ../include -pre-RA-sched=list-burr foo.c clang-cc -I ../include foo.c -o /tmp/llvm_5VxNFQ/foo.bc llvm-ld -disable-opt /tmp/llvm_5VxNFQ/foo.bc -o /tmp/llvm_5VxNFQ/foo.bc llc -pre-RA-sched list-burr -f /tmp/llvm_5VxNFQ/foo.bc -o foo.s This should be enough to get you started. I'm always happy to answer any further questions you may have. If you want to e-mail me privately, please use the.dead.shall.rise <at_sign> gmail dot com for now (our provider problems weren't resolved yet).
Thanks a lot. This is a great help. - Sanjiv -----Original Message----- From: llvmdev-bounces at cs.uiuc.edu on behalf of Mikhail Glushenkov Sent: Sun 6/7/2009 12:49 PM To: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] llvmc for PIC16 Hi Sanjiv, Sanjiv Gupta <sanjiv.gupta <at> microchip.com> writes:> The salient features that we want to have in the driver are: > [...]As promised, I've implemented a basic compiler driver for the PIC16 toolchain. It's under tools/llvmc/examples/mcc16. Some examples illustrating the features you requested:> 2. If the user has specified to generate the final executable, then > llvm-ld should run on all the .bc files generated by clang and create a > single optimized .bc file for further tools.$ mcc16 -dry-run foo.c bar.c clang-cc foo.c -o /tmp/llvm_6ibgr9/foo.bc clang-cc bar.c -o /tmp/llvm_6ibgr9/bar.bc llvm-ld /tmp/llvm_6ibgr9/foo.bc /tmp/llvm_6ibgr9/bar.bc \ -o /tmp/llvm_6ibgr9/tmp.bc llc -f /tmp/llvm_6ibgr9/tmp.bc -o /tmp/llvm_6ibgr9/tmp.s native-as /tmp/llvm_6ibgr9/tmp.s -o /tmp/llvm_6ibgr9/tmp.o native-ld /tmp/llvm_6ibgr9/tmp.o -o a.out> 3. -Wo <options> - pass optimizations to the llvm-ld > 4. mcc16 -Wl <options> - pass options to native linker. > 5. mcc16 -Wa <options> - pass options to native assembler.$ mcc16 -dry-run -Wo,-opt1 -Wllc,-opt2 -Wa,-opt3 -Wl,-opt4 foo.c clang-cc foo.c -o /tmp/llvm_92HLCj/foo.bc llvm-ld -opt1 /tmp/llvm_92HLCj/foo.bc -o /tmp/llvm_92HLCj/tmp.bc llc -opt2 -f /tmp/llvm_92HLCj/tmp.bc -o /tmp/llvm_92HLCj/tmp.s native-as -opt3 /tmp/llvm_92HLCj/tmp.s -o /tmp/llvm_92HLCj/tmp.o native-ld -opt4 /tmp/llvm_92HLCj/tmp.o -o a.out> $ mcc16 -S foo.c$ mcc16 -dry-run -S foo.c clang-cc foo.c -o /tmp/llvm_0uiDCR/foo.bc llvm-ld /tmp/llvm_0uiDCR/foo.bc -o /tmp/llvm_0uiDCR/foo.bc llc -f /tmp/llvm_0uiDCR/foo.bc -o foo.s> $ mcc16 -S foo.c bar.c$ mcc16 -dry-run -S foo.c bar.c clang-cc foo.c -o /tmp/llvm_1zAqik/foo.bc llvm-ld /tmp/llvm_1zAqik/foo.bc -o /tmp/llvm_1zAqik/foo.bc llc -f /tmp/llvm_1zAqik/foo.bc -o foo.s clang-cc bar.c -o /tmp/llvm_1zAqik/bar.bc llvm-ld /tmp/llvm_1zAqik/bar.bc -o /tmp/llvm_1zAqik/bar.bc llc -f /tmp/llvm_1zAqik/bar.bc -o bar.s> ** Use of -g causes llvm-ld to run with -disable-opt > $ mcc16 -S -g foo.c$ mcc16 -dry-run -S -g foo.c clang-cc foo.c -o /tmp/llvm_oQFmVn/foo.bc llvm-ld -disable-opt /tmp/llvm_oQFmVn/foo.bc -o /tmp/llvm_oQFmVn/foo.bc llc -f /tmp/llvm_oQFmVn/foo.bc -o foo.s> ** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc. > $ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c$ mcc16 -dry-run -S -g -I ../include -pre-RA-sched=list-burr foo.c clang-cc -I ../include foo.c -o /tmp/llvm_5VxNFQ/foo.bc llvm-ld -disable-opt /tmp/llvm_5VxNFQ/foo.bc -o /tmp/llvm_5VxNFQ/foo.bc llc -pre-RA-sched list-burr -f /tmp/llvm_5VxNFQ/foo.bc -o foo.s This should be enough to get you started. I'm always happy to answer any further questions you may have. If you want to e-mail me privately, please use the.dead.shall.rise <at_sign> gmail dot com for now (our provider problems weren't resolved yet). _______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20090607/c0dac46e/attachment.html>
Mikhail Glushenkov wrote:> > Hi Sanjiv, > > Sanjiv Gupta <sanjiv.gupta <at> microchip.com> writes: > > > The salient features that we want to have in the driver are: > > [...] > > As promised, I've implemented a basic compiler driver for the > PIC16 toolchain. It's under tools/llvmc/examples/mcc16. >Hi Mikhail, How do you build mcc16 executable? There are so many confusing things there: driver, plugins, example, Skelton etc. The LLVMC-Tutorial doesn't clearly talk about them. Your help is appreciated. Thanks, Sanjiv> > Some examples illustrating the features you requested: > > > 2. If the user has specified to generate the final executable, then > > llvm-ld should run on all the .bc files generated by clang and create a > > single optimized .bc file for further tools. > > $ mcc16 -dry-run foo.c bar.c > clang-cc foo.c -o /tmp/llvm_6ibgr9/foo.bc > clang-cc bar.c -o /tmp/llvm_6ibgr9/bar.bc > llvm-ld /tmp/llvm_6ibgr9/foo.bc /tmp/llvm_6ibgr9/bar.bc \ > -o /tmp/llvm_6ibgr9/tmp.bc > llc -f /tmp/llvm_6ibgr9/tmp.bc -o /tmp/llvm_6ibgr9/tmp.s > native-as /tmp/llvm_6ibgr9/tmp.s -o /tmp/llvm_6ibgr9/tmp.o > native-ld /tmp/llvm_6ibgr9/tmp.o -o a.out > > > 3. -Wo <options> - pass optimizations to the llvm-ld > > 4. mcc16 -Wl <options> - pass options to native linker. > > 5. mcc16 -Wa <options> - pass options to native assembler. > > $ mcc16 -dry-run -Wo,-opt1 -Wllc,-opt2 -Wa,-opt3 -Wl,-opt4 foo.c > clang-cc foo.c -o /tmp/llvm_92HLCj/foo.bc > llvm-ld -opt1 /tmp/llvm_92HLCj/foo.bc -o /tmp/llvm_92HLCj/tmp.bc > llc -opt2 -f /tmp/llvm_92HLCj/tmp.bc -o /tmp/llvm_92HLCj/tmp.s > native-as -opt3 /tmp/llvm_92HLCj/tmp.s -o /tmp/llvm_92HLCj/tmp.o > native-ld -opt4 /tmp/llvm_92HLCj/tmp.o -o a.out > > > $ mcc16 -S foo.c > > $ mcc16 -dry-run -S foo.c > clang-cc foo.c -o /tmp/llvm_0uiDCR/foo.bc > llvm-ld /tmp/llvm_0uiDCR/foo.bc -o /tmp/llvm_0uiDCR/foo.bc > llc -f /tmp/llvm_0uiDCR/foo.bc -o foo.s > > > $ mcc16 -S foo.c bar.c > > $ mcc16 -dry-run -S foo.c bar.c > clang-cc foo.c -o /tmp/llvm_1zAqik/foo.bc > llvm-ld /tmp/llvm_1zAqik/foo.bc -o /tmp/llvm_1zAqik/foo.bc > llc -f /tmp/llvm_1zAqik/foo.bc -o foo.s > clang-cc bar.c -o /tmp/llvm_1zAqik/bar.bc > llvm-ld /tmp/llvm_1zAqik/bar.bc -o /tmp/llvm_1zAqik/bar.bc > llc -f /tmp/llvm_1zAqik/bar.bc -o bar.s > > > ** Use of -g causes llvm-ld to run with -disable-opt > > $ mcc16 -S -g foo.c > > $ mcc16 -dry-run -S -g foo.c > clang-cc foo.c -o /tmp/llvm_oQFmVn/foo.bc > llvm-ld -disable-opt /tmp/llvm_oQFmVn/foo.bc -o /tmp/llvm_oQFmVn/foo.bc > llc -f /tmp/llvm_oQFmVn/foo.bc -o foo.s > > > ** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc. > > $ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c > > $ mcc16 -dry-run -S -g -I ../include -pre-RA-sched=list-burr foo.c > clang-cc -I ../include foo.c -o /tmp/llvm_5VxNFQ/foo.bc > llvm-ld -disable-opt /tmp/llvm_5VxNFQ/foo.bc -o /tmp/llvm_5VxNFQ/foo.bc > llc -pre-RA-sched list-burr -f /tmp/llvm_5VxNFQ/foo.bc -o foo.s > > This should be enough to get you started. > > I'm always happy to answer any further questions you may have. If > you want to e-mail me privately, please use the.dead.shall.rise > <at_sign> gmail dot com for now (our provider problems weren't > resolved yet). > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >