in Sources/SIL/BitcodeParser.swift [97:120]
func parseFieldType() throws -> (result: OperandKind, complexity: Int) {
let isLiteral = try read(fixed: 1)
if isLiteral == 1 {
return (result: .literal(try read(vbr: 8)), complexity: 1)
}
let encoding = try read(fixed: 3)
let result: OperandKind
switch encoding.uint8 {
case 1:
result = .fixed(width: try read(vbr: 5).int)
case 2:
result = .vbr(width: try read(vbr: 5).int)
case 3:
let (result:elementType, complexity:c) = try parseFieldType()
return (result: .array(elementType), complexity: c + 1)
case 4:
result = .char6
case 5:
result = .blob
default:
throw Error.parseError("Unknown record field encoding: " + String(encoding.uint8))
}
return (result: result, complexity: 1)
}