diff --git a/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/LLVMBuilder.kt b/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/LLVMBuilder.kt index 7db2931a596..8226ef55827 100644 --- a/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/LLVMBuilder.kt +++ b/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/LLVMBuilder.kt @@ -262,18 +262,24 @@ class LLVMBuilder(arm: Boolean = false) { } fun storeString(target: LLVMVariable, source: LLVMVariable, offset: Int) { - val code = "store ${target.type} getelementptr inbounds (" + + ir.storeString(target, source, offset) + bc.storeString(target, source, offset) + /*val code = "store ${target.type} getelementptr inbounds (" + "${(source.type as LLVMStringType).fullArrayType}* $source, i32 0, i32 $offset), ${target.pointedType} $target, align ${source.type.align}" (target.type as LLVMStringType).isLoaded = true addLLVMCodeToLocalPlace(code) + */ } fun storeVariable(target: LLVMSingleValue, source: LLVMSingleValue) { + ir.storeVariable(target, source) + bc.storeVariable(target, source) + /* if ((source.type is LLVMStringType) && !(source.type.isLoaded)) { storeString(target as LLVMVariable, source as LLVMVariable, 0) } else { addLLVMCodeToLocalPlace("store ${source.pointedType} $source, ${target.pointedType} $target, align ${source.type.align}") - } + }*/ } fun saveExpression(expression: LLVMSingleValue): LLVMVariable { @@ -282,10 +288,13 @@ class LLVMBuilder(arm: Boolean = false) { return resultOp } - fun storeNull(result: LLVMVariable) = - addLLVMCodeToLocalPlace("store ${result.pointedType.dropLast(1)} null, ${result.pointedType} $result, align ${TranslationState.POINTER_ALIGN}") + fun storeNull(result: LLVMVariable) { + ir.storeNull(result) + bc.storeNull(result) + //addLLVMCodeToLocalPlace("store ${result.pointedType.dropLast(1)} null, ${result.pointedType} $result, align ${TranslationState.POINTER_ALIGN}") + } - override fun toString() = globalCode.toString() + localCode.toString() + override fun toString() = ir.toString() private fun copyVariableValue(target: LLVMVariable, source: LLVMVariable) { var from = source diff --git a/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/bc/BcLlvmBuilder.kt b/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/bc/BcLlvmBuilder.kt index ecf84e4a8f5..40cc90fc686 100644 --- a/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/bc/BcLlvmBuilder.kt +++ b/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/bc/BcLlvmBuilder.kt @@ -100,5 +100,17 @@ class BcLlvmBuilder { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } + fun storeString(target: LLVMVariable, source: LLVMVariable, offset: Int) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + fun storeVariable(target: LLVMSingleValue, source: LLVMSingleValue) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + fun storeNull(result: LLVMVariable) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + } \ No newline at end of file diff --git a/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/ir/IrLlvmBuilder.kt b/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/ir/IrLlvmBuilder.kt index 1ce88f4994e..bb136cf19f1 100644 --- a/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/ir/IrLlvmBuilder.kt +++ b/experiments/translator-bc/src/main/kotlin/org/kotlinnative/translator/llvm/ir/IrLlvmBuilder.kt @@ -138,4 +138,16 @@ class IrLlvmBuilder { fun memcpy(castedDst: LLVMVariable, castedSrc: LLVMVariable, size: Int, align: Int, volatile: Boolean) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } + + fun storeString(target: LLVMVariable, source: LLVMVariable, offset: Int) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + fun storeVariable(target: LLVMSingleValue, source: LLVMSingleValue) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } + + fun storeNull(result: LLVMVariable) { + TODO("not implemented") //To change body of created functions use File | Settings | File Templates. + } } \ No newline at end of file