...
This commit is contained in:
@@ -97,28 +97,21 @@ public partial class QBEGenerator
|
||||
return _writer.ToString();
|
||||
}
|
||||
|
||||
private string QBEAssign(NubType type)
|
||||
private static string QBEAssign(NubType type)
|
||||
{
|
||||
return type switch
|
||||
if (type.IsSimpleType(out var simpleType, out _))
|
||||
{
|
||||
NubComplexType => "=l",
|
||||
NubSimpleType simpleType => simpleType switch
|
||||
return simpleType.StorageSize switch
|
||||
{
|
||||
NubFuncType or NubFuncType => "=l",
|
||||
NubPrimitiveType primitiveType => primitiveType.Kind switch
|
||||
{
|
||||
PrimitiveTypeKind.I64 or PrimitiveTypeKind.U64 => "=l",
|
||||
PrimitiveTypeKind.I32 or PrimitiveTypeKind.U32 => "=w",
|
||||
PrimitiveTypeKind.I16 or PrimitiveTypeKind.U16 => "=w",
|
||||
PrimitiveTypeKind.I8 or PrimitiveTypeKind.U8 or PrimitiveTypeKind.Bool => "=w",
|
||||
PrimitiveTypeKind.F64 => "=d",
|
||||
PrimitiveTypeKind.F32 => "=s",
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
},
|
||||
_ => throw new NotSupportedException($"'{type}' type cannot be used in variables")
|
||||
},
|
||||
_ => throw new UnreachableException()
|
||||
};
|
||||
StorageSize.I8 or StorageSize.U8 or StorageSize.I16 or StorageSize.U16 or StorageSize.I32 or StorageSize.U32 => "=w",
|
||||
StorageSize.I64 or StorageSize.U64 => "=l",
|
||||
StorageSize.F32 => "=s",
|
||||
StorageSize.F64 => "=d",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(simpleType.StorageSize))
|
||||
};
|
||||
}
|
||||
|
||||
return "=l";
|
||||
}
|
||||
|
||||
private void EmitStore(NubType type, string value, string destination)
|
||||
|
||||
Reference in New Issue
Block a user