[IR] Drop ir.ir2cfg module

#KTI-952 Fixed
#KT-65773 Related
This commit is contained in:
Wojciech Litewka
2024-03-05 13:09:58 +01:00
committed by Space Team
parent 6fb6f04509
commit cbabfc0fe2
55 changed files with 0 additions and 1848 deletions
-1
View File
@@ -1 +0,0 @@
fun foo(arg: Int) = arg
-14
View File
@@ -1,14 +0,0 @@
// FILE: /expressionFun.kt
// FUN: foo
BB 0
CONTENT
1 FUN name:foo visibility:public modality:FINAL <> (arg:kotlin.Int) returnType:kotlin.Int
2 GET_VAR 'arg: kotlin.Int declared in <root>.foo' type=kotlin.Int origin=null
3 RETURN type=kotlin.Nothing from='public final fun foo (arg: kotlin.Int): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:foo visibility:public modality:FINAL <> (arg:kotlin.Int) returnType:kotlin.Int
// END FUN: foo
// END FILE: /expressionFun.kt
-1
View File
@@ -1 +0,0 @@
fun foo() = Unit
-14
View File
@@ -1,14 +0,0 @@
// FILE: /expressionUnit.kt
// FUN: foo
BB 0
CONTENT
1 FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
2 GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
3 RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Unit declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
// END FUN: foo
// END FILE: /expressionUnit.kt
-11
View File
@@ -1,11 +0,0 @@
fun digitCountInNumber(n: Int, m: Int): Int {
var count = 0
var number = n
do {
if (m == number % 10) {
count++
}
number /= 10
} while (number > 0)
return count
}
-68
View File
@@ -1,68 +0,0 @@
// FILE: /digitCount.kt
// FUN: digitCountInNumber
BB 0
CONTENT
1 FUN name:digitCountInNumber visibility:public modality:FINAL <> (n:kotlin.Int, m:kotlin.Int) returnType:kotlin.Int
2 CONST Int type=kotlin.Int value=0
3 VAR name:count type:kotlin.Int [var]
4 GET_VAR 'n: kotlin.Int declared in <root>.digitCountInNumber' type=kotlin.Int origin=null
5 VAR name:number type:kotlin.Int [var]
6 DO_WHILE label=null origin=DO_WHILE_LOOP
OUTGOING -> BB 1
Do..while entry: DO_WHILE label=null origin=DO_WHILE_LOOP
BB 1
INCOMING <- BB 0, 4
Do..while entry: DO_WHILE label=null origin=DO_WHILE_LOOP
CONTENT
1 WHEN type=kotlin.Unit origin=IF
2 GET_VAR 'm: kotlin.Int declared in <root>.digitCountInNumber' type=kotlin.Int origin=null
3 GET_VAR 'var number: kotlin.Int [var] declared in <root>.digitCountInNumber' type=kotlin.Int origin=null
4 CONST Int type=kotlin.Int value=10
5 CALL 'public final fun rem (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PERC
OUTGOING -> BB 2
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 2
INCOMING <- BB 1
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 GET_VAR 'var count: kotlin.Int [var] declared in <root>.digitCountInNumber' type=kotlin.Int origin=POSTFIX_INCR
2 VAR IR_TEMPORARY_VARIABLE name:tmp0 type:kotlin.Int [val]
3 SET_VAR 'var count: kotlin.Int [var] declared in <root>.digitCountInNumber' type=kotlin.Unit origin=POSTFIX_INCR
4 GET_VAR 'val tmp0: kotlin.Int [val] declared in <root>.digitCountInNumber' type=kotlin.Int origin=null
5 TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
OUTGOING -> BB 3
When exit: WHEN type=kotlin.Unit origin=IF
BB 3
INCOMING <- BB 2
When exit: WHEN type=kotlin.Unit origin=IF
CONTENT
1 SET_VAR 'var number: kotlin.Int [var] declared in <root>.digitCountInNumber' type=kotlin.Unit origin=DIVEQ
2 GET_VAR 'var number: kotlin.Int [var] declared in <root>.digitCountInNumber' type=kotlin.Int origin=null
3 CONST Int type=kotlin.Int value=0
OUTGOING -> BB 4, 5
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
BB 4
INCOMING <- BB 3
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
OUTGOING -> BB 1
Do..while entry: DO_WHILE label=null origin=DO_WHILE_LOOP
BB 5
INCOMING <- BB 3
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
OUTGOING -> BB 6
Do..while exit: DO_WHILE label=null origin=DO_WHILE_LOOP
BB 6
INCOMING <- BB 5
Do..while exit: DO_WHILE label=null origin=DO_WHILE_LOOP
CONTENT
1 GET_VAR 'var count: kotlin.Int [var] declared in <root>.digitCountInNumber' type=kotlin.Int origin=null
2 RETURN type=kotlin.Nothing from='public final fun digitCountInNumber (n: kotlin.Int, m: kotlin.Int): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:digitCountInNumber visibility:public modality:FINAL <> (n:kotlin.Int, m:kotlin.Int) returnType:kotlin.Int
// END FUN: digitCountInNumber
// END FILE: /digitCount.kt
-7
View File
@@ -1,7 +0,0 @@
fun factorial(i: Int): Int {
var result = 1
for (j in 2..i) {
result *= j
}
return result
}
-51
View File
@@ -1,51 +0,0 @@
// FILE: /factorial.kt
// FUN: factorial
BB 0
CONTENT
1 FUN name:factorial visibility:public modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Int
2 CONST Int type=kotlin.Int value=1
3 VAR name:result type:kotlin.Int [var]
4 CONST Int type=kotlin.Int value=2
5 GET_VAR 'i: kotlin.Int declared in <root>.factorial' type=kotlin.Int origin=null
6 CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE
7 CALL 'public open fun iterator (): kotlin.collections.IntIterator [fake_override,operator] declared in kotlin.ranges.IntRange' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR
8 VAR FOR_LOOP_ITERATOR name:tmp0_iterator type:kotlin.collections.IntIterator [val]
9 WHILE label=null origin=FOR_LOOP_INNER_WHILE
OUTGOING -> BB 1
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 1
INCOMING <- BB 0, 2
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
CONTENT
1 GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.factorial' type=kotlin.collections.IntIterator origin=null
OUTGOING -> BB 2, 3
CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
BB 2
INCOMING <- BB 1
CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
CONTENT
1 GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.factorial' type=kotlin.collections.IntIterator origin=null
2 CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
3 VAR FOR_LOOP_VARIABLE name:j type:kotlin.Int [val]
4 SET_VAR 'var result: kotlin.Int [var] declared in <root>.factorial' type=kotlin.Unit origin=MULTEQ
OUTGOING -> BB 1
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 3
INCOMING <- BB 1
CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
CONTENT
OUTGOING -> BB 4
While exit: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 4
INCOMING <- BB 3
While exit: WHILE label=null origin=FOR_LOOP_INNER_WHILE
CONTENT
1 GET_VAR 'var result: kotlin.Int [var] declared in <root>.factorial' type=kotlin.Int origin=null
2 RETURN type=kotlin.Nothing from='public final fun factorial (i: kotlin.Int): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:factorial visibility:public modality:FINAL <> (i:kotlin.Int) returnType:kotlin.Int
// END FUN: factorial
// END FILE: /factorial.kt
-9
View File
@@ -1,9 +0,0 @@
fun isPerfect(n: Int): Boolean {
var sum = 1
for (m in 2..n/2) {
if (n % m > 0) continue
sum += m
if (sum > n) break
}
return sum == n
}
-89
View File
@@ -1,89 +0,0 @@
// FILE: /isPerfect.kt
// FUN: isPerfect
BB 0
CONTENT
1 FUN name:isPerfect visibility:public modality:FINAL <> (n:kotlin.Int) returnType:kotlin.Boolean
2 CONST Int type=kotlin.Int value=1
3 VAR name:sum type:kotlin.Int [var]
4 CONST Int type=kotlin.Int value=2
5 GET_VAR 'n: kotlin.Int declared in <root>.isPerfect' type=kotlin.Int origin=null
6 CONST Int type=kotlin.Int value=2
7 CALL 'public final fun div (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=DIV
8 CALL 'public final fun rangeTo (other: kotlin.Int): kotlin.ranges.IntRange [operator] declared in kotlin.Int' type=kotlin.ranges.IntRange origin=RANGE
9 CALL 'public open fun iterator (): kotlin.collections.IntIterator [fake_override,operator] declared in kotlin.ranges.IntRange' type=kotlin.collections.IntIterator origin=FOR_LOOP_ITERATOR
10 VAR FOR_LOOP_ITERATOR name:tmp0_iterator type:kotlin.collections.IntIterator [val]
11 WHILE label=null origin=FOR_LOOP_INNER_WHILE
OUTGOING -> BB 1
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 1
INCOMING <- BB 0, 3, 6
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
CONTENT
1 GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.isPerfect' type=kotlin.collections.IntIterator origin=null
OUTGOING -> BB 2, 7
CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
BB 2
INCOMING <- BB 1
CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
CONTENT
1 GET_VAR 'val tmp0_iterator: kotlin.collections.IntIterator [val] declared in <root>.isPerfect' type=kotlin.collections.IntIterator origin=null
2 CALL 'public final fun next (): kotlin.Int [operator] declared in kotlin.collections.IntIterator' type=kotlin.Int origin=FOR_LOOP_NEXT
3 VAR FOR_LOOP_VARIABLE name:m type:kotlin.Int [val]
4 WHEN type=kotlin.Unit origin=IF
5 GET_VAR 'n: kotlin.Int declared in <root>.isPerfect' type=kotlin.Int origin=null
6 GET_VAR 'val m: kotlin.Int [val] declared in <root>.isPerfect' type=kotlin.Int origin=null
7 CALL 'public final fun rem (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=PERC
8 CONST Int type=kotlin.Int value=0
OUTGOING -> BB 3, 4
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
BB 3
INCOMING <- BB 2
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 CONTINUE label=null loop.label=null
OUTGOING -> BB 1
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 4
INCOMING <- BB 2
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 SET_VAR 'var sum: kotlin.Int [var] declared in <root>.isPerfect' type=kotlin.Unit origin=PLUSEQ
2 WHEN type=kotlin.Unit origin=IF
3 GET_VAR 'var sum: kotlin.Int [var] declared in <root>.isPerfect' type=kotlin.Int origin=null
4 GET_VAR 'n: kotlin.Int declared in <root>.isPerfect' type=kotlin.Int origin=null
OUTGOING -> BB 5, 6
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
BB 5
INCOMING <- BB 4
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 BREAK label=null loop.label=null
OUTGOING -> BB 8
While exit: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 6
INCOMING <- BB 4
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
OUTGOING -> BB 1
While entry: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 7
INCOMING <- BB 1
CALL 'public abstract fun hasNext (): kotlin.Boolean [fake_override,operator] declared in kotlin.collections.IntIterator' type=kotlin.Boolean origin=FOR_LOOP_HAS_NEXT
CONTENT
OUTGOING -> BB 8
While exit: WHILE label=null origin=FOR_LOOP_INNER_WHILE
BB 8
INCOMING <- BB 5, 7
While exit: WHILE label=null origin=FOR_LOOP_INNER_WHILE
CONTENT
1 GET_VAR 'var sum: kotlin.Int [var] declared in <root>.isPerfect' type=kotlin.Int origin=null
2 GET_VAR 'n: kotlin.Int declared in <root>.isPerfect' type=kotlin.Int origin=null
3 CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
4 RETURN type=kotlin.Nothing from='public final fun isPerfect (n: kotlin.Int): kotlin.Boolean declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:isPerfect visibility:public modality:FINAL <> (n:kotlin.Int) returnType:kotlin.Boolean
// END FUN: isPerfect
// END FILE: /isPerfect.kt
-3
View File
@@ -1,3 +0,0 @@
fun foo() {
return Unit
}
-14
View File
@@ -1,14 +0,0 @@
// FILE: /returnUnit.kt
// FUN: foo
BB 0
CONTENT
1 FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
2 GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
3 RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Unit declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
// END FUN: foo
// END FILE: /returnUnit.kt
-4
View File
@@ -1,4 +0,0 @@
fun foo(arg: Int): Int {
val dbl = arg * 2
return dbl
}
-18
View File
@@ -1,18 +0,0 @@
// FILE: /sequentialFun.kt
// FUN: foo
BB 0
CONTENT
1 FUN name:foo visibility:public modality:FINAL <> (arg:kotlin.Int) returnType:kotlin.Int
2 GET_VAR 'arg: kotlin.Int declared in <root>.foo' type=kotlin.Int origin=null
3 CONST Int type=kotlin.Int value=2
4 CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=MUL
5 VAR name:dbl type:kotlin.Int [val]
6 GET_VAR 'val dbl: kotlin.Int [val] declared in <root>.foo' type=kotlin.Int origin=null
7 RETURN type=kotlin.Nothing from='public final fun foo (arg: kotlin.Int): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:foo visibility:public modality:FINAL <> (arg:kotlin.Int) returnType:kotlin.Int
// END FUN: foo
// END FILE: /sequentialFun.kt
-1
View File
@@ -1 +0,0 @@
fun foo() {}
-12
View File
@@ -1,12 +0,0 @@
// FILE: /simpleFun.kt
// FUN: foo
BB 0
CONTENT
1 FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
OUTGOING -> NONE
Function exit: FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
// END FUN: foo
// END FILE: /simpleFun.kt
-3
View File
@@ -1,3 +0,0 @@
fun foo() {
return
}
-14
View File
@@ -1,14 +0,0 @@
// FILE: /simpleReturn.kt
// FUN: foo
BB 0
CONTENT
1 FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
2 GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
3 RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Unit declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Unit
// END FUN: foo
// END FILE: /simpleReturn.kt
-1
View File
@@ -1 +0,0 @@
fun compare(x: Int, y: Int) = if (x > y) 1 else if (x < y) -1 else 0
-57
View File
@@ -1,57 +0,0 @@
// FILE: /cascadeIf.kt
// FUN: compare
BB 0
CONTENT
1 FUN name:compare visibility:public modality:FINAL <> (x:kotlin.Int, y:kotlin.Int) returnType:kotlin.Int
2 WHEN type=kotlin.Int origin=IF
3 GET_VAR 'x: kotlin.Int declared in <root>.compare' type=kotlin.Int origin=null
4 GET_VAR 'y: kotlin.Int declared in <root>.compare' type=kotlin.Int origin=null
OUTGOING -> BB 1, 3
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
BB 1
INCOMING <- BB 0
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 GET_VAR 'x: kotlin.Int declared in <root>.compare' type=kotlin.Int origin=null
2 GET_VAR 'y: kotlin.Int declared in <root>.compare' type=kotlin.Int origin=null
OUTGOING -> BB 2, 4
CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
BB 2
INCOMING <- BB 1
CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
OUTGOING -> BB 5
CONST Boolean type=kotlin.Boolean value=true
BB 3
INCOMING <- BB 0
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 CONST Int type=kotlin.Int value=1
OUTGOING -> BB 6
When exit: WHEN type=kotlin.Int origin=IF
BB 4
INCOMING <- BB 1
CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
1 CONST Int type=kotlin.Int value=-1
OUTGOING -> BB 6
When exit: WHEN type=kotlin.Int origin=IF
BB 5
INCOMING <- BB 2
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 CONST Int type=kotlin.Int value=0
OUTGOING -> BB 6
When exit: WHEN type=kotlin.Int origin=IF
BB 6
INCOMING <- BB 3, 4, 5
When exit: WHEN type=kotlin.Int origin=IF
CONTENT
1 RETURN type=kotlin.Nothing from='public final fun compare (x: kotlin.Int, y: kotlin.Int): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:compare visibility:public modality:FINAL <> (x:kotlin.Int, y:kotlin.Int) returnType:kotlin.Int
// END FUN: compare
// END FILE: /cascadeIf.kt
-3
View File
@@ -1,3 +0,0 @@
fun empty() = when {
else -> 42
}
-27
View File
@@ -1,27 +0,0 @@
// FILE: /emptyWhen.kt
// FUN: empty
BB 0
CONTENT
1 FUN name:empty visibility:public modality:FINAL <> () returnType:kotlin.Int
2 WHEN type=kotlin.Int origin=WHEN
OUTGOING -> BB 1
CONST Boolean type=kotlin.Boolean value=true
BB 1
INCOMING <- BB 0
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 CONST Int type=kotlin.Int value=42
OUTGOING -> BB 2
When exit: WHEN type=kotlin.Int origin=WHEN
BB 2
INCOMING <- BB 1
When exit: WHEN type=kotlin.Int origin=WHEN
CONTENT
1 RETURN type=kotlin.Nothing from='public final fun empty (): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:empty visibility:public modality:FINAL <> () returnType:kotlin.Int
// END FUN: empty
// END FILE: /emptyWhen.kt
-1
View File
@@ -1 +0,0 @@
fun max(x: Int, y: Int) = if (x > y) x else y
-42
View File
@@ -1,42 +0,0 @@
// FILE: /expressionIf.kt
// FUN: max
BB 0
CONTENT
1 FUN name:max visibility:public modality:FINAL <> (x:kotlin.Int, y:kotlin.Int) returnType:kotlin.Int
2 WHEN type=kotlin.Int origin=IF
3 GET_VAR 'x: kotlin.Int declared in <root>.max' type=kotlin.Int origin=null
4 GET_VAR 'y: kotlin.Int declared in <root>.max' type=kotlin.Int origin=null
OUTGOING -> BB 1, 2
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
BB 1
INCOMING <- BB 0
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
OUTGOING -> BB 3
CONST Boolean type=kotlin.Boolean value=true
BB 2
INCOMING <- BB 0
CALL 'public final fun greater (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 GET_VAR 'x: kotlin.Int declared in <root>.max' type=kotlin.Int origin=null
OUTGOING -> BB 4
When exit: WHEN type=kotlin.Int origin=IF
BB 3
INCOMING <- BB 1
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 GET_VAR 'y: kotlin.Int declared in <root>.max' type=kotlin.Int origin=null
OUTGOING -> BB 4
When exit: WHEN type=kotlin.Int origin=IF
BB 4
INCOMING <- BB 2, 3
When exit: WHEN type=kotlin.Int origin=IF
CONTENT
1 RETURN type=kotlin.Nothing from='public final fun max (x: kotlin.Int, y: kotlin.Int): kotlin.Int declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:max visibility:public modality:FINAL <> (x:kotlin.Int, y:kotlin.Int) returnType:kotlin.Int
// END FUN: max
// END FILE: /expressionIf.kt
-14
View File
@@ -1,14 +0,0 @@
fun minBiRoot(a: Double, b: Double, c: Double): Double {
if (a == 0.0) {
if (b == 0.0) return 1.0
val bc = -c / b
if (bc < 0.0) return 2.0
return -bc
}
val d = b * b - 4 * a * c
if (d < 0.0) return 3.0
val y1 = (-b + d) / (2 * a)
val y2 = (-b - d) / (2 * a)
val y3 = if (y1 > y2) y1 else y2
return if (y3 < 0.0) 4.0 else -y3
}
-175
View File
@@ -1,175 +0,0 @@
// FILE: /ifChain.kt
// FUN: minBiRoot
BB 0
CONTENT
1 FUN name:minBiRoot visibility:public modality:FINAL <> (a:kotlin.Double, b:kotlin.Double, c:kotlin.Double) returnType:kotlin.Double
2 WHEN type=kotlin.Unit origin=IF
3 GET_VAR 'a: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
4 CONST Double type=kotlin.Double value=0.0
OUTGOING -> BB 1, 6
CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 1
INCOMING <- BB 0
CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 WHEN type=kotlin.Unit origin=IF
2 GET_VAR 'b: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
3 CONST Double type=kotlin.Double value=0.0
OUTGOING -> BB 2, 3
CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 2
INCOMING <- BB 1
CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 CONST Double type=kotlin.Double value=1.0
2 RETURN type=kotlin.Nothing from='public final fun minBiRoot (a: kotlin.Double, b: kotlin.Double, c: kotlin.Double): kotlin.Double declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:minBiRoot visibility:public modality:FINAL <> (a:kotlin.Double, b:kotlin.Double, c:kotlin.Double) returnType:kotlin.Double
BB 3
INCOMING <- BB 1
CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 GET_VAR 'c: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
2 CALL 'public final fun unaryMinus (): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=UMINUS
3 GET_VAR 'b: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
4 CALL 'public final fun div (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=DIV
5 VAR name:bc type:kotlin.Double [val]
6 WHEN type=kotlin.Unit origin=IF
7 GET_VAR 'val bc: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
8 CONST Double type=kotlin.Double value=0.0
OUTGOING -> BB 4, 5
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
BB 4
INCOMING <- BB 3
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
1 CONST Double type=kotlin.Double value=2.0
2 RETURN type=kotlin.Nothing from='public final fun minBiRoot (a: kotlin.Double, b: kotlin.Double, c: kotlin.Double): kotlin.Double declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:minBiRoot visibility:public modality:FINAL <> (a:kotlin.Double, b:kotlin.Double, c:kotlin.Double) returnType:kotlin.Double
BB 5
INCOMING <- BB 3
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
1 GET_VAR 'val bc: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
2 CALL 'public final fun unaryMinus (): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=UMINUS
3 RETURN type=kotlin.Nothing from='public final fun minBiRoot (a: kotlin.Double, b: kotlin.Double, c: kotlin.Double): kotlin.Double declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:minBiRoot visibility:public modality:FINAL <> (a:kotlin.Double, b:kotlin.Double, c:kotlin.Double) returnType:kotlin.Double
BB 6
INCOMING <- BB 0
CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 GET_VAR 'b: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
2 GET_VAR 'b: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
3 CALL 'public final fun times (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=MUL
4 CONST Int type=kotlin.Int value=4
5 GET_VAR 'a: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
6 CALL 'public final fun times (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Int' type=kotlin.Double origin=MUL
7 GET_VAR 'c: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
8 CALL 'public final fun times (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=MUL
9 CALL 'public final fun minus (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=MINUS
10 VAR name:d type:kotlin.Double [val]
11 WHEN type=kotlin.Unit origin=IF
12 GET_VAR 'val d: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
13 CONST Double type=kotlin.Double value=0.0
OUTGOING -> BB 7, 8
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
BB 7
INCOMING <- BB 6
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
1 CONST Double type=kotlin.Double value=3.0
2 RETURN type=kotlin.Nothing from='public final fun minBiRoot (a: kotlin.Double, b: kotlin.Double, c: kotlin.Double): kotlin.Double declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:minBiRoot visibility:public modality:FINAL <> (a:kotlin.Double, b:kotlin.Double, c:kotlin.Double) returnType:kotlin.Double
BB 8
INCOMING <- BB 6
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
1 GET_VAR 'b: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
2 CALL 'public final fun unaryMinus (): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=UMINUS
3 GET_VAR 'val d: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
4 CALL 'public final fun plus (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=PLUS
5 CONST Int type=kotlin.Int value=2
6 GET_VAR 'a: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
7 CALL 'public final fun times (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Int' type=kotlin.Double origin=MUL
8 CALL 'public final fun div (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=DIV
9 VAR name:y1 type:kotlin.Double [val]
10 GET_VAR 'b: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
11 CALL 'public final fun unaryMinus (): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=UMINUS
12 GET_VAR 'val d: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
13 CALL 'public final fun minus (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=MINUS
14 CONST Int type=kotlin.Int value=2
15 GET_VAR 'a: kotlin.Double declared in <root>.minBiRoot' type=kotlin.Double origin=null
16 CALL 'public final fun times (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Int' type=kotlin.Double origin=MUL
17 CALL 'public final fun div (other: kotlin.Double): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=DIV
18 VAR name:y2 type:kotlin.Double [val]
19 WHEN type=kotlin.Double origin=IF
20 GET_VAR 'val y1: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
21 GET_VAR 'val y2: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
OUTGOING -> BB 9, 10
CALL 'public final fun greater (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
BB 9
INCOMING <- BB 8
CALL 'public final fun greater (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
OUTGOING -> BB 11
CONST Boolean type=kotlin.Boolean value=true
BB 10
INCOMING <- BB 8
CALL 'public final fun greater (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=GT
CONTENT
1 GET_VAR 'val y1: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
OUTGOING -> BB 12
When exit: WHEN type=kotlin.Double origin=IF
BB 11
INCOMING <- BB 9
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 GET_VAR 'val y2: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
OUTGOING -> BB 12
When exit: WHEN type=kotlin.Double origin=IF
BB 12
INCOMING <- BB 10, 11
When exit: WHEN type=kotlin.Double origin=IF
CONTENT
1 VAR name:y3 type:kotlin.Double [val]
2 WHEN type=kotlin.Double origin=IF
3 GET_VAR 'val y3: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
4 CONST Double type=kotlin.Double value=0.0
OUTGOING -> BB 13, 14
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
BB 13
INCOMING <- BB 12
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
OUTGOING -> BB 15
CONST Boolean type=kotlin.Boolean value=true
BB 14
INCOMING <- BB 12
CALL 'public final fun less (arg0: kotlin.Double, arg1: kotlin.Double): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT
CONTENT
1 CONST Double type=kotlin.Double value=4.0
OUTGOING -> BB 16
When exit: WHEN type=kotlin.Double origin=IF
BB 15
INCOMING <- BB 13
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 GET_VAR 'val y3: kotlin.Double [val] declared in <root>.minBiRoot' type=kotlin.Double origin=null
2 CALL 'public final fun unaryMinus (): kotlin.Double [operator] declared in kotlin.Double' type=kotlin.Double origin=UMINUS
OUTGOING -> BB 16
When exit: WHEN type=kotlin.Double origin=IF
BB 16
INCOMING <- BB 14, 15
When exit: WHEN type=kotlin.Double origin=IF
CONTENT
1 RETURN type=kotlin.Nothing from='public final fun minBiRoot (a: kotlin.Double, b: kotlin.Double, c: kotlin.Double): kotlin.Double declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:minBiRoot visibility:public modality:FINAL <> (a:kotlin.Double, b:kotlin.Double, c:kotlin.Double) returnType:kotlin.Double
// END FUN: minBiRoot
// END FILE: /ifChain.kt
-10
View File
@@ -1,10 +0,0 @@
fun toString(grade: String): String {
when (grade) {
"A" -> return "Excellent"
"B" -> return "Good"
"C" -> return "Mediocre"
"D" -> return "Fair"
else -> return "Failure"
}
return "???"
}
-95
View File
@@ -1,95 +0,0 @@
// FILE: /whenReturn.kt
// FUN: toString
BB 0
CONTENT
1 FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
2 GET_VAR 'grade: kotlin.String declared in <root>.toString' type=kotlin.String origin=null
3 VAR IR_TEMPORARY_VARIABLE name:tmp0_subject type:kotlin.String [val]
4 WHEN type=kotlin.Unit origin=WHEN
5 GET_VAR 'val tmp0_subject: kotlin.String [val] declared in <root>.toString' type=kotlin.String origin=null
6 CONST String type=kotlin.String value="A"
OUTGOING -> BB 1, 5
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 1
INCOMING <- BB 0
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 GET_VAR 'val tmp0_subject: kotlin.String [val] declared in <root>.toString' type=kotlin.String origin=null
2 CONST String type=kotlin.String value="B"
OUTGOING -> BB 2, 6
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 2
INCOMING <- BB 1
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 GET_VAR 'val tmp0_subject: kotlin.String [val] declared in <root>.toString' type=kotlin.String origin=null
2 CONST String type=kotlin.String value="C"
OUTGOING -> BB 3, 7
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 3
INCOMING <- BB 2
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 GET_VAR 'val tmp0_subject: kotlin.String [val] declared in <root>.toString' type=kotlin.String origin=null
2 CONST String type=kotlin.String value="D"
OUTGOING -> BB 4, 8
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
BB 4
INCOMING <- BB 3
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
OUTGOING -> BB 9, 10
CONST Boolean type=kotlin.Boolean value=true
BB 5
INCOMING <- BB 0
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 CONST String type=kotlin.String value="Excellent"
2 RETURN type=kotlin.Nothing from='public final fun toString (grade: kotlin.String): kotlin.String declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
BB 6
INCOMING <- BB 1
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 CONST String type=kotlin.String value="Good"
2 RETURN type=kotlin.Nothing from='public final fun toString (grade: kotlin.String): kotlin.String declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
BB 7
INCOMING <- BB 2
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 CONST String type=kotlin.String value="Mediocre"
2 RETURN type=kotlin.Nothing from='public final fun toString (grade: kotlin.String): kotlin.String declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
BB 8
INCOMING <- BB 3
CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
CONTENT
1 CONST String type=kotlin.String value="Fair"
2 RETURN type=kotlin.Nothing from='public final fun toString (grade: kotlin.String): kotlin.String declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
BB 9
INCOMING <- BB 4
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 CONST String type=kotlin.String value="Failure"
2 RETURN type=kotlin.Nothing from='public final fun toString (grade: kotlin.String): kotlin.String declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
BB 10
INCOMING <- BB 4
CONST Boolean type=kotlin.Boolean value=true
CONTENT
1 CONST String type=kotlin.String value="???"
2 RETURN type=kotlin.Nothing from='public final fun toString (grade: kotlin.String): kotlin.String declared in <root>'
OUTGOING -> NONE
Function exit: FUN name:toString visibility:public modality:FINAL <> (grade:kotlin.String) returnType:kotlin.String
// END FUN: toString
// END FILE: /whenReturn.kt