LLVM IR is a compiler IR

Hi Talin,

I had a talk in London developer meeting about More Target Independent Bitcode.
(You can download the slides from http://llvm.org/devmtg/2011-09-16/)

I have been also trying to make bitcode with more higher abstraction level.
I made new compilation strategy using more target indepent bitcode as followins,
(This didn’t consider about Jit or Interpreter like lli)

C/C++ source code
------------------------------------------ using front-end complier
Target Independent Bitcode
------------------------------------------ using translator
Traget Dependent Bitcode
------------------------------------------ using opt with optimization passes
Optimized Target Dependent Bitcode
------------------------------------------ using LLC
Target Assembly code

I can show you simple example with this strategy.

C/C++ source code

1 struct foo {
2 char a:4;
3 long long b:61;
4 int c:30;
5 };
6
7 struct foo var;

Target Independent Bitcode

1 ; ModuleID = ‘gu.c’
2 target datalayout = “e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32
-f64:64:64-v64:64:64-v128:128:128-a0:0:64-f192:32:32”
3 target triple = “ovm-none-linux”
4
5 %struct.foo = type { i4(char), i61(longlong), i30(int) }
6
7 @var = common global %struct.foo zeroinitializer ; <%struct.foo*> [#uses=0]

Target Dependent Bitcode

ARM
1 ; ModuleID = ‘gu.mod.opt.arm.bc’
2 target datalayout = “e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32
-f64:64:64-v64:64:64-v128:128:128-a0:0:64”
3 target triple = “armv5-none-linux-gnueabi”
4
5 %struct.foo = type <{ i8, [7 x i8], i64, i32, [4 x i8] }>
6
7 @var = common global %struct.foo zeroinitializer ; <%struct.foo*> [#uses=0]

X86
1 ; ModuleID = ‘gu.mod.opt.x86.bc’
2 target datalayout = “e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32
-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32”
3 target triple = “i386-pc-linux-gnu”
4
5 %struct.foo = type <{ i8, [3 x i8], i64, i32 }>
6
7 @var = common global %struct.foo zeroinitializer ; <%struct.foo*> [#uses=0]

I have inserted additional information into bitcode and have modified some codes of LLVM.

I am interested in having conversation about achieving the goals of the “near miss” users

of LLVM collaboratively. :slight_smile:

Thanks,

Jin-Gu Kang