<html dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="MSHTML 8.00.6001.19120">
<style title="owaParaStyle"><!--P {
MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
--></style>
</head>
<body ocsi="x">
<div dir="ltr"><font color="#000000" size="2" face="Tahoma">Hi David,</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="Tahoma">I have been also trying to make one bitcode representation that</font></div>
<div dir="ltr"><font size="2" face="Tahoma">can be lowered to efficient ABIs on all target platforms.</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">I made new compilation strategy to achieve this goal as follows,</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr">
<div dir="ltr"><font size="2" face="tahoma">C/C++ source code</font></div>
<div dir="ltr"><font size="2" face="tahoma">------------------------------------------ using front-end complier</font></div>
<div dir="ltr"><font size="2" face="tahoma">Target Independent Bitcode</font></div>
<div dir="ltr"><font size="2" face="tahoma">------------------------------------------ using translator</font></div>
<div dir="ltr"><font size="2" face="tahoma">Traget Dependent Bitcode</font></div>
<div dir="ltr"><font size="2" face="tahoma">------------------------------------------ using opt with optimization passes</font></div>
<div dir="ltr"><font size="2" face="tahoma">Optimized Target Dependent Bitcode</font></div>
<div dir="ltr"><font size="2" face="tahoma">------------------------------------------ using LLC</font></div>
<div dir="ltr"><font size="2" face="tahoma">Target Assembly code</font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">
<div dir="ltr"><font size="2" face="tahoma">I can show you simple example with this strategy.</font></div>
</font>
<div dir="ltr"><font size="2" face="tahoma">C/C++ source code</font></div>
</div>
</div>
<div dir="ltr"><font size="2" face="tahoma"></font><font size="2" face="Tahoma"> 1 #include <stdio.h><br>
2<br>
3 int main(void) {<br>
4 long double a = 3.14;<br>
5 long double b = 2.2;<br>
6 long double c;<br>
7<br>
8 c = a + b;<br>
9<br>
10 printf("c=%Lf\n", c);<br>
11 return 0;<br>
12 }<br>
</font><font size="2" face="Tahoma">------------------------------------------------------------------------------------------</div>
</font>
<div dir="ltr"><font size="2" face="tahoma">Target Independent Bitcode</font></div>
<div dir="ltr"><font size="2" face="Tahoma"> 1 ; ModuleID = 'long_double.c'<br>
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 </font></div>
<div dir="ltr"><font size="2" face="Tahoma"> -v64:64:64-v128:128:128-a0:0:64-f192:32:32"<br>
3 target triple = "ovm-none-linux"<br>
4<br>
5 @.str = private constant [7 x i8(char)] [i8(char) 99, i8(char) 61, i8(char) 37, i8(char) 76, i8(c</font></div>
<div dir="ltr"><font size="2" face="Tahoma"> har) 102, i8(char) 10, i8(char) 0], align 1 ; <[7 x i8(char)]*> [#uses=1]<br>
6<br>
7 define i32(int) @main() nounwind {<br>
8 entry:<br>
9 %retval = alloca i32(int) ; <i32(int)*> [#uses=2]<br>
10 %c = alloca long_double ; <long_double*> [#uses=2]<br>
11 %b = alloca long_double ; <long_double*> [#uses=2]<br>
12 %a = alloca long_double ; <long_double*> [#uses=2]<br>
13 %0 = alloca i32(int) ; <i32(int)*> [#uses=2]<br>
14 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]<br>
15 store long_double 0xL00000000000000810000000000000000C8F5C28F5C28F800, long_double* %a, align 8<br>
16 store long_double 0xL000000000000008100000000000000008CCCCCCCCCCCD000, long_double* %b, align 8<br>
17 %1 = load long_double* %a, align 8 ; <long_double> [#uses=1]<br>
18 %2 = load long_double* %b, align 8 ; <long_double> [#uses=1]<br>
19 %3 = fadd long_double %1, %2 ; <long_double> [#uses=1]<br>
20 store long_double %3, long_double* %c, align 8<br>
21 %4 = load long_double* %c, align 8 ; <long_double> [#uses=1]<br>
22 %5 = call i32(int) (i8(char)*, ...)* @printf(i8(char)* noalias getelementptr inbounds ([7 x i8(</font></div>
<div dir="ltr"><font size="2" face="Tahoma"> char)]* @.str, i32(int) 0, i32(int) 0), long_double %4) nounwind ; <i32(int)> [#uses=0]<br>
23 store i32(int) 0, i32(int)* %0, align 4<br>
24 %6 = load i32(int)* %0, align 4 ; <i32(int)> [#uses=1]<br>
25 store i32(int) %6, i32(int)* %retval, align 4<br>
26 br label %return<br>
27<br>
28 return: ; preds = %entry<br>
29 %retval1 = load i32(int)* %retval ; <i32(int)> [#uses=1]<br>
30 ret i32(int) %retval1<br>
31 }<br>
32<br>
33 declare i32(int) @printf(i8(char)* noalias, ...) nounwind<br>
------------------------------------------------------------------------------------------</font></div>
<div dir="ltr"><font size="2" face="Tahoma"><font face="tahoma">
<div dir="ltr"><font size="2" face="tahoma"><font size="2" face="tahoma"><font size="2" face="tahoma">Target Dependent Bitcode</font></div>
</font></font>
<div dir="ltr"><font size="2" face="tahoma"><font face="tahoma">ARM</font></font></div>
</font></font></div>
<div dir="ltr"><font size="2" face="Tahoma"> 1 ; ModuleID = 'long_double.mod.opt.arm.bc'<br>
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 </font></div>
<div dir="ltr"><font size="2" face="Tahoma"> -v64:64:64-v128:128:128-a0:0:64"<br>
3 target triple = "armv5-none-linux-gnueabi"<br>
4<br>
5 @.str = private constant [7 x i8] c"c=%Lf\0A\00", align 1 ; <[7 x i8]*> [#uses=1]<br>
6<br>
7 define i32 @main() nounwind {<br>
8 entry:<br>
9 %retval = alloca i32 ; <i32*> [#uses=2]<br>
10 %c = alloca double ; <double*> [#uses=2]<br>
11 %b = alloca double ; <double*> [#uses=2]<br>
12 %a = alloca double ; <double*> [#uses=2]<br>
13 %0 = alloca i32 ; <i32*> [#uses=2]<br>
14 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]<br>
15 store double 3.140000e+00, double* %a, align 8<br>
16 store double 2.200000e+00, double* %b, align 8<br>
17 %1 = load double* %a, align 8 ; <double> [#uses=1]<br>
18 %2 = load double* %b, align 8 ; <double> [#uses=1]<br>
19 %3 = fadd double %1, %2 ; <double> [#uses=1]<br>
20 store double %3, double* %c, align 8<br>
21 %4 = load double* %c, align 8 ; <double> [#uses=1]<br>
22 %5 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([7 x i8]* @.str, i32 0, i </font></div>
<div dir="ltr"><font size="2" face="Tahoma"> 32 0), double %4) nounwind ; <i32> [#uses=0]<br>
23 store i32 0, i32* %0, align 4<br>
24 %6 = load i32* %0, align 4 ; <i32> [#uses=1]<br>
25 store i32 %6, i32* %retval, align 4<br>
26 br label %return<br>
27<br>
28 return: ; preds = %entry<br>
29 %retval1 = load i32* %retval, align 4 ; <i32> [#uses=1]<br>
30 ret i32 %retval1<br>
31 }<br>
32<br>
33 declare i32 @printf(i8* noalias, ...) nounwind<br>
</div>
</font>
<div dir="ltr"><font size="2" face="Tahoma"><font face="tahoma"><font size="2" face="tahoma"><font face="tahoma"><font face="tahoma">X86</font></font></font></div>
</font></font>
<div dir="ltr"><font size="2" face="Tahoma"> 1 ; ModuleID = 'long_double.mod.opt.x86.bc'<br>
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</font></div>
<div dir="ltr"><font size="2" face="Tahoma"> -v64:64:64-v128:128:128-a0:0:64-f80:32:32"<br>
3 target triple = "i386-pc-linux-gnu"<br>
4<br>
5 @.str = private constant [7 x i8] c"c=%Lf\0A\00", align 1 ; <[7 x i8]*> [#uses=1]<br>
6<br>
7 define i32 @main() nounwind {<br>
8 entry:<br>
9 %retval = alloca i32 ; <i32*> [#uses=2]<br>
10 %c = alloca x86_fp80 ; <x86_fp80*> [#uses=2]<br>
11 %b = alloca x86_fp80 ; <x86_fp80*> [#uses=2]<br>
12 %a = alloca x86_fp80 ; <x86_fp80*> [#uses=2]<br>
13 %0 = alloca i32 ; <i32*> [#uses=2]<br>
14 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]<br>
15 store x86_fp80 0xK4000C8F5C28F5C28F800, x86_fp80* %a, align 4<br>
16 store x86_fp80 0xK40008CCCCCCCCCCCD000, x86_fp80* %b, align 4<br>
17 %1 = load x86_fp80* %a, align 4 ; <x86_fp80> [#uses=1]<br>
18 %2 = load x86_fp80* %b, align 4 ; <x86_fp80> [#uses=1]<br>
19 %3 = fadd x86_fp80 %1, %2 ; <x86_fp80> [#uses=1]<br>
20 store x86_fp80 %3, x86_fp80* %c, align 4<br>
21 %4 = load x86_fp80* %c, align 4 ; <x86_fp80> [#uses=1]<br>
22 %5 = call i32 (i8*, ...)* @printf(i8* noalias getelementptr inbounds ([7 x i8]* @.str, i32 0, i </font></div>
<div dir="ltr"><font size="2" face="Tahoma"> 32 0), x86_fp80 %4) nounwind ; <i32> [#uses=0]<br>
23 store i32 0, i32* %0, align 4<br>
24 %6 = load i32* %0, align 4 ; <i32> [#uses=1]<br>
25 store i32 %6, i32* %retval, align 4<br>
26 br label %return<br>
27<br>
28 return: ; preds = %entry<br>
29 %retval1 = load i32* %retval, align 4 ; <i32> [#uses=1]<br>
30 ret i32 %retval1<br>
31 }<br>
32<br>
33 declare i32 @printf(i8* noalias, ...) nounwind<br>
</div>
</font>
<div dir="ltr"><font size="2" face="Tahoma"><font face="tahoma">I made new common long double type and inserted it into bitcode.</font></font></div>
<div dir="ltr"><font size="2" face="tahoma"></font> </div>
<div dir="ltr"><font size="2" face="tahoma">As Talin mentioned,
<p><font size="2" face="Tahoma">I am interested in having conversation about achieving the goals of the "near miss" users</font></p>
<p><font size="2" face="Tahoma">of LLVM collaboratively. :)</font></p>
<p><font face="tahoma"></font> </p>
<p><font face="tahoma">Thanks,</font></p>
<p><font face="tahoma">Jin-Gu Kang</font></font><font face="Tahoma"></p>
</div>
</font>
</body>
</html>