Inlining phase inserted
This commit is contained in:
+3
@@ -35,5 +35,8 @@ internal class KonanLower(val context: Context) {
|
|||||||
phaser.phase(KonanPhase.AUTOBOX) {
|
phaser.phase(KonanPhase.AUTOBOX) {
|
||||||
Autoboxing(context).lower(irFile)
|
Autoboxing(context).lower(irFile)
|
||||||
}
|
}
|
||||||
|
phaser.phase(KonanPhase.LOWER_INLINE) {
|
||||||
|
FunctionInlining(context).inline(irFile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
@@ -15,6 +15,7 @@ enum class KonanPhase(val description: String,
|
|||||||
/* ... ... */ LOWER_SHARED_VARIABLES("Shared Variable Lowering"),
|
/* ... ... */ LOWER_SHARED_VARIABLES("Shared Variable Lowering"),
|
||||||
/* ... ... */ LOWER_LOCAL_FUNCTIONS("Local Function Lowering"),
|
/* ... ... */ LOWER_LOCAL_FUNCTIONS("Local Function Lowering"),
|
||||||
/* ... ... */ LOWER_CALLABLES("Callable references Lowering"),
|
/* ... ... */ LOWER_CALLABLES("Callable references Lowering"),
|
||||||
|
/* ... ... */ LOWER_INLINE("Functions inlining"),
|
||||||
/* ... ... */ AUTOBOX("Autoboxing of primitive types"),
|
/* ... ... */ AUTOBOX("Autoboxing of primitive types"),
|
||||||
/* ... */ BITCODE("LLVM BitCode Generation"),
|
/* ... */ BITCODE("LLVM BitCode Generation"),
|
||||||
/* ... ... */ RTTI("RTTI Generation"),
|
/* ... ... */ RTTI("RTTI Generation"),
|
||||||
|
|||||||
+33
@@ -0,0 +1,33 @@
|
|||||||
|
package org.jetbrains.kotlin.backend.konan.lower
|
||||||
|
|
||||||
|
import org.jetbrains.kotlin.backend.common.BackendContext
|
||||||
|
import org.jetbrains.kotlin.backend.konan.Context
|
||||||
|
import org.jetbrains.kotlin.backend.konan.ir.ModuleIndex
|
||||||
|
import org.jetbrains.kotlin.descriptors.FunctionDescriptor
|
||||||
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
|
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||||
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||||
|
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||||
|
import org.jetbrains.kotlin.ir.visitors.acceptVoid
|
||||||
|
|
||||||
|
class FunctionInlining(val context: Context) {
|
||||||
|
fun inline(irFile: IrFile) {
|
||||||
|
irFile.acceptVoid(object : IrElementVisitorVoid {
|
||||||
|
override fun visitElement(element: IrElement) {
|
||||||
|
element.acceptChildrenVoid(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun visitCall(expression: IrCall) {
|
||||||
|
val functionDescriptor = expression.descriptor as FunctionDescriptor
|
||||||
|
if (functionDescriptor.isInline == false) {
|
||||||
|
super.visitCall(expression)
|
||||||
|
} else {
|
||||||
|
val functionDeclaration = context.ir.moduleIndex.functions[functionDescriptor]
|
||||||
|
println("inline_akm")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user