Konstantin Anisimov d4c3d6dabd plus'n'minus_eq operation: support for integer comparison operations
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<------------------
2016-11-07 18:00:30 +03:00
2016-10-17 13:59:33 +03:00
2016-10-27 13:52:00 +03:00
2016-11-07 17:42:29 +03:00
2016-10-07 14:14:00 +03:00
2016-10-27 13:52:00 +03:00
2016-10-27 13:52:00 +03:00

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
S
Description
The Kotlin Programming Language.
Readme 2.1 GiB
Languages
Kotlin 79.9%
Java 10.4%
Swift 4.3%
C 2.8%
C++ 2.1%
Other 0.3%