Up to higher level directory | |||
Name | Date | Size | |
---|---|---|---|
Hooks.cpp | 15-Nov-2011 | 2.6K | |
Main.cpp | 15-Nov-2011 | 1.7K | |
Makefile | 15-Nov-2011 | 444 | |
PIC16.td | 15-Nov-2011 | 8.6K | |
README | 15-Nov-2011 | 2.5K |
1 This is a basic compiler driver for the PIC16 toolchain that shows how to create 2 your own llvmc-based drivers. It is based on the examples/Skeleton template. 3 4 The PIC16 toolchain looks like this: 5 6 clang-cc (FE) -> llvm-ld (optimizer) -> llc (codegen) -> native-as -> native-ld 7 8 Following features were requested by Sanjiv: 9 10 From: Sanjiv Gupta <sanjiv.gupta <at> microchip.com> 11 Subject: Re: llvmc for PIC16 12 Newsgroups: gmane.comp.compilers.llvm.devel 13 Date: 2009-06-05 06:51:14 GMT 14 15 The salient features that we want to have in the driver are: 16 1. llvm-ld will be used as "The Optimizer". 17 2. If the user has specified to generate the final executable, then 18 llvm-ld should run on all the .bc files generated by clang and create a 19 single optimized .bc file for further tools. 20 3. -Wo <options> - pass optimizations to the llvm-ld 21 4. mcc16 -Wl <options> - pass options to native linker. 22 5. mcc16 -Wa <options> - pass options to native assembler. 23 24 Here are some example command lines and sample command invocations as to 25 what should be done. 26 27 $ mcc16 -S foo.c 28 // [clang-cc foo.c] -> foo.bc 29 // [llvm-ld foo.bc] -> foo.opt.bc 30 // [llc foo.opt.bc] -> foo.s 31 32 $ mcc16 -S foo.c bar.c 33 // [clang-cc foo.c] -> foo.bc 34 // [llvm-ld foo.bc] -> foo.opt.bc 35 // [llc foo.opt.bc] -> foo.s 36 // [clang-cc bar.c] -> bar.bc 37 // [llvm-ld bar.bc] -> bar.opt.bc 38 // [llc bar.opt.bc] -> bar.s 39 40 ** Use of -g causes llvm-ld to run with -disable-opt 41 $ mcc16 -S -g foo.c 42 // [clang-cc foo.c] -> foo.bc 43 // [llvm-ld -disable-opt foo.bc] -> foo.opt.bc 44 // [llc foo.opt.bc] -> foo.s 45 46 ** -I is passed to clang-cc, -pre-RA-sched=list-burr to llc. 47 $ mcc16 -S -g -I ../include -pre-RA-sched=list-burr foo.c 48 // [clang-cc -I ../include foo.c] -> foo.bc 49 // [llvm-ld -disable-opt foo.bc] -> foo.opt.bc 50 // [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s 51 52 ** -Wo passes options to llvm-ld 53 $ mcc16 -Wo=opt1,opt2 -S -I ../include -pre-RA-sched=list-burr foo.c 54 // [clang-cc -I ../include foo.c] -> foo.bc 55 // [llvm-ld -opt1 -opt2 foo.bc] -> foo.opt.bc 56 // [llc -pre-RA-sched=list-burr foo.opt.bc] -> foo.s 57 58 ** -Wa passes options to native as. 59 $ mcc16 -c foo.c -Wa=opt1 60 // [clang-cc foo.c] -> foo.bc 61 // [llvm-ld foo.bc] -> foo.opt.bc 62 // [llc foo.opt.bc] -> foo.s 63 // [native-as -opt1 foo.s] -> foo.o 64 65 $ mcc16 -Wo=opt1 -Wl=opt2 -Wa=opt3 foo.c bar.c 66 // [clang-cc foo.c] -> foo.bc 67 // [clang-cc bar.c] -> bar.bc 68 // [llvm-ld -opt1 foo.bc bar.bc] -> a.out.bc 69 // [llc a.out.bc] -> a.out.s 70 // [native-as -opt3 a.out.s] -> a.out.o 71 // [native-ld -opt2 a.out.o] -> a.out 72 73 Is this achievable by a tablegen based driver ? 74 75 - Sanjiv 76