Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
Hooks.cpp | D | 03-May-2024 | 2.6 KiB | 110 | 73 | |
Main.cpp | D | 03-May-2024 | 1.7 KiB | 58 | 25 | |
Makefile | D | 03-May-2024 | 444 | 16 | 4 | |
PIC16.td | D | 03-May-2024 | 8.6 KiB | 235 | 217 | |
README | D | 03-May-2024 | 2.5 KiB | 76 | 60 |
README
1This is a basic compiler driver for the PIC16 toolchain that shows how to create 2your own llvmc-based drivers. It is based on the examples/Skeleton template. 3 4The PIC16 toolchain looks like this: 5 6clang-cc (FE) -> llvm-ld (optimizer) -> llc (codegen) -> native-as -> native-ld 7 8Following features were requested by Sanjiv: 9 10From: Sanjiv Gupta <sanjiv.gupta <at> microchip.com> 11Subject: Re: llvmc for PIC16 12Newsgroups: gmane.comp.compilers.llvm.devel 13Date: 2009-06-05 06:51:14 GMT 14 15The salient features that we want to have in the driver are: 161. llvm-ld will be used as "The Optimizer". 172. If the user has specified to generate the final executable, then 18llvm-ld should run on all the .bc files generated by clang and create a 19single optimized .bc file for further tools. 203. -Wo <options> - pass optimizations to the llvm-ld 214. mcc16 -Wl <options> - pass options to native linker. 225. mcc16 -Wa <options> - pass options to native assembler. 23 24Here are some example command lines and sample command invocations as to 25what 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 73Is this achievable by a tablegen based driver ? 74 75- Sanjiv 76