translator-bc: bit more transfer to laptop
This commit is contained in:
+14
-5
@@ -262,18 +262,24 @@ class LLVMBuilder(arm: Boolean = false) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun storeString(target: LLVMVariable, source: LLVMVariable, offset: Int) {
|
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}"
|
"${(source.type as LLVMStringType).fullArrayType}* $source, i32 0, i32 $offset), ${target.pointedType} $target, align ${source.type.align}"
|
||||||
(target.type as LLVMStringType).isLoaded = true
|
(target.type as LLVMStringType).isLoaded = true
|
||||||
addLLVMCodeToLocalPlace(code)
|
addLLVMCodeToLocalPlace(code)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
fun storeVariable(target: LLVMSingleValue, source: LLVMSingleValue) {
|
fun storeVariable(target: LLVMSingleValue, source: LLVMSingleValue) {
|
||||||
|
ir.storeVariable(target, source)
|
||||||
|
bc.storeVariable(target, source)
|
||||||
|
/*
|
||||||
if ((source.type is LLVMStringType) && !(source.type.isLoaded)) {
|
if ((source.type is LLVMStringType) && !(source.type.isLoaded)) {
|
||||||
storeString(target as LLVMVariable, source as LLVMVariable, 0)
|
storeString(target as LLVMVariable, source as LLVMVariable, 0)
|
||||||
} else {
|
} else {
|
||||||
addLLVMCodeToLocalPlace("store ${source.pointedType} $source, ${target.pointedType} $target, align ${source.type.align}")
|
addLLVMCodeToLocalPlace("store ${source.pointedType} $source, ${target.pointedType} $target, align ${source.type.align}")
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveExpression(expression: LLVMSingleValue): LLVMVariable {
|
fun saveExpression(expression: LLVMSingleValue): LLVMVariable {
|
||||||
@@ -282,10 +288,13 @@ class LLVMBuilder(arm: Boolean = false) {
|
|||||||
return resultOp
|
return resultOp
|
||||||
}
|
}
|
||||||
|
|
||||||
fun storeNull(result: LLVMVariable) =
|
fun storeNull(result: LLVMVariable) {
|
||||||
addLLVMCodeToLocalPlace("store ${result.pointedType.dropLast(1)} null, ${result.pointedType} $result, align ${TranslationState.POINTER_ALIGN}")
|
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) {
|
private fun copyVariableValue(target: LLVMVariable, source: LLVMVariable) {
|
||||||
var from = source
|
var from = source
|
||||||
|
|||||||
+12
@@ -100,5 +100,17 @@ class BcLlvmBuilder {
|
|||||||
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
|
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.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+12
@@ -138,4 +138,16 @@ class IrLlvmBuilder {
|
|||||||
fun memcpy(castedDst: LLVMVariable, castedSrc: LLVMVariable, size: Int, align: Int, volatile: Boolean) {
|
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.
|
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.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user