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 >
I think the correct command line is $ make LLVMC_BUILTIN_PLUGINS=MyPlugin LLVMC_BASED_DRIVER_NAME=mydriver rather than $ make BUILTIN_PLUGINS=MyPlugin DRIVER_NAME=mydriver (I found the later one in LLVMC-Reference) - Sanjiv Sanjiv Gupta wrote:> 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 >> > >
Hi Sanjiv, 2009/6/15 Sanjiv Gupta <sanjiv.gupta at microchip.com>:> Hi Mikhail, > How do you build mcc16 executable?This should work: $ cd $LLVM_DIR/tools/llvmc/examples/mcc16 $ make If you're building from some other dir, you'll need to update mcc16/Makefile, so it knows where Makefile.common is located.> There are so many confusing things there: driver, plugins, example, Skelton > etc. > The LLVMC-Tutorial doesn't clearly talk about them.Yes, I know, the documentation doesn't talk about creating standalone drivers. Sorry for that, I was planning to update it for ages... For now, please look at examples/Skeleton, which is a standalone driver skeleton, on which the mcc16 driver is based.> I think the correct command line is > $ make LLVMC_BUILTIN_PLUGINS=MyPlugin LLVMC_BASED_DRIVER_NAME=mydriver > > rather than > $ make BUILTIN_PLUGINS=MyPlugin DRIVER_NAME=mydriver > (I found the later one in LLVMC-Reference)This section is about building the "main" llvmc driver and its plugins. Creation of standalone drivers is not described in the docs yet (it was added relatively recently). -- () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments
Mikhail Glushenkov wrote:> Hi Sanjiv, > > 2009/6/15 Sanjiv Gupta <sanjiv.gupta at microchip.com>: > >> Hi Mikhail, >> How do you build mcc16 executable? >> > > This should work: > > $ cd $LLVM_DIR/tools/llvmc/examples/mcc16 > $ make > >I configure llvm into a separate directory from source. When I do the steps you mentioned in the source directory, this is what I get. [i00171 at rhino mcc16]$ make ../../../../Makefile.common:61: ../../../../Makefile.config: No such file or directory ../../../../Makefile.common:69: /Makefile.rules: No such file or directory make: *** No rule to make target `/Makefile.rules'. Stop. Ditto for the "Simple" plugin. [i00171 at rhino mcc16]$ cd ../Simple/ ../../../../Makefile.common:61: ../../../../Makefile.config: No such file or directory ../../../../Makefile.common:69: /Makefile.rules: No such file or directory make: *** No rule to make target `/Makefile.rules'. Stop. [i00171 at rhino Simple]$ I copied the "Simple" plugin to the configured directory $ cd objs/tools/llvmc/plugins $ cp -rf $LLVM_SRC/tools/llvmc/example/Simple MyPlugin Changed the plugin name in the Makefile from "Simple" to "MyPlugin", and moved "Simple.td" to "MyPlugin.td" $ make LLVMC_BUILTIN_PLUGINS=MyPlugin LLVMC_BASED_DRIVER_NAME=mydriver That created "mydriver" executable for me. - Sanjiv> If you're building from some other dir, you'll need to update > mcc16/Makefile, so it knows where Makefile.common is located. > > >> There are so many confusing things there: driver, plugins, example, Skelton >> etc. >> The LLVMC-Tutorial doesn't clearly talk about them. >> > > Yes, I know, the documentation doesn't talk about creating standalone > drivers. Sorry for that, I was planning to update it for ages... > For now, please look at examples/Skeleton, which is a standalone > driver skeleton, on which the mcc16 driver is based. > > >> I think the correct command line is >> $ make LLVMC_BUILTIN_PLUGINS=MyPlugin LLVMC_BASED_DRIVER_NAME=mydriver >> >> rather than >> $ make BUILTIN_PLUGINS=MyPlugin DRIVER_NAME=mydriver >> (I found the later one in LLVMC-Reference) >> > > This section is about building the "main" llvmc driver and its plugins. > Creation of standalone drivers is not described in the docs yet (it > was added relatively recently). > >