d4c3d6dabdae9635788610f10e17aff26421a416
for code (plus_eq):
--------------8<------------------
> cat ../backend.native/tests/codegen/function/plus_eq.kt
fun plus_eq(a: Int): Int {
var b = 11
b += a
return b
}
--------------8<------------------
generator produces:
--------------8<------------------
> llvm-dis-mp-3.8 ../backend.native/tests/codegen/function/plus_eq.kt.bc -o -
; ModuleID = '../backend.native/tests/codegen/function/plus_eq.kt.bc'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
....
define i32 @"kfun:plus_eq"(i32) {
entry:
%a = alloca i32
store i32 %0, i32* %a
%b = alloca i32
store i32 11, i32* %b
%tmp1 = load i32, i32* %b
%tmp2 = load i32, i32* %a
%tmp0 = add i32 %tmp1, %tmp2
store i32 %tmp0, i32* %b
%tmp3 = load i32, i32* %b
ret i32 %tmp3
}
--------------8<------------------
and for (minus_eq):
--------------8<------------------
> cat ../backend.native/tests/codegen/function/minus_eq.kt
fun minus_eq(a: Int): Int {
var b = 11
b -= a
return b
}
--------------8<------------------
generator produces:
--------------8<------------------
> llvm-dis-mp-3.8 ../backend.native/tests/codegen/function/minus_eq.kt.bc -o -
; ModuleID = '../backend.native/tests/codegen/function/minus_eq.kt.bc'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.12.0"
...
define i32 @"kfun:minus_eq"(i32) {
entry:
%a = alloca i32
store i32 %0, i32* %a
%b = alloca i32
store i32 11, i32* %b
%tmp1 = load i32, i32* %b
%tmp2 = load i32, i32* %a
%tmp0 = sub i32 %tmp1, %tmp2
store i32 %tmp0, i32* %b
%tmp3 = load i32, i32* %b
ret i32 %tmp3
}
--------------8<------------------
Kotlin-native backend
Build
Download dependencies:
gradle :dependencies:update
To run native translator just use:
gradle :backend.native:run
And it will run simple example (currently prints out IR of test file). For more tests, use:
gradle :backend.native:tests:run
Description
Languages
Kotlin
79.9%
Java
10.4%
Swift
4.3%
C
2.8%
C++
2.1%
Other
0.3%