May 2015
Intermediate to advanced
296 pages
5h 10m
English
Here we will convert a C code to intermediate representation in LLVM using the C frontend Clang.
Clang must be installed in the PATH.
multiply.c file, which will look something like the following:$ cat multiply.c int mult() { int a =5; int b = 3; int c = a * b; return c; }
$ clang -emit-llvm -S multiply.c -o multiply.ll
$ cat multiply.ll ; ModuleID = 'multiply.c' target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" ; Function Attrs: nounwind uwtable define i32 @mult() #0 { %a = alloca i32, align 4 %b ...
Read now
Unlock full access