translator-bc: bit more transfer to laptop

This commit is contained in:
Vasily Levchenko
2016-09-23 18:32:43 +03:00
parent f6c9a4ad6b
commit 6572f84b31
3 changed files with 38 additions and 5 deletions
@@ -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
@@ -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.
}
}
@@ -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.
}
}