From 361716124719f1ba99873f85e87d2297200d3574 Mon Sep 17 00:00:00 2001 From: Konstantin Anisimov Date: Fri, 28 Oct 2016 12:31:38 +0300 Subject: [PATCH] numeric literal support: define i32 @kfun:sum(i32) { entry: %a = alloca i32 store i32 %0, i32* %a %tmp1 = load i32, i32* %a %tmp0 = add i32 %tmp1, 33 ret i32 %tmp0 } --- .../kotlin/backend/native/llvm/IrToBitcode.kt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/native/llvm/IrToBitcode.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/native/llvm/IrToBitcode.kt index 79c1a00e167..99b05f03706 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/native/llvm/IrToBitcode.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/native/llvm/IrToBitcode.kt @@ -133,6 +133,20 @@ internal class CodeGeneratorVisitor(val context: Context) : IrElementVisitorVoid } TODO() } + + is IrConst<*> -> when (value.kind) { + IrConstKind.Null -> TODO() // LLVMConstPointerNull + IrConstKind.Boolean -> TODO() + IrConstKind.Char -> TODO() + IrConstKind.Byte -> return LLVMConstInt(LLVMInt32Type(), (value.value as Byte).toLong(), 1) + IrConstKind.Short -> return LLVMConstInt(LLVMInt32Type(), (value.value as Short).toLong(), 1) + IrConstKind.Int -> return LLVMConstInt(LLVMInt32Type(), (value.value as Int).toLong(), 1) + IrConstKind.Long -> return LLVMConstInt(LLVMInt64Type(), value.value as Long, 1) + IrConstKind.String -> TODO() + IrConstKind.Float -> TODO() + IrConstKind.Double -> TODO() + } + null -> return null else -> { TODO()