[K/N] Make llvm Int1 boolean, not byte

This commit is contained in:
Pavel Kunyavskiy
2021-07-07 17:14:21 +03:00
committed by Space
parent eec8fdf16a
commit 594ff1474d
5 changed files with 10 additions and 10 deletions
@@ -270,7 +270,7 @@ internal class StackLocalsManagerImpl(
listOf(bitcast(kInt8Ptr, stackSlot),
Int8(0).llvm,
Int32(LLVMSizeOfTypeInBits(codegen.llvmTargetData, type).toInt() / 8).llvm,
Int1(0).llvm))
Int1(false).llvm))
val objectHeader = structGep(stackSlot, 0, "objHeader")
val typeInfo = codegen.typeInfoForAllocation(irClass)
@@ -328,7 +328,7 @@ internal class StackLocalsManagerImpl(
Int8(0).llvm,
Int32(constCount * LLVMSizeOfTypeInBits(codegen.llvmTargetData,
arrayToElementType[irClass.symbol]).toInt() / 8).llvm,
Int1(0).llvm))
Int1(false).llvm))
StackLocal(true, irClass, arraySlot, arrayHeaderSlot)
}
@@ -367,7 +367,7 @@ internal class StackLocalsManagerImpl(
listOf(bodyWithSkippedServiceInfoPtr,
Int8(0).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,
listOf(slotsMem, Int8(0).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))
}
addPhiIncoming(slotsPhi!!, prologueBb to slots)
@@ -273,7 +273,7 @@ internal class IntrinsicGenerator(private val environment: IntrinsicGeneratorEnv
args.single()
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 {
val varargExpression = callSite.getValueArgument(0) as IrVararg
@@ -2246,8 +2246,8 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
//-------------------------------------------------------------------------//
private val kImmZero = Int32(0).llvm
private val kImmOne = Int32(1).llvm
private val kTrue = Int1(1).llvm
private val kFalse = Int1(0).llvm
private val kTrue = Int1(true).llvm
private val kFalse = Int1(false).llvm
// TODO: Intrinsify?
private fun evaluateOperatorCall(callee: IrCall, args: List<LLVMValueRef>): LLVMValueRef {
@@ -115,8 +115,8 @@ internal val vector128Type get() = LLVMVectorType(floatType, 4)!!
internal val voidType get() = LLVMVoidTypeInContext(llvmContext)!!
internal class Int1(val value: Byte) : ConstValue {
override val llvm = LLVMConstInt(int1Type, value.toLong(), 1)!!
internal class Int1(val value: Boolean) : ConstValue {
override val llvm = LLVMConstInt(int1Type, if (value) 1 else 0, 1)!!
}
internal class Int8(val value: Byte) : ConstValue {
@@ -363,7 +363,7 @@ internal class ObjCExportCodeGenerator(
if (context.llvmModuleSpecification.importsKotlinDeclarationsFromOtherSharedLibraries()) {
replaceExternalWeakOrCommonGlobal(
"Kotlin_ObjCExport_initTypeAdapters",
Int1(1),
Int1(true),
context.standardLlvmSymbolsOrigin
)
}