Difference between revisions of "R32V2020 C Compiler"
Jump to navigation
Jump to search
Blwikiadmin (talk | contribs) (Created page with "== Not Yet Implemented == * clang is used to create LLVM IR * Install clang <pre> sudo apt-get install clang </pre> * Create LLVM IR <pre> clang -S -emit-llvm foo.c </pre> *...") |
Blwikiadmin (talk | contribs) |
||
Line 47: | Line 47: | ||
"c:\Program Files\LLVM\bin\clang" -S -emit-llvm -O0 foo.c | "c:\Program Files\LLVM\bin\clang" -S -emit-llvm -O0 foo.c | ||
</pre> | </pre> | ||
+ | |||
+ | == GCC Toolchain== | ||
+ | |||
+ | * [https://atgreen.github.io/ggx/?fbclid=IwAR3oGRpUKzfx56UW2-LcfpXV5Ov1jfBg96q3_ZwDCEoX9wLAHAamR2UWMSg How To Retarget the GNU Toolchain in 21 Patches] |
Latest revision as of 12:58, 10 April 2022
Not Yet Implemented
- clang is used to create LLVM IR
- Install clang
sudo apt-get install clang
- Create LLVM IR
clang -S -emit-llvm foo.c
- Example Source File
int square(int a) { return(a*a); }
- .ll Output for example
; ModuleID = 'foo.c' target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" target triple = "armv6--linux-gnueabihf" ; Function Attrs: nounwind define i32 @square(i32 %a) #0 { %1 = alloca i32, align 4 store i32 %a, i32* %1, align 4 %2 = load i32, i32* %1, align 4 %3 = load i32, i32* %1, align 4 %4 = mul nsw i32 %2, %3 ret i32 %4 }
- Writing an LLVM Backend
- Tutorial for Writing Backend for a RISC style CPU (very similar (ISA)
- Writing a backend for the Tricore CPU (pdf)
- Godbolt Compiler Explorer - set option to
-S -emit-llvm -O0
- LLVM Installers includes clang
- Windows install option
- Command line
"c:\Program Files\LLVM\bin\clang" -S -emit-llvm -O0 foo.c