[K/N] Make llvm Int1 boolean, not byte
This commit is contained in:
+4
-4
@@ -270,7 +270,7 @@ internal class StackLocalsManagerImpl(
|
|||||||
listOf(bitcast(kInt8Ptr, stackSlot),
|
listOf(bitcast(kInt8Ptr, stackSlot),
|
||||||
Int8(0).llvm,
|
Int8(0).llvm,
|
||||||
Int32(LLVMSizeOfTypeInBits(codegen.llvmTargetData, type).toInt() / 8).llvm,
|
Int32(LLVMSizeOfTypeInBits(codegen.llvmTargetData, type).toInt() / 8).llvm,
|
||||||
Int1(0).llvm))
|
Int1(false).llvm))
|
||||||
|
|
||||||
val objectHeader = structGep(stackSlot, 0, "objHeader")
|
val objectHeader = structGep(stackSlot, 0, "objHeader")
|
||||||
val typeInfo = codegen.typeInfoForAllocation(irClass)
|
val typeInfo = codegen.typeInfoForAllocation(irClass)
|
||||||
@@ -328,7 +328,7 @@ internal class StackLocalsManagerImpl(
|
|||||||
Int8(0).llvm,
|
Int8(0).llvm,
|
||||||
Int32(constCount * LLVMSizeOfTypeInBits(codegen.llvmTargetData,
|
Int32(constCount * LLVMSizeOfTypeInBits(codegen.llvmTargetData,
|
||||||
arrayToElementType[irClass.symbol]).toInt() / 8).llvm,
|
arrayToElementType[irClass.symbol]).toInt() / 8).llvm,
|
||||||
Int1(0).llvm))
|
Int1(false).llvm))
|
||||||
StackLocal(true, irClass, arraySlot, arrayHeaderSlot)
|
StackLocal(true, irClass, arraySlot, arrayHeaderSlot)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ internal class StackLocalsManagerImpl(
|
|||||||
listOf(bodyWithSkippedServiceInfoPtr,
|
listOf(bodyWithSkippedServiceInfoPtr,
|
||||||
Int8(0).llvm,
|
Int8(0).llvm,
|
||||||
Int32(bodySize - serviceInfoSize).llvm,
|
Int32(bodySize - serviceInfoSize).llvm,
|
||||||
Int1(0).llvm))
|
Int1(false).llvm))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1353,7 +1353,7 @@ internal class FunctionGenerationContext(val function: LLVMValueRef,
|
|||||||
call(context.llvm.memsetFunction,
|
call(context.llvm.memsetFunction,
|
||||||
listOf(slotsMem, Int8(0).llvm,
|
listOf(slotsMem, Int8(0).llvm,
|
||||||
Int32(slotCount * codegen.runtime.pointerSize).llvm,
|
Int32(slotCount * codegen.runtime.pointerSize).llvm,
|
||||||
Int1(0).llvm))
|
Int1(false).llvm))
|
||||||
call(context.llvm.enterFrameFunction, listOf(slots, Int32(vars.skipSlots).llvm, Int32(slotCount).llvm))
|
call(context.llvm.enterFrameFunction, listOf(slots, Int32(vars.skipSlots).llvm, Int32(slotCount).llvm))
|
||||||
}
|
}
|
||||||
addPhiIncoming(slotsPhi!!, prologueBb to slots)
|
addPhiIncoming(slotsPhi!!, prologueBb to slots)
|
||||||
|
|||||||
+1
-1
@@ -273,7 +273,7 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv
|
|||||||
args.single()
|
args.single()
|
||||||
|
|
||||||
private fun FunctionGenerationContext.emitIsExperimentalMM(): LLVMValueRef =
|
private fun FunctionGenerationContext.emitIsExperimentalMM(): LLVMValueRef =
|
||||||
Int1(if (context.memoryModel == MemoryModel.EXPERIMENTAL) 1 else 0).llvm
|
Int1(context.memoryModel == MemoryModel.EXPERIMENTAL).llvm
|
||||||
|
|
||||||
private fun FunctionGenerationContext.emitListOfInternal(callSite: IrCall, args: List<LLVMValueRef>): LLVMValueRef {
|
private fun FunctionGenerationContext.emitListOfInternal(callSite: IrCall, args: List<LLVMValueRef>): LLVMValueRef {
|
||||||
val varargExpression = callSite.getValueArgument(0) as IrVararg
|
val varargExpression = callSite.getValueArgument(0) as IrVararg
|
||||||
|
|||||||
+2
-2
@@ -2246,8 +2246,8 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
//-------------------------------------------------------------------------//
|
//-------------------------------------------------------------------------//
|
||||||
private val kImmZero = Int32(0).llvm
|
private val kImmZero = Int32(0).llvm
|
||||||
private val kImmOne = Int32(1).llvm
|
private val kImmOne = Int32(1).llvm
|
||||||
private val kTrue = Int1(1).llvm
|
private val kTrue = Int1(true).llvm
|
||||||
private val kFalse = Int1(0).llvm
|
private val kFalse = Int1(false).llvm
|
||||||
|
|
||||||
// TODO: Intrinsify?
|
// TODO: Intrinsify?
|
||||||
private fun evaluateOperatorCall(callee: IrCall, args: List<LLVMValueRef>): LLVMValueRef {
|
private fun evaluateOperatorCall(callee: IrCall, args: List<LLVMValueRef>): LLVMValueRef {
|
||||||
|
|||||||
+2
-2
@@ -115,8 +115,8 @@ internal val vector128Type get() = LLVMVectorType(floatType, 4)!!
|
|||||||
|
|
||||||
internal val voidType get() = LLVMVoidTypeInContext(llvmContext)!!
|
internal val voidType get() = LLVMVoidTypeInContext(llvmContext)!!
|
||||||
|
|
||||||
internal class Int1(val value: Byte) : ConstValue {
|
internal class Int1(val value: Boolean) : ConstValue {
|
||||||
override val llvm = LLVMConstInt(int1Type, value.toLong(), 1)!!
|
override val llvm = LLVMConstInt(int1Type, if (value) 1 else 0, 1)!!
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class Int8(val value: Byte) : ConstValue {
|
internal class Int8(val value: Byte) : ConstValue {
|
||||||
|
|||||||
+1
-1
@@ -363,7 +363,7 @@ internal class ObjCExportCodeGenerator(
|
|||||||
if (context.llvmModuleSpecification.importsKotlinDeclarationsFromOtherSharedLibraries()) {
|
if (context.llvmModuleSpecification.importsKotlinDeclarationsFromOtherSharedLibraries()) {
|
||||||
replaceExternalWeakOrCommonGlobal(
|
replaceExternalWeakOrCommonGlobal(
|
||||||
"Kotlin_ObjCExport_initTypeAdapters",
|
"Kotlin_ObjCExport_initTypeAdapters",
|
||||||
Int1(1),
|
Int1(true),
|
||||||
context.standardLlvmSymbolsOrigin
|
context.standardLlvmSymbolsOrigin
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user