| author | |
| committer | |
| log | 5792570197f44b2c7599fb756f5c1e9d59bd0a9a |
| tree | c8c2ab2669f80879cd87b036a960c243467790c7 |
| parent | 47050fbb7d2da64334db267f8008cf71c6575d65 |
ref: 5688dbccfb58216468267a0f46b96bed7013715a49 files changed, 69476 insertions(+), 1 deletions(-)
.gitattributes+1| ... | ... | @@ -10,3 +10,4 @@ lib/libcxx/** linguist-vendored |
| 10 | 10 | lib/libcxxabi/** linguist-vendored |
| 11 | 11 | lib/libunwind/** linguist-vendored |
| 12 | 12 | lib/tsan/** linguist-vendored |
| 13 | deps/** linguist-vendored |
CMakeLists.txt+2-1| ... | ... | @@ -797,7 +797,8 @@ set(BUILD_ZIG2_ARGS |
| 797 | 797 | -OReleaseSmall |
| 798 | 798 | --name zig2 -femit-bin="${ZIG2_C_SOURCE}" |
| 799 | 799 | --mod "build_options::${ZIG_CONFIG_ZIG_OUT}" |
| 800 | --deps build_options | |
| 800 | --mod "aro::deps/aro/lib.zig" | |
| 801 | --deps build_options,aro | |
| 801 | 802 | -target "${ZIG_HOST_TARGET_TRIPLE}" |
| 802 | 803 | ) |
| 803 | 804 |
build.zig+3| ... | ... | @@ -580,6 +580,9 @@ fn addCompilerStep( |
| 580 | 580 | .optimize = optimize, |
| 581 | 581 | }); |
| 582 | 582 | exe.stack_size = stack_size; |
| 583 | exe.addAnonymousModule("aro", .{ | |
| 584 | .source_file = .{ .path = "deps/aro/lib.zig" }, | |
| 585 | }); | |
| 583 | 586 | return exe; |
| 584 | 587 | } |
| 585 | 588 |
deps/aro/Attribute.zig created+1346| ... | ... | @@ -0,0 +1,1346 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const ZigType = std.builtin.Type; | |
| 4 | const CallingConvention = @import("lib.zig").CallingConvention; | |
| 5 | const Compilation = @import("Compilation.zig"); | |
| 6 | const Diagnostics = @import("Diagnostics.zig"); | |
| 7 | const Parser = @import("Parser.zig"); | |
| 8 | const Tree = @import("Tree.zig"); | |
| 9 | const NodeIndex = Tree.NodeIndex; | |
| 10 | const TokenIndex = Tree.TokenIndex; | |
| 11 | const Type = @import("Type.zig"); | |
| 12 | const Value = @import("Value.zig"); | |
| 13 | ||
| 14 | const Attribute = @This(); | |
| 15 | ||
| 16 | tag: Tag, | |
| 17 | syntax: Syntax, | |
| 18 | args: Arguments, | |
| 19 | ||
| 20 | pub const Syntax = enum { | |
| 21 | c2x, | |
| 22 | declspec, | |
| 23 | gnu, | |
| 24 | keyword, | |
| 25 | }; | |
| 26 | ||
| 27 | pub const Kind = enum { | |
| 28 | c2x, | |
| 29 | declspec, | |
| 30 | gnu, | |
| 31 | ||
| 32 | pub fn toSyntax(kind: Kind) Syntax { | |
| 33 | return switch (kind) { | |
| 34 | .c2x => .c2x, | |
| 35 | .declspec => .declspec, | |
| 36 | .gnu => .gnu, | |
| 37 | }; | |
| 38 | } | |
| 39 | }; | |
| 40 | ||
| 41 | pub const ArgumentType = enum { | |
| 42 | string, | |
| 43 | identifier, | |
| 44 | int, | |
| 45 | alignment, | |
| 46 | float, | |
| 47 | expression, | |
| 48 | nullptr_t, | |
| 49 | ||
| 50 | pub fn toString(self: ArgumentType) []const u8 { | |
| 51 | return switch (self) { | |
| 52 | .string => "a string", | |
| 53 | .identifier => "an identifier", | |
| 54 | .int, .alignment => "an integer constant", | |
| 55 | .nullptr_t => "nullptr", | |
| 56 | .float => "a floating point number", | |
| 57 | .expression => "an expression", | |
| 58 | }; | |
| 59 | } | |
| 60 | ||
| 61 | fn fromType(comptime T: type) ArgumentType { | |
| 62 | return switch (T) { | |
| 63 | []const u8 => .string, | |
| 64 | Identifier => .identifier, | |
| 65 | u32 => .int, | |
| 66 | Alignment => .alignment, | |
| 67 | CallingConvention => .identifier, | |
| 68 | else => switch (@typeInfo(T)) { | |
| 69 | .Enum => if (T.opts.enum_kind == .string) .string else .identifier, | |
| 70 | else => unreachable, | |
| 71 | }, | |
| 72 | }; | |
| 73 | } | |
| 74 | ||
| 75 | fn fromVal(value: Value) ArgumentType { | |
| 76 | return switch (value.tag) { | |
| 77 | .int => .int, | |
| 78 | .bytes => .string, | |
| 79 | .unavailable => .expression, | |
| 80 | .float => .float, | |
| 81 | .nullptr_t => .nullptr_t, | |
| 82 | }; | |
| 83 | } | |
| 84 | }; | |
| 85 | ||
| 86 | fn getArguments(comptime descriptor: type) []const ZigType.StructField { | |
| 87 | return if (@hasDecl(descriptor, "Args")) std.meta.fields(descriptor.Args) else &.{}; | |
| 88 | } | |
| 89 | ||
| 90 | /// number of required arguments | |
| 91 | pub fn requiredArgCount(attr: Tag) u32 { | |
| 92 | switch (attr) { | |
| 93 | inline else => |tag| { | |
| 94 | comptime var needed = 0; | |
| 95 | comptime { | |
| 96 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 97 | for (fields) |arg_field| { | |
| 98 | if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .Optional) needed += 1; | |
| 99 | } | |
| 100 | } | |
| 101 | return needed; | |
| 102 | }, | |
| 103 | } | |
| 104 | } | |
| 105 | ||
| 106 | /// maximum number of args that can be passed | |
| 107 | pub fn maxArgCount(attr: Tag) u32 { | |
| 108 | switch (attr) { | |
| 109 | inline else => |tag| { | |
| 110 | comptime var max = 0; | |
| 111 | comptime { | |
| 112 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 113 | for (fields) |arg_field| { | |
| 114 | if (!mem.eql(u8, arg_field.name, "__name_tok")) max += 1; | |
| 115 | } | |
| 116 | } | |
| 117 | return max; | |
| 118 | }, | |
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | fn UnwrapOptional(comptime T: type) type { | |
| 123 | return switch (@typeInfo(T)) { | |
| 124 | .Optional => |optional| optional.child, | |
| 125 | else => T, | |
| 126 | }; | |
| 127 | } | |
| 128 | ||
| 129 | pub const Formatting = struct { | |
| 130 | /// The quote char (single or double) to use when printing identifiers/strings corresponding | |
| 131 | /// to the enum in the first field of the Args of `attr`. Identifier enums use single quotes, string enums | |
| 132 | /// use double quotes | |
| 133 | fn quoteChar(attr: Tag) []const u8 { | |
| 134 | switch (attr) { | |
| 135 | .calling_convention => unreachable, | |
| 136 | inline else => |tag| { | |
| 137 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 138 | ||
| 139 | if (fields.len == 0) unreachable; | |
| 140 | const Unwrapped = UnwrapOptional(fields[0].type); | |
| 141 | if (@typeInfo(Unwrapped) != .Enum) unreachable; | |
| 142 | ||
| 143 | return if (Unwrapped.opts.enum_kind == .identifier) "'" else "\""; | |
| 144 | }, | |
| 145 | } | |
| 146 | } | |
| 147 | ||
| 148 | /// returns a comma-separated string of quoted enum values, representing the valid | |
| 149 | /// choices for the string or identifier enum of the first field of the Args of `attr`. | |
| 150 | pub fn choices(attr: Tag) []const u8 { | |
| 151 | switch (attr) { | |
| 152 | .calling_convention => unreachable, | |
| 153 | inline else => |tag| { | |
| 154 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 155 | ||
| 156 | if (fields.len == 0) unreachable; | |
| 157 | const Unwrapped = UnwrapOptional(fields[0].type); | |
| 158 | if (@typeInfo(Unwrapped) != .Enum) unreachable; | |
| 159 | ||
| 160 | const enum_fields = @typeInfo(Unwrapped).Enum.fields; | |
| 161 | @setEvalBranchQuota(3000); | |
| 162 | const quote = comptime quoteChar(@enumFromInt(@intFromEnum(tag))); | |
| 163 | comptime var values: []const u8 = quote ++ enum_fields[0].name ++ quote; | |
| 164 | inline for (enum_fields[1..]) |enum_field| { | |
| 165 | values = values ++ ", "; | |
| 166 | values = values ++ quote ++ enum_field.name ++ quote; | |
| 167 | } | |
| 168 | return values; | |
| 169 | }, | |
| 170 | } | |
| 171 | } | |
| 172 | }; | |
| 173 | ||
| 174 | /// Checks if the first argument (if it exists) is an identifier enum | |
| 175 | pub fn wantsIdentEnum(attr: Tag) bool { | |
| 176 | switch (attr) { | |
| 177 | .calling_convention => return false, | |
| 178 | inline else => |tag| { | |
| 179 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 180 | ||
| 181 | if (fields.len == 0) return false; | |
| 182 | const Unwrapped = UnwrapOptional(fields[0].type); | |
| 183 | if (@typeInfo(Unwrapped) != .Enum) return false; | |
| 184 | ||
| 185 | return Unwrapped.opts.enum_kind == .identifier; | |
| 186 | }, | |
| 187 | } | |
| 188 | } | |
| 189 | ||
| 190 | pub fn diagnoseIdent(attr: Tag, arguments: *Arguments, ident: []const u8) ?Diagnostics.Message { | |
| 191 | switch (attr) { | |
| 192 | inline else => |tag| { | |
| 193 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 194 | if (fields.len == 0) unreachable; | |
| 195 | const Unwrapped = UnwrapOptional(fields[0].type); | |
| 196 | if (@typeInfo(Unwrapped) != .Enum) unreachable; | |
| 197 | if (std.meta.stringToEnum(Unwrapped, normalize(ident))) |enum_val| { | |
| 198 | @field(@field(arguments, @tagName(tag)), fields[0].name) = enum_val; | |
| 199 | return null; | |
| 200 | } | |
| 201 | return Diagnostics.Message{ | |
| 202 | .tag = .unknown_attr_enum, | |
| 203 | .extra = .{ .attr_enum = .{ .tag = attr } }, | |
| 204 | }; | |
| 205 | }, | |
| 206 | } | |
| 207 | } | |
| 208 | ||
| 209 | pub fn wantsAlignment(attr: Tag, idx: usize) bool { | |
| 210 | switch (attr) { | |
| 211 | inline else => |tag| { | |
| 212 | const fields = getArguments(@field(attributes, @tagName(tag))); | |
| 213 | if (fields.len == 0) return false; | |
| 214 | ||
| 215 | return switch (idx) { | |
| 216 | inline 0...fields.len - 1 => |i| UnwrapOptional(fields[i].type) == Alignment, | |
| 217 | else => false, | |
| 218 | }; | |
| 219 | }, | |
| 220 | } | |
| 221 | } | |
| 222 | ||
| 223 | pub fn diagnoseAlignment(attr: Tag, arguments: *Arguments, arg_idx: u32, val: Value, ty: Type, comp: *Compilation) ?Diagnostics.Message { | |
| 224 | switch (attr) { | |
| 225 | inline else => |tag| { | |
| 226 | const arg_fields = getArguments(@field(attributes, @tagName(tag))); | |
| 227 | if (arg_fields.len == 0) unreachable; | |
| 228 | ||
| 229 | switch (arg_idx) { | |
| 230 | inline 0...arg_fields.len - 1 => |arg_i| { | |
| 231 | if (UnwrapOptional(arg_fields[arg_i].type) != Alignment) unreachable; | |
| 232 | ||
| 233 | if (val.tag != .int) return Diagnostics.Message{ .tag = .alignas_unavailable }; | |
| 234 | if (val.compare(.lt, Value.int(0), ty, comp)) { | |
| 235 | return Diagnostics.Message{ .tag = .negative_alignment, .extra = .{ .signed = val.signExtend(ty, comp) } }; | |
| 236 | } | |
| 237 | const requested = std.math.cast(u29, val.data.int) orelse { | |
| 238 | return Diagnostics.Message{ .tag = .maximum_alignment, .extra = .{ .unsigned = val.data.int } }; | |
| 239 | }; | |
| 240 | if (!std.mem.isValidAlign(requested)) return Diagnostics.Message{ .tag = .non_pow2_align }; | |
| 241 | ||
| 242 | @field(@field(arguments, @tagName(tag)), arg_fields[arg_i].name) = Alignment{ .requested = requested }; | |
| 243 | return null; | |
| 244 | }, | |
| 245 | else => unreachable, | |
| 246 | } | |
| 247 | }, | |
| 248 | } | |
| 249 | } | |
| 250 | ||
| 251 | fn diagnoseField( | |
| 252 | comptime decl: ZigType.Declaration, | |
| 253 | comptime field: ZigType.StructField, | |
| 254 | comptime wanted: type, | |
| 255 | arguments: *Arguments, | |
| 256 | val: Value, | |
| 257 | node: Tree.Node, | |
| 258 | strings: []const u8, | |
| 259 | ) ?Diagnostics.Message { | |
| 260 | switch (val.tag) { | |
| 261 | .int => { | |
| 262 | if (@typeInfo(wanted) == .Int) { | |
| 263 | @field(@field(arguments, decl.name), field.name) = val.getInt(wanted); | |
| 264 | return null; | |
| 265 | } | |
| 266 | }, | |
| 267 | .bytes => { | |
| 268 | const bytes = val.data.bytes.trim(1); // remove null terminator | |
| 269 | if (wanted == Value.ByteRange) { | |
| 270 | @field(@field(arguments, decl.name), field.name) = bytes; | |
| 271 | return null; | |
| 272 | } else if (@typeInfo(wanted) == .Enum and @hasDecl(wanted, "opts") and wanted.opts.enum_kind == .string) { | |
| 273 | const str = bytes.slice(strings); | |
| 274 | if (std.meta.stringToEnum(wanted, str)) |enum_val| { | |
| 275 | @field(@field(arguments, decl.name), field.name) = enum_val; | |
| 276 | return null; | |
| 277 | } else { | |
| 278 | @setEvalBranchQuota(3000); | |
| 279 | return Diagnostics.Message{ | |
| 280 | .tag = .unknown_attr_enum, | |
| 281 | .extra = .{ .attr_enum = .{ .tag = std.meta.stringToEnum(Tag, decl.name).? } }, | |
| 282 | }; | |
| 283 | } | |
| 284 | } | |
| 285 | }, | |
| 286 | else => { | |
| 287 | if (wanted == Identifier and node.tag == .decl_ref_expr) { | |
| 288 | @field(@field(arguments, decl.name), field.name) = Identifier{ .tok = node.data.decl_ref }; | |
| 289 | return null; | |
| 290 | } | |
| 291 | }, | |
| 292 | } | |
| 293 | return Diagnostics.Message{ | |
| 294 | .tag = .attribute_arg_invalid, | |
| 295 | .extra = .{ .attr_arg_type = .{ .expected = ArgumentType.fromType(wanted), .actual = ArgumentType.fromVal(val) } }, | |
| 296 | }; | |
| 297 | } | |
| 298 | ||
| 299 | pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, val: Value, node: Tree.Node, strings: []const u8) ?Diagnostics.Message { | |
| 300 | switch (attr) { | |
| 301 | inline else => |tag| { | |
| 302 | const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)]; | |
| 303 | const max_arg_count = comptime maxArgCount(tag); | |
| 304 | if (arg_idx >= max_arg_count) return Diagnostics.Message{ | |
| 305 | .tag = .attribute_too_many_args, | |
| 306 | .extra = .{ .attr_arg_count = .{ .attribute = attr, .expected = max_arg_count } }, | |
| 307 | }; | |
| 308 | const arg_fields = getArguments(@field(attributes, decl.name)); | |
| 309 | switch (arg_idx) { | |
| 310 | inline 0...arg_fields.len - 1 => |arg_i| { | |
| 311 | return diagnoseField(decl, arg_fields[arg_i], UnwrapOptional(arg_fields[arg_i].type), arguments, val, node, strings); | |
| 312 | }, | |
| 313 | else => unreachable, | |
| 314 | } | |
| 315 | }, | |
| 316 | } | |
| 317 | } | |
| 318 | ||
| 319 | const EnumTypes = enum { | |
| 320 | string, | |
| 321 | identifier, | |
| 322 | }; | |
| 323 | pub const Alignment = struct { | |
| 324 | node: NodeIndex = .none, | |
| 325 | requested: u29, | |
| 326 | }; | |
| 327 | pub const Identifier = struct { | |
| 328 | tok: TokenIndex = 0, | |
| 329 | }; | |
| 330 | ||
| 331 | const attributes = struct { | |
| 332 | pub const access = struct { | |
| 333 | const gnu = "access"; | |
| 334 | ||
| 335 | const Args = struct { | |
| 336 | access_mode: enum { | |
| 337 | read_only, | |
| 338 | read_write, | |
| 339 | write_only, | |
| 340 | none, | |
| 341 | ||
| 342 | const opts = struct { | |
| 343 | const enum_kind = .identifier; | |
| 344 | }; | |
| 345 | }, | |
| 346 | ref_index: u32, | |
| 347 | size_index: ?u32 = null, | |
| 348 | }; | |
| 349 | }; | |
| 350 | pub const alias = struct { | |
| 351 | const gnu = "alias"; | |
| 352 | const Args = struct { | |
| 353 | alias: Value.ByteRange, | |
| 354 | }; | |
| 355 | }; | |
| 356 | pub const aligned = struct { | |
| 357 | const gnu = "aligned"; | |
| 358 | const declspec = "align"; | |
| 359 | ||
| 360 | const Args = struct { | |
| 361 | alignment: ?Alignment = null, | |
| 362 | __name_tok: TokenIndex, | |
| 363 | }; | |
| 364 | }; | |
| 365 | pub const alloc_align = struct { | |
| 366 | const gnu = "alloc_align"; | |
| 367 | ||
| 368 | const Args = struct { | |
| 369 | position: u32, | |
| 370 | }; | |
| 371 | }; | |
| 372 | pub const alloc_size = struct { | |
| 373 | const gnu = "alloc_size"; | |
| 374 | ||
| 375 | const Args = struct { | |
| 376 | position_1: u32, | |
| 377 | position_2: ?u32 = null, | |
| 378 | }; | |
| 379 | }; | |
| 380 | pub const allocate = struct { | |
| 381 | const declspec = "allocate"; | |
| 382 | ||
| 383 | const Args = struct { | |
| 384 | segname: Value.ByteRange, | |
| 385 | }; | |
| 386 | }; | |
| 387 | pub const allocator = struct { | |
| 388 | const declspec = "allocator"; | |
| 389 | }; | |
| 390 | pub const always_inline = struct { | |
| 391 | const gnu = "always_inline"; | |
| 392 | }; | |
| 393 | pub const appdomain = struct { | |
| 394 | const declspec = "appdomain"; | |
| 395 | }; | |
| 396 | pub const artificial = struct { | |
| 397 | const gnu = "artificial"; | |
| 398 | }; | |
| 399 | pub const assume_aligned = struct { | |
| 400 | const gnu = "assume_aligned"; | |
| 401 | const Args = struct { | |
| 402 | alignment: Alignment, | |
| 403 | offset: ?u32 = null, | |
| 404 | }; | |
| 405 | }; | |
| 406 | pub const cleanup = struct { | |
| 407 | const gnu = "cleanup"; | |
| 408 | const Args = struct { | |
| 409 | function: Identifier, | |
| 410 | }; | |
| 411 | }; | |
| 412 | pub const code_seg = struct { | |
| 413 | const declspec = "code_seg"; | |
| 414 | const Args = struct { | |
| 415 | segname: Value.ByteRange, | |
| 416 | }; | |
| 417 | }; | |
| 418 | pub const cold = struct { | |
| 419 | const gnu = "cold"; | |
| 420 | }; | |
| 421 | pub const common = struct { | |
| 422 | const gnu = "common"; | |
| 423 | }; | |
| 424 | pub const @"const" = struct { | |
| 425 | const gnu = "const"; | |
| 426 | }; | |
| 427 | pub const constructor = struct { | |
| 428 | const gnu = "constructor"; | |
| 429 | const Args = struct { | |
| 430 | priority: ?u32 = null, | |
| 431 | }; | |
| 432 | }; | |
| 433 | pub const copy = struct { | |
| 434 | const gnu = "copy"; | |
| 435 | const Args = struct { | |
| 436 | function: Identifier, | |
| 437 | }; | |
| 438 | }; | |
| 439 | pub const deprecated = struct { | |
| 440 | const gnu = "deprecated"; | |
| 441 | const declspec = "deprecated"; | |
| 442 | const c2x = "deprecated"; | |
| 443 | ||
| 444 | const Args = struct { | |
| 445 | msg: ?Value.ByteRange = null, | |
| 446 | __name_tok: TokenIndex, | |
| 447 | }; | |
| 448 | }; | |
| 449 | pub const designated_init = struct { | |
| 450 | const gnu = "designated_init"; | |
| 451 | }; | |
| 452 | pub const destructor = struct { | |
| 453 | const gnu = "destructor"; | |
| 454 | const Args = struct { | |
| 455 | priority: ?u32 = null, | |
| 456 | }; | |
| 457 | }; | |
| 458 | pub const dllexport = struct { | |
| 459 | const declspec = "dllexport"; | |
| 460 | }; | |
| 461 | pub const dllimport = struct { | |
| 462 | const declspec = "dllimport"; | |
| 463 | }; | |
| 464 | pub const @"error" = struct { | |
| 465 | const gnu = "error"; | |
| 466 | const Args = struct { | |
| 467 | msg: Value.ByteRange, | |
| 468 | __name_tok: TokenIndex, | |
| 469 | }; | |
| 470 | }; | |
| 471 | pub const externally_visible = struct { | |
| 472 | const gnu = "externally_visible"; | |
| 473 | }; | |
| 474 | pub const fallthrough = struct { | |
| 475 | const gnu = "fallthrough"; | |
| 476 | const c2x = "fallthrough"; | |
| 477 | }; | |
| 478 | pub const flatten = struct { | |
| 479 | const gnu = "flatten"; | |
| 480 | }; | |
| 481 | pub const format = struct { | |
| 482 | const gnu = "format"; | |
| 483 | const Args = struct { | |
| 484 | archetype: enum { | |
| 485 | printf, | |
| 486 | scanf, | |
| 487 | strftime, | |
| 488 | strfmon, | |
| 489 | ||
| 490 | const opts = struct { | |
| 491 | const enum_kind = .identifier; | |
| 492 | }; | |
| 493 | }, | |
| 494 | string_index: u32, | |
| 495 | first_to_check: u32, | |
| 496 | }; | |
| 497 | }; | |
| 498 | pub const format_arg = struct { | |
| 499 | const gnu = "format_arg"; | |
| 500 | const Args = struct { | |
| 501 | string_index: u32, | |
| 502 | }; | |
| 503 | }; | |
| 504 | pub const gnu_inline = struct { | |
| 505 | const gnu = "gnu_inline"; | |
| 506 | }; | |
| 507 | pub const hot = struct { | |
| 508 | const gnu = "hot"; | |
| 509 | }; | |
| 510 | pub const ifunc = struct { | |
| 511 | const gnu = "ifunc"; | |
| 512 | const Args = struct { | |
| 513 | resolver: Value.ByteRange, | |
| 514 | }; | |
| 515 | }; | |
| 516 | pub const interrupt = struct { | |
| 517 | const gnu = "interrupt"; | |
| 518 | }; | |
| 519 | pub const interrupt_handler = struct { | |
| 520 | const gnu = "interrupt_handler"; | |
| 521 | }; | |
| 522 | pub const jitintrinsic = struct { | |
| 523 | const declspec = "jitintrinsic"; | |
| 524 | }; | |
| 525 | pub const leaf = struct { | |
| 526 | const gnu = "leaf"; | |
| 527 | }; | |
| 528 | pub const malloc = struct { | |
| 529 | const gnu = "malloc"; | |
| 530 | }; | |
| 531 | pub const may_alias = struct { | |
| 532 | const gnu = "may_alias"; | |
| 533 | }; | |
| 534 | pub const mode = struct { | |
| 535 | const gnu = "mode"; | |
| 536 | const Args = struct { | |
| 537 | mode: enum { | |
| 538 | // zig fmt: off | |
| 539 | byte, word, pointer, | |
| 540 | BI, QI, HI, | |
| 541 | PSI, SI, PDI, | |
| 542 | DI, TI, OI, | |
| 543 | XI, QF, HF, | |
| 544 | TQF, SF, DF, | |
| 545 | XF, SD, DD, | |
| 546 | TD, TF, QQ, | |
| 547 | HQ, SQ, DQ, | |
| 548 | TQ, UQQ, UHQ, | |
| 549 | USQ, UDQ, UTQ, | |
| 550 | HA, SA, DA, | |
| 551 | TA, UHA, USA, | |
| 552 | UDA, UTA, CC, | |
| 553 | BLK, VOID, QC, | |
| 554 | HC, SC, DC, | |
| 555 | XC, TC, CQI, | |
| 556 | CHI, CSI, CDI, | |
| 557 | CTI, COI, CPSI, | |
| 558 | BND32, BND64, | |
| 559 | // zig fmt: on | |
| 560 | ||
| 561 | const opts = struct { | |
| 562 | const enum_kind = .identifier; | |
| 563 | }; | |
| 564 | }, | |
| 565 | }; | |
| 566 | }; | |
| 567 | pub const naked = struct { | |
| 568 | const declspec = "naked"; | |
| 569 | }; | |
| 570 | pub const no_address_safety_analysis = struct { | |
| 571 | const gnu = "no_address_safety_analysise"; | |
| 572 | }; | |
| 573 | pub const no_icf = struct { | |
| 574 | const gnu = "no_icf"; | |
| 575 | }; | |
| 576 | pub const no_instrument_function = struct { | |
| 577 | const gnu = "no_instrument_function"; | |
| 578 | }; | |
| 579 | pub const no_profile_instrument_function = struct { | |
| 580 | const gnu = "no_profile_instrument_function"; | |
| 581 | }; | |
| 582 | pub const no_reorder = struct { | |
| 583 | const gnu = "no_reorder"; | |
| 584 | }; | |
| 585 | pub const no_sanitize = struct { | |
| 586 | const gnu = "no_sanitize"; | |
| 587 | /// Todo: represent args as union? | |
| 588 | const Args = struct { | |
| 589 | alignment: Value.ByteRange, | |
| 590 | object_size: ?Value.ByteRange = null, | |
| 591 | }; | |
| 592 | }; | |
| 593 | pub const no_sanitize_address = struct { | |
| 594 | const gnu = "no_sanitize_address"; | |
| 595 | const declspec = "no_sanitize_address"; | |
| 596 | }; | |
| 597 | pub const no_sanitize_coverage = struct { | |
| 598 | const gnu = "no_sanitize_coverage"; | |
| 599 | }; | |
| 600 | pub const no_sanitize_thread = struct { | |
| 601 | const gnu = "no_sanitize_thread"; | |
| 602 | }; | |
| 603 | pub const no_sanitize_undefined = struct { | |
| 604 | const gnu = "no_sanitize_undefined"; | |
| 605 | }; | |
| 606 | pub const no_split_stack = struct { | |
| 607 | const gnu = "no_split_stack"; | |
| 608 | }; | |
| 609 | pub const no_stack_limit = struct { | |
| 610 | const gnu = "no_stack_limit"; | |
| 611 | }; | |
| 612 | pub const no_stack_protector = struct { | |
| 613 | const gnu = "no_stack_protector"; | |
| 614 | }; | |
| 615 | pub const @"noalias" = struct { | |
| 616 | const declspec = "noalias"; | |
| 617 | }; | |
| 618 | pub const noclone = struct { | |
| 619 | const gnu = "noclone"; | |
| 620 | }; | |
| 621 | pub const nocommon = struct { | |
| 622 | const gnu = "nocommon"; | |
| 623 | }; | |
| 624 | pub const nodiscard = struct { | |
| 625 | const c2x = "nodiscard"; | |
| 626 | }; | |
| 627 | pub const noinit = struct { | |
| 628 | const gnu = "noinit"; | |
| 629 | }; | |
| 630 | pub const @"noinline" = struct { | |
| 631 | const gnu = "noinline"; | |
| 632 | const declspec = "noinline"; | |
| 633 | }; | |
| 634 | pub const noipa = struct { | |
| 635 | const gnu = "noipa"; | |
| 636 | }; | |
| 637 | // TODO: arbitrary number of arguments | |
| 638 | // const nonnull = struct { | |
| 639 | // const gnu = "nonnull"; | |
| 640 | // const Args = struct { | |
| 641 | // arg_index: []const u32, | |
| 642 | // }; | |
| 643 | // }; | |
| 644 | pub const nonstring = struct { | |
| 645 | const gnu = "nonstring"; | |
| 646 | }; | |
| 647 | pub const noplt = struct { | |
| 648 | const gnu = "noplt"; | |
| 649 | }; | |
| 650 | pub const @"noreturn" = struct { | |
| 651 | const gnu = "noreturn"; | |
| 652 | const c2x = "noreturn"; | |
| 653 | const declspec = "noreturn"; | |
| 654 | }; | |
| 655 | // TODO: union args ? | |
| 656 | // const optimize = struct { | |
| 657 | // const gnu = "optimize"; | |
| 658 | // const Args = struct { | |
| 659 | // optimize, // u32 | []const u8 -- optimize? | |
| 660 | // }; | |
| 661 | // }; | |
| 662 | pub const @"packed" = struct { | |
| 663 | const gnu = "packed"; | |
| 664 | }; | |
| 665 | pub const patchable_function_entry = struct { | |
| 666 | const gnu = "patchable_function_entry"; | |
| 667 | }; | |
| 668 | pub const persistent = struct { | |
| 669 | const gnu = "persistent"; | |
| 670 | }; | |
| 671 | pub const process = struct { | |
| 672 | const declspec = "process"; | |
| 673 | }; | |
| 674 | pub const pure = struct { | |
| 675 | const gnu = "pure"; | |
| 676 | }; | |
| 677 | pub const reproducible = struct { | |
| 678 | const c2x = "reproducible"; | |
| 679 | }; | |
| 680 | pub const restrict = struct { | |
| 681 | const declspec = "restrict"; | |
| 682 | }; | |
| 683 | pub const retain = struct { | |
| 684 | const gnu = "retain"; | |
| 685 | }; | |
| 686 | pub const returns_nonnull = struct { | |
| 687 | const gnu = "returns_nonnull"; | |
| 688 | }; | |
| 689 | pub const returns_twice = struct { | |
| 690 | const gnu = "returns_twice"; | |
| 691 | }; | |
| 692 | pub const safebuffers = struct { | |
| 693 | const declspec = "safebuffers"; | |
| 694 | }; | |
| 695 | pub const scalar_storage_order = struct { | |
| 696 | const gnu = "scalar_storage_order"; | |
| 697 | const Args = struct { | |
| 698 | order: enum { | |
| 699 | @"little-endian", | |
| 700 | @"big-endian", | |
| 701 | ||
| 702 | const opts = struct { | |
| 703 | const enum_kind = .string; | |
| 704 | }; | |
| 705 | }, | |
| 706 | }; | |
| 707 | }; | |
| 708 | pub const section = struct { | |
| 709 | const gnu = "section"; | |
| 710 | const Args = struct { | |
| 711 | name: Value.ByteRange, | |
| 712 | }; | |
| 713 | }; | |
| 714 | pub const selectany = struct { | |
| 715 | const declspec = "selectany"; | |
| 716 | }; | |
| 717 | pub const sentinel = struct { | |
| 718 | const gnu = "sentinel"; | |
| 719 | const Args = struct { | |
| 720 | position: ?u32 = null, | |
| 721 | }; | |
| 722 | }; | |
| 723 | pub const simd = struct { | |
| 724 | const gnu = "simd"; | |
| 725 | const Args = struct { | |
| 726 | mask: ?enum { | |
| 727 | notinbranch, | |
| 728 | inbranch, | |
| 729 | ||
| 730 | const opts = struct { | |
| 731 | const enum_kind = .string; | |
| 732 | }; | |
| 733 | } = null, | |
| 734 | }; | |
| 735 | }; | |
| 736 | pub const spectre = struct { | |
| 737 | const declspec = "spectre"; | |
| 738 | const Args = struct { | |
| 739 | arg: enum { | |
| 740 | nomitigation, | |
| 741 | ||
| 742 | const opts = struct { | |
| 743 | const enum_kind = .identifier; | |
| 744 | }; | |
| 745 | }, | |
| 746 | }; | |
| 747 | }; | |
| 748 | pub const stack_protect = struct { | |
| 749 | const gnu = "stack_protect"; | |
| 750 | }; | |
| 751 | pub const symver = struct { | |
| 752 | const gnu = "symver"; | |
| 753 | const Args = struct { | |
| 754 | version: Value.ByteRange, // TODO: validate format "name2@nodename" | |
| 755 | }; | |
| 756 | }; | |
| 757 | pub const target = struct { | |
| 758 | const gnu = "target"; | |
| 759 | const Args = struct { | |
| 760 | options: Value.ByteRange, // TODO: multiple arguments | |
| 761 | }; | |
| 762 | }; | |
| 763 | pub const target_clones = struct { | |
| 764 | const gnu = "target_clones"; | |
| 765 | const Args = struct { | |
| 766 | options: Value.ByteRange, // TODO: multiple arguments | |
| 767 | }; | |
| 768 | }; | |
| 769 | pub const thread = struct { | |
| 770 | const declspec = "thread"; | |
| 771 | }; | |
| 772 | pub const tls_model = struct { | |
| 773 | const gnu = "tls_model"; | |
| 774 | const Args = struct { | |
| 775 | model: enum { | |
| 776 | @"global-dynamic", | |
| 777 | @"local-dynamic", | |
| 778 | @"initial-exec", | |
| 779 | @"local-exec", | |
| 780 | ||
| 781 | const opts = struct { | |
| 782 | const enum_kind = .string; | |
| 783 | }; | |
| 784 | }, | |
| 785 | }; | |
| 786 | }; | |
| 787 | pub const transparent_union = struct { | |
| 788 | const gnu = "transparent_union"; | |
| 789 | }; | |
| 790 | pub const unavailable = struct { | |
| 791 | const gnu = "unavailable"; | |
| 792 | const Args = struct { | |
| 793 | msg: ?Value.ByteRange = null, | |
| 794 | __name_tok: TokenIndex, | |
| 795 | }; | |
| 796 | }; | |
| 797 | pub const uninitialized = struct { | |
| 798 | const gnu = "uninitialized"; | |
| 799 | }; | |
| 800 | pub const unsequenced = struct { | |
| 801 | const c2x = "unsequenced"; | |
| 802 | }; | |
| 803 | pub const unused = struct { | |
| 804 | const gnu = "unused"; | |
| 805 | const c2x = "maybe_unused"; | |
| 806 | }; | |
| 807 | pub const used = struct { | |
| 808 | const gnu = "used"; | |
| 809 | }; | |
| 810 | pub const uuid = struct { | |
| 811 | const declspec = "uuid"; | |
| 812 | const Args = struct { | |
| 813 | uuid: Value.ByteRange, | |
| 814 | }; | |
| 815 | }; | |
| 816 | pub const vector_size = struct { | |
| 817 | const gnu = "vector_size"; | |
| 818 | const Args = struct { | |
| 819 | bytes: u32, // TODO: validate "The bytes argument must be a positive power-of-two multiple of the base type size" | |
| 820 | }; | |
| 821 | }; | |
| 822 | pub const visibility = struct { | |
| 823 | const gnu = "visibility"; | |
| 824 | const Args = struct { | |
| 825 | visibility_type: enum { | |
| 826 | default, | |
| 827 | hidden, | |
| 828 | internal, | |
| 829 | protected, | |
| 830 | ||
| 831 | const opts = struct { | |
| 832 | const enum_kind = .string; | |
| 833 | }; | |
| 834 | }, | |
| 835 | }; | |
| 836 | }; | |
| 837 | pub const warn_if_not_aligned = struct { | |
| 838 | const gnu = "warn_if_not_aligned"; | |
| 839 | const Args = struct { | |
| 840 | alignment: Alignment, | |
| 841 | }; | |
| 842 | }; | |
| 843 | pub const warn_unused_result = struct { | |
| 844 | const gnu = "warn_unused_result"; | |
| 845 | }; | |
| 846 | pub const warning = struct { | |
| 847 | const gnu = "warning"; | |
| 848 | const Args = struct { | |
| 849 | msg: Value.ByteRange, | |
| 850 | __name_tok: TokenIndex, | |
| 851 | }; | |
| 852 | }; | |
| 853 | pub const weak = struct { | |
| 854 | const gnu = "weak"; | |
| 855 | }; | |
| 856 | pub const weakref = struct { | |
| 857 | const gnu = "weakref"; | |
| 858 | const Args = struct { | |
| 859 | target: ?Value.ByteRange = null, | |
| 860 | }; | |
| 861 | }; | |
| 862 | pub const zero_call_used_regs = struct { | |
| 863 | const gnu = "zero_call_used_regs"; | |
| 864 | const Args = struct { | |
| 865 | choice: enum { | |
| 866 | skip, | |
| 867 | used, | |
| 868 | @"used-gpr", | |
| 869 | @"used-arg", | |
| 870 | @"used-gpr-arg", | |
| 871 | all, | |
| 872 | @"all-gpr", | |
| 873 | @"all-arg", | |
| 874 | @"all-gpr-arg", | |
| 875 | ||
| 876 | const opts = struct { | |
| 877 | const enum_kind = .string; | |
| 878 | }; | |
| 879 | }, | |
| 880 | }; | |
| 881 | }; | |
| 882 | pub const asm_label = struct { | |
| 883 | const Args = struct { | |
| 884 | name: Value.ByteRange, | |
| 885 | }; | |
| 886 | }; | |
| 887 | pub const calling_convention = struct { | |
| 888 | const Args = struct { | |
| 889 | cc: CallingConvention, | |
| 890 | }; | |
| 891 | }; | |
| 892 | }; | |
| 893 | ||
| 894 | pub const Tag = std.meta.DeclEnum(attributes); | |
| 895 | ||
| 896 | pub const Arguments = blk: { | |
| 897 | const decls = @typeInfo(attributes).Struct.decls; | |
| 898 | var union_fields: [decls.len]ZigType.UnionField = undefined; | |
| 899 | inline for (decls, &union_fields) |decl, *field| { | |
| 900 | field.* = .{ | |
| 901 | .name = decl.name, | |
| 902 | .type = if (@hasDecl(@field(attributes, decl.name), "Args")) @field(attributes, decl.name).Args else void, | |
| 903 | .alignment = 0, | |
| 904 | }; | |
| 905 | } | |
| 906 | ||
| 907 | break :blk @Type(.{ | |
| 908 | .Union = .{ | |
| 909 | .layout = .Auto, | |
| 910 | .tag_type = null, | |
| 911 | .fields = &union_fields, | |
| 912 | .decls = &.{}, | |
| 913 | }, | |
| 914 | }); | |
| 915 | }; | |
| 916 | ||
| 917 | pub fn ArgumentsForTag(comptime tag: Tag) type { | |
| 918 | const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)]; | |
| 919 | return if (@hasDecl(@field(attributes, decl.name), "Args")) @field(attributes, decl.name).Args else void; | |
| 920 | } | |
| 921 | ||
| 922 | pub fn initArguments(tag: Tag, name_tok: TokenIndex) Arguments { | |
| 923 | switch (tag) { | |
| 924 | inline else => |arg_tag| { | |
| 925 | const union_element = @field(attributes, @tagName(arg_tag)); | |
| 926 | const has_args = @hasDecl(union_element, "Args"); | |
| 927 | const init = if (has_args) std.mem.zeroInit(union_element.Args, .{}) else {}; | |
| 928 | var args = @unionInit(Arguments, @tagName(arg_tag), init); | |
| 929 | if (has_args and @hasField(@field(attributes, @tagName(arg_tag)).Args, "__name_tok")) { | |
| 930 | @field(args, @tagName(arg_tag)).__name_tok = name_tok; | |
| 931 | } | |
| 932 | return args; | |
| 933 | }, | |
| 934 | } | |
| 935 | } | |
| 936 | ||
| 937 | pub fn fromString(kind: Kind, namespace: ?[]const u8, name: []const u8) ?Tag { | |
| 938 | return switch (kind) { | |
| 939 | .c2x => fromStringC2X(namespace, name), | |
| 940 | .declspec => fromStringDeclspec(name), | |
| 941 | .gnu => fromStringGnu(name), | |
| 942 | }; | |
| 943 | } | |
| 944 | ||
| 945 | fn fromStringGnu(name: []const u8) ?Tag { | |
| 946 | const normalized = normalize(name); | |
| 947 | const decls = @typeInfo(attributes).Struct.decls; | |
| 948 | @setEvalBranchQuota(3000); | |
| 949 | inline for (decls, 0..) |decl, i| { | |
| 950 | if (@hasDecl(@field(attributes, decl.name), "gnu")) { | |
| 951 | if (mem.eql(u8, @field(attributes, decl.name).gnu, normalized)) { | |
| 952 | return @enumFromInt(i); | |
| 953 | } | |
| 954 | } | |
| 955 | } | |
| 956 | return null; | |
| 957 | } | |
| 958 | ||
| 959 | fn fromStringC2X(namespace: ?[]const u8, name: []const u8) ?Tag { | |
| 960 | const normalized = normalize(name); | |
| 961 | if (namespace) |ns| { | |
| 962 | const normalized_ns = normalize(ns); | |
| 963 | if (mem.eql(u8, normalized_ns, "gnu")) { | |
| 964 | return fromStringGnu(normalized); | |
| 965 | } | |
| 966 | return null; | |
| 967 | } | |
| 968 | const decls = @typeInfo(attributes).Struct.decls; | |
| 969 | inline for (decls, 0..) |decl, i| { | |
| 970 | if (@hasDecl(@field(attributes, decl.name), "c2x")) { | |
| 971 | if (mem.eql(u8, @field(attributes, decl.name).c2x, normalized)) { | |
| 972 | return @enumFromInt(i); | |
| 973 | } | |
| 974 | } | |
| 975 | } | |
| 976 | return null; | |
| 977 | } | |
| 978 | ||
| 979 | fn fromStringDeclspec(name: []const u8) ?Tag { | |
| 980 | const decls = @typeInfo(attributes).Struct.decls; | |
| 981 | inline for (decls, 0..) |decl, i| { | |
| 982 | if (@hasDecl(@field(attributes, decl.name), "declspec")) { | |
| 983 | if (mem.eql(u8, @field(attributes, decl.name).declspec, name)) { | |
| 984 | return @enumFromInt(i); | |
| 985 | } | |
| 986 | } | |
| 987 | } | |
| 988 | return null; | |
| 989 | } | |
| 990 | ||
| 991 | fn normalize(name: []const u8) []const u8 { | |
| 992 | if (name.len >= 4 and mem.startsWith(u8, name, "__") and mem.endsWith(u8, name, "__")) { | |
| 993 | return name[2 .. name.len - 2]; | |
| 994 | } | |
| 995 | return name; | |
| 996 | } | |
| 997 | ||
| 998 | fn ignoredAttrErr(p: *Parser, tok: TokenIndex, attr: Attribute.Tag, context: []const u8) !void { | |
| 999 | const strings_top = p.strings.items.len; | |
| 1000 | defer p.strings.items.len = strings_top; | |
| 1001 | ||
| 1002 | try p.strings.writer().print("attribute '{s}' ignored on {s}", .{ @tagName(attr), context }); | |
| 1003 | const str = try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 1004 | try p.errStr(.ignored_attribute, tok, str); | |
| 1005 | } | |
| 1006 | ||
| 1007 | pub const applyParameterAttributes = applyVariableAttributes; | |
| 1008 | pub fn applyVariableAttributes(p: *Parser, ty: Type, attr_buf_start: usize, tag: ?Diagnostics.Tag) !Type { | |
| 1009 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1010 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1011 | p.attr_application_buf.items.len = 0; | |
| 1012 | var base_ty = ty; | |
| 1013 | if (base_ty.specifier == .attributed) base_ty = base_ty.data.attributed.base; | |
| 1014 | var common = false; | |
| 1015 | var nocommon = false; | |
| 1016 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1017 | // zig fmt: off | |
| 1018 | .alias, .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .weak, .used, | |
| 1019 | .noinit, .retain, .persistent, .section, .mode, .asm_label, | |
| 1020 | => try p.attr_application_buf.append(p.gpa, attr), | |
| 1021 | // zig fmt: on | |
| 1022 | .common => if (nocommon) { | |
| 1023 | try p.errTok(.ignore_common, tok); | |
| 1024 | } else { | |
| 1025 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1026 | common = true; | |
| 1027 | }, | |
| 1028 | .nocommon => if (common) { | |
| 1029 | try p.errTok(.ignore_nocommon, tok); | |
| 1030 | } else { | |
| 1031 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1032 | nocommon = true; | |
| 1033 | }, | |
| 1034 | .vector_size => try attr.applyVectorSize(p, tok, &base_ty), | |
| 1035 | .aligned => try attr.applyAligned(p, base_ty, tag), | |
| 1036 | .nonstring => if (!base_ty.isArray() or !(base_ty.is(.char) or base_ty.is(.uchar) or base_ty.is(.schar))) { | |
| 1037 | try p.errStr(.non_string_ignored, tok, try p.typeStr(ty)); | |
| 1038 | } else { | |
| 1039 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1040 | }, | |
| 1041 | .uninitialized => if (p.func.ty == null) { | |
| 1042 | try p.errStr(.local_variable_attribute, tok, "uninitialized"); | |
| 1043 | } else { | |
| 1044 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1045 | }, | |
| 1046 | .cleanup => if (p.func.ty == null) { | |
| 1047 | try p.errStr(.local_variable_attribute, tok, "cleanup"); | |
| 1048 | } else { | |
| 1049 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1050 | }, | |
| 1051 | .alloc_size, | |
| 1052 | .copy, | |
| 1053 | .tls_model, | |
| 1054 | .visibility, | |
| 1055 | => std.debug.panic("apply variable attribute {s}", .{@tagName(attr.tag)}), | |
| 1056 | else => try ignoredAttrErr(p, tok, attr.tag, "variables"), | |
| 1057 | }; | |
| 1058 | const existing = ty.getAttributes(); | |
| 1059 | if (existing.len == 0 and p.attr_application_buf.items.len == 0) return base_ty; | |
| 1060 | if (existing.len == 0) return base_ty.withAttributes(p.arena, p.attr_application_buf.items); | |
| 1061 | ||
| 1062 | const attributed_type = try Type.Attributed.create(p.arena, base_ty, existing, p.attr_application_buf.items); | |
| 1063 | return Type{ .specifier = .attributed, .data = .{ .attributed = attributed_type } }; | |
| 1064 | } | |
| 1065 | ||
| 1066 | pub fn applyFieldAttributes(p: *Parser, field_ty: *Type, attr_buf_start: usize) ![]const Attribute { | |
| 1067 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1068 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1069 | p.attr_application_buf.items.len = 0; | |
| 1070 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1071 | // zig fmt: off | |
| 1072 | .@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .mode, | |
| 1073 | => try p.attr_application_buf.append(p.gpa, attr), | |
| 1074 | // zig fmt: on | |
| 1075 | .vector_size => try attr.applyVectorSize(p, tok, field_ty), | |
| 1076 | .aligned => try attr.applyAligned(p, field_ty.*, null), | |
| 1077 | else => try ignoredAttrErr(p, tok, attr.tag, "fields"), | |
| 1078 | }; | |
| 1079 | if (p.attr_application_buf.items.len == 0) return &[0]Attribute{}; | |
| 1080 | return p.arena.dupe(Attribute, p.attr_application_buf.items); | |
| 1081 | } | |
| 1082 | ||
| 1083 | pub fn applyTypeAttributes(p: *Parser, ty: Type, attr_buf_start: usize, tag: ?Diagnostics.Tag) !Type { | |
| 1084 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1085 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1086 | p.attr_application_buf.items.len = 0; | |
| 1087 | var base_ty = ty; | |
| 1088 | if (base_ty.specifier == .attributed) base_ty = base_ty.data.attributed.base; | |
| 1089 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1090 | // zig fmt: off | |
| 1091 | .@"packed", .may_alias, .deprecated, .unavailable, .unused, .warn_if_not_aligned, .mode, | |
| 1092 | => try p.attr_application_buf.append(p.gpa, attr), | |
| 1093 | // zig fmt: on | |
| 1094 | .transparent_union => try attr.applyTransparentUnion(p, tok, base_ty), | |
| 1095 | .vector_size => try attr.applyVectorSize(p, tok, &base_ty), | |
| 1096 | .aligned => try attr.applyAligned(p, base_ty, tag), | |
| 1097 | .designated_init => if (base_ty.is(.@"struct")) { | |
| 1098 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1099 | } else { | |
| 1100 | try p.errTok(.designated_init_invalid, tok); | |
| 1101 | }, | |
| 1102 | .alloc_size, | |
| 1103 | .copy, | |
| 1104 | .scalar_storage_order, | |
| 1105 | .nonstring, | |
| 1106 | => std.debug.panic("apply type attribute {s}", .{@tagName(attr.tag)}), | |
| 1107 | else => try ignoredAttrErr(p, tok, attr.tag, "types"), | |
| 1108 | }; | |
| 1109 | ||
| 1110 | const existing = ty.getAttributes(); | |
| 1111 | // TODO: the alignment annotation on a type should override | |
| 1112 | // the decl it refers to. This might not be true for others. Maybe bug. | |
| 1113 | ||
| 1114 | // if there are annotations on this type def use those. | |
| 1115 | if (p.attr_application_buf.items.len > 0) { | |
| 1116 | return try base_ty.withAttributes(p.arena, p.attr_application_buf.items); | |
| 1117 | } else if (existing.len > 0) { | |
| 1118 | // else use the ones on the typedef decl we were refering to. | |
| 1119 | return try base_ty.withAttributes(p.arena, existing); | |
| 1120 | } | |
| 1121 | return base_ty; | |
| 1122 | } | |
| 1123 | ||
| 1124 | pub fn applyFunctionAttributes(p: *Parser, ty: Type, attr_buf_start: usize) !Type { | |
| 1125 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1126 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1127 | p.attr_application_buf.items.len = 0; | |
| 1128 | var base_ty = ty; | |
| 1129 | if (base_ty.specifier == .attributed) base_ty = base_ty.data.attributed.base; | |
| 1130 | var hot = false; | |
| 1131 | var cold = false; | |
| 1132 | var @"noinline" = false; | |
| 1133 | var always_inline = false; | |
| 1134 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1135 | // zig fmt: off | |
| 1136 | .noreturn, .unused, .used, .warning, .deprecated, .unavailable, .weak, .pure, .leaf, | |
| 1137 | .@"const", .warn_unused_result, .section, .returns_nonnull, .returns_twice, .@"error", | |
| 1138 | .externally_visible, .retain, .flatten, .gnu_inline, .alias, .asm_label, .nodiscard, | |
| 1139 | .reproducible, .unsequenced, | |
| 1140 | => try p.attr_application_buf.append(p.gpa, attr), | |
| 1141 | // zig fmt: on | |
| 1142 | .hot => if (cold) { | |
| 1143 | try p.errTok(.ignore_hot, tok); | |
| 1144 | } else { | |
| 1145 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1146 | hot = true; | |
| 1147 | }, | |
| 1148 | .cold => if (hot) { | |
| 1149 | try p.errTok(.ignore_cold, tok); | |
| 1150 | } else { | |
| 1151 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1152 | cold = true; | |
| 1153 | }, | |
| 1154 | .always_inline => if (@"noinline") { | |
| 1155 | try p.errTok(.ignore_always_inline, tok); | |
| 1156 | } else { | |
| 1157 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1158 | always_inline = true; | |
| 1159 | }, | |
| 1160 | .@"noinline" => if (always_inline) { | |
| 1161 | try p.errTok(.ignore_noinline, tok); | |
| 1162 | } else { | |
| 1163 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1164 | @"noinline" = true; | |
| 1165 | }, | |
| 1166 | .aligned => try attr.applyAligned(p, base_ty, null), | |
| 1167 | .format => try attr.applyFormat(p, base_ty), | |
| 1168 | .calling_convention => switch (attr.args.calling_convention.cc) { | |
| 1169 | .C => continue, | |
| 1170 | .stdcall, .thiscall => switch (p.comp.target.cpu.arch) { | |
| 1171 | .x86 => try p.attr_application_buf.append(p.gpa, attr), | |
| 1172 | else => try p.errStr(.callconv_not_supported, tok, p.tok_ids[tok].lexeme().?), | |
| 1173 | }, | |
| 1174 | .vectorcall => switch (p.comp.target.cpu.arch) { | |
| 1175 | .x86, .aarch64, .aarch64_be, .aarch64_32 => try p.attr_application_buf.append(p.gpa, attr), | |
| 1176 | else => try p.errStr(.callconv_not_supported, tok, p.tok_ids[tok].lexeme().?), | |
| 1177 | }, | |
| 1178 | }, | |
| 1179 | .access, | |
| 1180 | .alloc_align, | |
| 1181 | .alloc_size, | |
| 1182 | .artificial, | |
| 1183 | .assume_aligned, | |
| 1184 | .constructor, | |
| 1185 | .copy, | |
| 1186 | .destructor, | |
| 1187 | .format_arg, | |
| 1188 | .ifunc, | |
| 1189 | .interrupt, | |
| 1190 | .interrupt_handler, | |
| 1191 | .malloc, | |
| 1192 | .no_address_safety_analysis, | |
| 1193 | .no_icf, | |
| 1194 | .no_instrument_function, | |
| 1195 | .no_profile_instrument_function, | |
| 1196 | .no_reorder, | |
| 1197 | .no_sanitize, | |
| 1198 | .no_sanitize_address, | |
| 1199 | .no_sanitize_coverage, | |
| 1200 | .no_sanitize_thread, | |
| 1201 | .no_sanitize_undefined, | |
| 1202 | .no_split_stack, | |
| 1203 | .no_stack_limit, | |
| 1204 | .no_stack_protector, | |
| 1205 | .noclone, | |
| 1206 | .noipa, | |
| 1207 | // .nonnull, | |
| 1208 | .noplt, | |
| 1209 | // .optimize, | |
| 1210 | .patchable_function_entry, | |
| 1211 | .sentinel, | |
| 1212 | .simd, | |
| 1213 | .stack_protect, | |
| 1214 | .symver, | |
| 1215 | .target, | |
| 1216 | .target_clones, | |
| 1217 | .visibility, | |
| 1218 | .weakref, | |
| 1219 | .zero_call_used_regs, | |
| 1220 | => std.debug.panic("apply type attribute {s}", .{@tagName(attr.tag)}), | |
| 1221 | else => try ignoredAttrErr(p, tok, attr.tag, "functions"), | |
| 1222 | }; | |
| 1223 | return ty.withAttributes(p.arena, p.attr_application_buf.items); | |
| 1224 | } | |
| 1225 | ||
| 1226 | pub fn applyLabelAttributes(p: *Parser, ty: Type, attr_buf_start: usize) !Type { | |
| 1227 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1228 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1229 | p.attr_application_buf.items.len = 0; | |
| 1230 | var hot = false; | |
| 1231 | var cold = false; | |
| 1232 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1233 | .unused => try p.attr_application_buf.append(p.gpa, attr), | |
| 1234 | .hot => if (cold) { | |
| 1235 | try p.errTok(.ignore_hot, tok); | |
| 1236 | } else { | |
| 1237 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1238 | hot = true; | |
| 1239 | }, | |
| 1240 | .cold => if (hot) { | |
| 1241 | try p.errTok(.ignore_cold, tok); | |
| 1242 | } else { | |
| 1243 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1244 | cold = true; | |
| 1245 | }, | |
| 1246 | else => try ignoredAttrErr(p, tok, attr.tag, "labels"), | |
| 1247 | }; | |
| 1248 | return ty.withAttributes(p.arena, p.attr_application_buf.items); | |
| 1249 | } | |
| 1250 | ||
| 1251 | pub fn applyStatementAttributes(p: *Parser, ty: Type, expr_start: TokenIndex, attr_buf_start: usize) !Type { | |
| 1252 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1253 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1254 | p.attr_application_buf.items.len = 0; | |
| 1255 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1256 | .fallthrough => if (p.tok_ids[p.tok_i] != .keyword_case and p.tok_ids[p.tok_i] != .keyword_default) { | |
| 1257 | // TODO: this condition is not completely correct; the last statement of a compound | |
| 1258 | // statement is also valid if it precedes a switch label (so intervening '}' are ok, | |
| 1259 | // but only if they close a compound statement) | |
| 1260 | try p.errTok(.invalid_fallthrough, expr_start); | |
| 1261 | } else { | |
| 1262 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1263 | }, | |
| 1264 | else => try p.errStr(.cannot_apply_attribute_to_statement, tok, @tagName(attr.tag)), | |
| 1265 | }; | |
| 1266 | return ty.withAttributes(p.arena, p.attr_application_buf.items); | |
| 1267 | } | |
| 1268 | ||
| 1269 | pub fn applyEnumeratorAttributes(p: *Parser, ty: Type, attr_buf_start: usize) !Type { | |
| 1270 | const attrs = p.attr_buf.items(.attr)[attr_buf_start..]; | |
| 1271 | const toks = p.attr_buf.items(.tok)[attr_buf_start..]; | |
| 1272 | p.attr_application_buf.items.len = 0; | |
| 1273 | for (attrs, toks) |attr, tok| switch (attr.tag) { | |
| 1274 | .deprecated, .unavailable => try p.attr_application_buf.append(p.gpa, attr), | |
| 1275 | else => try ignoredAttrErr(p, tok, attr.tag, "enums"), | |
| 1276 | }; | |
| 1277 | return ty.withAttributes(p.arena, p.attr_application_buf.items); | |
| 1278 | } | |
| 1279 | ||
| 1280 | fn applyAligned(attr: Attribute, p: *Parser, ty: Type, tag: ?Diagnostics.Tag) !void { | |
| 1281 | const base = ty.canonicalize(.standard); | |
| 1282 | if (attr.args.aligned.alignment) |alignment| alignas: { | |
| 1283 | if (attr.syntax != .keyword) break :alignas; | |
| 1284 | ||
| 1285 | const align_tok = attr.args.aligned.__name_tok; | |
| 1286 | if (tag) |t| try p.errTok(t, align_tok); | |
| 1287 | ||
| 1288 | const default_align = base.alignof(p.comp); | |
| 1289 | if (ty.isFunc()) { | |
| 1290 | try p.errTok(.alignas_on_func, align_tok); | |
| 1291 | } else if (alignment.requested < default_align) { | |
| 1292 | try p.errExtra(.minimum_alignment, align_tok, .{ .unsigned = default_align }); | |
| 1293 | } | |
| 1294 | } | |
| 1295 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1296 | } | |
| 1297 | ||
| 1298 | fn applyTransparentUnion(attr: Attribute, p: *Parser, tok: TokenIndex, ty: Type) !void { | |
| 1299 | const union_ty = ty.get(.@"union") orelse { | |
| 1300 | return p.errTok(.transparent_union_wrong_type, tok); | |
| 1301 | }; | |
| 1302 | // TODO validate union defined at end | |
| 1303 | if (union_ty.data.record.isIncomplete()) return; | |
| 1304 | const fields = union_ty.data.record.fields; | |
| 1305 | if (fields.len == 0) { | |
| 1306 | return p.errTok(.transparent_union_one_field, tok); | |
| 1307 | } | |
| 1308 | const first_field_size = fields[0].ty.bitSizeof(p.comp).?; | |
| 1309 | for (fields[1..]) |field| { | |
| 1310 | const field_size = field.ty.bitSizeof(p.comp).?; | |
| 1311 | if (field_size == first_field_size) continue; | |
| 1312 | const mapper = p.comp.string_interner.getSlowTypeMapper(); | |
| 1313 | const str = try std.fmt.allocPrint(p.comp.diag.arena.allocator(), "'{s}' ({d}", .{ mapper.lookup(field.name), field_size }); | |
| 1314 | try p.errStr(.transparent_union_size, field.name_tok, str); | |
| 1315 | return p.errExtra(.transparent_union_size_note, fields[0].name_tok, .{ .unsigned = first_field_size }); | |
| 1316 | } | |
| 1317 | ||
| 1318 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1319 | } | |
| 1320 | ||
| 1321 | fn applyVectorSize(attr: Attribute, p: *Parser, tok: TokenIndex, ty: *Type) !void { | |
| 1322 | if (!(ty.isInt() or ty.isFloat()) or !ty.isReal()) { | |
| 1323 | const orig_ty = try p.typeStr(ty.*); | |
| 1324 | ty.* = Type.invalid; | |
| 1325 | return p.errStr(.invalid_vec_elem_ty, tok, orig_ty); | |
| 1326 | } | |
| 1327 | const vec_bytes = attr.args.vector_size.bytes; | |
| 1328 | const ty_size = ty.sizeof(p.comp).?; | |
| 1329 | if (vec_bytes % ty_size != 0) { | |
| 1330 | return p.errTok(.vec_size_not_multiple, tok); | |
| 1331 | } | |
| 1332 | const vec_size = vec_bytes / ty_size; | |
| 1333 | ||
| 1334 | const arr_ty = try p.arena.create(Type.Array); | |
| 1335 | arr_ty.* = .{ .elem = ty.*, .len = vec_size }; | |
| 1336 | ty.* = Type{ | |
| 1337 | .specifier = .vector, | |
| 1338 | .data = .{ .array = arr_ty }, | |
| 1339 | }; | |
| 1340 | } | |
| 1341 | ||
| 1342 | fn applyFormat(attr: Attribute, p: *Parser, ty: Type) !void { | |
| 1343 | // TODO validate | |
| 1344 | _ = ty; | |
| 1345 | try p.attr_application_buf.append(p.gpa, attr); | |
| 1346 | } |
deps/aro/Builtins.zig created+337| ... | ... | @@ -0,0 +1,337 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Compilation = @import("Compilation.zig"); | |
| 3 | const Type = @import("Type.zig"); | |
| 4 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 5 | const TypeDescription = @import("builtins/TypeDescription.zig"); | |
| 6 | const target_util = @import("target.zig"); | |
| 7 | const StringId = @import("StringInterner.zig").StringId; | |
| 8 | const LangOpts = @import("LangOpts.zig"); | |
| 9 | const Parser = @import("Parser.zig"); | |
| 10 | ||
| 11 | const Builtins = @This(); | |
| 12 | ||
| 13 | const Expanded = struct { | |
| 14 | ty: Type, | |
| 15 | builtin: BuiltinFunction, | |
| 16 | }; | |
| 17 | ||
| 18 | const NameToTypeMap = std.StringHashMapUnmanaged(Type); | |
| 19 | ||
| 20 | _name_to_type_map: NameToTypeMap = .{}, | |
| 21 | ||
| 22 | pub fn deinit(b: *Builtins, gpa: std.mem.Allocator) void { | |
| 23 | b._name_to_type_map.deinit(gpa); | |
| 24 | } | |
| 25 | ||
| 26 | fn specForSize(comp: *const Compilation, size_bits: u32) Type.Builder.Specifier { | |
| 27 | var ty = Type{ .specifier = .short }; | |
| 28 | if (ty.sizeof(comp).? * 8 == size_bits) return .short; | |
| 29 | ||
| 30 | ty.specifier = .int; | |
| 31 | if (ty.sizeof(comp).? * 8 == size_bits) return .int; | |
| 32 | ||
| 33 | ty.specifier = .long; | |
| 34 | if (ty.sizeof(comp).? * 8 == size_bits) return .long; | |
| 35 | ||
| 36 | ty.specifier = .long_long; | |
| 37 | if (ty.sizeof(comp).? * 8 == size_bits) return .long_long; | |
| 38 | ||
| 39 | unreachable; | |
| 40 | } | |
| 41 | ||
| 42 | fn createType(desc: TypeDescription, it: *TypeDescription.TypeIterator, comp: *const Compilation, allocator: std.mem.Allocator) !Type { | |
| 43 | var builder: Type.Builder = .{ .error_on_invalid = true }; | |
| 44 | var require_native_int32 = false; | |
| 45 | var require_native_int64 = false; | |
| 46 | for (desc.prefix) |prefix| { | |
| 47 | switch (prefix) { | |
| 48 | .L => builder.combine(undefined, .long, 0) catch unreachable, | |
| 49 | .LL => { | |
| 50 | builder.combine(undefined, .long, 0) catch unreachable; | |
| 51 | builder.combine(undefined, .long, 0) catch unreachable; | |
| 52 | }, | |
| 53 | .LLL => { | |
| 54 | switch (builder.specifier) { | |
| 55 | .none => builder.specifier = .int128, | |
| 56 | .signed => builder.specifier = .sint128, | |
| 57 | .unsigned => builder.specifier = .uint128, | |
| 58 | else => unreachable, | |
| 59 | } | |
| 60 | }, | |
| 61 | .Z => require_native_int32 = true, | |
| 62 | .W => require_native_int64 = true, | |
| 63 | .N => { | |
| 64 | std.debug.assert(desc.spec == .i); | |
| 65 | if (!target_util.isLP64(comp.target)) { | |
| 66 | builder.combine(undefined, .long, 0) catch unreachable; | |
| 67 | } | |
| 68 | }, | |
| 69 | .O => { | |
| 70 | builder.combine(undefined, .long, 0) catch unreachable; | |
| 71 | if (comp.target.os.tag != .opencl) { | |
| 72 | builder.combine(undefined, .long, 0) catch unreachable; | |
| 73 | } | |
| 74 | }, | |
| 75 | .S => builder.combine(undefined, .signed, 0) catch unreachable, | |
| 76 | .U => builder.combine(undefined, .unsigned, 0) catch unreachable, | |
| 77 | .I => { | |
| 78 | // Todo: compile-time constant integer | |
| 79 | }, | |
| 80 | } | |
| 81 | } | |
| 82 | switch (desc.spec) { | |
| 83 | .v => builder.combine(undefined, .void, 0) catch unreachable, | |
| 84 | .b => builder.combine(undefined, .bool, 0) catch unreachable, | |
| 85 | .c => builder.combine(undefined, .char, 0) catch unreachable, | |
| 86 | .s => builder.combine(undefined, .short, 0) catch unreachable, | |
| 87 | .i => { | |
| 88 | if (require_native_int32) { | |
| 89 | builder.specifier = specForSize(comp, 32); | |
| 90 | } else if (require_native_int64) { | |
| 91 | builder.specifier = specForSize(comp, 64); | |
| 92 | } else { | |
| 93 | switch (builder.specifier) { | |
| 94 | .int128, .sint128, .uint128 => {}, | |
| 95 | else => builder.combine(undefined, .int, 0) catch unreachable, | |
| 96 | } | |
| 97 | } | |
| 98 | }, | |
| 99 | .h => builder.combine(undefined, .fp16, 0) catch unreachable, | |
| 100 | .x => { | |
| 101 | // Todo: _Float16 | |
| 102 | return .{ .specifier = .invalid }; | |
| 103 | }, | |
| 104 | .y => { | |
| 105 | // Todo: __bf16 | |
| 106 | return .{ .specifier = .invalid }; | |
| 107 | }, | |
| 108 | .f => builder.combine(undefined, .float, 0) catch unreachable, | |
| 109 | .d => { | |
| 110 | if (builder.specifier == .long_long) { | |
| 111 | builder.specifier = .float128; | |
| 112 | } else { | |
| 113 | builder.combine(undefined, .double, 0) catch unreachable; | |
| 114 | } | |
| 115 | }, | |
| 116 | .z => { | |
| 117 | std.debug.assert(builder.specifier == .none); | |
| 118 | builder.specifier = Type.Builder.fromType(comp.types.size); | |
| 119 | }, | |
| 120 | .w => { | |
| 121 | std.debug.assert(builder.specifier == .none); | |
| 122 | builder.specifier = Type.Builder.fromType(comp.types.wchar); | |
| 123 | }, | |
| 124 | .F => { | |
| 125 | std.debug.assert(builder.specifier == .none); | |
| 126 | builder.specifier = Type.Builder.fromType(comp.types.ns_constant_string.ty); | |
| 127 | }, | |
| 128 | .a => { | |
| 129 | std.debug.assert(builder.specifier == .none); | |
| 130 | std.debug.assert(desc.suffix.len == 0); | |
| 131 | builder.specifier = Type.Builder.fromType(comp.types.va_list); | |
| 132 | }, | |
| 133 | .A => { | |
| 134 | std.debug.assert(builder.specifier == .none); | |
| 135 | std.debug.assert(desc.suffix.len == 0); | |
| 136 | var va_list = comp.types.va_list; | |
| 137 | if (va_list.isArray()) va_list.decayArray(); | |
| 138 | builder.specifier = Type.Builder.fromType(va_list); | |
| 139 | }, | |
| 140 | .V => |element_count| { | |
| 141 | std.debug.assert(desc.suffix.len == 0); | |
| 142 | const child_desc = it.next().?; | |
| 143 | const child_ty = try createType(child_desc, undefined, comp, allocator); | |
| 144 | const arr_ty = try allocator.create(Type.Array); | |
| 145 | arr_ty.* = .{ | |
| 146 | .len = element_count, | |
| 147 | .elem = child_ty, | |
| 148 | }; | |
| 149 | const vector_ty = .{ .specifier = .vector, .data = .{ .array = arr_ty } }; | |
| 150 | builder.specifier = Type.Builder.fromType(vector_ty); | |
| 151 | }, | |
| 152 | .q => { | |
| 153 | // Todo: scalable vector | |
| 154 | return .{ .specifier = .invalid }; | |
| 155 | }, | |
| 156 | .E => { | |
| 157 | // Todo: ext_vector (OpenCL vector) | |
| 158 | return .{ .specifier = .invalid }; | |
| 159 | }, | |
| 160 | .X => |child| { | |
| 161 | builder.combine(undefined, .complex, 0) catch unreachable; | |
| 162 | switch (child) { | |
| 163 | .float => builder.combine(undefined, .float, 0) catch unreachable, | |
| 164 | .double => builder.combine(undefined, .double, 0) catch unreachable, | |
| 165 | .longdouble => { | |
| 166 | builder.combine(undefined, .long, 0) catch unreachable; | |
| 167 | builder.combine(undefined, .double, 0) catch unreachable; | |
| 168 | }, | |
| 169 | } | |
| 170 | }, | |
| 171 | .Y => { | |
| 172 | std.debug.assert(builder.specifier == .none); | |
| 173 | std.debug.assert(desc.suffix.len == 0); | |
| 174 | builder.specifier = Type.Builder.fromType(comp.types.ptrdiff); | |
| 175 | }, | |
| 176 | .P => { | |
| 177 | std.debug.assert(builder.specifier == .none); | |
| 178 | if (comp.types.file.specifier == .invalid) { | |
| 179 | return comp.types.file; | |
| 180 | } | |
| 181 | builder.specifier = Type.Builder.fromType(comp.types.file); | |
| 182 | }, | |
| 183 | .J => { | |
| 184 | std.debug.assert(builder.specifier == .none); | |
| 185 | std.debug.assert(desc.suffix.len == 0); | |
| 186 | if (comp.types.jmp_buf.specifier == .invalid) { | |
| 187 | return comp.types.jmp_buf; | |
| 188 | } | |
| 189 | builder.specifier = Type.Builder.fromType(comp.types.jmp_buf); | |
| 190 | }, | |
| 191 | .SJ => { | |
| 192 | std.debug.assert(builder.specifier == .none); | |
| 193 | std.debug.assert(desc.suffix.len == 0); | |
| 194 | if (comp.types.sigjmp_buf.specifier == .invalid) { | |
| 195 | return comp.types.sigjmp_buf; | |
| 196 | } | |
| 197 | builder.specifier = Type.Builder.fromType(comp.types.sigjmp_buf); | |
| 198 | }, | |
| 199 | .K => { | |
| 200 | std.debug.assert(builder.specifier == .none); | |
| 201 | if (comp.types.ucontext_t.specifier == .invalid) { | |
| 202 | return comp.types.ucontext_t; | |
| 203 | } | |
| 204 | builder.specifier = Type.Builder.fromType(comp.types.ucontext_t); | |
| 205 | }, | |
| 206 | .p => { | |
| 207 | std.debug.assert(builder.specifier == .none); | |
| 208 | std.debug.assert(desc.suffix.len == 0); | |
| 209 | builder.specifier = Type.Builder.fromType(comp.types.pid_t); | |
| 210 | }, | |
| 211 | .@"!" => return .{ .specifier = .invalid }, | |
| 212 | } | |
| 213 | for (desc.suffix) |suffix| { | |
| 214 | switch (suffix) { | |
| 215 | .@"*" => |address_space| { | |
| 216 | _ = address_space; // TODO: handle address space | |
| 217 | const elem_ty = try allocator.create(Type); | |
| 218 | elem_ty.* = builder.finish(undefined) catch unreachable; | |
| 219 | const ty = Type{ | |
| 220 | .specifier = .pointer, | |
| 221 | .data = .{ .sub_type = elem_ty }, | |
| 222 | }; | |
| 223 | builder.qual = .{}; | |
| 224 | builder.specifier = Type.Builder.fromType(ty); | |
| 225 | }, | |
| 226 | .C => builder.qual.@"const" = 0, | |
| 227 | .D => builder.qual.@"volatile" = 0, | |
| 228 | .R => builder.qual.restrict = 0, | |
| 229 | } | |
| 230 | } | |
| 231 | return builder.finish(undefined) catch unreachable; | |
| 232 | } | |
| 233 | ||
| 234 | fn createBuiltin(comp: *const Compilation, builtin: BuiltinFunction, type_arena: std.mem.Allocator) !Type { | |
| 235 | var it = TypeDescription.TypeIterator.init(builtin.param_str); | |
| 236 | ||
| 237 | const ret_ty_desc = it.next().?; | |
| 238 | if (ret_ty_desc.spec == .@"!") { | |
| 239 | // Todo: handle target-dependent definition | |
| 240 | } | |
| 241 | const ret_ty = try createType(ret_ty_desc, &it, comp, type_arena); | |
| 242 | var param_count: usize = 0; | |
| 243 | var params: [BuiltinFunction.MaxParamCount]Type.Func.Param = undefined; | |
| 244 | while (it.next()) |desc| : (param_count += 1) { | |
| 245 | params[param_count] = .{ .name_tok = 0, .ty = try createType(desc, &it, comp, type_arena), .name = .empty }; | |
| 246 | } | |
| 247 | ||
| 248 | const duped_params = try type_arena.dupe(Type.Func.Param, params[0..param_count]); | |
| 249 | const func = try type_arena.create(Type.Func); | |
| 250 | ||
| 251 | func.* = .{ | |
| 252 | .return_type = ret_ty, | |
| 253 | .params = duped_params, | |
| 254 | }; | |
| 255 | return .{ | |
| 256 | .specifier = if (builtin.isVarArgs()) .var_args_func else .func, | |
| 257 | .data = .{ .func = func }, | |
| 258 | }; | |
| 259 | } | |
| 260 | ||
| 261 | /// Asserts that the builtin has already been created | |
| 262 | pub fn lookup(b: *const Builtins, name: []const u8) Expanded { | |
| 263 | @setEvalBranchQuota(10_000); | |
| 264 | const builtin = BuiltinFunction.fromTag(std.meta.stringToEnum(BuiltinFunction.Tag, name).?); | |
| 265 | const ty = b._name_to_type_map.get(name).?; | |
| 266 | return .{ | |
| 267 | .builtin = builtin, | |
| 268 | .ty = ty, | |
| 269 | }; | |
| 270 | } | |
| 271 | ||
| 272 | pub fn getOrCreate(b: *Builtins, comp: *Compilation, name: []const u8, type_arena: std.mem.Allocator) !?Expanded { | |
| 273 | const ty = b._name_to_type_map.get(name) orelse { | |
| 274 | @setEvalBranchQuota(10_000); | |
| 275 | const tag = std.meta.stringToEnum(BuiltinFunction.Tag, name) orelse return null; | |
| 276 | const builtin = BuiltinFunction.fromTag(tag); | |
| 277 | if (!comp.hasBuiltinFunction(builtin)) return null; | |
| 278 | ||
| 279 | try b._name_to_type_map.ensureUnusedCapacity(comp.gpa, 1); | |
| 280 | const ty = try createBuiltin(comp, builtin, type_arena); | |
| 281 | b._name_to_type_map.putAssumeCapacity(name, ty); | |
| 282 | ||
| 283 | return .{ | |
| 284 | .builtin = builtin, | |
| 285 | .ty = ty, | |
| 286 | }; | |
| 287 | }; | |
| 288 | const builtin = BuiltinFunction.fromTag(std.meta.stringToEnum(BuiltinFunction.Tag, name).?); | |
| 289 | return .{ | |
| 290 | .builtin = builtin, | |
| 291 | .ty = ty, | |
| 292 | }; | |
| 293 | } | |
| 294 | ||
| 295 | test "All builtins" { | |
| 296 | var comp = Compilation.init(std.testing.allocator); | |
| 297 | defer comp.deinit(); | |
| 298 | _ = try comp.generateBuiltinMacros(); | |
| 299 | var arena = std.heap.ArenaAllocator.init(std.testing.allocator); | |
| 300 | defer arena.deinit(); | |
| 301 | ||
| 302 | const type_arena = arena.allocator(); | |
| 303 | ||
| 304 | for (0..@typeInfo(BuiltinFunction.Tag).Enum.fields.len) |i| { | |
| 305 | const tag: BuiltinFunction.Tag = @enumFromInt(i); | |
| 306 | const name = @tagName(tag); | |
| 307 | if (try comp.builtins.getOrCreate(&comp, name, type_arena)) |func_ty| { | |
| 308 | const get_again = (try comp.builtins.getOrCreate(&comp, name, std.testing.failing_allocator)).?; | |
| 309 | const found_by_lookup = comp.builtins.lookup(name); | |
| 310 | try std.testing.expectEqual(func_ty.builtin.tag, get_again.builtin.tag); | |
| 311 | try std.testing.expectEqual(func_ty.builtin.tag, found_by_lookup.builtin.tag); | |
| 312 | } | |
| 313 | } | |
| 314 | } | |
| 315 | ||
| 316 | test "Allocation failures" { | |
| 317 | const Test = struct { | |
| 318 | fn testOne(allocator: std.mem.Allocator) !void { | |
| 319 | var comp = Compilation.init(allocator); | |
| 320 | defer comp.deinit(); | |
| 321 | _ = try comp.generateBuiltinMacros(); | |
| 322 | var arena = std.heap.ArenaAllocator.init(comp.gpa); | |
| 323 | defer arena.deinit(); | |
| 324 | ||
| 325 | const type_arena = arena.allocator(); | |
| 326 | ||
| 327 | const num_builtins = 40; | |
| 328 | for (0..num_builtins) |i| { | |
| 329 | const tag: BuiltinFunction.Tag = @enumFromInt(i); | |
| 330 | const name = @tagName(tag); | |
| 331 | _ = try comp.builtins.getOrCreate(&comp, name, type_arena); | |
| 332 | } | |
| 333 | } | |
| 334 | }; | |
| 335 | ||
| 336 | try std.testing.checkAllAllocationFailures(std.testing.allocator, Test.testOne, .{}); | |
| 337 | } |
deps/aro/CharInfo.zig created+487| ... | ... | @@ -0,0 +1,487 @@ |
| 1 | //! This module provides functions for classifying characters according to | |
| 2 | //! various C standards. All classification routines *do not* consider | |
| 3 | //! characters from the basic character set; it is assumed those will be | |
| 4 | //! checked separately | |
| 5 | ||
| 6 | const assert = @import("std").debug.assert; | |
| 7 | ||
| 8 | /// C11 Standard Annex D | |
| 9 | pub fn isC11IdChar(codepoint: u21) bool { | |
| 10 | assert(codepoint > 0x7F); | |
| 11 | return switch (codepoint) { | |
| 12 | // 1 | |
| 13 | 0x00A8, | |
| 14 | 0x00AA, | |
| 15 | 0x00AD, | |
| 16 | 0x00AF, | |
| 17 | 0x00B2...0x00B5, | |
| 18 | 0x00B7...0x00BA, | |
| 19 | 0x00BC...0x00BE, | |
| 20 | 0x00C0...0x00D6, | |
| 21 | 0x00D8...0x00F6, | |
| 22 | 0x00F8...0x00FF, | |
| 23 | ||
| 24 | // 2 | |
| 25 | 0x0100...0x167F, | |
| 26 | 0x1681...0x180D, | |
| 27 | 0x180F...0x1FFF, | |
| 28 | ||
| 29 | // 3 | |
| 30 | 0x200B...0x200D, | |
| 31 | 0x202A...0x202E, | |
| 32 | 0x203F...0x2040, | |
| 33 | 0x2054, | |
| 34 | 0x2060...0x206F, | |
| 35 | ||
| 36 | // 4 | |
| 37 | 0x2070...0x218F, | |
| 38 | 0x2460...0x24FF, | |
| 39 | 0x2776...0x2793, | |
| 40 | 0x2C00...0x2DFF, | |
| 41 | 0x2E80...0x2FFF, | |
| 42 | ||
| 43 | // 5 | |
| 44 | 0x3004...0x3007, | |
| 45 | 0x3021...0x302F, | |
| 46 | 0x3031...0x303F, | |
| 47 | ||
| 48 | // 6 | |
| 49 | 0x3040...0xD7FF, | |
| 50 | ||
| 51 | // 7 | |
| 52 | 0xF900...0xFD3D, | |
| 53 | 0xFD40...0xFDCF, | |
| 54 | 0xFDF0...0xFE44, | |
| 55 | 0xFE47...0xFFFD, | |
| 56 | ||
| 57 | // 8 | |
| 58 | 0x10000...0x1FFFD, | |
| 59 | 0x20000...0x2FFFD, | |
| 60 | 0x30000...0x3FFFD, | |
| 61 | 0x40000...0x4FFFD, | |
| 62 | 0x50000...0x5FFFD, | |
| 63 | 0x60000...0x6FFFD, | |
| 64 | 0x70000...0x7FFFD, | |
| 65 | 0x80000...0x8FFFD, | |
| 66 | 0x90000...0x9FFFD, | |
| 67 | 0xA0000...0xAFFFD, | |
| 68 | 0xB0000...0xBFFFD, | |
| 69 | 0xC0000...0xCFFFD, | |
| 70 | 0xD0000...0xDFFFD, | |
| 71 | 0xE0000...0xEFFFD, | |
| 72 | => true, | |
| 73 | else => false, | |
| 74 | }; | |
| 75 | } | |
| 76 | ||
| 77 | /// C99 Standard Annex D | |
| 78 | pub fn isC99IdChar(codepoint: u21) bool { | |
| 79 | assert(codepoint > 0x7F); | |
| 80 | return switch (codepoint) { | |
| 81 | // Latin | |
| 82 | 0x00AA, | |
| 83 | 0x00BA, | |
| 84 | 0x00C0...0x00D6, | |
| 85 | 0x00D8...0x00F6, | |
| 86 | 0x00F8...0x01F5, | |
| 87 | 0x01FA...0x0217, | |
| 88 | 0x0250...0x02A8, | |
| 89 | 0x1E00...0x1E9B, | |
| 90 | 0x1EA0...0x1EF9, | |
| 91 | 0x207F, | |
| 92 | ||
| 93 | // Greek | |
| 94 | 0x0386, | |
| 95 | 0x0388...0x038A, | |
| 96 | 0x038C, | |
| 97 | 0x038E...0x03A1, | |
| 98 | 0x03A3...0x03CE, | |
| 99 | 0x03D0...0x03D6, | |
| 100 | 0x03DA, | |
| 101 | 0x03DC, | |
| 102 | 0x03DE, | |
| 103 | 0x03E0, | |
| 104 | 0x03E2...0x03F3, | |
| 105 | 0x1F00...0x1F15, | |
| 106 | 0x1F18...0x1F1D, | |
| 107 | 0x1F20...0x1F45, | |
| 108 | 0x1F48...0x1F4D, | |
| 109 | 0x1F50...0x1F57, | |
| 110 | 0x1F59, | |
| 111 | 0x1F5B, | |
| 112 | 0x1F5D, | |
| 113 | 0x1F5F...0x1F7D, | |
| 114 | 0x1F80...0x1FB4, | |
| 115 | 0x1FB6...0x1FBC, | |
| 116 | 0x1FC2...0x1FC4, | |
| 117 | 0x1FC6...0x1FCC, | |
| 118 | 0x1FD0...0x1FD3, | |
| 119 | 0x1FD6...0x1FDB, | |
| 120 | 0x1FE0...0x1FEC, | |
| 121 | 0x1FF2...0x1FF4, | |
| 122 | 0x1FF6...0x1FFC, | |
| 123 | ||
| 124 | // Cyrillic | |
| 125 | 0x0401...0x040C, | |
| 126 | 0x040E...0x044F, | |
| 127 | 0x0451...0x045C, | |
| 128 | 0x045E...0x0481, | |
| 129 | 0x0490...0x04C4, | |
| 130 | 0x04C7...0x04C8, | |
| 131 | 0x04CB...0x04CC, | |
| 132 | 0x04D0...0x04EB, | |
| 133 | 0x04EE...0x04F5, | |
| 134 | 0x04F8...0x04F9, | |
| 135 | ||
| 136 | // Armenian | |
| 137 | 0x0531...0x0556, | |
| 138 | 0x0561...0x0587, | |
| 139 | ||
| 140 | // Hebrew | |
| 141 | 0x05B0...0x05B9, | |
| 142 | 0x05BB...0x05BD, | |
| 143 | 0x05BF, | |
| 144 | 0x05C1...0x05C2, | |
| 145 | 0x05D0...0x05EA, | |
| 146 | 0x05F0...0x05F2, | |
| 147 | ||
| 148 | // Arabic | |
| 149 | 0x0621...0x063A, | |
| 150 | 0x0640...0x0652, | |
| 151 | 0x0670...0x06B7, | |
| 152 | 0x06BA...0x06BE, | |
| 153 | 0x06C0...0x06CE, | |
| 154 | 0x06D0...0x06DC, | |
| 155 | 0x06E5...0x06E8, | |
| 156 | 0x06EA...0x06ED, | |
| 157 | ||
| 158 | // Devanagari | |
| 159 | 0x0901...0x0903, | |
| 160 | 0x0905...0x0939, | |
| 161 | 0x093E...0x094D, | |
| 162 | 0x0950...0x0952, | |
| 163 | 0x0958...0x0963, | |
| 164 | ||
| 165 | // Bengali | |
| 166 | 0x0981...0x0983, | |
| 167 | 0x0985...0x098C, | |
| 168 | 0x098F...0x0990, | |
| 169 | 0x0993...0x09A8, | |
| 170 | 0x09AA...0x09B0, | |
| 171 | 0x09B2, | |
| 172 | 0x09B6...0x09B9, | |
| 173 | 0x09BE...0x09C4, | |
| 174 | 0x09C7...0x09C8, | |
| 175 | 0x09CB...0x09CD, | |
| 176 | 0x09DC...0x09DD, | |
| 177 | 0x09DF...0x09E3, | |
| 178 | 0x09F0...0x09F1, | |
| 179 | ||
| 180 | // Gurmukhi | |
| 181 | 0x0A02, | |
| 182 | 0x0A05...0x0A0A, | |
| 183 | 0x0A0F...0x0A10, | |
| 184 | 0x0A13...0x0A28, | |
| 185 | 0x0A2A...0x0A30, | |
| 186 | 0x0A32...0x0A33, | |
| 187 | 0x0A35...0x0A36, | |
| 188 | 0x0A38...0x0A39, | |
| 189 | 0x0A3E...0x0A42, | |
| 190 | 0x0A47...0x0A48, | |
| 191 | 0x0A4B...0x0A4D, | |
| 192 | 0x0A59...0x0A5C, | |
| 193 | 0x0A5E, | |
| 194 | 0x0A74, | |
| 195 | ||
| 196 | // Gujarati | |
| 197 | 0x0A81...0x0A83, | |
| 198 | 0x0A85...0x0A8B, | |
| 199 | 0x0A8D, | |
| 200 | 0x0A8F...0x0A91, | |
| 201 | 0x0A93...0x0AA8, | |
| 202 | 0x0AAA...0x0AB0, | |
| 203 | 0x0AB2...0x0AB3, | |
| 204 | 0x0AB5...0x0AB9, | |
| 205 | 0x0ABD...0x0AC5, | |
| 206 | 0x0AC7...0x0AC9, | |
| 207 | 0x0ACB...0x0ACD, | |
| 208 | 0x0AD0, | |
| 209 | 0x0AE0, | |
| 210 | ||
| 211 | // Oriya | |
| 212 | 0x0B01...0x0B03, | |
| 213 | 0x0B05...0x0B0C, | |
| 214 | 0x0B0F...0x0B10, | |
| 215 | 0x0B13...0x0B28, | |
| 216 | 0x0B2A...0x0B30, | |
| 217 | 0x0B32...0x0B33, | |
| 218 | 0x0B36...0x0B39, | |
| 219 | 0x0B3E...0x0B43, | |
| 220 | 0x0B47...0x0B48, | |
| 221 | 0x0B4B...0x0B4D, | |
| 222 | 0x0B5C...0x0B5D, | |
| 223 | 0x0B5F...0x0B61, | |
| 224 | ||
| 225 | // Tamil | |
| 226 | 0x0B82...0x0B83, | |
| 227 | 0x0B85...0x0B8A, | |
| 228 | 0x0B8E...0x0B90, | |
| 229 | 0x0B92...0x0B95, | |
| 230 | 0x0B99...0x0B9A, | |
| 231 | 0x0B9C, | |
| 232 | 0x0B9E...0x0B9F, | |
| 233 | 0x0BA3...0x0BA4, | |
| 234 | 0x0BA8...0x0BAA, | |
| 235 | 0x0BAE...0x0BB5, | |
| 236 | 0x0BB7...0x0BB9, | |
| 237 | 0x0BBE...0x0BC2, | |
| 238 | 0x0BC6...0x0BC8, | |
| 239 | 0x0BCA...0x0BCD, | |
| 240 | ||
| 241 | // Telugu | |
| 242 | 0x0C01...0x0C03, | |
| 243 | 0x0C05...0x0C0C, | |
| 244 | 0x0C0E...0x0C10, | |
| 245 | 0x0C12...0x0C28, | |
| 246 | 0x0C2A...0x0C33, | |
| 247 | 0x0C35...0x0C39, | |
| 248 | 0x0C3E...0x0C44, | |
| 249 | 0x0C46...0x0C48, | |
| 250 | 0x0C4A...0x0C4D, | |
| 251 | 0x0C60...0x0C61, | |
| 252 | ||
| 253 | // Kannada | |
| 254 | 0x0C82...0x0C83, | |
| 255 | 0x0C85...0x0C8C, | |
| 256 | 0x0C8E...0x0C90, | |
| 257 | 0x0C92...0x0CA8, | |
| 258 | 0x0CAA...0x0CB3, | |
| 259 | 0x0CB5...0x0CB9, | |
| 260 | 0x0CBE...0x0CC4, | |
| 261 | 0x0CC6...0x0CC8, | |
| 262 | 0x0CCA...0x0CCD, | |
| 263 | 0x0CDE, | |
| 264 | 0x0CE0...0x0CE1, | |
| 265 | ||
| 266 | // Malayalam | |
| 267 | 0x0D02...0x0D03, | |
| 268 | 0x0D05...0x0D0C, | |
| 269 | 0x0D0E...0x0D10, | |
| 270 | 0x0D12...0x0D28, | |
| 271 | 0x0D2A...0x0D39, | |
| 272 | 0x0D3E...0x0D43, | |
| 273 | 0x0D46...0x0D48, | |
| 274 | 0x0D4A...0x0D4D, | |
| 275 | 0x0D60...0x0D61, | |
| 276 | ||
| 277 | // Thai (excluding digits 0x0E50...0x0E59; originally 0x0E01...0x0E3A and 0x0E40...0x0E5B | |
| 278 | 0x0E01...0x0E3A, | |
| 279 | 0x0E40...0x0E4F, | |
| 280 | 0x0E5A...0x0E5B, | |
| 281 | ||
| 282 | // Lao | |
| 283 | 0x0E81...0x0E82, | |
| 284 | 0x0E84, | |
| 285 | 0x0E87...0x0E88, | |
| 286 | 0x0E8A, | |
| 287 | 0x0E8D, | |
| 288 | 0x0E94...0x0E97, | |
| 289 | 0x0E99...0x0E9F, | |
| 290 | 0x0EA1...0x0EA3, | |
| 291 | 0x0EA5, | |
| 292 | 0x0EA7, | |
| 293 | 0x0EAA...0x0EAB, | |
| 294 | 0x0EAD...0x0EAE, | |
| 295 | 0x0EB0...0x0EB9, | |
| 296 | 0x0EBB...0x0EBD, | |
| 297 | 0x0EC0...0x0EC4, | |
| 298 | 0x0EC6, | |
| 299 | 0x0EC8...0x0ECD, | |
| 300 | 0x0EDC...0x0EDD, | |
| 301 | ||
| 302 | // Tibetan | |
| 303 | 0x0F00, | |
| 304 | 0x0F18...0x0F19, | |
| 305 | 0x0F35, | |
| 306 | 0x0F37, | |
| 307 | 0x0F39, | |
| 308 | 0x0F3E...0x0F47, | |
| 309 | 0x0F49...0x0F69, | |
| 310 | 0x0F71...0x0F84, | |
| 311 | 0x0F86...0x0F8B, | |
| 312 | 0x0F90...0x0F95, | |
| 313 | 0x0F97, | |
| 314 | 0x0F99...0x0FAD, | |
| 315 | 0x0FB1...0x0FB7, | |
| 316 | 0x0FB9, | |
| 317 | ||
| 318 | // Georgian | |
| 319 | 0x10A0...0x10C5, | |
| 320 | 0x10D0...0x10F6, | |
| 321 | ||
| 322 | // Hiragana | |
| 323 | 0x3041...0x3093, | |
| 324 | 0x309B...0x309C, | |
| 325 | ||
| 326 | // Katakana | |
| 327 | 0x30A1...0x30F6, | |
| 328 | 0x30FB...0x30FC, | |
| 329 | ||
| 330 | // Bopomofo | |
| 331 | 0x3105...0x312C, | |
| 332 | ||
| 333 | // CJK Unified Ideographs | |
| 334 | 0x4E00...0x9FA5, | |
| 335 | ||
| 336 | // Hangul | |
| 337 | 0xAC00...0xD7A3, | |
| 338 | ||
| 339 | // Digits | |
| 340 | 0x0660...0x0669, | |
| 341 | 0x06F0...0x06F9, | |
| 342 | 0x0966...0x096F, | |
| 343 | 0x09E6...0x09EF, | |
| 344 | 0x0A66...0x0A6F, | |
| 345 | 0x0AE6...0x0AEF, | |
| 346 | 0x0B66...0x0B6F, | |
| 347 | 0x0BE7...0x0BEF, | |
| 348 | 0x0C66...0x0C6F, | |
| 349 | 0x0CE6...0x0CEF, | |
| 350 | 0x0D66...0x0D6F, | |
| 351 | 0x0E50...0x0E59, | |
| 352 | 0x0ED0...0x0ED9, | |
| 353 | 0x0F20...0x0F33, | |
| 354 | ||
| 355 | // Special characters | |
| 356 | 0x00B5, | |
| 357 | 0x00B7, | |
| 358 | 0x02B0...0x02B8, | |
| 359 | 0x02BB, | |
| 360 | 0x02BD...0x02C1, | |
| 361 | 0x02D0...0x02D1, | |
| 362 | 0x02E0...0x02E4, | |
| 363 | 0x037A, | |
| 364 | 0x0559, | |
| 365 | 0x093D, | |
| 366 | 0x0B3D, | |
| 367 | 0x1FBE, | |
| 368 | 0x203F...0x2040, | |
| 369 | 0x2102, | |
| 370 | 0x2107, | |
| 371 | 0x210A...0x2113, | |
| 372 | 0x2115, | |
| 373 | 0x2118...0x211D, | |
| 374 | 0x2124, | |
| 375 | 0x2126, | |
| 376 | 0x2128, | |
| 377 | 0x212A...0x2131, | |
| 378 | 0x2133...0x2138, | |
| 379 | 0x2160...0x2182, | |
| 380 | 0x3005...0x3007, | |
| 381 | 0x3021...0x3029, | |
| 382 | => true, | |
| 383 | else => false, | |
| 384 | }; | |
| 385 | } | |
| 386 | ||
| 387 | /// C11 standard Annex D | |
| 388 | pub fn isC11DisallowedInitialIdChar(codepoint: u21) bool { | |
| 389 | assert(codepoint > 0x7F); | |
| 390 | return switch (codepoint) { | |
| 391 | 0x0300...0x036F, | |
| 392 | 0x1DC0...0x1DFF, | |
| 393 | 0x20D0...0x20FF, | |
| 394 | 0xFE20...0xFE2F, | |
| 395 | => true, | |
| 396 | else => false, | |
| 397 | }; | |
| 398 | } | |
| 399 | ||
| 400 | /// These are "digit" characters; C99 disallows them as the first | |
| 401 | /// character of an identifier | |
| 402 | pub fn isC99DisallowedInitialIDChar(codepoint: u21) bool { | |
| 403 | assert(codepoint > 0x7F); | |
| 404 | return switch (codepoint) { | |
| 405 | 0x0660...0x0669, | |
| 406 | 0x06F0...0x06F9, | |
| 407 | 0x0966...0x096F, | |
| 408 | 0x09E6...0x09EF, | |
| 409 | 0x0A66...0x0A6F, | |
| 410 | 0x0AE6...0x0AEF, | |
| 411 | 0x0B66...0x0B6F, | |
| 412 | 0x0BE7...0x0BEF, | |
| 413 | 0x0C66...0x0C6F, | |
| 414 | 0x0CE6...0x0CEF, | |
| 415 | 0x0D66...0x0D6F, | |
| 416 | 0x0E50...0x0E59, | |
| 417 | 0x0ED0...0x0ED9, | |
| 418 | 0x0F20...0x0F33, | |
| 419 | => true, | |
| 420 | else => false, | |
| 421 | }; | |
| 422 | } | |
| 423 | ||
| 424 | pub fn isInvisible(codepoint: u21) bool { | |
| 425 | assert(codepoint > 0x7F); | |
| 426 | return switch (codepoint) { | |
| 427 | 0x00ad, // SOFT HYPHEN | |
| 428 | 0x200b, // ZERO WIDTH SPACE | |
| 429 | 0x200c, // ZERO WIDTH NON-JOINER | |
| 430 | 0x200d, // ZERO WIDTH JOINER | |
| 431 | 0x2060, // WORD JOINER | |
| 432 | 0x2061, // FUNCTION APPLICATION | |
| 433 | 0x2062, // INVISIBLE TIMES | |
| 434 | 0x2063, // INVISIBLE SEPARATOR | |
| 435 | 0x2064, // INVISIBLE PLUS | |
| 436 | 0xfeff, // ZERO WIDTH NO-BREAK SPACE | |
| 437 | => true, | |
| 438 | else => false, | |
| 439 | }; | |
| 440 | } | |
| 441 | ||
| 442 | /// Checks for identifier characters which resemble non-identifier characters | |
| 443 | pub fn homoglyph(codepoint: u21) ?u21 { | |
| 444 | assert(codepoint > 0x7F); | |
| 445 | return switch (codepoint) { | |
| 446 | 0x01c3 => '!', // LATIN LETTER RETROFLEX CLICK | |
| 447 | 0x037e => ';', // GREEK QUESTION MARK | |
| 448 | 0x2212 => '-', // MINUS SIGN | |
| 449 | 0x2215 => '/', // DIVISION SLASH | |
| 450 | 0x2216 => '\\', // SET MINUS | |
| 451 | 0x2217 => '*', // ASTERISK OPERATOR | |
| 452 | 0x2223 => '|', // DIVIDES | |
| 453 | 0x2227 => '^', // LOGICAL AND | |
| 454 | 0x2236 => ':', // RATIO | |
| 455 | 0x223c => '~', // TILDE OPERATOR | |
| 456 | 0xa789 => ':', // MODIFIER LETTER COLON | |
| 457 | 0xff01 => '!', // FULLWIDTH EXCLAMATION MARK | |
| 458 | 0xff03 => '#', // FULLWIDTH NUMBER SIGN | |
| 459 | 0xff04 => '$', // FULLWIDTH DOLLAR SIGN | |
| 460 | 0xff05 => '%', // FULLWIDTH PERCENT SIGN | |
| 461 | 0xff06 => '&', // FULLWIDTH AMPERSAND | |
| 462 | 0xff08 => '(', // FULLWIDTH LEFT PARENTHESIS | |
| 463 | 0xff09 => ')', // FULLWIDTH RIGHT PARENTHESIS | |
| 464 | 0xff0a => '*', // FULLWIDTH ASTERISK | |
| 465 | 0xff0b => '+', // FULLWIDTH ASTERISK | |
| 466 | 0xff0c => ',', // FULLWIDTH COMMA | |
| 467 | 0xff0d => '-', // FULLWIDTH HYPHEN-MINUS | |
| 468 | 0xff0e => '.', // FULLWIDTH FULL STOP | |
| 469 | 0xff0f => '/', // FULLWIDTH SOLIDUS | |
| 470 | 0xff1a => ':', // FULLWIDTH COLON | |
| 471 | 0xff1b => ';', // FULLWIDTH SEMICOLON | |
| 472 | 0xff1c => '<', // FULLWIDTH LESS-THAN SIGN | |
| 473 | 0xff1d => '=', // FULLWIDTH EQUALS SIGN | |
| 474 | 0xff1e => '>', // FULLWIDTH GREATER-THAN SIGN | |
| 475 | 0xff1f => '?', // FULLWIDTH QUESTION MARK | |
| 476 | 0xff20 => '@', // FULLWIDTH COMMERCIAL AT | |
| 477 | 0xff3b => '[', // FULLWIDTH LEFT SQUARE BRACKET | |
| 478 | 0xff3c => '\\', // FULLWIDTH REVERSE SOLIDUS | |
| 479 | 0xff3d => ']', // FULLWIDTH RIGHT SQUARE BRACKET | |
| 480 | 0xff3e => '^', // FULLWIDTH CIRCUMFLEX ACCENT | |
| 481 | 0xff5b => '{', // FULLWIDTH LEFT CURLY BRACKET | |
| 482 | 0xff5c => '|', // FULLWIDTH VERTICAL LINE | |
| 483 | 0xff5d => '}', // FULLWIDTH RIGHT CURLY BRACKET | |
| 484 | 0xff5e => '~', // FULLWIDTH TILDE | |
| 485 | else => null, | |
| 486 | }; | |
| 487 | } |
deps/aro/CodeGen.zig created+1291| ... | ... | @@ -0,0 +1,1291 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Allocator = std.mem.Allocator; | |
| 3 | const assert = std.debug.assert; | |
| 4 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 5 | const Compilation = @import("Compilation.zig"); | |
| 6 | const Interner = @import("Interner.zig"); | |
| 7 | const Ir = @import("Ir.zig"); | |
| 8 | const Builder = Ir.Builder; | |
| 9 | const StringId = @import("StringInterner.zig").StringId; | |
| 10 | const Tree = @import("Tree.zig"); | |
| 11 | const NodeIndex = Tree.NodeIndex; | |
| 12 | const Type = @import("Type.zig"); | |
| 13 | const Value = @import("Value.zig"); | |
| 14 | ||
| 15 | const CodeGen = @This(); | |
| 16 | ||
| 17 | const WipSwitch = struct { | |
| 18 | cases: Cases = .{}, | |
| 19 | default: ?Ir.Ref = null, | |
| 20 | size: u64, | |
| 21 | ||
| 22 | const Cases = std.MultiArrayList(struct { | |
| 23 | val: Interner.Ref, | |
| 24 | label: Ir.Ref, | |
| 25 | }); | |
| 26 | }; | |
| 27 | ||
| 28 | const Symbol = struct { | |
| 29 | name: StringId, | |
| 30 | val: Ir.Ref, | |
| 31 | }; | |
| 32 | ||
| 33 | const Error = Compilation.Error; | |
| 34 | ||
| 35 | tree: Tree, | |
| 36 | comp: *Compilation, | |
| 37 | builder: Builder, | |
| 38 | node_tag: []const Tree.Tag, | |
| 39 | node_data: []const Tree.Node.Data, | |
| 40 | node_ty: []const Type, | |
| 41 | wip_switch: *WipSwitch = undefined, | |
| 42 | symbols: std.ArrayListUnmanaged(Symbol) = .{}, | |
| 43 | ret_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, | |
| 44 | phi_nodes: std.ArrayListUnmanaged(Ir.Inst.Phi.Input) = .{}, | |
| 45 | record_elem_buf: std.ArrayListUnmanaged(Interner.Ref) = .{}, | |
| 46 | cond_dummy_ty: ?Interner.Ref = null, | |
| 47 | bool_invert: bool = false, | |
| 48 | bool_end_label: Ir.Ref = .none, | |
| 49 | cond_dummy_ref: Ir.Ref = undefined, | |
| 50 | continue_label: Ir.Ref = undefined, | |
| 51 | break_label: Ir.Ref = undefined, | |
| 52 | return_label: Ir.Ref = undefined, | |
| 53 | ||
| 54 | pub fn generateTree(comp: *Compilation, tree: Tree) Compilation.Error!void { | |
| 55 | var c = CodeGen{ | |
| 56 | .builder = .{ | |
| 57 | .gpa = comp.gpa, | |
| 58 | .arena = std.heap.ArenaAllocator.init(comp.gpa), | |
| 59 | }, | |
| 60 | .tree = tree, | |
| 61 | .comp = comp, | |
| 62 | .node_tag = tree.nodes.items(.tag), | |
| 63 | .node_data = tree.nodes.items(.data), | |
| 64 | .node_ty = tree.nodes.items(.ty), | |
| 65 | }; | |
| 66 | defer c.symbols.deinit(c.comp.gpa); | |
| 67 | defer c.ret_nodes.deinit(c.comp.gpa); | |
| 68 | defer c.phi_nodes.deinit(c.comp.gpa); | |
| 69 | defer c.record_elem_buf.deinit(c.comp.gpa); | |
| 70 | defer c.builder.deinit(); | |
| 71 | ||
| 72 | const node_tags = tree.nodes.items(.tag); | |
| 73 | for (tree.root_decls) |decl| { | |
| 74 | c.builder.arena.deinit(); | |
| 75 | c.builder.arena = std.heap.ArenaAllocator.init(comp.gpa); | |
| 76 | ||
| 77 | switch (node_tags[@intFromEnum(decl)]) { | |
| 78 | .static_assert, | |
| 79 | .typedef, | |
| 80 | .struct_decl_two, | |
| 81 | .union_decl_two, | |
| 82 | .enum_decl_two, | |
| 83 | .struct_decl, | |
| 84 | .union_decl, | |
| 85 | .enum_decl, | |
| 86 | => {}, | |
| 87 | ||
| 88 | .fn_proto, | |
| 89 | .static_fn_proto, | |
| 90 | .inline_fn_proto, | |
| 91 | .inline_static_fn_proto, | |
| 92 | .extern_var, | |
| 93 | .threadlocal_extern_var, | |
| 94 | => {}, | |
| 95 | ||
| 96 | .fn_def, | |
| 97 | .static_fn_def, | |
| 98 | .inline_fn_def, | |
| 99 | .inline_static_fn_def, | |
| 100 | => c.genFn(decl) catch |err| switch (err) { | |
| 101 | error.FatalError => return error.FatalError, | |
| 102 | error.OutOfMemory => return error.OutOfMemory, | |
| 103 | }, | |
| 104 | ||
| 105 | .@"var", | |
| 106 | .static_var, | |
| 107 | .threadlocal_var, | |
| 108 | .threadlocal_static_var, | |
| 109 | => c.genVar(decl) catch |err| switch (err) { | |
| 110 | error.FatalError => return error.FatalError, | |
| 111 | error.OutOfMemory => return error.OutOfMemory, | |
| 112 | }, | |
| 113 | else => unreachable, | |
| 114 | } | |
| 115 | } | |
| 116 | } | |
| 117 | ||
| 118 | fn genType(c: *CodeGen, base_ty: Type) !Interner.Ref { | |
| 119 | var key: Interner.Key = undefined; | |
| 120 | const ty = base_ty.canonicalize(.standard); | |
| 121 | switch (ty.specifier) { | |
| 122 | .void => return .void, | |
| 123 | .bool => return .i1, | |
| 124 | .@"struct" => { | |
| 125 | key = .{ | |
| 126 | .record = .{ | |
| 127 | .user_ptr = ty.data.record, | |
| 128 | .elements = undefined, // Not needed for hash lookup. | |
| 129 | }, | |
| 130 | }; | |
| 131 | if (c.builder.pool.has(key)) |some| return some; | |
| 132 | const elem_buf_top = c.record_elem_buf.items.len; | |
| 133 | defer c.record_elem_buf.items.len = elem_buf_top; | |
| 134 | ||
| 135 | for (ty.data.record.fields) |field| { | |
| 136 | if (!field.isRegularField()) { | |
| 137 | return c.comp.diag.fatalNoSrc("TODO lower struct bitfields", .{}); | |
| 138 | } | |
| 139 | // TODO handle padding bits | |
| 140 | const field_ref = try c.genType(field.ty); | |
| 141 | try c.record_elem_buf.append(c.builder.gpa, field_ref); | |
| 142 | } | |
| 143 | ||
| 144 | key.record.elements = try c.builder.arena.allocator().dupe(Interner.Ref, c.record_elem_buf.items[elem_buf_top..]); | |
| 145 | return c.builder.pool.put(c.builder.gpa, key); | |
| 146 | }, | |
| 147 | .@"union" => { | |
| 148 | return c.comp.diag.fatalNoSrc("TODO lower union types", .{}); | |
| 149 | }, | |
| 150 | else => {}, | |
| 151 | } | |
| 152 | if (ty.isPtr()) return .ptr; | |
| 153 | if (ty.isFunc()) return .func; | |
| 154 | if (!ty.isReal()) return c.comp.diag.fatalNoSrc("TODO lower complex types", .{}); | |
| 155 | if (ty.isInt()) { | |
| 156 | const bits = ty.bitSizeof(c.comp).?; | |
| 157 | key = .{ .int = @intCast(bits) }; | |
| 158 | } else if (ty.isFloat()) { | |
| 159 | const bits = ty.bitSizeof(c.comp).?; | |
| 160 | key = .{ .float = @intCast(bits) }; | |
| 161 | } else if (ty.isArray()) { | |
| 162 | const elem = try c.genType(ty.elemType()); | |
| 163 | key = .{ .array = .{ .child = elem, .len = ty.arrayLen().? } }; | |
| 164 | } else if (ty.specifier == .vector) { | |
| 165 | const elem = try c.genType(ty.elemType()); | |
| 166 | key = .{ .vector = .{ .child = elem, .len = @intCast(ty.data.array.len) } }; | |
| 167 | } else if (ty.is(.nullptr_t)) { | |
| 168 | return c.comp.diag.fatalNoSrc("TODO lower nullptr_t", .{}); | |
| 169 | } | |
| 170 | return c.builder.pool.put(c.builder.gpa, key); | |
| 171 | } | |
| 172 | ||
| 173 | fn genFn(c: *CodeGen, decl: NodeIndex) Error!void { | |
| 174 | const name = c.tree.tokSlice(c.node_data[@intFromEnum(decl)].decl.name); | |
| 175 | const func_ty = c.node_ty[@intFromEnum(decl)].canonicalize(.standard); | |
| 176 | c.ret_nodes.items.len = 0; | |
| 177 | ||
| 178 | try c.builder.startFn(); | |
| 179 | ||
| 180 | for (func_ty.data.func.params) |param| { | |
| 181 | // TODO handle calling convention here | |
| 182 | const arg = try c.builder.addArg(try c.genType(param.ty)); | |
| 183 | ||
| 184 | const size: u32 = @intCast(param.ty.sizeof(c.comp).?); // TODO add error in parser | |
| 185 | const @"align" = param.ty.alignof(c.comp); | |
| 186 | const alloc = try c.builder.addAlloc(size, @"align"); | |
| 187 | try c.builder.addStore(alloc, arg); | |
| 188 | try c.symbols.append(c.comp.gpa, .{ .name = param.name, .val = alloc }); | |
| 189 | } | |
| 190 | ||
| 191 | // Generate body | |
| 192 | c.return_label = try c.builder.makeLabel("return"); | |
| 193 | try c.genStmt(c.node_data[@intFromEnum(decl)].decl.node); | |
| 194 | ||
| 195 | // Relocate returns | |
| 196 | if (c.ret_nodes.items.len == 0) { | |
| 197 | _ = try c.builder.addInst(.ret, .{ .un = .none }, .noreturn); | |
| 198 | } else if (c.ret_nodes.items.len == 1) { | |
| 199 | c.builder.body.items.len -= 1; | |
| 200 | _ = try c.builder.addInst(.ret, .{ .un = c.ret_nodes.items[0].value }, .noreturn); | |
| 201 | } else { | |
| 202 | try c.builder.startBlock(c.return_label); | |
| 203 | const phi = try c.builder.addPhi(c.ret_nodes.items, try c.genType(func_ty.returnType())); | |
| 204 | _ = try c.builder.addInst(.ret, .{ .un = phi }, .noreturn); | |
| 205 | } | |
| 206 | ||
| 207 | var res = Ir{ | |
| 208 | .pool = c.builder.pool, | |
| 209 | .instructions = c.builder.instructions, | |
| 210 | .arena = c.builder.arena.state, | |
| 211 | .body = c.builder.body, | |
| 212 | .strings = c.tree.strings, | |
| 213 | }; | |
| 214 | res.dump(c.builder.gpa, name, c.comp.diag.color, std.io.getStdOut().writer()) catch {}; | |
| 215 | } | |
| 216 | ||
| 217 | fn addUn(c: *CodeGen, tag: Ir.Inst.Tag, operand: Ir.Ref, ty: Type) !Ir.Ref { | |
| 218 | return c.builder.addInst(tag, .{ .un = operand }, try c.genType(ty)); | |
| 219 | } | |
| 220 | ||
| 221 | fn addBin(c: *CodeGen, tag: Ir.Inst.Tag, lhs: Ir.Ref, rhs: Ir.Ref, ty: Type) !Ir.Ref { | |
| 222 | return c.builder.addInst(tag, .{ .bin = .{ .lhs = lhs, .rhs = rhs } }, try c.genType(ty)); | |
| 223 | } | |
| 224 | ||
| 225 | fn addBranch(c: *CodeGen, cond: Ir.Ref, true_label: Ir.Ref, false_label: Ir.Ref) !void { | |
| 226 | if (true_label == c.bool_end_label) { | |
| 227 | if (false_label == c.bool_end_label) { | |
| 228 | try c.phi_nodes.append(c.comp.gpa, .{ .label = c.builder.current_label, .value = cond }); | |
| 229 | return; | |
| 230 | } | |
| 231 | try c.addBoolPhi(!c.bool_invert); | |
| 232 | } | |
| 233 | if (false_label == c.bool_end_label) { | |
| 234 | try c.addBoolPhi(c.bool_invert); | |
| 235 | } | |
| 236 | return c.builder.addBranch(cond, true_label, false_label); | |
| 237 | } | |
| 238 | ||
| 239 | fn addBoolPhi(c: *CodeGen, value: bool) !void { | |
| 240 | const val = try c.builder.addConstant(Value.int(@intFromBool(value)), .i1); | |
| 241 | try c.phi_nodes.append(c.comp.gpa, .{ .label = c.builder.current_label, .value = val }); | |
| 242 | } | |
| 243 | ||
| 244 | fn genStmt(c: *CodeGen, node: NodeIndex) Error!void { | |
| 245 | _ = try c.genExpr(node); | |
| 246 | } | |
| 247 | ||
| 248 | fn genExpr(c: *CodeGen, node: NodeIndex) Error!Ir.Ref { | |
| 249 | std.debug.assert(node != .none); | |
| 250 | const ty = c.node_ty[@intFromEnum(node)]; | |
| 251 | if (c.tree.value_map.get(node)) |val| { | |
| 252 | return c.builder.addConstant(val, try c.genType(ty)); | |
| 253 | } | |
| 254 | const data = c.node_data[@intFromEnum(node)]; | |
| 255 | switch (c.node_tag[@intFromEnum(node)]) { | |
| 256 | .enumeration_ref, | |
| 257 | .bool_literal, | |
| 258 | .int_literal, | |
| 259 | .char_literal, | |
| 260 | .float_literal, | |
| 261 | .double_literal, | |
| 262 | .imaginary_literal, | |
| 263 | .string_literal_expr, | |
| 264 | .alignof_expr, | |
| 265 | => unreachable, // These should have an entry in value_map. | |
| 266 | .fn_def, | |
| 267 | .static_fn_def, | |
| 268 | .inline_fn_def, | |
| 269 | .inline_static_fn_def, | |
| 270 | .invalid, | |
| 271 | .threadlocal_var, | |
| 272 | => unreachable, | |
| 273 | .static_assert, | |
| 274 | .fn_proto, | |
| 275 | .static_fn_proto, | |
| 276 | .inline_fn_proto, | |
| 277 | .inline_static_fn_proto, | |
| 278 | .extern_var, | |
| 279 | .threadlocal_extern_var, | |
| 280 | .typedef, | |
| 281 | .struct_decl_two, | |
| 282 | .union_decl_two, | |
| 283 | .enum_decl_two, | |
| 284 | .struct_decl, | |
| 285 | .union_decl, | |
| 286 | .enum_decl, | |
| 287 | .enum_field_decl, | |
| 288 | .record_field_decl, | |
| 289 | .indirect_record_field_decl, | |
| 290 | .struct_forward_decl, | |
| 291 | .union_forward_decl, | |
| 292 | .enum_forward_decl, | |
| 293 | .null_stmt, | |
| 294 | => {}, | |
| 295 | .static_var, | |
| 296 | .implicit_static_var, | |
| 297 | .threadlocal_static_var, | |
| 298 | => try c.genVar(node), // TODO | |
| 299 | .@"var" => { | |
| 300 | const size: u32 = @intCast(ty.sizeof(c.comp).?); // TODO add error in parser | |
| 301 | const @"align" = ty.alignof(c.comp); | |
| 302 | const alloc = try c.builder.addAlloc(size, @"align"); | |
| 303 | const name = try c.comp.intern(c.tree.tokSlice(data.decl.name)); | |
| 304 | try c.symbols.append(c.comp.gpa, .{ .name = name, .val = alloc }); | |
| 305 | if (data.decl.node != .none) { | |
| 306 | try c.genInitializer(alloc, ty, data.decl.node); | |
| 307 | } | |
| 308 | }, | |
| 309 | .labeled_stmt => { | |
| 310 | const label = try c.builder.makeLabel("label"); | |
| 311 | try c.builder.startBlock(label); | |
| 312 | try c.genStmt(data.decl.node); | |
| 313 | }, | |
| 314 | .compound_stmt_two => { | |
| 315 | const old_sym_len = c.symbols.items.len; | |
| 316 | c.symbols.items.len = old_sym_len; | |
| 317 | ||
| 318 | if (data.bin.lhs != .none) try c.genStmt(data.bin.lhs); | |
| 319 | if (data.bin.rhs != .none) try c.genStmt(data.bin.rhs); | |
| 320 | }, | |
| 321 | .compound_stmt => { | |
| 322 | const old_sym_len = c.symbols.items.len; | |
| 323 | c.symbols.items.len = old_sym_len; | |
| 324 | ||
| 325 | for (c.tree.data[data.range.start..data.range.end]) |stmt| try c.genStmt(stmt); | |
| 326 | }, | |
| 327 | .if_then_else_stmt => { | |
| 328 | const then_label = try c.builder.makeLabel("if.then"); | |
| 329 | const else_label = try c.builder.makeLabel("if.else"); | |
| 330 | const end_label = try c.builder.makeLabel("if.end"); | |
| 331 | ||
| 332 | try c.genBoolExpr(data.if3.cond, then_label, else_label); | |
| 333 | ||
| 334 | try c.builder.startBlock(then_label); | |
| 335 | try c.genStmt(c.tree.data[data.if3.body]); // then | |
| 336 | try c.builder.addJump(end_label); | |
| 337 | ||
| 338 | try c.builder.startBlock(else_label); | |
| 339 | try c.genStmt(c.tree.data[data.if3.body + 1]); // else | |
| 340 | ||
| 341 | try c.builder.startBlock(end_label); | |
| 342 | }, | |
| 343 | .if_then_stmt => { | |
| 344 | const then_label = try c.builder.makeLabel("if.then"); | |
| 345 | const end_label = try c.builder.makeLabel("if.end"); | |
| 346 | ||
| 347 | try c.genBoolExpr(data.bin.lhs, then_label, end_label); | |
| 348 | ||
| 349 | try c.builder.startBlock(then_label); | |
| 350 | try c.genStmt(data.bin.rhs); // then | |
| 351 | try c.builder.startBlock(end_label); | |
| 352 | }, | |
| 353 | .switch_stmt => { | |
| 354 | var wip_switch = WipSwitch{ | |
| 355 | .size = c.node_ty[@intFromEnum(data.bin.lhs)].sizeof(c.comp).?, | |
| 356 | }; | |
| 357 | defer wip_switch.cases.deinit(c.builder.gpa); | |
| 358 | ||
| 359 | const old_wip_switch = c.wip_switch; | |
| 360 | defer c.wip_switch = old_wip_switch; | |
| 361 | c.wip_switch = &wip_switch; | |
| 362 | ||
| 363 | const old_break_label = c.break_label; | |
| 364 | defer c.break_label = old_break_label; | |
| 365 | const end_ref = try c.builder.makeLabel("switch.end"); | |
| 366 | c.break_label = end_ref; | |
| 367 | ||
| 368 | const cond = try c.genExpr(data.bin.lhs); | |
| 369 | const switch_index = c.builder.instructions.len; | |
| 370 | _ = try c.builder.addInst(.@"switch", undefined, .noreturn); | |
| 371 | ||
| 372 | try c.genStmt(data.bin.rhs); // body | |
| 373 | ||
| 374 | const default_ref = wip_switch.default orelse end_ref; | |
| 375 | try c.builder.startBlock(end_ref); | |
| 376 | ||
| 377 | const a = c.builder.arena.allocator(); | |
| 378 | const switch_data = try a.create(Ir.Inst.Switch); | |
| 379 | switch_data.* = .{ | |
| 380 | .target = cond, | |
| 381 | .cases_len = @intCast(wip_switch.cases.len), | |
| 382 | .case_vals = (try a.dupe(Interner.Ref, wip_switch.cases.items(.val))).ptr, | |
| 383 | .case_labels = (try a.dupe(Ir.Ref, wip_switch.cases.items(.label))).ptr, | |
| 384 | .default = default_ref, | |
| 385 | }; | |
| 386 | c.builder.instructions.items(.data)[switch_index] = .{ .@"switch" = switch_data }; | |
| 387 | }, | |
| 388 | .case_stmt => { | |
| 389 | const val = c.tree.value_map.get(data.bin.lhs).?; | |
| 390 | const label = try c.builder.makeLabel("case"); | |
| 391 | try c.builder.startBlock(label); | |
| 392 | try c.wip_switch.cases.append(c.builder.gpa, .{ | |
| 393 | .val = try c.builder.pool.put(c.builder.gpa, .{ .value = val }), | |
| 394 | .label = label, | |
| 395 | }); | |
| 396 | try c.genStmt(data.bin.rhs); | |
| 397 | }, | |
| 398 | .default_stmt => { | |
| 399 | const default = try c.builder.makeLabel("default"); | |
| 400 | try c.builder.startBlock(default); | |
| 401 | c.wip_switch.default = default; | |
| 402 | try c.genStmt(data.un); | |
| 403 | }, | |
| 404 | .while_stmt => { | |
| 405 | const old_break_label = c.break_label; | |
| 406 | defer c.break_label = old_break_label; | |
| 407 | ||
| 408 | const old_continue_label = c.continue_label; | |
| 409 | defer c.continue_label = old_continue_label; | |
| 410 | ||
| 411 | const cond_label = try c.builder.makeLabel("while.cond"); | |
| 412 | const then_label = try c.builder.makeLabel("while.then"); | |
| 413 | const end_label = try c.builder.makeLabel("while.end"); | |
| 414 | ||
| 415 | c.continue_label = cond_label; | |
| 416 | c.break_label = end_label; | |
| 417 | ||
| 418 | try c.builder.startBlock(cond_label); | |
| 419 | try c.genBoolExpr(data.bin.lhs, then_label, end_label); | |
| 420 | ||
| 421 | try c.builder.startBlock(then_label); | |
| 422 | try c.genStmt(data.bin.rhs); | |
| 423 | try c.builder.addJump(cond_label); | |
| 424 | try c.builder.startBlock(end_label); | |
| 425 | }, | |
| 426 | .do_while_stmt => { | |
| 427 | const old_break_label = c.break_label; | |
| 428 | defer c.break_label = old_break_label; | |
| 429 | ||
| 430 | const old_continue_label = c.continue_label; | |
| 431 | defer c.continue_label = old_continue_label; | |
| 432 | ||
| 433 | const then_label = try c.builder.makeLabel("do.then"); | |
| 434 | const cond_label = try c.builder.makeLabel("do.cond"); | |
| 435 | const end_label = try c.builder.makeLabel("do.end"); | |
| 436 | ||
| 437 | c.continue_label = cond_label; | |
| 438 | c.break_label = end_label; | |
| 439 | ||
| 440 | try c.builder.startBlock(then_label); | |
| 441 | try c.genStmt(data.bin.rhs); | |
| 442 | ||
| 443 | try c.builder.startBlock(cond_label); | |
| 444 | try c.genBoolExpr(data.bin.lhs, then_label, end_label); | |
| 445 | ||
| 446 | try c.builder.startBlock(end_label); | |
| 447 | }, | |
| 448 | .for_decl_stmt => { | |
| 449 | const old_break_label = c.break_label; | |
| 450 | defer c.break_label = old_break_label; | |
| 451 | ||
| 452 | const old_continue_label = c.continue_label; | |
| 453 | defer c.continue_label = old_continue_label; | |
| 454 | ||
| 455 | const for_decl = data.forDecl(c.tree); | |
| 456 | for (for_decl.decls) |decl| try c.genStmt(decl); | |
| 457 | ||
| 458 | const then_label = try c.builder.makeLabel("for.then"); | |
| 459 | var cond_label = then_label; | |
| 460 | const cont_label = try c.builder.makeLabel("for.cont"); | |
| 461 | const end_label = try c.builder.makeLabel("for.end"); | |
| 462 | ||
| 463 | c.continue_label = cont_label; | |
| 464 | c.break_label = end_label; | |
| 465 | ||
| 466 | if (for_decl.cond != .none) { | |
| 467 | cond_label = try c.builder.makeLabel("for.cond"); | |
| 468 | try c.builder.startBlock(cond_label); | |
| 469 | try c.genBoolExpr(for_decl.cond, then_label, end_label); | |
| 470 | } | |
| 471 | try c.builder.startBlock(then_label); | |
| 472 | try c.genStmt(for_decl.body); | |
| 473 | if (for_decl.incr != .none) { | |
| 474 | _ = try c.genExpr(for_decl.incr); | |
| 475 | } | |
| 476 | try c.builder.addJump(cond_label); | |
| 477 | try c.builder.startBlock(end_label); | |
| 478 | }, | |
| 479 | .forever_stmt => { | |
| 480 | const old_break_label = c.break_label; | |
| 481 | defer c.break_label = old_break_label; | |
| 482 | ||
| 483 | const old_continue_label = c.continue_label; | |
| 484 | defer c.continue_label = old_continue_label; | |
| 485 | ||
| 486 | const then_label = try c.builder.makeLabel("for.then"); | |
| 487 | const end_label = try c.builder.makeLabel("for.end"); | |
| 488 | ||
| 489 | c.continue_label = then_label; | |
| 490 | c.break_label = end_label; | |
| 491 | ||
| 492 | try c.builder.startBlock(then_label); | |
| 493 | try c.genStmt(data.un); | |
| 494 | try c.builder.startBlock(end_label); | |
| 495 | }, | |
| 496 | .for_stmt => { | |
| 497 | const old_break_label = c.break_label; | |
| 498 | defer c.break_label = old_break_label; | |
| 499 | ||
| 500 | const old_continue_label = c.continue_label; | |
| 501 | defer c.continue_label = old_continue_label; | |
| 502 | ||
| 503 | const for_stmt = data.forStmt(c.tree); | |
| 504 | if (for_stmt.init != .none) _ = try c.genExpr(for_stmt.init); | |
| 505 | ||
| 506 | const then_label = try c.builder.makeLabel("for.then"); | |
| 507 | var cond_label = then_label; | |
| 508 | const cont_label = try c.builder.makeLabel("for.cont"); | |
| 509 | const end_label = try c.builder.makeLabel("for.end"); | |
| 510 | ||
| 511 | c.continue_label = cont_label; | |
| 512 | c.break_label = end_label; | |
| 513 | ||
| 514 | if (for_stmt.cond != .none) { | |
| 515 | cond_label = try c.builder.makeLabel("for.cond"); | |
| 516 | try c.builder.startBlock(cond_label); | |
| 517 | try c.genBoolExpr(for_stmt.cond, then_label, end_label); | |
| 518 | } | |
| 519 | try c.builder.startBlock(then_label); | |
| 520 | try c.genStmt(for_stmt.body); | |
| 521 | if (for_stmt.incr != .none) { | |
| 522 | _ = try c.genExpr(for_stmt.incr); | |
| 523 | } | |
| 524 | try c.builder.addJump(cond_label); | |
| 525 | try c.builder.startBlock(end_label); | |
| 526 | }, | |
| 527 | .continue_stmt => try c.builder.addJump(c.continue_label), | |
| 528 | .break_stmt => try c.builder.addJump(c.break_label), | |
| 529 | .return_stmt => { | |
| 530 | if (data.un != .none) { | |
| 531 | const operand = try c.genExpr(data.un); | |
| 532 | try c.ret_nodes.append(c.comp.gpa, .{ .value = operand, .label = c.builder.current_label }); | |
| 533 | } | |
| 534 | try c.builder.addJump(c.return_label); | |
| 535 | }, | |
| 536 | .implicit_return => { | |
| 537 | if (data.return_zero) { | |
| 538 | const operand = try c.builder.addConstant(Value.int(0), try c.genType(ty)); | |
| 539 | try c.ret_nodes.append(c.comp.gpa, .{ .value = operand, .label = c.builder.current_label }); | |
| 540 | } | |
| 541 | // No need to emit a jump since implicit_return is always the last instruction. | |
| 542 | }, | |
| 543 | .case_range_stmt, | |
| 544 | .goto_stmt, | |
| 545 | .computed_goto_stmt, | |
| 546 | .nullptr_literal, | |
| 547 | => return c.comp.diag.fatalNoSrc("TODO CodeGen.genStmt {}\n", .{c.node_tag[@intFromEnum(node)]}), | |
| 548 | .comma_expr => { | |
| 549 | _ = try c.genExpr(data.bin.lhs); | |
| 550 | return c.genExpr(data.bin.rhs); | |
| 551 | }, | |
| 552 | .assign_expr => { | |
| 553 | const rhs = try c.genExpr(data.bin.rhs); | |
| 554 | const lhs = try c.genLval(data.bin.lhs); | |
| 555 | try c.builder.addStore(lhs, rhs); | |
| 556 | return rhs; | |
| 557 | }, | |
| 558 | .mul_assign_expr => return c.genCompoundAssign(node, .mul), | |
| 559 | .div_assign_expr => return c.genCompoundAssign(node, .div), | |
| 560 | .mod_assign_expr => return c.genCompoundAssign(node, .mod), | |
| 561 | .add_assign_expr => return c.genCompoundAssign(node, .add), | |
| 562 | .sub_assign_expr => return c.genCompoundAssign(node, .sub), | |
| 563 | .shl_assign_expr => return c.genCompoundAssign(node, .bit_shl), | |
| 564 | .shr_assign_expr => return c.genCompoundAssign(node, .bit_shr), | |
| 565 | .bit_and_assign_expr => return c.genCompoundAssign(node, .bit_and), | |
| 566 | .bit_xor_assign_expr => return c.genCompoundAssign(node, .bit_xor), | |
| 567 | .bit_or_assign_expr => return c.genCompoundAssign(node, .bit_or), | |
| 568 | .bit_or_expr => return c.genBinOp(node, .bit_or), | |
| 569 | .bit_xor_expr => return c.genBinOp(node, .bit_xor), | |
| 570 | .bit_and_expr => return c.genBinOp(node, .bit_and), | |
| 571 | .equal_expr => { | |
| 572 | const cmp = try c.genComparison(node, .cmp_eq); | |
| 573 | return c.addUn(.zext, cmp, ty); | |
| 574 | }, | |
| 575 | .not_equal_expr => { | |
| 576 | const cmp = try c.genComparison(node, .cmp_ne); | |
| 577 | return c.addUn(.zext, cmp, ty); | |
| 578 | }, | |
| 579 | .less_than_expr => { | |
| 580 | const cmp = try c.genComparison(node, .cmp_lt); | |
| 581 | return c.addUn(.zext, cmp, ty); | |
| 582 | }, | |
| 583 | .less_than_equal_expr => { | |
| 584 | const cmp = try c.genComparison(node, .cmp_lte); | |
| 585 | return c.addUn(.zext, cmp, ty); | |
| 586 | }, | |
| 587 | .greater_than_expr => { | |
| 588 | const cmp = try c.genComparison(node, .cmp_gt); | |
| 589 | return c.addUn(.zext, cmp, ty); | |
| 590 | }, | |
| 591 | .greater_than_equal_expr => { | |
| 592 | const cmp = try c.genComparison(node, .cmp_gte); | |
| 593 | return c.addUn(.zext, cmp, ty); | |
| 594 | }, | |
| 595 | .shl_expr => return c.genBinOp(node, .bit_shl), | |
| 596 | .shr_expr => return c.genBinOp(node, .bit_shr), | |
| 597 | .add_expr => { | |
| 598 | if (ty.isPtr()) { | |
| 599 | const lhs_ty = c.node_ty[@intFromEnum(data.bin.lhs)]; | |
| 600 | if (lhs_ty.isPtr()) { | |
| 601 | const ptr = try c.genExpr(data.bin.lhs); | |
| 602 | const offset = try c.genExpr(data.bin.rhs); | |
| 603 | const offset_ty = c.node_ty[@intFromEnum(data.bin.rhs)]; | |
| 604 | return c.genPtrArithmetic(ptr, offset, offset_ty, ty); | |
| 605 | } else { | |
| 606 | const offset = try c.genExpr(data.bin.lhs); | |
| 607 | const ptr = try c.genExpr(data.bin.rhs); | |
| 608 | const offset_ty = lhs_ty; | |
| 609 | return c.genPtrArithmetic(ptr, offset, offset_ty, ty); | |
| 610 | } | |
| 611 | } | |
| 612 | return c.genBinOp(node, .add); | |
| 613 | }, | |
| 614 | .sub_expr => { | |
| 615 | if (ty.isPtr()) { | |
| 616 | const ptr = try c.genExpr(data.bin.lhs); | |
| 617 | const offset = try c.genExpr(data.bin.rhs); | |
| 618 | const offset_ty = c.node_ty[@intFromEnum(data.bin.rhs)]; | |
| 619 | return c.genPtrArithmetic(ptr, offset, offset_ty, ty); | |
| 620 | } | |
| 621 | return c.genBinOp(node, .sub); | |
| 622 | }, | |
| 623 | .mul_expr => return c.genBinOp(node, .mul), | |
| 624 | .div_expr => return c.genBinOp(node, .div), | |
| 625 | .mod_expr => return c.genBinOp(node, .mod), | |
| 626 | .addr_of_expr => return try c.genLval(data.un), | |
| 627 | .deref_expr => { | |
| 628 | const un_data = c.node_data[@intFromEnum(data.un)]; | |
| 629 | if (c.node_tag[@intFromEnum(data.un)] == .implicit_cast and un_data.cast.kind == .function_to_pointer) { | |
| 630 | return c.genExpr(data.un); | |
| 631 | } | |
| 632 | const operand = try c.genLval(data.un); | |
| 633 | return c.addUn(.load, operand, ty); | |
| 634 | }, | |
| 635 | .plus_expr => return c.genExpr(data.un), | |
| 636 | .negate_expr => { | |
| 637 | const zero = try c.builder.addConstant(Value.int(0), try c.genType(ty)); | |
| 638 | const operand = try c.genExpr(data.un); | |
| 639 | return c.addBin(.sub, zero, operand, ty); | |
| 640 | }, | |
| 641 | .bit_not_expr => { | |
| 642 | const operand = try c.genExpr(data.un); | |
| 643 | return c.addUn(.bit_not, operand, ty); | |
| 644 | }, | |
| 645 | .bool_not_expr => { | |
| 646 | const zero = try c.builder.addConstant(Value.int(0), try c.genType(ty)); | |
| 647 | const operand = try c.genExpr(data.un); | |
| 648 | return c.addBin(.cmp_ne, zero, operand, ty); | |
| 649 | }, | |
| 650 | .pre_inc_expr => { | |
| 651 | const operand = try c.genLval(data.un); | |
| 652 | const val = try c.addUn(.load, operand, ty); | |
| 653 | const one = try c.builder.addConstant(Value.int(1), try c.genType(ty)); | |
| 654 | const plus_one = try c.addBin(.add, val, one, ty); | |
| 655 | try c.builder.addStore(operand, plus_one); | |
| 656 | return plus_one; | |
| 657 | }, | |
| 658 | .pre_dec_expr => { | |
| 659 | const operand = try c.genLval(data.un); | |
| 660 | const val = try c.addUn(.load, operand, ty); | |
| 661 | const one = try c.builder.addConstant(Value.int(1), try c.genType(ty)); | |
| 662 | const plus_one = try c.addBin(.sub, val, one, ty); | |
| 663 | try c.builder.addStore(operand, plus_one); | |
| 664 | return plus_one; | |
| 665 | }, | |
| 666 | .post_inc_expr => { | |
| 667 | const operand = try c.genLval(data.un); | |
| 668 | const val = try c.addUn(.load, operand, ty); | |
| 669 | const one = try c.builder.addConstant(Value.int(1), try c.genType(ty)); | |
| 670 | const plus_one = try c.addBin(.add, val, one, ty); | |
| 671 | try c.builder.addStore(operand, plus_one); | |
| 672 | return val; | |
| 673 | }, | |
| 674 | .post_dec_expr => { | |
| 675 | const operand = try c.genLval(data.un); | |
| 676 | const val = try c.addUn(.load, operand, ty); | |
| 677 | const one = try c.builder.addConstant(Value.int(1), try c.genType(ty)); | |
| 678 | const plus_one = try c.addBin(.sub, val, one, ty); | |
| 679 | try c.builder.addStore(operand, plus_one); | |
| 680 | return val; | |
| 681 | }, | |
| 682 | .paren_expr => return c.genExpr(data.un), | |
| 683 | .decl_ref_expr => unreachable, // Lval expression. | |
| 684 | .explicit_cast, .implicit_cast => switch (data.cast.kind) { | |
| 685 | .no_op => return c.genExpr(data.cast.operand), | |
| 686 | .to_void => { | |
| 687 | _ = try c.genExpr(data.cast.operand); | |
| 688 | return .none; | |
| 689 | }, | |
| 690 | .lval_to_rval => { | |
| 691 | const operand = try c.genLval(data.cast.operand); | |
| 692 | return c.addUn(.load, operand, ty); | |
| 693 | }, | |
| 694 | .function_to_pointer, .array_to_pointer => { | |
| 695 | return c.genLval(data.cast.operand); | |
| 696 | }, | |
| 697 | .int_cast => { | |
| 698 | const operand = try c.genExpr(data.cast.operand); | |
| 699 | const src_ty = c.node_ty[@intFromEnum(data.cast.operand)]; | |
| 700 | const src_bits = src_ty.bitSizeof(c.comp).?; | |
| 701 | const dest_bits = ty.bitSizeof(c.comp).?; | |
| 702 | if (src_bits == dest_bits) { | |
| 703 | return operand; | |
| 704 | } else if (src_bits < dest_bits) { | |
| 705 | if (src_ty.isUnsignedInt(c.comp)) | |
| 706 | return c.addUn(.zext, operand, ty) | |
| 707 | else | |
| 708 | return c.addUn(.sext, operand, ty); | |
| 709 | } else { | |
| 710 | return c.addUn(.trunc, operand, ty); | |
| 711 | } | |
| 712 | }, | |
| 713 | .bool_to_int => { | |
| 714 | const operand = try c.genExpr(data.cast.operand); | |
| 715 | return c.addUn(.zext, operand, ty); | |
| 716 | }, | |
| 717 | .pointer_to_bool, .int_to_bool, .float_to_bool => { | |
| 718 | const lhs = try c.genExpr(data.cast.operand); | |
| 719 | const rhs = try c.builder.addConstant(Value.int(0), try c.genType(c.node_ty[@intFromEnum(node)])); | |
| 720 | return c.builder.addInst(.cmp_ne, .{ .bin = .{ .lhs = lhs, .rhs = rhs } }, .i1); | |
| 721 | }, | |
| 722 | .bitcast, | |
| 723 | .pointer_to_int, | |
| 724 | .bool_to_float, | |
| 725 | .bool_to_pointer, | |
| 726 | .int_to_float, | |
| 727 | .complex_int_to_complex_float, | |
| 728 | .int_to_pointer, | |
| 729 | .float_to_int, | |
| 730 | .complex_float_to_complex_int, | |
| 731 | .complex_int_cast, | |
| 732 | .complex_int_to_real, | |
| 733 | .real_to_complex_int, | |
| 734 | .float_cast, | |
| 735 | .complex_float_cast, | |
| 736 | .complex_float_to_real, | |
| 737 | .real_to_complex_float, | |
| 738 | .null_to_pointer, | |
| 739 | .union_cast, | |
| 740 | .vector_splat, | |
| 741 | => return c.comp.diag.fatalNoSrc("TODO CodeGen gen CastKind {}\n", .{data.cast.kind}), | |
| 742 | }, | |
| 743 | .binary_cond_expr => { | |
| 744 | if (c.tree.value_map.get(data.if3.cond)) |cond| { | |
| 745 | if (cond.getBool()) { | |
| 746 | c.cond_dummy_ref = try c.genExpr(data.if3.cond); | |
| 747 | return c.genExpr(c.tree.data[data.if3.body]); // then | |
| 748 | } else { | |
| 749 | return c.genExpr(c.tree.data[data.if3.body + 1]); // else | |
| 750 | } | |
| 751 | } | |
| 752 | ||
| 753 | const then_label = try c.builder.makeLabel("ternary.then"); | |
| 754 | const else_label = try c.builder.makeLabel("ternary.else"); | |
| 755 | const end_label = try c.builder.makeLabel("ternary.end"); | |
| 756 | const cond_ty = c.node_ty[@intFromEnum(data.if3.cond)]; | |
| 757 | { | |
| 758 | const old_cond_dummy_ty = c.cond_dummy_ty; | |
| 759 | defer c.cond_dummy_ty = old_cond_dummy_ty; | |
| 760 | c.cond_dummy_ty = try c.genType(cond_ty); | |
| 761 | ||
| 762 | try c.genBoolExpr(data.if3.cond, then_label, else_label); | |
| 763 | } | |
| 764 | ||
| 765 | try c.builder.startBlock(then_label); | |
| 766 | if (c.builder.instructions.items(.ty)[@intFromEnum(c.cond_dummy_ref)] == .i1) { | |
| 767 | c.cond_dummy_ref = try c.addUn(.zext, c.cond_dummy_ref, cond_ty); | |
| 768 | } | |
| 769 | const then_val = try c.genExpr(c.tree.data[data.if3.body]); // then | |
| 770 | try c.builder.addJump(end_label); | |
| 771 | const then_exit = c.builder.current_label; | |
| 772 | ||
| 773 | try c.builder.startBlock(else_label); | |
| 774 | const else_val = try c.genExpr(c.tree.data[data.if3.body + 1]); // else | |
| 775 | const else_exit = c.builder.current_label; | |
| 776 | ||
| 777 | try c.builder.startBlock(end_label); | |
| 778 | ||
| 779 | var phi_buf: [2]Ir.Inst.Phi.Input = .{ | |
| 780 | .{ .value = then_val, .label = then_exit }, | |
| 781 | .{ .value = else_val, .label = else_exit }, | |
| 782 | }; | |
| 783 | return c.builder.addPhi(&phi_buf, try c.genType(ty)); | |
| 784 | }, | |
| 785 | .cond_dummy_expr => return c.cond_dummy_ref, | |
| 786 | .cond_expr => { | |
| 787 | if (c.tree.value_map.get(data.if3.cond)) |cond| { | |
| 788 | if (cond.getBool()) { | |
| 789 | return c.genExpr(c.tree.data[data.if3.body]); // then | |
| 790 | } else { | |
| 791 | return c.genExpr(c.tree.data[data.if3.body + 1]); // else | |
| 792 | } | |
| 793 | } | |
| 794 | ||
| 795 | const then_label = try c.builder.makeLabel("ternary.then"); | |
| 796 | const else_label = try c.builder.makeLabel("ternary.else"); | |
| 797 | const end_label = try c.builder.makeLabel("ternary.end"); | |
| 798 | ||
| 799 | try c.genBoolExpr(data.if3.cond, then_label, else_label); | |
| 800 | ||
| 801 | try c.builder.startBlock(then_label); | |
| 802 | const then_val = try c.genExpr(c.tree.data[data.if3.body]); // then | |
| 803 | try c.builder.addJump(end_label); | |
| 804 | const then_exit = c.builder.current_label; | |
| 805 | ||
| 806 | try c.builder.startBlock(else_label); | |
| 807 | const else_val = try c.genExpr(c.tree.data[data.if3.body + 1]); // else | |
| 808 | const else_exit = c.builder.current_label; | |
| 809 | ||
| 810 | try c.builder.startBlock(end_label); | |
| 811 | ||
| 812 | var phi_buf: [2]Ir.Inst.Phi.Input = .{ | |
| 813 | .{ .value = then_val, .label = then_exit }, | |
| 814 | .{ .value = else_val, .label = else_exit }, | |
| 815 | }; | |
| 816 | return c.builder.addPhi(&phi_buf, try c.genType(ty)); | |
| 817 | }, | |
| 818 | .call_expr_one => if (data.bin.rhs == .none) { | |
| 819 | return c.genCall(data.bin.lhs, &.{}, ty); | |
| 820 | } else { | |
| 821 | return c.genCall(data.bin.lhs, &.{data.bin.rhs}, ty); | |
| 822 | }, | |
| 823 | .call_expr => { | |
| 824 | return c.genCall(c.tree.data[data.range.start], c.tree.data[data.range.start + 1 .. data.range.end], ty); | |
| 825 | }, | |
| 826 | .bool_or_expr => { | |
| 827 | if (c.tree.value_map.get(data.bin.lhs)) |lhs| { | |
| 828 | const cond = lhs.getBool(); | |
| 829 | if (!cond) { | |
| 830 | return c.builder.addConstant(Value.int(1), try c.genType(ty)); | |
| 831 | } | |
| 832 | return c.genExpr(data.bin.rhs); | |
| 833 | } | |
| 834 | ||
| 835 | const false_label = try c.builder.makeLabel("bool_false"); | |
| 836 | const exit_label = try c.builder.makeLabel("bool_exit"); | |
| 837 | ||
| 838 | const old_bool_end_label = c.bool_end_label; | |
| 839 | defer c.bool_end_label = old_bool_end_label; | |
| 840 | c.bool_end_label = exit_label; | |
| 841 | ||
| 842 | const phi_nodes_top = c.phi_nodes.items.len; | |
| 843 | defer c.phi_nodes.items.len = phi_nodes_top; | |
| 844 | ||
| 845 | try c.genBoolExpr(data.bin.lhs, exit_label, false_label); | |
| 846 | ||
| 847 | try c.builder.startBlock(false_label); | |
| 848 | try c.genBoolExpr(data.bin.rhs, exit_label, exit_label); | |
| 849 | ||
| 850 | try c.builder.startBlock(exit_label); | |
| 851 | ||
| 852 | const phi = try c.builder.addPhi(c.phi_nodes.items[phi_nodes_top..], .i1); | |
| 853 | return c.addUn(.zext, phi, ty); | |
| 854 | }, | |
| 855 | .bool_and_expr => { | |
| 856 | if (c.tree.value_map.get(data.bin.lhs)) |lhs| { | |
| 857 | const cond = lhs.getBool(); | |
| 858 | if (!cond) { | |
| 859 | return c.builder.addConstant(Value.int(0), try c.genType(ty)); | |
| 860 | } | |
| 861 | return c.genExpr(data.bin.rhs); | |
| 862 | } | |
| 863 | ||
| 864 | const true_label = try c.builder.makeLabel("bool_true"); | |
| 865 | const exit_label = try c.builder.makeLabel("bool_exit"); | |
| 866 | ||
| 867 | const old_bool_end_label = c.bool_end_label; | |
| 868 | defer c.bool_end_label = old_bool_end_label; | |
| 869 | c.bool_end_label = exit_label; | |
| 870 | ||
| 871 | const phi_nodes_top = c.phi_nodes.items.len; | |
| 872 | defer c.phi_nodes.items.len = phi_nodes_top; | |
| 873 | ||
| 874 | try c.genBoolExpr(data.bin.lhs, true_label, exit_label); | |
| 875 | ||
| 876 | try c.builder.startBlock(true_label); | |
| 877 | try c.genBoolExpr(data.bin.rhs, exit_label, exit_label); | |
| 878 | ||
| 879 | try c.builder.startBlock(exit_label); | |
| 880 | ||
| 881 | const phi = try c.builder.addPhi(c.phi_nodes.items[phi_nodes_top..], .i1); | |
| 882 | return c.addUn(.zext, phi, ty); | |
| 883 | }, | |
| 884 | .builtin_choose_expr => { | |
| 885 | const cond = c.tree.value_map.get(data.if3.cond).?; | |
| 886 | if (cond.getBool()) { | |
| 887 | return c.genExpr(c.tree.data[data.if3.body]); | |
| 888 | } else { | |
| 889 | return c.genExpr(c.tree.data[data.if3.body + 1]); | |
| 890 | } | |
| 891 | }, | |
| 892 | .generic_expr_one => { | |
| 893 | const index = @intFromEnum(data.bin.rhs); | |
| 894 | switch (c.node_tag[index]) { | |
| 895 | .generic_association_expr, .generic_default_expr => { | |
| 896 | return c.genExpr(c.node_data[index].un); | |
| 897 | }, | |
| 898 | else => unreachable, | |
| 899 | } | |
| 900 | }, | |
| 901 | .generic_expr => { | |
| 902 | const index = @intFromEnum(c.tree.data[data.range.start + 1]); | |
| 903 | switch (c.node_tag[index]) { | |
| 904 | .generic_association_expr, .generic_default_expr => { | |
| 905 | return c.genExpr(c.node_data[index].un); | |
| 906 | }, | |
| 907 | else => unreachable, | |
| 908 | } | |
| 909 | }, | |
| 910 | .generic_association_expr, .generic_default_expr => unreachable, | |
| 911 | .stmt_expr => switch (c.node_tag[@intFromEnum(data.un)]) { | |
| 912 | .compound_stmt_two => { | |
| 913 | const old_sym_len = c.symbols.items.len; | |
| 914 | c.symbols.items.len = old_sym_len; | |
| 915 | ||
| 916 | const stmt_data = c.node_data[@intFromEnum(data.un)]; | |
| 917 | if (stmt_data.bin.rhs == .none) return c.genExpr(stmt_data.bin.lhs); | |
| 918 | try c.genStmt(stmt_data.bin.lhs); | |
| 919 | return c.genExpr(stmt_data.bin.rhs); | |
| 920 | }, | |
| 921 | .compound_stmt => { | |
| 922 | const old_sym_len = c.symbols.items.len; | |
| 923 | c.symbols.items.len = old_sym_len; | |
| 924 | ||
| 925 | const stmt_data = c.node_data[@intFromEnum(data.un)]; | |
| 926 | for (c.tree.data[stmt_data.range.start .. stmt_data.range.end - 1]) |stmt| try c.genStmt(stmt); | |
| 927 | return c.genExpr(c.tree.data[stmt_data.range.end]); | |
| 928 | }, | |
| 929 | else => unreachable, | |
| 930 | }, | |
| 931 | .builtin_call_expr_one => { | |
| 932 | const name = c.tree.tokSlice(data.decl.name); | |
| 933 | const builtin = c.comp.builtins.lookup(name).builtin; | |
| 934 | if (data.decl.node == .none) { | |
| 935 | return c.genBuiltinCall(builtin, &.{}, ty); | |
| 936 | } else { | |
| 937 | return c.genBuiltinCall(builtin, &.{data.decl.node}, ty); | |
| 938 | } | |
| 939 | }, | |
| 940 | .builtin_call_expr => { | |
| 941 | const name_node_idx = c.tree.data[data.range.start]; | |
| 942 | const name = c.tree.tokSlice(@intFromEnum(name_node_idx)); | |
| 943 | const builtin = c.comp.builtins.lookup(name).builtin; | |
| 944 | return c.genBuiltinCall(builtin, c.tree.data[data.range.start + 1 .. data.range.end], ty); | |
| 945 | }, | |
| 946 | .addr_of_label, | |
| 947 | .imag_expr, | |
| 948 | .real_expr, | |
| 949 | .sizeof_expr, | |
| 950 | .special_builtin_call_one, | |
| 951 | => return c.comp.diag.fatalNoSrc("TODO CodeGen.genExpr {}\n", .{c.node_tag[@intFromEnum(node)]}), | |
| 952 | else => unreachable, // Not an expression. | |
| 953 | } | |
| 954 | return .none; | |
| 955 | } | |
| 956 | ||
| 957 | fn genLval(c: *CodeGen, node: NodeIndex) Error!Ir.Ref { | |
| 958 | std.debug.assert(node != .none); | |
| 959 | assert(Tree.isLval(c.tree.nodes, c.tree.data, c.tree.value_map, node)); | |
| 960 | const data = c.node_data[@intFromEnum(node)]; | |
| 961 | switch (c.node_tag[@intFromEnum(node)]) { | |
| 962 | .string_literal_expr => { | |
| 963 | const val = c.tree.value_map.get(node).?; | |
| 964 | return c.builder.addConstant(val, .ptr); | |
| 965 | }, | |
| 966 | .paren_expr => return c.genLval(data.un), | |
| 967 | .decl_ref_expr => { | |
| 968 | const slice = c.tree.tokSlice(data.decl_ref); | |
| 969 | const name = try c.comp.intern(slice); | |
| 970 | var i = c.symbols.items.len; | |
| 971 | while (i > 0) { | |
| 972 | i -= 1; | |
| 973 | if (c.symbols.items[i].name == name) { | |
| 974 | return c.symbols.items[i].val; | |
| 975 | } | |
| 976 | } | |
| 977 | ||
| 978 | const duped_name = try c.builder.arena.allocator().dupeZ(u8, slice); | |
| 979 | const ref: Ir.Ref = @enumFromInt(c.builder.instructions.len); | |
| 980 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); | |
| 981 | return ref; | |
| 982 | }, | |
| 983 | .deref_expr => return c.genExpr(data.un), | |
| 984 | .compound_literal_expr => { | |
| 985 | const ty = c.node_ty[@intFromEnum(node)]; | |
| 986 | const size: u32 = @intCast(ty.sizeof(c.comp).?); // TODO add error in parser | |
| 987 | const @"align" = ty.alignof(c.comp); | |
| 988 | const alloc = try c.builder.addAlloc(size, @"align"); | |
| 989 | try c.genInitializer(alloc, ty, data.un); | |
| 990 | return alloc; | |
| 991 | }, | |
| 992 | .builtin_choose_expr => { | |
| 993 | const cond = c.tree.value_map.get(data.if3.cond).?; | |
| 994 | if (cond.getBool()) { | |
| 995 | return c.genLval(c.tree.data[data.if3.body]); | |
| 996 | } else { | |
| 997 | return c.genLval(c.tree.data[data.if3.body + 1]); | |
| 998 | } | |
| 999 | }, | |
| 1000 | .member_access_expr, | |
| 1001 | .member_access_ptr_expr, | |
| 1002 | .array_access_expr, | |
| 1003 | => return c.comp.diag.fatalNoSrc("TODO CodeGen.genLval {}\n", .{c.node_tag[@intFromEnum(node)]}), | |
| 1004 | else => unreachable, // Not an lval expression. | |
| 1005 | } | |
| 1006 | } | |
| 1007 | ||
| 1008 | fn genBoolExpr(c: *CodeGen, base: NodeIndex, true_label: Ir.Ref, false_label: Ir.Ref) Error!void { | |
| 1009 | var node = base; | |
| 1010 | while (true) switch (c.node_tag[@intFromEnum(node)]) { | |
| 1011 | .paren_expr => { | |
| 1012 | node = c.node_data[@intFromEnum(node)].un; | |
| 1013 | }, | |
| 1014 | else => break, | |
| 1015 | }; | |
| 1016 | ||
| 1017 | const data = c.node_data[@intFromEnum(node)]; | |
| 1018 | switch (c.node_tag[@intFromEnum(node)]) { | |
| 1019 | .bool_or_expr => { | |
| 1020 | if (c.tree.value_map.get(data.bin.lhs)) |lhs| { | |
| 1021 | const cond = lhs.getBool(); | |
| 1022 | if (cond) { | |
| 1023 | if (true_label == c.bool_end_label) { | |
| 1024 | return c.addBoolPhi(!c.bool_invert); | |
| 1025 | } | |
| 1026 | return c.builder.addJump(true_label); | |
| 1027 | } | |
| 1028 | return c.genBoolExpr(data.bin.rhs, true_label, false_label); | |
| 1029 | } | |
| 1030 | ||
| 1031 | const new_false_label = try c.builder.makeLabel("bool_false"); | |
| 1032 | try c.genBoolExpr(data.bin.lhs, true_label, new_false_label); | |
| 1033 | try c.builder.startBlock(new_false_label); | |
| 1034 | ||
| 1035 | if (c.cond_dummy_ty) |ty| c.cond_dummy_ref = try c.builder.addConstant(Value.int(1), ty); | |
| 1036 | return c.genBoolExpr(data.bin.rhs, true_label, false_label); | |
| 1037 | }, | |
| 1038 | .bool_and_expr => { | |
| 1039 | if (c.tree.value_map.get(data.bin.lhs)) |lhs| { | |
| 1040 | const cond = lhs.getBool(); | |
| 1041 | if (!cond) { | |
| 1042 | if (false_label == c.bool_end_label) { | |
| 1043 | return c.addBoolPhi(c.bool_invert); | |
| 1044 | } | |
| 1045 | return c.builder.addJump(false_label); | |
| 1046 | } | |
| 1047 | return c.genBoolExpr(data.bin.rhs, true_label, false_label); | |
| 1048 | } | |
| 1049 | ||
| 1050 | const new_true_label = try c.builder.makeLabel("bool_true"); | |
| 1051 | try c.genBoolExpr(data.bin.lhs, new_true_label, false_label); | |
| 1052 | try c.builder.startBlock(new_true_label); | |
| 1053 | ||
| 1054 | if (c.cond_dummy_ty) |ty| c.cond_dummy_ref = try c.builder.addConstant(Value.int(1), ty); | |
| 1055 | return c.genBoolExpr(data.bin.rhs, true_label, false_label); | |
| 1056 | }, | |
| 1057 | .bool_not_expr => { | |
| 1058 | c.bool_invert = !c.bool_invert; | |
| 1059 | defer c.bool_invert = !c.bool_invert; | |
| 1060 | ||
| 1061 | if (c.cond_dummy_ty) |ty| c.cond_dummy_ref = try c.builder.addConstant(Value.int(0), ty); | |
| 1062 | return c.genBoolExpr(data.un, false_label, true_label); | |
| 1063 | }, | |
| 1064 | .equal_expr => { | |
| 1065 | const cmp = try c.genComparison(node, .cmp_eq); | |
| 1066 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1067 | return c.addBranch(cmp, true_label, false_label); | |
| 1068 | }, | |
| 1069 | .not_equal_expr => { | |
| 1070 | const cmp = try c.genComparison(node, .cmp_ne); | |
| 1071 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1072 | return c.addBranch(cmp, true_label, false_label); | |
| 1073 | }, | |
| 1074 | .less_than_expr => { | |
| 1075 | const cmp = try c.genComparison(node, .cmp_lt); | |
| 1076 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1077 | return c.addBranch(cmp, true_label, false_label); | |
| 1078 | }, | |
| 1079 | .less_than_equal_expr => { | |
| 1080 | const cmp = try c.genComparison(node, .cmp_lte); | |
| 1081 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1082 | return c.addBranch(cmp, true_label, false_label); | |
| 1083 | }, | |
| 1084 | .greater_than_expr => { | |
| 1085 | const cmp = try c.genComparison(node, .cmp_gt); | |
| 1086 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1087 | return c.addBranch(cmp, true_label, false_label); | |
| 1088 | }, | |
| 1089 | .greater_than_equal_expr => { | |
| 1090 | const cmp = try c.genComparison(node, .cmp_gte); | |
| 1091 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1092 | return c.addBranch(cmp, true_label, false_label); | |
| 1093 | }, | |
| 1094 | .explicit_cast, .implicit_cast => switch (data.cast.kind) { | |
| 1095 | .bool_to_int => { | |
| 1096 | const operand = try c.genExpr(data.cast.operand); | |
| 1097 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = operand; | |
| 1098 | return c.addBranch(operand, true_label, false_label); | |
| 1099 | }, | |
| 1100 | else => {}, | |
| 1101 | }, | |
| 1102 | .binary_cond_expr => { | |
| 1103 | if (c.tree.value_map.get(data.if3.cond)) |cond| { | |
| 1104 | if (cond.getBool()) { | |
| 1105 | return c.genBoolExpr(c.tree.data[data.if3.body], true_label, false_label); // then | |
| 1106 | } else { | |
| 1107 | return c.genBoolExpr(c.tree.data[data.if3.body + 1], true_label, false_label); // else | |
| 1108 | } | |
| 1109 | } | |
| 1110 | ||
| 1111 | const new_false_label = try c.builder.makeLabel("ternary.else"); | |
| 1112 | try c.genBoolExpr(data.if3.cond, true_label, new_false_label); | |
| 1113 | ||
| 1114 | try c.builder.startBlock(new_false_label); | |
| 1115 | if (c.cond_dummy_ty) |ty| c.cond_dummy_ref = try c.builder.addConstant(Value.int(1), ty); | |
| 1116 | return c.genBoolExpr(c.tree.data[data.if3.body + 1], true_label, false_label); // else | |
| 1117 | }, | |
| 1118 | .cond_expr => { | |
| 1119 | if (c.tree.value_map.get(data.if3.cond)) |cond| { | |
| 1120 | if (cond.getBool()) { | |
| 1121 | return c.genBoolExpr(c.tree.data[data.if3.body], true_label, false_label); // then | |
| 1122 | } else { | |
| 1123 | return c.genBoolExpr(c.tree.data[data.if3.body + 1], true_label, false_label); // else | |
| 1124 | } | |
| 1125 | } | |
| 1126 | ||
| 1127 | const new_true_label = try c.builder.makeLabel("ternary.then"); | |
| 1128 | const new_false_label = try c.builder.makeLabel("ternary.else"); | |
| 1129 | try c.genBoolExpr(data.if3.cond, new_true_label, new_false_label); | |
| 1130 | ||
| 1131 | try c.builder.startBlock(new_true_label); | |
| 1132 | try c.genBoolExpr(c.tree.data[data.if3.body], true_label, false_label); // then | |
| 1133 | try c.builder.startBlock(new_false_label); | |
| 1134 | if (c.cond_dummy_ty) |ty| c.cond_dummy_ref = try c.builder.addConstant(Value.int(1), ty); | |
| 1135 | return c.genBoolExpr(c.tree.data[data.if3.body + 1], true_label, false_label); // else | |
| 1136 | }, | |
| 1137 | else => {}, | |
| 1138 | } | |
| 1139 | ||
| 1140 | if (c.tree.value_map.get(node)) |value| { | |
| 1141 | if (value.getBool()) { | |
| 1142 | if (true_label == c.bool_end_label) { | |
| 1143 | return c.addBoolPhi(!c.bool_invert); | |
| 1144 | } | |
| 1145 | return c.builder.addJump(true_label); | |
| 1146 | } else { | |
| 1147 | if (false_label == c.bool_end_label) { | |
| 1148 | return c.addBoolPhi(c.bool_invert); | |
| 1149 | } | |
| 1150 | return c.builder.addJump(false_label); | |
| 1151 | } | |
| 1152 | } | |
| 1153 | ||
| 1154 | // Assume int operand. | |
| 1155 | const lhs = try c.genExpr(node); | |
| 1156 | const rhs = try c.builder.addConstant(Value.int(0), try c.genType(c.node_ty[@intFromEnum(node)])); | |
| 1157 | const cmp = try c.builder.addInst(.cmp_ne, .{ .bin = .{ .lhs = lhs, .rhs = rhs } }, .i1); | |
| 1158 | if (c.cond_dummy_ty != null) c.cond_dummy_ref = cmp; | |
| 1159 | try c.addBranch(cmp, true_label, false_label); | |
| 1160 | } | |
| 1161 | ||
| 1162 | fn genBuiltinCall(c: *CodeGen, builtin: BuiltinFunction, arg_nodes: []const NodeIndex, ty: Type) Error!Ir.Ref { | |
| 1163 | _ = arg_nodes; | |
| 1164 | _ = ty; | |
| 1165 | return c.comp.diag.fatalNoSrc("TODO CodeGen.genBuiltinCall {s}\n", .{@tagName(builtin.tag)}); | |
| 1166 | } | |
| 1167 | ||
| 1168 | fn genCall(c: *CodeGen, fn_node: NodeIndex, arg_nodes: []const NodeIndex, ty: Type) Error!Ir.Ref { | |
| 1169 | // Detect direct calls. | |
| 1170 | const fn_ref = blk: { | |
| 1171 | const data = c.node_data[@intFromEnum(fn_node)]; | |
| 1172 | if (c.node_tag[@intFromEnum(fn_node)] != .implicit_cast or data.cast.kind != .function_to_pointer) { | |
| 1173 | break :blk try c.genExpr(fn_node); | |
| 1174 | } | |
| 1175 | ||
| 1176 | var cur = @intFromEnum(data.cast.operand); | |
| 1177 | while (true) switch (c.node_tag[cur]) { | |
| 1178 | .paren_expr, .addr_of_expr, .deref_expr => { | |
| 1179 | cur = @intFromEnum(c.node_data[cur].un); | |
| 1180 | }, | |
| 1181 | .implicit_cast => { | |
| 1182 | const cast = c.node_data[cur].cast; | |
| 1183 | if (cast.kind != .function_to_pointer) { | |
| 1184 | break :blk try c.genExpr(fn_node); | |
| 1185 | } | |
| 1186 | cur = @intFromEnum(cast.operand); | |
| 1187 | }, | |
| 1188 | .decl_ref_expr => { | |
| 1189 | const slice = c.tree.tokSlice(c.node_data[cur].decl_ref); | |
| 1190 | const name = try c.comp.intern(slice); | |
| 1191 | var i = c.symbols.items.len; | |
| 1192 | while (i > 0) { | |
| 1193 | i -= 1; | |
| 1194 | if (c.symbols.items[i].name == name) { | |
| 1195 | break :blk try c.genExpr(fn_node); | |
| 1196 | } | |
| 1197 | } | |
| 1198 | ||
| 1199 | const duped_name = try c.builder.arena.allocator().dupeZ(u8, slice); | |
| 1200 | const ref: Ir.Ref = @enumFromInt(c.builder.instructions.len); | |
| 1201 | try c.builder.instructions.append(c.builder.gpa, .{ .tag = .symbol, .data = .{ .label = duped_name }, .ty = .ptr }); | |
| 1202 | break :blk ref; | |
| 1203 | }, | |
| 1204 | else => break :blk try c.genExpr(fn_node), | |
| 1205 | }; | |
| 1206 | }; | |
| 1207 | ||
| 1208 | const args = try c.builder.arena.allocator().alloc(Ir.Ref, arg_nodes.len); | |
| 1209 | for (arg_nodes, args) |node, *arg| { | |
| 1210 | // TODO handle calling convention here | |
| 1211 | arg.* = try c.genExpr(node); | |
| 1212 | } | |
| 1213 | // TODO handle variadic call | |
| 1214 | const call = try c.builder.arena.allocator().create(Ir.Inst.Call); | |
| 1215 | call.* = .{ | |
| 1216 | .func = fn_ref, | |
| 1217 | .args_len = @intCast(args.len), | |
| 1218 | .args_ptr = args.ptr, | |
| 1219 | }; | |
| 1220 | return c.builder.addInst(.call, .{ .call = call }, try c.genType(ty)); | |
| 1221 | } | |
| 1222 | ||
| 1223 | fn genCompoundAssign(c: *CodeGen, node: NodeIndex, tag: Ir.Inst.Tag) Error!Ir.Ref { | |
| 1224 | const bin = c.node_data[@intFromEnum(node)].bin; | |
| 1225 | const ty = c.node_ty[@intFromEnum(node)]; | |
| 1226 | const rhs = try c.genExpr(bin.rhs); | |
| 1227 | const lhs = try c.genLval(bin.lhs); | |
| 1228 | const res = try c.addBin(tag, lhs, rhs, ty); | |
| 1229 | try c.builder.addStore(lhs, res); | |
| 1230 | return res; | |
| 1231 | } | |
| 1232 | ||
| 1233 | fn genBinOp(c: *CodeGen, node: NodeIndex, tag: Ir.Inst.Tag) Error!Ir.Ref { | |
| 1234 | const bin = c.node_data[@intFromEnum(node)].bin; | |
| 1235 | const ty = c.node_ty[@intFromEnum(node)]; | |
| 1236 | const lhs = try c.genExpr(bin.lhs); | |
| 1237 | const rhs = try c.genExpr(bin.rhs); | |
| 1238 | return c.addBin(tag, lhs, rhs, ty); | |
| 1239 | } | |
| 1240 | ||
| 1241 | fn genComparison(c: *CodeGen, node: NodeIndex, tag: Ir.Inst.Tag) Error!Ir.Ref { | |
| 1242 | const bin = c.node_data[@intFromEnum(node)].bin; | |
| 1243 | const lhs = try c.genExpr(bin.lhs); | |
| 1244 | const rhs = try c.genExpr(bin.rhs); | |
| 1245 | ||
| 1246 | return c.builder.addInst(tag, .{ .bin = .{ .lhs = lhs, .rhs = rhs } }, .i1); | |
| 1247 | } | |
| 1248 | ||
| 1249 | fn genPtrArithmetic(c: *CodeGen, ptr: Ir.Ref, offset: Ir.Ref, offset_ty: Type, ty: Type) Error!Ir.Ref { | |
| 1250 | // TODO consider adding a getelemptr instruction | |
| 1251 | const size = ty.elemType().sizeof(c.comp).?; | |
| 1252 | if (size == 1) { | |
| 1253 | return c.builder.addInst(.add, .{ .bin = .{ .lhs = ptr, .rhs = offset } }, try c.genType(ty)); | |
| 1254 | } | |
| 1255 | ||
| 1256 | const size_inst = try c.builder.addConstant(Value.int(size), try c.genType(offset_ty)); | |
| 1257 | const offset_inst = try c.addBin(.mul, offset, size_inst, offset_ty); | |
| 1258 | return c.addBin(.add, ptr, offset_inst, offset_ty); | |
| 1259 | } | |
| 1260 | ||
| 1261 | fn genInitializer(c: *CodeGen, ptr: Ir.Ref, dest_ty: Type, initializer: NodeIndex) Error!void { | |
| 1262 | std.debug.assert(initializer != .none); | |
| 1263 | switch (c.node_tag[@intFromEnum(initializer)]) { | |
| 1264 | .array_init_expr_two, | |
| 1265 | .array_init_expr, | |
| 1266 | .struct_init_expr_two, | |
| 1267 | .struct_init_expr, | |
| 1268 | .union_init_expr, | |
| 1269 | .array_filler_expr, | |
| 1270 | .default_init_expr, | |
| 1271 | => return c.comp.diag.fatalNoSrc("TODO CodeGen.genInitializer {}\n", .{c.node_tag[@intFromEnum(initializer)]}), | |
| 1272 | .string_literal_expr => { | |
| 1273 | const val = c.tree.value_map.get(initializer).?; | |
| 1274 | const str_ptr = try c.builder.addConstant(val, .ptr); | |
| 1275 | if (dest_ty.isArray()) { | |
| 1276 | return c.comp.diag.fatalNoSrc("TODO memcpy\n", .{}); | |
| 1277 | } else { | |
| 1278 | try c.builder.addStore(ptr, str_ptr); | |
| 1279 | } | |
| 1280 | }, | |
| 1281 | else => { | |
| 1282 | const res = try c.genExpr(initializer); | |
| 1283 | try c.builder.addStore(ptr, res); | |
| 1284 | }, | |
| 1285 | } | |
| 1286 | } | |
| 1287 | ||
| 1288 | fn genVar(c: *CodeGen, decl: NodeIndex) Error!void { | |
| 1289 | _ = decl; | |
| 1290 | return c.comp.diag.fatalNoSrc("TODO CodeGen.genVar\n", .{}); | |
| 1291 | } |
deps/aro/Codegen_legacy.zig created+108| ... | ... | @@ -0,0 +1,108 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Compilation = @import("Compilation.zig"); | |
| 3 | const Tree = @import("Tree.zig"); | |
| 4 | const NodeIndex = Tree.NodeIndex; | |
| 5 | const Object = @import("Object.zig"); | |
| 6 | const x86_64 = @import("codegen/x86_64.zig"); | |
| 7 | ||
| 8 | const Codegen = @This(); | |
| 9 | ||
| 10 | comp: *Compilation, | |
| 11 | tree: Tree, | |
| 12 | obj: *Object, | |
| 13 | node_tag: []const Tree.Tag, | |
| 14 | node_data: []const Tree.Node.Data, | |
| 15 | ||
| 16 | pub const Error = Compilation.Error || error{CodegenFailed}; | |
| 17 | ||
| 18 | /// Generate tree to an object file. | |
| 19 | /// Caller is responsible for flushing and freeing the returned object. | |
| 20 | pub fn generateTree(comp: *Compilation, tree: Tree) Compilation.Error!*Object { | |
| 21 | var c = Codegen{ | |
| 22 | .comp = comp, | |
| 23 | .tree = tree, | |
| 24 | .obj = try Object.create(comp), | |
| 25 | .node_tag = tree.nodes.items(.tag), | |
| 26 | .node_data = tree.nodes.items(.data), | |
| 27 | }; | |
| 28 | errdefer c.obj.deinit(); | |
| 29 | ||
| 30 | const node_tags = tree.nodes.items(.tag); | |
| 31 | for (tree.root_decls) |decl| { | |
| 32 | switch (node_tags[@intFromEnum(decl)]) { | |
| 33 | // these produce no code | |
| 34 | .static_assert, | |
| 35 | .typedef, | |
| 36 | .struct_decl_two, | |
| 37 | .union_decl_two, | |
| 38 | .enum_decl_two, | |
| 39 | .struct_decl, | |
| 40 | .union_decl, | |
| 41 | .enum_decl, | |
| 42 | .struct_forward_decl, | |
| 43 | .union_forward_decl, | |
| 44 | .enum_forward_decl, | |
| 45 | => {}, | |
| 46 | ||
| 47 | // define symbol | |
| 48 | .fn_proto, | |
| 49 | .static_fn_proto, | |
| 50 | .inline_fn_proto, | |
| 51 | .inline_static_fn_proto, | |
| 52 | .extern_var, | |
| 53 | .threadlocal_extern_var, | |
| 54 | => { | |
| 55 | const name = c.tree.tokSlice(c.node_data[@intFromEnum(decl)].decl.name); | |
| 56 | _ = try c.obj.declareSymbol(.undefined, name, .Strong, .external, 0, 0); | |
| 57 | }, | |
| 58 | ||
| 59 | // function definition | |
| 60 | .fn_def, | |
| 61 | .static_fn_def, | |
| 62 | .inline_fn_def, | |
| 63 | .inline_static_fn_def, | |
| 64 | => c.genFn(decl) catch |err| switch (err) { | |
| 65 | error.FatalError => return error.FatalError, | |
| 66 | error.OutOfMemory => return error.OutOfMemory, | |
| 67 | error.CodegenFailed => continue, | |
| 68 | }, | |
| 69 | ||
| 70 | .@"var", | |
| 71 | .static_var, | |
| 72 | .threadlocal_var, | |
| 73 | .threadlocal_static_var, | |
| 74 | .implicit_static_var, | |
| 75 | => c.genVar(decl) catch |err| switch (err) { | |
| 76 | error.FatalError => return error.FatalError, | |
| 77 | error.OutOfMemory => return error.OutOfMemory, | |
| 78 | error.CodegenFailed => continue, | |
| 79 | }, | |
| 80 | ||
| 81 | // TODO | |
| 82 | .file_scope_asm => {}, | |
| 83 | ||
| 84 | else => unreachable, | |
| 85 | } | |
| 86 | } | |
| 87 | ||
| 88 | return c.obj; | |
| 89 | } | |
| 90 | ||
| 91 | fn genFn(c: *Codegen, decl: NodeIndex) Error!void { | |
| 92 | const section: Object.Section = .func; | |
| 93 | const data = try c.obj.getSection(section); | |
| 94 | const start_len = data.items.len; | |
| 95 | switch (c.comp.target.cpu.arch) { | |
| 96 | .x86_64 => try x86_64.genFn(c, decl, data), | |
| 97 | else => unreachable, | |
| 98 | } | |
| 99 | const name = c.tree.tokSlice(c.node_data[@intFromEnum(decl)].decl.name); | |
| 100 | _ = try c.obj.declareSymbol(section, name, .Strong, .func, start_len, data.items.len - start_len); | |
| 101 | } | |
| 102 | ||
| 103 | fn genVar(c: *Codegen, decl: NodeIndex) Error!void { | |
| 104 | switch (c.comp.target.cpu.arch) { | |
| 105 | .x86_64 => try x86_64.genVar(c, decl), | |
| 106 | else => unreachable, | |
| 107 | } | |
| 108 | } |
deps/aro/Compilation.zig created+1491| ... | ... | @@ -0,0 +1,1491 @@ |
| 1 | const std = @import("std"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | const mem = std.mem; | |
| 4 | const Allocator = mem.Allocator; | |
| 5 | const EpochSeconds = std.time.epoch.EpochSeconds; | |
| 6 | const Builtins = @import("Builtins.zig"); | |
| 7 | const Diagnostics = @import("Diagnostics.zig"); | |
| 8 | const LangOpts = @import("LangOpts.zig"); | |
| 9 | const Source = @import("Source.zig"); | |
| 10 | const Tokenizer = @import("Tokenizer.zig"); | |
| 11 | const Token = Tokenizer.Token; | |
| 12 | const Type = @import("Type.zig"); | |
| 13 | const Pragma = @import("Pragma.zig"); | |
| 14 | const StringInterner = @import("StringInterner.zig"); | |
| 15 | const record_layout = @import("record_layout.zig"); | |
| 16 | const target_util = @import("target.zig"); | |
| 17 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 18 | ||
| 19 | const Compilation = @This(); | |
| 20 | ||
| 21 | pub const Error = error{ | |
| 22 | /// A fatal error has ocurred and compilation has stopped. | |
| 23 | FatalError, | |
| 24 | } || Allocator.Error; | |
| 25 | ||
| 26 | pub const bit_int_max_bits = 128; | |
| 27 | const path_buf_stack_limit = 1024; | |
| 28 | ||
| 29 | /// Environment variables used during compilation / linking. | |
| 30 | pub const Environment = struct { | |
| 31 | /// Directory to use for temporary files | |
| 32 | /// TODO: not implemented yet | |
| 33 | tmpdir: ?[]const u8 = null, | |
| 34 | ||
| 35 | /// PATH environment variable used to search for programs | |
| 36 | path: ?[]const u8 = null, | |
| 37 | ||
| 38 | /// Directories to try when searching for subprograms. | |
| 39 | /// TODO: not implemented yet | |
| 40 | compiler_path: ?[]const u8 = null, | |
| 41 | ||
| 42 | /// Directories to try when searching for special linker files, if compiling for the native target | |
| 43 | /// TODO: not implemented yet | |
| 44 | library_path: ?[]const u8 = null, | |
| 45 | ||
| 46 | /// List of directories to be searched as if specified with -I, but after any paths given with -I options on the command line | |
| 47 | /// Used regardless of the language being compiled | |
| 48 | /// TODO: not implemented yet | |
| 49 | cpath: ?[]const u8 = null, | |
| 50 | ||
| 51 | /// List of directories to be searched as if specified with -I, but after any paths given with -I options on the command line | |
| 52 | /// Used if the language being compiled is C | |
| 53 | /// TODO: not implemented yet | |
| 54 | c_include_path: ?[]const u8 = null, | |
| 55 | ||
| 56 | /// UNIX timestamp to be used instead of the current date and time in the __DATE__ and __TIME__ macros | |
| 57 | source_date_epoch: ?[]const u8 = null, | |
| 58 | ||
| 59 | /// Load all of the environment variables using the std.process API. Do not use if using Aro as a shared library on Linux without libc | |
| 60 | /// See https://github.com/ziglang/zig/issues/4524 | |
| 61 | /// Assumes that `self` has been default-initialized | |
| 62 | pub fn loadAll(self: *Environment, allocator: std.mem.Allocator) !void { | |
| 63 | errdefer self.deinit(allocator); | |
| 64 | ||
| 65 | inline for (@typeInfo(@TypeOf(self.*)).Struct.fields) |field| { | |
| 66 | std.debug.assert(@field(self, field.name) == null); | |
| 67 | ||
| 68 | var env_var_buf: [field.name.len]u8 = undefined; | |
| 69 | const env_var_name = std.ascii.upperString(&env_var_buf, field.name); | |
| 70 | const val: ?[]const u8 = std.process.getEnvVarOwned(allocator, env_var_name) catch |err| switch (err) { | |
| 71 | error.OutOfMemory => |e| return e, | |
| 72 | error.EnvironmentVariableNotFound => null, | |
| 73 | error.InvalidUtf8 => null, | |
| 74 | }; | |
| 75 | @field(self, field.name) = val; | |
| 76 | } | |
| 77 | } | |
| 78 | ||
| 79 | /// Use this only if environment slices were allocated with `allocator` (such as via `loadAll`) | |
| 80 | pub fn deinit(self: *Environment, allocator: std.mem.Allocator) void { | |
| 81 | inline for (@typeInfo(@TypeOf(self.*)).Struct.fields) |field| { | |
| 82 | if (@field(self, field.name)) |slice| { | |
| 83 | allocator.free(slice); | |
| 84 | } | |
| 85 | } | |
| 86 | self.* = undefined; | |
| 87 | } | |
| 88 | }; | |
| 89 | ||
| 90 | gpa: Allocator, | |
| 91 | environment: Environment = .{}, | |
| 92 | sources: std.StringArrayHashMap(Source), | |
| 93 | diag: Diagnostics, | |
| 94 | include_dirs: std.ArrayList([]const u8), | |
| 95 | system_include_dirs: std.ArrayList([]const u8), | |
| 96 | target: std.Target = @import("builtin").target, | |
| 97 | pragma_handlers: std.StringArrayHashMap(*Pragma), | |
| 98 | langopts: LangOpts = .{}, | |
| 99 | generated_buf: std.ArrayList(u8), | |
| 100 | builtins: Builtins = .{}, | |
| 101 | types: struct { | |
| 102 | wchar: Type = undefined, | |
| 103 | ptrdiff: Type = undefined, | |
| 104 | size: Type = undefined, | |
| 105 | va_list: Type = undefined, | |
| 106 | pid_t: Type = undefined, | |
| 107 | ns_constant_string: struct { | |
| 108 | ty: Type = undefined, | |
| 109 | record: Type.Record = undefined, | |
| 110 | fields: [4]Type.Record.Field = undefined, | |
| 111 | int_ty: Type = .{ .specifier = .int, .qual = .{ .@"const" = true } }, | |
| 112 | char_ty: Type = .{ .specifier = .char, .qual = .{ .@"const" = true } }, | |
| 113 | } = .{}, | |
| 114 | file: Type = .{ .specifier = .invalid }, | |
| 115 | jmp_buf: Type = .{ .specifier = .invalid }, | |
| 116 | sigjmp_buf: Type = .{ .specifier = .invalid }, | |
| 117 | ucontext_t: Type = .{ .specifier = .invalid }, | |
| 118 | intmax: Type = .{ .specifier = .invalid }, | |
| 119 | intptr: Type = .{ .specifier = .invalid }, | |
| 120 | int16: Type = .{ .specifier = .invalid }, | |
| 121 | int64: Type = .{ .specifier = .invalid }, | |
| 122 | } = .{}, | |
| 123 | /// Mapping from Source.Id to byte offset of first non-utf8 byte | |
| 124 | invalid_utf8_locs: std.AutoHashMapUnmanaged(Source.Id, u32) = .{}, | |
| 125 | string_interner: StringInterner = .{}, | |
| 126 | ||
| 127 | pub fn init(gpa: Allocator) Compilation { | |
| 128 | return .{ | |
| 129 | .gpa = gpa, | |
| 130 | .sources = std.StringArrayHashMap(Source).init(gpa), | |
| 131 | .diag = Diagnostics.init(gpa), | |
| 132 | .include_dirs = std.ArrayList([]const u8).init(gpa), | |
| 133 | .system_include_dirs = std.ArrayList([]const u8).init(gpa), | |
| 134 | .pragma_handlers = std.StringArrayHashMap(*Pragma).init(gpa), | |
| 135 | .generated_buf = std.ArrayList(u8).init(gpa), | |
| 136 | }; | |
| 137 | } | |
| 138 | ||
| 139 | pub fn deinit(comp: *Compilation) void { | |
| 140 | for (comp.pragma_handlers.values()) |pragma| { | |
| 141 | pragma.deinit(pragma, comp); | |
| 142 | } | |
| 143 | for (comp.sources.values()) |source| { | |
| 144 | comp.gpa.free(source.path); | |
| 145 | comp.gpa.free(source.buf); | |
| 146 | comp.gpa.free(source.splice_locs); | |
| 147 | } | |
| 148 | comp.sources.deinit(); | |
| 149 | comp.diag.deinit(); | |
| 150 | comp.include_dirs.deinit(); | |
| 151 | for (comp.system_include_dirs.items) |path| comp.gpa.free(path); | |
| 152 | comp.system_include_dirs.deinit(); | |
| 153 | comp.pragma_handlers.deinit(); | |
| 154 | comp.generated_buf.deinit(); | |
| 155 | comp.builtins.deinit(comp.gpa); | |
| 156 | comp.invalid_utf8_locs.deinit(comp.gpa); | |
| 157 | comp.string_interner.deinit(comp.gpa); | |
| 158 | } | |
| 159 | ||
| 160 | pub fn intern(comp: *Compilation, str: []const u8) !StringInterner.StringId { | |
| 161 | return comp.string_interner.intern(comp.gpa, str); | |
| 162 | } | |
| 163 | ||
| 164 | pub fn getSourceEpoch(self: *const Compilation, max: i64) !?i64 { | |
| 165 | const provided = self.environment.source_date_epoch orelse return null; | |
| 166 | const parsed = std.fmt.parseInt(i64, provided, 10) catch return error.InvalidEpoch; | |
| 167 | if (parsed < 0 or parsed > max) return error.InvalidEpoch; | |
| 168 | return parsed; | |
| 169 | } | |
| 170 | ||
| 171 | /// Dec 31 9999 23:59:59 | |
| 172 | const max_timestamp = 253402300799; | |
| 173 | ||
| 174 | fn getTimestamp(comp: *Compilation) !u47 { | |
| 175 | const provided: ?i64 = comp.getSourceEpoch(max_timestamp) catch blk: { | |
| 176 | try comp.diag.add(.{ | |
| 177 | .tag = .invalid_source_epoch, | |
| 178 | .loc = .{ .id = .unused, .byte_offset = 0, .line = 0 }, | |
| 179 | }, &.{}); | |
| 180 | break :blk null; | |
| 181 | }; | |
| 182 | const timestamp = provided orelse std.time.timestamp(); | |
| 183 | return @intCast(std.math.clamp(timestamp, 0, max_timestamp)); | |
| 184 | } | |
| 185 | ||
| 186 | fn generateDateAndTime(w: anytype, timestamp: u47) !void { | |
| 187 | const epoch_seconds = EpochSeconds{ .secs = timestamp }; | |
| 188 | const epoch_day = epoch_seconds.getEpochDay(); | |
| 189 | const day_seconds = epoch_seconds.getDaySeconds(); | |
| 190 | const year_day = epoch_day.calculateYearDay(); | |
| 191 | const month_day = year_day.calculateMonthDay(); | |
| 192 | ||
| 193 | const month_names = [_][]const u8{ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; | |
| 194 | std.debug.assert(std.time.epoch.Month.jan.numeric() == 1); | |
| 195 | ||
| 196 | const month_name = month_names[month_day.month.numeric() - 1]; | |
| 197 | try w.print("#define __DATE__ \"{s} {d: >2} {d}\"\n", .{ | |
| 198 | month_name, | |
| 199 | month_day.day_index + 1, | |
| 200 | year_day.year, | |
| 201 | }); | |
| 202 | try w.print("#define __TIME__ \"{d:0>2}:{d:0>2}:{d:0>2}\"\n", .{ | |
| 203 | day_seconds.getHoursIntoDay(), | |
| 204 | day_seconds.getMinutesIntoHour(), | |
| 205 | day_seconds.getSecondsIntoMinute(), | |
| 206 | }); | |
| 207 | ||
| 208 | const day_names = [_][]const u8{ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" }; | |
| 209 | // days since Thu Oct 1 1970 | |
| 210 | const day_name = day_names[@intCast((epoch_day.day + 3) % 7)]; | |
| 211 | try w.print("#define __TIMESTAMP__ \"{s} {s} {d: >2} {d:0>2}:{d:0>2}:{d:0>2} {d}\"\n", .{ | |
| 212 | day_name, | |
| 213 | month_name, | |
| 214 | month_day.day_index + 1, | |
| 215 | day_seconds.getHoursIntoDay(), | |
| 216 | day_seconds.getMinutesIntoHour(), | |
| 217 | day_seconds.getSecondsIntoMinute(), | |
| 218 | year_day.year, | |
| 219 | }); | |
| 220 | } | |
| 221 | ||
| 222 | /// Generate builtin macros that will be available to each source file. | |
| 223 | pub fn generateBuiltinMacros(comp: *Compilation) !Source { | |
| 224 | try comp.generateBuiltinTypes(); | |
| 225 | ||
| 226 | var buf = std.ArrayList(u8).init(comp.gpa); | |
| 227 | defer buf.deinit(); | |
| 228 | const w = buf.writer(); | |
| 229 | ||
| 230 | // standard macros | |
| 231 | try w.writeAll( | |
| 232 | \\#define __VERSION__ "Aro | |
| 233 | ++ @import("lib.zig").version_str ++ "\"\n" ++ | |
| 234 | \\#define __Aro__ | |
| 235 | \\#define __STDC__ 1 | |
| 236 | \\#define __STDC_HOSTED__ 1 | |
| 237 | \\#define __STDC_NO_ATOMICS__ 1 | |
| 238 | \\#define __STDC_NO_COMPLEX__ 1 | |
| 239 | \\#define __STDC_NO_THREADS__ 1 | |
| 240 | \\#define __STDC_NO_VLA__ 1 | |
| 241 | \\ | |
| 242 | ); | |
| 243 | if (comp.langopts.standard.StdCVersionMacro()) |stdc_version| { | |
| 244 | try w.print("#define __STDC_VERSION__ {s}\n", .{stdc_version}); | |
| 245 | } | |
| 246 | const ptr_width = comp.target.ptrBitWidth(); | |
| 247 | ||
| 248 | // os macros | |
| 249 | switch (comp.target.os.tag) { | |
| 250 | .linux => try w.writeAll( | |
| 251 | \\#define linux 1 | |
| 252 | \\#define __linux 1 | |
| 253 | \\#define __linux__ 1 | |
| 254 | \\ | |
| 255 | ), | |
| 256 | .windows => if (ptr_width == 32) try w.writeAll( | |
| 257 | \\#define WIN32 1 | |
| 258 | \\#define _WIN32 1 | |
| 259 | \\#define __WIN32 1 | |
| 260 | \\#define __WIN32__ 1 | |
| 261 | \\ | |
| 262 | ) else try w.writeAll( | |
| 263 | \\#define WIN32 1 | |
| 264 | \\#define WIN64 1 | |
| 265 | \\#define _WIN32 1 | |
| 266 | \\#define _WIN64 1 | |
| 267 | \\#define __WIN32 1 | |
| 268 | \\#define __WIN64 1 | |
| 269 | \\#define __WIN32__ 1 | |
| 270 | \\#define __WIN64__ 1 | |
| 271 | \\ | |
| 272 | ), | |
| 273 | .freebsd => try w.print("#define __FreeBSD__ {d}\n", .{comp.target.os.version_range.semver.min.major}), | |
| 274 | .netbsd => try w.writeAll("#define __NetBSD__ 1\n"), | |
| 275 | .openbsd => try w.writeAll("#define __OpenBSD__ 1\n"), | |
| 276 | .dragonfly => try w.writeAll("#define __DragonFly__ 1\n"), | |
| 277 | .solaris => try w.writeAll( | |
| 278 | \\#define sun 1 | |
| 279 | \\#define __sun 1 | |
| 280 | \\ | |
| 281 | ), | |
| 282 | .macos => try w.writeAll( | |
| 283 | \\#define __APPLE__ 1 | |
| 284 | \\#define __MACH__ 1 | |
| 285 | \\ | |
| 286 | ), | |
| 287 | else => {}, | |
| 288 | } | |
| 289 | ||
| 290 | // unix and other additional os macros | |
| 291 | switch (comp.target.os.tag) { | |
| 292 | .freebsd, | |
| 293 | .netbsd, | |
| 294 | .openbsd, | |
| 295 | .dragonfly, | |
| 296 | .linux, | |
| 297 | => try w.writeAll( | |
| 298 | \\#define unix 1 | |
| 299 | \\#define __unix 1 | |
| 300 | \\#define __unix__ 1 | |
| 301 | \\ | |
| 302 | ), | |
| 303 | else => {}, | |
| 304 | } | |
| 305 | if (comp.target.abi == .android) { | |
| 306 | try w.writeAll("#define __ANDROID__ 1\n"); | |
| 307 | } | |
| 308 | ||
| 309 | // architecture macros | |
| 310 | switch (comp.target.cpu.arch) { | |
| 311 | .x86_64 => try w.writeAll( | |
| 312 | \\#define __amd64__ 1 | |
| 313 | \\#define __amd64 1 | |
| 314 | \\#define __x86_64 1 | |
| 315 | \\#define __x86_64__ 1 | |
| 316 | \\ | |
| 317 | ), | |
| 318 | .x86 => try w.writeAll( | |
| 319 | \\#define i386 1 | |
| 320 | \\#define __i386 1 | |
| 321 | \\#define __i386__ 1 | |
| 322 | \\ | |
| 323 | ), | |
| 324 | .mips, | |
| 325 | .mipsel, | |
| 326 | .mips64, | |
| 327 | .mips64el, | |
| 328 | => try w.writeAll( | |
| 329 | \\#define __mips__ 1 | |
| 330 | \\#define mips 1 | |
| 331 | \\ | |
| 332 | ), | |
| 333 | .powerpc, | |
| 334 | .powerpcle, | |
| 335 | => try w.writeAll( | |
| 336 | \\#define __powerpc__ 1 | |
| 337 | \\#define __POWERPC__ 1 | |
| 338 | \\#define __ppc__ 1 | |
| 339 | \\#define __PPC__ 1 | |
| 340 | \\#define _ARCH_PPC 1 | |
| 341 | \\ | |
| 342 | ), | |
| 343 | .powerpc64, | |
| 344 | .powerpc64le, | |
| 345 | => try w.writeAll( | |
| 346 | \\#define __powerpc 1 | |
| 347 | \\#define __powerpc__ 1 | |
| 348 | \\#define __powerpc64__ 1 | |
| 349 | \\#define __POWERPC__ 1 | |
| 350 | \\#define __ppc__ 1 | |
| 351 | \\#define __ppc64__ 1 | |
| 352 | \\#define __PPC__ 1 | |
| 353 | \\#define __PPC64__ 1 | |
| 354 | \\#define _ARCH_PPC 1 | |
| 355 | \\#define _ARCH_PPC64 1 | |
| 356 | \\ | |
| 357 | ), | |
| 358 | .sparc64 => try w.writeAll( | |
| 359 | \\#define __sparc__ 1 | |
| 360 | \\#define __sparc 1 | |
| 361 | \\#define __sparc_v9__ 1 | |
| 362 | \\ | |
| 363 | ), | |
| 364 | .sparc, .sparcel => try w.writeAll( | |
| 365 | \\#define __sparc__ 1 | |
| 366 | \\#define __sparc 1 | |
| 367 | \\ | |
| 368 | ), | |
| 369 | .arm, .armeb => try w.writeAll( | |
| 370 | \\#define __arm__ 1 | |
| 371 | \\#define __arm 1 | |
| 372 | \\ | |
| 373 | ), | |
| 374 | .thumb, .thumbeb => try w.writeAll( | |
| 375 | \\#define __arm__ 1 | |
| 376 | \\#define __arm 1 | |
| 377 | \\#define __thumb__ 1 | |
| 378 | \\ | |
| 379 | ), | |
| 380 | .aarch64, .aarch64_be => try w.writeAll("#define __aarch64__ 1\n"), | |
| 381 | .msp430 => try w.writeAll( | |
| 382 | \\#define MSP430 1 | |
| 383 | \\#define __MSP430__ 1 | |
| 384 | \\ | |
| 385 | ), | |
| 386 | else => {}, | |
| 387 | } | |
| 388 | ||
| 389 | if (comp.target.os.tag != .windows) switch (ptr_width) { | |
| 390 | 64 => try w.writeAll( | |
| 391 | \\#define _LP64 1 | |
| 392 | \\#define __LP64__ 1 | |
| 393 | \\ | |
| 394 | ), | |
| 395 | 32 => try w.writeAll("#define _ILP32 1\n"), | |
| 396 | else => {}, | |
| 397 | }; | |
| 398 | ||
| 399 | try w.writeAll( | |
| 400 | \\#define __ORDER_LITTLE_ENDIAN__ 1234 | |
| 401 | \\#define __ORDER_BIG_ENDIAN__ 4321 | |
| 402 | \\#define __ORDER_PDP_ENDIAN__ 3412 | |
| 403 | \\ | |
| 404 | ); | |
| 405 | if (comp.target.cpu.arch.endian() == .Little) try w.writeAll( | |
| 406 | \\#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ | |
| 407 | \\#define __LITTLE_ENDIAN__ 1 | |
| 408 | \\ | |
| 409 | ) else try w.writeAll( | |
| 410 | \\#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__ | |
| 411 | \\#define __BIG_ENDIAN__ 1 | |
| 412 | \\ | |
| 413 | ); | |
| 414 | ||
| 415 | // timestamps | |
| 416 | const timestamp = try comp.getTimestamp(); | |
| 417 | try generateDateAndTime(w, timestamp); | |
| 418 | ||
| 419 | // types | |
| 420 | if (comp.getCharSignedness() == .unsigned) try w.writeAll("#define __CHAR_UNSIGNED__ 1\n"); | |
| 421 | try w.writeAll("#define __CHAR_BIT__ 8\n"); | |
| 422 | ||
| 423 | // int maxs | |
| 424 | try comp.generateIntWidth(w, "BOOL", .{ .specifier = .bool }); | |
| 425 | try comp.generateIntMaxAndWidth(w, "SCHAR", .{ .specifier = .schar }); | |
| 426 | try comp.generateIntMaxAndWidth(w, "SHRT", .{ .specifier = .short }); | |
| 427 | try comp.generateIntMaxAndWidth(w, "INT", .{ .specifier = .int }); | |
| 428 | try comp.generateIntMaxAndWidth(w, "LONG", .{ .specifier = .long }); | |
| 429 | try comp.generateIntMaxAndWidth(w, "LONG_LONG", .{ .specifier = .long_long }); | |
| 430 | try comp.generateIntMaxAndWidth(w, "WCHAR", comp.types.wchar); | |
| 431 | // try comp.generateIntMax(w, "WINT", comp.types.wchar); | |
| 432 | try comp.generateIntMaxAndWidth(w, "INTMAX", comp.types.intmax); | |
| 433 | try comp.generateIntMaxAndWidth(w, "SIZE", comp.types.size); | |
| 434 | try comp.generateIntMaxAndWidth(w, "UINTMAX", comp.types.intmax.makeIntegerUnsigned()); | |
| 435 | try comp.generateIntMaxAndWidth(w, "PTRDIFF", comp.types.ptrdiff); | |
| 436 | try comp.generateIntMaxAndWidth(w, "INTPTR", comp.types.intptr); | |
| 437 | try comp.generateIntMaxAndWidth(w, "UINTPTR", comp.types.intptr.makeIntegerUnsigned()); | |
| 438 | ||
| 439 | // int widths | |
| 440 | try w.print("#define __BITINT_MAXWIDTH__ {d}\n", .{bit_int_max_bits}); | |
| 441 | ||
| 442 | // sizeof types | |
| 443 | try comp.generateSizeofType(w, "__SIZEOF_FLOAT__", .{ .specifier = .float }); | |
| 444 | try comp.generateSizeofType(w, "__SIZEOF_DOUBLE__", .{ .specifier = .double }); | |
| 445 | try comp.generateSizeofType(w, "__SIZEOF_LONG_DOUBLE__", .{ .specifier = .long_double }); | |
| 446 | try comp.generateSizeofType(w, "__SIZEOF_SHORT__", .{ .specifier = .short }); | |
| 447 | try comp.generateSizeofType(w, "__SIZEOF_INT__", .{ .specifier = .int }); | |
| 448 | try comp.generateSizeofType(w, "__SIZEOF_LONG__", .{ .specifier = .long }); | |
| 449 | try comp.generateSizeofType(w, "__SIZEOF_LONG_LONG__", .{ .specifier = .long_long }); | |
| 450 | try comp.generateSizeofType(w, "__SIZEOF_POINTER__", .{ .specifier = .pointer }); | |
| 451 | try comp.generateSizeofType(w, "__SIZEOF_PTRDIFF_T__", comp.types.ptrdiff); | |
| 452 | try comp.generateSizeofType(w, "__SIZEOF_SIZE_T__", comp.types.size); | |
| 453 | try comp.generateSizeofType(w, "__SIZEOF_WCHAR_T__", comp.types.wchar); | |
| 454 | // try comp.generateSizeofType(w, "__SIZEOF_WINT_T__", .{ .specifier = .pointer }); | |
| 455 | ||
| 456 | // various int types | |
| 457 | const mapper = comp.string_interner.getSlowTypeMapper(); | |
| 458 | try generateTypeMacro(w, mapper, "__INTPTR_TYPE__", comp.types.intptr, comp.langopts); | |
| 459 | try generateTypeMacro(w, mapper, "__UINTPTR_TYPE__", comp.types.intptr.makeIntegerUnsigned(), comp.langopts); | |
| 460 | ||
| 461 | try generateTypeMacro(w, mapper, "__INTMAX_TYPE__", comp.types.intmax, comp.langopts); | |
| 462 | try comp.generateSuffixMacro("__INTMAX", w, comp.types.intptr); | |
| 463 | ||
| 464 | try generateTypeMacro(w, mapper, "__UINTMAX_TYPE__", comp.types.intmax.makeIntegerUnsigned(), comp.langopts); | |
| 465 | try comp.generateSuffixMacro("__UINTMAX", w, comp.types.intptr.makeIntegerUnsigned()); | |
| 466 | ||
| 467 | try generateTypeMacro(w, mapper, "__PTRDIFF_TYPE__", comp.types.ptrdiff, comp.langopts); | |
| 468 | try generateTypeMacro(w, mapper, "__SIZE_TYPE__", comp.types.size, comp.langopts); | |
| 469 | try generateTypeMacro(w, mapper, "__WCHAR_TYPE__", comp.types.wchar, comp.langopts); | |
| 470 | ||
| 471 | try comp.generateExactWidthTypes(w, mapper); | |
| 472 | ||
| 473 | if (target_util.FPSemantics.halfPrecisionType(comp.target)) |half| { | |
| 474 | try generateFloatMacros(w, "FLT16", half, "F16"); | |
| 475 | } | |
| 476 | try generateFloatMacros(w, "FLT", target_util.FPSemantics.forType(.float, comp.target), "F"); | |
| 477 | try generateFloatMacros(w, "DBL", target_util.FPSemantics.forType(.double, comp.target), ""); | |
| 478 | try generateFloatMacros(w, "LDBL", target_util.FPSemantics.forType(.longdouble, comp.target), "L"); | |
| 479 | ||
| 480 | // TODO: clang treats __FLT_EVAL_METHOD__ as a special-cased macro because evaluating it within a scope | |
| 481 | // where `#pragma clang fp eval_method(X)` has been called produces an error diagnostic. | |
| 482 | const flt_eval_method = comp.langopts.fp_eval_method orelse target_util.defaultFpEvalMethod(comp.target); | |
| 483 | try w.print("#define __FLT_EVAL_METHOD__ {d}\n", .{@intFromEnum(flt_eval_method)}); | |
| 484 | ||
| 485 | try w.writeAll( | |
| 486 | \\#define __FLT_RADIX__ 2 | |
| 487 | \\#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__ | |
| 488 | \\ | |
| 489 | ); | |
| 490 | ||
| 491 | return comp.addSourceFromBuffer("<builtin>", buf.items); | |
| 492 | } | |
| 493 | ||
| 494 | fn generateFloatMacros(w: anytype, prefix: []const u8, semantics: target_util.FPSemantics, ext: []const u8) !void { | |
| 495 | const denormMin = semantics.chooseValue( | |
| 496 | []const u8, | |
| 497 | .{ | |
| 498 | "5.9604644775390625e-8", | |
| 499 | "1.40129846e-45", | |
| 500 | "4.9406564584124654e-324", | |
| 501 | "3.64519953188247460253e-4951", | |
| 502 | "4.94065645841246544176568792868221e-324", | |
| 503 | "6.47517511943802511092443895822764655e-4966", | |
| 504 | }, | |
| 505 | ); | |
| 506 | const digits = semantics.chooseValue(i32, .{ 3, 6, 15, 18, 31, 33 }); | |
| 507 | const decimalDigits = semantics.chooseValue(i32, .{ 5, 9, 17, 21, 33, 36 }); | |
| 508 | const epsilon = semantics.chooseValue( | |
| 509 | []const u8, | |
| 510 | .{ | |
| 511 | "9.765625e-4", | |
| 512 | "1.19209290e-7", | |
| 513 | "2.2204460492503131e-16", | |
| 514 | "1.08420217248550443401e-19", | |
| 515 | "4.94065645841246544176568792868221e-324", | |
| 516 | "1.92592994438723585305597794258492732e-34", | |
| 517 | }, | |
| 518 | ); | |
| 519 | const mantissaDigits = semantics.chooseValue(i32, .{ 11, 24, 53, 64, 106, 113 }); | |
| 520 | ||
| 521 | const min10Exp = semantics.chooseValue(i32, .{ -4, -37, -307, -4931, -291, -4931 }); | |
| 522 | const max10Exp = semantics.chooseValue(i32, .{ 4, 38, 308, 4932, 308, 4932 }); | |
| 523 | ||
| 524 | const minExp = semantics.chooseValue(i32, .{ -13, -125, -1021, -16381, -968, -16381 }); | |
| 525 | const maxExp = semantics.chooseValue(i32, .{ 16, 128, 1024, 16384, 1024, 16384 }); | |
| 526 | ||
| 527 | const min = semantics.chooseValue( | |
| 528 | []const u8, | |
| 529 | .{ | |
| 530 | "6.103515625e-5", | |
| 531 | "1.17549435e-38", | |
| 532 | "2.2250738585072014e-308", | |
| 533 | "3.36210314311209350626e-4932", | |
| 534 | "2.00416836000897277799610805135016e-292", | |
| 535 | "3.36210314311209350626267781732175260e-4932", | |
| 536 | }, | |
| 537 | ); | |
| 538 | const max = semantics.chooseValue( | |
| 539 | []const u8, | |
| 540 | .{ | |
| 541 | "6.5504e+4", | |
| 542 | "3.40282347e+38", | |
| 543 | "1.7976931348623157e+308", | |
| 544 | "1.18973149535723176502e+4932", | |
| 545 | "1.79769313486231580793728971405301e+308", | |
| 546 | "1.18973149535723176508575932662800702e+4932", | |
| 547 | }, | |
| 548 | ); | |
| 549 | ||
| 550 | var defPrefix = std.BoundedArray(u8, 32).init(0) catch unreachable; | |
| 551 | defPrefix.writer().print("__{s}_", .{prefix}) catch return error.OutOfMemory; | |
| 552 | ||
| 553 | const prefix_slice = defPrefix.constSlice(); | |
| 554 | ||
| 555 | try w.print("#define {s}DENORM_MIN__ {s}{s}\n", .{ prefix_slice, denormMin, ext }); | |
| 556 | try w.print("#define {s}HAS_DENORM__\n", .{prefix_slice}); | |
| 557 | try w.print("#define {s}DIG__ {d}\n", .{ prefix_slice, digits }); | |
| 558 | try w.print("#define {s}DECIMAL_DIG__ {d}\n", .{ prefix_slice, decimalDigits }); | |
| 559 | ||
| 560 | try w.print("#define {s}EPSILON__ {s}{s}\n", .{ prefix_slice, epsilon, ext }); | |
| 561 | try w.print("#define {s}HAS_INFINITY__\n", .{prefix_slice}); | |
| 562 | try w.print("#define {s}HAS_QUIET_NAN__\n", .{prefix_slice}); | |
| 563 | try w.print("#define {s}MANT_DIG__ {d}\n", .{ prefix_slice, mantissaDigits }); | |
| 564 | ||
| 565 | try w.print("#define {s}MAX_10_EXP__ {d}\n", .{ prefix_slice, max10Exp }); | |
| 566 | try w.print("#define {s}MAX_EXP__ {d}\n", .{ prefix_slice, maxExp }); | |
| 567 | try w.print("#define {s}MAX__ {s}{s}\n", .{ prefix_slice, max, ext }); | |
| 568 | ||
| 569 | try w.print("#define {s}MIN_10_EXP__ ({d})\n", .{ prefix_slice, min10Exp }); | |
| 570 | try w.print("#define {s}MIN_EXP__ ({d})\n", .{ prefix_slice, minExp }); | |
| 571 | try w.print("#define {s}MIN__ {s}{s}\n", .{ prefix_slice, min, ext }); | |
| 572 | } | |
| 573 | ||
| 574 | fn generateTypeMacro(w: anytype, mapper: StringInterner.TypeMapper, name: []const u8, ty: Type, langopts: LangOpts) !void { | |
| 575 | try w.print("#define {s} ", .{name}); | |
| 576 | try ty.print(mapper, langopts, w); | |
| 577 | try w.writeByte('\n'); | |
| 578 | } | |
| 579 | ||
| 580 | fn generateBuiltinTypes(comp: *Compilation) !void { | |
| 581 | const os = comp.target.os.tag; | |
| 582 | const wchar: Type = switch (comp.target.cpu.arch) { | |
| 583 | .xcore => .{ .specifier = .uchar }, | |
| 584 | .ve, .msp430 => .{ .specifier = .uint }, | |
| 585 | .arm, .armeb, .thumb, .thumbeb => .{ | |
| 586 | .specifier = if (os != .windows and os != .netbsd and os != .openbsd) .uint else .int, | |
| 587 | }, | |
| 588 | .aarch64, .aarch64_be, .aarch64_32 => .{ | |
| 589 | .specifier = if (!os.isDarwin() and os != .netbsd) .uint else .int, | |
| 590 | }, | |
| 591 | .x86_64, .x86 => .{ .specifier = if (os == .windows) .ushort else .int }, | |
| 592 | else => .{ .specifier = .int }, | |
| 593 | }; | |
| 594 | ||
| 595 | const ptr_width = comp.target.ptrBitWidth(); | |
| 596 | const ptrdiff = if (os == .windows and ptr_width == 64) | |
| 597 | Type{ .specifier = .long_long } | |
| 598 | else switch (ptr_width) { | |
| 599 | 16 => Type{ .specifier = .int }, | |
| 600 | 32 => Type{ .specifier = .int }, | |
| 601 | 64 => Type{ .specifier = .long }, | |
| 602 | else => unreachable, | |
| 603 | }; | |
| 604 | ||
| 605 | const size = if (os == .windows and ptr_width == 64) | |
| 606 | Type{ .specifier = .ulong_long } | |
| 607 | else switch (ptr_width) { | |
| 608 | 16 => Type{ .specifier = .uint }, | |
| 609 | 32 => Type{ .specifier = .uint }, | |
| 610 | 64 => Type{ .specifier = .ulong }, | |
| 611 | else => unreachable, | |
| 612 | }; | |
| 613 | ||
| 614 | const va_list = try comp.generateVaListType(); | |
| 615 | ||
| 616 | const pid_t: Type = switch (os) { | |
| 617 | .haiku => .{ .specifier = .long }, | |
| 618 | // Todo: pid_t is required to "a signed integer type"; are there any systems | |
| 619 | // on which it is `short int`? | |
| 620 | else => .{ .specifier = .int }, | |
| 621 | }; | |
| 622 | ||
| 623 | const intmax = target_util.intMaxType(comp.target); | |
| 624 | const intptr = target_util.intPtrType(comp.target); | |
| 625 | const int16 = target_util.int16Type(comp.target); | |
| 626 | const int64 = target_util.int64Type(comp.target); | |
| 627 | ||
| 628 | comp.types = .{ | |
| 629 | .wchar = wchar, | |
| 630 | .ptrdiff = ptrdiff, | |
| 631 | .size = size, | |
| 632 | .va_list = va_list, | |
| 633 | .pid_t = pid_t, | |
| 634 | .intmax = intmax, | |
| 635 | .intptr = intptr, | |
| 636 | .int16 = int16, | |
| 637 | .int64 = int64, | |
| 638 | }; | |
| 639 | ||
| 640 | try comp.generateNsConstantStringType(); | |
| 641 | } | |
| 642 | ||
| 643 | fn intSize(comp: *const Compilation, specifier: Type.Specifier) u64 { | |
| 644 | const ty = Type{ .specifier = specifier }; | |
| 645 | return ty.sizeof(comp).?; | |
| 646 | } | |
| 647 | ||
| 648 | fn generateExactWidthTypes(comp: *const Compilation, w: anytype, mapper: StringInterner.TypeMapper) !void { | |
| 649 | try comp.generateExactWidthType(w, mapper, .schar); | |
| 650 | ||
| 651 | if (comp.intSize(.short) > comp.intSize(.char)) { | |
| 652 | try comp.generateExactWidthType(w, mapper, .short); | |
| 653 | } | |
| 654 | ||
| 655 | if (comp.intSize(.int) > comp.intSize(.short)) { | |
| 656 | try comp.generateExactWidthType(w, mapper, .int); | |
| 657 | } | |
| 658 | ||
| 659 | if (comp.intSize(.long) > comp.intSize(.int)) { | |
| 660 | try comp.generateExactWidthType(w, mapper, .long); | |
| 661 | } | |
| 662 | ||
| 663 | if (comp.intSize(.long_long) > comp.intSize(.long)) { | |
| 664 | try comp.generateExactWidthType(w, mapper, .long_long); | |
| 665 | } | |
| 666 | ||
| 667 | try comp.generateExactWidthType(w, mapper, .uchar); | |
| 668 | try comp.generateExactWidthIntMax(w, .uchar); | |
| 669 | try comp.generateExactWidthIntMax(w, .schar); | |
| 670 | ||
| 671 | if (comp.intSize(.short) > comp.intSize(.char)) { | |
| 672 | try comp.generateExactWidthType(w, mapper, .ushort); | |
| 673 | try comp.generateExactWidthIntMax(w, .ushort); | |
| 674 | try comp.generateExactWidthIntMax(w, .short); | |
| 675 | } | |
| 676 | ||
| 677 | if (comp.intSize(.int) > comp.intSize(.short)) { | |
| 678 | try comp.generateExactWidthType(w, mapper, .uint); | |
| 679 | try comp.generateExactWidthIntMax(w, .uint); | |
| 680 | try comp.generateExactWidthIntMax(w, .int); | |
| 681 | } | |
| 682 | ||
| 683 | if (comp.intSize(.long) > comp.intSize(.int)) { | |
| 684 | try comp.generateExactWidthType(w, mapper, .ulong); | |
| 685 | try comp.generateExactWidthIntMax(w, .ulong); | |
| 686 | try comp.generateExactWidthIntMax(w, .long); | |
| 687 | } | |
| 688 | ||
| 689 | if (comp.intSize(.long_long) > comp.intSize(.long)) { | |
| 690 | try comp.generateExactWidthType(w, mapper, .ulong_long); | |
| 691 | try comp.generateExactWidthIntMax(w, .ulong_long); | |
| 692 | try comp.generateExactWidthIntMax(w, .long_long); | |
| 693 | } | |
| 694 | } | |
| 695 | ||
| 696 | fn generateFmt(comp: *const Compilation, prefix: []const u8, w: anytype, ty: Type) !void { | |
| 697 | const unsigned = ty.isUnsignedInt(comp); | |
| 698 | const modifier = ty.formatModifier(); | |
| 699 | const formats = if (unsigned) "ouxX" else "di"; | |
| 700 | for (formats) |c| { | |
| 701 | try w.print("#define {s}_FMT{c}__ \"{s}{c}\"\n", .{ prefix, c, modifier, c }); | |
| 702 | } | |
| 703 | } | |
| 704 | ||
| 705 | fn generateSuffixMacro(comp: *const Compilation, prefix: []const u8, w: anytype, ty: Type) !void { | |
| 706 | return w.print("#define {s}_C_SUFFIX__ {s}\n", .{ prefix, ty.intValueSuffix(comp) }); | |
| 707 | } | |
| 708 | ||
| 709 | /// Generate the following for ty: | |
| 710 | /// Name macro (e.g. #define __UINT32_TYPE__ unsigned int) | |
| 711 | /// Format strings (e.g. #define __UINT32_FMTu__ "u") | |
| 712 | /// Suffix macro (e.g. #define __UINT32_C_SUFFIX__ U) | |
| 713 | fn generateExactWidthType(comp: *const Compilation, w: anytype, mapper: StringInterner.TypeMapper, specifier: Type.Specifier) !void { | |
| 714 | var ty = Type{ .specifier = specifier }; | |
| 715 | const width = 8 * ty.sizeof(comp).?; | |
| 716 | const unsigned = ty.isUnsignedInt(comp); | |
| 717 | ||
| 718 | if (width == 16) { | |
| 719 | ty = if (unsigned) comp.types.int16.makeIntegerUnsigned() else comp.types.int16; | |
| 720 | } else if (width == 64) { | |
| 721 | ty = if (unsigned) comp.types.int64.makeIntegerUnsigned() else comp.types.int64; | |
| 722 | } | |
| 723 | ||
| 724 | var prefix = std.BoundedArray(u8, 16).init(0) catch unreachable; | |
| 725 | prefix.writer().print("{s}{d}", .{ if (unsigned) "__UINT" else "__INT", width }) catch return error.OutOfMemory; | |
| 726 | ||
| 727 | { | |
| 728 | const len = prefix.len; | |
| 729 | defer prefix.resize(len) catch unreachable; // restoring previous size | |
| 730 | prefix.appendSliceAssumeCapacity("_TYPE__"); | |
| 731 | try generateTypeMacro(w, mapper, prefix.constSlice(), ty, comp.langopts); | |
| 732 | } | |
| 733 | ||
| 734 | try comp.generateFmt(prefix.constSlice(), w, ty); | |
| 735 | try comp.generateSuffixMacro(prefix.constSlice(), w, ty); | |
| 736 | } | |
| 737 | ||
| 738 | pub fn hasHalfPrecisionFloatABI(comp: *const Compilation) bool { | |
| 739 | return comp.langopts.allow_half_args_and_returns or target_util.hasHalfPrecisionFloatABI(comp.target); | |
| 740 | } | |
| 741 | ||
| 742 | fn generateNsConstantStringType(comp: *Compilation) !void { | |
| 743 | comp.types.ns_constant_string.record = .{ | |
| 744 | .name = try comp.intern("__NSConstantString_tag"), | |
| 745 | .fields = &comp.types.ns_constant_string.fields, | |
| 746 | .field_attributes = null, | |
| 747 | .type_layout = undefined, | |
| 748 | }; | |
| 749 | const const_int_ptr = Type{ .specifier = .pointer, .data = .{ .sub_type = &comp.types.ns_constant_string.int_ty } }; | |
| 750 | const const_char_ptr = Type{ .specifier = .pointer, .data = .{ .sub_type = &comp.types.ns_constant_string.char_ty } }; | |
| 751 | ||
| 752 | comp.types.ns_constant_string.fields[0] = .{ .name = try comp.intern("isa"), .ty = const_int_ptr }; | |
| 753 | comp.types.ns_constant_string.fields[1] = .{ .name = try comp.intern("flags"), .ty = .{ .specifier = .int } }; | |
| 754 | comp.types.ns_constant_string.fields[2] = .{ .name = try comp.intern("str"), .ty = const_char_ptr }; | |
| 755 | comp.types.ns_constant_string.fields[3] = .{ .name = try comp.intern("length"), .ty = .{ .specifier = .long } }; | |
| 756 | comp.types.ns_constant_string.ty = .{ .specifier = .@"struct", .data = .{ .record = &comp.types.ns_constant_string.record } }; | |
| 757 | record_layout.compute(&comp.types.ns_constant_string.record, comp.types.ns_constant_string.ty, comp, null); | |
| 758 | } | |
| 759 | ||
| 760 | fn generateVaListType(comp: *Compilation) !Type { | |
| 761 | const Kind = enum { char_ptr, void_ptr, aarch64_va_list, x86_64_va_list }; | |
| 762 | const kind: Kind = switch (comp.target.cpu.arch) { | |
| 763 | .aarch64 => switch (comp.target.os.tag) { | |
| 764 | .windows => @as(Kind, .char_ptr), | |
| 765 | .ios, .macos, .tvos, .watchos => .char_ptr, | |
| 766 | else => .aarch64_va_list, | |
| 767 | }, | |
| 768 | .sparc, .wasm32, .wasm64, .bpfel, .bpfeb, .riscv32, .riscv64, .avr, .spirv32, .spirv64 => .void_ptr, | |
| 769 | .powerpc => switch (comp.target.os.tag) { | |
| 770 | .ios, .macos, .tvos, .watchos, .aix => @as(Kind, .char_ptr), | |
| 771 | else => return Type{ .specifier = .void }, // unknown | |
| 772 | }, | |
| 773 | .x86, .msp430 => .char_ptr, | |
| 774 | .x86_64 => switch (comp.target.os.tag) { | |
| 775 | .windows => @as(Kind, .char_ptr), | |
| 776 | else => .x86_64_va_list, | |
| 777 | }, | |
| 778 | else => return Type{ .specifier = .void }, // unknown | |
| 779 | }; | |
| 780 | ||
| 781 | // TODO this might be bad? | |
| 782 | const arena = comp.diag.arena.allocator(); | |
| 783 | ||
| 784 | var ty: Type = undefined; | |
| 785 | switch (kind) { | |
| 786 | .char_ptr => ty = .{ .specifier = .char }, | |
| 787 | .void_ptr => ty = .{ .specifier = .void }, | |
| 788 | .aarch64_va_list => { | |
| 789 | const record_ty = try arena.create(Type.Record); | |
| 790 | record_ty.* = .{ | |
| 791 | .name = try comp.intern("__va_list_tag"), | |
| 792 | .fields = try arena.alloc(Type.Record.Field, 5), | |
| 793 | .field_attributes = null, | |
| 794 | .type_layout = undefined, // computed below | |
| 795 | }; | |
| 796 | const void_ty = try arena.create(Type); | |
| 797 | void_ty.* = .{ .specifier = .void }; | |
| 798 | const void_ptr = Type{ .specifier = .pointer, .data = .{ .sub_type = void_ty } }; | |
| 799 | record_ty.fields[0] = .{ .name = try comp.intern("__stack"), .ty = void_ptr }; | |
| 800 | record_ty.fields[1] = .{ .name = try comp.intern("__gr_top"), .ty = void_ptr }; | |
| 801 | record_ty.fields[2] = .{ .name = try comp.intern("__vr_top"), .ty = void_ptr }; | |
| 802 | record_ty.fields[3] = .{ .name = try comp.intern("__gr_offs"), .ty = .{ .specifier = .int } }; | |
| 803 | record_ty.fields[4] = .{ .name = try comp.intern("__vr_offs"), .ty = .{ .specifier = .int } }; | |
| 804 | ty = .{ .specifier = .@"struct", .data = .{ .record = record_ty } }; | |
| 805 | record_layout.compute(record_ty, ty, comp, null); | |
| 806 | }, | |
| 807 | .x86_64_va_list => { | |
| 808 | const record_ty = try arena.create(Type.Record); | |
| 809 | record_ty.* = .{ | |
| 810 | .name = try comp.intern("__va_list_tag"), | |
| 811 | .fields = try arena.alloc(Type.Record.Field, 4), | |
| 812 | .field_attributes = null, | |
| 813 | .type_layout = undefined, // computed below | |
| 814 | }; | |
| 815 | const void_ty = try arena.create(Type); | |
| 816 | void_ty.* = .{ .specifier = .void }; | |
| 817 | const void_ptr = Type{ .specifier = .pointer, .data = .{ .sub_type = void_ty } }; | |
| 818 | record_ty.fields[0] = .{ .name = try comp.intern("gp_offset"), .ty = .{ .specifier = .uint } }; | |
| 819 | record_ty.fields[1] = .{ .name = try comp.intern("fp_offset"), .ty = .{ .specifier = .uint } }; | |
| 820 | record_ty.fields[2] = .{ .name = try comp.intern("overflow_arg_area"), .ty = void_ptr }; | |
| 821 | record_ty.fields[3] = .{ .name = try comp.intern("reg_save_area"), .ty = void_ptr }; | |
| 822 | ty = .{ .specifier = .@"struct", .data = .{ .record = record_ty } }; | |
| 823 | record_layout.compute(record_ty, ty, comp, null); | |
| 824 | }, | |
| 825 | } | |
| 826 | if (kind == .char_ptr or kind == .void_ptr) { | |
| 827 | const elem_ty = try arena.create(Type); | |
| 828 | elem_ty.* = ty; | |
| 829 | ty = Type{ .specifier = .pointer, .data = .{ .sub_type = elem_ty } }; | |
| 830 | } else { | |
| 831 | const arr_ty = try arena.create(Type.Array); | |
| 832 | arr_ty.* = .{ .len = 1, .elem = ty }; | |
| 833 | ty = Type{ .specifier = .array, .data = .{ .array = arr_ty } }; | |
| 834 | } | |
| 835 | ||
| 836 | return ty; | |
| 837 | } | |
| 838 | ||
| 839 | fn generateIntMax(comp: *const Compilation, w: anytype, name: []const u8, ty: Type) !void { | |
| 840 | const bit_count: u8 = @intCast(ty.sizeof(comp).? * 8); | |
| 841 | const unsigned = ty.isUnsignedInt(comp); | |
| 842 | const max = if (bit_count == 128) | |
| 843 | @as(u128, if (unsigned) std.math.maxInt(u128) else std.math.maxInt(u128)) | |
| 844 | else | |
| 845 | ty.maxInt(comp); | |
| 846 | try w.print("#define __{s}_MAX__ {d}{s}\n", .{ name, max, ty.intValueSuffix(comp) }); | |
| 847 | } | |
| 848 | ||
| 849 | fn generateExactWidthIntMax(comp: *const Compilation, w: anytype, specifier: Type.Specifier) !void { | |
| 850 | var ty = Type{ .specifier = specifier }; | |
| 851 | const bit_count: u8 = @intCast(ty.sizeof(comp).? * 8); | |
| 852 | const unsigned = ty.isUnsignedInt(comp); | |
| 853 | ||
| 854 | if (bit_count == 64) { | |
| 855 | ty = if (unsigned) comp.types.int64.makeIntegerUnsigned() else comp.types.int64; | |
| 856 | } | |
| 857 | ||
| 858 | var name = std.BoundedArray(u8, 6).init(0) catch unreachable; | |
| 859 | name.writer().print("{s}{d}", .{ if (unsigned) "UINT" else "INT", bit_count }) catch return error.OutOfMemory; | |
| 860 | ||
| 861 | return comp.generateIntMax(w, name.constSlice(), ty); | |
| 862 | } | |
| 863 | ||
| 864 | fn generateIntWidth(comp: *Compilation, w: anytype, name: []const u8, ty: Type) !void { | |
| 865 | try w.print("#define __{s}_WIDTH__ {d}\n", .{ name, 8 * ty.sizeof(comp).? }); | |
| 866 | } | |
| 867 | ||
| 868 | fn generateIntMaxAndWidth(comp: *Compilation, w: anytype, name: []const u8, ty: Type) !void { | |
| 869 | try comp.generateIntMax(w, name, ty); | |
| 870 | try comp.generateIntWidth(w, name, ty); | |
| 871 | } | |
| 872 | ||
| 873 | fn generateSizeofType(comp: *Compilation, w: anytype, name: []const u8, ty: Type) !void { | |
| 874 | try w.print("#define {s} {d}\n", .{ name, ty.sizeof(comp).? }); | |
| 875 | } | |
| 876 | ||
| 877 | pub fn nextLargestIntSameSign(comp: *const Compilation, ty: Type) ?Type { | |
| 878 | assert(ty.isInt()); | |
| 879 | const specifiers = if (ty.isUnsignedInt(comp)) | |
| 880 | [_]Type.Specifier{ .short, .int, .long, .long_long } | |
| 881 | else | |
| 882 | [_]Type.Specifier{ .ushort, .uint, .ulong, .ulong_long }; | |
| 883 | const size = ty.sizeof(comp).?; | |
| 884 | for (specifiers) |specifier| { | |
| 885 | const candidate = Type{ .specifier = specifier }; | |
| 886 | if (candidate.sizeof(comp).? > size) return candidate; | |
| 887 | } | |
| 888 | return null; | |
| 889 | } | |
| 890 | ||
| 891 | /// If `enum E { ... }` syntax has a fixed underlying integer type regardless of the presence of | |
| 892 | /// __attribute__((packed)) or the range of values of the corresponding enumerator constants, | |
| 893 | /// specify it here. | |
| 894 | /// TODO: likely incomplete | |
| 895 | pub fn fixedEnumTagSpecifier(comp: *const Compilation) ?Type.Specifier { | |
| 896 | switch (comp.langopts.emulate) { | |
| 897 | .msvc => return .int, | |
| 898 | .clang => if (comp.target.os.tag == .windows) return .int, | |
| 899 | .gcc => {}, | |
| 900 | } | |
| 901 | return null; | |
| 902 | } | |
| 903 | ||
| 904 | pub fn getCharSignedness(comp: *const Compilation) std.builtin.Signedness { | |
| 905 | return comp.langopts.char_signedness_override orelse comp.target.charSignedness(); | |
| 906 | } | |
| 907 | ||
| 908 | pub fn defineSystemIncludes(comp: *Compilation, aro_dir: []const u8) !void { | |
| 909 | var stack_fallback = std.heap.stackFallback(path_buf_stack_limit, comp.gpa); | |
| 910 | const allocator = stack_fallback.get(); | |
| 911 | var search_path = aro_dir; | |
| 912 | while (std.fs.path.dirname(search_path)) |dirname| : (search_path = dirname) { | |
| 913 | var base_dir = std.fs.cwd().openDir(dirname, .{}) catch continue; | |
| 914 | defer base_dir.close(); | |
| 915 | ||
| 916 | base_dir.access("include/stddef.h", .{}) catch continue; | |
| 917 | const path = try std.fs.path.join(comp.gpa, &.{ dirname, "include" }); | |
| 918 | errdefer comp.gpa.free(path); | |
| 919 | try comp.system_include_dirs.append(path); | |
| 920 | break; | |
| 921 | } else return error.AroIncludeNotFound; | |
| 922 | ||
| 923 | if (comp.target.os.tag == .linux) { | |
| 924 | const triple_str = try comp.target.linuxTriple(allocator); | |
| 925 | defer allocator.free(triple_str); | |
| 926 | ||
| 927 | const multiarch_path = try std.fs.path.join(allocator, &.{ "/usr/include", triple_str }); | |
| 928 | defer allocator.free(multiarch_path); | |
| 929 | ||
| 930 | if (!std.meta.isError(std.fs.accessAbsolute(multiarch_path, .{}))) { | |
| 931 | const duped = try comp.gpa.dupe(u8, multiarch_path); | |
| 932 | errdefer comp.gpa.free(duped); | |
| 933 | try comp.system_include_dirs.append(duped); | |
| 934 | } | |
| 935 | } | |
| 936 | const usr_include = try comp.gpa.dupe(u8, "/usr/include"); | |
| 937 | errdefer comp.gpa.free(usr_include); | |
| 938 | try comp.system_include_dirs.append(usr_include); | |
| 939 | } | |
| 940 | ||
| 941 | pub fn getSource(comp: *const Compilation, id: Source.Id) Source { | |
| 942 | if (id == .generated) return .{ | |
| 943 | .path = "<scratch space>", | |
| 944 | .buf = comp.generated_buf.items, | |
| 945 | .id = .generated, | |
| 946 | .splice_locs = &.{}, | |
| 947 | }; | |
| 948 | return comp.sources.values()[@intFromEnum(id) - 2]; | |
| 949 | } | |
| 950 | ||
| 951 | /// Creates a Source from the contents of `reader` and adds it to the Compilation | |
| 952 | /// Performs newline splicing, line-ending normalization to '\n', and UTF-8 validation. | |
| 953 | /// caller retains ownership of `path` | |
| 954 | /// `expected_size` will be allocated to hold the contents of `reader` and *must* be at least | |
| 955 | /// as large as the entire contents of `reader`. | |
| 956 | /// To add a pre-existing buffer as a Source, see addSourceFromBuffer | |
| 957 | /// To add a file's contents given its path, see addSourceFromPath | |
| 958 | pub fn addSourceFromReader(comp: *Compilation, reader: anytype, path: []const u8, expected_size: u32) !Source { | |
| 959 | var contents = try comp.gpa.alloc(u8, expected_size); | |
| 960 | errdefer comp.gpa.free(contents); | |
| 961 | ||
| 962 | const duped_path = try comp.gpa.dupe(u8, path); | |
| 963 | errdefer comp.gpa.free(duped_path); | |
| 964 | ||
| 965 | var splice_list = std.ArrayList(u32).init(comp.gpa); | |
| 966 | defer splice_list.deinit(); | |
| 967 | ||
| 968 | const source_id: Source.Id = @enumFromInt(comp.sources.count() + 2); | |
| 969 | ||
| 970 | var i: u32 = 0; | |
| 971 | var backslash_loc: u32 = undefined; | |
| 972 | var state: enum { | |
| 973 | beginning_of_file, | |
| 974 | bom1, | |
| 975 | bom2, | |
| 976 | start, | |
| 977 | back_slash, | |
| 978 | cr, | |
| 979 | back_slash_cr, | |
| 980 | trailing_ws, | |
| 981 | } = .beginning_of_file; | |
| 982 | var line: u32 = 1; | |
| 983 | ||
| 984 | while (true) { | |
| 985 | const byte = reader.readByte() catch |err| switch (err) { | |
| 986 | error.EndOfStream => break, | |
| 987 | else => |e| return e, | |
| 988 | }; | |
| 989 | contents[i] = byte; | |
| 990 | ||
| 991 | switch (byte) { | |
| 992 | '\r' => { | |
| 993 | switch (state) { | |
| 994 | .start, .cr, .beginning_of_file => { | |
| 995 | state = .start; | |
| 996 | line += 1; | |
| 997 | state = .cr; | |
| 998 | contents[i] = '\n'; | |
| 999 | i += 1; | |
| 1000 | }, | |
| 1001 | .back_slash, .trailing_ws, .back_slash_cr => { | |
| 1002 | i = backslash_loc; | |
| 1003 | try splice_list.append(i); | |
| 1004 | if (state == .trailing_ws) { | |
| 1005 | try comp.diag.add(.{ | |
| 1006 | .tag = .backslash_newline_escape, | |
| 1007 | .loc = .{ .id = source_id, .byte_offset = i, .line = line }, | |
| 1008 | }, &.{}); | |
| 1009 | } | |
| 1010 | state = if (state == .back_slash_cr) .cr else .back_slash_cr; | |
| 1011 | }, | |
| 1012 | .bom1, .bom2 => break, // invalid utf-8 | |
| 1013 | } | |
| 1014 | }, | |
| 1015 | '\n' => { | |
| 1016 | switch (state) { | |
| 1017 | .start, .beginning_of_file => { | |
| 1018 | state = .start; | |
| 1019 | line += 1; | |
| 1020 | i += 1; | |
| 1021 | }, | |
| 1022 | .cr, .back_slash_cr => {}, | |
| 1023 | .back_slash, .trailing_ws => { | |
| 1024 | i = backslash_loc; | |
| 1025 | if (state == .back_slash or state == .trailing_ws) { | |
| 1026 | try splice_list.append(i); | |
| 1027 | } | |
| 1028 | if (state == .trailing_ws) { | |
| 1029 | try comp.diag.add(.{ | |
| 1030 | .tag = .backslash_newline_escape, | |
| 1031 | .loc = .{ .id = source_id, .byte_offset = i, .line = line }, | |
| 1032 | }, &.{}); | |
| 1033 | } | |
| 1034 | }, | |
| 1035 | .bom1, .bom2 => break, | |
| 1036 | } | |
| 1037 | state = .start; | |
| 1038 | }, | |
| 1039 | '\\' => { | |
| 1040 | backslash_loc = i; | |
| 1041 | state = .back_slash; | |
| 1042 | i += 1; | |
| 1043 | }, | |
| 1044 | '\t', '\x0B', '\x0C', ' ' => { | |
| 1045 | switch (state) { | |
| 1046 | .start, .trailing_ws => {}, | |
| 1047 | .beginning_of_file => state = .start, | |
| 1048 | .cr, .back_slash_cr => state = .start, | |
| 1049 | .back_slash => state = .trailing_ws, | |
| 1050 | .bom1, .bom2 => break, | |
| 1051 | } | |
| 1052 | i += 1; | |
| 1053 | }, | |
| 1054 | '\xEF' => { | |
| 1055 | i += 1; | |
| 1056 | state = switch (state) { | |
| 1057 | .beginning_of_file => .bom1, | |
| 1058 | else => .start, | |
| 1059 | }; | |
| 1060 | }, | |
| 1061 | '\xBB' => { | |
| 1062 | i += 1; | |
| 1063 | state = switch (state) { | |
| 1064 | .bom1 => .bom2, | |
| 1065 | else => .start, | |
| 1066 | }; | |
| 1067 | }, | |
| 1068 | '\xBF' => { | |
| 1069 | switch (state) { | |
| 1070 | .bom2 => i = 0, // rewind and overwrite the BOM | |
| 1071 | else => i += 1, | |
| 1072 | } | |
| 1073 | state = .start; | |
| 1074 | }, | |
| 1075 | else => { | |
| 1076 | i += 1; | |
| 1077 | state = .start; | |
| 1078 | }, | |
| 1079 | } | |
| 1080 | } | |
| 1081 | ||
| 1082 | const splice_locs = try splice_list.toOwnedSlice(); | |
| 1083 | errdefer comp.gpa.free(splice_locs); | |
| 1084 | ||
| 1085 | if (i != contents.len) contents = try comp.gpa.realloc(contents, i); | |
| 1086 | ||
| 1087 | var source = Source{ | |
| 1088 | .id = source_id, | |
| 1089 | .path = duped_path, | |
| 1090 | .buf = contents, | |
| 1091 | .splice_locs = splice_locs, | |
| 1092 | }; | |
| 1093 | ||
| 1094 | try comp.sources.put(duped_path, source); | |
| 1095 | if (source.offsetOfInvalidUtf8()) |offset| { | |
| 1096 | try comp.invalid_utf8_locs.putNoClobber(comp.gpa, source_id, offset); | |
| 1097 | } | |
| 1098 | return source; | |
| 1099 | } | |
| 1100 | ||
| 1101 | /// Caller retains ownership of `path` and `buf`. | |
| 1102 | pub fn addSourceFromBuffer(comp: *Compilation, path: []const u8, buf: []const u8) !Source { | |
| 1103 | if (comp.sources.get(path)) |some| return some; | |
| 1104 | ||
| 1105 | const size = std.math.cast(u32, buf.len) orelse return error.StreamTooLong; | |
| 1106 | var buf_reader = std.io.fixedBufferStream(buf); | |
| 1107 | ||
| 1108 | return comp.addSourceFromReader(buf_reader.reader(), path, size); | |
| 1109 | } | |
| 1110 | ||
| 1111 | /// Caller retains ownership of `path` | |
| 1112 | pub fn addSourceFromPath(comp: *Compilation, path: []const u8) !Source { | |
| 1113 | if (comp.sources.get(path)) |some| return some; | |
| 1114 | ||
| 1115 | if (mem.indexOfScalar(u8, path, 0) != null) { | |
| 1116 | return error.FileNotFound; | |
| 1117 | } | |
| 1118 | ||
| 1119 | const file = try std.fs.cwd().openFile(path, .{}); | |
| 1120 | defer file.close(); | |
| 1121 | ||
| 1122 | const size = std.math.cast(u32, try file.getEndPos()) orelse return error.StreamTooLong; | |
| 1123 | var buf_reader = std.io.bufferedReader(file.reader()); | |
| 1124 | ||
| 1125 | return comp.addSourceFromReader(buf_reader.reader(), path, size); | |
| 1126 | } | |
| 1127 | ||
| 1128 | pub const IncludeDirIterator = struct { | |
| 1129 | comp: *const Compilation, | |
| 1130 | cwd_source_id: ?Source.Id, | |
| 1131 | include_dirs_idx: usize = 0, | |
| 1132 | sys_include_dirs_idx: usize = 0, | |
| 1133 | ||
| 1134 | fn next(self: *IncludeDirIterator) ?[]const u8 { | |
| 1135 | if (self.cwd_source_id) |source_id| { | |
| 1136 | self.cwd_source_id = null; | |
| 1137 | const path = self.comp.getSource(source_id).path; | |
| 1138 | return std.fs.path.dirname(path) orelse "."; | |
| 1139 | } | |
| 1140 | if (self.include_dirs_idx < self.comp.include_dirs.items.len) { | |
| 1141 | defer self.include_dirs_idx += 1; | |
| 1142 | return self.comp.include_dirs.items[self.include_dirs_idx]; | |
| 1143 | } | |
| 1144 | if (self.sys_include_dirs_idx < self.comp.system_include_dirs.items.len) { | |
| 1145 | defer self.sys_include_dirs_idx += 1; | |
| 1146 | return self.comp.system_include_dirs.items[self.sys_include_dirs_idx]; | |
| 1147 | } | |
| 1148 | return null; | |
| 1149 | } | |
| 1150 | ||
| 1151 | /// Returned value must be freed by allocator | |
| 1152 | fn nextWithFile(self: *IncludeDirIterator, filename: []const u8, allocator: Allocator) !?[]const u8 { | |
| 1153 | while (self.next()) |dir| { | |
| 1154 | return try std.fs.path.join(allocator, &.{ dir, filename }); | |
| 1155 | } | |
| 1156 | return null; | |
| 1157 | } | |
| 1158 | ||
| 1159 | /// Advance the iterator until it finds an include directory that matches | |
| 1160 | /// the directory which contains `source`. | |
| 1161 | fn skipUntilDirMatch(self: *IncludeDirIterator, source: Source.Id) void { | |
| 1162 | const path = self.comp.getSource(source).path; | |
| 1163 | const includer_path = std.fs.path.dirname(path) orelse "."; | |
| 1164 | while (self.next()) |dir| { | |
| 1165 | if (mem.eql(u8, includer_path, dir)) break; | |
| 1166 | } | |
| 1167 | } | |
| 1168 | }; | |
| 1169 | ||
| 1170 | pub fn hasInclude( | |
| 1171 | comp: *const Compilation, | |
| 1172 | filename: []const u8, | |
| 1173 | includer_token_source: Source.Id, | |
| 1174 | /// angle bracket vs quotes | |
| 1175 | include_type: IncludeType, | |
| 1176 | /// __has_include vs __has_include_next | |
| 1177 | which: WhichInclude, | |
| 1178 | ) !bool { | |
| 1179 | const cwd = std.fs.cwd(); | |
| 1180 | if (std.fs.path.isAbsolute(filename)) { | |
| 1181 | if (which == .next) return false; | |
| 1182 | return !std.meta.isError(cwd.access(filename, .{})); | |
| 1183 | } | |
| 1184 | ||
| 1185 | const cwd_source_id = switch (include_type) { | |
| 1186 | .quotes => switch (which) { | |
| 1187 | .first => includer_token_source, | |
| 1188 | .next => null, | |
| 1189 | }, | |
| 1190 | .angle_brackets => null, | |
| 1191 | }; | |
| 1192 | var it = IncludeDirIterator{ .comp = comp, .cwd_source_id = cwd_source_id }; | |
| 1193 | if (which == .next) { | |
| 1194 | it.skipUntilDirMatch(includer_token_source); | |
| 1195 | } | |
| 1196 | ||
| 1197 | var stack_fallback = std.heap.stackFallback(path_buf_stack_limit, comp.gpa); | |
| 1198 | ||
| 1199 | while (try it.nextWithFile(filename, stack_fallback.get())) |path| { | |
| 1200 | defer stack_fallback.get().free(path); | |
| 1201 | if (!std.meta.isError(cwd.access(path, .{}))) return true; | |
| 1202 | } | |
| 1203 | return false; | |
| 1204 | } | |
| 1205 | ||
| 1206 | pub const WhichInclude = enum { | |
| 1207 | first, | |
| 1208 | next, | |
| 1209 | }; | |
| 1210 | ||
| 1211 | pub const IncludeType = enum { | |
| 1212 | quotes, | |
| 1213 | angle_brackets, | |
| 1214 | }; | |
| 1215 | ||
| 1216 | fn getFileContents(comp: *Compilation, path: []const u8) ![]const u8 { | |
| 1217 | if (mem.indexOfScalar(u8, path, 0) != null) { | |
| 1218 | return error.FileNotFound; | |
| 1219 | } | |
| 1220 | ||
| 1221 | const file = try std.fs.cwd().openFile(path, .{}); | |
| 1222 | defer file.close(); | |
| 1223 | ||
| 1224 | return file.readToEndAlloc(comp.gpa, std.math.maxInt(u32)); | |
| 1225 | } | |
| 1226 | ||
| 1227 | pub fn findEmbed( | |
| 1228 | comp: *Compilation, | |
| 1229 | filename: []const u8, | |
| 1230 | includer_token_source: Source.Id, | |
| 1231 | /// angle bracket vs quotes | |
| 1232 | include_type: IncludeType, | |
| 1233 | ) !?[]const u8 { | |
| 1234 | if (std.fs.path.isAbsolute(filename)) { | |
| 1235 | return if (comp.getFileContents(filename)) |some| | |
| 1236 | some | |
| 1237 | else |err| switch (err) { | |
| 1238 | error.OutOfMemory => |e| return e, | |
| 1239 | else => null, | |
| 1240 | }; | |
| 1241 | } | |
| 1242 | ||
| 1243 | const cwd_source_id = switch (include_type) { | |
| 1244 | .quotes => includer_token_source, | |
| 1245 | .angle_brackets => null, | |
| 1246 | }; | |
| 1247 | var it = IncludeDirIterator{ .comp = comp, .cwd_source_id = cwd_source_id }; | |
| 1248 | var stack_fallback = std.heap.stackFallback(path_buf_stack_limit, comp.gpa); | |
| 1249 | ||
| 1250 | while (try it.nextWithFile(filename, stack_fallback.get())) |path| { | |
| 1251 | defer stack_fallback.get().free(path); | |
| 1252 | if (comp.getFileContents(path)) |some| | |
| 1253 | return some | |
| 1254 | else |err| switch (err) { | |
| 1255 | error.OutOfMemory => return error.OutOfMemory, | |
| 1256 | else => {}, | |
| 1257 | } | |
| 1258 | } | |
| 1259 | return null; | |
| 1260 | } | |
| 1261 | ||
| 1262 | pub fn findInclude( | |
| 1263 | comp: *Compilation, | |
| 1264 | filename: []const u8, | |
| 1265 | includer_token_source: Source.Id, | |
| 1266 | /// angle bracket vs quotes | |
| 1267 | include_type: IncludeType, | |
| 1268 | /// include vs include_next | |
| 1269 | which: WhichInclude, | |
| 1270 | ) !?Source { | |
| 1271 | if (std.fs.path.isAbsolute(filename)) { | |
| 1272 | if (which == .next) return null; | |
| 1273 | return if (comp.addSourceFromPath(filename)) |some| | |
| 1274 | some | |
| 1275 | else |err| switch (err) { | |
| 1276 | error.OutOfMemory => |e| return e, | |
| 1277 | else => null, | |
| 1278 | }; | |
| 1279 | } | |
| 1280 | const cwd_source_id = switch (include_type) { | |
| 1281 | .quotes => switch (which) { | |
| 1282 | .first => includer_token_source, | |
| 1283 | .next => null, | |
| 1284 | }, | |
| 1285 | .angle_brackets => null, | |
| 1286 | }; | |
| 1287 | var it = IncludeDirIterator{ .comp = comp, .cwd_source_id = cwd_source_id }; | |
| 1288 | ||
| 1289 | if (which == .next) { | |
| 1290 | it.skipUntilDirMatch(includer_token_source); | |
| 1291 | } | |
| 1292 | ||
| 1293 | var stack_fallback = std.heap.stackFallback(path_buf_stack_limit, comp.gpa); | |
| 1294 | while (try it.nextWithFile(filename, stack_fallback.get())) |path| { | |
| 1295 | defer stack_fallback.get().free(path); | |
| 1296 | if (comp.addSourceFromPath(path)) |some| | |
| 1297 | return some | |
| 1298 | else |err| switch (err) { | |
| 1299 | error.OutOfMemory => return error.OutOfMemory, | |
| 1300 | else => {}, | |
| 1301 | } | |
| 1302 | } | |
| 1303 | return null; | |
| 1304 | } | |
| 1305 | ||
| 1306 | pub fn addPragmaHandler(comp: *Compilation, name: []const u8, handler: *Pragma) Allocator.Error!void { | |
| 1307 | try comp.pragma_handlers.putNoClobber(name, handler); | |
| 1308 | } | |
| 1309 | ||
| 1310 | pub fn addDefaultPragmaHandlers(comp: *Compilation) Allocator.Error!void { | |
| 1311 | const GCC = @import("pragmas/gcc.zig"); | |
| 1312 | var gcc = try GCC.init(comp.gpa); | |
| 1313 | errdefer gcc.deinit(gcc, comp); | |
| 1314 | ||
| 1315 | const Once = @import("pragmas/once.zig"); | |
| 1316 | var once = try Once.init(comp.gpa); | |
| 1317 | errdefer once.deinit(once, comp); | |
| 1318 | ||
| 1319 | const Message = @import("pragmas/message.zig"); | |
| 1320 | var message = try Message.init(comp.gpa); | |
| 1321 | errdefer message.deinit(message, comp); | |
| 1322 | ||
| 1323 | const Pack = @import("pragmas/pack.zig"); | |
| 1324 | var pack = try Pack.init(comp.gpa); | |
| 1325 | errdefer pack.deinit(pack, comp); | |
| 1326 | ||
| 1327 | try comp.addPragmaHandler("GCC", gcc); | |
| 1328 | try comp.addPragmaHandler("once", once); | |
| 1329 | try comp.addPragmaHandler("message", message); | |
| 1330 | try comp.addPragmaHandler("pack", pack); | |
| 1331 | } | |
| 1332 | ||
| 1333 | pub fn getPragma(comp: *Compilation, name: []const u8) ?*Pragma { | |
| 1334 | return comp.pragma_handlers.get(name); | |
| 1335 | } | |
| 1336 | ||
| 1337 | const PragmaEvent = enum { | |
| 1338 | before_preprocess, | |
| 1339 | before_parse, | |
| 1340 | after_parse, | |
| 1341 | }; | |
| 1342 | ||
| 1343 | pub fn pragmaEvent(comp: *Compilation, event: PragmaEvent) void { | |
| 1344 | for (comp.pragma_handlers.values()) |pragma| { | |
| 1345 | const maybe_func = switch (event) { | |
| 1346 | .before_preprocess => pragma.beforePreprocess, | |
| 1347 | .before_parse => pragma.beforeParse, | |
| 1348 | .after_parse => pragma.afterParse, | |
| 1349 | }; | |
| 1350 | if (maybe_func) |func| func(pragma, comp); | |
| 1351 | } | |
| 1352 | } | |
| 1353 | ||
| 1354 | pub fn hasBuiltin(comp: *const Compilation, name: []const u8) bool { | |
| 1355 | if (std.mem.eql(u8, name, "__builtin_va_arg") or | |
| 1356 | std.mem.eql(u8, name, "__builtin_choose_expr") or | |
| 1357 | std.mem.eql(u8, name, "__builtin_bitoffsetof") or | |
| 1358 | std.mem.eql(u8, name, "__builtin_offsetof") or | |
| 1359 | std.mem.eql(u8, name, "__builtin_types_compatible_p")) return true; | |
| 1360 | ||
| 1361 | @setEvalBranchQuota(10_000); | |
| 1362 | const tag = std.meta.stringToEnum(BuiltinFunction.Tag, name) orelse return false; | |
| 1363 | const builtin = BuiltinFunction.fromTag(tag); | |
| 1364 | return comp.hasBuiltinFunction(builtin); | |
| 1365 | } | |
| 1366 | ||
| 1367 | pub fn hasBuiltinFunction(comp: *const Compilation, builtin: BuiltinFunction) bool { | |
| 1368 | if (!target_util.builtinEnabled(comp.target, builtin.properties.target_set)) return false; | |
| 1369 | ||
| 1370 | switch (builtin.properties.language) { | |
| 1371 | .all_languages => return true, | |
| 1372 | .all_ms_languages => return comp.langopts.emulate == .msvc, | |
| 1373 | .gnu_lang, .all_gnu_languages => return comp.langopts.standard.isGNU(), | |
| 1374 | } | |
| 1375 | } | |
| 1376 | ||
| 1377 | pub const renderErrors = Diagnostics.render; | |
| 1378 | ||
| 1379 | test "addSourceFromReader" { | |
| 1380 | const Test = struct { | |
| 1381 | fn addSourceFromReader(str: []const u8, expected: []const u8, warning_count: u32, splices: []const u32) !void { | |
| 1382 | var comp = Compilation.init(std.testing.allocator); | |
| 1383 | defer comp.deinit(); | |
| 1384 | ||
| 1385 | var buf_reader = std.io.fixedBufferStream(str); | |
| 1386 | const source = try comp.addSourceFromReader(buf_reader.reader(), "path", @intCast(str.len)); | |
| 1387 | ||
| 1388 | try std.testing.expectEqualStrings(expected, source.buf); | |
| 1389 | try std.testing.expectEqual(warning_count, @as(u32, @intCast(comp.diag.list.items.len))); | |
| 1390 | try std.testing.expectEqualSlices(u32, splices, source.splice_locs); | |
| 1391 | } | |
| 1392 | ||
| 1393 | fn withAllocationFailures(allocator: std.mem.Allocator) !void { | |
| 1394 | var comp = Compilation.init(allocator); | |
| 1395 | defer comp.deinit(); | |
| 1396 | ||
| 1397 | _ = try comp.addSourceFromBuffer("path", "spliced\\\nbuffer\n"); | |
| 1398 | _ = try comp.addSourceFromBuffer("path", "non-spliced buffer\n"); | |
| 1399 | } | |
| 1400 | }; | |
| 1401 | try Test.addSourceFromReader("ab\\\nc", "abc", 0, &.{2}); | |
| 1402 | try Test.addSourceFromReader("ab\\\rc", "abc", 0, &.{2}); | |
| 1403 | try Test.addSourceFromReader("ab\\\r\nc", "abc", 0, &.{2}); | |
| 1404 | try Test.addSourceFromReader("ab\\ \nc", "abc", 1, &.{2}); | |
| 1405 | try Test.addSourceFromReader("ab\\\t\nc", "abc", 1, &.{2}); | |
| 1406 | try Test.addSourceFromReader("ab\\ \t\nc", "abc", 1, &.{2}); | |
| 1407 | try Test.addSourceFromReader("ab\\\r \nc", "ab \nc", 0, &.{2}); | |
| 1408 | try Test.addSourceFromReader("ab\\\\\nc", "ab\\c", 0, &.{3}); | |
| 1409 | try Test.addSourceFromReader("ab\\ \r\nc", "abc", 1, &.{2}); | |
| 1410 | try Test.addSourceFromReader("ab\\ \\\nc", "ab\\ c", 0, &.{4}); | |
| 1411 | try Test.addSourceFromReader("ab\\\r\\\nc", "abc", 0, &.{ 2, 2 }); | |
| 1412 | try Test.addSourceFromReader("ab\\ \rc", "abc", 1, &.{2}); | |
| 1413 | try Test.addSourceFromReader("ab\\", "ab\\", 0, &.{}); | |
| 1414 | try Test.addSourceFromReader("ab\\\\", "ab\\\\", 0, &.{}); | |
| 1415 | try Test.addSourceFromReader("ab\\ ", "ab\\ ", 0, &.{}); | |
| 1416 | try Test.addSourceFromReader("ab\\\n", "ab", 0, &.{2}); | |
| 1417 | try Test.addSourceFromReader("ab\\\r\n", "ab", 0, &.{2}); | |
| 1418 | try Test.addSourceFromReader("ab\\\r", "ab", 0, &.{2}); | |
| 1419 | ||
| 1420 | // carriage return normalization | |
| 1421 | try Test.addSourceFromReader("ab\r", "ab\n", 0, &.{}); | |
| 1422 | try Test.addSourceFromReader("ab\r\r", "ab\n\n", 0, &.{}); | |
| 1423 | try Test.addSourceFromReader("ab\r\r\n", "ab\n\n", 0, &.{}); | |
| 1424 | try Test.addSourceFromReader("ab\r\r\n\r", "ab\n\n\n", 0, &.{}); | |
| 1425 | try Test.addSourceFromReader("\r\\", "\n\\", 0, &.{}); | |
| 1426 | try Test.addSourceFromReader("\\\r\\", "\\", 0, &.{0}); | |
| 1427 | ||
| 1428 | try std.testing.checkAllAllocationFailures(std.testing.allocator, Test.withAllocationFailures, .{}); | |
| 1429 | } | |
| 1430 | ||
| 1431 | test "addSourceFromReader - exhaustive check for carriage return elimination" { | |
| 1432 | const alphabet = [_]u8{ '\r', '\n', ' ', '\\', 'a' }; | |
| 1433 | const alen = alphabet.len; | |
| 1434 | var buf: [alphabet.len]u8 = [1]u8{alphabet[0]} ** alen; | |
| 1435 | ||
| 1436 | var comp = Compilation.init(std.testing.allocator); | |
| 1437 | defer comp.deinit(); | |
| 1438 | ||
| 1439 | var source_count: u32 = 0; | |
| 1440 | ||
| 1441 | while (true) { | |
| 1442 | const source = try comp.addSourceFromBuffer(&buf, &buf); | |
| 1443 | source_count += 1; | |
| 1444 | try std.testing.expect(std.mem.indexOfScalar(u8, source.buf, '\r') == null); | |
| 1445 | ||
| 1446 | if (std.mem.allEqual(u8, &buf, alphabet[alen - 1])) break; | |
| 1447 | ||
| 1448 | var idx = std.mem.indexOfScalar(u8, &alphabet, buf[buf.len - 1]).?; | |
| 1449 | buf[buf.len - 1] = alphabet[(idx + 1) % alen]; | |
| 1450 | var j = buf.len - 1; | |
| 1451 | while (j > 0) : (j -= 1) { | |
| 1452 | idx = std.mem.indexOfScalar(u8, &alphabet, buf[j - 1]).?; | |
| 1453 | if (buf[j] == alphabet[0]) buf[j - 1] = alphabet[(idx + 1) % alen] else break; | |
| 1454 | } | |
| 1455 | } | |
| 1456 | try std.testing.expect(source_count == std.math.powi(usize, alen, alen) catch unreachable); | |
| 1457 | } | |
| 1458 | ||
| 1459 | test "ignore BOM at beginning of file" { | |
| 1460 | const BOM = "\xEF\xBB\xBF"; | |
| 1461 | ||
| 1462 | const Test = struct { | |
| 1463 | fn run(buf: []const u8, input_type: enum { valid_utf8, invalid_utf8 }) !void { | |
| 1464 | var comp = Compilation.init(std.testing.allocator); | |
| 1465 | defer comp.deinit(); | |
| 1466 | ||
| 1467 | var buf_reader = std.io.fixedBufferStream(buf); | |
| 1468 | const source = try comp.addSourceFromReader(buf_reader.reader(), "file.c", @intCast(buf.len)); | |
| 1469 | switch (input_type) { | |
| 1470 | .valid_utf8 => { | |
| 1471 | const expected_output = if (mem.startsWith(u8, buf, BOM)) buf[BOM.len..] else buf; | |
| 1472 | try std.testing.expectEqualStrings(expected_output, source.buf); | |
| 1473 | try std.testing.expect(!comp.invalid_utf8_locs.contains(source.id)); | |
| 1474 | }, | |
| 1475 | .invalid_utf8 => try std.testing.expect(comp.invalid_utf8_locs.contains(source.id)), | |
| 1476 | } | |
| 1477 | } | |
| 1478 | }; | |
| 1479 | ||
| 1480 | try Test.run(BOM, .valid_utf8); | |
| 1481 | try Test.run(BOM ++ "x", .valid_utf8); | |
| 1482 | try Test.run("x" ++ BOM, .valid_utf8); | |
| 1483 | try Test.run(BOM ++ " ", .valid_utf8); | |
| 1484 | try Test.run(BOM ++ "\n", .valid_utf8); | |
| 1485 | try Test.run(BOM ++ "\\", .valid_utf8); | |
| 1486 | ||
| 1487 | try Test.run(BOM[0..1] ++ "x", .invalid_utf8); | |
| 1488 | try Test.run(BOM[0..2] ++ "x", .invalid_utf8); | |
| 1489 | try Test.run(BOM[1..] ++ "x", .invalid_utf8); | |
| 1490 | try Test.run(BOM[2..] ++ "x", .invalid_utf8); | |
| 1491 | } |
deps/aro/Diagnostics.zig created+2787| ... | ... | @@ -0,0 +1,2787 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Allocator = mem.Allocator; | |
| 4 | const Source = @import("Source.zig"); | |
| 5 | const Compilation = @import("Compilation.zig"); | |
| 6 | const Attribute = @import("Attribute.zig"); | |
| 7 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 8 | const Header = @import("builtins/Properties.zig").Header; | |
| 9 | const Tree = @import("Tree.zig"); | |
| 10 | const util = @import("util.zig"); | |
| 11 | const is_windows = @import("builtin").os.tag == .windows; | |
| 12 | ||
| 13 | const Diagnostics = @This(); | |
| 14 | ||
| 15 | const PointerSignMessage = " converts between pointers to integer types with different sign"; | |
| 16 | ||
| 17 | pub const Message = struct { | |
| 18 | tag: Tag, | |
| 19 | kind: Kind = undefined, | |
| 20 | loc: Source.Location = .{}, | |
| 21 | extra: Extra = .{ .none = {} }, | |
| 22 | ||
| 23 | pub const Extra = union { | |
| 24 | str: []const u8, | |
| 25 | tok_id: struct { | |
| 26 | expected: Tree.Token.Id, | |
| 27 | actual: Tree.Token.Id, | |
| 28 | }, | |
| 29 | tok_id_expected: Tree.Token.Id, | |
| 30 | arguments: struct { | |
| 31 | expected: u32, | |
| 32 | actual: u32, | |
| 33 | }, | |
| 34 | codepoints: struct { | |
| 35 | actual: u21, | |
| 36 | resembles: u21, | |
| 37 | }, | |
| 38 | attr_arg_count: struct { | |
| 39 | attribute: Attribute.Tag, | |
| 40 | expected: u32, | |
| 41 | }, | |
| 42 | attr_arg_type: struct { | |
| 43 | expected: Attribute.ArgumentType, | |
| 44 | actual: Attribute.ArgumentType, | |
| 45 | }, | |
| 46 | attr_enum: struct { | |
| 47 | tag: Attribute.Tag, | |
| 48 | }, | |
| 49 | ignored_record_attr: struct { | |
| 50 | tag: Attribute.Tag, | |
| 51 | specifier: enum { @"struct", @"union", @"enum" }, | |
| 52 | }, | |
| 53 | builtin_with_header: struct { | |
| 54 | builtin: BuiltinFunction.Tag, | |
| 55 | header: Header, | |
| 56 | }, | |
| 57 | actual_codepoint: u21, | |
| 58 | ascii: u7, | |
| 59 | unsigned: u64, | |
| 60 | pow_2_as_string: u8, | |
| 61 | signed: i64, | |
| 62 | none: void, | |
| 63 | }; | |
| 64 | }; | |
| 65 | ||
| 66 | pub const Tag = std.meta.DeclEnum(messages); | |
| 67 | ||
| 68 | // u4 to avoid any possible packed struct issues | |
| 69 | pub const Kind = enum(u4) { @"fatal error", @"error", note, warning, off, default }; | |
| 70 | ||
| 71 | pub const Options = packed struct { | |
| 72 | // do not directly use these, instead add `const NAME = true;` | |
| 73 | all: Kind = .default, | |
| 74 | extra: Kind = .default, | |
| 75 | pedantic: Kind = .default, | |
| 76 | ||
| 77 | @"unsupported-pragma": Kind = .default, | |
| 78 | @"c99-extensions": Kind = .default, | |
| 79 | @"implicit-int": Kind = .default, | |
| 80 | @"duplicate-decl-specifier": Kind = .default, | |
| 81 | @"missing-declaration": Kind = .default, | |
| 82 | @"extern-initializer": Kind = .default, | |
| 83 | @"implicit-function-declaration": Kind = .default, | |
| 84 | @"unused-value": Kind = .default, | |
| 85 | @"unreachable-code": Kind = .default, | |
| 86 | @"unknown-warning-option": Kind = .default, | |
| 87 | @"gnu-empty-struct": Kind = .default, | |
| 88 | @"gnu-alignof-expression": Kind = .default, | |
| 89 | @"macro-redefined": Kind = .default, | |
| 90 | @"generic-qual-type": Kind = .default, | |
| 91 | multichar: Kind = .default, | |
| 92 | @"pointer-integer-compare": Kind = .default, | |
| 93 | @"compare-distinct-pointer-types": Kind = .default, | |
| 94 | @"literal-conversion": Kind = .default, | |
| 95 | @"cast-qualifiers": Kind = .default, | |
| 96 | @"array-bounds": Kind = .default, | |
| 97 | @"int-conversion": Kind = .default, | |
| 98 | @"pointer-type-mismatch": Kind = .default, | |
| 99 | @"c2x-extensions": Kind = .default, | |
| 100 | @"incompatible-pointer-types": Kind = .default, | |
| 101 | @"excess-initializers": Kind = .default, | |
| 102 | @"division-by-zero": Kind = .default, | |
| 103 | @"initializer-overrides": Kind = .default, | |
| 104 | @"incompatible-pointer-types-discards-qualifiers": Kind = .default, | |
| 105 | @"unknown-attributes": Kind = .default, | |
| 106 | @"ignored-attributes": Kind = .default, | |
| 107 | @"builtin-macro-redefined": Kind = .default, | |
| 108 | @"gnu-label-as-value": Kind = .default, | |
| 109 | @"malformed-warning-check": Kind = .default, | |
| 110 | @"#pragma-messages": Kind = .default, | |
| 111 | @"newline-eof": Kind = .default, | |
| 112 | @"empty-translation-unit": Kind = .default, | |
| 113 | @"implicitly-unsigned-literal": Kind = .default, | |
| 114 | @"c99-compat": Kind = .default, | |
| 115 | @"unicode-zero-width": Kind = .default, | |
| 116 | @"unicode-homoglyph": Kind = .default, | |
| 117 | @"return-type": Kind = .default, | |
| 118 | @"dollar-in-identifier-extension": Kind = .default, | |
| 119 | @"unknown-pragmas": Kind = .default, | |
| 120 | @"predefined-identifier-outside-function": Kind = .default, | |
| 121 | @"many-braces-around-scalar-init": Kind = .default, | |
| 122 | uninitialized: Kind = .default, | |
| 123 | @"gnu-statement-expression": Kind = .default, | |
| 124 | @"gnu-imaginary-constant": Kind = .default, | |
| 125 | @"gnu-complex-integer": Kind = .default, | |
| 126 | @"ignored-qualifiers": Kind = .default, | |
| 127 | @"integer-overflow": Kind = .default, | |
| 128 | @"extra-semi": Kind = .default, | |
| 129 | @"gnu-binary-literal": Kind = .default, | |
| 130 | @"variadic-macros": Kind = .default, | |
| 131 | varargs: Kind = .default, | |
| 132 | @"#warnings": Kind = .default, | |
| 133 | @"deprecated-declarations": Kind = .default, | |
| 134 | @"backslash-newline-escape": Kind = .default, | |
| 135 | @"pointer-to-int-cast": Kind = .default, | |
| 136 | @"gnu-case-range": Kind = .default, | |
| 137 | @"c++-compat": Kind = .default, | |
| 138 | vla: Kind = .default, | |
| 139 | @"float-overflow-conversion": Kind = .default, | |
| 140 | @"float-zero-conversion": Kind = .default, | |
| 141 | @"float-conversion": Kind = .default, | |
| 142 | @"gnu-folding-constant": Kind = .default, | |
| 143 | undef: Kind = .default, | |
| 144 | @"ignored-pragmas": Kind = .default, | |
| 145 | @"gnu-include-next": Kind = .default, | |
| 146 | @"include-next-outside-header": Kind = .default, | |
| 147 | @"include-next-absolute-path": Kind = .default, | |
| 148 | @"enum-too-large": Kind = .default, | |
| 149 | @"fixed-enum-extension": Kind = .default, | |
| 150 | @"designated-init": Kind = .default, | |
| 151 | @"attribute-warning": Kind = .default, | |
| 152 | @"invalid-noreturn": Kind = .default, | |
| 153 | @"zero-length-array": Kind = .default, | |
| 154 | @"old-style-flexible-struct": Kind = .default, | |
| 155 | @"gnu-zero-variadic-macro-arguments": Kind = .default, | |
| 156 | @"main-return-type": Kind = .default, | |
| 157 | @"expansion-to-defined": Kind = .default, | |
| 158 | @"bit-int-extension": Kind = .default, | |
| 159 | @"keyword-macro": Kind = .default, | |
| 160 | @"pointer-arith": Kind = .default, | |
| 161 | @"sizeof-array-argument": Kind = .default, | |
| 162 | @"pre-c2x-compat": Kind = .default, | |
| 163 | @"pointer-bool-conversion": Kind = .default, | |
| 164 | @"string-conversion": Kind = .default, | |
| 165 | @"gnu-auto-type": Kind = .default, | |
| 166 | @"gnu-union-cast": Kind = .default, | |
| 167 | @"pointer-sign": Kind = .default, | |
| 168 | @"fuse-ld-path": Kind = .default, | |
| 169 | @"language-extension-token": Kind = .default, | |
| 170 | @"complex-component-init": Kind = .default, | |
| 171 | }; | |
| 172 | ||
| 173 | const messages = struct { | |
| 174 | pub const todo = struct { // Maybe someday this will no longer be needed. | |
| 175 | const msg = "TODO: {s}"; | |
| 176 | const extra = .str; | |
| 177 | const kind = .@"error"; | |
| 178 | }; | |
| 179 | pub const error_directive = struct { | |
| 180 | const msg = "{s}"; | |
| 181 | const extra = .str; | |
| 182 | const kind = .@"error"; | |
| 183 | }; | |
| 184 | pub const warning_directive = struct { | |
| 185 | const msg = "{s}"; | |
| 186 | const opt = "#warnings"; | |
| 187 | const extra = .str; | |
| 188 | const kind = .warning; | |
| 189 | }; | |
| 190 | pub const elif_without_if = struct { | |
| 191 | const msg = "#elif without #if"; | |
| 192 | const kind = .@"error"; | |
| 193 | }; | |
| 194 | pub const elif_after_else = struct { | |
| 195 | const msg = "#elif after #else"; | |
| 196 | const kind = .@"error"; | |
| 197 | }; | |
| 198 | pub const elifdef_without_if = struct { | |
| 199 | const msg = "#elifdef without #if"; | |
| 200 | const kind = .@"error"; | |
| 201 | }; | |
| 202 | pub const elifdef_after_else = struct { | |
| 203 | const msg = "#elifdef after #else"; | |
| 204 | const kind = .@"error"; | |
| 205 | }; | |
| 206 | pub const elifndef_without_if = struct { | |
| 207 | const msg = "#elifndef without #if"; | |
| 208 | const kind = .@"error"; | |
| 209 | }; | |
| 210 | pub const elifndef_after_else = struct { | |
| 211 | const msg = "#elifndef after #else"; | |
| 212 | const kind = .@"error"; | |
| 213 | }; | |
| 214 | pub const else_without_if = struct { | |
| 215 | const msg = "#else without #if"; | |
| 216 | const kind = .@"error"; | |
| 217 | }; | |
| 218 | pub const else_after_else = struct { | |
| 219 | const msg = "#else after #else"; | |
| 220 | const kind = .@"error"; | |
| 221 | }; | |
| 222 | pub const endif_without_if = struct { | |
| 223 | const msg = "#endif without #if"; | |
| 224 | const kind = .@"error"; | |
| 225 | }; | |
| 226 | pub const unknown_pragma = struct { | |
| 227 | const msg = "unknown pragma ignored"; | |
| 228 | const opt = "unknown-pragmas"; | |
| 229 | const kind = .off; | |
| 230 | const all = true; | |
| 231 | }; | |
| 232 | pub const line_simple_digit = struct { | |
| 233 | const msg = "#line directive requires a simple digit sequence"; | |
| 234 | const kind = .@"error"; | |
| 235 | }; | |
| 236 | pub const line_invalid_filename = struct { | |
| 237 | const msg = "invalid filename for #line directive"; | |
| 238 | const kind = .@"error"; | |
| 239 | }; | |
| 240 | pub const unterminated_conditional_directive = struct { | |
| 241 | const msg = "unterminated conditional directive"; | |
| 242 | const kind = .@"error"; | |
| 243 | }; | |
| 244 | pub const invalid_preprocessing_directive = struct { | |
| 245 | const msg = "invalid preprocessing directive"; | |
| 246 | const kind = .@"error"; | |
| 247 | }; | |
| 248 | pub const macro_name_missing = struct { | |
| 249 | const msg = "macro name missing"; | |
| 250 | const kind = .@"error"; | |
| 251 | }; | |
| 252 | pub const extra_tokens_directive_end = struct { | |
| 253 | const msg = "extra tokens at end of macro directive"; | |
| 254 | const kind = .@"error"; | |
| 255 | }; | |
| 256 | pub const expected_value_in_expr = struct { | |
| 257 | const msg = "expected value in expression"; | |
| 258 | const kind = .@"error"; | |
| 259 | }; | |
| 260 | pub const closing_paren = struct { | |
| 261 | const msg = "expected closing ')'"; | |
| 262 | const kind = .@"error"; | |
| 263 | }; | |
| 264 | pub const to_match_paren = struct { | |
| 265 | const msg = "to match this '('"; | |
| 266 | const kind = .note; | |
| 267 | }; | |
| 268 | pub const to_match_brace = struct { | |
| 269 | const msg = "to match this '{'"; | |
| 270 | const kind = .note; | |
| 271 | }; | |
| 272 | pub const to_match_bracket = struct { | |
| 273 | const msg = "to match this '['"; | |
| 274 | const kind = .note; | |
| 275 | }; | |
| 276 | pub const header_str_closing = struct { | |
| 277 | const msg = "expected closing '>'"; | |
| 278 | const kind = .@"error"; | |
| 279 | }; | |
| 280 | pub const header_str_match = struct { | |
| 281 | const msg = "to match this '<'"; | |
| 282 | const kind = .note; | |
| 283 | }; | |
| 284 | pub const string_literal_in_pp_expr = struct { | |
| 285 | const msg = "string literal in preprocessor expression"; | |
| 286 | const kind = .@"error"; | |
| 287 | }; | |
| 288 | pub const float_literal_in_pp_expr = struct { | |
| 289 | const msg = "floating point literal in preprocessor expression"; | |
| 290 | const kind = .@"error"; | |
| 291 | }; | |
| 292 | pub const defined_as_macro_name = struct { | |
| 293 | const msg = "'defined' cannot be used as a macro name"; | |
| 294 | const kind = .@"error"; | |
| 295 | }; | |
| 296 | pub const macro_name_must_be_identifier = struct { | |
| 297 | const msg = "macro name must be an identifier"; | |
| 298 | const kind = .@"error"; | |
| 299 | }; | |
| 300 | pub const whitespace_after_macro_name = struct { | |
| 301 | const msg = "ISO C99 requires whitespace after the macro name"; | |
| 302 | const opt = "c99-extensions"; | |
| 303 | const kind = .warning; | |
| 304 | }; | |
| 305 | pub const hash_hash_at_start = struct { | |
| 306 | const msg = "'##' cannot appear at the start of a macro expansion"; | |
| 307 | const kind = .@"error"; | |
| 308 | }; | |
| 309 | pub const hash_hash_at_end = struct { | |
| 310 | const msg = "'##' cannot appear at the end of a macro expansion"; | |
| 311 | const kind = .@"error"; | |
| 312 | }; | |
| 313 | pub const pasting_formed_invalid = struct { | |
| 314 | const msg = "pasting formed '{s}', an invalid preprocessing token"; | |
| 315 | const extra = .str; | |
| 316 | const kind = .@"error"; | |
| 317 | }; | |
| 318 | pub const missing_paren_param_list = struct { | |
| 319 | const msg = "missing ')' in macro parameter list"; | |
| 320 | const kind = .@"error"; | |
| 321 | }; | |
| 322 | pub const unterminated_macro_param_list = struct { | |
| 323 | const msg = "unterminated macro param list"; | |
| 324 | const kind = .@"error"; | |
| 325 | }; | |
| 326 | pub const invalid_token_param_list = struct { | |
| 327 | const msg = "invalid token in macro parameter list"; | |
| 328 | const kind = .@"error"; | |
| 329 | }; | |
| 330 | pub const expected_comma_param_list = struct { | |
| 331 | const msg = "expected comma in macro parameter list"; | |
| 332 | const kind = .@"error"; | |
| 333 | }; | |
| 334 | pub const hash_not_followed_param = struct { | |
| 335 | const msg = "'#' is not followed by a macro parameter"; | |
| 336 | const kind = .@"error"; | |
| 337 | }; | |
| 338 | pub const expected_filename = struct { | |
| 339 | const msg = "expected \"FILENAME\" or <FILENAME>"; | |
| 340 | const kind = .@"error"; | |
| 341 | }; | |
| 342 | pub const empty_filename = struct { | |
| 343 | const msg = "empty filename"; | |
| 344 | const kind = .@"error"; | |
| 345 | }; | |
| 346 | pub const expected_invalid = struct { | |
| 347 | const msg = "expected '{s}', found invalid bytes"; | |
| 348 | const extra = .tok_id_expected; | |
| 349 | const kind = .@"error"; | |
| 350 | }; | |
| 351 | pub const expected_eof = struct { | |
| 352 | const msg = "expected '{s}' before end of file"; | |
| 353 | const extra = .tok_id_expected; | |
| 354 | const kind = .@"error"; | |
| 355 | }; | |
| 356 | pub const expected_token = struct { | |
| 357 | const msg = "expected '{s}', found '{s}'"; | |
| 358 | const extra = .tok_id; | |
| 359 | const kind = .@"error"; | |
| 360 | }; | |
| 361 | pub const expected_expr = struct { | |
| 362 | const msg = "expected expression"; | |
| 363 | const kind = .@"error"; | |
| 364 | }; | |
| 365 | pub const expected_integer_constant_expr = struct { | |
| 366 | const msg = "expression is not an integer constant expression"; | |
| 367 | const kind = .@"error"; | |
| 368 | }; | |
| 369 | pub const missing_type_specifier = struct { | |
| 370 | const msg = "type specifier missing, defaults to 'int'"; | |
| 371 | const opt = "implicit-int"; | |
| 372 | const kind = .warning; | |
| 373 | const all = true; | |
| 374 | }; | |
| 375 | pub const multiple_storage_class = struct { | |
| 376 | const msg = "cannot combine with previous '{s}' declaration specifier"; | |
| 377 | const extra = .str; | |
| 378 | const kind = .@"error"; | |
| 379 | }; | |
| 380 | pub const static_assert_failure = struct { | |
| 381 | const msg = "static assertion failed"; | |
| 382 | const kind = .@"error"; | |
| 383 | }; | |
| 384 | pub const static_assert_failure_message = struct { | |
| 385 | const msg = "static assertion failed {s}"; | |
| 386 | const extra = .str; | |
| 387 | const kind = .@"error"; | |
| 388 | }; | |
| 389 | pub const expected_type = struct { | |
| 390 | const msg = "expected a type"; | |
| 391 | const kind = .@"error"; | |
| 392 | }; | |
| 393 | pub const cannot_combine_spec = struct { | |
| 394 | const msg = "cannot combine with previous '{s}' specifier"; | |
| 395 | const extra = .str; | |
| 396 | const kind = .@"error"; | |
| 397 | }; | |
| 398 | pub const duplicate_decl_spec = struct { | |
| 399 | const msg = "duplicate '{s}' declaration specifier"; | |
| 400 | const extra = .str; | |
| 401 | const opt = "duplicate-decl-specifier"; | |
| 402 | const kind = .warning; | |
| 403 | const all = true; | |
| 404 | }; | |
| 405 | pub const restrict_non_pointer = struct { | |
| 406 | const msg = "restrict requires a pointer or reference ('{s}' is invalid)"; | |
| 407 | const extra = .str; | |
| 408 | const kind = .@"error"; | |
| 409 | }; | |
| 410 | pub const expected_external_decl = struct { | |
| 411 | const msg = "expected external declaration"; | |
| 412 | const kind = .@"error"; | |
| 413 | }; | |
| 414 | pub const expected_ident_or_l_paren = struct { | |
| 415 | const msg = "expected identifier or '('"; | |
| 416 | const kind = .@"error"; | |
| 417 | }; | |
| 418 | pub const missing_declaration = struct { | |
| 419 | const msg = "declaration does not declare anything"; | |
| 420 | const opt = "missing-declaration"; | |
| 421 | const kind = .warning; | |
| 422 | }; | |
| 423 | pub const func_not_in_root = struct { | |
| 424 | const msg = "function definition is not allowed here"; | |
| 425 | const kind = .@"error"; | |
| 426 | }; | |
| 427 | pub const illegal_initializer = struct { | |
| 428 | const msg = "illegal initializer (only variables can be initialized)"; | |
| 429 | const kind = .@"error"; | |
| 430 | }; | |
| 431 | pub const extern_initializer = struct { | |
| 432 | const msg = "extern variable has initializer"; | |
| 433 | const opt = "extern-initializer"; | |
| 434 | const kind = .warning; | |
| 435 | }; | |
| 436 | pub const spec_from_typedef = struct { | |
| 437 | const msg = "'{s}' came from typedef"; | |
| 438 | const extra = .str; | |
| 439 | const kind = .note; | |
| 440 | }; | |
| 441 | pub const param_before_var_args = struct { | |
| 442 | const msg = "ISO C requires a named parameter before '...'"; | |
| 443 | const kind = .@"error"; | |
| 444 | }; | |
| 445 | pub const void_only_param = struct { | |
| 446 | const msg = "'void' must be the only parameter if specified"; | |
| 447 | const kind = .@"error"; | |
| 448 | }; | |
| 449 | pub const void_param_qualified = struct { | |
| 450 | const msg = "'void' parameter cannot be qualified"; | |
| 451 | const kind = .@"error"; | |
| 452 | }; | |
| 453 | pub const void_must_be_first_param = struct { | |
| 454 | const msg = "'void' must be the first parameter if specified"; | |
| 455 | const kind = .@"error"; | |
| 456 | }; | |
| 457 | pub const invalid_storage_on_param = struct { | |
| 458 | const msg = "invalid storage class on function parameter"; | |
| 459 | const kind = .@"error"; | |
| 460 | }; | |
| 461 | pub const threadlocal_non_var = struct { | |
| 462 | const msg = "_Thread_local only allowed on variables"; | |
| 463 | const kind = .@"error"; | |
| 464 | }; | |
| 465 | pub const func_spec_non_func = struct { | |
| 466 | const msg = "'{s}' can only appear on functions"; | |
| 467 | const extra = .str; | |
| 468 | const kind = .@"error"; | |
| 469 | }; | |
| 470 | pub const illegal_storage_on_func = struct { | |
| 471 | const msg = "illegal storage class on function"; | |
| 472 | const kind = .@"error"; | |
| 473 | }; | |
| 474 | pub const illegal_storage_on_global = struct { | |
| 475 | const msg = "illegal storage class on global variable"; | |
| 476 | const kind = .@"error"; | |
| 477 | }; | |
| 478 | pub const expected_stmt = struct { | |
| 479 | const msg = "expected statement"; | |
| 480 | const kind = .@"error"; | |
| 481 | }; | |
| 482 | pub const func_cannot_return_func = struct { | |
| 483 | const msg = "function cannot return a function"; | |
| 484 | const kind = .@"error"; | |
| 485 | }; | |
| 486 | pub const func_cannot_return_array = struct { | |
| 487 | const msg = "function cannot return an array"; | |
| 488 | const kind = .@"error"; | |
| 489 | }; | |
| 490 | pub const undeclared_identifier = struct { | |
| 491 | const msg = "use of undeclared identifier '{s}'"; | |
| 492 | const extra = .str; | |
| 493 | const kind = .@"error"; | |
| 494 | }; | |
| 495 | pub const not_callable = struct { | |
| 496 | const msg = "cannot call non function type '{s}'"; | |
| 497 | const extra = .str; | |
| 498 | const kind = .@"error"; | |
| 499 | }; | |
| 500 | pub const unsupported_str_cat = struct { | |
| 501 | const msg = "unsupported string literal concatenation"; | |
| 502 | const kind = .@"error"; | |
| 503 | }; | |
| 504 | pub const static_func_not_global = struct { | |
| 505 | const msg = "static functions must be global"; | |
| 506 | const kind = .@"error"; | |
| 507 | }; | |
| 508 | pub const implicit_func_decl = struct { | |
| 509 | const msg = "implicit declaration of function '{s}' is invalid in C99"; | |
| 510 | const extra = .str; | |
| 511 | const opt = "implicit-function-declaration"; | |
| 512 | const kind = .warning; | |
| 513 | const all = true; | |
| 514 | }; | |
| 515 | pub const unknown_builtin = struct { | |
| 516 | const msg = "use of unknown builtin '{s}'"; | |
| 517 | const extra = .str; | |
| 518 | const opt = "implicit-function-declaration"; | |
| 519 | const kind = .@"error"; | |
| 520 | const all = true; | |
| 521 | }; | |
| 522 | pub const implicit_builtin = struct { | |
| 523 | const msg = "implicitly declaring library function '{s}'"; | |
| 524 | const extra = .str; | |
| 525 | const opt = "implicit-function-declaration"; | |
| 526 | const kind = .@"error"; | |
| 527 | const all = true; | |
| 528 | }; | |
| 529 | pub const implicit_builtin_header_note = struct { | |
| 530 | const msg = "include the header <{s}.h> or explicitly provide a declaration for '{s}'"; | |
| 531 | const extra = .builtin_with_header; | |
| 532 | const opt = "implicit-function-declaration"; | |
| 533 | const kind = .note; | |
| 534 | const all = true; | |
| 535 | }; | |
| 536 | pub const expected_param_decl = struct { | |
| 537 | const msg = "expected parameter declaration"; | |
| 538 | const kind = .@"error"; | |
| 539 | }; | |
| 540 | pub const invalid_old_style_params = struct { | |
| 541 | const msg = "identifier parameter lists are only allowed in function definitions"; | |
| 542 | const kind = .@"error"; | |
| 543 | }; | |
| 544 | pub const expected_fn_body = struct { | |
| 545 | const msg = "expected function body after function declaration"; | |
| 546 | const kind = .@"error"; | |
| 547 | }; | |
| 548 | pub const invalid_void_param = struct { | |
| 549 | const msg = "parameter cannot have void type"; | |
| 550 | const kind = .@"error"; | |
| 551 | }; | |
| 552 | pub const unused_value = struct { | |
| 553 | const msg = "expression result unused"; | |
| 554 | const opt = "unused-value"; | |
| 555 | const kind = .warning; | |
| 556 | const all = true; | |
| 557 | }; | |
| 558 | pub const continue_not_in_loop = struct { | |
| 559 | const msg = "'continue' statement not in a loop"; | |
| 560 | const kind = .@"error"; | |
| 561 | }; | |
| 562 | pub const break_not_in_loop_or_switch = struct { | |
| 563 | const msg = "'break' statement not in a loop or a switch"; | |
| 564 | const kind = .@"error"; | |
| 565 | }; | |
| 566 | pub const unreachable_code = struct { | |
| 567 | const msg = "unreachable code"; | |
| 568 | const opt = "unreachable-code"; | |
| 569 | const kind = .warning; | |
| 570 | const all = true; | |
| 571 | }; | |
| 572 | pub const duplicate_label = struct { | |
| 573 | const msg = "duplicate label '{s}'"; | |
| 574 | const extra = .str; | |
| 575 | const kind = .@"error"; | |
| 576 | }; | |
| 577 | pub const previous_label = struct { | |
| 578 | const msg = "previous definition of label '{s}' was here"; | |
| 579 | const extra = .str; | |
| 580 | const kind = .note; | |
| 581 | }; | |
| 582 | pub const undeclared_label = struct { | |
| 583 | const msg = "use of undeclared label '{s}'"; | |
| 584 | const extra = .str; | |
| 585 | const kind = .@"error"; | |
| 586 | }; | |
| 587 | pub const case_not_in_switch = struct { | |
| 588 | const msg = "'{s}' statement not in a switch statement"; | |
| 589 | const extra = .str; | |
| 590 | const kind = .@"error"; | |
| 591 | }; | |
| 592 | pub const duplicate_switch_case_signed = struct { | |
| 593 | const msg = "duplicate case value '{d}'"; | |
| 594 | const extra = .signed; | |
| 595 | const kind = .@"error"; | |
| 596 | }; | |
| 597 | pub const duplicate_switch_case_unsigned = struct { | |
| 598 | const msg = "duplicate case value '{d}'"; | |
| 599 | const extra = .unsigned; | |
| 600 | const kind = .@"error"; | |
| 601 | }; | |
| 602 | pub const multiple_default = struct { | |
| 603 | const msg = "multiple default cases in the same switch"; | |
| 604 | const kind = .@"error"; | |
| 605 | }; | |
| 606 | pub const previous_case = struct { | |
| 607 | const msg = "previous case defined here"; | |
| 608 | const kind = .note; | |
| 609 | }; | |
| 610 | pub const expected_arguments = struct { | |
| 611 | const msg = "expected {d} argument(s) got {d}"; | |
| 612 | const extra = .arguments; | |
| 613 | const kind = .@"error"; | |
| 614 | }; | |
| 615 | pub const expected_arguments_old = struct { | |
| 616 | const msg = expected_arguments.msg; | |
| 617 | const extra = .arguments; | |
| 618 | const kind = .warning; | |
| 619 | }; | |
| 620 | pub const expected_at_least_arguments = struct { | |
| 621 | const msg = "expected at least {d} argument(s) got {d}"; | |
| 622 | const extra = .arguments; | |
| 623 | const kind = .warning; | |
| 624 | }; | |
| 625 | pub const invalid_static_star = struct { | |
| 626 | const msg = "'static' may not be used with an unspecified variable length array size"; | |
| 627 | const kind = .@"error"; | |
| 628 | }; | |
| 629 | pub const static_non_param = struct { | |
| 630 | const msg = "'static' used outside of function parameters"; | |
| 631 | const kind = .@"error"; | |
| 632 | }; | |
| 633 | pub const array_qualifiers = struct { | |
| 634 | const msg = "type qualifier in non parameter array type"; | |
| 635 | const kind = .@"error"; | |
| 636 | }; | |
| 637 | pub const star_non_param = struct { | |
| 638 | const msg = "star modifier used outside of function parameters"; | |
| 639 | const kind = .@"error"; | |
| 640 | }; | |
| 641 | pub const variable_len_array_file_scope = struct { | |
| 642 | const msg = "variable length arrays not allowed at file scope"; | |
| 643 | const kind = .@"error"; | |
| 644 | }; | |
| 645 | pub const useless_static = struct { | |
| 646 | const msg = "'static' useless without a constant size"; | |
| 647 | const kind = .warning; | |
| 648 | const w_extra = true; | |
| 649 | }; | |
| 650 | pub const negative_array_size = struct { | |
| 651 | const msg = "array size must be 0 or greater"; | |
| 652 | const kind = .@"error"; | |
| 653 | }; | |
| 654 | pub const array_incomplete_elem = struct { | |
| 655 | const msg = "array has incomplete element type '{s}'"; | |
| 656 | const extra = .str; | |
| 657 | const kind = .@"error"; | |
| 658 | }; | |
| 659 | pub const array_func_elem = struct { | |
| 660 | const msg = "arrays cannot have functions as their element type"; | |
| 661 | const kind = .@"error"; | |
| 662 | }; | |
| 663 | pub const static_non_outermost_array = struct { | |
| 664 | const msg = "'static' used in non-outermost array type"; | |
| 665 | const kind = .@"error"; | |
| 666 | }; | |
| 667 | pub const qualifier_non_outermost_array = struct { | |
| 668 | const msg = "type qualifier used in non-outermost array type"; | |
| 669 | const kind = .@"error"; | |
| 670 | }; | |
| 671 | pub const unterminated_macro_arg_list = struct { | |
| 672 | const msg = "unterminated function macro argument list"; | |
| 673 | const kind = .@"error"; | |
| 674 | }; | |
| 675 | pub const unknown_warning = struct { | |
| 676 | const msg = "unknown warning '{s}'"; | |
| 677 | const extra = .str; | |
| 678 | const opt = "unknown-warning-option"; | |
| 679 | const kind = .warning; | |
| 680 | }; | |
| 681 | pub const overflow_signed = struct { | |
| 682 | const msg = "overflow in expression; result is '{d}'"; | |
| 683 | const extra = .signed; | |
| 684 | const opt = "integer-overflow"; | |
| 685 | const kind = .warning; | |
| 686 | }; | |
| 687 | pub const overflow_unsigned = struct { | |
| 688 | const msg = overflow_signed.msg; | |
| 689 | const extra = .unsigned; | |
| 690 | const opt = "integer-overflow"; | |
| 691 | const kind = .warning; | |
| 692 | }; | |
| 693 | pub const int_literal_too_big = struct { | |
| 694 | const msg = "integer literal is too large to be represented in any integer type"; | |
| 695 | const kind = .@"error"; | |
| 696 | }; | |
| 697 | pub const indirection_ptr = struct { | |
| 698 | const msg = "indirection requires pointer operand"; | |
| 699 | const kind = .@"error"; | |
| 700 | }; | |
| 701 | pub const addr_of_rvalue = struct { | |
| 702 | const msg = "cannot take the address of an rvalue"; | |
| 703 | const kind = .@"error"; | |
| 704 | }; | |
| 705 | pub const addr_of_bitfield = struct { | |
| 706 | const msg = "address of bit-field requested"; | |
| 707 | const kind = .@"error"; | |
| 708 | }; | |
| 709 | pub const not_assignable = struct { | |
| 710 | const msg = "expression is not assignable"; | |
| 711 | const kind = .@"error"; | |
| 712 | }; | |
| 713 | pub const ident_or_l_brace = struct { | |
| 714 | const msg = "expected identifier or '{'"; | |
| 715 | const kind = .@"error"; | |
| 716 | }; | |
| 717 | pub const empty_enum = struct { | |
| 718 | const msg = "empty enum is invalid"; | |
| 719 | const kind = .@"error"; | |
| 720 | }; | |
| 721 | pub const redefinition = struct { | |
| 722 | const msg = "redefinition of '{s}'"; | |
| 723 | const extra = .str; | |
| 724 | const kind = .@"error"; | |
| 725 | }; | |
| 726 | pub const previous_definition = struct { | |
| 727 | const msg = "previous definition is here"; | |
| 728 | const kind = .note; | |
| 729 | }; | |
| 730 | pub const expected_identifier = struct { | |
| 731 | const msg = "expected identifier"; | |
| 732 | const kind = .@"error"; | |
| 733 | }; | |
| 734 | pub const expected_str_literal = struct { | |
| 735 | const msg = "expected string literal for diagnostic message in static_assert"; | |
| 736 | const kind = .@"error"; | |
| 737 | }; | |
| 738 | pub const expected_str_literal_in = struct { | |
| 739 | const msg = "expected string literal in '{s}'"; | |
| 740 | const extra = .str; | |
| 741 | const kind = .@"error"; | |
| 742 | }; | |
| 743 | pub const parameter_missing = struct { | |
| 744 | const msg = "parameter named '{s}' is missing"; | |
| 745 | const extra = .str; | |
| 746 | const kind = .@"error"; | |
| 747 | }; | |
| 748 | pub const empty_record = struct { | |
| 749 | const msg = "empty {s} is a GNU extension"; | |
| 750 | const extra = .str; | |
| 751 | const opt = "gnu-empty-struct"; | |
| 752 | const kind = .off; | |
| 753 | const pedantic = true; | |
| 754 | }; | |
| 755 | pub const empty_record_size = struct { | |
| 756 | const msg = "empty {s} has size 0 in C, size 1 in C++"; | |
| 757 | const extra = .str; | |
| 758 | const opt = "c++-compat"; | |
| 759 | const kind = .off; | |
| 760 | }; | |
| 761 | pub const wrong_tag = struct { | |
| 762 | const msg = "use of '{s}' with tag type that does not match previous definition"; | |
| 763 | const extra = .str; | |
| 764 | const kind = .@"error"; | |
| 765 | }; | |
| 766 | pub const expected_parens_around_typename = struct { | |
| 767 | const msg = "expected parentheses around type name"; | |
| 768 | const kind = .@"error"; | |
| 769 | }; | |
| 770 | pub const alignof_expr = struct { | |
| 771 | const msg = "'_Alignof' applied to an expression is a GNU extension"; | |
| 772 | const opt = "gnu-alignof-expression"; | |
| 773 | const kind = .warning; | |
| 774 | const suppress_gnu = true; | |
| 775 | }; | |
| 776 | pub const invalid_alignof = struct { | |
| 777 | const msg = "invalid application of 'alignof' to an incomplete type '{s}'"; | |
| 778 | const extra = .str; | |
| 779 | const kind = .@"error"; | |
| 780 | }; | |
| 781 | pub const invalid_sizeof = struct { | |
| 782 | const msg = "invalid application of 'sizeof' to an incomplete type '{s}'"; | |
| 783 | const extra = .str; | |
| 784 | const kind = .@"error"; | |
| 785 | }; | |
| 786 | pub const macro_redefined = struct { | |
| 787 | const msg = "'{s}' macro redefined"; | |
| 788 | const extra = .str; | |
| 789 | const opt = "macro-redefined"; | |
| 790 | const kind = .warning; | |
| 791 | }; | |
| 792 | pub const generic_qual_type = struct { | |
| 793 | const msg = "generic association with qualifiers cannot be matched with"; | |
| 794 | const opt = "generic-qual-type"; | |
| 795 | const kind = .warning; | |
| 796 | }; | |
| 797 | pub const generic_array_type = struct { | |
| 798 | const msg = "generic association array type cannot be matched with"; | |
| 799 | const opt = "generic-qual-type"; | |
| 800 | const kind = .warning; | |
| 801 | }; | |
| 802 | pub const generic_func_type = struct { | |
| 803 | const msg = "generic association function type cannot be matched with"; | |
| 804 | const opt = "generic-qual-type"; | |
| 805 | const kind = .warning; | |
| 806 | }; | |
| 807 | pub const generic_duplicate = struct { | |
| 808 | const msg = "type '{s}' in generic association compatible with previously specified type"; | |
| 809 | const extra = .str; | |
| 810 | const kind = .@"error"; | |
| 811 | }; | |
| 812 | pub const generic_duplicate_here = struct { | |
| 813 | const msg = "compatible type '{s}' specified here"; | |
| 814 | const extra = .str; | |
| 815 | const kind = .note; | |
| 816 | }; | |
| 817 | pub const generic_duplicate_default = struct { | |
| 818 | const msg = "duplicate default generic association"; | |
| 819 | const kind = .@"error"; | |
| 820 | }; | |
| 821 | pub const generic_no_match = struct { | |
| 822 | const msg = "controlling expression type '{s}' not compatible with any generic association type"; | |
| 823 | const extra = .str; | |
| 824 | const kind = .@"error"; | |
| 825 | }; | |
| 826 | pub const escape_sequence_overflow = struct { | |
| 827 | const msg = "escape sequence out of range"; | |
| 828 | const kind = .@"error"; | |
| 829 | }; | |
| 830 | pub const invalid_universal_character = struct { | |
| 831 | const msg = "invalid universal character"; | |
| 832 | const kind = .@"error"; | |
| 833 | }; | |
| 834 | pub const multichar_literal = struct { | |
| 835 | const msg = "multi-character character constant"; | |
| 836 | const opt = "multichar"; | |
| 837 | const kind = .warning; | |
| 838 | const all = true; | |
| 839 | }; | |
| 840 | pub const unicode_multichar_literal = struct { | |
| 841 | const msg = "Unicode character literals may not contain multiple characters"; | |
| 842 | const kind = .@"error"; | |
| 843 | }; | |
| 844 | pub const wide_multichar_literal = struct { | |
| 845 | const msg = "extraneous characters in character constant ignored"; | |
| 846 | const kind = .warning; | |
| 847 | }; | |
| 848 | pub const char_lit_too_wide = struct { | |
| 849 | const msg = "character constant too long for its type"; | |
| 850 | const kind = .warning; | |
| 851 | const all = true; | |
| 852 | }; | |
| 853 | pub const char_too_large = struct { | |
| 854 | const msg = "character too large for enclosing character literal type"; | |
| 855 | const kind = .@"error"; | |
| 856 | }; | |
| 857 | pub const must_use_struct = struct { | |
| 858 | const msg = "must use 'struct' tag to refer to type '{s}'"; | |
| 859 | const extra = .str; | |
| 860 | const kind = .@"error"; | |
| 861 | }; | |
| 862 | pub const must_use_union = struct { | |
| 863 | const msg = "must use 'union' tag to refer to type '{s}'"; | |
| 864 | const extra = .str; | |
| 865 | const kind = .@"error"; | |
| 866 | }; | |
| 867 | pub const must_use_enum = struct { | |
| 868 | const msg = "must use 'enum' tag to refer to type '{s}'"; | |
| 869 | const extra = .str; | |
| 870 | const kind = .@"error"; | |
| 871 | }; | |
| 872 | pub const redefinition_different_sym = struct { | |
| 873 | const msg = "redefinition of '{s}' as different kind of symbol"; | |
| 874 | const extra = .str; | |
| 875 | const kind = .@"error"; | |
| 876 | }; | |
| 877 | pub const redefinition_incompatible = struct { | |
| 878 | const msg = "redefinition of '{s}' with a different type"; | |
| 879 | const extra = .str; | |
| 880 | const kind = .@"error"; | |
| 881 | }; | |
| 882 | pub const redefinition_of_parameter = struct { | |
| 883 | const msg = "redefinition of parameter '{s}'"; | |
| 884 | const extra = .str; | |
| 885 | const kind = .@"error"; | |
| 886 | }; | |
| 887 | pub const invalid_bin_types = struct { | |
| 888 | const msg = "invalid operands to binary expression ({s})"; | |
| 889 | const extra = .str; | |
| 890 | const kind = .@"error"; | |
| 891 | }; | |
| 892 | pub const comparison_ptr_int = struct { | |
| 893 | const msg = "comparison between pointer and integer ({s})"; | |
| 894 | const extra = .str; | |
| 895 | const opt = "pointer-integer-compare"; | |
| 896 | const kind = .warning; | |
| 897 | }; | |
| 898 | pub const comparison_distinct_ptr = struct { | |
| 899 | const msg = "comparison of distinct pointer types ({s})"; | |
| 900 | const extra = .str; | |
| 901 | const opt = "compare-distinct-pointer-types"; | |
| 902 | const kind = .warning; | |
| 903 | }; | |
| 904 | pub const incompatible_pointers = struct { | |
| 905 | const msg = "incompatible pointer types ({s})"; | |
| 906 | const extra = .str; | |
| 907 | const kind = .@"error"; | |
| 908 | }; | |
| 909 | pub const invalid_argument_un = struct { | |
| 910 | const msg = "invalid argument type '{s}' to unary expression"; | |
| 911 | const extra = .str; | |
| 912 | const kind = .@"error"; | |
| 913 | }; | |
| 914 | pub const incompatible_assign = struct { | |
| 915 | const msg = "assignment to {s}"; | |
| 916 | const extra = .str; | |
| 917 | const kind = .@"error"; | |
| 918 | }; | |
| 919 | pub const implicit_ptr_to_int = struct { | |
| 920 | const msg = "implicit pointer to integer conversion from {s}"; | |
| 921 | const extra = .str; | |
| 922 | const opt = "int-conversion"; | |
| 923 | const kind = .warning; | |
| 924 | }; | |
| 925 | pub const invalid_cast_to_float = struct { | |
| 926 | const msg = "pointer cannot be cast to type '{s}'"; | |
| 927 | const extra = .str; | |
| 928 | const kind = .@"error"; | |
| 929 | }; | |
| 930 | pub const invalid_cast_to_pointer = struct { | |
| 931 | const msg = "operand of type '{s}' cannot be cast to a pointer type"; | |
| 932 | const extra = .str; | |
| 933 | const kind = .@"error"; | |
| 934 | }; | |
| 935 | pub const invalid_cast_type = struct { | |
| 936 | const msg = "cannot cast to non arithmetic or pointer type '{s}'"; | |
| 937 | const extra = .str; | |
| 938 | const kind = .@"error"; | |
| 939 | }; | |
| 940 | pub const qual_cast = struct { | |
| 941 | const msg = "cast to type '{s}' will not preserve qualifiers"; | |
| 942 | const extra = .str; | |
| 943 | const opt = "cast-qualifiers"; | |
| 944 | const kind = .warning; | |
| 945 | }; | |
| 946 | pub const invalid_index = struct { | |
| 947 | const msg = "array subscript is not an integer"; | |
| 948 | const kind = .@"error"; | |
| 949 | }; | |
| 950 | pub const invalid_subscript = struct { | |
| 951 | const msg = "subscripted value is not an array or pointer"; | |
| 952 | const kind = .@"error"; | |
| 953 | }; | |
| 954 | pub const array_after = struct { | |
| 955 | const msg = "array index {d} is past the end of the array"; | |
| 956 | const extra = .unsigned; | |
| 957 | const opt = "array-bounds"; | |
| 958 | const kind = .warning; | |
| 959 | }; | |
| 960 | pub const array_before = struct { | |
| 961 | const msg = "array index {d} is before the beginning of the array"; | |
| 962 | const extra = .signed; | |
| 963 | const opt = "array-bounds"; | |
| 964 | const kind = .warning; | |
| 965 | }; | |
| 966 | pub const statement_int = struct { | |
| 967 | const msg = "statement requires expression with integer type ('{s}' invalid)"; | |
| 968 | const extra = .str; | |
| 969 | const kind = .@"error"; | |
| 970 | }; | |
| 971 | pub const statement_scalar = struct { | |
| 972 | const msg = "statement requires expression with scalar type ('{s}' invalid)"; | |
| 973 | const extra = .str; | |
| 974 | const kind = .@"error"; | |
| 975 | }; | |
| 976 | pub const func_should_return = struct { | |
| 977 | const msg = "non-void function '{s}' should return a value"; | |
| 978 | const extra = .str; | |
| 979 | const opt = "return-type"; | |
| 980 | const kind = .@"error"; | |
| 981 | const all = true; | |
| 982 | }; | |
| 983 | pub const incompatible_return = struct { | |
| 984 | const msg = "returning {s}"; | |
| 985 | const extra = .str; | |
| 986 | const kind = .@"error"; | |
| 987 | }; | |
| 988 | pub const incompatible_return_sign = struct { | |
| 989 | const msg = "returning {s}" ++ PointerSignMessage; | |
| 990 | const extra = .str; | |
| 991 | const kind = .warning; | |
| 992 | const opt = "pointer-sign"; | |
| 993 | }; | |
| 994 | pub const implicit_int_to_ptr = struct { | |
| 995 | const msg = "implicit integer to pointer conversion from {s}"; | |
| 996 | const extra = .str; | |
| 997 | const opt = "int-conversion"; | |
| 998 | const kind = .warning; | |
| 999 | }; | |
| 1000 | pub const func_does_not_return = struct { | |
| 1001 | const msg = "non-void function '{s}' does not return a value"; | |
| 1002 | const extra = .str; | |
| 1003 | const opt = "return-type"; | |
| 1004 | const kind = .warning; | |
| 1005 | const all = true; | |
| 1006 | }; | |
| 1007 | pub const void_func_returns_value = struct { | |
| 1008 | const msg = "void function '{s}' should not return a value"; | |
| 1009 | const extra = .str; | |
| 1010 | const opt = "return-type"; | |
| 1011 | const kind = .@"error"; | |
| 1012 | const all = true; | |
| 1013 | }; | |
| 1014 | pub const incompatible_arg = struct { | |
| 1015 | const msg = "passing {s}"; | |
| 1016 | const extra = .str; | |
| 1017 | const kind = .@"error"; | |
| 1018 | }; | |
| 1019 | pub const incompatible_ptr_arg = struct { | |
| 1020 | const msg = "passing {s}"; | |
| 1021 | const extra = .str; | |
| 1022 | const kind = .warning; | |
| 1023 | const opt = "incompatible-pointer-types"; | |
| 1024 | }; | |
| 1025 | pub const incompatible_ptr_arg_sign = struct { | |
| 1026 | const msg = "passing {s}" ++ PointerSignMessage; | |
| 1027 | const extra = .str; | |
| 1028 | const kind = .warning; | |
| 1029 | const opt = "pointer-sign"; | |
| 1030 | }; | |
| 1031 | pub const parameter_here = struct { | |
| 1032 | const msg = "passing argument to parameter here"; | |
| 1033 | const kind = .note; | |
| 1034 | }; | |
| 1035 | pub const atomic_array = struct { | |
| 1036 | const msg = "atomic cannot be applied to array type '{s}'"; | |
| 1037 | const extra = .str; | |
| 1038 | const kind = .@"error"; | |
| 1039 | }; | |
| 1040 | pub const atomic_func = struct { | |
| 1041 | const msg = "atomic cannot be applied to function type '{s}'"; | |
| 1042 | const extra = .str; | |
| 1043 | const kind = .@"error"; | |
| 1044 | }; | |
| 1045 | pub const atomic_incomplete = struct { | |
| 1046 | const msg = "atomic cannot be applied to incomplete type '{s}'"; | |
| 1047 | const extra = .str; | |
| 1048 | const kind = .@"error"; | |
| 1049 | }; | |
| 1050 | pub const addr_of_register = struct { | |
| 1051 | const msg = "address of register variable requested"; | |
| 1052 | const kind = .@"error"; | |
| 1053 | }; | |
| 1054 | pub const variable_incomplete_ty = struct { | |
| 1055 | const msg = "variable has incomplete type '{s}'"; | |
| 1056 | const extra = .str; | |
| 1057 | const kind = .@"error"; | |
| 1058 | }; | |
| 1059 | pub const parameter_incomplete_ty = struct { | |
| 1060 | const msg = "parameter has incomplete type '{s}'"; | |
| 1061 | const extra = .str; | |
| 1062 | const kind = .@"error"; | |
| 1063 | }; | |
| 1064 | pub const tentative_array = struct { | |
| 1065 | const msg = "tentative array definition assumed to have one element"; | |
| 1066 | const kind = .warning; | |
| 1067 | }; | |
| 1068 | pub const deref_incomplete_ty_ptr = struct { | |
| 1069 | const msg = "dereferencing pointer to incomplete type '{s}'"; | |
| 1070 | const extra = .str; | |
| 1071 | const kind = .@"error"; | |
| 1072 | }; | |
| 1073 | pub const alignas_on_func = struct { | |
| 1074 | const msg = "'_Alignas' attribute only applies to variables and fields"; | |
| 1075 | const kind = .@"error"; | |
| 1076 | }; | |
| 1077 | pub const alignas_on_param = struct { | |
| 1078 | const msg = "'_Alignas' attribute cannot be applied to a function parameter"; | |
| 1079 | const kind = .@"error"; | |
| 1080 | }; | |
| 1081 | pub const minimum_alignment = struct { | |
| 1082 | const msg = "requested alignment is less than minimum alignment of {d}"; | |
| 1083 | const extra = .unsigned; | |
| 1084 | const kind = .@"error"; | |
| 1085 | }; | |
| 1086 | pub const maximum_alignment = struct { | |
| 1087 | const msg = "requested alignment of {d} is too large"; | |
| 1088 | const extra = .unsigned; | |
| 1089 | const kind = .@"error"; | |
| 1090 | }; | |
| 1091 | pub const negative_alignment = struct { | |
| 1092 | const msg = "requested negative alignment of {d} is invalid"; | |
| 1093 | const extra = .signed; | |
| 1094 | const kind = .@"error"; | |
| 1095 | }; | |
| 1096 | pub const align_ignored = struct { | |
| 1097 | const msg = "'_Alignas' attribute is ignored here"; | |
| 1098 | const kind = .warning; | |
| 1099 | }; | |
| 1100 | pub const zero_align_ignored = struct { | |
| 1101 | const msg = "requested alignment of zero is ignored"; | |
| 1102 | const kind = .warning; | |
| 1103 | }; | |
| 1104 | pub const non_pow2_align = struct { | |
| 1105 | const msg = "requested alignment is not a power of 2"; | |
| 1106 | const kind = .@"error"; | |
| 1107 | }; | |
| 1108 | pub const pointer_mismatch = struct { | |
| 1109 | const msg = "pointer type mismatch ({s})"; | |
| 1110 | const extra = .str; | |
| 1111 | const opt = "pointer-type-mismatch"; | |
| 1112 | const kind = .warning; | |
| 1113 | }; | |
| 1114 | pub const static_assert_not_constant = struct { | |
| 1115 | const msg = "static_assert expression is not an integral constant expression"; | |
| 1116 | const kind = .@"error"; | |
| 1117 | }; | |
| 1118 | pub const static_assert_missing_message = struct { | |
| 1119 | const msg = "static_assert with no message is a C2X extension"; | |
| 1120 | const opt = "c2x-extensions"; | |
| 1121 | const kind = .warning; | |
| 1122 | const suppress_version = .c2x; | |
| 1123 | }; | |
| 1124 | pub const pre_c2x_compat = struct { | |
| 1125 | const msg = "{s} is incompatible with C standards before C2x"; | |
| 1126 | const extra = .str; | |
| 1127 | const kind = .off; | |
| 1128 | const suppress_unless_version = .c2x; | |
| 1129 | const opt = "pre-c2x-compat"; | |
| 1130 | }; | |
| 1131 | pub const unbound_vla = struct { | |
| 1132 | const msg = "variable length array must be bound in function definition"; | |
| 1133 | const kind = .@"error"; | |
| 1134 | }; | |
| 1135 | pub const array_too_large = struct { | |
| 1136 | const msg = "array is too large"; | |
| 1137 | const kind = .@"error"; | |
| 1138 | }; | |
| 1139 | pub const incompatible_ptr_init = struct { | |
| 1140 | const msg = "incompatible pointer types initializing {s}"; | |
| 1141 | const extra = .str; | |
| 1142 | const opt = "incompatible-pointer-types"; | |
| 1143 | const kind = .warning; | |
| 1144 | }; | |
| 1145 | pub const incompatible_ptr_init_sign = struct { | |
| 1146 | const msg = "incompatible pointer types initializing {s}" ++ PointerSignMessage; | |
| 1147 | const extra = .str; | |
| 1148 | const opt = "pointer-sign"; | |
| 1149 | const kind = .warning; | |
| 1150 | }; | |
| 1151 | pub const incompatible_ptr_assign = struct { | |
| 1152 | const msg = "incompatible pointer types assigning to {s}"; | |
| 1153 | const extra = .str; | |
| 1154 | const opt = "incompatible-pointer-types"; | |
| 1155 | const kind = .warning; | |
| 1156 | }; | |
| 1157 | pub const incompatible_ptr_assign_sign = struct { | |
| 1158 | const msg = "incompatible pointer types assigning to {s} " ++ PointerSignMessage; | |
| 1159 | const extra = .str; | |
| 1160 | const opt = "pointer-sign"; | |
| 1161 | const kind = .warning; | |
| 1162 | }; | |
| 1163 | pub const vla_init = struct { | |
| 1164 | const msg = "variable-sized object may not be initialized"; | |
| 1165 | const kind = .@"error"; | |
| 1166 | }; | |
| 1167 | pub const func_init = struct { | |
| 1168 | const msg = "illegal initializer type"; | |
| 1169 | const kind = .@"error"; | |
| 1170 | }; | |
| 1171 | pub const incompatible_init = struct { | |
| 1172 | const msg = "initializing {s}"; | |
| 1173 | const extra = .str; | |
| 1174 | const kind = .@"error"; | |
| 1175 | }; | |
| 1176 | pub const empty_scalar_init = struct { | |
| 1177 | const msg = "scalar initializer cannot be empty"; | |
| 1178 | const kind = .@"error"; | |
| 1179 | }; | |
| 1180 | pub const excess_scalar_init = struct { | |
| 1181 | const msg = "excess elements in scalar initializer"; | |
| 1182 | const opt = "excess-initializers"; | |
| 1183 | const kind = .warning; | |
| 1184 | }; | |
| 1185 | pub const excess_str_init = struct { | |
| 1186 | const msg = "excess elements in string initializer"; | |
| 1187 | const opt = "excess-initializers"; | |
| 1188 | const kind = .warning; | |
| 1189 | }; | |
| 1190 | pub const excess_struct_init = struct { | |
| 1191 | const msg = "excess elements in struct initializer"; | |
| 1192 | const opt = "excess-initializers"; | |
| 1193 | const kind = .warning; | |
| 1194 | }; | |
| 1195 | pub const excess_array_init = struct { | |
| 1196 | const msg = "excess elements in array initializer"; | |
| 1197 | const opt = "excess-initializers"; | |
| 1198 | const kind = .warning; | |
| 1199 | }; | |
| 1200 | pub const str_init_too_long = struct { | |
| 1201 | const msg = "initializer-string for char array is too long"; | |
| 1202 | const opt = "excess-initializers"; | |
| 1203 | const kind = .warning; | |
| 1204 | }; | |
| 1205 | pub const arr_init_too_long = struct { | |
| 1206 | const msg = "cannot initialize type ({s})"; | |
| 1207 | const extra = .str; | |
| 1208 | const kind = .@"error"; | |
| 1209 | }; | |
| 1210 | pub const invalid_typeof = struct { | |
| 1211 | const msg = "'{s} typeof' is invalid"; | |
| 1212 | const extra = .str; | |
| 1213 | const kind = .@"error"; | |
| 1214 | }; | |
| 1215 | pub const division_by_zero = struct { | |
| 1216 | const msg = "{s} by zero is undefined"; | |
| 1217 | const extra = .str; | |
| 1218 | const opt = "division-by-zero"; | |
| 1219 | const kind = .warning; | |
| 1220 | }; | |
| 1221 | pub const division_by_zero_macro = struct { | |
| 1222 | const msg = "{s} by zero in preprocessor expression"; | |
| 1223 | const extra = .str; | |
| 1224 | const kind = .@"error"; | |
| 1225 | }; | |
| 1226 | pub const builtin_choose_cond = struct { | |
| 1227 | const msg = "'__builtin_choose_expr' requires a constant expression"; | |
| 1228 | const kind = .@"error"; | |
| 1229 | }; | |
| 1230 | pub const alignas_unavailable = struct { | |
| 1231 | const msg = "'_Alignas' attribute requires integer constant expression"; | |
| 1232 | const kind = .@"error"; | |
| 1233 | }; | |
| 1234 | pub const case_val_unavailable = struct { | |
| 1235 | const msg = "case value must be an integer constant expression"; | |
| 1236 | const kind = .@"error"; | |
| 1237 | }; | |
| 1238 | pub const enum_val_unavailable = struct { | |
| 1239 | const msg = "enum value must be an integer constant expression"; | |
| 1240 | const kind = .@"error"; | |
| 1241 | }; | |
| 1242 | pub const incompatible_array_init = struct { | |
| 1243 | const msg = "cannot initialize array of type {s}"; | |
| 1244 | const extra = .str; | |
| 1245 | const kind = .@"error"; | |
| 1246 | }; | |
| 1247 | pub const array_init_str = struct { | |
| 1248 | const msg = "array initializer must be an initializer list or wide string literal"; | |
| 1249 | const kind = .@"error"; | |
| 1250 | }; | |
| 1251 | pub const initializer_overrides = struct { | |
| 1252 | const msg = "initializer overrides previous initialization"; | |
| 1253 | const opt = "initializer-overrides"; | |
| 1254 | const kind = .warning; | |
| 1255 | const w_extra = true; | |
| 1256 | }; | |
| 1257 | pub const previous_initializer = struct { | |
| 1258 | const msg = "previous initialization"; | |
| 1259 | const kind = .note; | |
| 1260 | }; | |
| 1261 | pub const invalid_array_designator = struct { | |
| 1262 | const msg = "array designator used for non-array type '{s}'"; | |
| 1263 | const extra = .str; | |
| 1264 | const kind = .@"error"; | |
| 1265 | }; | |
| 1266 | pub const negative_array_designator = struct { | |
| 1267 | const msg = "array designator value {d} is negative"; | |
| 1268 | const extra = .signed; | |
| 1269 | const kind = .@"error"; | |
| 1270 | }; | |
| 1271 | pub const oob_array_designator = struct { | |
| 1272 | const msg = "array designator index {d} exceeds array bounds"; | |
| 1273 | const extra = .unsigned; | |
| 1274 | const kind = .@"error"; | |
| 1275 | }; | |
| 1276 | pub const invalid_field_designator = struct { | |
| 1277 | const msg = "field designator used for non-record type '{s}'"; | |
| 1278 | const extra = .str; | |
| 1279 | const kind = .@"error"; | |
| 1280 | }; | |
| 1281 | pub const no_such_field_designator = struct { | |
| 1282 | const msg = "record type has no field named '{s}'"; | |
| 1283 | const extra = .str; | |
| 1284 | const kind = .@"error"; | |
| 1285 | }; | |
| 1286 | pub const empty_aggregate_init_braces = struct { | |
| 1287 | const msg = "initializer for aggregate with no elements requires explicit braces"; | |
| 1288 | const kind = .@"error"; | |
| 1289 | }; | |
| 1290 | pub const ptr_init_discards_quals = struct { | |
| 1291 | const msg = "initializing {s} discards qualifiers"; | |
| 1292 | const extra = .str; | |
| 1293 | const opt = "incompatible-pointer-types-discards-qualifiers"; | |
| 1294 | const kind = .warning; | |
| 1295 | }; | |
| 1296 | pub const ptr_assign_discards_quals = struct { | |
| 1297 | const msg = "assigning to {s} discards qualifiers"; | |
| 1298 | const extra = .str; | |
| 1299 | const opt = "incompatible-pointer-types-discards-qualifiers"; | |
| 1300 | const kind = .warning; | |
| 1301 | }; | |
| 1302 | pub const ptr_ret_discards_quals = struct { | |
| 1303 | const msg = "returning {s} discards qualifiers"; | |
| 1304 | const extra = .str; | |
| 1305 | const opt = "incompatible-pointer-types-discards-qualifiers"; | |
| 1306 | const kind = .warning; | |
| 1307 | }; | |
| 1308 | pub const ptr_arg_discards_quals = struct { | |
| 1309 | const msg = "passing {s} discards qualifiers"; | |
| 1310 | const extra = .str; | |
| 1311 | const opt = "incompatible-pointer-types-discards-qualifiers"; | |
| 1312 | const kind = .warning; | |
| 1313 | }; | |
| 1314 | pub const unknown_attribute = struct { | |
| 1315 | const msg = "unknown attribute '{s}' ignored"; | |
| 1316 | const extra = .str; | |
| 1317 | const opt = "unknown-attributes"; | |
| 1318 | const kind = .warning; | |
| 1319 | }; | |
| 1320 | pub const ignored_attribute = struct { | |
| 1321 | const msg = "{s}"; | |
| 1322 | const extra = .str; | |
| 1323 | const opt = "ignored-attributes"; | |
| 1324 | const kind = .warning; | |
| 1325 | }; | |
| 1326 | pub const invalid_fallthrough = struct { | |
| 1327 | const msg = "fallthrough annotation does not directly precede switch label"; | |
| 1328 | const kind = .@"error"; | |
| 1329 | }; | |
| 1330 | pub const cannot_apply_attribute_to_statement = struct { | |
| 1331 | const msg = "'{s}' attribute cannot be applied to a statement"; | |
| 1332 | const extra = .str; | |
| 1333 | const kind = .@"error"; | |
| 1334 | }; | |
| 1335 | pub const builtin_macro_redefined = struct { | |
| 1336 | const msg = "redefining builtin macro"; | |
| 1337 | const opt = "builtin-macro-redefined"; | |
| 1338 | const kind = .warning; | |
| 1339 | }; | |
| 1340 | pub const feature_check_requires_identifier = struct { | |
| 1341 | const msg = "builtin feature check macro requires a parenthesized identifier"; | |
| 1342 | const kind = .@"error"; | |
| 1343 | }; | |
| 1344 | pub const missing_tok_builtin = struct { | |
| 1345 | const msg = "missing '{s}', after builtin feature-check macro"; | |
| 1346 | const extra = .tok_id_expected; | |
| 1347 | const kind = .@"error"; | |
| 1348 | }; | |
| 1349 | pub const gnu_label_as_value = struct { | |
| 1350 | const msg = "use of GNU address-of-label extension"; | |
| 1351 | const opt = "gnu-label-as-value"; | |
| 1352 | const kind = .off; | |
| 1353 | const pedantic = true; | |
| 1354 | }; | |
| 1355 | pub const expected_record_ty = struct { | |
| 1356 | const msg = "member reference base type '{s}' is not a structure or union"; | |
| 1357 | const extra = .str; | |
| 1358 | const kind = .@"error"; | |
| 1359 | }; | |
| 1360 | pub const member_expr_not_ptr = struct { | |
| 1361 | const msg = "member reference type '{s}' is not a pointer; did you mean to use '.'?"; | |
| 1362 | const extra = .str; | |
| 1363 | const kind = .@"error"; | |
| 1364 | }; | |
| 1365 | pub const member_expr_ptr = struct { | |
| 1366 | const msg = "member reference type '{s}' is a pointer; did you mean to use '->'?"; | |
| 1367 | const extra = .str; | |
| 1368 | const kind = .@"error"; | |
| 1369 | }; | |
| 1370 | pub const no_such_member = struct { | |
| 1371 | const msg = "no member named {s}"; | |
| 1372 | const extra = .str; | |
| 1373 | const kind = .@"error"; | |
| 1374 | }; | |
| 1375 | pub const malformed_warning_check = struct { | |
| 1376 | const msg = "{s} expected option name (e.g. \"-Wundef\")"; | |
| 1377 | const extra = .str; | |
| 1378 | const opt = "malformed-warning-check"; | |
| 1379 | const kind = .warning; | |
| 1380 | const all = true; | |
| 1381 | }; | |
| 1382 | pub const invalid_computed_goto = struct { | |
| 1383 | const msg = "computed goto in function with no address-of-label expressions"; | |
| 1384 | const kind = .@"error"; | |
| 1385 | }; | |
| 1386 | pub const pragma_warning_message = struct { | |
| 1387 | const msg = "{s}"; | |
| 1388 | const extra = .str; | |
| 1389 | const opt = "#pragma-messages"; | |
| 1390 | const kind = .warning; | |
| 1391 | }; | |
| 1392 | pub const pragma_error_message = struct { | |
| 1393 | const msg = "{s}"; | |
| 1394 | const extra = .str; | |
| 1395 | const kind = .@"error"; | |
| 1396 | }; | |
| 1397 | pub const pragma_message = struct { | |
| 1398 | const msg = "#pragma message: {s}"; | |
| 1399 | const extra = .str; | |
| 1400 | const kind = .note; | |
| 1401 | }; | |
| 1402 | pub const pragma_requires_string_literal = struct { | |
| 1403 | const msg = "pragma {s} requires string literal"; | |
| 1404 | const extra = .str; | |
| 1405 | const kind = .@"error"; | |
| 1406 | }; | |
| 1407 | pub const poisoned_identifier = struct { | |
| 1408 | const msg = "attempt to use a poisoned identifier"; | |
| 1409 | const kind = .@"error"; | |
| 1410 | }; | |
| 1411 | pub const pragma_poison_identifier = struct { | |
| 1412 | const msg = "can only poison identifier tokens"; | |
| 1413 | const kind = .@"error"; | |
| 1414 | }; | |
| 1415 | pub const pragma_poison_macro = struct { | |
| 1416 | const msg = "poisoning existing macro"; | |
| 1417 | const kind = .warning; | |
| 1418 | }; | |
| 1419 | pub const newline_eof = struct { | |
| 1420 | const msg = "no newline at end of file"; | |
| 1421 | const opt = "newline-eof"; | |
| 1422 | const kind = .off; | |
| 1423 | const pedantic = true; | |
| 1424 | }; | |
| 1425 | pub const empty_translation_unit = struct { | |
| 1426 | const msg = "ISO C requires a translation unit to contain at least one declaration"; | |
| 1427 | const opt = "empty-translation-unit"; | |
| 1428 | const kind = .off; | |
| 1429 | const pedantic = true; | |
| 1430 | }; | |
| 1431 | pub const omitting_parameter_name = struct { | |
| 1432 | const msg = "omitting the parameter name in a function definition is a C2x extension"; | |
| 1433 | const opt = "c2x-extensions"; | |
| 1434 | const kind = .warning; | |
| 1435 | const suppress_version = .c2x; | |
| 1436 | }; | |
| 1437 | pub const non_int_bitfield = struct { | |
| 1438 | const msg = "bit-field has non-integer type '{s}'"; | |
| 1439 | const extra = .str; | |
| 1440 | const kind = .@"error"; | |
| 1441 | }; | |
| 1442 | pub const negative_bitwidth = struct { | |
| 1443 | const msg = "bit-field has negative width ({d})"; | |
| 1444 | const extra = .signed; | |
| 1445 | const kind = .@"error"; | |
| 1446 | }; | |
| 1447 | pub const zero_width_named_field = struct { | |
| 1448 | const msg = "named bit-field has zero width"; | |
| 1449 | const kind = .@"error"; | |
| 1450 | }; | |
| 1451 | pub const bitfield_too_big = struct { | |
| 1452 | const msg = "width of bit-field exceeds width of its type"; | |
| 1453 | const kind = .@"error"; | |
| 1454 | }; | |
| 1455 | pub const invalid_utf8 = struct { | |
| 1456 | const msg = "source file is not valid UTF-8"; | |
| 1457 | const kind = .@"error"; | |
| 1458 | }; | |
| 1459 | pub const implicitly_unsigned_literal = struct { | |
| 1460 | const msg = "integer literal is too large to be represented in a signed integer type, interpreting as unsigned"; | |
| 1461 | const opt = "implicitly-unsigned-literal"; | |
| 1462 | const kind = .warning; | |
| 1463 | }; | |
| 1464 | pub const invalid_preproc_operator = struct { | |
| 1465 | const msg = "token is not a valid binary operator in a preprocessor subexpression"; | |
| 1466 | const kind = .@"error"; | |
| 1467 | }; | |
| 1468 | pub const invalid_preproc_expr_start = struct { | |
| 1469 | const msg = "invalid token at start of a preprocessor expression"; | |
| 1470 | const kind = .@"error"; | |
| 1471 | }; | |
| 1472 | pub const c99_compat = struct { | |
| 1473 | const msg = "using this character in an identifier is incompatible with C99"; | |
| 1474 | const opt = "c99-compat"; | |
| 1475 | const kind = .off; | |
| 1476 | }; | |
| 1477 | pub const unicode_zero_width = struct { | |
| 1478 | const msg = "identifier contains Unicode character <U+{X:0>4}> that is invisible in some environments"; | |
| 1479 | const opt = "unicode-homoglyph"; | |
| 1480 | const extra = .actual_codepoint; | |
| 1481 | const kind = .warning; | |
| 1482 | }; | |
| 1483 | pub const unicode_homoglyph = struct { | |
| 1484 | const msg = "treating Unicode character <U+{X:0>4}> as identifier character rather than as '{u}' symbol"; | |
| 1485 | const extra = .codepoints; | |
| 1486 | const opt = "unicode-homoglyph"; | |
| 1487 | const kind = .warning; | |
| 1488 | }; | |
| 1489 | pub const meaningless_asm_qual = struct { | |
| 1490 | const msg = "meaningless '{s}' on assembly outside function"; | |
| 1491 | const extra = .str; | |
| 1492 | const kind = .@"error"; | |
| 1493 | }; | |
| 1494 | pub const duplicate_asm_qual = struct { | |
| 1495 | const msg = "duplicate asm qualifier '{s}'"; | |
| 1496 | const extra = .str; | |
| 1497 | const kind = .@"error"; | |
| 1498 | }; | |
| 1499 | pub const invalid_asm_str = struct { | |
| 1500 | const msg = "cannot use {s} string literal in assembly"; | |
| 1501 | const extra = .str; | |
| 1502 | const kind = .@"error"; | |
| 1503 | }; | |
| 1504 | pub const dollar_in_identifier_extension = struct { | |
| 1505 | const msg = "'$' in identifier"; | |
| 1506 | const opt = "dollar-in-identifier-extension"; | |
| 1507 | const kind = .off; | |
| 1508 | const suppress_language_option = "dollars_in_identifiers"; | |
| 1509 | const pedantic = true; | |
| 1510 | }; | |
| 1511 | pub const dollars_in_identifiers = struct { | |
| 1512 | const msg = "illegal character '$' in identifier"; | |
| 1513 | const kind = .@"error"; | |
| 1514 | }; | |
| 1515 | pub const expanded_from_here = struct { | |
| 1516 | const msg = "expanded from here"; | |
| 1517 | const kind = .note; | |
| 1518 | }; | |
| 1519 | pub const skipping_macro_backtrace = struct { | |
| 1520 | const msg = "(skipping {d} expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)"; | |
| 1521 | const extra = .unsigned; | |
| 1522 | const kind = .note; | |
| 1523 | }; | |
| 1524 | pub const pragma_operator_string_literal = struct { | |
| 1525 | const msg = "_Pragma requires exactly one string literal token"; | |
| 1526 | const kind = .@"error"; | |
| 1527 | }; | |
| 1528 | pub const unknown_gcc_pragma = struct { | |
| 1529 | const msg = "pragma GCC expected 'error', 'warning', 'diagnostic', 'poison'"; | |
| 1530 | const opt = "unknown-pragmas"; | |
| 1531 | const kind = .off; | |
| 1532 | const all = true; | |
| 1533 | }; | |
| 1534 | pub const unknown_gcc_pragma_directive = struct { | |
| 1535 | const msg = "pragma GCC diagnostic expected 'error', 'warning', 'ignored', 'fatal', 'push', or 'pop'"; | |
| 1536 | const opt = "unknown-pragmas"; | |
| 1537 | const kind = .warning; | |
| 1538 | const all = true; | |
| 1539 | }; | |
| 1540 | pub const predefined_top_level = struct { | |
| 1541 | const msg = "predefined identifier is only valid inside function"; | |
| 1542 | const opt = "predefined-identifier-outside-function"; | |
| 1543 | const kind = .warning; | |
| 1544 | }; | |
| 1545 | pub const incompatible_va_arg = struct { | |
| 1546 | const msg = "first argument to va_arg, is of type '{s}' and not 'va_list'"; | |
| 1547 | const extra = .str; | |
| 1548 | const kind = .@"error"; | |
| 1549 | }; | |
| 1550 | pub const too_many_scalar_init_braces = struct { | |
| 1551 | const msg = "too many braces around scalar initializer"; | |
| 1552 | const opt = "many-braces-around-scalar-init"; | |
| 1553 | const kind = .warning; | |
| 1554 | }; | |
| 1555 | pub const uninitialized_in_own_init = struct { | |
| 1556 | const msg = "variable '{s}' is uninitialized when used within its own initialization"; | |
| 1557 | const extra = .str; | |
| 1558 | const opt = "uninitialized"; | |
| 1559 | const kind = .off; | |
| 1560 | const all = true; | |
| 1561 | }; | |
| 1562 | pub const gnu_statement_expression = struct { | |
| 1563 | const msg = "use of GNU statement expression extension"; | |
| 1564 | const opt = "gnu-statement-expression"; | |
| 1565 | const kind = .off; | |
| 1566 | const suppress_gnu = true; | |
| 1567 | const pedantic = true; | |
| 1568 | }; | |
| 1569 | pub const stmt_expr_not_allowed_file_scope = struct { | |
| 1570 | const msg = "statement expression not allowed at file scope"; | |
| 1571 | const kind = .@"error"; | |
| 1572 | }; | |
| 1573 | pub const gnu_imaginary_constant = struct { | |
| 1574 | const msg = "imaginary constants are a GNU extension"; | |
| 1575 | const opt = "gnu-imaginary-constant"; | |
| 1576 | const kind = .off; | |
| 1577 | const suppress_gnu = true; | |
| 1578 | const pedantic = true; | |
| 1579 | }; | |
| 1580 | pub const plain_complex = struct { | |
| 1581 | const msg = "plain '_Complex' requires a type specifier; assuming '_Complex double'"; | |
| 1582 | const kind = .warning; | |
| 1583 | }; | |
| 1584 | pub const complex_int = struct { | |
| 1585 | const msg = "complex integer types are a GNU extension"; | |
| 1586 | const opt = "gnu-complex-integer"; | |
| 1587 | const suppress_gnu = true; | |
| 1588 | const kind = .off; | |
| 1589 | }; | |
| 1590 | pub const qual_on_ret_type = struct { | |
| 1591 | const msg = "'{s}' type qualifier on return type has no effect"; | |
| 1592 | const opt = "ignored-qualifiers"; | |
| 1593 | const extra = .str; | |
| 1594 | const kind = .off; | |
| 1595 | const all = true; | |
| 1596 | }; | |
| 1597 | pub const cli_invalid_standard = struct { | |
| 1598 | const msg = "invalid standard '{s}'"; | |
| 1599 | const extra = .str; | |
| 1600 | const kind = .@"error"; | |
| 1601 | }; | |
| 1602 | pub const cli_invalid_target = struct { | |
| 1603 | const msg = "invalid target '{s}'"; | |
| 1604 | const extra = .str; | |
| 1605 | const kind = .@"error"; | |
| 1606 | }; | |
| 1607 | pub const cli_invalid_emulate = struct { | |
| 1608 | const msg = "invalid compiler '{s}'"; | |
| 1609 | const extra = .str; | |
| 1610 | const kind = .@"error"; | |
| 1611 | }; | |
| 1612 | pub const cli_unknown_arg = struct { | |
| 1613 | const msg = "unknown argument '{s}'"; | |
| 1614 | const extra = .str; | |
| 1615 | const kind = .@"error"; | |
| 1616 | }; | |
| 1617 | pub const cli_error = struct { | |
| 1618 | const msg = "{s}"; | |
| 1619 | const extra = .str; | |
| 1620 | const kind = .@"error"; | |
| 1621 | }; | |
| 1622 | pub const cli_unused_link_object = struct { | |
| 1623 | const msg = "{s}: linker input file unused because linking not done"; | |
| 1624 | const extra = .str; | |
| 1625 | const kind = .warning; | |
| 1626 | }; | |
| 1627 | pub const cli_unknown_linker = struct { | |
| 1628 | const msg = "unrecognized linker '{s}'"; | |
| 1629 | const extra = .str; | |
| 1630 | const kind = .@"error"; | |
| 1631 | }; | |
| 1632 | pub const extra_semi = struct { | |
| 1633 | const msg = "extra ';' outside of a function"; | |
| 1634 | const opt = "extra-semi"; | |
| 1635 | const kind = .off; | |
| 1636 | const pedantic = true; | |
| 1637 | }; | |
| 1638 | pub const func_field = struct { | |
| 1639 | const msg = "field declared as a function"; | |
| 1640 | const kind = .@"error"; | |
| 1641 | }; | |
| 1642 | pub const vla_field = struct { | |
| 1643 | const msg = "variable length array fields extension is not supported"; | |
| 1644 | const kind = .@"error"; | |
| 1645 | }; | |
| 1646 | pub const field_incomplete_ty = struct { | |
| 1647 | const msg = "field has incomplete type '{s}'"; | |
| 1648 | const extra = .str; | |
| 1649 | const kind = .@"error"; | |
| 1650 | }; | |
| 1651 | pub const flexible_in_union = struct { | |
| 1652 | const msg = "flexible array member in union is not allowed"; | |
| 1653 | const kind = .@"error"; | |
| 1654 | const suppress_msvc = true; | |
| 1655 | }; | |
| 1656 | pub const flexible_non_final = struct { | |
| 1657 | const msg = "flexible array member is not at the end of struct"; | |
| 1658 | const kind = .@"error"; | |
| 1659 | }; | |
| 1660 | pub const flexible_in_empty = struct { | |
| 1661 | const msg = "flexible array member in otherwise empty struct"; | |
| 1662 | const kind = .@"error"; | |
| 1663 | const suppress_msvc = true; | |
| 1664 | }; | |
| 1665 | pub const duplicate_member = struct { | |
| 1666 | const msg = "duplicate member '{s}'"; | |
| 1667 | const extra = .str; | |
| 1668 | const kind = .@"error"; | |
| 1669 | }; | |
| 1670 | pub const binary_integer_literal = struct { | |
| 1671 | const msg = "binary integer literals are a GNU extension"; | |
| 1672 | const kind = .off; | |
| 1673 | const opt = "gnu-binary-literal"; | |
| 1674 | const pedantic = true; | |
| 1675 | }; | |
| 1676 | pub const gnu_va_macro = struct { | |
| 1677 | const msg = "named variadic macros are a GNU extension"; | |
| 1678 | const opt = "variadic-macros"; | |
| 1679 | const kind = .off; | |
| 1680 | const pedantic = true; | |
| 1681 | }; | |
| 1682 | pub const builtin_must_be_called = struct { | |
| 1683 | const msg = "builtin function must be directly called"; | |
| 1684 | const kind = .@"error"; | |
| 1685 | }; | |
| 1686 | pub const va_start_not_in_func = struct { | |
| 1687 | const msg = "'va_start' cannot be used outside a function"; | |
| 1688 | const kind = .@"error"; | |
| 1689 | }; | |
| 1690 | pub const va_start_fixed_args = struct { | |
| 1691 | const msg = "'va_start' used in a function with fixed args"; | |
| 1692 | const kind = .@"error"; | |
| 1693 | }; | |
| 1694 | pub const va_start_not_last_param = struct { | |
| 1695 | const msg = "second argument to 'va_start' is not the last named parameter"; | |
| 1696 | const opt = "varargs"; | |
| 1697 | const kind = .warning; | |
| 1698 | }; | |
| 1699 | pub const attribute_not_enough_args = struct { | |
| 1700 | const msg = "'{s}' attribute takes at least {d} argument(s)"; | |
| 1701 | const kind = .@"error"; | |
| 1702 | const extra = .attr_arg_count; | |
| 1703 | }; | |
| 1704 | pub const attribute_too_many_args = struct { | |
| 1705 | const msg = "'{s}' attribute takes at most {d} argument(s)"; | |
| 1706 | const kind = .@"error"; | |
| 1707 | const extra = .attr_arg_count; | |
| 1708 | }; | |
| 1709 | pub const attribute_arg_invalid = struct { | |
| 1710 | const msg = "Attribute argument is invalid, expected {s} but got {s}"; | |
| 1711 | const kind = .@"error"; | |
| 1712 | const extra = .attr_arg_type; | |
| 1713 | }; | |
| 1714 | pub const unknown_attr_enum = struct { | |
| 1715 | const msg = "Unknown `{s}` argument. Possible values are: {s}"; | |
| 1716 | const kind = .@"error"; | |
| 1717 | const extra = .attr_enum; | |
| 1718 | }; | |
| 1719 | pub const attribute_requires_identifier = struct { | |
| 1720 | const msg = "'{s}' attribute requires an identifier"; | |
| 1721 | const kind = .@"error"; | |
| 1722 | const extra = .str; | |
| 1723 | }; | |
| 1724 | pub const declspec_not_enabled = struct { | |
| 1725 | const msg = "'__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes"; | |
| 1726 | const kind = .@"error"; | |
| 1727 | }; | |
| 1728 | pub const declspec_attr_not_supported = struct { | |
| 1729 | const msg = "__declspec attribute '{s}' is not supported"; | |
| 1730 | const extra = .str; | |
| 1731 | const opt = "ignored-attributes"; | |
| 1732 | const kind = .warning; | |
| 1733 | }; | |
| 1734 | pub const deprecated_declarations = struct { | |
| 1735 | const msg = "{s}"; | |
| 1736 | const extra = .str; | |
| 1737 | const opt = "deprecated-declarations"; | |
| 1738 | const kind = .warning; | |
| 1739 | }; | |
| 1740 | pub const deprecated_note = struct { | |
| 1741 | const msg = "'{s}' has been explicitly marked deprecated here"; | |
| 1742 | const extra = .str; | |
| 1743 | const opt = "deprecated-declarations"; | |
| 1744 | const kind = .note; | |
| 1745 | }; | |
| 1746 | pub const unavailable = struct { | |
| 1747 | const msg = "{s}"; | |
| 1748 | const extra = .str; | |
| 1749 | const kind = .@"error"; | |
| 1750 | }; | |
| 1751 | pub const unavailable_note = struct { | |
| 1752 | const msg = "'{s}' has been explicitly marked unavailable here"; | |
| 1753 | const extra = .str; | |
| 1754 | const kind = .note; | |
| 1755 | }; | |
| 1756 | pub const warning_attribute = struct { | |
| 1757 | const msg = "{s}"; | |
| 1758 | const extra = .str; | |
| 1759 | const kind = .warning; | |
| 1760 | const opt = "attribute-warning"; | |
| 1761 | }; | |
| 1762 | pub const error_attribute = struct { | |
| 1763 | const msg = "{s}"; | |
| 1764 | const extra = .str; | |
| 1765 | const kind = .@"error"; | |
| 1766 | }; | |
| 1767 | pub const ignored_record_attr = struct { | |
| 1768 | const msg = "attribute '{s}' is ignored, place it after \"{s}\" to apply attribute to type declaration"; | |
| 1769 | const extra = .ignored_record_attr; | |
| 1770 | const kind = .warning; | |
| 1771 | const opt = "ignored-attributes"; | |
| 1772 | }; | |
| 1773 | pub const backslash_newline_escape = struct { | |
| 1774 | const msg = "backslash and newline separated by space"; | |
| 1775 | const kind = .warning; | |
| 1776 | const opt = "backslash-newline-escape"; | |
| 1777 | }; | |
| 1778 | pub const array_size_non_int = struct { | |
| 1779 | const msg = "size of array has non-integer type '{s}'"; | |
| 1780 | const extra = .str; | |
| 1781 | const kind = .@"error"; | |
| 1782 | }; | |
| 1783 | pub const cast_to_smaller_int = struct { | |
| 1784 | const msg = "cast to smaller integer type {s}"; | |
| 1785 | const extra = .str; | |
| 1786 | const kind = .warning; | |
| 1787 | const opt = "pointer-to-int-cast"; | |
| 1788 | }; | |
| 1789 | pub const gnu_switch_range = struct { | |
| 1790 | const msg = "use of GNU case range extension"; | |
| 1791 | const opt = "gnu-case-range"; | |
| 1792 | const kind = .off; | |
| 1793 | const pedantic = true; | |
| 1794 | }; | |
| 1795 | pub const empty_case_range = struct { | |
| 1796 | const msg = "empty case range specified"; | |
| 1797 | const kind = .warning; | |
| 1798 | }; | |
| 1799 | pub const non_standard_escape_char = struct { | |
| 1800 | const msg = "use of non-standard escape character '\\e'"; | |
| 1801 | const kind = .off; | |
| 1802 | const opt = "pedantic"; | |
| 1803 | }; | |
| 1804 | pub const invalid_pp_stringify_escape = struct { | |
| 1805 | const msg = "invalid string literal, ignoring final '\\'"; | |
| 1806 | const kind = .warning; | |
| 1807 | }; | |
| 1808 | pub const vla = struct { | |
| 1809 | const msg = "variable length array used"; | |
| 1810 | const kind = .off; | |
| 1811 | const opt = "vla"; | |
| 1812 | }; | |
| 1813 | pub const float_overflow_conversion = struct { | |
| 1814 | const msg = "implicit conversion of non-finite value from {s} is undefined"; | |
| 1815 | const extra = .str; | |
| 1816 | const kind = .off; | |
| 1817 | const opt = "float-overflow-conversion"; | |
| 1818 | }; | |
| 1819 | pub const float_out_of_range = struct { | |
| 1820 | const msg = "implicit conversion of out of range value from {s} is undefined"; | |
| 1821 | const extra = .str; | |
| 1822 | const kind = .warning; | |
| 1823 | const opt = "literal-conversion"; | |
| 1824 | }; | |
| 1825 | pub const float_zero_conversion = struct { | |
| 1826 | const msg = "implicit conversion from {s}"; | |
| 1827 | const extra = .str; | |
| 1828 | const kind = .off; | |
| 1829 | const opt = "float-zero-conversion"; | |
| 1830 | }; | |
| 1831 | pub const float_value_changed = struct { | |
| 1832 | const msg = "implicit conversion from {s}"; | |
| 1833 | const extra = .str; | |
| 1834 | const kind = .warning; | |
| 1835 | const opt = "float-conversion"; | |
| 1836 | }; | |
| 1837 | pub const float_to_int = struct { | |
| 1838 | const msg = "implicit conversion turns floating-point number into integer: {s}"; | |
| 1839 | const extra = .str; | |
| 1840 | const kind = .off; | |
| 1841 | const opt = "literal-conversion"; | |
| 1842 | }; | |
| 1843 | pub const const_decl_folded = struct { | |
| 1844 | const msg = "expression is not an integer constant expression; folding it to a constant is a GNU extension"; | |
| 1845 | const kind = .off; | |
| 1846 | const opt = "gnu-folding-constant"; | |
| 1847 | const pedantic = true; | |
| 1848 | }; | |
| 1849 | pub const const_decl_folded_vla = struct { | |
| 1850 | const msg = "variable length array folded to constant array as an extension"; | |
| 1851 | const kind = .off; | |
| 1852 | const opt = "gnu-folding-constant"; | |
| 1853 | const pedantic = true; | |
| 1854 | }; | |
| 1855 | pub const redefinition_of_typedef = struct { | |
| 1856 | const msg = "typedef redefinition with different types ({s})"; | |
| 1857 | const extra = .str; | |
| 1858 | const kind = .@"error"; | |
| 1859 | }; | |
| 1860 | pub const undefined_macro = struct { | |
| 1861 | const msg = "'{s}' is not defined, evaluates to 0"; | |
| 1862 | const extra = .str; | |
| 1863 | const kind = .off; | |
| 1864 | const opt = "undef"; | |
| 1865 | }; | |
| 1866 | pub const fn_macro_undefined = struct { | |
| 1867 | const msg = "function-like macro '{s}' is not defined"; | |
| 1868 | const extra = .str; | |
| 1869 | const kind = .@"error"; | |
| 1870 | }; | |
| 1871 | pub const preprocessing_directive_only = struct { | |
| 1872 | const msg = "'{s}' must be used within a preprocessing directive"; | |
| 1873 | const extra = .tok_id_expected; | |
| 1874 | const kind = .@"error"; | |
| 1875 | }; | |
| 1876 | pub const missing_lparen_after_builtin = struct { | |
| 1877 | const msg = "Missing '(' after built-in macro '{s}'"; | |
| 1878 | const extra = .str; | |
| 1879 | const kind = .@"error"; | |
| 1880 | }; | |
| 1881 | pub const offsetof_ty = struct { | |
| 1882 | const msg = "offsetof requires struct or union type, '{s}' invalid"; | |
| 1883 | const extra = .str; | |
| 1884 | const kind = .@"error"; | |
| 1885 | }; | |
| 1886 | pub const offsetof_incomplete = struct { | |
| 1887 | const msg = "offsetof of incomplete type '{s}'"; | |
| 1888 | const extra = .str; | |
| 1889 | const kind = .@"error"; | |
| 1890 | }; | |
| 1891 | pub const offsetof_array = struct { | |
| 1892 | const msg = "offsetof requires array type, '{s}' invalid"; | |
| 1893 | const extra = .str; | |
| 1894 | const kind = .@"error"; | |
| 1895 | }; | |
| 1896 | pub const pragma_pack_lparen = struct { | |
| 1897 | const msg = "missing '(' after '#pragma pack' - ignoring"; | |
| 1898 | const kind = .warning; | |
| 1899 | const opt = "ignored-pragmas"; | |
| 1900 | }; | |
| 1901 | pub const pragma_pack_rparen = struct { | |
| 1902 | const msg = "missing ')' after '#pragma pack' - ignoring"; | |
| 1903 | const kind = .warning; | |
| 1904 | const opt = "ignored-pragmas"; | |
| 1905 | }; | |
| 1906 | pub const pragma_pack_unknown_action = struct { | |
| 1907 | const msg = "unknown action for '#pragma pack' - ignoring"; | |
| 1908 | const opt = "ignored-pragmas"; | |
| 1909 | const kind = .warning; | |
| 1910 | }; | |
| 1911 | pub const pragma_pack_show = struct { | |
| 1912 | const msg = "value of #pragma pack(show) == {d}"; | |
| 1913 | const extra = .unsigned; | |
| 1914 | const kind = .warning; | |
| 1915 | }; | |
| 1916 | pub const pragma_pack_int = struct { | |
| 1917 | const msg = "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'"; | |
| 1918 | const opt = "ignored-pragmas"; | |
| 1919 | const kind = .warning; | |
| 1920 | }; | |
| 1921 | pub const pragma_pack_int_ident = struct { | |
| 1922 | const msg = "expected integer or identifier in '#pragma pack' - ignored"; | |
| 1923 | const opt = "ignored-pragmas"; | |
| 1924 | const kind = .warning; | |
| 1925 | }; | |
| 1926 | pub const pragma_pack_undefined_pop = struct { | |
| 1927 | const msg = "specifying both a name and alignment to 'pop' is undefined"; | |
| 1928 | const kind = .warning; | |
| 1929 | }; | |
| 1930 | pub const pragma_pack_empty_stack = struct { | |
| 1931 | const msg = "#pragma pack(pop, ...) failed: stack empty"; | |
| 1932 | const opt = "ignored-pragmas"; | |
| 1933 | const kind = .warning; | |
| 1934 | }; | |
| 1935 | pub const cond_expr_type = struct { | |
| 1936 | const msg = "used type '{s}' where arithmetic or pointer type is required"; | |
| 1937 | const extra = .str; | |
| 1938 | const kind = .@"error"; | |
| 1939 | }; | |
| 1940 | pub const too_many_includes = struct { | |
| 1941 | const msg = "#include nested too deeply"; | |
| 1942 | const kind = .@"error"; | |
| 1943 | }; | |
| 1944 | pub const enumerator_too_small = struct { | |
| 1945 | const msg = "ISO C restricts enumerator values to range of 'int' ({d} is too small)"; | |
| 1946 | const extra = .signed; | |
| 1947 | const kind = .off; | |
| 1948 | const opt = "pedantic"; | |
| 1949 | }; | |
| 1950 | pub const enumerator_too_large = struct { | |
| 1951 | const msg = "ISO C restricts enumerator values to range of 'int' ({d} is too large)"; | |
| 1952 | const extra = .unsigned; | |
| 1953 | const kind = .off; | |
| 1954 | const opt = "pedantic"; | |
| 1955 | }; | |
| 1956 | pub const include_next = struct { | |
| 1957 | const msg = "#include_next is a language extension"; | |
| 1958 | const kind = .off; | |
| 1959 | const pedantic = true; | |
| 1960 | const opt = "gnu-include-next"; | |
| 1961 | }; | |
| 1962 | pub const include_next_outside_header = struct { | |
| 1963 | const msg = "#include_next in primary source file; will search from start of include path"; | |
| 1964 | const kind = .warning; | |
| 1965 | const opt = "include-next-outside-header"; | |
| 1966 | }; | |
| 1967 | pub const enumerator_overflow = struct { | |
| 1968 | const msg = "overflow in enumeration value"; | |
| 1969 | const kind = .warning; | |
| 1970 | }; | |
| 1971 | pub const enum_not_representable = struct { | |
| 1972 | const msg = "incremented enumerator value {s} is not representable in the largest integer type"; | |
| 1973 | const kind = .warning; | |
| 1974 | const opt = "enum-too-large"; | |
| 1975 | const extra = .pow_2_as_string; | |
| 1976 | }; | |
| 1977 | pub const enum_too_large = struct { | |
| 1978 | const msg = "enumeration values exceed range of largest integer"; | |
| 1979 | const kind = .warning; | |
| 1980 | const opt = "enum-too-large"; | |
| 1981 | }; | |
| 1982 | pub const enum_fixed = struct { | |
| 1983 | const msg = "enumeration types with a fixed underlying type are a Clang extension"; | |
| 1984 | const kind = .off; | |
| 1985 | const pedantic = true; | |
| 1986 | const opt = "fixed-enum-extension"; | |
| 1987 | }; | |
| 1988 | pub const enum_prev_nonfixed = struct { | |
| 1989 | const msg = "enumeration previously declared with nonfixed underlying type"; | |
| 1990 | const kind = .@"error"; | |
| 1991 | }; | |
| 1992 | pub const enum_prev_fixed = struct { | |
| 1993 | const msg = "enumeration previously declared with fixed underlying type"; | |
| 1994 | const kind = .@"error"; | |
| 1995 | }; | |
| 1996 | pub const enum_different_explicit_ty = struct { | |
| 1997 | // str will be like 'new' (was 'old' | |
| 1998 | const msg = "enumeration redeclared with different underlying type {s})"; | |
| 1999 | const extra = .str; | |
| 2000 | const kind = .@"error"; | |
| 2001 | }; | |
| 2002 | pub const enum_not_representable_fixed = struct { | |
| 2003 | const msg = "enumerator value is not representable in the underlying type '{s}'"; | |
| 2004 | const extra = .str; | |
| 2005 | const kind = .@"error"; | |
| 2006 | }; | |
| 2007 | pub const transparent_union_wrong_type = struct { | |
| 2008 | const msg = "'transparent_union' attribute only applies to unions"; | |
| 2009 | const opt = "ignored-attributes"; | |
| 2010 | const kind = .warning; | |
| 2011 | }; | |
| 2012 | pub const transparent_union_one_field = struct { | |
| 2013 | const msg = "transparent union definition must contain at least one field; transparent_union attribute ignored"; | |
| 2014 | const opt = "ignored-attributes"; | |
| 2015 | const kind = .warning; | |
| 2016 | }; | |
| 2017 | pub const transparent_union_size = struct { | |
| 2018 | const msg = "size of field {s} bits) does not match the size of the first field in transparent union; transparent_union attribute ignored"; | |
| 2019 | const extra = .str; | |
| 2020 | const opt = "ignored-attributes"; | |
| 2021 | const kind = .warning; | |
| 2022 | }; | |
| 2023 | pub const transparent_union_size_note = struct { | |
| 2024 | const msg = "size of first field is {d}"; | |
| 2025 | const extra = .unsigned; | |
| 2026 | const kind = .note; | |
| 2027 | }; | |
| 2028 | pub const designated_init_invalid = struct { | |
| 2029 | const msg = "'designated_init' attribute is only valid on 'struct' type'"; | |
| 2030 | const kind = .@"error"; | |
| 2031 | }; | |
| 2032 | pub const designated_init_needed = struct { | |
| 2033 | const msg = "positional initialization of field in 'struct' declared with 'designated_init' attribute"; | |
| 2034 | const opt = "designated-init"; | |
| 2035 | const kind = .warning; | |
| 2036 | }; | |
| 2037 | pub const ignore_common = struct { | |
| 2038 | const msg = "ignoring attribute 'common' because it conflicts with attribute 'nocommon'"; | |
| 2039 | const opt = "ignored-attributes"; | |
| 2040 | const kind = .warning; | |
| 2041 | }; | |
| 2042 | pub const ignore_nocommon = struct { | |
| 2043 | const msg = "ignoring attribute 'nocommon' because it conflicts with attribute 'common'"; | |
| 2044 | const opt = "ignored-attributes"; | |
| 2045 | const kind = .warning; | |
| 2046 | }; | |
| 2047 | pub const non_string_ignored = struct { | |
| 2048 | const msg = "'nonstring' attribute ignored on objects of type '{s}'"; | |
| 2049 | const opt = "ignored-attributes"; | |
| 2050 | const kind = .warning; | |
| 2051 | }; | |
| 2052 | pub const local_variable_attribute = struct { | |
| 2053 | const msg = "'{s}' attribute only applies to local variables"; | |
| 2054 | const extra = .str; | |
| 2055 | const opt = "ignored-attributes"; | |
| 2056 | const kind = .warning; | |
| 2057 | }; | |
| 2058 | pub const ignore_cold = struct { | |
| 2059 | const msg = "ignoring attribute 'cold' because it conflicts with attribute 'hot'"; | |
| 2060 | const opt = "ignored-attributes"; | |
| 2061 | const kind = .warning; | |
| 2062 | }; | |
| 2063 | pub const ignore_hot = struct { | |
| 2064 | const msg = "ignoring attribute 'hot' because it conflicts with attribute 'cold'"; | |
| 2065 | const opt = "ignored-attributes"; | |
| 2066 | const kind = .warning; | |
| 2067 | }; | |
| 2068 | pub const ignore_noinline = struct { | |
| 2069 | const msg = "ignoring attribute 'noinline' because it conflicts with attribute 'always_inline'"; | |
| 2070 | const opt = "ignored-attributes"; | |
| 2071 | const kind = .warning; | |
| 2072 | }; | |
| 2073 | pub const ignore_always_inline = struct { | |
| 2074 | const msg = "ignoring attribute 'always_inline' because it conflicts with attribute 'noinline'"; | |
| 2075 | const opt = "ignored-attributes"; | |
| 2076 | const kind = .warning; | |
| 2077 | }; | |
| 2078 | pub const invalid_noreturn = struct { | |
| 2079 | const msg = "function '{s}' declared 'noreturn' should not return"; | |
| 2080 | const extra = .str; | |
| 2081 | const kind = .warning; | |
| 2082 | const opt = "invalid-noreturn"; | |
| 2083 | }; | |
| 2084 | pub const nodiscard_unused = struct { | |
| 2085 | const msg = "ignoring return value of '{s}', declared with 'nodiscard' attribute"; | |
| 2086 | const extra = .str; | |
| 2087 | const kind = .warning; | |
| 2088 | const op = "unused-result"; | |
| 2089 | }; | |
| 2090 | pub const warn_unused_result = struct { | |
| 2091 | const msg = "ignoring return value of '{s}', declared with 'warn_unused_result' attribute"; | |
| 2092 | const extra = .str; | |
| 2093 | const kind = .warning; | |
| 2094 | const op = "unused-result"; | |
| 2095 | }; | |
| 2096 | pub const invalid_vec_elem_ty = struct { | |
| 2097 | const msg = "invalid vector element type '{s}'"; | |
| 2098 | const extra = .str; | |
| 2099 | const kind = .@"error"; | |
| 2100 | }; | |
| 2101 | pub const vec_size_not_multiple = struct { | |
| 2102 | const msg = "vector size not an integral multiple of component size"; | |
| 2103 | const kind = .@"error"; | |
| 2104 | }; | |
| 2105 | pub const invalid_imag = struct { | |
| 2106 | const msg = "invalid type '{s}' to __imag operator"; | |
| 2107 | const extra = .str; | |
| 2108 | const kind = .@"error"; | |
| 2109 | }; | |
| 2110 | pub const invalid_real = struct { | |
| 2111 | const msg = "invalid type '{s}' to __real operator"; | |
| 2112 | const extra = .str; | |
| 2113 | const kind = .@"error"; | |
| 2114 | }; | |
| 2115 | pub const zero_length_array = struct { | |
| 2116 | const msg = "zero size arrays are an extension"; | |
| 2117 | const kind = .off; | |
| 2118 | const pedantic = true; | |
| 2119 | const opt = "zero-length-array"; | |
| 2120 | }; | |
| 2121 | pub const old_style_flexible_struct = struct { | |
| 2122 | const msg = "array index {d} is past the end of the array"; | |
| 2123 | const extra = .unsigned; | |
| 2124 | const kind = .off; | |
| 2125 | const pedantic = true; | |
| 2126 | const opt = "old-style-flexible-struct"; | |
| 2127 | }; | |
| 2128 | pub const comma_deletion_va_args = struct { | |
| 2129 | const msg = "token pasting of ',' and __VA_ARGS__ is a GNU extension"; | |
| 2130 | const kind = .off; | |
| 2131 | const pedantic = true; | |
| 2132 | const opt = "gnu-zero-variadic-macro-arguments"; | |
| 2133 | const suppress_gcc = true; | |
| 2134 | }; | |
| 2135 | pub const main_return_type = struct { | |
| 2136 | const msg = "return type of 'main' is not 'int'"; | |
| 2137 | const kind = .warning; | |
| 2138 | const opt = "main-return-type"; | |
| 2139 | }; | |
| 2140 | pub const expansion_to_defined = struct { | |
| 2141 | const msg = "macro expansion producing 'defined' has undefined behavior"; | |
| 2142 | const kind = .off; | |
| 2143 | const pedantic = true; | |
| 2144 | const opt = "expansion-to-defined"; | |
| 2145 | }; | |
| 2146 | pub const invalid_int_suffix = struct { | |
| 2147 | const msg = "invalid suffix '{s}' on integer constant"; | |
| 2148 | const extra = .str; | |
| 2149 | const kind = .@"error"; | |
| 2150 | }; | |
| 2151 | pub const invalid_float_suffix = struct { | |
| 2152 | const msg = "invalid suffix '{s}' on floating constant"; | |
| 2153 | const extra = .str; | |
| 2154 | const kind = .@"error"; | |
| 2155 | }; | |
| 2156 | pub const invalid_octal_digit = struct { | |
| 2157 | const msg = "invalid digit '{c}' in octal constant"; | |
| 2158 | const extra = .ascii; | |
| 2159 | const kind = .@"error"; | |
| 2160 | }; | |
| 2161 | pub const invalid_binary_digit = struct { | |
| 2162 | const msg = "invalid digit '{c}' in binary constant"; | |
| 2163 | const extra = .ascii; | |
| 2164 | const kind = .@"error"; | |
| 2165 | }; | |
| 2166 | pub const exponent_has_no_digits = struct { | |
| 2167 | const msg = "exponent has no digits"; | |
| 2168 | const kind = .@"error"; | |
| 2169 | }; | |
| 2170 | pub const hex_floating_constant_requires_exponent = struct { | |
| 2171 | const msg = "hexadecimal floating constant requires an exponent"; | |
| 2172 | const kind = .@"error"; | |
| 2173 | }; | |
| 2174 | pub const sizeof_returns_zero = struct { | |
| 2175 | const msg = "sizeof returns 0"; | |
| 2176 | const kind = .warning; | |
| 2177 | const suppress_gcc = true; | |
| 2178 | const suppress_clang = true; | |
| 2179 | }; | |
| 2180 | pub const declspec_not_allowed_after_declarator = struct { | |
| 2181 | const msg = "'declspec' attribute not allowed after declarator"; | |
| 2182 | const kind = .@"error"; | |
| 2183 | }; | |
| 2184 | pub const declarator_name_tok = struct { | |
| 2185 | const msg = "this declarator"; | |
| 2186 | const kind = .note; | |
| 2187 | }; | |
| 2188 | pub const type_not_supported_on_target = struct { | |
| 2189 | const msg = "{s} is not supported on this target"; | |
| 2190 | const extra = .str; | |
| 2191 | const kind = .@"error"; | |
| 2192 | }; | |
| 2193 | pub const bit_int = struct { | |
| 2194 | const msg = "'_BitInt' in C17 and earlier is a Clang extension'"; | |
| 2195 | const kind = .off; | |
| 2196 | const pedantic = true; | |
| 2197 | const opt = "bit-int-extension"; | |
| 2198 | const suppress_version = .c2x; | |
| 2199 | }; | |
| 2200 | pub const unsigned_bit_int_too_small = struct { | |
| 2201 | const msg = "{s} must have a bit size of at least 1"; | |
| 2202 | const extra = .str; | |
| 2203 | const kind = .@"error"; | |
| 2204 | }; | |
| 2205 | pub const signed_bit_int_too_small = struct { | |
| 2206 | const msg = "{s} must have a bit size of at least 2"; | |
| 2207 | const extra = .str; | |
| 2208 | const kind = .@"error"; | |
| 2209 | }; | |
| 2210 | pub const bit_int_too_big = struct { | |
| 2211 | const msg = "{s} of bit sizes greater than " ++ std.fmt.comptimePrint("{d}", .{Compilation.bit_int_max_bits}) ++ " not supported"; | |
| 2212 | const extra = .str; | |
| 2213 | const kind = .@"error"; | |
| 2214 | }; | |
| 2215 | pub const keyword_macro = struct { | |
| 2216 | const msg = "keyword is hidden by macro definition"; | |
| 2217 | const kind = .off; | |
| 2218 | const pedantic = true; | |
| 2219 | const opt = "keyword-macro"; | |
| 2220 | }; | |
| 2221 | pub const ptr_arithmetic_incomplete = struct { | |
| 2222 | const msg = "arithmetic on a pointer to an incomplete type '{s}'"; | |
| 2223 | const extra = .str; | |
| 2224 | const kind = .@"error"; | |
| 2225 | }; | |
| 2226 | pub const callconv_not_supported = struct { | |
| 2227 | const msg = "'{s}' calling convention is not supported for this target"; | |
| 2228 | const extra = .str; | |
| 2229 | const opt = "ignored-attributes"; | |
| 2230 | const kind = .warning; | |
| 2231 | }; | |
| 2232 | pub const pointer_arith_void = struct { | |
| 2233 | const msg = "invalid application of '{s}' to a void type"; | |
| 2234 | const extra = .str; | |
| 2235 | const kind = .off; | |
| 2236 | const pedantic = true; | |
| 2237 | const opt = "pointer-arith"; | |
| 2238 | }; | |
| 2239 | pub const sizeof_array_arg = struct { | |
| 2240 | const msg = "sizeof on array function parameter will return size of {s}"; | |
| 2241 | const extra = .str; | |
| 2242 | const kind = .warning; | |
| 2243 | const opt = "sizeof-array-argument"; | |
| 2244 | }; | |
| 2245 | pub const array_address_to_bool = struct { | |
| 2246 | const msg = "address of array '{s}' will always evaluate to 'true'"; | |
| 2247 | const extra = .str; | |
| 2248 | const kind = .warning; | |
| 2249 | const opt = "pointer-bool-conversion"; | |
| 2250 | }; | |
| 2251 | pub const string_literal_to_bool = struct { | |
| 2252 | const msg = "implicit conversion turns string literal into bool: {s}"; | |
| 2253 | const extra = .str; | |
| 2254 | const kind = .off; | |
| 2255 | const opt = "string-conversion"; | |
| 2256 | }; | |
| 2257 | pub const constant_expression_conversion_not_allowed = struct { | |
| 2258 | const msg = "this conversion is not allowed in a constant expression"; | |
| 2259 | const kind = .note; | |
| 2260 | }; | |
| 2261 | pub const invalid_object_cast = struct { | |
| 2262 | const msg = "cannot cast an object of type {s}"; | |
| 2263 | const extra = .str; | |
| 2264 | const kind = .@"error"; | |
| 2265 | }; | |
| 2266 | pub const cli_invalid_fp_eval_method = struct { | |
| 2267 | const msg = "unsupported argument '{s}' to option '-ffp-eval-method='; expected 'source', 'double', or 'extended'"; | |
| 2268 | const extra = .str; | |
| 2269 | const kind = .@"error"; | |
| 2270 | }; | |
| 2271 | pub const suggest_pointer_for_invalid_fp16 = struct { | |
| 2272 | const msg = "{s} cannot have __fp16 type; did you forget * ?"; | |
| 2273 | const extra = .str; | |
| 2274 | const kind = .@"error"; | |
| 2275 | }; | |
| 2276 | pub const bitint_suffix = struct { | |
| 2277 | const msg = "'_BitInt' suffix for literals is a C2x extension"; | |
| 2278 | const opt = "c2x-extensions"; | |
| 2279 | const kind = .warning; | |
| 2280 | const suppress_version = .c2x; | |
| 2281 | }; | |
| 2282 | pub const auto_type_extension = struct { | |
| 2283 | const msg = "'__auto_type' is a GNU extension"; | |
| 2284 | const opt = "gnu-auto-type"; | |
| 2285 | const kind = .off; | |
| 2286 | const pedantic = true; | |
| 2287 | }; | |
| 2288 | pub const auto_type_not_allowed = struct { | |
| 2289 | const msg = "'__auto_type' not allowed in {s}"; | |
| 2290 | const kind = .@"error"; | |
| 2291 | const extra = .str; | |
| 2292 | }; | |
| 2293 | pub const auto_type_requires_initializer = struct { | |
| 2294 | const msg = "declaration of variable '{s}' with deduced type requires an initializer"; | |
| 2295 | const kind = .@"error"; | |
| 2296 | const extra = .str; | |
| 2297 | }; | |
| 2298 | pub const auto_type_requires_single_declarator = struct { | |
| 2299 | const msg = "'__auto_type' may only be used with a single declarator"; | |
| 2300 | const kind = .@"error"; | |
| 2301 | }; | |
| 2302 | pub const auto_type_requires_plain_declarator = struct { | |
| 2303 | const msg = "'__auto_type' requires a plain identifier as declarator"; | |
| 2304 | const kind = .@"error"; | |
| 2305 | }; | |
| 2306 | pub const invalid_cast_to_auto_type = struct { | |
| 2307 | const msg = "invalid cast to '__auto_type'"; | |
| 2308 | const kind = .@"error"; | |
| 2309 | }; | |
| 2310 | pub const auto_type_from_bitfield = struct { | |
| 2311 | const msg = "cannot use bit-field as '__auto_type' initializer"; | |
| 2312 | const kind = .@"error"; | |
| 2313 | }; | |
| 2314 | pub const array_of_auto_type = struct { | |
| 2315 | const msg = "'{s}' declared as array of '__auto_type'"; | |
| 2316 | const kind = .@"error"; | |
| 2317 | const extra = .str; | |
| 2318 | }; | |
| 2319 | pub const auto_type_with_init_list = struct { | |
| 2320 | const msg = "cannot use '__auto_type' with initializer list"; | |
| 2321 | const kind = .@"error"; | |
| 2322 | }; | |
| 2323 | pub const missing_semicolon = struct { | |
| 2324 | const msg = "expected ';' at end of declaration list"; | |
| 2325 | const kind = .warning; | |
| 2326 | }; | |
| 2327 | pub const tentative_definition_incomplete = struct { | |
| 2328 | const msg = "tentative definition has type '{s}' that is never completed"; | |
| 2329 | const kind = .@"error"; | |
| 2330 | const extra = .str; | |
| 2331 | }; | |
| 2332 | pub const forward_declaration_here = struct { | |
| 2333 | const msg = "forward declaration of '{s}'"; | |
| 2334 | const kind = .note; | |
| 2335 | const extra = .str; | |
| 2336 | }; | |
| 2337 | pub const gnu_union_cast = struct { | |
| 2338 | const msg = "cast to union type is a GNU extension"; | |
| 2339 | const opt = "gnu-union-cast"; | |
| 2340 | const kind = .off; | |
| 2341 | const pedantic = true; | |
| 2342 | }; | |
| 2343 | pub const invalid_union_cast = struct { | |
| 2344 | const msg = "cast to union type from type '{s}' not present in union"; | |
| 2345 | const kind = .@"error"; | |
| 2346 | const extra = .str; | |
| 2347 | }; | |
| 2348 | pub const cast_to_incomplete_type = struct { | |
| 2349 | const msg = "cast to incomplete type '{s}'"; | |
| 2350 | const kind = .@"error"; | |
| 2351 | const extra = .str; | |
| 2352 | }; | |
| 2353 | pub const invalid_source_epoch = struct { | |
| 2354 | const msg = "environment variable SOURCE_DATE_EPOCH must expand to a non-negative integer less than or equal to 253402300799"; | |
| 2355 | const kind = .@"error"; | |
| 2356 | }; | |
| 2357 | pub const fuse_ld_path = struct { | |
| 2358 | const msg = "'-fuse-ld=' taking a path is deprecated; use '--ld-path=' instead"; | |
| 2359 | const kind = .off; | |
| 2360 | const opt = "fuse-ld-path"; | |
| 2361 | }; | |
| 2362 | pub const invalid_rtlib = struct { | |
| 2363 | const msg = "invalid runtime library name '{s}'"; | |
| 2364 | const kind = .@"error"; | |
| 2365 | const extra = .str; | |
| 2366 | }; | |
| 2367 | pub const unsupported_rtlib_gcc = struct { | |
| 2368 | const msg = "unsupported runtime library 'libgcc' for platform '{s}'"; | |
| 2369 | const kind = .@"error"; | |
| 2370 | const extra = .str; | |
| 2371 | }; | |
| 2372 | pub const invalid_unwindlib = struct { | |
| 2373 | const msg = "invalid unwind library name '{s}'"; | |
| 2374 | const kind = .@"error"; | |
| 2375 | const extra = .str; | |
| 2376 | }; | |
| 2377 | pub const incompatible_unwindlib = struct { | |
| 2378 | const msg = "--rtlib=libgcc requires --unwindlib=libgcc"; | |
| 2379 | const kind = .@"error"; | |
| 2380 | }; | |
| 2381 | pub const gnu_asm_disabled = struct { | |
| 2382 | const msg = "GNU-style inline assembly is disabled"; | |
| 2383 | const kind = .@"error"; | |
| 2384 | }; | |
| 2385 | pub const extension_token_used = struct { | |
| 2386 | const msg = "extension used"; | |
| 2387 | const kind = .off; | |
| 2388 | const pedantic = true; | |
| 2389 | const opt = "language-extension-token"; | |
| 2390 | }; | |
| 2391 | pub const complex_component_init = struct { | |
| 2392 | const msg = "complex initialization specifying real and imaginary components is an extension"; | |
| 2393 | const opt = "complex-component-init"; | |
| 2394 | const kind = .off; | |
| 2395 | const pedantic = true; | |
| 2396 | }; | |
| 2397 | pub const complex_prefix_postfix_op = struct { | |
| 2398 | const msg = "ISO C does not support '++'/'--' on complex type '{s}'"; | |
| 2399 | const opt = "pedantic"; | |
| 2400 | const extra = .str; | |
| 2401 | const kind = .off; | |
| 2402 | const pedantic = true; | |
| 2403 | }; | |
| 2404 | pub const not_floating_type = struct { | |
| 2405 | const msg = "argument type '{s}' is not a real floating point type"; | |
| 2406 | const extra = .str; | |
| 2407 | const kind = .@"error"; | |
| 2408 | }; | |
| 2409 | pub const argument_types_differ = struct { | |
| 2410 | const msg = "arguments are of different types ({s})"; | |
| 2411 | const extra = .str; | |
| 2412 | const kind = .@"error"; | |
| 2413 | }; | |
| 2414 | }; | |
| 2415 | ||
| 2416 | list: std.ArrayListUnmanaged(Message) = .{}, | |
| 2417 | arena: std.heap.ArenaAllocator, | |
| 2418 | color: bool = true, | |
| 2419 | fatal_errors: bool = false, | |
| 2420 | options: Options = .{}, | |
| 2421 | errors: u32 = 0, | |
| 2422 | macro_backtrace_limit: u32 = 6, | |
| 2423 | ||
| 2424 | pub fn warningExists(name: []const u8) bool { | |
| 2425 | inline for (std.meta.fields(Options)) |f| { | |
| 2426 | if (mem.eql(u8, f.name, name)) return true; | |
| 2427 | } | |
| 2428 | return false; | |
| 2429 | } | |
| 2430 | ||
| 2431 | pub fn set(diag: *Diagnostics, name: []const u8, to: Kind) !void { | |
| 2432 | inline for (std.meta.fields(Options)) |f| { | |
| 2433 | if (mem.eql(u8, f.name, name)) { | |
| 2434 | @field(diag.options, f.name) = to; | |
| 2435 | return; | |
| 2436 | } | |
| 2437 | } | |
| 2438 | try diag.add(.{ | |
| 2439 | .tag = .unknown_warning, | |
| 2440 | .extra = .{ .str = name }, | |
| 2441 | }, &.{}); | |
| 2442 | } | |
| 2443 | ||
| 2444 | pub fn init(gpa: Allocator) Diagnostics { | |
| 2445 | return .{ | |
| 2446 | .arena = std.heap.ArenaAllocator.init(gpa), | |
| 2447 | }; | |
| 2448 | } | |
| 2449 | ||
| 2450 | pub fn deinit(diag: *Diagnostics) void { | |
| 2451 | diag.list.deinit(diag.arena.allocator()); | |
| 2452 | diag.arena.deinit(); | |
| 2453 | } | |
| 2454 | ||
| 2455 | pub fn add(diag: *Diagnostics, msg: Message, expansion_locs: []const Source.Location) Compilation.Error!void { | |
| 2456 | const kind = diag.tagKind(msg.tag); | |
| 2457 | if (kind == .off) return; | |
| 2458 | var copy = msg; | |
| 2459 | copy.kind = kind; | |
| 2460 | ||
| 2461 | if (expansion_locs.len != 0) copy.loc = expansion_locs[expansion_locs.len - 1]; | |
| 2462 | try diag.list.append(diag.arena.allocator(), copy); | |
| 2463 | if (expansion_locs.len != 0) { | |
| 2464 | // Add macro backtrace notes in reverse order omitting from the middle if needed. | |
| 2465 | var i = expansion_locs.len - 1; | |
| 2466 | const half = diag.macro_backtrace_limit / 2; | |
| 2467 | const limit = if (i < diag.macro_backtrace_limit) 0 else i - half; | |
| 2468 | try diag.list.ensureUnusedCapacity( | |
| 2469 | diag.arena.allocator(), | |
| 2470 | if (limit == 0) expansion_locs.len else diag.macro_backtrace_limit + 1, | |
| 2471 | ); | |
| 2472 | while (i > limit) { | |
| 2473 | i -= 1; | |
| 2474 | diag.list.appendAssumeCapacity(.{ | |
| 2475 | .tag = .expanded_from_here, | |
| 2476 | .kind = .note, | |
| 2477 | .loc = expansion_locs[i], | |
| 2478 | }); | |
| 2479 | } | |
| 2480 | if (limit != 0) { | |
| 2481 | diag.list.appendAssumeCapacity(.{ | |
| 2482 | .tag = .skipping_macro_backtrace, | |
| 2483 | .kind = .note, | |
| 2484 | .extra = .{ .unsigned = expansion_locs.len - diag.macro_backtrace_limit }, | |
| 2485 | }); | |
| 2486 | i = half - 1; | |
| 2487 | while (i > 0) { | |
| 2488 | i -= 1; | |
| 2489 | diag.list.appendAssumeCapacity(.{ | |
| 2490 | .tag = .expanded_from_here, | |
| 2491 | .kind = .note, | |
| 2492 | .loc = expansion_locs[i], | |
| 2493 | }); | |
| 2494 | } | |
| 2495 | } | |
| 2496 | ||
| 2497 | diag.list.appendAssumeCapacity(.{ | |
| 2498 | .tag = .expanded_from_here, | |
| 2499 | .kind = .note, | |
| 2500 | .loc = msg.loc, | |
| 2501 | }); | |
| 2502 | } | |
| 2503 | if (kind == .@"fatal error" or (kind == .@"error" and diag.fatal_errors)) | |
| 2504 | return error.FatalError; | |
| 2505 | } | |
| 2506 | ||
| 2507 | pub fn fatal( | |
| 2508 | diag: *Diagnostics, | |
| 2509 | path: []const u8, | |
| 2510 | line: []const u8, | |
| 2511 | line_no: u32, | |
| 2512 | col: u32, | |
| 2513 | comptime fmt: []const u8, | |
| 2514 | args: anytype, | |
| 2515 | ) Compilation.Error { | |
| 2516 | var m = MsgWriter.init(diag.color); | |
| 2517 | defer m.deinit(); | |
| 2518 | ||
| 2519 | m.location(path, line_no, col); | |
| 2520 | m.start(.@"fatal error"); | |
| 2521 | m.print(fmt, args); | |
| 2522 | m.end(line, col, false); | |
| 2523 | ||
| 2524 | diag.errors += 1; | |
| 2525 | return error.FatalError; | |
| 2526 | } | |
| 2527 | ||
| 2528 | pub fn fatalNoSrc(diag: *Diagnostics, comptime fmt: []const u8, args: anytype) error{FatalError} { | |
| 2529 | if (!diag.color) { | |
| 2530 | std.debug.print("fatal error: " ++ fmt ++ "\n", args); | |
| 2531 | } else { | |
| 2532 | const std_err = std.io.getStdErr().writer(); | |
| 2533 | util.setColor(.red, std_err); | |
| 2534 | std_err.writeAll("fatal error: ") catch {}; | |
| 2535 | util.setColor(.white, std_err); | |
| 2536 | std_err.print(fmt ++ "\n", args) catch {}; | |
| 2537 | util.setColor(.reset, std_err); | |
| 2538 | } | |
| 2539 | diag.errors += 1; | |
| 2540 | return error.FatalError; | |
| 2541 | } | |
| 2542 | ||
| 2543 | pub fn render(comp: *Compilation) void { | |
| 2544 | if (comp.diag.list.items.len == 0) return; | |
| 2545 | var m = defaultMsgWriter(comp); | |
| 2546 | defer m.deinit(); | |
| 2547 | renderMessages(comp, &m); | |
| 2548 | } | |
| 2549 | pub fn defaultMsgWriter(comp: *const Compilation) MsgWriter { | |
| 2550 | return MsgWriter.init(comp.diag.color); | |
| 2551 | } | |
| 2552 | ||
| 2553 | pub fn renderMessages(comp: *Compilation, m: anytype) void { | |
| 2554 | var errors: u32 = 0; | |
| 2555 | var warnings: u32 = 0; | |
| 2556 | for (comp.diag.list.items) |msg| { | |
| 2557 | switch (msg.kind) { | |
| 2558 | .@"fatal error", .@"error" => errors += 1, | |
| 2559 | .warning => warnings += 1, | |
| 2560 | .note => {}, | |
| 2561 | .off => continue, // happens if an error is added before it is disabled | |
| 2562 | .default => unreachable, | |
| 2563 | } | |
| 2564 | renderMessage(comp, m, msg); | |
| 2565 | } | |
| 2566 | const w_s: []const u8 = if (warnings == 1) "" else "s"; | |
| 2567 | const e_s: []const u8 = if (errors == 1) "" else "s"; | |
| 2568 | if (errors != 0 and warnings != 0) { | |
| 2569 | m.print("{d} warning{s} and {d} error{s} generated.\n", .{ warnings, w_s, errors, e_s }); | |
| 2570 | } else if (warnings != 0) { | |
| 2571 | m.print("{d} warning{s} generated.\n", .{ warnings, w_s }); | |
| 2572 | } else if (errors != 0) { | |
| 2573 | m.print("{d} error{s} generated.\n", .{ errors, e_s }); | |
| 2574 | } | |
| 2575 | ||
| 2576 | comp.diag.list.items.len = 0; | |
| 2577 | comp.diag.errors += errors; | |
| 2578 | } | |
| 2579 | ||
| 2580 | pub fn renderMessage(comp: *Compilation, m: anytype, msg: Message) void { | |
| 2581 | var line: ?[]const u8 = null; | |
| 2582 | var end_with_splice = false; | |
| 2583 | const width = if (msg.loc.id != .unused) blk: { | |
| 2584 | var loc = msg.loc; | |
| 2585 | switch (msg.tag) { | |
| 2586 | .escape_sequence_overflow, | |
| 2587 | .invalid_universal_character, | |
| 2588 | .non_standard_escape_char, | |
| 2589 | // use msg.extra.unsigned for index into string literal | |
| 2590 | => loc.byte_offset += @truncate(msg.extra.unsigned), | |
| 2591 | else => {}, | |
| 2592 | } | |
| 2593 | const source = comp.getSource(loc.id); | |
| 2594 | var line_col = source.lineCol(loc); | |
| 2595 | line = line_col.line; | |
| 2596 | end_with_splice = line_col.end_with_splice; | |
| 2597 | if (msg.tag == .backslash_newline_escape) { | |
| 2598 | line = line_col.line[0 .. line_col.col - 1]; | |
| 2599 | line_col.col += 1; | |
| 2600 | line_col.width += 1; | |
| 2601 | } | |
| 2602 | m.location(source.path, line_col.line_no, line_col.col); | |
| 2603 | break :blk line_col.width; | |
| 2604 | } else 0; | |
| 2605 | ||
| 2606 | m.start(msg.kind); | |
| 2607 | @setEvalBranchQuota(1500); | |
| 2608 | switch (msg.tag) { | |
| 2609 | inline else => |tag| { | |
| 2610 | const info = @field(messages, @tagName(tag)); | |
| 2611 | if (@hasDecl(info, "extra")) { | |
| 2612 | switch (info.extra) { | |
| 2613 | .str => m.print(info.msg, .{msg.extra.str}), | |
| 2614 | .tok_id => m.print(info.msg, .{ | |
| 2615 | msg.extra.tok_id.expected.symbol(), | |
| 2616 | msg.extra.tok_id.actual.symbol(), | |
| 2617 | }), | |
| 2618 | .tok_id_expected => m.print(info.msg, .{msg.extra.tok_id_expected.symbol()}), | |
| 2619 | .arguments => m.print(info.msg, .{ msg.extra.arguments.expected, msg.extra.arguments.actual }), | |
| 2620 | .codepoints => m.print(info.msg, .{ | |
| 2621 | msg.extra.codepoints.actual, | |
| 2622 | msg.extra.codepoints.resembles, | |
| 2623 | }), | |
| 2624 | .attr_arg_count => m.print(info.msg, .{ | |
| 2625 | @tagName(msg.extra.attr_arg_count.attribute), | |
| 2626 | msg.extra.attr_arg_count.expected, | |
| 2627 | }), | |
| 2628 | .attr_arg_type => m.print(info.msg, .{ | |
| 2629 | msg.extra.attr_arg_type.expected.toString(), | |
| 2630 | msg.extra.attr_arg_type.actual.toString(), | |
| 2631 | }), | |
| 2632 | .actual_codepoint => m.print(info.msg, .{msg.extra.actual_codepoint}), | |
| 2633 | .ascii => m.print(info.msg, .{msg.extra.ascii}), | |
| 2634 | .unsigned => m.print(info.msg, .{msg.extra.unsigned}), | |
| 2635 | .pow_2_as_string => m.print(info.msg, .{switch (msg.extra.pow_2_as_string) { | |
| 2636 | 63 => "9223372036854775808", | |
| 2637 | 64 => "18446744073709551616", | |
| 2638 | 127 => "170141183460469231731687303715884105728", | |
| 2639 | 128 => "340282366920938463463374607431768211456", | |
| 2640 | else => unreachable, | |
| 2641 | }}), | |
| 2642 | .signed => m.print(info.msg, .{msg.extra.signed}), | |
| 2643 | .attr_enum => m.print(info.msg, .{ | |
| 2644 | @tagName(msg.extra.attr_enum.tag), | |
| 2645 | Attribute.Formatting.choices(msg.extra.attr_enum.tag), | |
| 2646 | }), | |
| 2647 | .ignored_record_attr => m.print(info.msg, .{ | |
| 2648 | @tagName(msg.extra.ignored_record_attr.tag), | |
| 2649 | @tagName(msg.extra.ignored_record_attr.specifier), | |
| 2650 | }), | |
| 2651 | .builtin_with_header => m.print(info.msg, .{ | |
| 2652 | @tagName(msg.extra.builtin_with_header.header), | |
| 2653 | @tagName(msg.extra.builtin_with_header.builtin), | |
| 2654 | }), | |
| 2655 | else => @compileError("invalid extra kind " ++ @tagName(info.extra)), | |
| 2656 | } | |
| 2657 | } else { | |
| 2658 | m.write(info.msg); | |
| 2659 | } | |
| 2660 | ||
| 2661 | if (@hasDecl(info, "opt")) { | |
| 2662 | if (msg.kind == .@"error" and info.kind != .@"error") { | |
| 2663 | m.print(" [-Werror,-W{s}]", .{info.opt}); | |
| 2664 | } else if (msg.kind != .note) { | |
| 2665 | m.print(" [-W{s}]", .{info.opt}); | |
| 2666 | } | |
| 2667 | } | |
| 2668 | }, | |
| 2669 | } | |
| 2670 | ||
| 2671 | m.end(line, width, end_with_splice); | |
| 2672 | } | |
| 2673 | ||
| 2674 | fn tagKind(diag: *Diagnostics, tag: Tag) Kind { | |
| 2675 | // XXX: horrible hack, do not do this | |
| 2676 | const comp = @fieldParentPtr(Compilation, "diag", diag); | |
| 2677 | ||
| 2678 | var kind: Kind = undefined; | |
| 2679 | switch (tag) { | |
| 2680 | inline else => |tag_val| { | |
| 2681 | const info = @field(messages, @tagName(tag_val)); | |
| 2682 | kind = info.kind; | |
| 2683 | ||
| 2684 | // stage1 doesn't like when I combine these ifs | |
| 2685 | if (@hasDecl(info, "all")) { | |
| 2686 | if (diag.options.all != .default) kind = diag.options.all; | |
| 2687 | } | |
| 2688 | if (@hasDecl(info, "w_extra")) { | |
| 2689 | if (diag.options.extra != .default) kind = diag.options.extra; | |
| 2690 | } | |
| 2691 | if (@hasDecl(info, "pedantic")) { | |
| 2692 | if (diag.options.pedantic != .default) kind = diag.options.pedantic; | |
| 2693 | } | |
| 2694 | if (@hasDecl(info, "opt")) { | |
| 2695 | if (@field(diag.options, info.opt) != .default) kind = @field(diag.options, info.opt); | |
| 2696 | } | |
| 2697 | if (@hasDecl(info, "suppress_version")) if (comp.langopts.standard.atLeast(info.suppress_version)) return .off; | |
| 2698 | if (@hasDecl(info, "suppress_unless_version")) if (!comp.langopts.standard.atLeast(info.suppress_unless_version)) return .off; | |
| 2699 | if (@hasDecl(info, "suppress_gnu")) if (comp.langopts.standard.isExplicitGNU()) return .off; | |
| 2700 | if (@hasDecl(info, "suppress_language_option")) if (!@field(comp.langopts, info.suppress_language_option)) return .off; | |
| 2701 | if (@hasDecl(info, "suppress_gcc")) if (comp.langopts.emulate == .gcc) return .off; | |
| 2702 | if (@hasDecl(info, "suppress_clang")) if (comp.langopts.emulate == .clang) return .off; | |
| 2703 | if (@hasDecl(info, "suppress_msvc")) if (comp.langopts.emulate == .msvc) return .off; | |
| 2704 | if (kind == .@"error" and diag.fatal_errors) kind = .@"fatal error"; | |
| 2705 | return kind; | |
| 2706 | }, | |
| 2707 | } | |
| 2708 | } | |
| 2709 | ||
| 2710 | const MsgWriter = struct { | |
| 2711 | w: std.io.BufferedWriter(4096, std.fs.File.Writer), | |
| 2712 | color: bool, | |
| 2713 | ||
| 2714 | fn init(color: bool) MsgWriter { | |
| 2715 | std.debug.getStderrMutex().lock(); | |
| 2716 | return .{ | |
| 2717 | .w = std.io.bufferedWriter(std.io.getStdErr().writer()), | |
| 2718 | .color = color, | |
| 2719 | }; | |
| 2720 | } | |
| 2721 | ||
| 2722 | pub fn deinit(m: *MsgWriter) void { | |
| 2723 | m.w.flush() catch {}; | |
| 2724 | std.debug.getStderrMutex().unlock(); | |
| 2725 | } | |
| 2726 | ||
| 2727 | pub fn print(m: *MsgWriter, comptime fmt: []const u8, args: anytype) void { | |
| 2728 | m.w.writer().print(fmt, args) catch {}; | |
| 2729 | } | |
| 2730 | ||
| 2731 | fn write(m: *MsgWriter, msg: []const u8) void { | |
| 2732 | m.w.writer().writeAll(msg) catch {}; | |
| 2733 | } | |
| 2734 | ||
| 2735 | fn setColor(m: *MsgWriter, color: util.Color) void { | |
| 2736 | util.setColor(color, m.w.writer()); | |
| 2737 | } | |
| 2738 | ||
| 2739 | fn location(m: *MsgWriter, path: []const u8, line: u32, col: u32) void { | |
| 2740 | const prefix = if (std.fs.path.dirname(path) == null and path[0] != '<') "." ++ std.fs.path.sep_str else ""; | |
| 2741 | if (!m.color) { | |
| 2742 | m.print("{s}{s}:{d}:{d}: ", .{ prefix, path, line, col }); | |
| 2743 | } else { | |
| 2744 | m.setColor(.white); | |
| 2745 | m.print("{s}{s}:{d}:{d}: ", .{ prefix, path, line, col }); | |
| 2746 | } | |
| 2747 | } | |
| 2748 | ||
| 2749 | fn start(m: *MsgWriter, kind: Kind) void { | |
| 2750 | if (!m.color) { | |
| 2751 | m.print("{s}: ", .{@tagName(kind)}); | |
| 2752 | } else { | |
| 2753 | switch (kind) { | |
| 2754 | .@"fatal error", .@"error" => m.setColor(.red), | |
| 2755 | .note => m.setColor(.cyan), | |
| 2756 | .warning => m.setColor(.purple), | |
| 2757 | .off, .default => unreachable, | |
| 2758 | } | |
| 2759 | m.write(switch (kind) { | |
| 2760 | .@"fatal error" => "fatal error: ", | |
| 2761 | .@"error" => "error: ", | |
| 2762 | .note => "note: ", | |
| 2763 | .warning => "warning: ", | |
| 2764 | .off, .default => unreachable, | |
| 2765 | }); | |
| 2766 | m.setColor(.white); | |
| 2767 | } | |
| 2768 | } | |
| 2769 | ||
| 2770 | fn end(m: *MsgWriter, maybe_line: ?[]const u8, col: u32, end_with_splice: bool) void { | |
| 2771 | const line = maybe_line orelse { | |
| 2772 | m.write("\n"); | |
| 2773 | return; | |
| 2774 | }; | |
| 2775 | const trailer = if (end_with_splice) "\\ " else ""; | |
| 2776 | if (!m.color) { | |
| 2777 | m.print("\n{s}{s}\n", .{ line, trailer }); | |
| 2778 | m.print("{s: >[1]}^\n", .{ "", col }); | |
| 2779 | } else { | |
| 2780 | m.setColor(.reset); | |
| 2781 | m.print("\n{s}{s}\n{s: >[3]}", .{ line, trailer, "", col }); | |
| 2782 | m.setColor(.green); | |
| 2783 | m.write("^\n"); | |
| 2784 | m.setColor(.reset); | |
| 2785 | } | |
| 2786 | } | |
| 2787 | }; |
deps/aro/Driver.zig created+683| ... | ... | @@ -0,0 +1,683 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Allocator = mem.Allocator; | |
| 4 | const process = std.process; | |
| 5 | const Codegen = @import("Codegen_legacy.zig"); | |
| 6 | const Compilation = @import("Compilation.zig"); | |
| 7 | const LangOpts = @import("LangOpts.zig"); | |
| 8 | const Preprocessor = @import("Preprocessor.zig"); | |
| 9 | const Parser = @import("Parser.zig"); | |
| 10 | const Source = @import("Source.zig"); | |
| 11 | const Toolchain = @import("Toolchain.zig"); | |
| 12 | const util = @import("util.zig"); | |
| 13 | const target_util = @import("target.zig"); | |
| 14 | ||
| 15 | const Driver = @This(); | |
| 16 | ||
| 17 | pub const Linker = enum { | |
| 18 | ld, | |
| 19 | bfd, | |
| 20 | gold, | |
| 21 | lld, | |
| 22 | mold, | |
| 23 | }; | |
| 24 | ||
| 25 | comp: *Compilation, | |
| 26 | inputs: std.ArrayListUnmanaged(Source) = .{}, | |
| 27 | link_objects: std.ArrayListUnmanaged([]const u8) = .{}, | |
| 28 | output_name: ?[]const u8 = null, | |
| 29 | sysroot: ?[]const u8 = null, | |
| 30 | temp_file_count: u32 = 0, | |
| 31 | only_preprocess: bool = false, | |
| 32 | only_syntax: bool = false, | |
| 33 | only_compile: bool = false, | |
| 34 | only_preprocess_and_compile: bool = false, | |
| 35 | verbose_ast: bool = false, | |
| 36 | verbose_pp: bool = false, | |
| 37 | verbose_ir: bool = false, | |
| 38 | verbose_linker_args: bool = false, | |
| 39 | ||
| 40 | /// Full path to the aro executable | |
| 41 | aro_name: []const u8 = "", | |
| 42 | ||
| 43 | /// Value of --triple= passed via CLI | |
| 44 | raw_target_triple: ?[]const u8 = null, | |
| 45 | ||
| 46 | // linker options | |
| 47 | use_linker: ?[]const u8 = null, | |
| 48 | linker_path: ?[]const u8 = null, | |
| 49 | nodefaultlibs: bool = false, | |
| 50 | nolibc: bool = false, | |
| 51 | nostartfiles: bool = false, | |
| 52 | nostdlib: bool = false, | |
| 53 | pie: ?bool = null, | |
| 54 | rdynamic: bool = false, | |
| 55 | relocatable: bool = false, | |
| 56 | rtlib: ?[]const u8 = null, | |
| 57 | shared: bool = false, | |
| 58 | shared_libgcc: bool = false, | |
| 59 | static: bool = false, | |
| 60 | static_libgcc: bool = false, | |
| 61 | static_pie: bool = false, | |
| 62 | strip: bool = false, | |
| 63 | unwindlib: ?[]const u8 = null, | |
| 64 | ||
| 65 | pub fn deinit(d: *Driver) void { | |
| 66 | for (d.link_objects.items[d.link_objects.items.len - d.temp_file_count ..]) |obj| { | |
| 67 | std.fs.deleteFileAbsolute(obj) catch {}; | |
| 68 | d.comp.gpa.free(obj); | |
| 69 | } | |
| 70 | d.inputs.deinit(d.comp.gpa); | |
| 71 | d.link_objects.deinit(d.comp.gpa); | |
| 72 | d.* = undefined; | |
| 73 | } | |
| 74 | ||
| 75 | pub const usage = | |
| 76 | \\Usage {s}: [options] file.. | |
| 77 | \\ | |
| 78 | \\General options: | |
| 79 | \\ -h, --help Print this message. | |
| 80 | \\ -v, --version Print aro version. | |
| 81 | \\ | |
| 82 | \\Compile options: | |
| 83 | \\ -c, --compile Only run preprocess, compile, and assemble steps | |
| 84 | \\ -D <macro>=<value> Define <macro> to <value> (defaults to 1) | |
| 85 | \\ -E Only run the preprocessor | |
| 86 | \\ -fchar8_t Enable char8_t (enabled by default in C2X and later) | |
| 87 | \\ -fno-char8_t Disable char8_t (disabled by default for pre-C2X) | |
| 88 | \\ -fcolor-diagnostics Enable colors in diagnostics | |
| 89 | \\ -fno-color-diagnostics Disable colors in diagnostics | |
| 90 | \\ -fdeclspec Enable support for __declspec attributes | |
| 91 | \\ -fno-declspec Disable support for __declspec attributes | |
| 92 | \\ -ffp-eval-method=[source|double|extended] | |
| 93 | \\ Evaluation method to use for floating-point arithmetic | |
| 94 | \\ -fgnu-inline-asm Enable GNU style inline asm (default: enabled) | |
| 95 | \\ -fno-gnu-inline-asm Disable GNU style inline asm | |
| 96 | \\ -fms-extensions Enable support for Microsoft extensions | |
| 97 | \\ -fno-ms-extensions Disable support for Microsoft extensions | |
| 98 | \\ -fdollars-in-identifiers | |
| 99 | \\ Allow '$' in identifiers | |
| 100 | \\ -fno-dollars-in-identifiers | |
| 101 | \\ Disallow '$' in identifiers | |
| 102 | \\ -fmacro-backtrace-limit=<limit> | |
| 103 | \\ Set limit on how many macro expansion traces are shown in errors (default 6) | |
| 104 | \\ -fnative-half-type Use the native half type for __fp16 instead of promoting to float | |
| 105 | \\ -fnative-half-arguments-and-returns | |
| 106 | \\ Allow half-precision function arguments and return values | |
| 107 | \\ -fshort-enums Use the narrowest possible integer type for enums | |
| 108 | \\ -fno-short-enums Use "int" as the tag type for enums | |
| 109 | \\ -fsigned-char "char" is signed | |
| 110 | \\ -fno-signed-char "char" is unsigned | |
| 111 | \\ -fsyntax-only Only run the preprocessor, parser, and semantic analysis stages | |
| 112 | \\ -funsigned-char "char" is unsigned | |
| 113 | \\ -fno-unsigned-char "char" is signed | |
| 114 | \\ -I <dir> Add directory to include search path | |
| 115 | \\ -isystem Add directory to SYSTEM include search path | |
| 116 | \\ --emulate=[clang|gcc|msvc] | |
| 117 | \\ Select which C compiler to emulate (default clang) | |
| 118 | \\ -o <file> Write output to <file> | |
| 119 | \\ -pedantic Warn on language extensions | |
| 120 | \\ --rtlib=<arg> Compiler runtime library to use (libgcc or compiler-rt) | |
| 121 | \\ -std=<standard> Specify language standard | |
| 122 | \\ -S, --assemble Only run preprocess and compilation steps | |
| 123 | \\ --sysroot=<dir> Use dir as the logical root directory for headers and libraries (not fully implemented) | |
| 124 | \\ --target=<value> Generate code for the given target | |
| 125 | \\ -U <macro> Undefine <macro> | |
| 126 | \\ -Werror Treat all warnings as errors | |
| 127 | \\ -Werror=<warning> Treat warning as error | |
| 128 | \\ -W<warning> Enable the specified warning | |
| 129 | \\ -Wno-<warning> Disable the specified warning | |
| 130 | \\ | |
| 131 | \\Link options: | |
| 132 | \\ -fuse-ld=[bfd|gold|lld|mold] | |
| 133 | \\ Use specific linker | |
| 134 | \\ -nodefaultlibs Do not use the standard system libraries when linking. | |
| 135 | \\ -nolibc Do not use the C library or system libraries tightly coupled with it when linking. | |
| 136 | \\ -nostdlib Do not use the standard system startup files or libraries when linking | |
| 137 | \\ -nostartfiles Do not use the standard system startup files when linking. | |
| 138 | \\ -pie Produce a dynamically linked position independent executable on targets that support it. | |
| 139 | \\ --ld-path=<path> Use linker specified by <path> | |
| 140 | \\ -r Produce a relocatable object as output. | |
| 141 | \\ -rdynamic Pass the flag -export-dynamic to the ELF linker, on targets that support it. | |
| 142 | \\ -s Remove all symbol table and relocation information from the executable. | |
| 143 | \\ -shared Produce a shared object which can then be linked with other objects to form an executable. | |
| 144 | \\ -shared-libgcc On systems that provide libgcc as a shared library, force the use of the shared version | |
| 145 | \\ -static On systems that support dynamic linking, this overrides -pie and prevents linking with the shared libraries. | |
| 146 | \\ -static-libgcc On systems that provide libgcc as a shared library, force the use of the static version | |
| 147 | \\ -static-pie Produce a static position independent executable on targets that support it. | |
| 148 | \\ --unwindlib=<arg> Unwind library to use ("none", "libgcc", or "libunwind") If not specified, will match runtime library | |
| 149 | \\ | |
| 150 | \\Debug options: | |
| 151 | \\ --verbose-ast Dump produced AST to stdout | |
| 152 | \\ --verbose-pp Dump preprocessor state | |
| 153 | \\ --verbose-ir Dump ir to stdout | |
| 154 | \\ --verbose-linker-args Dump linker args to stdout | |
| 155 | \\ | |
| 156 | \\ | |
| 157 | ; | |
| 158 | ||
| 159 | /// Process command line arguments, returns true if something was written to std_out. | |
| 160 | pub fn parseArgs( | |
| 161 | d: *Driver, | |
| 162 | std_out: anytype, | |
| 163 | macro_buf: anytype, | |
| 164 | args: []const []const u8, | |
| 165 | ) !bool { | |
| 166 | var i: usize = 1; | |
| 167 | var color_setting: enum { | |
| 168 | on, | |
| 169 | off, | |
| 170 | unset, | |
| 171 | } = .unset; | |
| 172 | while (i < args.len) : (i += 1) { | |
| 173 | const arg = args[i]; | |
| 174 | if (mem.startsWith(u8, arg, "-") and arg.len > 1) { | |
| 175 | if (mem.eql(u8, arg, "-h") or mem.eql(u8, arg, "--help")) { | |
| 176 | std_out.print(usage, .{args[0]}) catch |er| { | |
| 177 | return d.fatal("unable to print usage: {s}", .{util.errorDescription(er)}); | |
| 178 | }; | |
| 179 | return true; | |
| 180 | } else if (mem.eql(u8, arg, "-v") or mem.eql(u8, arg, "--version")) { | |
| 181 | std_out.writeAll(@import("lib.zig").version_str ++ "\n") catch |er| { | |
| 182 | return d.fatal("unable to print version: {s}", .{util.errorDescription(er)}); | |
| 183 | }; | |
| 184 | return true; | |
| 185 | } else if (mem.startsWith(u8, arg, "-D")) { | |
| 186 | var macro = arg["-D".len..]; | |
| 187 | if (macro.len == 0) { | |
| 188 | i += 1; | |
| 189 | if (i >= args.len) { | |
| 190 | try d.err("expected argument after -I"); | |
| 191 | continue; | |
| 192 | } | |
| 193 | macro = args[i]; | |
| 194 | } | |
| 195 | var value: []const u8 = "1"; | |
| 196 | if (mem.indexOfScalar(u8, macro, '=')) |some| { | |
| 197 | value = macro[some + 1 ..]; | |
| 198 | macro = macro[0..some]; | |
| 199 | } | |
| 200 | try macro_buf.print("#define {s} {s}\n", .{ macro, value }); | |
| 201 | } else if (mem.startsWith(u8, arg, "-U")) { | |
| 202 | var macro = arg["-U".len..]; | |
| 203 | if (macro.len == 0) { | |
| 204 | i += 1; | |
| 205 | if (i >= args.len) { | |
| 206 | try d.err("expected argument after -I"); | |
| 207 | continue; | |
| 208 | } | |
| 209 | macro = args[i]; | |
| 210 | } | |
| 211 | try macro_buf.print("#undef {s}\n", .{macro}); | |
| 212 | } else if (mem.eql(u8, arg, "-c") or mem.eql(u8, arg, "--compile")) { | |
| 213 | d.only_compile = true; | |
| 214 | } else if (mem.eql(u8, arg, "-E")) { | |
| 215 | d.only_preprocess = true; | |
| 216 | } else if (mem.eql(u8, arg, "-fchar8_t")) { | |
| 217 | d.comp.langopts.has_char8_t_override = true; | |
| 218 | } else if (mem.eql(u8, arg, "-fno-char8_t")) { | |
| 219 | d.comp.langopts.has_char8_t_override = false; | |
| 220 | } else if (mem.eql(u8, arg, "-fcolor-diagnostics")) { | |
| 221 | color_setting = .on; | |
| 222 | } else if (mem.eql(u8, arg, "-fno-color-diagnostics")) { | |
| 223 | color_setting = .off; | |
| 224 | } else if (mem.eql(u8, arg, "-fdollars-in-identifiers")) { | |
| 225 | d.comp.langopts.dollars_in_identifiers = true; | |
| 226 | } else if (mem.eql(u8, arg, "-fno-dollars-in-identifiers")) { | |
| 227 | d.comp.langopts.dollars_in_identifiers = false; | |
| 228 | } else if (mem.eql(u8, arg, "-fdigraphs")) { | |
| 229 | d.comp.langopts.digraphs = true; | |
| 230 | } else if (mem.eql(u8, arg, "-fgnu-inline-asm")) { | |
| 231 | d.comp.langopts.gnu_asm = true; | |
| 232 | } else if (mem.eql(u8, arg, "-fno-gnu-inline-asm")) { | |
| 233 | d.comp.langopts.gnu_asm = false; | |
| 234 | } else if (mem.eql(u8, arg, "-fno-digraphs")) { | |
| 235 | d.comp.langopts.digraphs = false; | |
| 236 | } else if (option(arg, "-fmacro-backtrace-limit=")) |limit_str| { | |
| 237 | var limit = std.fmt.parseInt(u32, limit_str, 10) catch { | |
| 238 | try d.err("-fmacro-backtrace-limit takes a number argument"); | |
| 239 | continue; | |
| 240 | }; | |
| 241 | ||
| 242 | if (limit == 0) limit = std.math.maxInt(u32); | |
| 243 | d.comp.diag.macro_backtrace_limit = limit; | |
| 244 | } else if (mem.eql(u8, arg, "-fnative-half-type")) { | |
| 245 | d.comp.langopts.use_native_half_type = true; | |
| 246 | } else if (mem.eql(u8, arg, "-fnative-half-arguments-and-returns")) { | |
| 247 | d.comp.langopts.allow_half_args_and_returns = true; | |
| 248 | } else if (mem.eql(u8, arg, "-fshort-enums")) { | |
| 249 | d.comp.langopts.short_enums = true; | |
| 250 | } else if (mem.eql(u8, arg, "-fno-short-enums")) { | |
| 251 | d.comp.langopts.short_enums = false; | |
| 252 | } else if (mem.eql(u8, arg, "-fsigned-char")) { | |
| 253 | d.comp.langopts.setCharSignedness(.signed); | |
| 254 | } else if (mem.eql(u8, arg, "-fno-signed-char")) { | |
| 255 | d.comp.langopts.setCharSignedness(.unsigned); | |
| 256 | } else if (mem.eql(u8, arg, "-funsigned-char")) { | |
| 257 | d.comp.langopts.setCharSignedness(.unsigned); | |
| 258 | } else if (mem.eql(u8, arg, "-fno-unsigned-char")) { | |
| 259 | d.comp.langopts.setCharSignedness(.signed); | |
| 260 | } else if (mem.eql(u8, arg, "-fdeclspec")) { | |
| 261 | d.comp.langopts.declspec_attrs = true; | |
| 262 | } else if (mem.eql(u8, arg, "-fno-declspec")) { | |
| 263 | d.comp.langopts.declspec_attrs = false; | |
| 264 | } else if (mem.eql(u8, arg, "-fms-extensions")) { | |
| 265 | d.comp.langopts.enableMSExtensions(); | |
| 266 | } else if (mem.eql(u8, arg, "-fno-ms-extensions")) { | |
| 267 | d.comp.langopts.disableMSExtensions(); | |
| 268 | } else if (mem.startsWith(u8, arg, "-I")) { | |
| 269 | var path = arg["-I".len..]; | |
| 270 | if (path.len == 0) { | |
| 271 | i += 1; | |
| 272 | if (i >= args.len) { | |
| 273 | try d.err("expected argument after -I"); | |
| 274 | continue; | |
| 275 | } | |
| 276 | path = args[i]; | |
| 277 | } | |
| 278 | try d.comp.include_dirs.append(path); | |
| 279 | } else if (mem.startsWith(u8, arg, "-fsyntax-only")) { | |
| 280 | d.only_syntax = true; | |
| 281 | } else if (mem.startsWith(u8, arg, "-fno-syntax-only")) { | |
| 282 | d.only_syntax = false; | |
| 283 | } else if (mem.startsWith(u8, arg, "-isystem")) { | |
| 284 | var path = arg["-isystem".len..]; | |
| 285 | if (path.len == 0) { | |
| 286 | i += 1; | |
| 287 | if (i >= args.len) { | |
| 288 | try d.err("expected argument after -isystem"); | |
| 289 | continue; | |
| 290 | } | |
| 291 | path = args[i]; | |
| 292 | } | |
| 293 | const duped = try d.comp.gpa.dupe(u8, path); | |
| 294 | errdefer d.comp.gpa.free(duped); | |
| 295 | try d.comp.system_include_dirs.append(duped); | |
| 296 | } else if (option(arg, "--emulate=")) |compiler_str| { | |
| 297 | const compiler = std.meta.stringToEnum(LangOpts.Compiler, compiler_str) orelse { | |
| 298 | try d.comp.diag.add(.{ .tag = .cli_invalid_emulate, .extra = .{ .str = arg } }, &.{}); | |
| 299 | continue; | |
| 300 | }; | |
| 301 | d.comp.langopts.setEmulatedCompiler(compiler); | |
| 302 | } else if (option(arg, "-ffp-eval-method=")) |fp_method_str| { | |
| 303 | const fp_eval_method = std.meta.stringToEnum(LangOpts.FPEvalMethod, fp_method_str) orelse .indeterminate; | |
| 304 | if (fp_eval_method == .indeterminate) { | |
| 305 | try d.comp.diag.add(.{ .tag = .cli_invalid_fp_eval_method, .extra = .{ .str = fp_method_str } }, &.{}); | |
| 306 | continue; | |
| 307 | } | |
| 308 | d.comp.langopts.setFpEvalMethod(fp_eval_method); | |
| 309 | } else if (mem.startsWith(u8, arg, "-o")) { | |
| 310 | var file = arg["-o".len..]; | |
| 311 | if (file.len == 0) { | |
| 312 | i += 1; | |
| 313 | if (i >= args.len) { | |
| 314 | try d.err("expected argument after -o"); | |
| 315 | continue; | |
| 316 | } | |
| 317 | file = args[i]; | |
| 318 | } | |
| 319 | d.output_name = file; | |
| 320 | } else if (option(arg, "--sysroot=")) |sysroot| { | |
| 321 | d.sysroot = sysroot; | |
| 322 | } else if (mem.eql(u8, arg, "-pedantic")) { | |
| 323 | d.comp.diag.options.pedantic = .warning; | |
| 324 | } else if (option(arg, "--rtlib=")) |rtlib| { | |
| 325 | if (mem.eql(u8, rtlib, "compiler-rt") or mem.eql(u8, rtlib, "libgcc") or mem.eql(u8, rtlib, "platform")) { | |
| 326 | d.rtlib = rtlib; | |
| 327 | } else { | |
| 328 | try d.comp.diag.add(.{ .tag = .invalid_rtlib, .extra = .{ .str = rtlib } }, &.{}); | |
| 329 | } | |
| 330 | } else if (option(arg, "-Werror=")) |err_name| { | |
| 331 | try d.comp.diag.set(err_name, .@"error"); | |
| 332 | } else if (mem.eql(u8, arg, "-Wno-fatal-errors")) { | |
| 333 | d.comp.diag.fatal_errors = false; | |
| 334 | } else if (option(arg, "-Wno-")) |err_name| { | |
| 335 | try d.comp.diag.set(err_name, .off); | |
| 336 | } else if (mem.eql(u8, arg, "-Wfatal-errors")) { | |
| 337 | d.comp.diag.fatal_errors = true; | |
| 338 | } else if (option(arg, "-W")) |err_name| { | |
| 339 | try d.comp.diag.set(err_name, .warning); | |
| 340 | } else if (option(arg, "-std=")) |standard| { | |
| 341 | d.comp.langopts.setStandard(standard) catch | |
| 342 | try d.comp.diag.add(.{ .tag = .cli_invalid_standard, .extra = .{ .str = arg } }, &.{}); | |
| 343 | } else if (mem.eql(u8, arg, "-S") or mem.eql(u8, arg, "--assemble")) { | |
| 344 | d.only_preprocess_and_compile = true; | |
| 345 | } else if (option(arg, "--target=")) |triple| { | |
| 346 | const cross = std.zig.CrossTarget.parse(.{ .arch_os_abi = triple }) catch { | |
| 347 | try d.comp.diag.add(.{ .tag = .cli_invalid_target, .extra = .{ .str = arg } }, &.{}); | |
| 348 | continue; | |
| 349 | }; | |
| 350 | d.comp.target = cross.toTarget(); // TODO deprecated | |
| 351 | d.comp.langopts.setEmulatedCompiler(target_util.systemCompiler(d.comp.target)); | |
| 352 | d.raw_target_triple = triple; | |
| 353 | } else if (mem.eql(u8, arg, "--verbose-ast")) { | |
| 354 | d.verbose_ast = true; | |
| 355 | } else if (mem.eql(u8, arg, "--verbose-pp")) { | |
| 356 | d.verbose_pp = true; | |
| 357 | } else if (mem.eql(u8, arg, "--verbose-ir")) { | |
| 358 | d.verbose_ir = true; | |
| 359 | } else if (mem.eql(u8, arg, "--verbose-linker-args")) { | |
| 360 | d.verbose_linker_args = true; | |
| 361 | } else if (option(arg, "-fuse-ld=")) |linker_name| { | |
| 362 | d.use_linker = linker_name; | |
| 363 | } else if (mem.eql(u8, arg, "-fuse-ld=")) { | |
| 364 | d.use_linker = null; | |
| 365 | } else if (option(arg, "--ld-path=")) |linker_path| { | |
| 366 | d.linker_path = linker_path; | |
| 367 | } else if (mem.eql(u8, arg, "-r")) { | |
| 368 | d.relocatable = true; | |
| 369 | } else if (mem.eql(u8, arg, "-shared")) { | |
| 370 | d.shared = true; | |
| 371 | } else if (mem.eql(u8, arg, "-shared-libgcc")) { | |
| 372 | d.shared_libgcc = true; | |
| 373 | } else if (mem.eql(u8, arg, "-static")) { | |
| 374 | d.static = true; | |
| 375 | } else if (mem.eql(u8, arg, "-static-libgcc")) { | |
| 376 | d.static_libgcc = true; | |
| 377 | } else if (mem.eql(u8, arg, "-static-pie")) { | |
| 378 | d.static_pie = true; | |
| 379 | } else if (mem.eql(u8, arg, "-pie")) { | |
| 380 | d.pie = true; | |
| 381 | } else if (mem.eql(u8, arg, "-no-pie") or mem.eql(u8, arg, "-nopie")) { | |
| 382 | d.pie = false; | |
| 383 | } else if (mem.eql(u8, arg, "-rdynamic")) { | |
| 384 | d.rdynamic = true; | |
| 385 | } else if (mem.eql(u8, arg, "-s")) { | |
| 386 | d.strip = true; | |
| 387 | } else if (mem.eql(u8, arg, "-nodefaultlibs")) { | |
| 388 | d.nodefaultlibs = true; | |
| 389 | } else if (mem.eql(u8, arg, "-nolibc")) { | |
| 390 | d.nolibc = true; | |
| 391 | } else if (mem.eql(u8, arg, "-nostdlib")) { | |
| 392 | d.nostdlib = true; | |
| 393 | } else if (mem.eql(u8, arg, "-nostartfiles")) { | |
| 394 | d.nostartfiles = true; | |
| 395 | } else if (option(arg, "--unwindlib=")) |unwindlib| { | |
| 396 | const valid_unwindlibs: [5][]const u8 = .{ "", "none", "platform", "libunwind", "libgcc" }; | |
| 397 | for (valid_unwindlibs) |name| { | |
| 398 | if (mem.eql(u8, name, unwindlib)) { | |
| 399 | d.unwindlib = unwindlib; | |
| 400 | break; | |
| 401 | } | |
| 402 | } else { | |
| 403 | try d.comp.diag.add(.{ .tag = .invalid_unwindlib, .extra = .{ .str = unwindlib } }, &.{}); | |
| 404 | } | |
| 405 | } else { | |
| 406 | try d.comp.diag.add(.{ .tag = .cli_unknown_arg, .extra = .{ .str = arg } }, &.{}); | |
| 407 | } | |
| 408 | } else if (std.mem.endsWith(u8, arg, ".o") or std.mem.endsWith(u8, arg, ".obj")) { | |
| 409 | try d.link_objects.append(d.comp.gpa, arg); | |
| 410 | } else { | |
| 411 | const source = d.addSource(arg) catch |er| { | |
| 412 | return d.fatal("unable to add source file '{s}': {s}", .{ arg, util.errorDescription(er) }); | |
| 413 | }; | |
| 414 | try d.inputs.append(d.comp.gpa, source); | |
| 415 | } | |
| 416 | } | |
| 417 | d.comp.diag.color = switch (color_setting) { | |
| 418 | .on => true, | |
| 419 | .off => false, | |
| 420 | .unset => util.fileSupportsColor(std.io.getStdErr()) and !std.process.hasEnvVarConstant("NO_COLOR"), | |
| 421 | }; | |
| 422 | return false; | |
| 423 | } | |
| 424 | ||
| 425 | fn option(arg: []const u8, name: []const u8) ?[]const u8 { | |
| 426 | if (std.mem.startsWith(u8, arg, name) and arg.len > name.len) { | |
| 427 | return arg[name.len..]; | |
| 428 | } | |
| 429 | return null; | |
| 430 | } | |
| 431 | ||
| 432 | fn addSource(d: *Driver, path: []const u8) !Source { | |
| 433 | if (mem.eql(u8, "-", path)) { | |
| 434 | const stdin = std.io.getStdIn().reader(); | |
| 435 | const input = try stdin.readAllAlloc(d.comp.gpa, std.math.maxInt(u32)); | |
| 436 | defer d.comp.gpa.free(input); | |
| 437 | return d.comp.addSourceFromBuffer("<stdin>", input); | |
| 438 | } | |
| 439 | return d.comp.addSourceFromPath(path); | |
| 440 | } | |
| 441 | ||
| 442 | pub fn err(d: *Driver, msg: []const u8) !void { | |
| 443 | try d.comp.diag.add(.{ .tag = .cli_error, .extra = .{ .str = msg } }, &.{}); | |
| 444 | } | |
| 445 | ||
| 446 | pub fn fatal(d: *Driver, comptime fmt: []const u8, args: anytype) error{FatalError} { | |
| 447 | d.comp.renderErrors(); | |
| 448 | return d.comp.diag.fatalNoSrc(fmt, args); | |
| 449 | } | |
| 450 | ||
| 451 | pub fn main(d: *Driver, tc: *Toolchain, args: []const []const u8) !void { | |
| 452 | var macro_buf = std.ArrayList(u8).init(d.comp.gpa); | |
| 453 | defer macro_buf.deinit(); | |
| 454 | ||
| 455 | const std_out = std.io.getStdOut().writer(); | |
| 456 | if (try parseArgs(d, std_out, macro_buf.writer(), args)) return; | |
| 457 | ||
| 458 | const linking = !(d.only_preprocess or d.only_syntax or d.only_compile or d.only_preprocess_and_compile); | |
| 459 | ||
| 460 | if (d.inputs.items.len == 0) { | |
| 461 | return d.fatal("no input files", .{}); | |
| 462 | } else if (d.inputs.items.len != 1 and d.output_name != null and !linking) { | |
| 463 | return d.fatal("cannot specify -o when generating multiple output files", .{}); | |
| 464 | } | |
| 465 | ||
| 466 | if (!linking) for (d.link_objects.items) |obj| { | |
| 467 | try d.comp.diag.add(.{ .tag = .cli_unused_link_object, .extra = .{ .str = obj } }, &.{}); | |
| 468 | }; | |
| 469 | ||
| 470 | d.comp.defineSystemIncludes(d.aro_name) catch |er| switch (er) { | |
| 471 | error.OutOfMemory => return error.OutOfMemory, | |
| 472 | error.AroIncludeNotFound => return d.fatal("unable to find Aro builtin headers", .{}), | |
| 473 | }; | |
| 474 | ||
| 475 | const builtin = try d.comp.generateBuiltinMacros(); | |
| 476 | const user_macros = try d.comp.addSourceFromBuffer("<command line>", macro_buf.items); | |
| 477 | ||
| 478 | const fast_exit = @import("builtin").mode != .Debug; | |
| 479 | ||
| 480 | if (fast_exit and d.inputs.items.len == 1) { | |
| 481 | d.processSource(tc, d.inputs.items[0], builtin, user_macros, fast_exit) catch |e| switch (e) { | |
| 482 | error.FatalError => { | |
| 483 | d.comp.renderErrors(); | |
| 484 | d.exitWithCleanup(1); | |
| 485 | }, | |
| 486 | else => |er| return er, | |
| 487 | }; | |
| 488 | unreachable; | |
| 489 | } | |
| 490 | ||
| 491 | for (d.inputs.items) |source| { | |
| 492 | d.processSource(tc, source, builtin, user_macros, fast_exit) catch |e| switch (e) { | |
| 493 | error.FatalError => { | |
| 494 | d.comp.renderErrors(); | |
| 495 | }, | |
| 496 | else => |er| return er, | |
| 497 | }; | |
| 498 | } | |
| 499 | if (d.comp.diag.errors != 0) { | |
| 500 | if (fast_exit) d.exitWithCleanup(1); | |
| 501 | return; | |
| 502 | } | |
| 503 | if (linking) { | |
| 504 | try d.invokeLinker(tc, fast_exit); | |
| 505 | } | |
| 506 | if (fast_exit) std.process.exit(0); | |
| 507 | } | |
| 508 | ||
| 509 | fn processSource( | |
| 510 | d: *Driver, | |
| 511 | tc: *Toolchain, | |
| 512 | source: Source, | |
| 513 | builtin: Source, | |
| 514 | user_macros: Source, | |
| 515 | comptime fast_exit: bool, | |
| 516 | ) !void { | |
| 517 | d.comp.generated_buf.items.len = 0; | |
| 518 | var pp = Preprocessor.init(d.comp); | |
| 519 | defer pp.deinit(); | |
| 520 | ||
| 521 | if (d.verbose_pp) pp.verbose = true; | |
| 522 | if (d.only_preprocess) pp.preserve_whitespace = true; | |
| 523 | try pp.addBuiltinMacros(); | |
| 524 | ||
| 525 | _ = try pp.preprocess(builtin); | |
| 526 | _ = try pp.preprocess(user_macros); | |
| 527 | const eof = try pp.preprocess(source); | |
| 528 | try pp.tokens.append(pp.comp.gpa, eof); | |
| 529 | ||
| 530 | if (d.only_preprocess) { | |
| 531 | d.comp.renderErrors(); | |
| 532 | ||
| 533 | const file = if (d.output_name) |some| | |
| 534 | std.fs.cwd().createFile(some, .{}) catch |er| | |
| 535 | return d.fatal("unable to create output file '{s}': {s}", .{ some, util.errorDescription(er) }) | |
| 536 | else | |
| 537 | std.io.getStdOut(); | |
| 538 | defer if (d.output_name != null) file.close(); | |
| 539 | ||
| 540 | var buf_w = std.io.bufferedWriter(file.writer()); | |
| 541 | pp.prettyPrintTokens(buf_w.writer()) catch |er| | |
| 542 | return d.fatal("unable to write result: {s}", .{util.errorDescription(er)}); | |
| 543 | ||
| 544 | buf_w.flush() catch |er| | |
| 545 | return d.fatal("unable to write result: {s}", .{util.errorDescription(er)}); | |
| 546 | if (fast_exit) std.process.exit(0); // Not linking, no need for cleanup. | |
| 547 | return; | |
| 548 | } | |
| 549 | ||
| 550 | var tree = try Parser.parse(&pp); | |
| 551 | defer tree.deinit(); | |
| 552 | ||
| 553 | if (d.verbose_ast) { | |
| 554 | const stdout = std.io.getStdOut(); | |
| 555 | var buf_writer = std.io.bufferedWriter(stdout.writer()); | |
| 556 | const color = d.comp.diag.color and util.fileSupportsColor(stdout); | |
| 557 | tree.dump(color, buf_writer.writer()) catch {}; | |
| 558 | buf_writer.flush() catch {}; | |
| 559 | } | |
| 560 | ||
| 561 | const prev_errors = d.comp.diag.errors; | |
| 562 | d.comp.renderErrors(); | |
| 563 | ||
| 564 | if (d.comp.diag.errors != prev_errors) { | |
| 565 | if (fast_exit) d.exitWithCleanup(1); | |
| 566 | return; // do not compile if there were errors | |
| 567 | } | |
| 568 | ||
| 569 | if (d.only_syntax) { | |
| 570 | if (fast_exit) std.process.exit(0); // Not linking, no need for cleanup. | |
| 571 | return; | |
| 572 | } | |
| 573 | ||
| 574 | if (d.comp.target.ofmt != .elf or d.comp.target.cpu.arch != .x86_64) { | |
| 575 | return d.fatal( | |
| 576 | "unsupported target {s}-{s}-{s}, currently only x86-64 elf is supported", | |
| 577 | .{ @tagName(d.comp.target.cpu.arch), @tagName(d.comp.target.os.tag), @tagName(d.comp.target.abi) }, | |
| 578 | ); | |
| 579 | } | |
| 580 | ||
| 581 | if (d.verbose_ir) { | |
| 582 | try @import("CodeGen.zig").generateTree(d.comp, tree); | |
| 583 | } | |
| 584 | ||
| 585 | const obj = try Codegen.generateTree(d.comp, tree); | |
| 586 | defer obj.deinit(); | |
| 587 | ||
| 588 | // If it's used, name_buf will either hold a filename or `/tmp/<12 random bytes with base-64 encoding>.<extension>` | |
| 589 | // both of which should fit into MAX_NAME_BYTES for all systems | |
| 590 | var name_buf: [std.fs.MAX_NAME_BYTES]u8 = undefined; | |
| 591 | ||
| 592 | const out_file_name = if (d.only_compile) blk: { | |
| 593 | const fmt_template = "{s}{s}"; | |
| 594 | const fmt_args = .{ | |
| 595 | std.fs.path.stem(source.path), | |
| 596 | d.comp.target.ofmt.fileExt(d.comp.target.cpu.arch), | |
| 597 | }; | |
| 598 | break :blk d.output_name orelse | |
| 599 | std.fmt.bufPrint(&name_buf, fmt_template, fmt_args) catch return d.fatal("Filename too long for filesystem: " ++ fmt_template, fmt_args); | |
| 600 | } else blk: { | |
| 601 | const random_bytes_count = 12; | |
| 602 | const sub_path_len = comptime std.fs.base64_encoder.calcSize(random_bytes_count); | |
| 603 | ||
| 604 | var random_bytes: [random_bytes_count]u8 = undefined; | |
| 605 | std.crypto.random.bytes(&random_bytes); | |
| 606 | var random_name: [sub_path_len]u8 = undefined; | |
| 607 | _ = std.fs.base64_encoder.encode(&random_name, &random_bytes); | |
| 608 | ||
| 609 | const fmt_template = "/tmp/{s}{s}"; | |
| 610 | const fmt_args = .{ | |
| 611 | random_name, | |
| 612 | d.comp.target.ofmt.fileExt(d.comp.target.cpu.arch), | |
| 613 | }; | |
| 614 | break :blk std.fmt.bufPrint(&name_buf, fmt_template, fmt_args) catch return d.fatal("Filename too long for filesystem: " ++ fmt_template, fmt_args); | |
| 615 | }; | |
| 616 | ||
| 617 | const out_file = std.fs.cwd().createFile(out_file_name, .{}) catch |er| | |
| 618 | return d.fatal("unable to create output file '{s}': {s}", .{ out_file_name, util.errorDescription(er) }); | |
| 619 | defer out_file.close(); | |
| 620 | ||
| 621 | obj.finish(out_file) catch |er| | |
| 622 | return d.fatal("could not output to object file '{s}': {s}", .{ out_file_name, util.errorDescription(er) }); | |
| 623 | ||
| 624 | if (d.only_compile) { | |
| 625 | if (fast_exit) std.process.exit(0); // Not linking, no need for cleanup. | |
| 626 | return; | |
| 627 | } | |
| 628 | try d.link_objects.ensureUnusedCapacity(d.comp.gpa, 1); | |
| 629 | d.link_objects.appendAssumeCapacity(try d.comp.gpa.dupe(u8, out_file_name)); | |
| 630 | d.temp_file_count += 1; | |
| 631 | if (fast_exit) { | |
| 632 | try d.invokeLinker(tc, fast_exit); | |
| 633 | } | |
| 634 | } | |
| 635 | ||
| 636 | fn dumpLinkerArgs(items: []const []const u8) !void { | |
| 637 | const stdout = std.io.getStdOut().writer(); | |
| 638 | for (items, 0..) |item, i| { | |
| 639 | if (i > 0) try stdout.writeByte(' '); | |
| 640 | try stdout.print("\"{}\"", .{std.zig.fmtEscapes(item)}); | |
| 641 | } | |
| 642 | try stdout.writeByte('\n'); | |
| 643 | } | |
| 644 | ||
| 645 | pub fn invokeLinker(d: *Driver, tc: *Toolchain, comptime fast_exit: bool) !void { | |
| 646 | try tc.discover(); | |
| 647 | ||
| 648 | var argv = std.ArrayList([]const u8).init(d.comp.gpa); | |
| 649 | defer argv.deinit(); | |
| 650 | ||
| 651 | var linker_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 652 | const linker_path = try tc.getLinkerPath(&linker_path_buf); | |
| 653 | try argv.append(linker_path); | |
| 654 | ||
| 655 | try tc.buildLinkerArgs(&argv); | |
| 656 | ||
| 657 | if (d.verbose_linker_args) { | |
| 658 | dumpLinkerArgs(argv.items) catch |er| { | |
| 659 | return d.fatal("unable to dump linker args: {s}", .{util.errorDescription(er)}); | |
| 660 | }; | |
| 661 | } | |
| 662 | var child = std.ChildProcess.init(argv.items, d.comp.gpa); | |
| 663 | // TODO handle better | |
| 664 | child.stdin_behavior = .Inherit; | |
| 665 | child.stdout_behavior = .Inherit; | |
| 666 | child.stderr_behavior = .Inherit; | |
| 667 | ||
| 668 | const term = child.spawnAndWait() catch |er| { | |
| 669 | return d.fatal("unable to spawn linker: {s}", .{util.errorDescription(er)}); | |
| 670 | }; | |
| 671 | switch (term) { | |
| 672 | .Exited => |code| if (code != 0) d.exitWithCleanup(code), | |
| 673 | else => std.process.abort(), | |
| 674 | } | |
| 675 | if (fast_exit) d.exitWithCleanup(0); | |
| 676 | } | |
| 677 | ||
| 678 | fn exitWithCleanup(d: *Driver, code: u8) noreturn { | |
| 679 | for (d.link_objects.items[d.link_objects.items.len - d.temp_file_count ..]) |obj| { | |
| 680 | std.fs.deleteFileAbsolute(obj) catch {}; | |
| 681 | } | |
| 682 | std.process.exit(code); | |
| 683 | } |
deps/aro/Driver/Distro.zig created+329| ... | ... | @@ -0,0 +1,329 @@ |
| 1 | //! Tools for figuring out what Linux distro we're running on | |
| 2 | ||
| 3 | const std = @import("std"); | |
| 4 | const mem = std.mem; | |
| 5 | const util = @import("../util.zig"); | |
| 6 | const Filesystem = @import("Filesystem.zig").Filesystem; | |
| 7 | ||
| 8 | const MAX_BYTES = 1024; // TODO: Can we assume 1024 bytes enough for the info we need? | |
| 9 | ||
| 10 | /// Value for linker `--hash-style=` argument | |
| 11 | pub const HashStyle = enum { | |
| 12 | both, | |
| 13 | gnu, | |
| 14 | }; | |
| 15 | ||
| 16 | pub const Tag = enum { | |
| 17 | alpine, | |
| 18 | arch, | |
| 19 | debian_lenny, | |
| 20 | debian_squeeze, | |
| 21 | debian_wheezy, | |
| 22 | debian_jessie, | |
| 23 | debian_stretch, | |
| 24 | debian_buster, | |
| 25 | debian_bullseye, | |
| 26 | debian_bookworm, | |
| 27 | debian_trixie, | |
| 28 | exherbo, | |
| 29 | rhel5, | |
| 30 | rhel6, | |
| 31 | rhel7, | |
| 32 | fedora, | |
| 33 | gentoo, | |
| 34 | open_suse, | |
| 35 | ubuntu_hardy, | |
| 36 | ubuntu_intrepid, | |
| 37 | ubuntu_jaunty, | |
| 38 | ubuntu_karmic, | |
| 39 | ubuntu_lucid, | |
| 40 | ubuntu_maverick, | |
| 41 | ubuntu_natty, | |
| 42 | ubuntu_oneiric, | |
| 43 | ubuntu_precise, | |
| 44 | ubuntu_quantal, | |
| 45 | ubuntu_raring, | |
| 46 | ubuntu_saucy, | |
| 47 | ubuntu_trusty, | |
| 48 | ubuntu_utopic, | |
| 49 | ubuntu_vivid, | |
| 50 | ubuntu_wily, | |
| 51 | ubuntu_xenial, | |
| 52 | ubuntu_yakkety, | |
| 53 | ubuntu_zesty, | |
| 54 | ubuntu_artful, | |
| 55 | ubuntu_bionic, | |
| 56 | ubuntu_cosmic, | |
| 57 | ubuntu_disco, | |
| 58 | ubuntu_eoan, | |
| 59 | ubuntu_focal, | |
| 60 | ubuntu_groovy, | |
| 61 | ubuntu_hirsute, | |
| 62 | ubuntu_impish, | |
| 63 | ubuntu_jammy, | |
| 64 | ubuntu_kinetic, | |
| 65 | ubuntu_lunar, | |
| 66 | unknown, | |
| 67 | ||
| 68 | pub fn getHashStyle(self: Tag) HashStyle { | |
| 69 | if (self.isOpenSUSE()) return .both; | |
| 70 | return switch (self) { | |
| 71 | .ubuntu_lucid, | |
| 72 | .ubuntu_jaunty, | |
| 73 | .ubuntu_karmic, | |
| 74 | => .both, | |
| 75 | else => .gnu, | |
| 76 | }; | |
| 77 | } | |
| 78 | ||
| 79 | pub fn isRedhat(self: Tag) bool { | |
| 80 | return switch (self) { | |
| 81 | .fedora, | |
| 82 | .rhel5, | |
| 83 | .rhel6, | |
| 84 | .rhel7, | |
| 85 | => true, | |
| 86 | else => false, | |
| 87 | }; | |
| 88 | } | |
| 89 | ||
| 90 | pub fn isOpenSUSE(self: Tag) bool { | |
| 91 | return self == .open_suse; | |
| 92 | } | |
| 93 | ||
| 94 | pub fn isDebian(self: Tag) bool { | |
| 95 | return switch (self) { | |
| 96 | .debian_lenny, | |
| 97 | .debian_squeeze, | |
| 98 | .debian_wheezy, | |
| 99 | .debian_jessie, | |
| 100 | .debian_stretch, | |
| 101 | .debian_buster, | |
| 102 | .debian_bullseye, | |
| 103 | .debian_bookworm, | |
| 104 | .debian_trixie, | |
| 105 | => true, | |
| 106 | else => false, | |
| 107 | }; | |
| 108 | } | |
| 109 | pub fn isUbuntu(self: Tag) bool { | |
| 110 | return switch (self) { | |
| 111 | .ubuntu_hardy, | |
| 112 | .ubuntu_intrepid, | |
| 113 | .ubuntu_jaunty, | |
| 114 | .ubuntu_karmic, | |
| 115 | .ubuntu_lucid, | |
| 116 | .ubuntu_maverick, | |
| 117 | .ubuntu_natty, | |
| 118 | .ubuntu_oneiric, | |
| 119 | .ubuntu_precise, | |
| 120 | .ubuntu_quantal, | |
| 121 | .ubuntu_raring, | |
| 122 | .ubuntu_saucy, | |
| 123 | .ubuntu_trusty, | |
| 124 | .ubuntu_utopic, | |
| 125 | .ubuntu_vivid, | |
| 126 | .ubuntu_wily, | |
| 127 | .ubuntu_xenial, | |
| 128 | .ubuntu_yakkety, | |
| 129 | .ubuntu_zesty, | |
| 130 | .ubuntu_artful, | |
| 131 | .ubuntu_bionic, | |
| 132 | .ubuntu_cosmic, | |
| 133 | .ubuntu_disco, | |
| 134 | .ubuntu_eoan, | |
| 135 | .ubuntu_focal, | |
| 136 | .ubuntu_groovy, | |
| 137 | .ubuntu_hirsute, | |
| 138 | .ubuntu_impish, | |
| 139 | .ubuntu_jammy, | |
| 140 | .ubuntu_kinetic, | |
| 141 | .ubuntu_lunar, | |
| 142 | => true, | |
| 143 | ||
| 144 | else => false, | |
| 145 | }; | |
| 146 | } | |
| 147 | pub fn isAlpine(self: Tag) bool { | |
| 148 | return self == .alpine; | |
| 149 | } | |
| 150 | pub fn isGentoo(self: Tag) bool { | |
| 151 | return self == .gentoo; | |
| 152 | } | |
| 153 | }; | |
| 154 | ||
| 155 | fn scanForOsRelease(buf: []const u8) ?Tag { | |
| 156 | var it = mem.splitScalar(u8, buf, '\n'); | |
| 157 | while (it.next()) |line| { | |
| 158 | if (mem.startsWith(u8, line, "ID=")) { | |
| 159 | const rest = line["ID=".len..]; | |
| 160 | if (mem.eql(u8, rest, "alpine")) return .alpine; | |
| 161 | if (mem.eql(u8, rest, "fedora")) return .fedora; | |
| 162 | if (mem.eql(u8, rest, "gentoo")) return .gentoo; | |
| 163 | if (mem.eql(u8, rest, "arch")) return .arch; | |
| 164 | if (mem.eql(u8, rest, "sles")) return .open_suse; | |
| 165 | if (mem.eql(u8, rest, "opensuse")) return .open_suse; | |
| 166 | if (mem.eql(u8, rest, "exherbo")) return .exherbo; | |
| 167 | } | |
| 168 | } | |
| 169 | return null; | |
| 170 | } | |
| 171 | ||
| 172 | fn detectOsRelease(fs: Filesystem) ?Tag { | |
| 173 | var buf: [MAX_BYTES]u8 = undefined; | |
| 174 | const data = fs.readFile("/etc/os-release", &buf) orelse fs.readFile("/usr/lib/os-release", &buf) orelse return null; | |
| 175 | return scanForOsRelease(data); | |
| 176 | } | |
| 177 | ||
| 178 | fn scanForLSBRelease(buf: []const u8) ?Tag { | |
| 179 | var it = mem.splitScalar(u8, buf, '\n'); | |
| 180 | while (it.next()) |line| { | |
| 181 | if (mem.startsWith(u8, line, "DISTRIB_CODENAME=")) { | |
| 182 | const rest = line["DISTRIB_CODENAME=".len..]; | |
| 183 | if (mem.eql(u8, rest, "hardy")) return .ubuntu_hardy; | |
| 184 | if (mem.eql(u8, rest, "intrepid")) return .ubuntu_intrepid; | |
| 185 | if (mem.eql(u8, rest, "jaunty")) return .ubuntu_jaunty; | |
| 186 | if (mem.eql(u8, rest, "karmic")) return .ubuntu_karmic; | |
| 187 | if (mem.eql(u8, rest, "lucid")) return .ubuntu_lucid; | |
| 188 | if (mem.eql(u8, rest, "maverick")) return .ubuntu_maverick; | |
| 189 | if (mem.eql(u8, rest, "natty")) return .ubuntu_natty; | |
| 190 | if (mem.eql(u8, rest, "oneiric")) return .ubuntu_oneiric; | |
| 191 | if (mem.eql(u8, rest, "precise")) return .ubuntu_precise; | |
| 192 | if (mem.eql(u8, rest, "quantal")) return .ubuntu_quantal; | |
| 193 | if (mem.eql(u8, rest, "raring")) return .ubuntu_raring; | |
| 194 | if (mem.eql(u8, rest, "saucy")) return .ubuntu_saucy; | |
| 195 | if (mem.eql(u8, rest, "trusty")) return .ubuntu_trusty; | |
| 196 | if (mem.eql(u8, rest, "utopic")) return .ubuntu_utopic; | |
| 197 | if (mem.eql(u8, rest, "vivid")) return .ubuntu_vivid; | |
| 198 | if (mem.eql(u8, rest, "wily")) return .ubuntu_wily; | |
| 199 | if (mem.eql(u8, rest, "xenial")) return .ubuntu_xenial; | |
| 200 | if (mem.eql(u8, rest, "yakkety")) return .ubuntu_yakkety; | |
| 201 | if (mem.eql(u8, rest, "zesty")) return .ubuntu_zesty; | |
| 202 | if (mem.eql(u8, rest, "artful")) return .ubuntu_artful; | |
| 203 | if (mem.eql(u8, rest, "bionic")) return .ubuntu_bionic; | |
| 204 | if (mem.eql(u8, rest, "cosmic")) return .ubuntu_cosmic; | |
| 205 | if (mem.eql(u8, rest, "disco")) return .ubuntu_disco; | |
| 206 | if (mem.eql(u8, rest, "eoan")) return .ubuntu_eoan; | |
| 207 | if (mem.eql(u8, rest, "focal")) return .ubuntu_focal; | |
| 208 | if (mem.eql(u8, rest, "groovy")) return .ubuntu_groovy; | |
| 209 | if (mem.eql(u8, rest, "hirsute")) return .ubuntu_hirsute; | |
| 210 | if (mem.eql(u8, rest, "impish")) return .ubuntu_impish; | |
| 211 | if (mem.eql(u8, rest, "jammy")) return .ubuntu_jammy; | |
| 212 | if (mem.eql(u8, rest, "kinetic")) return .ubuntu_kinetic; | |
| 213 | if (mem.eql(u8, rest, "lunar")) return .ubuntu_lunar; | |
| 214 | } | |
| 215 | } | |
| 216 | return null; | |
| 217 | } | |
| 218 | ||
| 219 | fn detectLSBRelease(fs: Filesystem) ?Tag { | |
| 220 | var buf: [MAX_BYTES]u8 = undefined; | |
| 221 | const data = fs.readFile("/etc/lsb-release", &buf) orelse return null; | |
| 222 | ||
| 223 | return scanForLSBRelease(data); | |
| 224 | } | |
| 225 | ||
| 226 | fn scanForRedHat(buf: []const u8) Tag { | |
| 227 | if (mem.startsWith(u8, buf, "Fedora release")) return .fedora; | |
| 228 | if (mem.startsWith(u8, buf, "Red Hat Enterprise Linux") or mem.startsWith(u8, buf, "CentOS") or mem.startsWith(u8, buf, "Scientific Linux")) { | |
| 229 | if (mem.indexOfPos(u8, buf, 0, "release 7") != null) return .rhel7; | |
| 230 | if (mem.indexOfPos(u8, buf, 0, "release 6") != null) return .rhel6; | |
| 231 | if (mem.indexOfPos(u8, buf, 0, "release 5") != null) return .rhel5; | |
| 232 | } | |
| 233 | ||
| 234 | return .unknown; | |
| 235 | } | |
| 236 | ||
| 237 | fn detectRedhat(fs: Filesystem) ?Tag { | |
| 238 | var buf: [MAX_BYTES]u8 = undefined; | |
| 239 | const data = fs.readFile("/etc/redhat-release", &buf) orelse return null; | |
| 240 | return scanForRedHat(data); | |
| 241 | } | |
| 242 | ||
| 243 | fn scanForDebian(buf: []const u8) Tag { | |
| 244 | var it = mem.splitScalar(u8, buf, '.'); | |
| 245 | if (std.fmt.parseInt(u8, it.next().?, 10)) |major| { | |
| 246 | return switch (major) { | |
| 247 | 5 => .debian_lenny, | |
| 248 | 6 => .debian_squeeze, | |
| 249 | 7 => .debian_wheezy, | |
| 250 | 8 => .debian_jessie, | |
| 251 | 9 => .debian_stretch, | |
| 252 | 10 => .debian_buster, | |
| 253 | 11 => .debian_bullseye, | |
| 254 | 12 => .debian_bookworm, | |
| 255 | 13 => .debian_trixie, | |
| 256 | else => .unknown, | |
| 257 | }; | |
| 258 | } else |_| {} | |
| 259 | ||
| 260 | it = mem.splitScalar(u8, buf, '\n'); | |
| 261 | const name = it.next().?; | |
| 262 | if (mem.eql(u8, name, "squeeze/sid")) return .debian_squeeze; | |
| 263 | if (mem.eql(u8, name, "wheezy/sid")) return .debian_wheezy; | |
| 264 | if (mem.eql(u8, name, "jessie/sid")) return .debian_jessie; | |
| 265 | if (mem.eql(u8, name, "stretch/sid")) return .debian_stretch; | |
| 266 | if (mem.eql(u8, name, "buster/sid")) return .debian_buster; | |
| 267 | if (mem.eql(u8, name, "bullseye/sid")) return .debian_bullseye; | |
| 268 | if (mem.eql(u8, name, "bookworm/sid")) return .debian_bookworm; | |
| 269 | ||
| 270 | return .unknown; | |
| 271 | } | |
| 272 | ||
| 273 | fn detectDebian(fs: Filesystem) ?Tag { | |
| 274 | var buf: [MAX_BYTES]u8 = undefined; | |
| 275 | const data = fs.readFile("/etc/debian_version", &buf) orelse return null; | |
| 276 | return scanForDebian(data); | |
| 277 | } | |
| 278 | ||
| 279 | pub fn detect(target: std.Target, fs: Filesystem) Tag { | |
| 280 | if (target.os.tag != .linux) return .unknown; | |
| 281 | ||
| 282 | if (detectOsRelease(fs)) |tag| return tag; | |
| 283 | if (detectLSBRelease(fs)) |tag| return tag; | |
| 284 | if (detectRedhat(fs)) |tag| return tag; | |
| 285 | if (detectDebian(fs)) |tag| return tag; | |
| 286 | ||
| 287 | if (fs.exists("/etc/gentoo-release")) return .gentoo; | |
| 288 | ||
| 289 | return .unknown; | |
| 290 | } | |
| 291 | ||
| 292 | test scanForDebian { | |
| 293 | try std.testing.expectEqual(Tag.debian_squeeze, scanForDebian("squeeze/sid")); | |
| 294 | try std.testing.expectEqual(Tag.debian_bullseye, scanForDebian("11.1.2")); | |
| 295 | try std.testing.expectEqual(Tag.unknown, scanForDebian("None")); | |
| 296 | try std.testing.expectEqual(Tag.unknown, scanForDebian("")); | |
| 297 | } | |
| 298 | ||
| 299 | test scanForRedHat { | |
| 300 | try std.testing.expectEqual(Tag.fedora, scanForRedHat("Fedora release 7")); | |
| 301 | try std.testing.expectEqual(Tag.rhel7, scanForRedHat("Red Hat Enterprise Linux release 7")); | |
| 302 | try std.testing.expectEqual(Tag.rhel5, scanForRedHat("CentOS release 5")); | |
| 303 | try std.testing.expectEqual(Tag.unknown, scanForRedHat("CentOS release 4")); | |
| 304 | try std.testing.expectEqual(Tag.unknown, scanForRedHat("")); | |
| 305 | } | |
| 306 | ||
| 307 | test scanForLSBRelease { | |
| 308 | const text = | |
| 309 | \\DISTRIB_ID=Ubuntu | |
| 310 | \\DISTRIB_RELEASE=20.04 | |
| 311 | \\DISTRIB_CODENAME=focal | |
| 312 | \\DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS" | |
| 313 | \\ | |
| 314 | ; | |
| 315 | try std.testing.expectEqual(Tag.ubuntu_focal, scanForLSBRelease(text).?); | |
| 316 | } | |
| 317 | ||
| 318 | test scanForOsRelease { | |
| 319 | const text = | |
| 320 | \\NAME="Alpine Linux" | |
| 321 | \\ID=alpine | |
| 322 | \\VERSION_ID=3.18.2 | |
| 323 | \\PRETTY_NAME="Alpine Linux v3.18" | |
| 324 | \\HOME_URL="https://alpinelinux.org/" | |
| 325 | \\BUG_REPORT_URL="https://gitlab.alpinelinux.org/alpine/aports/-/issues" | |
| 326 | \\ | |
| 327 | ; | |
| 328 | try std.testing.expectEqual(Tag.alpine, scanForOsRelease(text).?); | |
| 329 | } |
deps/aro/Driver/Filesystem.zig created+242| ... | ... | @@ -0,0 +1,242 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const builtin = @import("builtin"); | |
| 4 | const system_defaults = @import("system_defaults"); | |
| 5 | const is_windows = builtin.os.tag == .windows; | |
| 6 | ||
| 7 | fn readFileFake(entries: []const Filesystem.Entry, path: []const u8, buf: []u8) ?[]const u8 { | |
| 8 | @setCold(true); | |
| 9 | for (entries) |entry| { | |
| 10 | if (mem.eql(u8, entry.path, path)) { | |
| 11 | const len = @min(entry.contents.len, buf.len); | |
| 12 | @memcpy(buf[0..len], entry.contents[0..len]); | |
| 13 | return buf[0..len]; | |
| 14 | } | |
| 15 | } | |
| 16 | return null; | |
| 17 | } | |
| 18 | ||
| 19 | fn findProgramByNameFake(entries: []const Filesystem.Entry, name: []const u8, path: ?[]const u8, buf: []u8) ?[]const u8 { | |
| 20 | @setCold(true); | |
| 21 | if (mem.indexOfScalar(u8, name, '/') != null) { | |
| 22 | @memcpy(buf[0..name.len], name); | |
| 23 | return buf[0..name.len]; | |
| 24 | } | |
| 25 | const path_env = path orelse return null; | |
| 26 | var fib = std.heap.FixedBufferAllocator.init(buf); | |
| 27 | ||
| 28 | var it = mem.tokenizeScalar(u8, path_env, system_defaults.path_sep); | |
| 29 | while (it.next()) |path_dir| { | |
| 30 | defer fib.reset(); | |
| 31 | const full_path = std.fs.path.join(fib.allocator(), &.{ path_dir, name }) catch continue; | |
| 32 | if (canExecuteFake(entries, full_path)) return full_path; | |
| 33 | } | |
| 34 | ||
| 35 | return null; | |
| 36 | } | |
| 37 | ||
| 38 | fn canExecuteFake(entries: []const Filesystem.Entry, path: []const u8) bool { | |
| 39 | @setCold(true); | |
| 40 | for (entries) |entry| { | |
| 41 | if (mem.eql(u8, entry.path, path)) { | |
| 42 | return entry.executable; | |
| 43 | } | |
| 44 | } | |
| 45 | return false; | |
| 46 | } | |
| 47 | ||
| 48 | fn existsFake(entries: []const Filesystem.Entry, path: []const u8) bool { | |
| 49 | @setCold(true); | |
| 50 | var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 51 | var fib = std.heap.FixedBufferAllocator.init(&buf); | |
| 52 | const resolved = std.fs.path.resolvePosix(fib.allocator(), &.{path}) catch return false; | |
| 53 | for (entries) |entry| { | |
| 54 | if (mem.eql(u8, entry.path, resolved)) return true; | |
| 55 | } | |
| 56 | return false; | |
| 57 | } | |
| 58 | ||
| 59 | fn canExecutePosix(path: []const u8) bool { | |
| 60 | std.os.access(path, std.os.X_OK) catch return false; | |
| 61 | // Todo: ensure path is not a directory | |
| 62 | return true; | |
| 63 | } | |
| 64 | ||
| 65 | /// TODO | |
| 66 | fn canExecuteWindows(path: []const u8) bool { | |
| 67 | _ = path; | |
| 68 | return true; | |
| 69 | } | |
| 70 | ||
| 71 | /// TODO | |
| 72 | fn findProgramByNameWindows(allocator: std.mem.Allocator, name: []const u8, path: ?[]const u8, buf: []u8) ?[]const u8 { | |
| 73 | _ = path; | |
| 74 | _ = buf; | |
| 75 | _ = name; | |
| 76 | _ = allocator; | |
| 77 | return null; | |
| 78 | } | |
| 79 | ||
| 80 | /// TODO: does WASI need special handling? | |
| 81 | fn findProgramByNamePosix(name: []const u8, path: ?[]const u8, buf: []u8) ?[]const u8 { | |
| 82 | if (mem.indexOfScalar(u8, name, '/') != null) { | |
| 83 | @memcpy(buf[0..name.len], name); | |
| 84 | return buf[0..name.len]; | |
| 85 | } | |
| 86 | const path_env = path orelse return null; | |
| 87 | var fib = std.heap.FixedBufferAllocator.init(buf); | |
| 88 | ||
| 89 | var it = mem.tokenizeScalar(u8, path_env, system_defaults.path_sep); | |
| 90 | while (it.next()) |path_dir| { | |
| 91 | defer fib.reset(); | |
| 92 | const full_path = std.fs.path.join(fib.allocator(), &.{ path_dir, name }) catch continue; | |
| 93 | if (canExecutePosix(full_path)) return full_path; | |
| 94 | } | |
| 95 | ||
| 96 | return null; | |
| 97 | } | |
| 98 | ||
| 99 | pub const Filesystem = union(enum) { | |
| 100 | real: void, | |
| 101 | fake: []const Entry, | |
| 102 | ||
| 103 | const Entry = struct { | |
| 104 | path: []const u8, | |
| 105 | contents: []const u8 = "", | |
| 106 | executable: bool = false, | |
| 107 | }; | |
| 108 | ||
| 109 | const FakeDir = struct { | |
| 110 | entries: []const Entry, | |
| 111 | path: []const u8, | |
| 112 | ||
| 113 | fn iterate(self: FakeDir) FakeDir.Iterator { | |
| 114 | return .{ | |
| 115 | .entries = self.entries, | |
| 116 | .base = self.path, | |
| 117 | }; | |
| 118 | } | |
| 119 | ||
| 120 | const Iterator = struct { | |
| 121 | entries: []const Entry, | |
| 122 | base: []const u8, | |
| 123 | i: usize = 0, | |
| 124 | ||
| 125 | const Self = @This(); | |
| 126 | ||
| 127 | fn next(self: *@This()) !?std.fs.IterableDir.Entry { | |
| 128 | while (self.i < self.entries.len) { | |
| 129 | const entry = self.entries[self.i]; | |
| 130 | self.i += 1; | |
| 131 | if (entry.path.len == self.base.len) continue; | |
| 132 | if (std.mem.startsWith(u8, entry.path, self.base)) { | |
| 133 | const remaining = entry.path[self.base.len + 1 ..]; | |
| 134 | if (std.mem.indexOfScalar(u8, remaining, std.fs.path.sep) != null) continue; | |
| 135 | const extension = std.fs.path.extension(remaining); | |
| 136 | const kind: std.fs.IterableDir.Entry.Kind = if (extension.len == 0) .directory else .file; | |
| 137 | return .{ .name = remaining, .kind = kind }; | |
| 138 | } | |
| 139 | } | |
| 140 | return null; | |
| 141 | } | |
| 142 | }; | |
| 143 | }; | |
| 144 | ||
| 145 | const IterableDir = union(enum) { | |
| 146 | dir: std.fs.IterableDir, | |
| 147 | fake: FakeDir, | |
| 148 | ||
| 149 | pub fn iterate(self: IterableDir) Iterator { | |
| 150 | return switch (self) { | |
| 151 | .dir => |dir| .{ .iterator = dir.iterate() }, | |
| 152 | .fake => |fake| .{ .fake = fake.iterate() }, | |
| 153 | }; | |
| 154 | } | |
| 155 | ||
| 156 | pub fn close(self: *IterableDir) void { | |
| 157 | switch (self.*) { | |
| 158 | .dir => |*d| d.close(), | |
| 159 | .fake => {}, | |
| 160 | } | |
| 161 | } | |
| 162 | }; | |
| 163 | ||
| 164 | const Iterator = union(enum) { | |
| 165 | iterator: std.fs.IterableDir.Iterator, | |
| 166 | fake: FakeDir.Iterator, | |
| 167 | ||
| 168 | pub fn next(self: *Iterator) std.fs.IterableDir.Iterator.Error!?std.fs.IterableDir.Entry { | |
| 169 | return switch (self.*) { | |
| 170 | .iterator => |*it| it.next(), | |
| 171 | .fake => |*it| it.next(), | |
| 172 | }; | |
| 173 | } | |
| 174 | }; | |
| 175 | ||
| 176 | pub fn exists(fs: Filesystem, path: []const u8) bool { | |
| 177 | switch (fs) { | |
| 178 | .real => { | |
| 179 | std.os.access(path, std.os.F_OK) catch return false; | |
| 180 | return true; | |
| 181 | }, | |
| 182 | .fake => |paths| return existsFake(paths, path), | |
| 183 | } | |
| 184 | } | |
| 185 | ||
| 186 | pub fn joinedExists(fs: Filesystem, parts: []const []const u8) bool { | |
| 187 | var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 188 | var fib = std.heap.FixedBufferAllocator.init(&buf); | |
| 189 | const joined = std.fs.path.join(fib.allocator(), parts) catch return false; | |
| 190 | return fs.exists(joined); | |
| 191 | } | |
| 192 | ||
| 193 | pub fn canExecute(fs: Filesystem, path: []const u8) bool { | |
| 194 | return switch (fs) { | |
| 195 | .real => if (is_windows) canExecuteWindows(path) else canExecutePosix(path), | |
| 196 | .fake => |entries| canExecuteFake(entries, path), | |
| 197 | }; | |
| 198 | } | |
| 199 | ||
| 200 | /// Search for an executable named `name` using platform-specific logic | |
| 201 | /// If it's found, write the full path to `buf` and return a slice of it | |
| 202 | /// Otherwise retun null | |
| 203 | pub fn findProgramByName(fs: Filesystem, allocator: std.mem.Allocator, name: []const u8, path: ?[]const u8, buf: []u8) ?[]const u8 { | |
| 204 | std.debug.assert(name.len > 0); | |
| 205 | return switch (fs) { | |
| 206 | .real => if (is_windows) findProgramByNameWindows(allocator, name, path, buf) else findProgramByNamePosix(name, path, buf), | |
| 207 | .fake => |entries| findProgramByNameFake(entries, name, path, buf), | |
| 208 | }; | |
| 209 | } | |
| 210 | ||
| 211 | /// Read the file at `path` into `buf`. | |
| 212 | /// Returns null if any errors are encountered | |
| 213 | /// Otherwise returns a slice of `buf`. If the file is larger than `buf` partial contents are returned | |
| 214 | pub fn readFile(fs: Filesystem, path: []const u8, buf: []u8) ?[]const u8 { | |
| 215 | return switch (fs) { | |
| 216 | .real => { | |
| 217 | const file = std.fs.cwd().openFile(path, .{}) catch return null; | |
| 218 | defer file.close(); | |
| 219 | ||
| 220 | const bytes_read = file.readAll(buf) catch return null; | |
| 221 | return buf[0..bytes_read]; | |
| 222 | }, | |
| 223 | .fake => |entries| readFileFake(entries, path, buf), | |
| 224 | }; | |
| 225 | } | |
| 226 | ||
| 227 | pub fn openIterableDir(fs: Filesystem, dir_name: []const u8) std.fs.Dir.OpenError!IterableDir { | |
| 228 | return switch (fs) { | |
| 229 | .real => .{ .dir = try std.fs.cwd().openIterableDir(dir_name, .{ .access_sub_paths = false }) }, | |
| 230 | .fake => |entries| .{ .fake = .{ .entries = entries, .path = dir_name } }, | |
| 231 | }; | |
| 232 | } | |
| 233 | }; | |
| 234 | ||
| 235 | test "Fake filesystem" { | |
| 236 | const fs: Filesystem = .{ .fake = &.{ | |
| 237 | .{ .path = "/usr/bin" }, | |
| 238 | } }; | |
| 239 | try std.testing.expect(fs.exists("/usr/bin")); | |
| 240 | try std.testing.expect(fs.exists("/usr/bin/foo/..")); | |
| 241 | try std.testing.expect(!fs.exists("/usr/bin/bar")); | |
| 242 | } |
deps/aro/Driver/GCCDetector.zig created+610| ... | ... | @@ -0,0 +1,610 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Toolchain = @import("../Toolchain.zig"); | |
| 3 | const target_util = @import("../target.zig"); | |
| 4 | const system_defaults = @import("system_defaults"); | |
| 5 | const util = @import("../util.zig"); | |
| 6 | const GCCVersion = @import("GCCVersion.zig"); | |
| 7 | const Multilib = @import("Multilib.zig"); | |
| 8 | const GCCDetector = @This(); | |
| 9 | ||
| 10 | is_valid: bool = false, | |
| 11 | install_path: []const u8 = "", | |
| 12 | parent_lib_path: []const u8 = "", | |
| 13 | version: GCCVersion = .{}, | |
| 14 | gcc_triple: []const u8 = "", | |
| 15 | selected: Multilib = .{}, | |
| 16 | biarch_sibling: ?Multilib = null, | |
| 17 | ||
| 18 | pub fn deinit(self: *GCCDetector) void { | |
| 19 | if (!self.is_valid) return; | |
| 20 | } | |
| 21 | ||
| 22 | pub fn appendToolPath(self: *const GCCDetector, tc: *Toolchain) !void { | |
| 23 | if (!self.is_valid) return; | |
| 24 | return tc.addPathFromComponents(&.{ | |
| 25 | self.parent_lib_path, | |
| 26 | "..", | |
| 27 | self.gcc_triple, | |
| 28 | "bin", | |
| 29 | }, .program); | |
| 30 | } | |
| 31 | ||
| 32 | fn addDefaultGCCPrefixes(prefixes: *PathPrefixes, tc: *const Toolchain) !void { | |
| 33 | const sysroot = tc.getSysroot(); | |
| 34 | const target = tc.getTarget(); | |
| 35 | if (sysroot.len == 0 and target.os.tag == .linux and tc.filesystem.exists("/opt/rh")) { | |
| 36 | prefixes.appendAssumeCapacity("/opt/rh/gcc-toolset-12/root/usr"); | |
| 37 | prefixes.appendAssumeCapacity("/opt/rh/gcc-toolset-11/root/usr"); | |
| 38 | prefixes.appendAssumeCapacity("/opt/rh/gcc-toolset-10/root/usr"); | |
| 39 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-12/root/usr"); | |
| 40 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-11/root/usr"); | |
| 41 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-10/root/usr"); | |
| 42 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-9/root/usr"); | |
| 43 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-8/root/usr"); | |
| 44 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-7/root/usr"); | |
| 45 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-6/root/usr"); | |
| 46 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-4/root/usr"); | |
| 47 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-3/root/usr"); | |
| 48 | prefixes.appendAssumeCapacity("/opt/rh/devtoolset-2/root/usr"); | |
| 49 | } | |
| 50 | if (sysroot.len == 0) { | |
| 51 | prefixes.appendAssumeCapacity("/usr"); | |
| 52 | } else { | |
| 53 | var usr_path = try tc.arena.alloc(u8, 4 + sysroot.len); | |
| 54 | @memcpy(usr_path[0..4], "/usr"); | |
| 55 | @memcpy(usr_path[4..], sysroot); | |
| 56 | prefixes.appendAssumeCapacity(usr_path); | |
| 57 | } | |
| 58 | } | |
| 59 | ||
| 60 | const PathPrefixes = std.BoundedArray([]const u8, 16); | |
| 61 | ||
| 62 | fn collectLibDirsAndTriples( | |
| 63 | tc: *Toolchain, | |
| 64 | lib_dirs: *PathPrefixes, | |
| 65 | triple_aliases: *PathPrefixes, | |
| 66 | biarch_libdirs: *PathPrefixes, | |
| 67 | biarch_triple_aliases: *PathPrefixes, | |
| 68 | ) !void { | |
| 69 | const AArch64LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 70 | const AArch64Triples: [4][]const u8 = .{ "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", "aarch64-suse-linux" }; | |
| 71 | const AArch64beLibDirs: [1][]const u8 = .{"/lib"}; | |
| 72 | const AArch64beTriples: [2][]const u8 = .{ "aarch64_be-none-linux-gnu", "aarch64_be-linux-gnu" }; | |
| 73 | ||
| 74 | const ARMLibDirs: [1][]const u8 = .{"/lib"}; | |
| 75 | const ARMTriples: [1][]const u8 = .{"arm-linux-gnueabi"}; | |
| 76 | const ARMHFTriples: [4][]const u8 = .{ "arm-linux-gnueabihf", "armv7hl-redhat-linux-gnueabi", "armv6hl-suse-linux-gnueabi", "armv7hl-suse-linux-gnueabi" }; | |
| 77 | ||
| 78 | const ARMebLibDirs: [1][]const u8 = .{"/lib"}; | |
| 79 | const ARMebTriples: [1][]const u8 = .{"armeb-linux-gnueabi"}; | |
| 80 | const ARMebHFTriples: [2][]const u8 = .{ "armeb-linux-gnueabihf", "armebv7hl-redhat-linux-gnueabi" }; | |
| 81 | ||
| 82 | const AVRLibDirs: [1][]const u8 = .{"/lib"}; | |
| 83 | const AVRTriples: [1][]const u8 = .{"avr"}; | |
| 84 | ||
| 85 | const CSKYLibDirs: [1][]const u8 = .{"/lib"}; | |
| 86 | const CSKYTriples: [3][]const u8 = .{ "csky-linux-gnuabiv2", "csky-linux-uclibcabiv2", "csky-elf-noneabiv2" }; | |
| 87 | ||
| 88 | const X86_64LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 89 | const X86_64Triples: [11][]const u8 = .{ | |
| 90 | "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", | |
| 91 | "x86_64-pc-linux-gnu", "x86_64-redhat-linux6E", | |
| 92 | "x86_64-redhat-linux", "x86_64-suse-linux", | |
| 93 | "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", | |
| 94 | "x86_64-slackware-linux", "x86_64-unknown-linux", | |
| 95 | "x86_64-amazon-linux", | |
| 96 | }; | |
| 97 | const X32Triples: [2][]const u8 = .{ "x86_64-linux-gnux32", "x86_64-pc-linux-gnux32" }; | |
| 98 | const X32LibDirs: [2][]const u8 = .{ "/libx32", "/lib" }; | |
| 99 | const X86LibDirs: [2][]const u8 = .{ "/lib32", "/lib" }; | |
| 100 | const X86Triples: [9][]const u8 = .{ | |
| 101 | "i586-linux-gnu", "i686-linux-gnu", "i686-pc-linux-gnu", | |
| 102 | "i386-redhat-linux6E", "i686-redhat-linux", "i386-redhat-linux", | |
| 103 | "i586-suse-linux", "i686-montavista-linux", "i686-gnu", | |
| 104 | }; | |
| 105 | ||
| 106 | const LoongArch64LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 107 | const LoongArch64Triples: [2][]const u8 = .{ "loongarch64-linux-gnu", "loongarch64-unknown-linux-gnu" }; | |
| 108 | ||
| 109 | const M68kLibDirs: [1][]const u8 = .{"/lib"}; | |
| 110 | const M68kTriples: [3][]const u8 = .{ "m68k-linux-gnu", "m68k-unknown-linux-gnu", "m68k-suse-linux" }; | |
| 111 | ||
| 112 | const MIPSLibDirs: [2][]const u8 = .{ "/libo32", "/lib" }; | |
| 113 | const MIPSTriples: [5][]const u8 = .{ | |
| 114 | "mips-linux-gnu", "mips-mti-linux", | |
| 115 | "mips-mti-linux-gnu", "mips-img-linux-gnu", | |
| 116 | "mipsisa32r6-linux-gnu", | |
| 117 | }; | |
| 118 | const MIPSELLibDirs: [2][]const u8 = .{ "/libo32", "/lib" }; | |
| 119 | const MIPSELTriples: [3][]const u8 = .{ "mipsel-linux-gnu", "mips-img-linux-gnu", "mipsisa32r6el-linux-gnu" }; | |
| 120 | ||
| 121 | const MIPS64LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 122 | const MIPS64Triples: [6][]const u8 = .{ | |
| 123 | "mips64-linux-gnu", "mips-mti-linux-gnu", | |
| 124 | "mips-img-linux-gnu", "mips64-linux-gnuabi64", | |
| 125 | "mipsisa64r6-linux-gnu", "mipsisa64r6-linux-gnuabi64", | |
| 126 | }; | |
| 127 | const MIPS64ELLibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 128 | const MIPS64ELTriples: [6][]const u8 = .{ | |
| 129 | "mips64el-linux-gnu", "mips-mti-linux-gnu", | |
| 130 | "mips-img-linux-gnu", "mips64el-linux-gnuabi64", | |
| 131 | "mipsisa64r6el-linux-gnu", "mipsisa64r6el-linux-gnuabi64", | |
| 132 | }; | |
| 133 | ||
| 134 | const MIPSN32LibDirs: [1][]const u8 = .{"/lib32"}; | |
| 135 | const MIPSN32Triples: [2][]const u8 = .{ "mips64-linux-gnuabin32", "mipsisa64r6-linux-gnuabin32" }; | |
| 136 | const MIPSN32ELLibDirs: [1][]const u8 = .{"/lib32"}; | |
| 137 | const MIPSN32ELTriples: [2][]const u8 = .{ "mips64el-linux-gnuabin32", "mipsisa64r6el-linux-gnuabin32" }; | |
| 138 | ||
| 139 | const MSP430LibDirs: [1][]const u8 = .{"/lib"}; | |
| 140 | const MSP430Triples: [1][]const u8 = .{"msp430-elf"}; | |
| 141 | ||
| 142 | const PPCLibDirs: [2][]const u8 = .{ "/lib32", "/lib" }; | |
| 143 | const PPCTriples: [5][]const u8 = .{ | |
| 144 | "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe", | |
| 145 | // On 32-bit PowerPC systems running SUSE Linux, gcc is configured as a | |
| 146 | // 64-bit compiler which defaults to "-m32", hence "powerpc64-suse-linux". | |
| 147 | "powerpc64-suse-linux", "powerpc-montavista-linuxspe", | |
| 148 | }; | |
| 149 | const PPCLELibDirs: [2][]const u8 = .{ "/lib32", "/lib" }; | |
| 150 | const PPCLETriples: [3][]const u8 = .{ "powerpcle-linux-gnu", "powerpcle-unknown-linux-gnu", "powerpcle-linux-musl" }; | |
| 151 | ||
| 152 | const PPC64LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 153 | const PPC64Triples: [4][]const u8 = .{ | |
| 154 | "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu", | |
| 155 | "powerpc64-suse-linux", "ppc64-redhat-linux", | |
| 156 | }; | |
| 157 | const PPC64LELibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 158 | const PPC64LETriples: [5][]const u8 = .{ | |
| 159 | "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu", | |
| 160 | "powerpc64le-none-linux-gnu", "powerpc64le-suse-linux", | |
| 161 | "ppc64le-redhat-linux", | |
| 162 | }; | |
| 163 | ||
| 164 | const RISCV32LibDirs: [2][]const u8 = .{ "/lib32", "/lib" }; | |
| 165 | const RISCV32Triples: [3][]const u8 = .{ "riscv32-unknown-linux-gnu", "riscv32-linux-gnu", "riscv32-unknown-elf" }; | |
| 166 | const RISCV64LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 167 | const RISCV64Triples: [3][]const u8 = .{ | |
| 168 | "riscv64-unknown-linux-gnu", | |
| 169 | "riscv64-linux-gnu", | |
| 170 | "riscv64-unknown-elf", | |
| 171 | }; | |
| 172 | ||
| 173 | const SPARCv8LibDirs: [2][]const u8 = .{ "/lib32", "/lib" }; | |
| 174 | const SPARCv8Triples: [2][]const u8 = .{ "sparc-linux-gnu", "sparcv8-linux-gnu" }; | |
| 175 | const SPARCv9LibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 176 | const SPARCv9Triples: [2][]const u8 = .{ "sparc64-linux-gnu", "sparcv9-linux-gnu" }; | |
| 177 | ||
| 178 | const SystemZLibDirs: [2][]const u8 = .{ "/lib64", "/lib" }; | |
| 179 | const SystemZTriples: [5][]const u8 = .{ | |
| 180 | "s390x-linux-gnu", "s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu", | |
| 181 | "s390x-suse-linux", "s390x-redhat-linux", | |
| 182 | }; | |
| 183 | const target = tc.getTarget(); | |
| 184 | if (target.os.tag == .solaris) { | |
| 185 | // TODO | |
| 186 | return; | |
| 187 | } | |
| 188 | if (target.isAndroid()) { | |
| 189 | const AArch64AndroidTriples: [1][]const u8 = .{"aarch64-linux-android"}; | |
| 190 | const ARMAndroidTriples: [1][]const u8 = .{"arm-linux-androideabi"}; | |
| 191 | const MIPSELAndroidTriples: [1][]const u8 = .{"mipsel-linux-android"}; | |
| 192 | const MIPS64ELAndroidTriples: [1][]const u8 = .{"mips64el-linux-android"}; | |
| 193 | const X86AndroidTriples: [1][]const u8 = .{"i686-linux-android"}; | |
| 194 | const X86_64AndroidTriples: [1][]const u8 = .{"x86_64-linux-android"}; | |
| 195 | ||
| 196 | switch (target.cpu.arch) { | |
| 197 | .aarch64 => { | |
| 198 | lib_dirs.appendSliceAssumeCapacity(&AArch64LibDirs); | |
| 199 | triple_aliases.appendSliceAssumeCapacity(&AArch64AndroidTriples); | |
| 200 | }, | |
| 201 | .arm, | |
| 202 | .thumb, | |
| 203 | => { | |
| 204 | lib_dirs.appendSliceAssumeCapacity(&ARMLibDirs); | |
| 205 | triple_aliases.appendSliceAssumeCapacity(&ARMAndroidTriples); | |
| 206 | }, | |
| 207 | .mipsel => { | |
| 208 | lib_dirs.appendSliceAssumeCapacity(&MIPSELLibDirs); | |
| 209 | triple_aliases.appendSliceAssumeCapacity(&MIPSELAndroidTriples); | |
| 210 | biarch_libdirs.appendSliceAssumeCapacity(&MIPS64ELLibDirs); | |
| 211 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPS64ELAndroidTriples); | |
| 212 | }, | |
| 213 | .mips64el => { | |
| 214 | lib_dirs.appendSliceAssumeCapacity(&MIPS64ELLibDirs); | |
| 215 | triple_aliases.appendSliceAssumeCapacity(&MIPS64ELAndroidTriples); | |
| 216 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSELLibDirs); | |
| 217 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSELAndroidTriples); | |
| 218 | }, | |
| 219 | .x86_64 => { | |
| 220 | lib_dirs.appendSliceAssumeCapacity(&X86_64LibDirs); | |
| 221 | triple_aliases.appendSliceAssumeCapacity(&X86_64AndroidTriples); | |
| 222 | biarch_libdirs.appendSliceAssumeCapacity(&X86LibDirs); | |
| 223 | biarch_triple_aliases.appendSliceAssumeCapacity(&X86AndroidTriples); | |
| 224 | }, | |
| 225 | .x86 => { | |
| 226 | lib_dirs.appendSliceAssumeCapacity(&X86LibDirs); | |
| 227 | triple_aliases.appendSliceAssumeCapacity(&X86AndroidTriples); | |
| 228 | biarch_libdirs.appendSliceAssumeCapacity(&X86_64LibDirs); | |
| 229 | biarch_triple_aliases.appendSliceAssumeCapacity(&X86_64AndroidTriples); | |
| 230 | }, | |
| 231 | else => {}, | |
| 232 | } | |
| 233 | return; | |
| 234 | } | |
| 235 | switch (target.cpu.arch) { | |
| 236 | .aarch64 => { | |
| 237 | lib_dirs.appendSliceAssumeCapacity(&AArch64LibDirs); | |
| 238 | triple_aliases.appendSliceAssumeCapacity(&AArch64Triples); | |
| 239 | biarch_libdirs.appendSliceAssumeCapacity(&AArch64LibDirs); | |
| 240 | biarch_triple_aliases.appendSliceAssumeCapacity(&AArch64Triples); | |
| 241 | }, | |
| 242 | .aarch64_be => { | |
| 243 | lib_dirs.appendSliceAssumeCapacity(&AArch64beLibDirs); | |
| 244 | triple_aliases.appendSliceAssumeCapacity(&AArch64beTriples); | |
| 245 | biarch_libdirs.appendSliceAssumeCapacity(&AArch64beLibDirs); | |
| 246 | biarch_triple_aliases.appendSliceAssumeCapacity(&AArch64beTriples); | |
| 247 | }, | |
| 248 | .arm, .thumb => { | |
| 249 | lib_dirs.appendSliceAssumeCapacity(&ARMLibDirs); | |
| 250 | if (target.abi == .gnueabihf) { | |
| 251 | triple_aliases.appendSliceAssumeCapacity(&ARMHFTriples); | |
| 252 | } else { | |
| 253 | triple_aliases.appendSliceAssumeCapacity(&ARMTriples); | |
| 254 | } | |
| 255 | }, | |
| 256 | .armeb, .thumbeb => { | |
| 257 | lib_dirs.appendSliceAssumeCapacity(&ARMebLibDirs); | |
| 258 | if (target.abi == .gnueabihf) { | |
| 259 | triple_aliases.appendSliceAssumeCapacity(&ARMebHFTriples); | |
| 260 | } else { | |
| 261 | triple_aliases.appendSliceAssumeCapacity(&ARMebTriples); | |
| 262 | } | |
| 263 | }, | |
| 264 | .avr => { | |
| 265 | lib_dirs.appendSliceAssumeCapacity(&AVRLibDirs); | |
| 266 | triple_aliases.appendSliceAssumeCapacity(&AVRTriples); | |
| 267 | }, | |
| 268 | .csky => { | |
| 269 | lib_dirs.appendSliceAssumeCapacity(&CSKYLibDirs); | |
| 270 | triple_aliases.appendSliceAssumeCapacity(&CSKYTriples); | |
| 271 | }, | |
| 272 | .x86_64 => { | |
| 273 | if (target.abi == .gnux32 or target.abi == .muslx32) { | |
| 274 | lib_dirs.appendSliceAssumeCapacity(&X32LibDirs); | |
| 275 | triple_aliases.appendSliceAssumeCapacity(&X32Triples); | |
| 276 | biarch_libdirs.appendSliceAssumeCapacity(&X86_64LibDirs); | |
| 277 | biarch_triple_aliases.appendSliceAssumeCapacity(&X86_64Triples); | |
| 278 | } else { | |
| 279 | lib_dirs.appendSliceAssumeCapacity(&X86_64LibDirs); | |
| 280 | triple_aliases.appendSliceAssumeCapacity(&X86_64Triples); | |
| 281 | biarch_libdirs.appendSliceAssumeCapacity(&X32LibDirs); | |
| 282 | biarch_triple_aliases.appendSliceAssumeCapacity(&X32Triples); | |
| 283 | } | |
| 284 | biarch_libdirs.appendSliceAssumeCapacity(&X86LibDirs); | |
| 285 | biarch_triple_aliases.appendSliceAssumeCapacity(&X86Triples); | |
| 286 | }, | |
| 287 | .x86 => { | |
| 288 | lib_dirs.appendSliceAssumeCapacity(&X86LibDirs); | |
| 289 | // MCU toolchain is 32 bit only and its triple alias is TargetTriple | |
| 290 | // itself, which will be appended below. | |
| 291 | if (target.os.tag != .elfiamcu) { | |
| 292 | triple_aliases.appendSliceAssumeCapacity(&X86Triples); | |
| 293 | biarch_libdirs.appendSliceAssumeCapacity(&X86_64LibDirs); | |
| 294 | biarch_triple_aliases.appendSliceAssumeCapacity(&X86_64Triples); | |
| 295 | biarch_libdirs.appendSliceAssumeCapacity(&X32LibDirs); | |
| 296 | biarch_triple_aliases.appendSliceAssumeCapacity(&X32Triples); | |
| 297 | } | |
| 298 | }, | |
| 299 | .loongarch64 => { | |
| 300 | lib_dirs.appendSliceAssumeCapacity(&LoongArch64LibDirs); | |
| 301 | triple_aliases.appendSliceAssumeCapacity(&LoongArch64Triples); | |
| 302 | }, | |
| 303 | .m68k => { | |
| 304 | lib_dirs.appendSliceAssumeCapacity(&M68kLibDirs); | |
| 305 | triple_aliases.appendSliceAssumeCapacity(&M68kTriples); | |
| 306 | }, | |
| 307 | .mips => { | |
| 308 | lib_dirs.appendSliceAssumeCapacity(&MIPSLibDirs); | |
| 309 | triple_aliases.appendSliceAssumeCapacity(&MIPSTriples); | |
| 310 | biarch_libdirs.appendSliceAssumeCapacity(&MIPS64LibDirs); | |
| 311 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPS64Triples); | |
| 312 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSN32LibDirs); | |
| 313 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSN32Triples); | |
| 314 | }, | |
| 315 | .mipsel => { | |
| 316 | lib_dirs.appendSliceAssumeCapacity(&MIPSELLibDirs); | |
| 317 | triple_aliases.appendSliceAssumeCapacity(&MIPSELTriples); | |
| 318 | triple_aliases.appendSliceAssumeCapacity(&MIPSTriples); | |
| 319 | biarch_libdirs.appendSliceAssumeCapacity(&MIPS64ELLibDirs); | |
| 320 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPS64ELTriples); | |
| 321 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSN32ELLibDirs); | |
| 322 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSN32ELTriples); | |
| 323 | }, | |
| 324 | .mips64 => { | |
| 325 | lib_dirs.appendSliceAssumeCapacity(&MIPS64LibDirs); | |
| 326 | triple_aliases.appendSliceAssumeCapacity(&MIPS64Triples); | |
| 327 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSLibDirs); | |
| 328 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSTriples); | |
| 329 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSN32LibDirs); | |
| 330 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSN32Triples); | |
| 331 | }, | |
| 332 | .mips64el => { | |
| 333 | lib_dirs.appendSliceAssumeCapacity(&MIPS64ELLibDirs); | |
| 334 | triple_aliases.appendSliceAssumeCapacity(&MIPS64ELTriples); | |
| 335 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSELLibDirs); | |
| 336 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSELTriples); | |
| 337 | biarch_libdirs.appendSliceAssumeCapacity(&MIPSN32ELLibDirs); | |
| 338 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSN32ELTriples); | |
| 339 | biarch_triple_aliases.appendSliceAssumeCapacity(&MIPSTriples); | |
| 340 | }, | |
| 341 | .msp430 => { | |
| 342 | lib_dirs.appendSliceAssumeCapacity(&MSP430LibDirs); | |
| 343 | triple_aliases.appendSliceAssumeCapacity(&MSP430Triples); | |
| 344 | }, | |
| 345 | .powerpc => { | |
| 346 | lib_dirs.appendSliceAssumeCapacity(&PPCLibDirs); | |
| 347 | triple_aliases.appendSliceAssumeCapacity(&PPCTriples); | |
| 348 | biarch_libdirs.appendSliceAssumeCapacity(&PPC64LibDirs); | |
| 349 | biarch_triple_aliases.appendSliceAssumeCapacity(&PPC64Triples); | |
| 350 | }, | |
| 351 | .powerpcle => { | |
| 352 | lib_dirs.appendSliceAssumeCapacity(&PPCLELibDirs); | |
| 353 | triple_aliases.appendSliceAssumeCapacity(&PPCLETriples); | |
| 354 | biarch_libdirs.appendSliceAssumeCapacity(&PPC64LELibDirs); | |
| 355 | biarch_triple_aliases.appendSliceAssumeCapacity(&PPC64LETriples); | |
| 356 | }, | |
| 357 | .powerpc64 => { | |
| 358 | lib_dirs.appendSliceAssumeCapacity(&PPC64LibDirs); | |
| 359 | triple_aliases.appendSliceAssumeCapacity(&PPC64Triples); | |
| 360 | biarch_libdirs.appendSliceAssumeCapacity(&PPCLibDirs); | |
| 361 | biarch_triple_aliases.appendSliceAssumeCapacity(&PPCTriples); | |
| 362 | }, | |
| 363 | .powerpc64le => { | |
| 364 | lib_dirs.appendSliceAssumeCapacity(&PPC64LELibDirs); | |
| 365 | triple_aliases.appendSliceAssumeCapacity(&PPC64LETriples); | |
| 366 | biarch_libdirs.appendSliceAssumeCapacity(&PPCLELibDirs); | |
| 367 | biarch_triple_aliases.appendSliceAssumeCapacity(&PPCLETriples); | |
| 368 | }, | |
| 369 | .riscv32 => { | |
| 370 | lib_dirs.appendSliceAssumeCapacity(&RISCV32LibDirs); | |
| 371 | triple_aliases.appendSliceAssumeCapacity(&RISCV32Triples); | |
| 372 | biarch_libdirs.appendSliceAssumeCapacity(&RISCV64LibDirs); | |
| 373 | biarch_triple_aliases.appendSliceAssumeCapacity(&RISCV64Triples); | |
| 374 | }, | |
| 375 | .riscv64 => { | |
| 376 | lib_dirs.appendSliceAssumeCapacity(&RISCV64LibDirs); | |
| 377 | triple_aliases.appendSliceAssumeCapacity(&RISCV64Triples); | |
| 378 | biarch_libdirs.appendSliceAssumeCapacity(&RISCV32LibDirs); | |
| 379 | biarch_triple_aliases.appendSliceAssumeCapacity(&RISCV32Triples); | |
| 380 | }, | |
| 381 | .sparc, .sparcel => { | |
| 382 | lib_dirs.appendSliceAssumeCapacity(&SPARCv8LibDirs); | |
| 383 | triple_aliases.appendSliceAssumeCapacity(&SPARCv8Triples); | |
| 384 | biarch_libdirs.appendSliceAssumeCapacity(&SPARCv9LibDirs); | |
| 385 | biarch_triple_aliases.appendSliceAssumeCapacity(&SPARCv9Triples); | |
| 386 | }, | |
| 387 | .sparc64 => { | |
| 388 | lib_dirs.appendSliceAssumeCapacity(&SPARCv9LibDirs); | |
| 389 | triple_aliases.appendSliceAssumeCapacity(&SPARCv9Triples); | |
| 390 | biarch_libdirs.appendSliceAssumeCapacity(&SPARCv8LibDirs); | |
| 391 | biarch_triple_aliases.appendSliceAssumeCapacity(&SPARCv8Triples); | |
| 392 | }, | |
| 393 | .s390x => { | |
| 394 | lib_dirs.appendSliceAssumeCapacity(&SystemZLibDirs); | |
| 395 | triple_aliases.appendSliceAssumeCapacity(&SystemZTriples); | |
| 396 | }, | |
| 397 | else => {}, | |
| 398 | } | |
| 399 | } | |
| 400 | ||
| 401 | pub fn discover(self: *GCCDetector, tc: *Toolchain) !void { | |
| 402 | var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 403 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); | |
| 404 | ||
| 405 | const target = tc.getTarget(); | |
| 406 | const biarch_variant_target = if (target.ptrBitWidth() == 32) target_util.get64BitArchVariant(target) else target_util.get32BitArchVariant(target); | |
| 407 | ||
| 408 | var candidate_lib_dirs: PathPrefixes = .{}; | |
| 409 | var candidate_biarch_lib_dirs: PathPrefixes = .{}; | |
| 410 | var candidate_triple_aliases: PathPrefixes = .{}; | |
| 411 | var candidate_biarch_triple_aliases: PathPrefixes = .{}; | |
| 412 | try collectLibDirsAndTriples(tc, &candidate_lib_dirs, &candidate_biarch_lib_dirs, &candidate_triple_aliases, &candidate_biarch_triple_aliases); | |
| 413 | ||
| 414 | var target_buf: [64]u8 = undefined; | |
| 415 | const triple_str = target_util.toLLVMTriple(target, &target_buf); | |
| 416 | candidate_triple_aliases.appendAssumeCapacity(triple_str); | |
| 417 | ||
| 418 | // Also include the multiarch variant if it's different. | |
| 419 | var biarch_buf: [64]u8 = undefined; | |
| 420 | if (biarch_variant_target) |biarch_target| { | |
| 421 | const biarch_triple_str = target_util.toLLVMTriple(biarch_target, &biarch_buf); | |
| 422 | if (!std.mem.eql(u8, biarch_triple_str, triple_str)) { | |
| 423 | candidate_triple_aliases.appendAssumeCapacity(biarch_triple_str); | |
| 424 | } | |
| 425 | } | |
| 426 | ||
| 427 | var prefixes: PathPrefixes = .{}; | |
| 428 | const gcc_toolchain_dir = gccToolchainDir(tc); | |
| 429 | if (gcc_toolchain_dir.len != 0) { | |
| 430 | const adjusted = if (gcc_toolchain_dir[gcc_toolchain_dir.len - 1] == '/') | |
| 431 | gcc_toolchain_dir[0 .. gcc_toolchain_dir.len - 1] | |
| 432 | else | |
| 433 | gcc_toolchain_dir; | |
| 434 | prefixes.appendAssumeCapacity(adjusted); | |
| 435 | } else { | |
| 436 | const sysroot = tc.getSysroot(); | |
| 437 | if (sysroot.len > 0) { | |
| 438 | prefixes.appendAssumeCapacity(sysroot); | |
| 439 | try addDefaultGCCPrefixes(&prefixes, tc); | |
| 440 | } | |
| 441 | ||
| 442 | if (sysroot.len == 0) { | |
| 443 | try addDefaultGCCPrefixes(&prefixes, tc); | |
| 444 | } | |
| 445 | // TODO: Special-case handling for Gentoo | |
| 446 | } | |
| 447 | ||
| 448 | const v0 = GCCVersion.parse("0.0.0"); | |
| 449 | for (prefixes.constSlice()) |prefix| { | |
| 450 | if (!tc.filesystem.exists(prefix)) continue; | |
| 451 | ||
| 452 | for (candidate_lib_dirs.constSlice()) |suffix| { | |
| 453 | defer fib.reset(); | |
| 454 | const lib_dir = std.fs.path.join(fib.allocator(), &.{ prefix, suffix }) catch continue; | |
| 455 | if (!tc.filesystem.exists(lib_dir)) continue; | |
| 456 | ||
| 457 | const gcc_dir_exists = tc.filesystem.joinedExists(&.{ lib_dir, "/gcc" }); | |
| 458 | const gcc_cross_dir_exists = tc.filesystem.joinedExists(&.{ lib_dir, "/gcc-cross" }); | |
| 459 | ||
| 460 | try self.scanLibDirForGCCTriple(tc, target, lib_dir, triple_str, false, gcc_dir_exists, gcc_cross_dir_exists); | |
| 461 | for (candidate_triple_aliases.constSlice()) |candidate| { | |
| 462 | try self.scanLibDirForGCCTriple(tc, target, lib_dir, candidate, false, gcc_dir_exists, gcc_cross_dir_exists); | |
| 463 | } | |
| 464 | } | |
| 465 | for (candidate_biarch_lib_dirs.constSlice()) |suffix| { | |
| 466 | const lib_dir = std.fs.path.join(fib.allocator(), &.{ prefix, suffix }) catch continue; | |
| 467 | if (!tc.filesystem.exists(lib_dir)) continue; | |
| 468 | ||
| 469 | const gcc_dir_exists = tc.filesystem.joinedExists(&.{ lib_dir, "/gcc" }); | |
| 470 | const gcc_cross_dir_exists = tc.filesystem.joinedExists(&.{ lib_dir, "/gcc-cross" }); | |
| 471 | for (candidate_biarch_triple_aliases.constSlice()) |candidate| { | |
| 472 | try self.scanLibDirForGCCTriple(tc, target, lib_dir, candidate, true, gcc_dir_exists, gcc_cross_dir_exists); | |
| 473 | } | |
| 474 | } | |
| 475 | if (self.version.order(v0) == .gt) break; | |
| 476 | } | |
| 477 | } | |
| 478 | ||
| 479 | fn findBiarchMultilibs(tc: *const Toolchain, result: *Multilib.Detected, target: std.Target, path: [2][]const u8, needs_biarch_suffix: bool) !bool { | |
| 480 | const suff64 = if (target.os.tag == .solaris) switch (target.cpu.arch) { | |
| 481 | .x86, .x86_64 => "/amd64", | |
| 482 | .sparc => "/sparcv9", | |
| 483 | else => "/64", | |
| 484 | } else "/64"; | |
| 485 | ||
| 486 | const alt_64 = Multilib.init(suff64, suff64, &.{ "-m32", "+m64", "-mx32" }); | |
| 487 | const alt_32 = Multilib.init("/32", "/32", &.{ "+m32", "-m64", "-mx32" }); | |
| 488 | const alt_x32 = Multilib.init("/x32", "/x32", &.{ "-m32", "-m64", "+mx32" }); | |
| 489 | ||
| 490 | const multilib_filter = Multilib.Filter{ | |
| 491 | .base = path, | |
| 492 | .file = if (target.os.tag == .elfiamcu) "libgcc.a" else "crtbegin.o", | |
| 493 | }; | |
| 494 | ||
| 495 | const Want = enum { | |
| 496 | want32, | |
| 497 | want64, | |
| 498 | wantx32, | |
| 499 | }; | |
| 500 | const is_x32 = target.abi == .gnux32 or target.abi == .muslx32; | |
| 501 | const target_ptr_width = target.ptrBitWidth(); | |
| 502 | const want: Want = if (target_ptr_width == 32 and multilib_filter.exists(alt_32, tc.filesystem)) | |
| 503 | .want64 | |
| 504 | else if (target_ptr_width == 64 and is_x32 and multilib_filter.exists(alt_x32, tc.filesystem)) | |
| 505 | .want64 | |
| 506 | else if (target_ptr_width == 64 and !is_x32 and multilib_filter.exists(alt_64, tc.filesystem)) | |
| 507 | .want32 | |
| 508 | else if (target_ptr_width == 32) | |
| 509 | if (needs_biarch_suffix) .want64 else .want32 | |
| 510 | else if (is_x32) | |
| 511 | if (needs_biarch_suffix) .want64 else .wantx32 | |
| 512 | else if (needs_biarch_suffix) .want32 else .want64; | |
| 513 | ||
| 514 | const default = switch (want) { | |
| 515 | .want32 => Multilib.init("", "", &.{ "+m32", "-m64", "-mx32" }), | |
| 516 | .want64 => Multilib.init("", "", &.{ "-m32", "+m64", "-mx32" }), | |
| 517 | .wantx32 => Multilib.init("", "", &.{ "-m32", "-m64", "+mx32" }), | |
| 518 | }; | |
| 519 | result.multilibs.appendSliceAssumeCapacity(&.{ | |
| 520 | default, | |
| 521 | alt_64, | |
| 522 | alt_32, | |
| 523 | alt_x32, | |
| 524 | }); | |
| 525 | result.filter(multilib_filter, tc.filesystem); | |
| 526 | var flags: Multilib.Flags = .{}; | |
| 527 | flags.appendAssumeCapacity(if (target_ptr_width == 64 and !is_x32) "+m64" else "-m64"); | |
| 528 | flags.appendAssumeCapacity(if (target_ptr_width == 32) "+m32" else "-m32"); | |
| 529 | flags.appendAssumeCapacity(if (target_ptr_width == 64 and is_x32) "+mx32" else "-mx32"); | |
| 530 | ||
| 531 | return result.select(flags); | |
| 532 | } | |
| 533 | ||
| 534 | fn scanGCCForMultilibs(self: *GCCDetector, tc: *const Toolchain, target: std.Target, path: [2][]const u8, needs_biarch_suffix: bool) !bool { | |
| 535 | var detected: Multilib.Detected = .{}; | |
| 536 | if (target.cpu.arch == .csky) { | |
| 537 | // TODO | |
| 538 | } else if (target.cpu.arch.isMIPS()) { | |
| 539 | // TODO | |
| 540 | } else if (target.cpu.arch.isRISCV()) { | |
| 541 | // TODO | |
| 542 | } else if (target.cpu.arch == .msp430) { | |
| 543 | // TODO | |
| 544 | } else if (target.cpu.arch == .avr) { | |
| 545 | // No multilibs | |
| 546 | } else if (!try findBiarchMultilibs(tc, &detected, target, path, needs_biarch_suffix)) { | |
| 547 | return false; | |
| 548 | } | |
| 549 | self.selected = detected.selected; | |
| 550 | self.biarch_sibling = detected.biarch_sibling; | |
| 551 | return true; | |
| 552 | } | |
| 553 | ||
| 554 | fn scanLibDirForGCCTriple( | |
| 555 | self: *GCCDetector, | |
| 556 | tc: *const Toolchain, | |
| 557 | target: std.Target, | |
| 558 | lib_dir: []const u8, | |
| 559 | candidate_triple: []const u8, | |
| 560 | needs_biarch_suffix: bool, | |
| 561 | gcc_dir_exists: bool, | |
| 562 | gcc_cross_dir_exists: bool, | |
| 563 | ) !void { | |
| 564 | var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 565 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); | |
| 566 | for (0..2) |i| { | |
| 567 | if (i == 0 and !gcc_dir_exists) continue; | |
| 568 | if (i == 1 and !gcc_cross_dir_exists) continue; | |
| 569 | defer fib.reset(); | |
| 570 | ||
| 571 | const base: []const u8 = if (i == 0) "gcc" else "gcc-cross"; | |
| 572 | var lib_suffix_buf: [64]u8 = undefined; | |
| 573 | var suffix_buf_fib = std.heap.FixedBufferAllocator.init(&lib_suffix_buf); | |
| 574 | const lib_suffix = std.fs.path.join(suffix_buf_fib.allocator(), &.{ base, candidate_triple }) catch continue; | |
| 575 | ||
| 576 | const dir_name = std.fs.path.join(fib.allocator(), &.{ lib_dir, lib_suffix }) catch continue; | |
| 577 | var parent_dir = tc.filesystem.openIterableDir(dir_name) catch continue; | |
| 578 | defer parent_dir.close(); | |
| 579 | ||
| 580 | var it = parent_dir.iterate(); | |
| 581 | while (it.next() catch continue) |entry| { | |
| 582 | if (entry.kind != .directory) continue; | |
| 583 | ||
| 584 | const version_text = entry.name; | |
| 585 | const candidate_version = GCCVersion.parse(version_text); | |
| 586 | if (candidate_version.major != -1) { | |
| 587 | // TODO: cache path so we're not repeatedly scanning | |
| 588 | } | |
| 589 | if (candidate_version.isLessThan(4, 1, 1, "")) continue; | |
| 590 | switch (candidate_version.order(self.version)) { | |
| 591 | .lt, .eq => continue, | |
| 592 | .gt => {}, | |
| 593 | } | |
| 594 | ||
| 595 | if (!try self.scanGCCForMultilibs(tc, target, .{ dir_name, version_text }, needs_biarch_suffix)) continue; | |
| 596 | ||
| 597 | self.version = candidate_version; | |
| 598 | self.gcc_triple = try tc.arena.dupe(u8, candidate_triple); | |
| 599 | self.install_path = try std.fs.path.join(tc.arena, &.{ lib_dir, lib_suffix, version_text }); | |
| 600 | self.parent_lib_path = try std.fs.path.join(tc.arena, &.{ self.install_path, "..", "..", ".." }); | |
| 601 | self.is_valid = true; | |
| 602 | } | |
| 603 | } | |
| 604 | } | |
| 605 | ||
| 606 | fn gccToolchainDir(tc: *const Toolchain) []const u8 { | |
| 607 | const sysroot = tc.getSysroot(); | |
| 608 | if (sysroot.len != 0) return ""; | |
| 609 | return system_defaults.gcc_install_prefix; | |
| 610 | } |
deps/aro/Driver/GCCVersion.zig created+122| ... | ... | @@ -0,0 +1,122 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Order = std.math.Order; | |
| 4 | ||
| 5 | const GCCVersion = @This(); | |
| 6 | ||
| 7 | /// Raw version number text | |
| 8 | raw: []const u8 = "", | |
| 9 | ||
| 10 | /// -1 indicates not present | |
| 11 | major: i32 = -1, | |
| 12 | /// -1 indicates not present | |
| 13 | minor: i32 = -1, | |
| 14 | /// -1 indicates not present | |
| 15 | patch: i32 = -1, | |
| 16 | ||
| 17 | /// Text of parsed major version number | |
| 18 | major_str: []const u8 = "", | |
| 19 | /// Text of parsed major + minor version number | |
| 20 | minor_str: []const u8 = "", | |
| 21 | ||
| 22 | /// Patch number suffix | |
| 23 | suffix: []const u8 = "", | |
| 24 | ||
| 25 | /// This orders versions according to the preferred usage order, not a notion of release-time ordering | |
| 26 | /// Higher version numbers are preferred, but nonexistent minor/patch/suffix is preferred to one that does exist | |
| 27 | /// e.g. `4.1` is preferred over `4.0` but `4` is preferred over both `4.0` and `4.1` | |
| 28 | pub fn isLessThan(self: GCCVersion, rhs_major: i32, rhs_minor: i32, rhs_patch: i32, rhs_suffix: []const u8) bool { | |
| 29 | if (self.major != rhs_major) { | |
| 30 | return self.major < rhs_major; | |
| 31 | } | |
| 32 | if (self.minor != rhs_minor) { | |
| 33 | if (rhs_minor == -1) return true; | |
| 34 | if (self.minor == -1) return false; | |
| 35 | return self.minor < rhs_minor; | |
| 36 | } | |
| 37 | if (self.patch != rhs_patch) { | |
| 38 | if (rhs_patch == -1) return true; | |
| 39 | if (self.patch == -1) return false; | |
| 40 | return self.patch < rhs_patch; | |
| 41 | } | |
| 42 | if (!mem.eql(u8, self.suffix, rhs_suffix)) { | |
| 43 | if (rhs_suffix.len == 0) return true; | |
| 44 | if (self.suffix.len == 0) return false; | |
| 45 | return switch (std.mem.order(u8, self.suffix, rhs_suffix)) { | |
| 46 | .lt => true, | |
| 47 | .eq => unreachable, | |
| 48 | .gt => false, | |
| 49 | }; | |
| 50 | } | |
| 51 | return false; | |
| 52 | } | |
| 53 | ||
| 54 | /// Strings in the returned GCCVersion struct have the same lifetime as `text` | |
| 55 | pub fn parse(text: []const u8) GCCVersion { | |
| 56 | const bad = GCCVersion{ .major = -1 }; | |
| 57 | var good = bad; | |
| 58 | ||
| 59 | var it = mem.splitScalar(u8, text, '.'); | |
| 60 | const first = it.next().?; | |
| 61 | const second = it.next() orelse ""; | |
| 62 | const rest = it.next() orelse ""; | |
| 63 | ||
| 64 | good.major = std.fmt.parseInt(i32, first, 10) catch return bad; | |
| 65 | if (good.major < 0) return bad; | |
| 66 | good.major_str = first; | |
| 67 | ||
| 68 | if (second.len == 0) return good; | |
| 69 | var minor_str = second; | |
| 70 | ||
| 71 | if (rest.len == 0) { | |
| 72 | const end = mem.indexOfNone(u8, minor_str, "0123456789") orelse minor_str.len; | |
| 73 | if (end > 0) { | |
| 74 | good.suffix = minor_str[end..]; | |
| 75 | minor_str = minor_str[0..end]; | |
| 76 | } | |
| 77 | } | |
| 78 | good.minor = std.fmt.parseInt(i32, minor_str, 10) catch return bad; | |
| 79 | if (good.minor < 0) return bad; | |
| 80 | good.minor_str = minor_str; | |
| 81 | ||
| 82 | if (rest.len > 0) { | |
| 83 | const end = mem.indexOfNone(u8, rest, "0123456789") orelse rest.len; | |
| 84 | if (end > 0) { | |
| 85 | const patch_num_text = rest[0..end]; | |
| 86 | good.patch = std.fmt.parseInt(i32, patch_num_text, 10) catch return bad; | |
| 87 | if (good.patch < 0) return bad; | |
| 88 | good.suffix = rest[end..]; | |
| 89 | } | |
| 90 | } | |
| 91 | ||
| 92 | return good; | |
| 93 | } | |
| 94 | ||
| 95 | pub fn order(a: GCCVersion, b: GCCVersion) Order { | |
| 96 | if (a.isLessThan(b.major, b.minor, b.patch, b.suffix)) return .lt; | |
| 97 | if (b.isLessThan(a.major, a.minor, a.patch, a.suffix)) return .gt; | |
| 98 | return .eq; | |
| 99 | } | |
| 100 | ||
| 101 | test parse { | |
| 102 | const versions = [10]GCCVersion{ | |
| 103 | parse("5"), | |
| 104 | parse("4"), | |
| 105 | parse("4.2"), | |
| 106 | parse("4.0"), | |
| 107 | parse("4.0-patched"), | |
| 108 | parse("4.0.2"), | |
| 109 | parse("4.0.1"), | |
| 110 | parse("4.0.1-patched"), | |
| 111 | parse("4.0.0"), | |
| 112 | parse("4.0.0-patched"), | |
| 113 | }; | |
| 114 | ||
| 115 | for (versions[0 .. versions.len - 1], versions[1..versions.len]) |first, second| { | |
| 116 | try std.testing.expectEqual(Order.eq, first.order(first)); | |
| 117 | try std.testing.expectEqual(Order.gt, first.order(second)); | |
| 118 | try std.testing.expectEqual(Order.lt, second.order(first)); | |
| 119 | } | |
| 120 | const last = versions[versions.len - 1]; | |
| 121 | try std.testing.expectEqual(Order.eq, last.order(last)); | |
| 122 | } |
deps/aro/Driver/Multilib.zig created+72| ... | ... | @@ -0,0 +1,72 @@ |
| 1 | const std = @import("std"); | |
| 2 | const util = @import("../util.zig"); | |
| 3 | const Filesystem = @import("Filesystem.zig").Filesystem; | |
| 4 | ||
| 5 | pub const Flags = std.BoundedArray([]const u8, 6); | |
| 6 | ||
| 7 | /// Large enough for GCCDetector for Linux; may need to be increased to support other toolchains. | |
| 8 | const max_multilibs = 4; | |
| 9 | ||
| 10 | const MultilibArray = std.BoundedArray(Multilib, max_multilibs); | |
| 11 | ||
| 12 | pub const Detected = struct { | |
| 13 | multilibs: MultilibArray = .{}, | |
| 14 | selected: Multilib = .{}, | |
| 15 | biarch_sibling: ?Multilib = null, | |
| 16 | ||
| 17 | pub fn filter(self: *Detected, multilib_filter: Filter, fs: Filesystem) void { | |
| 18 | var found_count: usize = 0; | |
| 19 | for (self.multilibs.constSlice()) |multilib| { | |
| 20 | if (multilib_filter.exists(multilib, fs)) { | |
| 21 | self.multilibs.set(found_count, multilib); | |
| 22 | found_count += 1; | |
| 23 | } | |
| 24 | } | |
| 25 | self.multilibs.resize(found_count) catch unreachable; | |
| 26 | } | |
| 27 | ||
| 28 | pub fn select(self: *Detected, flags: Flags) !bool { | |
| 29 | var filtered: MultilibArray = .{}; | |
| 30 | for (self.multilibs.constSlice()) |multilib| { | |
| 31 | for (multilib.flags.constSlice()) |multilib_flag| { | |
| 32 | const matched = for (flags.constSlice()) |arg_flag| { | |
| 33 | if (std.mem.eql(u8, arg_flag[1..], multilib_flag[1..])) break arg_flag; | |
| 34 | } else multilib_flag; | |
| 35 | if (matched[0] != multilib_flag[0]) break; | |
| 36 | } else { | |
| 37 | filtered.appendAssumeCapacity(multilib); | |
| 38 | } | |
| 39 | } | |
| 40 | if (filtered.len == 0) return false; | |
| 41 | if (filtered.len == 1) { | |
| 42 | self.selected = filtered.get(0); | |
| 43 | return true; | |
| 44 | } | |
| 45 | return error.TooManyMultilibs; | |
| 46 | } | |
| 47 | }; | |
| 48 | ||
| 49 | pub const Filter = struct { | |
| 50 | base: [2][]const u8, | |
| 51 | file: []const u8, | |
| 52 | pub fn exists(self: Filter, m: Multilib, fs: Filesystem) bool { | |
| 53 | return fs.joinedExists(&.{ self.base[0], self.base[1], m.gcc_suffix, self.file }); | |
| 54 | } | |
| 55 | }; | |
| 56 | ||
| 57 | const Multilib = @This(); | |
| 58 | ||
| 59 | gcc_suffix: []const u8 = "", | |
| 60 | os_suffix: []const u8 = "", | |
| 61 | include_suffix: []const u8 = "", | |
| 62 | flags: Flags = .{}, | |
| 63 | priority: u32 = 0, | |
| 64 | ||
| 65 | pub fn init(gcc_suffix: []const u8, os_suffix: []const u8, flags: []const []const u8) Multilib { | |
| 66 | var self: Multilib = .{ | |
| 67 | .gcc_suffix = gcc_suffix, | |
| 68 | .os_suffix = os_suffix, | |
| 69 | }; | |
| 70 | self.flags.appendSliceAssumeCapacity(flags); | |
| 71 | return self; | |
| 72 | } |
deps/aro/InitList.zig created+153| ... | ... | @@ -0,0 +1,153 @@ |
| 1 | //! Sparsely populated list of used indexes. | |
| 2 | //! Used for detecting duplicate initializers. | |
| 3 | const std = @import("std"); | |
| 4 | const Allocator = std.mem.Allocator; | |
| 5 | const testing = std.testing; | |
| 6 | const Tree = @import("Tree.zig"); | |
| 7 | const Token = Tree.Token; | |
| 8 | const TokenIndex = Tree.TokenIndex; | |
| 9 | const NodeIndex = Tree.NodeIndex; | |
| 10 | const Type = @import("Type.zig"); | |
| 11 | const Diagnostics = @import("Diagnostics.zig"); | |
| 12 | const NodeList = std.ArrayList(NodeIndex); | |
| 13 | const Parser = @import("Parser.zig"); | |
| 14 | ||
| 15 | const InitList = @This(); | |
| 16 | ||
| 17 | const Item = struct { | |
| 18 | list: InitList = .{}, | |
| 19 | index: u64, | |
| 20 | ||
| 21 | fn order(_: void, a: Item, b: Item) std.math.Order { | |
| 22 | return std.math.order(a.index, b.index); | |
| 23 | } | |
| 24 | }; | |
| 25 | ||
| 26 | list: std.ArrayListUnmanaged(Item) = .{}, | |
| 27 | node: NodeIndex = .none, | |
| 28 | tok: TokenIndex = 0, | |
| 29 | ||
| 30 | /// Deinitialize freeing all memory. | |
| 31 | pub fn deinit(il: *InitList, gpa: Allocator) void { | |
| 32 | for (il.list.items) |*item| item.list.deinit(gpa); | |
| 33 | il.list.deinit(gpa); | |
| 34 | il.* = undefined; | |
| 35 | } | |
| 36 | ||
| 37 | /// Insert initializer at index, returning previous entry if one exists. | |
| 38 | pub fn put(il: *InitList, gpa: Allocator, index: usize, node: NodeIndex, tok: TokenIndex) !?TokenIndex { | |
| 39 | const items = il.list.items; | |
| 40 | var left: usize = 0; | |
| 41 | var right: usize = items.len; | |
| 42 | ||
| 43 | // Append new value to empty list | |
| 44 | if (left == right) { | |
| 45 | const item = try il.list.addOne(gpa); | |
| 46 | item.* = .{ | |
| 47 | .list = .{ .node = node, .tok = tok }, | |
| 48 | .index = index, | |
| 49 | }; | |
| 50 | return null; | |
| 51 | } | |
| 52 | ||
| 53 | while (left < right) { | |
| 54 | // Avoid overflowing in the midpoint calculation | |
| 55 | const mid = left + (right - left) / 2; | |
| 56 | // Compare the key with the midpoint element | |
| 57 | switch (std.math.order(index, items[mid].index)) { | |
| 58 | .eq => { | |
| 59 | // Replace previous entry. | |
| 60 | const prev = items[mid].list.tok; | |
| 61 | items[mid].list.deinit(gpa); | |
| 62 | items[mid] = .{ | |
| 63 | .list = .{ .node = node, .tok = tok }, | |
| 64 | .index = index, | |
| 65 | }; | |
| 66 | return prev; | |
| 67 | }, | |
| 68 | .gt => left = mid + 1, | |
| 69 | .lt => right = mid, | |
| 70 | } | |
| 71 | } | |
| 72 | ||
| 73 | // Insert a new value into a sorted position. | |
| 74 | try il.list.insert(gpa, left, .{ | |
| 75 | .list = .{ .node = node, .tok = tok }, | |
| 76 | .index = index, | |
| 77 | }); | |
| 78 | return null; | |
| 79 | } | |
| 80 | ||
| 81 | /// Find item at index, create new if one does not exist. | |
| 82 | pub fn find(il: *InitList, gpa: Allocator, index: u64) !*InitList { | |
| 83 | const items = il.list.items; | |
| 84 | var left: usize = 0; | |
| 85 | var right: usize = items.len; | |
| 86 | ||
| 87 | // Append new value to empty list | |
| 88 | if (left == right) { | |
| 89 | const item = try il.list.addOne(gpa); | |
| 90 | item.* = .{ | |
| 91 | .list = .{ .node = .none, .tok = 0 }, | |
| 92 | .index = index, | |
| 93 | }; | |
| 94 | return &item.list; | |
| 95 | } | |
| 96 | ||
| 97 | while (left < right) { | |
| 98 | // Avoid overflowing in the midpoint calculation | |
| 99 | const mid = left + (right - left) / 2; | |
| 100 | // Compare the key with the midpoint element | |
| 101 | switch (std.math.order(index, items[mid].index)) { | |
| 102 | .eq => return &items[mid].list, | |
| 103 | .gt => left = mid + 1, | |
| 104 | .lt => right = mid, | |
| 105 | } | |
| 106 | } | |
| 107 | ||
| 108 | // Insert a new value into a sorted position. | |
| 109 | try il.list.insert(gpa, left, .{ | |
| 110 | .list = .{ .node = .none, .tok = 0 }, | |
| 111 | .index = index, | |
| 112 | }); | |
| 113 | return &il.list.items[left].list; | |
| 114 | } | |
| 115 | ||
| 116 | test "basic usage" { | |
| 117 | const gpa = testing.allocator; | |
| 118 | var il: InitList = .{}; | |
| 119 | defer il.deinit(gpa); | |
| 120 | ||
| 121 | { | |
| 122 | var i: usize = 0; | |
| 123 | while (i < 5) : (i += 1) { | |
| 124 | const prev = try il.put(gpa, i, .none, 0); | |
| 125 | try testing.expect(prev == null); | |
| 126 | } | |
| 127 | } | |
| 128 | ||
| 129 | { | |
| 130 | const failing = testing.failing_allocator; | |
| 131 | var i: usize = 0; | |
| 132 | while (i < 5) : (i += 1) { | |
| 133 | _ = try il.find(failing, i); | |
| 134 | } | |
| 135 | } | |
| 136 | ||
| 137 | { | |
| 138 | var item = try il.find(gpa, 0); | |
| 139 | var i: usize = 1; | |
| 140 | while (i < 5) : (i += 1) { | |
| 141 | item = try item.find(gpa, i); | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | { | |
| 146 | const failing = testing.failing_allocator; | |
| 147 | var item = try il.find(failing, 0); | |
| 148 | var i: usize = 1; | |
| 149 | while (i < 5) : (i += 1) { | |
| 150 | item = try item.find(failing, i); | |
| 151 | } | |
| 152 | } | |
| 153 | } |
deps/aro/Interner.zig created+180| ... | ... | @@ -0,0 +1,180 @@ |
| 1 | const Interner = @This(); | |
| 2 | const std = @import("std"); | |
| 3 | const Allocator = std.mem.Allocator; | |
| 4 | const assert = std.debug.assert; | |
| 5 | const Value = @import("Value.zig"); | |
| 6 | ||
| 7 | map: std.ArrayHashMapUnmanaged(Key, void, KeyContext, false) = .{}, | |
| 8 | ||
| 9 | const KeyContext = struct { | |
| 10 | pub fn eql(_: @This(), a: Key, b: Key, _: usize) bool { | |
| 11 | return b.eql(a); | |
| 12 | } | |
| 13 | ||
| 14 | pub fn hash(_: @This(), a: Key) u32 { | |
| 15 | return a.hash(); | |
| 16 | } | |
| 17 | }; | |
| 18 | ||
| 19 | pub const Key = union(enum) { | |
| 20 | int: u16, | |
| 21 | float: u16, | |
| 22 | ptr, | |
| 23 | noreturn, | |
| 24 | void, | |
| 25 | func, | |
| 26 | array: struct { | |
| 27 | len: u64, | |
| 28 | child: Ref, | |
| 29 | }, | |
| 30 | vector: struct { | |
| 31 | len: u32, | |
| 32 | child: Ref, | |
| 33 | }, | |
| 34 | value: Value, | |
| 35 | record: struct { | |
| 36 | /// Pointer to user data, value used for hash and equality check. | |
| 37 | user_ptr: *anyopaque, | |
| 38 | /// TODO make smaller if Value is made smaller | |
| 39 | elements: []const Ref, | |
| 40 | }, | |
| 41 | ||
| 42 | pub fn hash(key: Key) u32 { | |
| 43 | var hasher = std.hash.Wyhash.init(0); | |
| 44 | switch (key) { | |
| 45 | .value => |val| { | |
| 46 | std.hash.autoHash(&hasher, val.tag); | |
| 47 | switch (val.tag) { | |
| 48 | .unavailable => unreachable, | |
| 49 | .nullptr_t => std.hash.autoHash(&hasher, @as(u64, 0)), | |
| 50 | .int => std.hash.autoHash(&hasher, val.data.int), | |
| 51 | .float => std.hash.autoHash(&hasher, @as(u64, @bitCast(val.data.float))), | |
| 52 | .bytes => std.hash.autoHashStrat(&hasher, val.data.bytes, .Shallow), | |
| 53 | } | |
| 54 | }, | |
| 55 | .record => |info| { | |
| 56 | std.hash.autoHash(&hasher, @intFromPtr(info.user_ptr)); | |
| 57 | }, | |
| 58 | inline else => |info| { | |
| 59 | std.hash.autoHash(&hasher, info); | |
| 60 | }, | |
| 61 | } | |
| 62 | return @truncate(hasher.final()); | |
| 63 | } | |
| 64 | ||
| 65 | pub fn eql(a: Key, b: Key) bool { | |
| 66 | const KeyTag = std.meta.Tag(Key); | |
| 67 | const a_tag: KeyTag = a; | |
| 68 | const b_tag: KeyTag = b; | |
| 69 | if (a_tag != b_tag) return false; | |
| 70 | switch (a) { | |
| 71 | .value => |a_info| { | |
| 72 | const b_info = b.value; | |
| 73 | if (a_info.tag != b_info.tag) return false; | |
| 74 | switch (a_info.tag) { | |
| 75 | .unavailable => unreachable, | |
| 76 | .nullptr_t => return true, | |
| 77 | .int => return a_info.data.int == b_info.data.int, | |
| 78 | .float => return a_info.data.float == b_info.data.float, | |
| 79 | .bytes => return a_info.data.bytes.start == b_info.data.bytes.start and a_info.data.bytes.end == b_info.data.bytes.end, | |
| 80 | } | |
| 81 | }, | |
| 82 | .record => |a_info| { | |
| 83 | return a_info.user_ptr == b.record.user_ptr; | |
| 84 | }, | |
| 85 | inline else => |a_info, tag| { | |
| 86 | const b_info = @field(b, @tagName(tag)); | |
| 87 | return std.meta.eql(a_info, b_info); | |
| 88 | }, | |
| 89 | } | |
| 90 | } | |
| 91 | ||
| 92 | fn toRef(key: Key) ?Ref { | |
| 93 | switch (key) { | |
| 94 | .int => |bits| switch (bits) { | |
| 95 | 1 => return .i1, | |
| 96 | 8 => return .i8, | |
| 97 | 16 => return .i16, | |
| 98 | 32 => return .i32, | |
| 99 | 64 => return .i64, | |
| 100 | 128 => return .i128, | |
| 101 | else => {}, | |
| 102 | }, | |
| 103 | .float => |bits| switch (bits) { | |
| 104 | 16 => return .f16, | |
| 105 | 32 => return .f32, | |
| 106 | 64 => return .f64, | |
| 107 | 80 => return .f80, | |
| 108 | 128 => return .f128, | |
| 109 | else => unreachable, | |
| 110 | }, | |
| 111 | .ptr => return .ptr, | |
| 112 | .func => return .func, | |
| 113 | .noreturn => return .noreturn, | |
| 114 | .void => return .void, | |
| 115 | else => {}, | |
| 116 | } | |
| 117 | return null; | |
| 118 | } | |
| 119 | }; | |
| 120 | ||
| 121 | pub const Ref = enum(u32) { | |
| 122 | const max = std.math.maxInt(u32); | |
| 123 | ||
| 124 | ptr = max - 0, | |
| 125 | noreturn = max - 1, | |
| 126 | void = max - 2, | |
| 127 | i1 = max - 3, | |
| 128 | i8 = max - 4, | |
| 129 | i16 = max - 5, | |
| 130 | i32 = max - 6, | |
| 131 | i64 = max - 7, | |
| 132 | i128 = max - 8, | |
| 133 | f16 = max - 9, | |
| 134 | f32 = max - 10, | |
| 135 | f64 = max - 11, | |
| 136 | f80 = max - 12, | |
| 137 | f128 = max - 13, | |
| 138 | func = max - 14, | |
| 139 | _, | |
| 140 | }; | |
| 141 | ||
| 142 | pub fn deinit(ip: *Interner, gpa: Allocator) void { | |
| 143 | ip.map.deinit(gpa); | |
| 144 | } | |
| 145 | ||
| 146 | pub fn put(ip: *Interner, gpa: Allocator, key: Key) !Ref { | |
| 147 | if (key.toRef()) |some| return some; | |
| 148 | const gop = try ip.map.getOrPut(gpa, key); | |
| 149 | return @enumFromInt(gop.index); | |
| 150 | } | |
| 151 | ||
| 152 | pub fn has(ip: *Interner, key: Key) ?Ref { | |
| 153 | if (key.toRef()) |some| return some; | |
| 154 | if (ip.map.getIndex(key)) |index| { | |
| 155 | return @enumFromInt(index); | |
| 156 | } | |
| 157 | return null; | |
| 158 | } | |
| 159 | ||
| 160 | pub fn get(ip: Interner, ref: Ref) Key { | |
| 161 | switch (ref) { | |
| 162 | .ptr => return .ptr, | |
| 163 | .func => return .func, | |
| 164 | .noreturn => return .noreturn, | |
| 165 | .void => return .void, | |
| 166 | .i1 => return .{ .int = 1 }, | |
| 167 | .i8 => return .{ .int = 8 }, | |
| 168 | .i16 => return .{ .int = 16 }, | |
| 169 | .i32 => return .{ .int = 32 }, | |
| 170 | .i64 => return .{ .int = 64 }, | |
| 171 | .i128 => return .{ .int = 128 }, | |
| 172 | .f16 => return .{ .float = 16 }, | |
| 173 | .f32 => return .{ .float = 32 }, | |
| 174 | .f64 => return .{ .float = 64 }, | |
| 175 | .f80 => return .{ .float = 80 }, | |
| 176 | .f128 => return .{ .float = 128 }, | |
| 177 | else => {}, | |
| 178 | } | |
| 179 | return ip.map.keys()[@intFromEnum(ref)]; | |
| 180 | } |
deps/aro/Ir.zig created+601| ... | ... | @@ -0,0 +1,601 @@ |
| 1 | const std = @import("std"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | const Allocator = std.mem.Allocator; | |
| 4 | const Compilation = @import("Compilation.zig"); | |
| 5 | const Interner = @import("Interner.zig"); | |
| 6 | const StringId = @import("StringInterner.zig").StringId; | |
| 7 | const Value = @import("Value.zig"); | |
| 8 | ||
| 9 | const Ir = @This(); | |
| 10 | ||
| 11 | pool: Interner, | |
| 12 | strings: []const u8, | |
| 13 | // decls: std.StringArrayHashMapUnmanaged(Decl), | |
| 14 | ||
| 15 | // pub const Decl = struct { | |
| 16 | instructions: std.MultiArrayList(Inst), | |
| 17 | body: std.ArrayListUnmanaged(Ref), | |
| 18 | arena: std.heap.ArenaAllocator.State, | |
| 19 | // }; | |
| 20 | ||
| 21 | pub const Builder = struct { | |
| 22 | gpa: Allocator, | |
| 23 | arena: std.heap.ArenaAllocator, | |
| 24 | instructions: std.MultiArrayList(Ir.Inst) = .{}, | |
| 25 | body: std.ArrayListUnmanaged(Ref) = .{}, | |
| 26 | alloc_count: u32 = 0, | |
| 27 | arg_count: u32 = 0, | |
| 28 | pool: Interner = .{}, | |
| 29 | current_label: Ref = undefined, | |
| 30 | ||
| 31 | pub fn deinit(b: *Builder) void { | |
| 32 | b.arena.deinit(); | |
| 33 | b.instructions.deinit(b.gpa); | |
| 34 | b.body.deinit(b.gpa); | |
| 35 | b.pool.deinit(b.gpa); | |
| 36 | b.* = undefined; | |
| 37 | } | |
| 38 | ||
| 39 | pub fn startFn(b: *Builder) Allocator.Error!void { | |
| 40 | b.alloc_count = 0; | |
| 41 | b.arg_count = 0; | |
| 42 | b.instructions.len = 0; | |
| 43 | b.body.items.len = 0; | |
| 44 | const entry = try b.makeLabel("entry"); | |
| 45 | try b.body.append(b.gpa, entry); | |
| 46 | b.current_label = entry; | |
| 47 | } | |
| 48 | ||
| 49 | pub fn startBlock(b: *Builder, label: Ref) !void { | |
| 50 | try b.body.append(b.gpa, label); | |
| 51 | b.current_label = label; | |
| 52 | } | |
| 53 | ||
| 54 | pub fn addArg(b: *Builder, ty: Interner.Ref) Allocator.Error!Ref { | |
| 55 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 56 | try b.instructions.append(b.gpa, .{ .tag = .arg, .data = .{ .none = {} }, .ty = ty }); | |
| 57 | try b.body.insert(b.gpa, b.arg_count, ref); | |
| 58 | b.arg_count += 1; | |
| 59 | return ref; | |
| 60 | } | |
| 61 | ||
| 62 | pub fn addAlloc(b: *Builder, size: u32, @"align": u32) Allocator.Error!Ref { | |
| 63 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 64 | try b.instructions.append(b.gpa, .{ | |
| 65 | .tag = .alloc, | |
| 66 | .data = .{ .alloc = .{ .size = size, .@"align" = @"align" } }, | |
| 67 | .ty = .ptr, | |
| 68 | }); | |
| 69 | try b.body.insert(b.gpa, b.alloc_count + b.arg_count + 1, ref); | |
| 70 | b.alloc_count += 1; | |
| 71 | return ref; | |
| 72 | } | |
| 73 | ||
| 74 | pub fn addInst(b: *Builder, tag: Ir.Inst.Tag, data: Ir.Inst.Data, ty: Interner.Ref) Allocator.Error!Ref { | |
| 75 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 76 | try b.instructions.append(b.gpa, .{ .tag = tag, .data = data, .ty = ty }); | |
| 77 | try b.body.append(b.gpa, ref); | |
| 78 | return ref; | |
| 79 | } | |
| 80 | ||
| 81 | pub fn makeLabel(b: *Builder, name: [*:0]const u8) Allocator.Error!Ref { | |
| 82 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 83 | try b.instructions.append(b.gpa, .{ .tag = .label, .data = .{ .label = name }, .ty = .void }); | |
| 84 | return ref; | |
| 85 | } | |
| 86 | ||
| 87 | pub fn addJump(b: *Builder, label: Ref) Allocator.Error!void { | |
| 88 | _ = try b.addInst(.jmp, .{ .un = label }, .noreturn); | |
| 89 | } | |
| 90 | ||
| 91 | pub fn addBranch(b: *Builder, cond: Ref, true_label: Ref, false_label: Ref) Allocator.Error!void { | |
| 92 | const branch = try b.arena.allocator().create(Ir.Inst.Branch); | |
| 93 | branch.* = .{ | |
| 94 | .cond = cond, | |
| 95 | .then = true_label, | |
| 96 | .@"else" = false_label, | |
| 97 | }; | |
| 98 | _ = try b.addInst(.branch, .{ .branch = branch }, .noreturn); | |
| 99 | } | |
| 100 | ||
| 101 | pub fn addSwitch(b: *Builder, target: Ref, values: []Interner.Ref, labels: []Ref, default: Ref) Allocator.Error!void { | |
| 102 | assert(values.len == labels.len); | |
| 103 | const a = b.arena.allocator(); | |
| 104 | const @"switch" = try a.create(Ir.Inst.Switch); | |
| 105 | @"switch".* = .{ | |
| 106 | .target = target, | |
| 107 | .cases_len = @intCast(values.len), | |
| 108 | .case_vals = (try a.dupe(Interner.Ref, values)).ptr, | |
| 109 | .case_labels = (try a.dupe(Ref, labels)).ptr, | |
| 110 | .default = default, | |
| 111 | }; | |
| 112 | _ = try b.addInst(.@"switch", .{ .@"switch" = @"switch" }, .noreturn); | |
| 113 | } | |
| 114 | ||
| 115 | pub fn addStore(b: *Builder, ptr: Ref, val: Ref) Allocator.Error!void { | |
| 116 | _ = try b.addInst(.store, .{ .bin = .{ .lhs = ptr, .rhs = val } }, .void); | |
| 117 | } | |
| 118 | ||
| 119 | pub fn addConstant(b: *Builder, val: Value, ty: Interner.Ref) Allocator.Error!Ref { | |
| 120 | const ref: Ref = @enumFromInt(b.instructions.len); | |
| 121 | const key: Interner.Key = .{ | |
| 122 | .value = val, | |
| 123 | }; | |
| 124 | const val_ref = try b.pool.put(b.gpa, key); | |
| 125 | try b.instructions.append(b.gpa, .{ .tag = .constant, .data = .{ | |
| 126 | .constant = val_ref, | |
| 127 | }, .ty = ty }); | |
| 128 | return ref; | |
| 129 | } | |
| 130 | ||
| 131 | pub fn addPhi(b: *Builder, inputs: []const Inst.Phi.Input, ty: Interner.Ref) Allocator.Error!Ref { | |
| 132 | const a = b.arena.allocator(); | |
| 133 | const input_refs = try a.alloc(Ref, inputs.len * 2 + 1); | |
| 134 | input_refs[0] = @enumFromInt(inputs.len); | |
| 135 | std.mem.copy(Ref, input_refs[1..], std.mem.bytesAsSlice(Ref, std.mem.sliceAsBytes(inputs))); | |
| 136 | ||
| 137 | return b.addInst(.phi, .{ .phi = .{ .ptr = input_refs.ptr } }, ty); | |
| 138 | } | |
| 139 | ||
| 140 | pub fn addSelect(b: *Builder, cond: Ref, then: Ref, @"else": Ref, ty: Interner.Ref) Allocator.Error!Ref { | |
| 141 | const branch = try b.arena.allocator().create(Ir.Inst.Branch); | |
| 142 | branch.* = .{ | |
| 143 | .cond = cond, | |
| 144 | .then = then, | |
| 145 | .@"else" = @"else", | |
| 146 | }; | |
| 147 | return b.addInst(.select, .{ .branch = branch }, ty); | |
| 148 | } | |
| 149 | }; | |
| 150 | ||
| 151 | pub const Ref = enum(u32) { none = std.math.maxInt(u32), _ }; | |
| 152 | ||
| 153 | pub const Inst = struct { | |
| 154 | tag: Tag, | |
| 155 | data: Data, | |
| 156 | ty: Interner.Ref, | |
| 157 | ||
| 158 | pub const Tag = enum { | |
| 159 | // data.constant | |
| 160 | // not included in blocks | |
| 161 | constant, | |
| 162 | ||
| 163 | // data.arg | |
| 164 | // not included in blocks | |
| 165 | arg, | |
| 166 | symbol, | |
| 167 | ||
| 168 | // data.label | |
| 169 | label, | |
| 170 | ||
| 171 | // data.block | |
| 172 | label_addr, | |
| 173 | jmp, | |
| 174 | ||
| 175 | // data.switch | |
| 176 | @"switch", | |
| 177 | ||
| 178 | // data.branch | |
| 179 | branch, | |
| 180 | select, | |
| 181 | ||
| 182 | // data.un | |
| 183 | jmp_val, | |
| 184 | ||
| 185 | // data.call | |
| 186 | call, | |
| 187 | ||
| 188 | // data.alloc | |
| 189 | alloc, | |
| 190 | ||
| 191 | // data.phi | |
| 192 | phi, | |
| 193 | ||
| 194 | // data.bin | |
| 195 | store, | |
| 196 | bit_or, | |
| 197 | bit_xor, | |
| 198 | bit_and, | |
| 199 | bit_shl, | |
| 200 | bit_shr, | |
| 201 | cmp_eq, | |
| 202 | cmp_ne, | |
| 203 | cmp_lt, | |
| 204 | cmp_lte, | |
| 205 | cmp_gt, | |
| 206 | cmp_gte, | |
| 207 | add, | |
| 208 | sub, | |
| 209 | mul, | |
| 210 | div, | |
| 211 | mod, | |
| 212 | ||
| 213 | // data.un | |
| 214 | ret, | |
| 215 | load, | |
| 216 | bit_not, | |
| 217 | negate, | |
| 218 | trunc, | |
| 219 | zext, | |
| 220 | sext, | |
| 221 | }; | |
| 222 | ||
| 223 | pub const Data = union { | |
| 224 | constant: Interner.Ref, | |
| 225 | none: void, | |
| 226 | bin: struct { | |
| 227 | lhs: Ref, | |
| 228 | rhs: Ref, | |
| 229 | }, | |
| 230 | un: Ref, | |
| 231 | arg: u32, | |
| 232 | alloc: struct { | |
| 233 | size: u32, | |
| 234 | @"align": u32, | |
| 235 | }, | |
| 236 | @"switch": *Switch, | |
| 237 | call: *Call, | |
| 238 | label: [*:0]const u8, | |
| 239 | branch: *Branch, | |
| 240 | phi: Phi, | |
| 241 | }; | |
| 242 | ||
| 243 | pub const Branch = struct { | |
| 244 | cond: Ref, | |
| 245 | then: Ref, | |
| 246 | @"else": Ref, | |
| 247 | }; | |
| 248 | ||
| 249 | pub const Switch = struct { | |
| 250 | target: Ref, | |
| 251 | cases_len: u32, | |
| 252 | default: Ref, | |
| 253 | case_vals: [*]Interner.Ref, | |
| 254 | case_labels: [*]Ref, | |
| 255 | }; | |
| 256 | ||
| 257 | pub const Call = struct { | |
| 258 | func: Ref, | |
| 259 | args_len: u32, | |
| 260 | args_ptr: [*]Ref, | |
| 261 | ||
| 262 | pub fn args(c: Call) []Ref { | |
| 263 | return c.args_ptr[0..c.args_len]; | |
| 264 | } | |
| 265 | }; | |
| 266 | ||
| 267 | pub const Phi = struct { | |
| 268 | ptr: [*]Ir.Ref, | |
| 269 | ||
| 270 | pub const Input = struct { | |
| 271 | label: Ir.Ref, | |
| 272 | value: Ir.Ref, | |
| 273 | }; | |
| 274 | ||
| 275 | pub fn inputs(p: Phi) []Input { | |
| 276 | const len = @intFromEnum(p.ptr[0]) * 2; | |
| 277 | const slice = (p.ptr + 1)[0..len]; | |
| 278 | return std.mem.bytesAsSlice(Input, std.mem.sliceAsBytes(slice)); | |
| 279 | } | |
| 280 | }; | |
| 281 | }; | |
| 282 | ||
| 283 | pub fn deinit(ir: *Ir, gpa: std.mem.Allocator) void { | |
| 284 | ir.arena.promote(gpa).deinit(); | |
| 285 | ir.instructions.deinit(gpa); | |
| 286 | ir.* = undefined; | |
| 287 | } | |
| 288 | ||
| 289 | const util = @import("util.zig"); | |
| 290 | const TYPE = util.Color.purple; | |
| 291 | const INST = util.Color.cyan; | |
| 292 | const REF = util.Color.blue; | |
| 293 | const LITERAL = util.Color.green; | |
| 294 | const ATTRIBUTE = util.Color.yellow; | |
| 295 | ||
| 296 | const RefMap = std.AutoArrayHashMap(Ref, void); | |
| 297 | ||
| 298 | pub fn dump(ir: Ir, gpa: Allocator, name: []const u8, color: bool, w: anytype) !void { | |
| 299 | const tags = ir.instructions.items(.tag); | |
| 300 | const data = ir.instructions.items(.data); | |
| 301 | ||
| 302 | var ref_map = RefMap.init(gpa); | |
| 303 | defer ref_map.deinit(); | |
| 304 | ||
| 305 | var label_map = RefMap.init(gpa); | |
| 306 | defer label_map.deinit(); | |
| 307 | ||
| 308 | const ret_inst = ir.body.items[ir.body.items.len - 1]; | |
| 309 | const ret_operand = data[@intFromEnum(ret_inst)].un; | |
| 310 | const ret_ty = ir.instructions.items(.ty)[@intFromEnum(ret_operand)]; | |
| 311 | try ir.writeType(ret_ty, color, w); | |
| 312 | if (color) util.setColor(REF, w); | |
| 313 | try w.print(" @{s}", .{name}); | |
| 314 | if (color) util.setColor(.reset, w); | |
| 315 | try w.writeAll("("); | |
| 316 | ||
| 317 | var arg_count: u32 = 0; | |
| 318 | while (true) : (arg_count += 1) { | |
| 319 | const ref = ir.body.items[arg_count]; | |
| 320 | if (tags[@intFromEnum(ref)] != .arg) break; | |
| 321 | if (arg_count != 0) try w.writeAll(", "); | |
| 322 | try ref_map.put(ref, {}); | |
| 323 | try ir.writeRef(&ref_map, ref, color, w); | |
| 324 | if (color) util.setColor(.reset, w); | |
| 325 | } | |
| 326 | try w.writeAll(") {\n"); | |
| 327 | for (ir.body.items[arg_count..]) |ref| { | |
| 328 | switch (tags[@intFromEnum(ref)]) { | |
| 329 | .label => try label_map.put(ref, {}), | |
| 330 | else => {}, | |
| 331 | } | |
| 332 | } | |
| 333 | ||
| 334 | for (ir.body.items[arg_count..]) |ref| { | |
| 335 | const i = @intFromEnum(ref); | |
| 336 | const tag = tags[i]; | |
| 337 | switch (tag) { | |
| 338 | .arg, .constant, .symbol => unreachable, | |
| 339 | .label => { | |
| 340 | const label_index = label_map.getIndex(ref).?; | |
| 341 | if (color) util.setColor(REF, w); | |
| 342 | try w.print("{s}.{d}:\n", .{ data[i].label, label_index }); | |
| 343 | }, | |
| 344 | // .label_val => { | |
| 345 | // const un = data[i].un; | |
| 346 | // try w.print(" %{d} = label.{d}\n", .{ i, @intFromEnum(un) }); | |
| 347 | // }, | |
| 348 | .jmp => { | |
| 349 | const un = data[i].un; | |
| 350 | if (color) util.setColor(INST, w); | |
| 351 | try w.writeAll(" jmp "); | |
| 352 | try ir.writeLabel(&label_map, un, color, w); | |
| 353 | try w.writeByte('\n'); | |
| 354 | }, | |
| 355 | .branch => { | |
| 356 | const br = data[i].branch; | |
| 357 | if (color) util.setColor(INST, w); | |
| 358 | try w.writeAll(" branch "); | |
| 359 | try ir.writeRef(&ref_map, br.cond, color, w); | |
| 360 | if (color) util.setColor(.reset, w); | |
| 361 | try w.writeAll(", "); | |
| 362 | try ir.writeLabel(&label_map, br.then, color, w); | |
| 363 | if (color) util.setColor(.reset, w); | |
| 364 | try w.writeAll(", "); | |
| 365 | try ir.writeLabel(&label_map, br.@"else", color, w); | |
| 366 | try w.writeByte('\n'); | |
| 367 | }, | |
| 368 | .select => { | |
| 369 | const br = data[i].branch; | |
| 370 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 371 | try w.writeAll("select "); | |
| 372 | try ir.writeRef(&ref_map, br.cond, color, w); | |
| 373 | if (color) util.setColor(.reset, w); | |
| 374 | try w.writeAll(", "); | |
| 375 | try ir.writeRef(&ref_map, br.then, color, w); | |
| 376 | if (color) util.setColor(.reset, w); | |
| 377 | try w.writeAll(", "); | |
| 378 | try ir.writeRef(&ref_map, br.@"else", color, w); | |
| 379 | try w.writeByte('\n'); | |
| 380 | }, | |
| 381 | // .jmp_val => { | |
| 382 | // const bin = data[i].bin; | |
| 383 | // try w.print(" %{s} %{d} label.{d}\n", .{ @tagName(tag), @intFromEnum(bin.lhs), @intFromEnum(bin.rhs) }); | |
| 384 | // }, | |
| 385 | .@"switch" => { | |
| 386 | const @"switch" = data[i].@"switch"; | |
| 387 | if (color) util.setColor(INST, w); | |
| 388 | try w.writeAll(" switch "); | |
| 389 | try ir.writeRef(&ref_map, @"switch".target, color, w); | |
| 390 | if (color) util.setColor(.reset, w); | |
| 391 | try w.writeAll(" {"); | |
| 392 | for (@"switch".case_vals[0..@"switch".cases_len], @"switch".case_labels) |val_ref, label_ref| { | |
| 393 | try w.writeAll("\n "); | |
| 394 | try ir.writeValue(val_ref, color, w); | |
| 395 | if (color) util.setColor(.reset, w); | |
| 396 | try w.writeAll(" => "); | |
| 397 | try ir.writeLabel(&label_map, label_ref, color, w); | |
| 398 | if (color) util.setColor(.reset, w); | |
| 399 | } | |
| 400 | if (color) util.setColor(LITERAL, w); | |
| 401 | try w.writeAll("\n default "); | |
| 402 | if (color) util.setColor(.reset, w); | |
| 403 | try w.writeAll("=> "); | |
| 404 | try ir.writeLabel(&label_map, @"switch".default, color, w); | |
| 405 | if (color) util.setColor(.reset, w); | |
| 406 | try w.writeAll("\n }\n"); | |
| 407 | }, | |
| 408 | .call => { | |
| 409 | const call = data[i].call; | |
| 410 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 411 | try w.writeAll("call "); | |
| 412 | try ir.writeRef(&ref_map, call.func, color, w); | |
| 413 | if (color) util.setColor(.reset, w); | |
| 414 | try w.writeAll("("); | |
| 415 | for (call.args(), 0..) |arg, arg_i| { | |
| 416 | if (arg_i != 0) try w.writeAll(", "); | |
| 417 | try ir.writeRef(&ref_map, arg, color, w); | |
| 418 | if (color) util.setColor(.reset, w); | |
| 419 | } | |
| 420 | try w.writeAll(")\n"); | |
| 421 | }, | |
| 422 | .alloc => { | |
| 423 | const alloc = data[i].alloc; | |
| 424 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 425 | try w.writeAll("alloc "); | |
| 426 | if (color) util.setColor(ATTRIBUTE, w); | |
| 427 | try w.writeAll("size "); | |
| 428 | if (color) util.setColor(LITERAL, w); | |
| 429 | try w.print("{d}", .{alloc.size}); | |
| 430 | if (color) util.setColor(ATTRIBUTE, w); | |
| 431 | try w.writeAll(" align "); | |
| 432 | if (color) util.setColor(LITERAL, w); | |
| 433 | try w.print("{d}", .{alloc.@"align"}); | |
| 434 | try w.writeByte('\n'); | |
| 435 | }, | |
| 436 | .phi => { | |
| 437 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 438 | try w.writeAll("phi"); | |
| 439 | if (color) util.setColor(.reset, w); | |
| 440 | try w.writeAll(" {"); | |
| 441 | for (data[i].phi.inputs()) |input| { | |
| 442 | try w.writeAll("\n "); | |
| 443 | try ir.writeLabel(&label_map, input.label, color, w); | |
| 444 | if (color) util.setColor(.reset, w); | |
| 445 | try w.writeAll(" => "); | |
| 446 | try ir.writeRef(&ref_map, input.value, color, w); | |
| 447 | if (color) util.setColor(.reset, w); | |
| 448 | } | |
| 449 | if (color) util.setColor(.reset, w); | |
| 450 | try w.writeAll("\n }\n"); | |
| 451 | }, | |
| 452 | .store => { | |
| 453 | const bin = data[i].bin; | |
| 454 | if (color) util.setColor(INST, w); | |
| 455 | try w.writeAll(" store "); | |
| 456 | try ir.writeRef(&ref_map, bin.lhs, color, w); | |
| 457 | if (color) util.setColor(.reset, w); | |
| 458 | try w.writeAll(", "); | |
| 459 | try ir.writeRef(&ref_map, bin.rhs, color, w); | |
| 460 | try w.writeByte('\n'); | |
| 461 | }, | |
| 462 | .ret => { | |
| 463 | if (color) util.setColor(INST, w); | |
| 464 | try w.writeAll(" ret "); | |
| 465 | if (data[i].un != .none) try ir.writeRef(&ref_map, data[i].un, color, w); | |
| 466 | try w.writeByte('\n'); | |
| 467 | }, | |
| 468 | .load => { | |
| 469 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 470 | try w.writeAll("load "); | |
| 471 | try ir.writeRef(&ref_map, data[i].un, color, w); | |
| 472 | try w.writeByte('\n'); | |
| 473 | }, | |
| 474 | .bit_or, | |
| 475 | .bit_xor, | |
| 476 | .bit_and, | |
| 477 | .bit_shl, | |
| 478 | .bit_shr, | |
| 479 | .cmp_eq, | |
| 480 | .cmp_ne, | |
| 481 | .cmp_lt, | |
| 482 | .cmp_lte, | |
| 483 | .cmp_gt, | |
| 484 | .cmp_gte, | |
| 485 | .add, | |
| 486 | .sub, | |
| 487 | .mul, | |
| 488 | .div, | |
| 489 | .mod, | |
| 490 | => { | |
| 491 | const bin = data[i].bin; | |
| 492 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 493 | try w.print("{s} ", .{@tagName(tag)}); | |
| 494 | try ir.writeRef(&ref_map, bin.lhs, color, w); | |
| 495 | if (color) util.setColor(.reset, w); | |
| 496 | try w.writeAll(", "); | |
| 497 | try ir.writeRef(&ref_map, bin.rhs, color, w); | |
| 498 | try w.writeByte('\n'); | |
| 499 | }, | |
| 500 | .bit_not, | |
| 501 | .negate, | |
| 502 | .trunc, | |
| 503 | .zext, | |
| 504 | .sext, | |
| 505 | => { | |
| 506 | const un = data[i].un; | |
| 507 | try ir.writeNewRef(&ref_map, ref, color, w); | |
| 508 | try w.print("{s} ", .{@tagName(tag)}); | |
| 509 | try ir.writeRef(&ref_map, un, color, w); | |
| 510 | try w.writeByte('\n'); | |
| 511 | }, | |
| 512 | .label_addr, .jmp_val => {}, | |
| 513 | } | |
| 514 | } | |
| 515 | if (color) util.setColor(.reset, w); | |
| 516 | try w.writeAll("}\n\n"); | |
| 517 | } | |
| 518 | ||
| 519 | fn writeType(ir: Ir, ty_ref: Interner.Ref, color: bool, w: anytype) !void { | |
| 520 | const ty = ir.pool.get(ty_ref); | |
| 521 | if (color) util.setColor(TYPE, w); | |
| 522 | switch (ty) { | |
| 523 | .value => unreachable, | |
| 524 | .ptr, .noreturn, .void, .func => try w.writeAll(@tagName(ty)), | |
| 525 | .int => |bits| try w.print("i{d}", .{bits}), | |
| 526 | .float => |bits| try w.print("f{d}", .{bits}), | |
| 527 | .array => |info| { | |
| 528 | try w.print("[{d} * ", .{info.len}); | |
| 529 | try ir.writeType(info.child, false, w); | |
| 530 | try w.writeByte(']'); | |
| 531 | }, | |
| 532 | .vector => |info| { | |
| 533 | try w.print("<{d} * ", .{info.len}); | |
| 534 | try ir.writeType(info.child, false, w); | |
| 535 | try w.writeByte('>'); | |
| 536 | }, | |
| 537 | .record => |info| { | |
| 538 | // TODO collect into buffer and only print once | |
| 539 | try w.writeAll("{ "); | |
| 540 | for (info.elements, 0..) |elem, i| { | |
| 541 | if (i != 0) try w.writeAll(", "); | |
| 542 | try ir.writeType(elem, color, w); | |
| 543 | } | |
| 544 | try w.writeAll(" }"); | |
| 545 | }, | |
| 546 | } | |
| 547 | } | |
| 548 | ||
| 549 | fn writeValue(ir: Ir, val_ref: Interner.Ref, color: bool, w: anytype) !void { | |
| 550 | const v = ir.pool.get(val_ref).value; | |
| 551 | if (color) util.setColor(LITERAL, w); | |
| 552 | switch (v.tag) { | |
| 553 | .unavailable => try w.writeAll(" unavailable"), | |
| 554 | .int => try w.print("{d}", .{v.data.int}), | |
| 555 | .bytes => try w.print("\"{s}\"", .{v.data.bytes.slice(ir.strings)}), | |
| 556 | // std.fmt does @as instead of @floatCast | |
| 557 | .float => try w.print("{d}", .{@as(f64, @floatCast(v.data.float))}), | |
| 558 | else => try w.print("({s})", .{@tagName(v.tag)}), | |
| 559 | } | |
| 560 | } | |
| 561 | ||
| 562 | fn writeRef(ir: Ir, ref_map: *RefMap, ref: Ref, color: bool, w: anytype) !void { | |
| 563 | assert(ref != .none); | |
| 564 | const index = @intFromEnum(ref); | |
| 565 | const ty_ref = ir.instructions.items(.ty)[index]; | |
| 566 | if (ir.instructions.items(.tag)[index] == .constant) { | |
| 567 | try ir.writeType(ty_ref, color, w); | |
| 568 | const v_ref = ir.instructions.items(.data)[index].constant; | |
| 569 | try w.writeByte(' '); | |
| 570 | try ir.writeValue(v_ref, color, w); | |
| 571 | return; | |
| 572 | } else if (ir.instructions.items(.tag)[index] == .symbol) { | |
| 573 | const name = ir.instructions.items(.data)[index].label; | |
| 574 | try ir.writeType(ty_ref, color, w); | |
| 575 | if (color) util.setColor(REF, w); | |
| 576 | try w.print(" @{s}", .{name}); | |
| 577 | return; | |
| 578 | } | |
| 579 | try ir.writeType(ty_ref, color, w); | |
| 580 | if (color) util.setColor(REF, w); | |
| 581 | const ref_index = ref_map.getIndex(ref).?; | |
| 582 | try w.print(" %{d}", .{ref_index}); | |
| 583 | } | |
| 584 | ||
| 585 | fn writeNewRef(ir: Ir, ref_map: *RefMap, ref: Ref, color: bool, w: anytype) !void { | |
| 586 | try ref_map.put(ref, {}); | |
| 587 | try w.writeAll(" "); | |
| 588 | try ir.writeRef(ref_map, ref, color, w); | |
| 589 | if (color) util.setColor(.reset, w); | |
| 590 | try w.writeAll(" = "); | |
| 591 | if (color) util.setColor(INST, w); | |
| 592 | } | |
| 593 | ||
| 594 | fn writeLabel(ir: Ir, label_map: *RefMap, ref: Ref, color: bool, w: anytype) !void { | |
| 595 | assert(ref != .none); | |
| 596 | const index = @intFromEnum(ref); | |
| 597 | const label = ir.instructions.items(.data)[index].label; | |
| 598 | if (color) util.setColor(REF, w); | |
| 599 | const label_index = label_map.getIndex(ref).?; | |
| 600 | try w.print("{s}.{d}", .{ label, label_index }); | |
| 601 | } |
deps/aro/LangOpts.zig created+146| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | const std = @import("std"); | |
| 2 | const DiagnosticTag = @import("Diagnostics.zig").Tag; | |
| 3 | ||
| 4 | const LangOpts = @This(); | |
| 5 | ||
| 6 | pub const Compiler = enum { | |
| 7 | clang, | |
| 8 | gcc, | |
| 9 | msvc, | |
| 10 | }; | |
| 11 | ||
| 12 | /// The floating-point evaluation method for intermediate results within a single expression | |
| 13 | pub const FPEvalMethod = enum(i8) { | |
| 14 | /// The evaluation method cannot be determined or is inconsistent for this target. | |
| 15 | indeterminate = -1, | |
| 16 | /// Use the type declared in the source | |
| 17 | source = 0, | |
| 18 | /// Use double as the floating-point evaluation method for all float expressions narrower than double. | |
| 19 | double = 1, | |
| 20 | /// Use long double as the floating-point evaluation method for all float expressions narrower than long double. | |
| 21 | extended = 2, | |
| 22 | }; | |
| 23 | ||
| 24 | pub const Standard = enum { | |
| 25 | /// ISO C 1990 | |
| 26 | c89, | |
| 27 | /// ISO C 1990 with amendment 1 | |
| 28 | iso9899, | |
| 29 | /// ISO C 1990 with GNU extensions | |
| 30 | gnu89, | |
| 31 | /// ISO C 1999 | |
| 32 | c99, | |
| 33 | /// ISO C 1999 with GNU extensions | |
| 34 | gnu99, | |
| 35 | /// ISO C 2011 | |
| 36 | c11, | |
| 37 | /// ISO C 2011 with GNU extensions | |
| 38 | gnu11, | |
| 39 | /// ISO C 2017 | |
| 40 | c17, | |
| 41 | /// Default value if nothing specified; adds the GNU keywords to | |
| 42 | /// C17 but does not suppress warnings about using GNU extensions | |
| 43 | default, | |
| 44 | /// ISO C 2017 with GNU extensions | |
| 45 | gnu17, | |
| 46 | /// Working Draft for ISO C2x | |
| 47 | c2x, | |
| 48 | /// Working Draft for ISO C2x with GNU extensions | |
| 49 | gnu2x, | |
| 50 | ||
| 51 | const NameMap = std.ComptimeStringMap(Standard, .{ | |
| 52 | .{ "c89", .c89 }, .{ "c90", .c89 }, .{ "iso9899:1990", .c89 }, | |
| 53 | .{ "iso9899:199409", .iso9899 }, .{ "gnu89", .gnu89 }, .{ "gnu90", .gnu89 }, | |
| 54 | .{ "c99", .c99 }, .{ "iso9899:1999", .c99 }, .{ "gnu99", .gnu99 }, | |
| 55 | .{ "c11", .c11 }, .{ "iso9899:2011", .c11 }, .{ "gnu11", .gnu11 }, | |
| 56 | .{ "c17", .c17 }, .{ "iso9899:2017", .c17 }, .{ "c18", .c17 }, | |
| 57 | .{ "iso9899:2018", .c17 }, .{ "gnu17", .gnu17 }, .{ "gnu18", .gnu17 }, | |
| 58 | .{ "c2x", .c2x }, .{ "gnu2x", .gnu2x }, | |
| 59 | }); | |
| 60 | ||
| 61 | pub fn atLeast(self: Standard, other: Standard) bool { | |
| 62 | return @intFromEnum(self) >= @intFromEnum(other); | |
| 63 | } | |
| 64 | ||
| 65 | pub fn isGNU(standard: Standard) bool { | |
| 66 | return switch (standard) { | |
| 67 | .gnu89, .gnu99, .gnu11, .default, .gnu17, .gnu2x => true, | |
| 68 | else => false, | |
| 69 | }; | |
| 70 | } | |
| 71 | ||
| 72 | pub fn isExplicitGNU(standard: Standard) bool { | |
| 73 | return standard.isGNU() and standard != .default; | |
| 74 | } | |
| 75 | ||
| 76 | /// Value reported by __STDC_VERSION__ macro | |
| 77 | pub fn StdCVersionMacro(standard: Standard) ?[]const u8 { | |
| 78 | return switch (standard) { | |
| 79 | .c89, .gnu89 => null, | |
| 80 | .iso9899 => "199409L", | |
| 81 | .c99, .gnu99 => "199901L", | |
| 82 | .c11, .gnu11 => "201112L", | |
| 83 | .default, .c17, .gnu17 => "201710L", | |
| 84 | // todo: subject to change, verify once c23 finalized | |
| 85 | .c2x, .gnu2x => "202311L", | |
| 86 | }; | |
| 87 | } | |
| 88 | }; | |
| 89 | ||
| 90 | emulate: Compiler = .clang, | |
| 91 | standard: Standard = .default, | |
| 92 | /// -fshort-enums option, makes enums only take up as much space as they need to hold all the values. | |
| 93 | short_enums: bool = false, | |
| 94 | dollars_in_identifiers: bool = true, | |
| 95 | declspec_attrs: bool = false, | |
| 96 | ms_extensions: bool = false, | |
| 97 | /// true or false if digraph support explicitly enabled/disabled with -fdigraphs/-fno-digraphs | |
| 98 | digraphs: ?bool = null, | |
| 99 | /// If set, use the native half type instead of promoting to float | |
| 100 | use_native_half_type: bool = false, | |
| 101 | /// If set, function arguments and return values may be of type __fp16 even if there is no standard ABI for it | |
| 102 | allow_half_args_and_returns: bool = false, | |
| 103 | /// null indicates that the user did not select a value, use target to determine default | |
| 104 | fp_eval_method: ?FPEvalMethod = null, | |
| 105 | /// If set, use specified signedness for `char` instead of the target's default char signedness | |
| 106 | char_signedness_override: ?std.builtin.Signedness = null, | |
| 107 | /// If set, override the default availability of char8_t (by default, enabled in C2X and later; disabled otherwise) | |
| 108 | has_char8_t_override: ?bool = null, | |
| 109 | ||
| 110 | /// Whether to allow GNU-style inline assembly | |
| 111 | gnu_asm: bool = true, | |
| 112 | ||
| 113 | pub fn setStandard(self: *LangOpts, name: []const u8) error{InvalidStandard}!void { | |
| 114 | self.standard = Standard.NameMap.get(name) orelse return error.InvalidStandard; | |
| 115 | } | |
| 116 | ||
| 117 | pub fn enableMSExtensions(self: *LangOpts) void { | |
| 118 | self.declspec_attrs = true; | |
| 119 | self.ms_extensions = true; | |
| 120 | } | |
| 121 | ||
| 122 | pub fn disableMSExtensions(self: *LangOpts) void { | |
| 123 | self.declspec_attrs = false; | |
| 124 | self.ms_extensions = true; | |
| 125 | } | |
| 126 | ||
| 127 | pub fn hasChar8_T(self: *const LangOpts) bool { | |
| 128 | return self.has_char8_t_override orelse self.standard.atLeast(.c2x); | |
| 129 | } | |
| 130 | ||
| 131 | pub fn hasDigraphs(self: *const LangOpts) bool { | |
| 132 | return self.digraphs orelse self.standard.atLeast(.gnu89); | |
| 133 | } | |
| 134 | ||
| 135 | pub fn setEmulatedCompiler(self: *LangOpts, compiler: Compiler) void { | |
| 136 | self.emulate = compiler; | |
| 137 | if (compiler == .msvc) self.enableMSExtensions(); | |
| 138 | } | |
| 139 | ||
| 140 | pub fn setFpEvalMethod(self: *LangOpts, fp_eval_method: FPEvalMethod) void { | |
| 141 | self.fp_eval_method = fp_eval_method; | |
| 142 | } | |
| 143 | ||
| 144 | pub fn setCharSignedness(self: *LangOpts, signedness: std.builtin.Signedness) void { | |
| 145 | self.char_signedness_override = signedness; | |
| 146 | } |
deps/aro/Object.zig created+73| ... | ... | @@ -0,0 +1,73 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Compilation = @import("Compilation.zig"); | |
| 3 | const Elf = @import("object/Elf.zig"); | |
| 4 | ||
| 5 | const Object = @This(); | |
| 6 | ||
| 7 | format: std.Target.ObjectFormat, | |
| 8 | comp: *Compilation, | |
| 9 | ||
| 10 | pub fn create(comp: *Compilation) !*Object { | |
| 11 | switch (comp.target.ofmt) { | |
| 12 | .elf => return Elf.create(comp), | |
| 13 | else => unreachable, | |
| 14 | } | |
| 15 | } | |
| 16 | ||
| 17 | pub fn deinit(obj: *Object) void { | |
| 18 | switch (obj.format) { | |
| 19 | .elf => @fieldParentPtr(Elf, "obj", obj).deinit(), | |
| 20 | else => unreachable, | |
| 21 | } | |
| 22 | } | |
| 23 | ||
| 24 | pub const Section = union(enum) { | |
| 25 | undefined, | |
| 26 | data, | |
| 27 | read_only_data, | |
| 28 | func, | |
| 29 | strings, | |
| 30 | custom: []const u8, | |
| 31 | }; | |
| 32 | ||
| 33 | pub fn getSection(obj: *Object, section: Section) !*std.ArrayList(u8) { | |
| 34 | switch (obj.format) { | |
| 35 | .elf => return @fieldParentPtr(Elf, "obj", obj).getSection(section), | |
| 36 | else => unreachable, | |
| 37 | } | |
| 38 | } | |
| 39 | ||
| 40 | pub const SymbolType = enum { | |
| 41 | func, | |
| 42 | variable, | |
| 43 | external, | |
| 44 | }; | |
| 45 | ||
| 46 | pub fn declareSymbol( | |
| 47 | obj: *Object, | |
| 48 | section: Section, | |
| 49 | name: ?[]const u8, | |
| 50 | linkage: std.builtin.GlobalLinkage, | |
| 51 | @"type": SymbolType, | |
| 52 | offset: u64, | |
| 53 | size: u64, | |
| 54 | ) ![]const u8 { | |
| 55 | switch (obj.format) { | |
| 56 | .elf => return @fieldParentPtr(Elf, "obj", obj).declareSymbol(section, name, linkage, @"type", offset, size), | |
| 57 | else => unreachable, | |
| 58 | } | |
| 59 | } | |
| 60 | ||
| 61 | pub fn addRelocation(obj: *Object, name: []const u8, section: Section, address: u64, addend: i64) !void { | |
| 62 | switch (obj.format) { | |
| 63 | .elf => return @fieldParentPtr(Elf, "obj", obj).addRelocation(name, section, address, addend), | |
| 64 | else => unreachable, | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| 68 | pub fn finish(obj: *Object, file: std.fs.File) !void { | |
| 69 | switch (obj.format) { | |
| 70 | .elf => return @fieldParentPtr(Elf, "obj", obj).finish(file), | |
| 71 | else => unreachable, | |
| 72 | } | |
| 73 | } |
deps/aro/Parser.zig created+8200| ... | ... | @@ -0,0 +1,8200 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Allocator = mem.Allocator; | |
| 4 | const assert = std.debug.assert; | |
| 5 | const big = std.math.big; | |
| 6 | const Compilation = @import("Compilation.zig"); | |
| 7 | const Source = @import("Source.zig"); | |
| 8 | const Tokenizer = @import("Tokenizer.zig"); | |
| 9 | const Preprocessor = @import("Preprocessor.zig"); | |
| 10 | const Tree = @import("Tree.zig"); | |
| 11 | const Token = Tree.Token; | |
| 12 | const TokenIndex = Tree.TokenIndex; | |
| 13 | const NodeIndex = Tree.NodeIndex; | |
| 14 | const Type = @import("Type.zig"); | |
| 15 | const Diagnostics = @import("Diagnostics.zig"); | |
| 16 | const NodeList = std.ArrayList(NodeIndex); | |
| 17 | const InitList = @import("InitList.zig"); | |
| 18 | const Attribute = @import("Attribute.zig"); | |
| 19 | const CharInfo = @import("CharInfo.zig"); | |
| 20 | const Value = @import("Value.zig"); | |
| 21 | const SymbolStack = @import("SymbolStack.zig"); | |
| 22 | const Symbol = SymbolStack.Symbol; | |
| 23 | const record_layout = @import("record_layout.zig"); | |
| 24 | const StringId = @import("StringInterner.zig").StringId; | |
| 25 | const number_affixes = @import("number_affixes.zig"); | |
| 26 | const NumberPrefix = number_affixes.Prefix; | |
| 27 | const NumberSuffix = number_affixes.Suffix; | |
| 28 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 29 | const target_util = @import("target.zig"); | |
| 30 | ||
| 31 | const Parser = @This(); | |
| 32 | ||
| 33 | const Switch = struct { | |
| 34 | default: ?TokenIndex = null, | |
| 35 | ranges: std.ArrayList(Range), | |
| 36 | ty: Type, | |
| 37 | ||
| 38 | const Range = struct { | |
| 39 | first: Value, | |
| 40 | last: Value, | |
| 41 | tok: TokenIndex, | |
| 42 | }; | |
| 43 | ||
| 44 | fn add( | |
| 45 | self: *Switch, | |
| 46 | comp: *Compilation, | |
| 47 | first: Value, | |
| 48 | last: Value, | |
| 49 | tok: TokenIndex, | |
| 50 | ) !?Range { | |
| 51 | for (self.ranges.items) |range| { | |
| 52 | if (last.compare(.gte, range.first, self.ty, comp) and first.compare(.lte, range.last, self.ty, comp)) { | |
| 53 | return range; // They overlap. | |
| 54 | } | |
| 55 | } | |
| 56 | try self.ranges.append(.{ | |
| 57 | .first = first, | |
| 58 | .last = last, | |
| 59 | .tok = tok, | |
| 60 | }); | |
| 61 | return null; | |
| 62 | } | |
| 63 | }; | |
| 64 | ||
| 65 | const Label = union(enum) { | |
| 66 | unresolved_goto: TokenIndex, | |
| 67 | label: TokenIndex, | |
| 68 | }; | |
| 69 | ||
| 70 | pub const Error = Compilation.Error || error{ParsingFailed}; | |
| 71 | ||
| 72 | /// An attribute that has been parsed but not yet validated in its context | |
| 73 | const TentativeAttribute = struct { | |
| 74 | attr: Attribute, | |
| 75 | tok: TokenIndex, | |
| 76 | }; | |
| 77 | ||
| 78 | /// How the parser handles const int decl references when it is expecting an integer | |
| 79 | /// constant expression. | |
| 80 | const ConstDeclFoldingMode = enum { | |
| 81 | /// fold const decls as if they were literals | |
| 82 | fold_const_decls, | |
| 83 | /// fold const decls as if they were literals and issue GNU extension diagnostic | |
| 84 | gnu_folding_extension, | |
| 85 | /// fold const decls as if they were literals and issue VLA diagnostic | |
| 86 | gnu_vla_folding_extension, | |
| 87 | /// folding const decls is prohibited; return an unavailable value | |
| 88 | no_const_decl_folding, | |
| 89 | }; | |
| 90 | ||
| 91 | // values from preprocessor | |
| 92 | pp: *Preprocessor, | |
| 93 | comp: *Compilation, | |
| 94 | gpa: mem.Allocator, | |
| 95 | tok_ids: []const Token.Id, | |
| 96 | tok_i: TokenIndex = 0, | |
| 97 | ||
| 98 | // values of the incomplete Tree | |
| 99 | arena: Allocator, | |
| 100 | nodes: Tree.Node.List = .{}, | |
| 101 | data: NodeList, | |
| 102 | retained_strings: std.ArrayList(u8), | |
| 103 | value_map: Tree.ValueMap, | |
| 104 | ||
| 105 | // buffers used during compilation | |
| 106 | syms: SymbolStack = .{}, | |
| 107 | strings: std.ArrayList(u8), | |
| 108 | labels: std.ArrayList(Label), | |
| 109 | list_buf: NodeList, | |
| 110 | decl_buf: NodeList, | |
| 111 | param_buf: std.ArrayList(Type.Func.Param), | |
| 112 | enum_buf: std.ArrayList(Type.Enum.Field), | |
| 113 | record_buf: std.ArrayList(Type.Record.Field), | |
| 114 | attr_buf: std.MultiArrayList(TentativeAttribute) = .{}, | |
| 115 | attr_application_buf: std.ArrayListUnmanaged(Attribute) = .{}, | |
| 116 | field_attr_buf: std.ArrayList([]const Attribute), | |
| 117 | /// type name -> variable name location for tentative definitions (top-level defs with thus-far-incomplete types) | |
| 118 | /// e.g. `struct Foo bar;` where `struct Foo` is not defined yet. | |
| 119 | /// The key is the StringId of `Foo` and the value is the TokenIndex of `bar` | |
| 120 | /// Items are removed if the type is subsequently completed with a definition. | |
| 121 | /// We only store the first tentative definition that uses a given type because this map is only used | |
| 122 | /// for issuing an error message, and correcting the first error for a type will fix all of them for that type. | |
| 123 | tentative_defs: std.AutoHashMapUnmanaged(StringId, TokenIndex) = .{}, | |
| 124 | ||
| 125 | // configuration and miscellaneous info | |
| 126 | no_eval: bool = false, | |
| 127 | in_macro: bool = false, | |
| 128 | extension_suppressed: bool = false, | |
| 129 | contains_address_of_label: bool = false, | |
| 130 | label_count: u32 = 0, | |
| 131 | const_decl_folding: ConstDeclFoldingMode = .fold_const_decls, | |
| 132 | /// location of first computed goto in function currently being parsed | |
| 133 | /// if a computed goto is used, the function must contain an | |
| 134 | /// address-of-label expression (tracked with contains_address_of_label) | |
| 135 | computed_goto_tok: ?TokenIndex = null, | |
| 136 | ||
| 137 | /// Various variables that are different for each function. | |
| 138 | func: struct { | |
| 139 | /// null if not in function, will always be plain func, var_args_func or old_style_func | |
| 140 | ty: ?Type = null, | |
| 141 | name: TokenIndex = 0, | |
| 142 | ident: ?Result = null, | |
| 143 | pretty_ident: ?Result = null, | |
| 144 | } = .{}, | |
| 145 | /// Various variables that are different for each record. | |
| 146 | record: struct { | |
| 147 | // invalid means we're not parsing a record | |
| 148 | kind: Token.Id = .invalid, | |
| 149 | flexible_field: ?TokenIndex = null, | |
| 150 | start: usize = 0, | |
| 151 | field_attr_start: usize = 0, | |
| 152 | ||
| 153 | fn addField(r: @This(), p: *Parser, name: StringId, tok: TokenIndex) Error!void { | |
| 154 | var i = p.record_members.items.len; | |
| 155 | while (i > r.start) { | |
| 156 | i -= 1; | |
| 157 | if (p.record_members.items[i].name == name) { | |
| 158 | try p.errStr(.duplicate_member, tok, p.tokSlice(tok)); | |
| 159 | try p.errTok(.previous_definition, p.record_members.items[i].tok); | |
| 160 | break; | |
| 161 | } | |
| 162 | } | |
| 163 | try p.record_members.append(p.gpa, .{ .name = name, .tok = tok }); | |
| 164 | } | |
| 165 | ||
| 166 | fn addFieldsFromAnonymous(r: @This(), p: *Parser, ty: Type) Error!void { | |
| 167 | for (ty.data.record.fields) |f| { | |
| 168 | if (f.isAnonymousRecord()) { | |
| 169 | try r.addFieldsFromAnonymous(p, f.ty.canonicalize(.standard)); | |
| 170 | } else if (f.name_tok != 0) { | |
| 171 | try r.addField(p, f.name, f.name_tok); | |
| 172 | } | |
| 173 | } | |
| 174 | } | |
| 175 | } = .{}, | |
| 176 | record_members: std.ArrayListUnmanaged(struct { tok: TokenIndex, name: StringId }) = .{}, | |
| 177 | @"switch": ?*Switch = null, | |
| 178 | in_loop: bool = false, | |
| 179 | pragma_pack: ?u8 = null, | |
| 180 | string_ids: struct { | |
| 181 | declspec_id: StringId, | |
| 182 | main_id: StringId, | |
| 183 | file: StringId, | |
| 184 | jmp_buf: StringId, | |
| 185 | sigjmp_buf: StringId, | |
| 186 | ucontext_t: StringId, | |
| 187 | }, | |
| 188 | ||
| 189 | fn checkIdentifierCodepoint(comp: *Compilation, codepoint: u21, loc: Source.Location) Compilation.Error!bool { | |
| 190 | if (codepoint <= 0x7F) return false; | |
| 191 | var diagnosed = false; | |
| 192 | if (!CharInfo.isC99IdChar(codepoint)) { | |
| 193 | try comp.diag.add(.{ | |
| 194 | .tag = .c99_compat, | |
| 195 | .loc = loc, | |
| 196 | }, &.{}); | |
| 197 | diagnosed = true; | |
| 198 | } | |
| 199 | if (CharInfo.isInvisible(codepoint)) { | |
| 200 | try comp.diag.add(.{ | |
| 201 | .tag = .unicode_zero_width, | |
| 202 | .loc = loc, | |
| 203 | .extra = .{ .actual_codepoint = codepoint }, | |
| 204 | }, &.{}); | |
| 205 | diagnosed = true; | |
| 206 | } | |
| 207 | if (CharInfo.homoglyph(codepoint)) |resembles| { | |
| 208 | try comp.diag.add(.{ | |
| 209 | .tag = .unicode_homoglyph, | |
| 210 | .loc = loc, | |
| 211 | .extra = .{ .codepoints = .{ .actual = codepoint, .resembles = resembles } }, | |
| 212 | }, &.{}); | |
| 213 | diagnosed = true; | |
| 214 | } | |
| 215 | return diagnosed; | |
| 216 | } | |
| 217 | ||
| 218 | fn eatIdentifier(p: *Parser) !?TokenIndex { | |
| 219 | switch (p.tok_ids[p.tok_i]) { | |
| 220 | .identifier => {}, | |
| 221 | .extended_identifier => { | |
| 222 | const slice = p.tokSlice(p.tok_i); | |
| 223 | var it = std.unicode.Utf8View.initUnchecked(slice).iterator(); | |
| 224 | var loc = p.pp.tokens.items(.loc)[p.tok_i]; | |
| 225 | ||
| 226 | if (mem.indexOfScalar(u8, slice, '$')) |i| { | |
| 227 | loc.byte_offset += @intCast(i); | |
| 228 | try p.comp.diag.add(.{ | |
| 229 | .tag = .dollar_in_identifier_extension, | |
| 230 | .loc = loc, | |
| 231 | }, &.{}); | |
| 232 | loc = p.pp.tokens.items(.loc)[p.tok_i]; | |
| 233 | } | |
| 234 | ||
| 235 | while (it.nextCodepoint()) |c| { | |
| 236 | if (try checkIdentifierCodepoint(p.comp, c, loc)) break; | |
| 237 | loc.byte_offset += std.unicode.utf8CodepointSequenceLength(c) catch unreachable; | |
| 238 | } | |
| 239 | }, | |
| 240 | else => return null, | |
| 241 | } | |
| 242 | p.tok_i += 1; | |
| 243 | ||
| 244 | // Handle illegal '$' characters in identifiers | |
| 245 | if (!p.comp.langopts.dollars_in_identifiers) { | |
| 246 | if (p.tok_ids[p.tok_i] == .invalid and p.tokSlice(p.tok_i)[0] == '$') { | |
| 247 | try p.err(.dollars_in_identifiers); | |
| 248 | p.tok_i += 1; | |
| 249 | return error.ParsingFailed; | |
| 250 | } | |
| 251 | } | |
| 252 | ||
| 253 | return p.tok_i - 1; | |
| 254 | } | |
| 255 | ||
| 256 | fn expectIdentifier(p: *Parser) Error!TokenIndex { | |
| 257 | const actual = p.tok_ids[p.tok_i]; | |
| 258 | if (actual != .identifier and actual != .extended_identifier) { | |
| 259 | return p.errExpectedToken(.identifier, actual); | |
| 260 | } | |
| 261 | ||
| 262 | return (try p.eatIdentifier()) orelse unreachable; | |
| 263 | } | |
| 264 | ||
| 265 | fn eatToken(p: *Parser, id: Token.Id) ?TokenIndex { | |
| 266 | assert(id != .identifier and id != .extended_identifier); // use eatIdentifier | |
| 267 | if (p.tok_ids[p.tok_i] == id) { | |
| 268 | defer p.tok_i += 1; | |
| 269 | return p.tok_i; | |
| 270 | } else return null; | |
| 271 | } | |
| 272 | ||
| 273 | fn expectToken(p: *Parser, expected: Token.Id) Error!TokenIndex { | |
| 274 | assert(expected != .identifier and expected != .extended_identifier); // use expectIdentifier | |
| 275 | const actual = p.tok_ids[p.tok_i]; | |
| 276 | if (actual != expected) return p.errExpectedToken(expected, actual); | |
| 277 | defer p.tok_i += 1; | |
| 278 | return p.tok_i; | |
| 279 | } | |
| 280 | ||
| 281 | pub fn tokSlice(p: *Parser, tok: TokenIndex) []const u8 { | |
| 282 | if (p.tok_ids[tok].lexeme()) |some| return some; | |
| 283 | const loc = p.pp.tokens.items(.loc)[tok]; | |
| 284 | var tmp_tokenizer = Tokenizer{ | |
| 285 | .buf = p.comp.getSource(loc.id).buf, | |
| 286 | .comp = p.comp, | |
| 287 | .index = loc.byte_offset, | |
| 288 | .source = .generated, | |
| 289 | }; | |
| 290 | const res = tmp_tokenizer.next(); | |
| 291 | return tmp_tokenizer.buf[res.start..res.end]; | |
| 292 | } | |
| 293 | ||
| 294 | fn expectClosing(p: *Parser, opening: TokenIndex, id: Token.Id) Error!void { | |
| 295 | _ = p.expectToken(id) catch |e| { | |
| 296 | if (e == error.ParsingFailed) { | |
| 297 | try p.errTok(switch (id) { | |
| 298 | .r_paren => .to_match_paren, | |
| 299 | .r_brace => .to_match_brace, | |
| 300 | .r_bracket => .to_match_brace, | |
| 301 | else => unreachable, | |
| 302 | }, opening); | |
| 303 | } | |
| 304 | return e; | |
| 305 | }; | |
| 306 | } | |
| 307 | ||
| 308 | fn errOverflow(p: *Parser, op_tok: TokenIndex, res: Result) !void { | |
| 309 | if (res.ty.isUnsignedInt(p.comp)) { | |
| 310 | try p.errExtra(.overflow_unsigned, op_tok, .{ .unsigned = res.val.data.int }); | |
| 311 | } else { | |
| 312 | try p.errExtra(.overflow_signed, op_tok, .{ .signed = res.val.signExtend(res.ty, p.comp) }); | |
| 313 | } | |
| 314 | } | |
| 315 | ||
| 316 | fn errExpectedToken(p: *Parser, expected: Token.Id, actual: Token.Id) Error { | |
| 317 | switch (actual) { | |
| 318 | .invalid => try p.errExtra(.expected_invalid, p.tok_i, .{ .tok_id_expected = expected }), | |
| 319 | .eof => try p.errExtra(.expected_eof, p.tok_i, .{ .tok_id_expected = expected }), | |
| 320 | else => try p.errExtra(.expected_token, p.tok_i, .{ .tok_id = .{ | |
| 321 | .expected = expected, | |
| 322 | .actual = actual, | |
| 323 | } }), | |
| 324 | } | |
| 325 | return error.ParsingFailed; | |
| 326 | } | |
| 327 | ||
| 328 | pub fn errStr(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, str: []const u8) Compilation.Error!void { | |
| 329 | @setCold(true); | |
| 330 | return p.errExtra(tag, tok_i, .{ .str = str }); | |
| 331 | } | |
| 332 | ||
| 333 | pub fn errExtra(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, extra: Diagnostics.Message.Extra) Compilation.Error!void { | |
| 334 | @setCold(true); | |
| 335 | const tok = p.pp.tokens.get(tok_i); | |
| 336 | var loc = tok.loc; | |
| 337 | if (tok_i != 0 and tok.id == .eof) { | |
| 338 | // if the token is EOF, point at the end of the previous token instead | |
| 339 | const prev = p.pp.tokens.get(tok_i - 1); | |
| 340 | loc = prev.loc; | |
| 341 | loc.byte_offset += @intCast(p.tokSlice(tok_i - 1).len); | |
| 342 | } | |
| 343 | try p.comp.diag.add(.{ | |
| 344 | .tag = tag, | |
| 345 | .loc = loc, | |
| 346 | .extra = extra, | |
| 347 | }, tok.expansionSlice()); | |
| 348 | } | |
| 349 | ||
| 350 | pub fn errTok(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex) Compilation.Error!void { | |
| 351 | @setCold(true); | |
| 352 | return p.errExtra(tag, tok_i, .{ .none = {} }); | |
| 353 | } | |
| 354 | ||
| 355 | pub fn err(p: *Parser, tag: Diagnostics.Tag) Compilation.Error!void { | |
| 356 | @setCold(true); | |
| 357 | return p.errExtra(tag, p.tok_i, .{ .none = {} }); | |
| 358 | } | |
| 359 | ||
| 360 | pub fn todo(p: *Parser, msg: []const u8) Error { | |
| 361 | try p.errStr(.todo, p.tok_i, msg); | |
| 362 | return error.ParsingFailed; | |
| 363 | } | |
| 364 | ||
| 365 | pub fn typeStr(p: *Parser, ty: Type) ![]const u8 { | |
| 366 | if (Type.Builder.fromType(ty).str(p.comp.langopts)) |str| return str; | |
| 367 | const strings_top = p.strings.items.len; | |
| 368 | defer p.strings.items.len = strings_top; | |
| 369 | ||
| 370 | const mapper = p.comp.string_interner.getSlowTypeMapper(); | |
| 371 | try ty.print(mapper, p.comp.langopts, p.strings.writer()); | |
| 372 | return try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 373 | } | |
| 374 | ||
| 375 | pub fn typePairStr(p: *Parser, a: Type, b: Type) ![]const u8 { | |
| 376 | return p.typePairStrExtra(a, " and ", b); | |
| 377 | } | |
| 378 | ||
| 379 | pub fn typePairStrExtra(p: *Parser, a: Type, msg: []const u8, b: Type) ![]const u8 { | |
| 380 | const strings_top = p.strings.items.len; | |
| 381 | defer p.strings.items.len = strings_top; | |
| 382 | ||
| 383 | try p.strings.append('\''); | |
| 384 | const mapper = p.comp.string_interner.getSlowTypeMapper(); | |
| 385 | try a.print(mapper, p.comp.langopts, p.strings.writer()); | |
| 386 | try p.strings.append('\''); | |
| 387 | try p.strings.appendSlice(msg); | |
| 388 | try p.strings.append('\''); | |
| 389 | try b.print(mapper, p.comp.langopts, p.strings.writer()); | |
| 390 | try p.strings.append('\''); | |
| 391 | return try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 392 | } | |
| 393 | ||
| 394 | pub fn floatValueChangedStr(p: *Parser, res: *Result, old_value: f64, int_ty: Type) ![]const u8 { | |
| 395 | const strings_top = p.strings.items.len; | |
| 396 | defer p.strings.items.len = strings_top; | |
| 397 | ||
| 398 | var w = p.strings.writer(); | |
| 399 | const type_pair_str = try p.typePairStrExtra(res.ty, " to ", int_ty); | |
| 400 | try w.writeAll(type_pair_str); | |
| 401 | const is_zero = res.val.isZero(); | |
| 402 | const non_zero_str: []const u8 = if (is_zero) "non-zero " else ""; | |
| 403 | if (int_ty.is(.bool)) { | |
| 404 | try w.print(" changes {s}value from {d} to {}", .{ non_zero_str, old_value, res.val.getBool() }); | |
| 405 | } else if (int_ty.isUnsignedInt(p.comp)) { | |
| 406 | try w.print(" changes {s}value from {d} to {d}", .{ non_zero_str, old_value, res.val.getInt(u64) }); | |
| 407 | } else { | |
| 408 | try w.print(" changes {s}value from {d} to {d}", .{ non_zero_str, old_value, res.val.getInt(i64) }); | |
| 409 | } | |
| 410 | ||
| 411 | return try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 412 | } | |
| 413 | ||
| 414 | fn checkDeprecatedUnavailable(p: *Parser, ty: Type, usage_tok: TokenIndex, decl_tok: TokenIndex) !void { | |
| 415 | if (ty.getAttribute(.@"error")) |@"error"| { | |
| 416 | const strings_top = p.strings.items.len; | |
| 417 | defer p.strings.items.len = strings_top; | |
| 418 | ||
| 419 | const w = p.strings.writer(); | |
| 420 | const msg_str = p.retainedString(@"error".msg); | |
| 421 | try w.print("call to '{s}' declared with attribute error: {s}", .{ p.tokSlice(@"error".__name_tok), msg_str }); | |
| 422 | const str = try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 423 | try p.errStr(.error_attribute, usage_tok, str); | |
| 424 | } | |
| 425 | if (ty.getAttribute(.warning)) |warning| { | |
| 426 | const strings_top = p.strings.items.len; | |
| 427 | defer p.strings.items.len = strings_top; | |
| 428 | ||
| 429 | const w = p.strings.writer(); | |
| 430 | const msg_str = p.retainedString(warning.msg); | |
| 431 | try w.print("call to '{s}' declared with attribute warning: {s}", .{ p.tokSlice(warning.__name_tok), msg_str }); | |
| 432 | const str = try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 433 | try p.errStr(.warning_attribute, usage_tok, str); | |
| 434 | } | |
| 435 | if (ty.getAttribute(.unavailable)) |unavailable| { | |
| 436 | try p.errDeprecated(.unavailable, usage_tok, unavailable.msg); | |
| 437 | try p.errStr(.unavailable_note, unavailable.__name_tok, p.tokSlice(decl_tok)); | |
| 438 | return error.ParsingFailed; | |
| 439 | } else if (ty.getAttribute(.deprecated)) |deprecated| { | |
| 440 | try p.errDeprecated(.deprecated_declarations, usage_tok, deprecated.msg); | |
| 441 | try p.errStr(.deprecated_note, deprecated.__name_tok, p.tokSlice(decl_tok)); | |
| 442 | } | |
| 443 | } | |
| 444 | ||
| 445 | /// Returned slice is invalidated if additional strings are added to p.retained_strings | |
| 446 | fn retainedString(p: *Parser, range: Value.ByteRange) []const u8 { | |
| 447 | return range.slice(p.retained_strings.items); | |
| 448 | } | |
| 449 | ||
| 450 | fn errDeprecated(p: *Parser, tag: Diagnostics.Tag, tok_i: TokenIndex, msg: ?Value.ByteRange) Compilation.Error!void { | |
| 451 | const strings_top = p.strings.items.len; | |
| 452 | defer p.strings.items.len = strings_top; | |
| 453 | ||
| 454 | const w = p.strings.writer(); | |
| 455 | try w.print("'{s}' is ", .{p.tokSlice(tok_i)}); | |
| 456 | const reason: []const u8 = switch (tag) { | |
| 457 | .unavailable => "unavailable", | |
| 458 | .deprecated_declarations => "deprecated", | |
| 459 | else => unreachable, | |
| 460 | }; | |
| 461 | try w.writeAll(reason); | |
| 462 | if (msg) |m| { | |
| 463 | const str = p.retainedString(m); | |
| 464 | try w.print(": {s}", .{str}); | |
| 465 | } | |
| 466 | const str = try p.comp.diag.arena.allocator().dupe(u8, p.strings.items[strings_top..]); | |
| 467 | return p.errStr(tag, tok_i, str); | |
| 468 | } | |
| 469 | ||
| 470 | fn addNode(p: *Parser, node: Tree.Node) Allocator.Error!NodeIndex { | |
| 471 | if (p.in_macro) return .none; | |
| 472 | const res = p.nodes.len; | |
| 473 | try p.nodes.append(p.gpa, node); | |
| 474 | return @enumFromInt(res); | |
| 475 | } | |
| 476 | ||
| 477 | fn addList(p: *Parser, nodes: []const NodeIndex) Allocator.Error!Tree.Node.Range { | |
| 478 | if (p.in_macro) return Tree.Node.Range{ .start = 0, .end = 0 }; | |
| 479 | const start: u32 = @intCast(p.data.items.len); | |
| 480 | try p.data.appendSlice(nodes); | |
| 481 | const end: u32 = @intCast(p.data.items.len); | |
| 482 | return Tree.Node.Range{ .start = start, .end = end }; | |
| 483 | } | |
| 484 | ||
| 485 | fn findLabel(p: *Parser, name: []const u8) ?TokenIndex { | |
| 486 | for (p.labels.items) |item| { | |
| 487 | switch (item) { | |
| 488 | .label => |l| if (mem.eql(u8, p.tokSlice(l), name)) return l, | |
| 489 | .unresolved_goto => {}, | |
| 490 | } | |
| 491 | } | |
| 492 | return null; | |
| 493 | } | |
| 494 | ||
| 495 | fn nodeIs(p: *Parser, node: NodeIndex, tag: Tree.Tag) bool { | |
| 496 | return p.getNode(node, tag) != null; | |
| 497 | } | |
| 498 | ||
| 499 | fn getNode(p: *Parser, node: NodeIndex, tag: Tree.Tag) ?NodeIndex { | |
| 500 | var cur = node; | |
| 501 | const tags = p.nodes.items(.tag); | |
| 502 | const data = p.nodes.items(.data); | |
| 503 | while (true) { | |
| 504 | const cur_tag = tags[@intFromEnum(cur)]; | |
| 505 | if (cur_tag == .paren_expr) { | |
| 506 | cur = data[@intFromEnum(cur)].un; | |
| 507 | } else if (cur_tag == tag) { | |
| 508 | return cur; | |
| 509 | } else { | |
| 510 | return null; | |
| 511 | } | |
| 512 | } | |
| 513 | } | |
| 514 | ||
| 515 | fn pragma(p: *Parser) Compilation.Error!bool { | |
| 516 | var found_pragma = false; | |
| 517 | while (p.eatToken(.keyword_pragma)) |_| { | |
| 518 | found_pragma = true; | |
| 519 | ||
| 520 | const name_tok = p.tok_i; | |
| 521 | const name = p.tokSlice(name_tok); | |
| 522 | ||
| 523 | const end_idx = mem.indexOfScalarPos(Token.Id, p.tok_ids, p.tok_i, .nl).?; | |
| 524 | const pragma_len = @as(TokenIndex, @intCast(end_idx)) - p.tok_i; | |
| 525 | defer p.tok_i += pragma_len + 1; // skip past .nl as well | |
| 526 | if (p.comp.getPragma(name)) |prag| { | |
| 527 | try prag.parserCB(p, p.tok_i); | |
| 528 | } | |
| 529 | } | |
| 530 | return found_pragma; | |
| 531 | } | |
| 532 | ||
| 533 | /// Issue errors for top-level definitions whose type was never completed. | |
| 534 | fn diagnoseIncompleteDefinitions(p: *Parser) !void { | |
| 535 | @setCold(true); | |
| 536 | ||
| 537 | const node_slices = p.nodes.slice(); | |
| 538 | const tags = node_slices.items(.tag); | |
| 539 | const tys = node_slices.items(.ty); | |
| 540 | const data = node_slices.items(.data); | |
| 541 | ||
| 542 | const err_start = p.comp.diag.list.items.len; | |
| 543 | for (p.decl_buf.items) |decl_node| { | |
| 544 | const idx = @intFromEnum(decl_node); | |
| 545 | switch (tags[idx]) { | |
| 546 | .struct_forward_decl, .union_forward_decl, .enum_forward_decl => {}, | |
| 547 | else => continue, | |
| 548 | } | |
| 549 | ||
| 550 | const ty = tys[idx]; | |
| 551 | const decl_type_name = if (ty.getRecord()) |rec| | |
| 552 | rec.name | |
| 553 | else if (ty.get(.@"enum")) |en| | |
| 554 | en.data.@"enum".name | |
| 555 | else | |
| 556 | unreachable; | |
| 557 | ||
| 558 | const tentative_def_tok = p.tentative_defs.get(decl_type_name) orelse continue; | |
| 559 | const type_str = try p.typeStr(ty); | |
| 560 | try p.errStr(.tentative_definition_incomplete, tentative_def_tok, type_str); | |
| 561 | try p.errStr(.forward_declaration_here, data[idx].decl_ref, type_str); | |
| 562 | } | |
| 563 | const errors_added = p.comp.diag.list.items.len - err_start; | |
| 564 | assert(errors_added == 2 * p.tentative_defs.count()); // Each tentative def should add an error + note | |
| 565 | } | |
| 566 | ||
| 567 | /// root : (decl | assembly ';' | staticAssert)* | |
| 568 | pub fn parse(pp: *Preprocessor) Compilation.Error!Tree { | |
| 569 | pp.comp.pragmaEvent(.before_parse); | |
| 570 | ||
| 571 | var arena = std.heap.ArenaAllocator.init(pp.comp.gpa); | |
| 572 | errdefer arena.deinit(); | |
| 573 | var p = Parser{ | |
| 574 | .pp = pp, | |
| 575 | .comp = pp.comp, | |
| 576 | .gpa = pp.comp.gpa, | |
| 577 | .arena = arena.allocator(), | |
| 578 | .tok_ids = pp.tokens.items(.id), | |
| 579 | .strings = std.ArrayList(u8).init(pp.comp.gpa), | |
| 580 | .retained_strings = std.ArrayList(u8).init(pp.comp.gpa), | |
| 581 | .value_map = Tree.ValueMap.init(pp.comp.gpa), | |
| 582 | .data = NodeList.init(pp.comp.gpa), | |
| 583 | .labels = std.ArrayList(Label).init(pp.comp.gpa), | |
| 584 | .list_buf = NodeList.init(pp.comp.gpa), | |
| 585 | .decl_buf = NodeList.init(pp.comp.gpa), | |
| 586 | .param_buf = std.ArrayList(Type.Func.Param).init(pp.comp.gpa), | |
| 587 | .enum_buf = std.ArrayList(Type.Enum.Field).init(pp.comp.gpa), | |
| 588 | .record_buf = std.ArrayList(Type.Record.Field).init(pp.comp.gpa), | |
| 589 | .field_attr_buf = std.ArrayList([]const Attribute).init(pp.comp.gpa), | |
| 590 | .string_ids = .{ | |
| 591 | .declspec_id = try pp.comp.intern("__declspec"), | |
| 592 | .main_id = try pp.comp.intern("main"), | |
| 593 | .file = try pp.comp.intern("FILE"), | |
| 594 | .jmp_buf = try pp.comp.intern("jmp_buf"), | |
| 595 | .sigjmp_buf = try pp.comp.intern("sigjmp_buf"), | |
| 596 | .ucontext_t = try pp.comp.intern("ucontext_t"), | |
| 597 | }, | |
| 598 | }; | |
| 599 | errdefer { | |
| 600 | p.nodes.deinit(pp.comp.gpa); | |
| 601 | p.retained_strings.deinit(); | |
| 602 | p.value_map.deinit(); | |
| 603 | } | |
| 604 | defer { | |
| 605 | p.data.deinit(); | |
| 606 | p.labels.deinit(); | |
| 607 | p.strings.deinit(); | |
| 608 | p.syms.deinit(pp.comp.gpa); | |
| 609 | p.list_buf.deinit(); | |
| 610 | p.decl_buf.deinit(); | |
| 611 | p.param_buf.deinit(); | |
| 612 | p.enum_buf.deinit(); | |
| 613 | p.record_buf.deinit(); | |
| 614 | p.record_members.deinit(pp.comp.gpa); | |
| 615 | p.attr_buf.deinit(pp.comp.gpa); | |
| 616 | p.attr_application_buf.deinit(pp.comp.gpa); | |
| 617 | p.tentative_defs.deinit(pp.comp.gpa); | |
| 618 | assert(p.field_attr_buf.items.len == 0); | |
| 619 | p.field_attr_buf.deinit(); | |
| 620 | } | |
| 621 | ||
| 622 | // NodeIndex 0 must be invalid | |
| 623 | _ = try p.addNode(.{ .tag = .invalid, .ty = undefined, .data = undefined }); | |
| 624 | ||
| 625 | { | |
| 626 | if (p.comp.langopts.hasChar8_T()) { | |
| 627 | try p.syms.defineTypedef(&p, try p.comp.intern("char8_t"), .{ .specifier = .uchar }, 0, .none); | |
| 628 | } | |
| 629 | try p.syms.defineTypedef(&p, try p.comp.intern("__int128_t"), .{ .specifier = .int128 }, 0, .none); | |
| 630 | try p.syms.defineTypedef(&p, try p.comp.intern("__uint128_t"), .{ .specifier = .uint128 }, 0, .none); | |
| 631 | ||
| 632 | const elem_ty = try p.arena.create(Type); | |
| 633 | elem_ty.* = .{ .specifier = .char }; | |
| 634 | try p.syms.defineTypedef(&p, try p.comp.intern("__builtin_ms_va_list"), .{ | |
| 635 | .specifier = .pointer, | |
| 636 | .data = .{ .sub_type = elem_ty }, | |
| 637 | }, 0, .none); | |
| 638 | ||
| 639 | const ty = &pp.comp.types.va_list; | |
| 640 | try p.syms.defineTypedef(&p, try p.comp.intern("__builtin_va_list"), ty.*, 0, .none); | |
| 641 | ||
| 642 | if (ty.isArray()) ty.decayArray(); | |
| 643 | ||
| 644 | try p.syms.defineTypedef(&p, try p.comp.intern("__NSConstantString"), pp.comp.types.ns_constant_string.ty, 0, .none); | |
| 645 | } | |
| 646 | ||
| 647 | while (p.eatToken(.eof) == null) { | |
| 648 | if (try p.pragma()) continue; | |
| 649 | if (try p.parseOrNextDecl(staticAssert)) continue; | |
| 650 | if (try p.parseOrNextDecl(decl)) continue; | |
| 651 | if (p.eatToken(.keyword_extension)) |_| { | |
| 652 | const saved_extension = p.extension_suppressed; | |
| 653 | defer p.extension_suppressed = saved_extension; | |
| 654 | p.extension_suppressed = true; | |
| 655 | ||
| 656 | if (try p.parseOrNextDecl(decl)) continue; | |
| 657 | switch (p.tok_ids[p.tok_i]) { | |
| 658 | .semicolon => p.tok_i += 1, | |
| 659 | .keyword_static_assert, | |
| 660 | .keyword_c23_static_assert, | |
| 661 | .keyword_pragma, | |
| 662 | .keyword_extension, | |
| 663 | .keyword_asm, | |
| 664 | .keyword_asm1, | |
| 665 | .keyword_asm2, | |
| 666 | => {}, | |
| 667 | else => try p.err(.expected_external_decl), | |
| 668 | } | |
| 669 | continue; | |
| 670 | } | |
| 671 | if (p.assembly(.global) catch |er| switch (er) { | |
| 672 | error.ParsingFailed => { | |
| 673 | p.nextExternDecl(); | |
| 674 | continue; | |
| 675 | }, | |
| 676 | else => |e| return e, | |
| 677 | }) |node| { | |
| 678 | try p.decl_buf.append(node); | |
| 679 | continue; | |
| 680 | } | |
| 681 | if (p.eatToken(.semicolon)) |tok| { | |
| 682 | try p.errTok(.extra_semi, tok); | |
| 683 | continue; | |
| 684 | } | |
| 685 | try p.err(.expected_external_decl); | |
| 686 | p.tok_i += 1; | |
| 687 | } | |
| 688 | if (p.tentative_defs.count() > 0) { | |
| 689 | try p.diagnoseIncompleteDefinitions(); | |
| 690 | } | |
| 691 | ||
| 692 | const root_decls = try p.decl_buf.toOwnedSlice(); | |
| 693 | errdefer pp.comp.gpa.free(root_decls); | |
| 694 | if (root_decls.len == 0) { | |
| 695 | try p.errTok(.empty_translation_unit, p.tok_i - 1); | |
| 696 | } | |
| 697 | pp.comp.pragmaEvent(.after_parse); | |
| 698 | ||
| 699 | const data = try p.data.toOwnedSlice(); | |
| 700 | errdefer pp.comp.gpa.free(data); | |
| 701 | const strings = try p.retained_strings.toOwnedSlice(); | |
| 702 | errdefer pp.comp.gpa.free(strings); | |
| 703 | return Tree{ | |
| 704 | .comp = pp.comp, | |
| 705 | .tokens = pp.tokens.slice(), | |
| 706 | .arena = arena, | |
| 707 | .generated = pp.comp.generated_buf.items, | |
| 708 | .nodes = p.nodes.toOwnedSlice(), | |
| 709 | .data = data, | |
| 710 | .root_decls = root_decls, | |
| 711 | .strings = strings, | |
| 712 | .value_map = p.value_map, | |
| 713 | }; | |
| 714 | } | |
| 715 | ||
| 716 | fn skipToPragmaSentinel(p: *Parser) void { | |
| 717 | while (true) : (p.tok_i += 1) { | |
| 718 | if (p.tok_ids[p.tok_i] == .nl) return; | |
| 719 | if (p.tok_ids[p.tok_i] == .eof) { | |
| 720 | p.tok_i -= 1; | |
| 721 | return; | |
| 722 | } | |
| 723 | } | |
| 724 | } | |
| 725 | ||
| 726 | fn parseOrNextDecl(p: *Parser, comptime func: fn (*Parser) Error!bool) Compilation.Error!bool { | |
| 727 | return func(p) catch |er| switch (er) { | |
| 728 | error.ParsingFailed => { | |
| 729 | p.nextExternDecl(); | |
| 730 | return true; | |
| 731 | }, | |
| 732 | else => |e| return e, | |
| 733 | }; | |
| 734 | } | |
| 735 | ||
| 736 | fn nextExternDecl(p: *Parser) void { | |
| 737 | var parens: u32 = 0; | |
| 738 | while (true) : (p.tok_i += 1) { | |
| 739 | switch (p.tok_ids[p.tok_i]) { | |
| 740 | .l_paren, .l_brace, .l_bracket => parens += 1, | |
| 741 | .r_paren, .r_brace, .r_bracket => if (parens != 0) { | |
| 742 | parens -= 1; | |
| 743 | }, | |
| 744 | .keyword_typedef, | |
| 745 | .keyword_extern, | |
| 746 | .keyword_static, | |
| 747 | .keyword_auto, | |
| 748 | .keyword_register, | |
| 749 | .keyword_thread_local, | |
| 750 | .keyword_c23_thread_local, | |
| 751 | .keyword_inline, | |
| 752 | .keyword_inline1, | |
| 753 | .keyword_inline2, | |
| 754 | .keyword_noreturn, | |
| 755 | .keyword_void, | |
| 756 | .keyword_bool, | |
| 757 | .keyword_c23_bool, | |
| 758 | .keyword_char, | |
| 759 | .keyword_short, | |
| 760 | .keyword_int, | |
| 761 | .keyword_long, | |
| 762 | .keyword_signed, | |
| 763 | .keyword_unsigned, | |
| 764 | .keyword_float, | |
| 765 | .keyword_double, | |
| 766 | .keyword_complex, | |
| 767 | .keyword_atomic, | |
| 768 | .keyword_enum, | |
| 769 | .keyword_struct, | |
| 770 | .keyword_union, | |
| 771 | .keyword_alignas, | |
| 772 | .keyword_c23_alignas, | |
| 773 | .identifier, | |
| 774 | .extended_identifier, | |
| 775 | .keyword_typeof, | |
| 776 | .keyword_typeof1, | |
| 777 | .keyword_typeof2, | |
| 778 | .keyword_extension, | |
| 779 | .keyword_bit_int, | |
| 780 | => if (parens == 0) return, | |
| 781 | .keyword_pragma => p.skipToPragmaSentinel(), | |
| 782 | .eof => return, | |
| 783 | .semicolon => if (parens == 0) { | |
| 784 | p.tok_i += 1; | |
| 785 | return; | |
| 786 | }, | |
| 787 | else => {}, | |
| 788 | } | |
| 789 | } | |
| 790 | } | |
| 791 | ||
| 792 | fn skipTo(p: *Parser, id: Token.Id) void { | |
| 793 | var parens: u32 = 0; | |
| 794 | while (true) : (p.tok_i += 1) { | |
| 795 | if (p.tok_ids[p.tok_i] == id and parens == 0) { | |
| 796 | p.tok_i += 1; | |
| 797 | return; | |
| 798 | } | |
| 799 | switch (p.tok_ids[p.tok_i]) { | |
| 800 | .l_paren, .l_brace, .l_bracket => parens += 1, | |
| 801 | .r_paren, .r_brace, .r_bracket => if (parens != 0) { | |
| 802 | parens -= 1; | |
| 803 | }, | |
| 804 | .keyword_pragma => p.skipToPragmaSentinel(), | |
| 805 | .eof => return, | |
| 806 | else => {}, | |
| 807 | } | |
| 808 | } | |
| 809 | } | |
| 810 | ||
| 811 | /// Called after a typedef is defined | |
| 812 | fn typedefDefined(p: *Parser, name: StringId, ty: Type) void { | |
| 813 | if (name == p.string_ids.file) { | |
| 814 | p.comp.types.file = ty; | |
| 815 | } else if (name == p.string_ids.jmp_buf) { | |
| 816 | p.comp.types.jmp_buf = ty; | |
| 817 | } else if (name == p.string_ids.sigjmp_buf) { | |
| 818 | p.comp.types.sigjmp_buf = ty; | |
| 819 | } else if (name == p.string_ids.ucontext_t) { | |
| 820 | p.comp.types.ucontext_t = ty; | |
| 821 | } | |
| 822 | } | |
| 823 | ||
| 824 | // ====== declarations ====== | |
| 825 | ||
| 826 | /// decl | |
| 827 | /// : declSpec (initDeclarator ( ',' initDeclarator)*)? ';' | |
| 828 | /// | declSpec declarator decl* compoundStmt | |
| 829 | fn decl(p: *Parser) Error!bool { | |
| 830 | _ = try p.pragma(); | |
| 831 | const first_tok = p.tok_i; | |
| 832 | const attr_buf_top = p.attr_buf.len; | |
| 833 | defer p.attr_buf.len = attr_buf_top; | |
| 834 | ||
| 835 | try p.attributeSpecifier(); | |
| 836 | ||
| 837 | var decl_spec = if (try p.declSpec()) |some| some else blk: { | |
| 838 | if (p.func.ty != null) { | |
| 839 | p.tok_i = first_tok; | |
| 840 | return false; | |
| 841 | } | |
| 842 | switch (p.tok_ids[first_tok]) { | |
| 843 | .asterisk, .l_paren, .identifier, .extended_identifier => {}, | |
| 844 | else => if (p.tok_i != first_tok) { | |
| 845 | try p.err(.expected_ident_or_l_paren); | |
| 846 | return error.ParsingFailed; | |
| 847 | } else return false, | |
| 848 | } | |
| 849 | var spec: Type.Builder = .{}; | |
| 850 | break :blk DeclSpec{ .ty = try spec.finish(p) }; | |
| 851 | }; | |
| 852 | if (decl_spec.noreturn) |tok| { | |
| 853 | const attr = Attribute{ .tag = .noreturn, .args = .{ .noreturn = {} }, .syntax = .keyword }; | |
| 854 | try p.attr_buf.append(p.gpa, .{ .attr = attr, .tok = tok }); | |
| 855 | } | |
| 856 | var init_d = (try p.initDeclarator(&decl_spec, attr_buf_top)) orelse { | |
| 857 | _ = try p.expectToken(.semicolon); | |
| 858 | if (decl_spec.ty.is(.@"enum") or | |
| 859 | (decl_spec.ty.isRecord() and !decl_spec.ty.isAnonymousRecord(p.comp) and | |
| 860 | !decl_spec.ty.isTypeof())) // we follow GCC and clang's behavior here | |
| 861 | { | |
| 862 | const specifier = decl_spec.ty.canonicalize(.standard).specifier; | |
| 863 | const attrs = p.attr_buf.items(.attr)[attr_buf_top..]; | |
| 864 | const toks = p.attr_buf.items(.tok)[attr_buf_top..]; | |
| 865 | for (attrs, toks) |attr, tok| { | |
| 866 | try p.errExtra(.ignored_record_attr, tok, .{ | |
| 867 | .ignored_record_attr = .{ .tag = attr.tag, .specifier = switch (specifier) { | |
| 868 | .@"enum" => .@"enum", | |
| 869 | .@"struct" => .@"struct", | |
| 870 | .@"union" => .@"union", | |
| 871 | else => unreachable, | |
| 872 | } }, | |
| 873 | }); | |
| 874 | } | |
| 875 | return true; | |
| 876 | } | |
| 877 | ||
| 878 | try p.errTok(.missing_declaration, first_tok); | |
| 879 | return true; | |
| 880 | }; | |
| 881 | ||
| 882 | // Check for function definition. | |
| 883 | if (init_d.d.func_declarator != null and init_d.initializer.node == .none and init_d.d.ty.isFunc()) fn_def: { | |
| 884 | if (decl_spec.auto_type) |tok_i| { | |
| 885 | try p.errStr(.auto_type_not_allowed, tok_i, "function return type"); | |
| 886 | return error.ParsingFailed; | |
| 887 | } | |
| 888 | ||
| 889 | switch (p.tok_ids[p.tok_i]) { | |
| 890 | .comma, .semicolon => break :fn_def, | |
| 891 | .l_brace => {}, | |
| 892 | else => if (init_d.d.old_style_func == null) { | |
| 893 | try p.err(.expected_fn_body); | |
| 894 | return true; | |
| 895 | }, | |
| 896 | } | |
| 897 | if (p.func.ty != null) try p.err(.func_not_in_root); | |
| 898 | ||
| 899 | const node = try p.addNode(undefined); // reserve space | |
| 900 | const interned_declarator_name = try p.comp.intern(p.tokSlice(init_d.d.name)); | |
| 901 | try p.syms.defineSymbol(p, interned_declarator_name, init_d.d.ty, init_d.d.name, node, .{}, false); | |
| 902 | ||
| 903 | const func = p.func; | |
| 904 | p.func = .{ | |
| 905 | .ty = init_d.d.ty, | |
| 906 | .name = init_d.d.name, | |
| 907 | }; | |
| 908 | if (interned_declarator_name == p.string_ids.main_id and !init_d.d.ty.returnType().is(.int)) { | |
| 909 | try p.errTok(.main_return_type, init_d.d.name); | |
| 910 | } | |
| 911 | defer p.func = func; | |
| 912 | ||
| 913 | try p.syms.pushScope(p); | |
| 914 | defer p.syms.popScope(); | |
| 915 | ||
| 916 | // Collect old style parameter declarations. | |
| 917 | if (init_d.d.old_style_func != null) { | |
| 918 | const attrs = init_d.d.ty.getAttributes(); | |
| 919 | var base_ty = if (init_d.d.ty.specifier == .attributed) init_d.d.ty.elemType() else init_d.d.ty; | |
| 920 | base_ty.specifier = .func; | |
| 921 | init_d.d.ty = try base_ty.withAttributes(p.arena, attrs); | |
| 922 | ||
| 923 | const param_buf_top = p.param_buf.items.len; | |
| 924 | defer p.param_buf.items.len = param_buf_top; | |
| 925 | ||
| 926 | param_loop: while (true) { | |
| 927 | const param_decl_spec = (try p.declSpec()) orelse break; | |
| 928 | if (p.eatToken(.semicolon)) |semi| { | |
| 929 | try p.errTok(.missing_declaration, semi); | |
| 930 | continue :param_loop; | |
| 931 | } | |
| 932 | ||
| 933 | while (true) { | |
| 934 | const attr_buf_top_declarator = p.attr_buf.len; | |
| 935 | defer p.attr_buf.len = attr_buf_top_declarator; | |
| 936 | ||
| 937 | var d = (try p.declarator(param_decl_spec.ty, .normal)) orelse { | |
| 938 | try p.errTok(.missing_declaration, first_tok); | |
| 939 | _ = try p.expectToken(.semicolon); | |
| 940 | continue :param_loop; | |
| 941 | }; | |
| 942 | try p.attributeSpecifier(); | |
| 943 | ||
| 944 | if (d.ty.hasIncompleteSize() and !d.ty.is(.void)) try p.errStr(.parameter_incomplete_ty, d.name, try p.typeStr(d.ty)); | |
| 945 | if (d.ty.isFunc()) { | |
| 946 | // Params declared as functions are converted to function pointers. | |
| 947 | const elem_ty = try p.arena.create(Type); | |
| 948 | elem_ty.* = d.ty; | |
| 949 | d.ty = Type{ | |
| 950 | .specifier = .pointer, | |
| 951 | .data = .{ .sub_type = elem_ty }, | |
| 952 | }; | |
| 953 | } else if (d.ty.isArray()) { | |
| 954 | // params declared as arrays are converted to pointers | |
| 955 | d.ty.decayArray(); | |
| 956 | } else if (d.ty.is(.void)) { | |
| 957 | try p.errTok(.invalid_void_param, d.name); | |
| 958 | } | |
| 959 | ||
| 960 | // find and correct parameter types | |
| 961 | // TODO check for missing declarations and redefinitions | |
| 962 | const name_str = p.tokSlice(d.name); | |
| 963 | const interned_name = try p.comp.intern(name_str); | |
| 964 | for (init_d.d.ty.params()) |*param| { | |
| 965 | if (param.name == interned_name) { | |
| 966 | param.ty = d.ty; | |
| 967 | break; | |
| 968 | } | |
| 969 | } else { | |
| 970 | try p.errStr(.parameter_missing, d.name, name_str); | |
| 971 | } | |
| 972 | d.ty = try Attribute.applyParameterAttributes(p, d.ty, attr_buf_top_declarator, .alignas_on_param); | |
| 973 | ||
| 974 | // bypass redefinition check to avoid duplicate errors | |
| 975 | try p.syms.syms.append(p.gpa, .{ | |
| 976 | .kind = .def, | |
| 977 | .name = interned_name, | |
| 978 | .tok = d.name, | |
| 979 | .ty = d.ty, | |
| 980 | .val = .{}, | |
| 981 | }); | |
| 982 | if (p.eatToken(.comma) == null) break; | |
| 983 | } | |
| 984 | _ = try p.expectToken(.semicolon); | |
| 985 | } | |
| 986 | } else { | |
| 987 | for (init_d.d.ty.params()) |param| { | |
| 988 | if (param.ty.hasUnboundVLA()) try p.errTok(.unbound_vla, param.name_tok); | |
| 989 | if (param.ty.hasIncompleteSize() and !param.ty.is(.void) and param.ty.specifier != .invalid) try p.errStr(.parameter_incomplete_ty, param.name_tok, try p.typeStr(param.ty)); | |
| 990 | ||
| 991 | if (param.name == .empty) { | |
| 992 | try p.errTok(.omitting_parameter_name, param.name_tok); | |
| 993 | continue; | |
| 994 | } | |
| 995 | ||
| 996 | // bypass redefinition check to avoid duplicate errors | |
| 997 | try p.syms.syms.append(p.gpa, .{ | |
| 998 | .kind = .def, | |
| 999 | .name = param.name, | |
| 1000 | .tok = param.name_tok, | |
| 1001 | .ty = param.ty, | |
| 1002 | .val = .{}, | |
| 1003 | }); | |
| 1004 | } | |
| 1005 | } | |
| 1006 | ||
| 1007 | const body = (try p.compoundStmt(true, null)) orelse { | |
| 1008 | assert(init_d.d.old_style_func != null); | |
| 1009 | try p.err(.expected_fn_body); | |
| 1010 | return true; | |
| 1011 | }; | |
| 1012 | p.nodes.set(@intFromEnum(node), .{ | |
| 1013 | .ty = init_d.d.ty, | |
| 1014 | .tag = try decl_spec.validateFnDef(p), | |
| 1015 | .data = .{ .decl = .{ .name = init_d.d.name, .node = body } }, | |
| 1016 | }); | |
| 1017 | try p.decl_buf.append(node); | |
| 1018 | ||
| 1019 | // check gotos | |
| 1020 | if (func.ty == null) { | |
| 1021 | for (p.labels.items) |item| { | |
| 1022 | if (item == .unresolved_goto) | |
| 1023 | try p.errStr(.undeclared_label, item.unresolved_goto, p.tokSlice(item.unresolved_goto)); | |
| 1024 | } | |
| 1025 | if (p.computed_goto_tok) |goto_tok| { | |
| 1026 | if (!p.contains_address_of_label) try p.errTok(.invalid_computed_goto, goto_tok); | |
| 1027 | } | |
| 1028 | p.labels.items.len = 0; | |
| 1029 | p.label_count = 0; | |
| 1030 | p.contains_address_of_label = false; | |
| 1031 | p.computed_goto_tok = null; | |
| 1032 | } | |
| 1033 | return true; | |
| 1034 | } | |
| 1035 | ||
| 1036 | // Declare all variable/typedef declarators. | |
| 1037 | while (true) { | |
| 1038 | if (init_d.d.old_style_func) |tok_i| try p.errTok(.invalid_old_style_params, tok_i); | |
| 1039 | const tag = try decl_spec.validate(p, &init_d.d.ty, init_d.initializer.node != .none); | |
| 1040 | ||
| 1041 | const node = try p.addNode(.{ .ty = init_d.d.ty, .tag = tag, .data = .{ | |
| 1042 | .decl = .{ .name = init_d.d.name, .node = init_d.initializer.node }, | |
| 1043 | } }); | |
| 1044 | try p.decl_buf.append(node); | |
| 1045 | ||
| 1046 | const interned_name = try p.comp.intern(p.tokSlice(init_d.d.name)); | |
| 1047 | if (decl_spec.storage_class == .typedef) { | |
| 1048 | try p.syms.defineTypedef(p, interned_name, init_d.d.ty, init_d.d.name, node); | |
| 1049 | p.typedefDefined(interned_name, init_d.d.ty); | |
| 1050 | } else if (init_d.initializer.node != .none or | |
| 1051 | (p.func.ty != null and decl_spec.storage_class != .@"extern")) | |
| 1052 | { | |
| 1053 | // TODO validate global variable/constexpr initializer comptime known | |
| 1054 | try p.syms.defineSymbol( | |
| 1055 | p, | |
| 1056 | interned_name, | |
| 1057 | init_d.d.ty, | |
| 1058 | init_d.d.name, | |
| 1059 | node, | |
| 1060 | if (init_d.d.ty.isConst() or decl_spec.constexpr != null) init_d.initializer.val else .{}, | |
| 1061 | decl_spec.constexpr != null, | |
| 1062 | ); | |
| 1063 | } else { | |
| 1064 | try p.syms.declareSymbol(p, interned_name, init_d.d.ty, init_d.d.name, node); | |
| 1065 | } | |
| 1066 | ||
| 1067 | if (p.eatToken(.comma) == null) break; | |
| 1068 | ||
| 1069 | if (decl_spec.auto_type) |tok_i| try p.errTok(.auto_type_requires_single_declarator, tok_i); | |
| 1070 | ||
| 1071 | init_d = (try p.initDeclarator(&decl_spec, attr_buf_top)) orelse { | |
| 1072 | try p.err(.expected_ident_or_l_paren); | |
| 1073 | continue; | |
| 1074 | }; | |
| 1075 | } | |
| 1076 | ||
| 1077 | _ = try p.expectToken(.semicolon); | |
| 1078 | return true; | |
| 1079 | } | |
| 1080 | ||
| 1081 | fn staticAssertMessage(p: *Parser, cond_node: NodeIndex, message: Result) !?[]const u8 { | |
| 1082 | const cond_tag = p.nodes.items(.tag)[@intFromEnum(cond_node)]; | |
| 1083 | if (cond_tag != .builtin_types_compatible_p and message.node == .none) return null; | |
| 1084 | ||
| 1085 | var buf = std.ArrayList(u8).init(p.gpa); | |
| 1086 | defer buf.deinit(); | |
| 1087 | ||
| 1088 | if (cond_tag == .builtin_types_compatible_p) { | |
| 1089 | const mapper = p.comp.string_interner.getSlowTypeMapper(); | |
| 1090 | const data = p.nodes.items(.data)[@intFromEnum(cond_node)].bin; | |
| 1091 | ||
| 1092 | try buf.appendSlice("'__builtin_types_compatible_p("); | |
| 1093 | ||
| 1094 | const lhs_ty = p.nodes.items(.ty)[@intFromEnum(data.lhs)]; | |
| 1095 | try lhs_ty.print(mapper, p.comp.langopts, buf.writer()); | |
| 1096 | try buf.appendSlice(", "); | |
| 1097 | ||
| 1098 | const rhs_ty = p.nodes.items(.ty)[@intFromEnum(data.rhs)]; | |
| 1099 | try rhs_ty.print(mapper, p.comp.langopts, buf.writer()); | |
| 1100 | ||
| 1101 | try buf.appendSlice(")'"); | |
| 1102 | } | |
| 1103 | if (message.node != .none) { | |
| 1104 | if (buf.items.len > 0) { | |
| 1105 | try buf.append(' '); | |
| 1106 | } | |
| 1107 | const data = message.val.data.bytes; | |
| 1108 | try buf.ensureUnusedCapacity(data.len()); | |
| 1109 | try Tree.dumpStr( | |
| 1110 | p.retained_strings.items, | |
| 1111 | data, | |
| 1112 | p.nodes.items(.tag)[@intFromEnum(message.node)], | |
| 1113 | buf.writer(), | |
| 1114 | ); | |
| 1115 | } | |
| 1116 | return try p.comp.diag.arena.allocator().dupe(u8, buf.items); | |
| 1117 | } | |
| 1118 | ||
| 1119 | /// staticAssert | |
| 1120 | /// : keyword_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';' | |
| 1121 | /// | keyword_c23_static_assert '(' integerConstExpr (',' STRING_LITERAL)? ')' ';' | |
| 1122 | fn staticAssert(p: *Parser) Error!bool { | |
| 1123 | const static_assert = p.eatToken(.keyword_static_assert) orelse p.eatToken(.keyword_c23_static_assert) orelse return false; | |
| 1124 | const l_paren = try p.expectToken(.l_paren); | |
| 1125 | const res_token = p.tok_i; | |
| 1126 | var res = try p.constExpr(.gnu_folding_extension); | |
| 1127 | const res_node = res.node; | |
| 1128 | const str = if (p.eatToken(.comma) != null) | |
| 1129 | switch (p.tok_ids[p.tok_i]) { | |
| 1130 | .string_literal, | |
| 1131 | .string_literal_utf_16, | |
| 1132 | .string_literal_utf_8, | |
| 1133 | .string_literal_utf_32, | |
| 1134 | .string_literal_wide, | |
| 1135 | => try p.stringLiteral(), | |
| 1136 | else => { | |
| 1137 | try p.err(.expected_str_literal); | |
| 1138 | return error.ParsingFailed; | |
| 1139 | }, | |
| 1140 | } | |
| 1141 | else | |
| 1142 | Result{}; | |
| 1143 | try p.expectClosing(l_paren, .r_paren); | |
| 1144 | _ = try p.expectToken(.semicolon); | |
| 1145 | if (str.node == .none) { | |
| 1146 | try p.errTok(.static_assert_missing_message, static_assert); | |
| 1147 | try p.errStr(.pre_c2x_compat, static_assert, "'_Static_assert' with no message"); | |
| 1148 | } | |
| 1149 | ||
| 1150 | // Array will never be zero; a value of zero for a pointer is a null pointer constant | |
| 1151 | if ((res.ty.isArray() or res.ty.isPtr()) and !res.val.isZero()) { | |
| 1152 | const err_start = p.comp.diag.list.items.len; | |
| 1153 | try p.errTok(.const_decl_folded, res_token); | |
| 1154 | if (res.ty.isPtr() and err_start != p.comp.diag.list.items.len) { | |
| 1155 | // Don't show the note if the .const_decl_folded diagnostic was not added | |
| 1156 | try p.errTok(.constant_expression_conversion_not_allowed, res_token); | |
| 1157 | } | |
| 1158 | } | |
| 1159 | try res.boolCast(p, .{ .specifier = .bool }, res_token); | |
| 1160 | if (res.val.tag == .unavailable) { | |
| 1161 | if (res.ty.specifier != .invalid) { | |
| 1162 | try p.errTok(.static_assert_not_constant, res_token); | |
| 1163 | } | |
| 1164 | } else { | |
| 1165 | if (!res.val.getBool()) { | |
| 1166 | if (try p.staticAssertMessage(res_node, str)) |message| { | |
| 1167 | try p.errStr(.static_assert_failure_message, static_assert, message); | |
| 1168 | } else { | |
| 1169 | try p.errTok(.static_assert_failure, static_assert); | |
| 1170 | } | |
| 1171 | } | |
| 1172 | } | |
| 1173 | ||
| 1174 | const node = try p.addNode(.{ | |
| 1175 | .tag = .static_assert, | |
| 1176 | .data = .{ .bin = .{ | |
| 1177 | .lhs = res.node, | |
| 1178 | .rhs = str.node, | |
| 1179 | } }, | |
| 1180 | }); | |
| 1181 | try p.decl_buf.append(node); | |
| 1182 | return true; | |
| 1183 | } | |
| 1184 | ||
| 1185 | pub const DeclSpec = struct { | |
| 1186 | storage_class: union(enum) { | |
| 1187 | auto: TokenIndex, | |
| 1188 | @"extern": TokenIndex, | |
| 1189 | register: TokenIndex, | |
| 1190 | static: TokenIndex, | |
| 1191 | typedef: TokenIndex, | |
| 1192 | none, | |
| 1193 | } = .none, | |
| 1194 | thread_local: ?TokenIndex = null, | |
| 1195 | constexpr: ?TokenIndex = null, | |
| 1196 | @"inline": ?TokenIndex = null, | |
| 1197 | noreturn: ?TokenIndex = null, | |
| 1198 | auto_type: ?TokenIndex = null, | |
| 1199 | ty: Type, | |
| 1200 | ||
| 1201 | fn validateParam(d: DeclSpec, p: *Parser, ty: *Type) Error!void { | |
| 1202 | switch (d.storage_class) { | |
| 1203 | .none => {}, | |
| 1204 | .register => ty.qual.register = true, | |
| 1205 | .auto, .@"extern", .static, .typedef => |tok_i| try p.errTok(.invalid_storage_on_param, tok_i), | |
| 1206 | } | |
| 1207 | if (d.thread_local) |tok_i| try p.errTok(.threadlocal_non_var, tok_i); | |
| 1208 | if (d.@"inline") |tok_i| try p.errStr(.func_spec_non_func, tok_i, "inline"); | |
| 1209 | if (d.noreturn) |tok_i| try p.errStr(.func_spec_non_func, tok_i, "_Noreturn"); | |
| 1210 | if (d.constexpr) |tok_i| try p.errTok(.invalid_storage_on_param, tok_i); | |
| 1211 | if (d.auto_type) |tok_i| { | |
| 1212 | try p.errStr(.auto_type_not_allowed, tok_i, "function prototype"); | |
| 1213 | ty.* = Type.invalid; | |
| 1214 | } | |
| 1215 | } | |
| 1216 | ||
| 1217 | fn validateFnDef(d: DeclSpec, p: *Parser) Error!Tree.Tag { | |
| 1218 | switch (d.storage_class) { | |
| 1219 | .none, .@"extern", .static => {}, | |
| 1220 | .auto, .register, .typedef => |tok_i| try p.errTok(.illegal_storage_on_func, tok_i), | |
| 1221 | } | |
| 1222 | if (d.thread_local) |tok_i| try p.errTok(.threadlocal_non_var, tok_i); | |
| 1223 | if (d.constexpr) |tok_i| try p.errTok(.illegal_storage_on_func, tok_i); | |
| 1224 | ||
| 1225 | const is_static = d.storage_class == .static; | |
| 1226 | const is_inline = d.@"inline" != null; | |
| 1227 | if (is_static) { | |
| 1228 | if (is_inline) return .inline_static_fn_def; | |
| 1229 | return .static_fn_def; | |
| 1230 | } else { | |
| 1231 | if (is_inline) return .inline_fn_def; | |
| 1232 | return .fn_def; | |
| 1233 | } | |
| 1234 | } | |
| 1235 | ||
| 1236 | fn validate(d: DeclSpec, p: *Parser, ty: *Type, has_init: bool) Error!Tree.Tag { | |
| 1237 | const is_static = d.storage_class == .static; | |
| 1238 | if (ty.isFunc() and d.storage_class != .typedef) { | |
| 1239 | switch (d.storage_class) { | |
| 1240 | .none, .@"extern" => {}, | |
| 1241 | .static => |tok_i| if (p.func.ty != null) try p.errTok(.static_func_not_global, tok_i), | |
| 1242 | .typedef => unreachable, | |
| 1243 | .auto, .register => |tok_i| try p.errTok(.illegal_storage_on_func, tok_i), | |
| 1244 | } | |
| 1245 | if (d.thread_local) |tok_i| try p.errTok(.threadlocal_non_var, tok_i); | |
| 1246 | if (d.constexpr) |tok_i| try p.errTok(.illegal_storage_on_func, tok_i); | |
| 1247 | ||
| 1248 | const is_inline = d.@"inline" != null; | |
| 1249 | if (is_static) { | |
| 1250 | if (is_inline) return .inline_static_fn_proto; | |
| 1251 | return .static_fn_proto; | |
| 1252 | } else { | |
| 1253 | if (is_inline) return .inline_fn_proto; | |
| 1254 | return .fn_proto; | |
| 1255 | } | |
| 1256 | } else { | |
| 1257 | if (d.@"inline") |tok_i| try p.errStr(.func_spec_non_func, tok_i, "inline"); | |
| 1258 | // TODO move to attribute validation | |
| 1259 | if (d.noreturn) |tok_i| try p.errStr(.func_spec_non_func, tok_i, "_Noreturn"); | |
| 1260 | switch (d.storage_class) { | |
| 1261 | .auto, .register => if (p.func.ty == null) try p.err(.illegal_storage_on_global), | |
| 1262 | .typedef => return .typedef, | |
| 1263 | else => {}, | |
| 1264 | } | |
| 1265 | ty.qual.register = d.storage_class == .register; | |
| 1266 | ||
| 1267 | const is_extern = d.storage_class == .@"extern" and !has_init; | |
| 1268 | if (d.thread_local != null) { | |
| 1269 | if (is_static) return .threadlocal_static_var; | |
| 1270 | if (is_extern) return .threadlocal_extern_var; | |
| 1271 | return .threadlocal_var; | |
| 1272 | } else { | |
| 1273 | if (is_static) return .static_var; | |
| 1274 | if (is_extern) return .extern_var; | |
| 1275 | return .@"var"; | |
| 1276 | } | |
| 1277 | } | |
| 1278 | } | |
| 1279 | }; | |
| 1280 | ||
| 1281 | /// typeof | |
| 1282 | /// : keyword_typeof '(' typeName ')' | |
| 1283 | /// | keyword_typeof '(' expr ')' | |
| 1284 | fn typeof(p: *Parser) Error!?Type { | |
| 1285 | switch (p.tok_ids[p.tok_i]) { | |
| 1286 | .keyword_typeof, .keyword_typeof1, .keyword_typeof2 => p.tok_i += 1, | |
| 1287 | else => return null, | |
| 1288 | } | |
| 1289 | const l_paren = try p.expectToken(.l_paren); | |
| 1290 | if (try p.typeName()) |ty| { | |
| 1291 | try p.expectClosing(l_paren, .r_paren); | |
| 1292 | const typeof_ty = try p.arena.create(Type); | |
| 1293 | typeof_ty.* = .{ | |
| 1294 | .data = ty.data, | |
| 1295 | .qual = ty.qual.inheritFromTypeof(), | |
| 1296 | .specifier = ty.specifier, | |
| 1297 | }; | |
| 1298 | ||
| 1299 | return Type{ | |
| 1300 | .data = .{ .sub_type = typeof_ty }, | |
| 1301 | .specifier = .typeof_type, | |
| 1302 | }; | |
| 1303 | } | |
| 1304 | const typeof_expr = try p.parseNoEval(expr); | |
| 1305 | try typeof_expr.expect(p); | |
| 1306 | try p.expectClosing(l_paren, .r_paren); | |
| 1307 | // Special case nullptr_t since it's defined as typeof(nullptr) | |
| 1308 | if (typeof_expr.ty.is(.nullptr_t)) { | |
| 1309 | return Type{ .specifier = .nullptr_t, .qual = typeof_expr.ty.qual.inheritFromTypeof() }; | |
| 1310 | } | |
| 1311 | ||
| 1312 | const inner = try p.arena.create(Type.Expr); | |
| 1313 | inner.* = .{ | |
| 1314 | .node = typeof_expr.node, | |
| 1315 | .ty = .{ | |
| 1316 | .data = typeof_expr.ty.data, | |
| 1317 | .qual = typeof_expr.ty.qual.inheritFromTypeof(), | |
| 1318 | .specifier = typeof_expr.ty.specifier, | |
| 1319 | }, | |
| 1320 | }; | |
| 1321 | ||
| 1322 | return Type{ | |
| 1323 | .data = .{ .expr = inner }, | |
| 1324 | .specifier = .typeof_expr, | |
| 1325 | }; | |
| 1326 | } | |
| 1327 | ||
| 1328 | /// declSpec: (storageClassSpec | typeSpec | typeQual | funcSpec | alignSpec)+ | |
| 1329 | /// storageClassSpec: | |
| 1330 | /// : keyword_typedef | |
| 1331 | /// | keyword_extern | |
| 1332 | /// | keyword_static | |
| 1333 | /// | keyword_threadlocal | |
| 1334 | /// | keyword_auto | |
| 1335 | /// | keyword_register | |
| 1336 | /// funcSpec : keyword_inline | keyword_noreturn | |
| 1337 | fn declSpec(p: *Parser) Error!?DeclSpec { | |
| 1338 | var d: DeclSpec = .{ .ty = .{ .specifier = undefined } }; | |
| 1339 | var spec: Type.Builder = .{}; | |
| 1340 | ||
| 1341 | const start = p.tok_i; | |
| 1342 | while (true) { | |
| 1343 | if (try p.typeSpec(&spec)) continue; | |
| 1344 | const id = p.tok_ids[p.tok_i]; | |
| 1345 | switch (id) { | |
| 1346 | .keyword_typedef, | |
| 1347 | .keyword_extern, | |
| 1348 | .keyword_static, | |
| 1349 | .keyword_auto, | |
| 1350 | .keyword_register, | |
| 1351 | => { | |
| 1352 | if (d.storage_class != .none) { | |
| 1353 | try p.errStr(.multiple_storage_class, p.tok_i, @tagName(d.storage_class)); | |
| 1354 | return error.ParsingFailed; | |
| 1355 | } | |
| 1356 | if (d.thread_local != null) { | |
| 1357 | switch (id) { | |
| 1358 | .keyword_extern, .keyword_static => {}, | |
| 1359 | else => try p.errStr(.cannot_combine_spec, p.tok_i, id.lexeme().?), | |
| 1360 | } | |
| 1361 | if (d.constexpr) |tok| try p.errStr(.cannot_combine_spec, p.tok_i, p.tok_ids[tok].lexeme().?); | |
| 1362 | } | |
| 1363 | if (d.constexpr != null) { | |
| 1364 | switch (id) { | |
| 1365 | .keyword_auto, .keyword_register, .keyword_static => {}, | |
| 1366 | else => try p.errStr(.cannot_combine_spec, p.tok_i, id.lexeme().?), | |
| 1367 | } | |
| 1368 | if (d.thread_local) |tok| try p.errStr(.cannot_combine_spec, p.tok_i, p.tok_ids[tok].lexeme().?); | |
| 1369 | } | |
| 1370 | switch (id) { | |
| 1371 | .keyword_typedef => d.storage_class = .{ .typedef = p.tok_i }, | |
| 1372 | .keyword_extern => d.storage_class = .{ .@"extern" = p.tok_i }, | |
| 1373 | .keyword_static => d.storage_class = .{ .static = p.tok_i }, | |
| 1374 | .keyword_auto => d.storage_class = .{ .auto = p.tok_i }, | |
| 1375 | .keyword_register => d.storage_class = .{ .register = p.tok_i }, | |
| 1376 | else => unreachable, | |
| 1377 | } | |
| 1378 | }, | |
| 1379 | .keyword_thread_local, | |
| 1380 | .keyword_c23_thread_local, | |
| 1381 | => { | |
| 1382 | if (d.thread_local != null) { | |
| 1383 | try p.errStr(.duplicate_decl_spec, p.tok_i, id.lexeme().?); | |
| 1384 | } | |
| 1385 | if (d.constexpr) |tok| try p.errStr(.cannot_combine_spec, p.tok_i, p.tok_ids[tok].lexeme().?); | |
| 1386 | switch (d.storage_class) { | |
| 1387 | .@"extern", .none, .static => {}, | |
| 1388 | else => try p.errStr(.cannot_combine_spec, p.tok_i, @tagName(d.storage_class)), | |
| 1389 | } | |
| 1390 | d.thread_local = p.tok_i; | |
| 1391 | }, | |
| 1392 | .keyword_constexpr => { | |
| 1393 | if (d.constexpr != null) { | |
| 1394 | try p.errStr(.duplicate_decl_spec, p.tok_i, id.lexeme().?); | |
| 1395 | } | |
| 1396 | if (d.thread_local) |tok| try p.errStr(.cannot_combine_spec, p.tok_i, p.tok_ids[tok].lexeme().?); | |
| 1397 | switch (d.storage_class) { | |
| 1398 | .auto, .register, .none, .static => {}, | |
| 1399 | else => try p.errStr(.cannot_combine_spec, p.tok_i, @tagName(d.storage_class)), | |
| 1400 | } | |
| 1401 | d.constexpr = p.tok_i; | |
| 1402 | }, | |
| 1403 | .keyword_inline, .keyword_inline1, .keyword_inline2 => { | |
| 1404 | if (d.@"inline" != null) { | |
| 1405 | try p.errStr(.duplicate_decl_spec, p.tok_i, "inline"); | |
| 1406 | } | |
| 1407 | d.@"inline" = p.tok_i; | |
| 1408 | }, | |
| 1409 | .keyword_noreturn => { | |
| 1410 | if (d.noreturn != null) { | |
| 1411 | try p.errStr(.duplicate_decl_spec, p.tok_i, "_Noreturn"); | |
| 1412 | } | |
| 1413 | d.noreturn = p.tok_i; | |
| 1414 | }, | |
| 1415 | else => break, | |
| 1416 | } | |
| 1417 | p.tok_i += 1; | |
| 1418 | } | |
| 1419 | ||
| 1420 | if (p.tok_i == start) return null; | |
| 1421 | ||
| 1422 | d.ty = try spec.finish(p); | |
| 1423 | d.auto_type = spec.auto_type_tok; | |
| 1424 | return d; | |
| 1425 | } | |
| 1426 | ||
| 1427 | const InitDeclarator = struct { d: Declarator, initializer: Result = .{} }; | |
| 1428 | ||
| 1429 | /// attribute | |
| 1430 | /// : attrIdentifier | |
| 1431 | /// | attrIdentifier '(' identifier ')' | |
| 1432 | /// | attrIdentifier '(' identifier (',' expr)+ ')' | |
| 1433 | /// | attrIdentifier '(' (expr (',' expr)*)? ')' | |
| 1434 | fn attribute(p: *Parser, kind: Attribute.Kind, namespace: ?[]const u8) Error!?TentativeAttribute { | |
| 1435 | const name_tok = p.tok_i; | |
| 1436 | switch (p.tok_ids[p.tok_i]) { | |
| 1437 | .keyword_const, .keyword_const1, .keyword_const2 => p.tok_i += 1, | |
| 1438 | else => _ = try p.expectIdentifier(), | |
| 1439 | } | |
| 1440 | const name = p.tokSlice(name_tok); | |
| 1441 | ||
| 1442 | const attr = Attribute.fromString(kind, namespace, name) orelse { | |
| 1443 | const tag: Diagnostics.Tag = if (kind == .declspec) .declspec_attr_not_supported else .unknown_attribute; | |
| 1444 | try p.errStr(tag, name_tok, name); | |
| 1445 | if (p.eatToken(.l_paren)) |_| p.skipTo(.r_paren); | |
| 1446 | return null; | |
| 1447 | }; | |
| 1448 | ||
| 1449 | const required_count = Attribute.requiredArgCount(attr); | |
| 1450 | var arguments = Attribute.initArguments(attr, name_tok); | |
| 1451 | var arg_idx: u32 = 0; | |
| 1452 | ||
| 1453 | switch (p.tok_ids[p.tok_i]) { | |
| 1454 | .comma, .r_paren => {}, // will be consumed in attributeList | |
| 1455 | .l_paren => blk: { | |
| 1456 | p.tok_i += 1; | |
| 1457 | if (p.eatToken(.r_paren)) |_| break :blk; | |
| 1458 | ||
| 1459 | if (Attribute.wantsIdentEnum(attr)) { | |
| 1460 | if (try p.eatIdentifier()) |ident| { | |
| 1461 | if (Attribute.diagnoseIdent(attr, &arguments, p.tokSlice(ident))) |msg| { | |
| 1462 | try p.errExtra(msg.tag, ident, msg.extra); | |
| 1463 | p.skipTo(.r_paren); | |
| 1464 | return error.ParsingFailed; | |
| 1465 | } | |
| 1466 | } else { | |
| 1467 | try p.errExtra(.attribute_requires_identifier, name_tok, .{ .str = name }); | |
| 1468 | return error.ParsingFailed; | |
| 1469 | } | |
| 1470 | } else { | |
| 1471 | const arg_start = p.tok_i; | |
| 1472 | var first_expr = try p.assignExpr(); | |
| 1473 | try first_expr.expect(p); | |
| 1474 | if (p.diagnose(attr, &arguments, arg_idx, first_expr)) |msg| { | |
| 1475 | try p.errExtra(msg.tag, arg_start, msg.extra); | |
| 1476 | p.skipTo(.r_paren); | |
| 1477 | return error.ParsingFailed; | |
| 1478 | } | |
| 1479 | } | |
| 1480 | arg_idx += 1; | |
| 1481 | while (p.eatToken(.r_paren) == null) : (arg_idx += 1) { | |
| 1482 | _ = try p.expectToken(.comma); | |
| 1483 | ||
| 1484 | const arg_start = p.tok_i; | |
| 1485 | var arg_expr = try p.assignExpr(); | |
| 1486 | try arg_expr.expect(p); | |
| 1487 | if (p.diagnose(attr, &arguments, arg_idx, arg_expr)) |msg| { | |
| 1488 | try p.errExtra(msg.tag, arg_start, msg.extra); | |
| 1489 | p.skipTo(.r_paren); | |
| 1490 | return error.ParsingFailed; | |
| 1491 | } | |
| 1492 | } | |
| 1493 | }, | |
| 1494 | else => {}, | |
| 1495 | } | |
| 1496 | if (arg_idx < required_count) { | |
| 1497 | try p.errExtra(.attribute_not_enough_args, name_tok, .{ .attr_arg_count = .{ .attribute = attr, .expected = required_count } }); | |
| 1498 | return error.ParsingFailed; | |
| 1499 | } | |
| 1500 | return TentativeAttribute{ .attr = .{ .tag = attr, .args = arguments, .syntax = kind.toSyntax() }, .tok = name_tok }; | |
| 1501 | } | |
| 1502 | ||
| 1503 | fn diagnose(p: *Parser, attr: Attribute.Tag, arguments: *Attribute.Arguments, arg_idx: u32, res: Result) ?Diagnostics.Message { | |
| 1504 | if (Attribute.wantsAlignment(attr, arg_idx)) { | |
| 1505 | return Attribute.diagnoseAlignment(attr, arguments, arg_idx, res.val, res.ty, p.comp); | |
| 1506 | } | |
| 1507 | const node = p.nodes.get(@intFromEnum(res.node)); | |
| 1508 | return Attribute.diagnose(attr, arguments, arg_idx, res.val, node, p.retained_strings.items); | |
| 1509 | } | |
| 1510 | ||
| 1511 | /// attributeList : (attribute (',' attribute)*)? | |
| 1512 | fn gnuAttributeList(p: *Parser) Error!void { | |
| 1513 | if (p.tok_ids[p.tok_i] == .r_paren) return; | |
| 1514 | ||
| 1515 | if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(p.gpa, attr); | |
| 1516 | while (p.tok_ids[p.tok_i] != .r_paren) { | |
| 1517 | _ = try p.expectToken(.comma); | |
| 1518 | if (try p.attribute(.gnu, null)) |attr| try p.attr_buf.append(p.gpa, attr); | |
| 1519 | } | |
| 1520 | } | |
| 1521 | ||
| 1522 | fn c2xAttributeList(p: *Parser) Error!void { | |
| 1523 | while (p.tok_ids[p.tok_i] != .r_bracket) { | |
| 1524 | var namespace_tok = try p.expectIdentifier(); | |
| 1525 | var namespace: ?[]const u8 = null; | |
| 1526 | if (p.eatToken(.colon_colon)) |_| { | |
| 1527 | namespace = p.tokSlice(namespace_tok); | |
| 1528 | } else { | |
| 1529 | p.tok_i -= 1; | |
| 1530 | } | |
| 1531 | if (try p.attribute(.c2x, namespace)) |attr| try p.attr_buf.append(p.gpa, attr); | |
| 1532 | _ = p.eatToken(.comma); | |
| 1533 | } | |
| 1534 | } | |
| 1535 | ||
| 1536 | fn msvcAttributeList(p: *Parser) Error!void { | |
| 1537 | while (p.tok_ids[p.tok_i] != .r_paren) { | |
| 1538 | if (try p.attribute(.declspec, null)) |attr| try p.attr_buf.append(p.gpa, attr); | |
| 1539 | _ = p.eatToken(.comma); | |
| 1540 | } | |
| 1541 | } | |
| 1542 | ||
| 1543 | fn c2xAttribute(p: *Parser) !bool { | |
| 1544 | if (!p.comp.langopts.standard.atLeast(.c2x)) return false; | |
| 1545 | const bracket1 = p.eatToken(.l_bracket) orelse return false; | |
| 1546 | const bracket2 = p.eatToken(.l_bracket) orelse { | |
| 1547 | p.tok_i -= 1; | |
| 1548 | return false; | |
| 1549 | }; | |
| 1550 | ||
| 1551 | try p.c2xAttributeList(); | |
| 1552 | ||
| 1553 | _ = try p.expectClosing(bracket2, .r_bracket); | |
| 1554 | _ = try p.expectClosing(bracket1, .r_bracket); | |
| 1555 | ||
| 1556 | return true; | |
| 1557 | } | |
| 1558 | ||
| 1559 | fn msvcAttribute(p: *Parser) !bool { | |
| 1560 | _ = p.eatToken(.keyword_declspec) orelse return false; | |
| 1561 | const l_paren = try p.expectToken(.l_paren); | |
| 1562 | try p.msvcAttributeList(); | |
| 1563 | _ = try p.expectClosing(l_paren, .r_paren); | |
| 1564 | ||
| 1565 | return true; | |
| 1566 | } | |
| 1567 | ||
| 1568 | fn gnuAttribute(p: *Parser) !bool { | |
| 1569 | switch (p.tok_ids[p.tok_i]) { | |
| 1570 | .keyword_attribute1, .keyword_attribute2 => p.tok_i += 1, | |
| 1571 | else => return false, | |
| 1572 | } | |
| 1573 | const paren1 = try p.expectToken(.l_paren); | |
| 1574 | const paren2 = try p.expectToken(.l_paren); | |
| 1575 | ||
| 1576 | try p.gnuAttributeList(); | |
| 1577 | ||
| 1578 | _ = try p.expectClosing(paren2, .r_paren); | |
| 1579 | _ = try p.expectClosing(paren1, .r_paren); | |
| 1580 | return true; | |
| 1581 | } | |
| 1582 | ||
| 1583 | fn attributeSpecifier(p: *Parser) Error!void { | |
| 1584 | return attributeSpecifierExtra(p, null); | |
| 1585 | } | |
| 1586 | ||
| 1587 | /// attributeSpecifier : (keyword_attribute '( '(' attributeList ')' ')')* | |
| 1588 | fn attributeSpecifierExtra(p: *Parser, declarator_name: ?TokenIndex) Error!void { | |
| 1589 | while (true) { | |
| 1590 | if (try p.gnuAttribute()) continue; | |
| 1591 | if (try p.c2xAttribute()) continue; | |
| 1592 | const maybe_declspec_tok = p.tok_i; | |
| 1593 | const attr_buf_top = p.attr_buf.len; | |
| 1594 | if (try p.msvcAttribute()) { | |
| 1595 | if (declarator_name) |name_tok| { | |
| 1596 | try p.errTok(.declspec_not_allowed_after_declarator, maybe_declspec_tok); | |
| 1597 | try p.errTok(.declarator_name_tok, name_tok); | |
| 1598 | p.attr_buf.len = attr_buf_top; | |
| 1599 | } | |
| 1600 | continue; | |
| 1601 | } | |
| 1602 | break; | |
| 1603 | } | |
| 1604 | } | |
| 1605 | ||
| 1606 | /// initDeclarator : declarator assembly? attributeSpecifier? ('=' initializer)? | |
| 1607 | fn initDeclarator(p: *Parser, decl_spec: *DeclSpec, attr_buf_top: usize) Error!?InitDeclarator { | |
| 1608 | const this_attr_buf_top = p.attr_buf.len; | |
| 1609 | defer p.attr_buf.len = this_attr_buf_top; | |
| 1610 | ||
| 1611 | var init_d = InitDeclarator{ | |
| 1612 | .d = (try p.declarator(decl_spec.ty, .normal)) orelse return null, | |
| 1613 | }; | |
| 1614 | ||
| 1615 | try p.attributeSpecifierExtra(init_d.d.name); | |
| 1616 | _ = try p.assembly(.decl_label); | |
| 1617 | try p.attributeSpecifierExtra(init_d.d.name); | |
| 1618 | ||
| 1619 | var apply_var_attributes = false; | |
| 1620 | if (decl_spec.storage_class == .typedef) { | |
| 1621 | if (decl_spec.auto_type) |tok_i| { | |
| 1622 | try p.errStr(.auto_type_not_allowed, tok_i, "typedef"); | |
| 1623 | return error.ParsingFailed; | |
| 1624 | } | |
| 1625 | init_d.d.ty = try Attribute.applyTypeAttributes(p, init_d.d.ty, attr_buf_top, null); | |
| 1626 | } else if (init_d.d.ty.isFunc()) { | |
| 1627 | init_d.d.ty = try Attribute.applyFunctionAttributes(p, init_d.d.ty, attr_buf_top); | |
| 1628 | } else { | |
| 1629 | apply_var_attributes = true; | |
| 1630 | } | |
| 1631 | ||
| 1632 | if (p.eatToken(.equal)) |eq| init: { | |
| 1633 | if (decl_spec.storage_class == .typedef or init_d.d.func_declarator != null) { | |
| 1634 | try p.errTok(.illegal_initializer, eq); | |
| 1635 | } else if (init_d.d.ty.is(.variable_len_array)) { | |
| 1636 | try p.errTok(.vla_init, eq); | |
| 1637 | } else if (decl_spec.storage_class == .@"extern") { | |
| 1638 | try p.err(.extern_initializer); | |
| 1639 | decl_spec.storage_class = .none; | |
| 1640 | } | |
| 1641 | ||
| 1642 | if (init_d.d.ty.hasIncompleteSize() and !init_d.d.ty.is(.incomplete_array)) { | |
| 1643 | try p.errStr(.variable_incomplete_ty, init_d.d.name, try p.typeStr(init_d.d.ty)); | |
| 1644 | return error.ParsingFailed; | |
| 1645 | } | |
| 1646 | ||
| 1647 | try p.syms.pushScope(p); | |
| 1648 | defer p.syms.popScope(); | |
| 1649 | ||
| 1650 | const interned_name = try p.comp.intern(p.tokSlice(init_d.d.name)); | |
| 1651 | try p.syms.declareSymbol(p, interned_name, init_d.d.ty, init_d.d.name, .none); | |
| 1652 | var init_list_expr = try p.initializer(init_d.d.ty); | |
| 1653 | init_d.initializer = init_list_expr; | |
| 1654 | if (!init_list_expr.ty.isArray()) break :init; | |
| 1655 | if (init_d.d.ty.specifier == .incomplete_array) { | |
| 1656 | // Modifying .data is exceptionally allowed for .incomplete_array. | |
| 1657 | init_d.d.ty.data.array.len = init_list_expr.ty.arrayLen() orelse break :init; | |
| 1658 | init_d.d.ty.specifier = .array; | |
| 1659 | } | |
| 1660 | } | |
| 1661 | ||
| 1662 | const name = init_d.d.name; | |
| 1663 | if (init_d.d.ty.is(.auto_type)) { | |
| 1664 | if (init_d.initializer.node == .none) { | |
| 1665 | init_d.d.ty = Type.invalid; | |
| 1666 | try p.errStr(.auto_type_requires_initializer, name, p.tokSlice(name)); | |
| 1667 | return init_d; | |
| 1668 | } else { | |
| 1669 | init_d.d.ty.specifier = init_d.initializer.ty.specifier; | |
| 1670 | init_d.d.ty.data = init_d.initializer.ty.data; | |
| 1671 | } | |
| 1672 | } | |
| 1673 | if (apply_var_attributes) { | |
| 1674 | init_d.d.ty = try Attribute.applyVariableAttributes(p, init_d.d.ty, attr_buf_top, null); | |
| 1675 | } | |
| 1676 | if (decl_spec.storage_class != .typedef and init_d.d.ty.hasIncompleteSize()) incomplete: { | |
| 1677 | const specifier = init_d.d.ty.canonicalize(.standard).specifier; | |
| 1678 | if (decl_spec.storage_class == .@"extern") switch (specifier) { | |
| 1679 | .@"struct", .@"union", .@"enum" => break :incomplete, | |
| 1680 | .incomplete_array => { | |
| 1681 | init_d.d.ty.decayArray(); | |
| 1682 | break :incomplete; | |
| 1683 | }, | |
| 1684 | else => {}, | |
| 1685 | }; | |
| 1686 | // if there was an initializer expression it must have contained an error | |
| 1687 | if (init_d.initializer.node != .none) break :incomplete; | |
| 1688 | ||
| 1689 | if (p.func.ty == null) { | |
| 1690 | if (specifier == .incomplete_array) { | |
| 1691 | // TODO properly check this after finishing parsing | |
| 1692 | try p.errStr(.tentative_array, name, try p.typeStr(init_d.d.ty)); | |
| 1693 | break :incomplete; | |
| 1694 | } else if (init_d.d.ty.getRecord()) |record| { | |
| 1695 | _ = try p.tentative_defs.getOrPutValue(p.comp.gpa, record.name, init_d.d.name); | |
| 1696 | break :incomplete; | |
| 1697 | } else if (init_d.d.ty.get(.@"enum")) |en| { | |
| 1698 | _ = try p.tentative_defs.getOrPutValue(p.comp.gpa, en.data.@"enum".name, init_d.d.name); | |
| 1699 | break :incomplete; | |
| 1700 | } | |
| 1701 | } | |
| 1702 | try p.errStr(.variable_incomplete_ty, name, try p.typeStr(init_d.d.ty)); | |
| 1703 | } | |
| 1704 | return init_d; | |
| 1705 | } | |
| 1706 | ||
| 1707 | /// typeSpec | |
| 1708 | /// : keyword_void | |
| 1709 | /// | keyword_auto_type | |
| 1710 | /// | keyword_char | |
| 1711 | /// | keyword_short | |
| 1712 | /// | keyword_int | |
| 1713 | /// | keyword_long | |
| 1714 | /// | keyword_float | |
| 1715 | /// | keyword_double | |
| 1716 | /// | keyword_signed | |
| 1717 | /// | keyword_unsigned | |
| 1718 | /// | keyword_bool | |
| 1719 | /// | keyword_c23_bool | |
| 1720 | /// | keyword_complex | |
| 1721 | /// | atomicTypeSpec | |
| 1722 | /// | recordSpec | |
| 1723 | /// | enumSpec | |
| 1724 | /// | typedef // IDENTIFIER | |
| 1725 | /// | typeof | |
| 1726 | /// | keyword_bit_int '(' integerConstExpr ')' | |
| 1727 | /// atomicTypeSpec : keyword_atomic '(' typeName ')' | |
| 1728 | /// alignSpec | |
| 1729 | /// : keyword_alignas '(' typeName ')' | |
| 1730 | /// | keyword_alignas '(' integerConstExpr ')' | |
| 1731 | /// | keyword_c23_alignas '(' typeName ')' | |
| 1732 | /// | keyword_c23_alignas '(' integerConstExpr ')' | |
| 1733 | fn typeSpec(p: *Parser, ty: *Type.Builder) Error!bool { | |
| 1734 | const start = p.tok_i; | |
| 1735 | while (true) { | |
| 1736 | try p.attributeSpecifier(); | |
| 1737 | ||
| 1738 | if (try p.typeof()) |inner_ty| { | |
| 1739 | try ty.combineFromTypeof(p, inner_ty, start); | |
| 1740 | continue; | |
| 1741 | } | |
| 1742 | if (try p.typeQual(&ty.qual)) continue; | |
| 1743 | switch (p.tok_ids[p.tok_i]) { | |
| 1744 | .keyword_void => try ty.combine(p, .void, p.tok_i), | |
| 1745 | .keyword_auto_type => { | |
| 1746 | try p.errTok(.auto_type_extension, p.tok_i); | |
| 1747 | try ty.combine(p, .auto_type, p.tok_i); | |
| 1748 | }, | |
| 1749 | .keyword_bool, .keyword_c23_bool => try ty.combine(p, .bool, p.tok_i), | |
| 1750 | .keyword_int8, .keyword_int8_2, .keyword_char => try ty.combine(p, .char, p.tok_i), | |
| 1751 | .keyword_int16, .keyword_int16_2, .keyword_short => try ty.combine(p, .short, p.tok_i), | |
| 1752 | .keyword_int32, .keyword_int32_2, .keyword_int => try ty.combine(p, .int, p.tok_i), | |
| 1753 | .keyword_long => try ty.combine(p, .long, p.tok_i), | |
| 1754 | .keyword_int64, .keyword_int64_2 => try ty.combine(p, .long_long, p.tok_i), | |
| 1755 | .keyword_int128 => try ty.combine(p, .int128, p.tok_i), | |
| 1756 | .keyword_signed => try ty.combine(p, .signed, p.tok_i), | |
| 1757 | .keyword_unsigned => try ty.combine(p, .unsigned, p.tok_i), | |
| 1758 | .keyword_fp16 => try ty.combine(p, .fp16, p.tok_i), | |
| 1759 | .keyword_float16 => try ty.combine(p, .float16, p.tok_i), | |
| 1760 | .keyword_float => try ty.combine(p, .float, p.tok_i), | |
| 1761 | .keyword_double => try ty.combine(p, .double, p.tok_i), | |
| 1762 | .keyword_complex => try ty.combine(p, .complex, p.tok_i), | |
| 1763 | .keyword_float80 => try ty.combine(p, .float80, p.tok_i), | |
| 1764 | .keyword_float128 => try ty.combine(p, .float128, p.tok_i), | |
| 1765 | .keyword_atomic => { | |
| 1766 | const atomic_tok = p.tok_i; | |
| 1767 | p.tok_i += 1; | |
| 1768 | const l_paren = p.eatToken(.l_paren) orelse { | |
| 1769 | // _Atomic qualifier not _Atomic(typeName) | |
| 1770 | p.tok_i = atomic_tok; | |
| 1771 | break; | |
| 1772 | }; | |
| 1773 | const inner_ty = (try p.typeName()) orelse { | |
| 1774 | try p.err(.expected_type); | |
| 1775 | return error.ParsingFailed; | |
| 1776 | }; | |
| 1777 | try p.expectClosing(l_paren, .r_paren); | |
| 1778 | ||
| 1779 | const new_spec = Type.Builder.fromType(inner_ty); | |
| 1780 | try ty.combine(p, new_spec, atomic_tok); | |
| 1781 | ||
| 1782 | if (ty.qual.atomic != null) | |
| 1783 | try p.errStr(.duplicate_decl_spec, atomic_tok, "atomic") | |
| 1784 | else | |
| 1785 | ty.qual.atomic = atomic_tok; | |
| 1786 | continue; | |
| 1787 | }, | |
| 1788 | .keyword_alignas, | |
| 1789 | .keyword_c23_alignas, | |
| 1790 | => { | |
| 1791 | const align_tok = p.tok_i; | |
| 1792 | p.tok_i += 1; | |
| 1793 | const l_paren = try p.expectToken(.l_paren); | |
| 1794 | const typename_start = p.tok_i; | |
| 1795 | if (try p.typeName()) |inner_ty| { | |
| 1796 | if (!inner_ty.alignable()) { | |
| 1797 | try p.errStr(.invalid_alignof, typename_start, try p.typeStr(inner_ty)); | |
| 1798 | } | |
| 1799 | const alignment = Attribute.Alignment{ .requested = inner_ty.alignof(p.comp) }; | |
| 1800 | try p.attr_buf.append(p.gpa, .{ | |
| 1801 | .attr = .{ .tag = .aligned, .args = .{ | |
| 1802 | .aligned = .{ .alignment = alignment, .__name_tok = align_tok }, | |
| 1803 | }, .syntax = .keyword }, | |
| 1804 | .tok = align_tok, | |
| 1805 | }); | |
| 1806 | } else { | |
| 1807 | const arg_start = p.tok_i; | |
| 1808 | const res = try p.integerConstExpr(.no_const_decl_folding); | |
| 1809 | if (!res.val.isZero()) { | |
| 1810 | var args = Attribute.initArguments(.aligned, align_tok); | |
| 1811 | if (p.diagnose(.aligned, &args, 0, res)) |msg| { | |
| 1812 | try p.errExtra(msg.tag, arg_start, msg.extra); | |
| 1813 | p.skipTo(.r_paren); | |
| 1814 | return error.ParsingFailed; | |
| 1815 | } | |
| 1816 | args.aligned.alignment.?.node = res.node; | |
| 1817 | try p.attr_buf.append(p.gpa, .{ | |
| 1818 | .attr = .{ .tag = .aligned, .args = args, .syntax = .keyword }, | |
| 1819 | .tok = align_tok, | |
| 1820 | }); | |
| 1821 | } | |
| 1822 | } | |
| 1823 | try p.expectClosing(l_paren, .r_paren); | |
| 1824 | continue; | |
| 1825 | }, | |
| 1826 | .keyword_stdcall, | |
| 1827 | .keyword_stdcall2, | |
| 1828 | .keyword_thiscall, | |
| 1829 | .keyword_thiscall2, | |
| 1830 | .keyword_vectorcall, | |
| 1831 | .keyword_vectorcall2, | |
| 1832 | => try p.attr_buf.append(p.gpa, .{ | |
| 1833 | .attr = .{ .tag = .calling_convention, .args = .{ | |
| 1834 | .calling_convention = .{ .cc = switch (p.tok_ids[p.tok_i]) { | |
| 1835 | .keyword_stdcall, | |
| 1836 | .keyword_stdcall2, | |
| 1837 | => .stdcall, | |
| 1838 | .keyword_thiscall, | |
| 1839 | .keyword_thiscall2, | |
| 1840 | => .thiscall, | |
| 1841 | .keyword_vectorcall, | |
| 1842 | .keyword_vectorcall2, | |
| 1843 | => .vectorcall, | |
| 1844 | else => unreachable, | |
| 1845 | } }, | |
| 1846 | }, .syntax = .keyword }, | |
| 1847 | .tok = p.tok_i, | |
| 1848 | }), | |
| 1849 | .keyword_struct, .keyword_union => { | |
| 1850 | const tag_tok = p.tok_i; | |
| 1851 | const record_ty = try p.recordSpec(); | |
| 1852 | try ty.combine(p, Type.Builder.fromType(record_ty), tag_tok); | |
| 1853 | continue; | |
| 1854 | }, | |
| 1855 | .keyword_enum => { | |
| 1856 | const tag_tok = p.tok_i; | |
| 1857 | const enum_ty = try p.enumSpec(); | |
| 1858 | try ty.combine(p, Type.Builder.fromType(enum_ty), tag_tok); | |
| 1859 | continue; | |
| 1860 | }, | |
| 1861 | .identifier, .extended_identifier => { | |
| 1862 | var interned_name = try p.comp.intern(p.tokSlice(p.tok_i)); | |
| 1863 | var declspec_found = false; | |
| 1864 | ||
| 1865 | if (interned_name == p.string_ids.declspec_id) { | |
| 1866 | try p.errTok(.declspec_not_enabled, p.tok_i); | |
| 1867 | p.tok_i += 1; | |
| 1868 | if (p.eatToken(.l_paren)) |_| { | |
| 1869 | p.skipTo(.r_paren); | |
| 1870 | continue; | |
| 1871 | } | |
| 1872 | declspec_found = true; | |
| 1873 | } | |
| 1874 | if (ty.typedef != null) break; | |
| 1875 | if (declspec_found) { | |
| 1876 | interned_name = try p.comp.intern(p.tokSlice(p.tok_i)); | |
| 1877 | } | |
| 1878 | const typedef = (try p.syms.findTypedef(p, interned_name, p.tok_i, ty.specifier != .none)) orelse break; | |
| 1879 | if (!ty.combineTypedef(p, typedef.ty, typedef.tok)) break; | |
| 1880 | }, | |
| 1881 | .keyword_bit_int => { | |
| 1882 | try p.err(.bit_int); | |
| 1883 | const bit_int_tok = p.tok_i; | |
| 1884 | p.tok_i += 1; | |
| 1885 | const l_paren = try p.expectToken(.l_paren); | |
| 1886 | const res = try p.integerConstExpr(.gnu_folding_extension); | |
| 1887 | try p.expectClosing(l_paren, .r_paren); | |
| 1888 | ||
| 1889 | var bits: i16 = undefined; | |
| 1890 | if (res.val.tag == .unavailable) { | |
| 1891 | try p.errTok(.expected_integer_constant_expr, bit_int_tok); | |
| 1892 | return error.ParsingFailed; | |
| 1893 | } else if (res.val.compare(.lte, Value.int(0), res.ty, p.comp)) { | |
| 1894 | bits = -1; | |
| 1895 | } else if (res.val.compare(.gt, Value.int(128), res.ty, p.comp)) { | |
| 1896 | bits = 129; | |
| 1897 | } else { | |
| 1898 | bits = res.val.getInt(i16); | |
| 1899 | } | |
| 1900 | ||
| 1901 | try ty.combine(p, .{ .bit_int = bits }, bit_int_tok); | |
| 1902 | continue; | |
| 1903 | }, | |
| 1904 | else => break, | |
| 1905 | } | |
| 1906 | // consume single token specifiers here | |
| 1907 | p.tok_i += 1; | |
| 1908 | } | |
| 1909 | return p.tok_i != start; | |
| 1910 | } | |
| 1911 | ||
| 1912 | fn getAnonymousName(p: *Parser, kind_tok: TokenIndex) !StringId { | |
| 1913 | const loc = p.pp.tokens.items(.loc)[kind_tok]; | |
| 1914 | const source = p.comp.getSource(loc.id); | |
| 1915 | const line_col = source.lineCol(loc); | |
| 1916 | ||
| 1917 | const kind_str = switch (p.tok_ids[kind_tok]) { | |
| 1918 | .keyword_struct, .keyword_union, .keyword_enum => p.tokSlice(kind_tok), | |
| 1919 | else => "record field", | |
| 1920 | }; | |
| 1921 | ||
| 1922 | const str = try std.fmt.allocPrint( | |
| 1923 | p.arena, | |
| 1924 | "(anonymous {s} at {s}:{d}:{d})", | |
| 1925 | .{ kind_str, source.path, line_col.line_no, line_col.col }, | |
| 1926 | ); | |
| 1927 | return p.comp.intern(str); | |
| 1928 | } | |
| 1929 | ||
| 1930 | /// recordSpec | |
| 1931 | /// : (keyword_struct | keyword_union) IDENTIFIER? { recordDecl* } | |
| 1932 | /// | (keyword_struct | keyword_union) IDENTIFIER | |
| 1933 | fn recordSpec(p: *Parser) Error!Type { | |
| 1934 | const starting_pragma_pack = p.pragma_pack; | |
| 1935 | const kind_tok = p.tok_i; | |
| 1936 | const is_struct = p.tok_ids[kind_tok] == .keyword_struct; | |
| 1937 | p.tok_i += 1; | |
| 1938 | const attr_buf_top = p.attr_buf.len; | |
| 1939 | defer p.attr_buf.len = attr_buf_top; | |
| 1940 | try p.attributeSpecifier(); | |
| 1941 | ||
| 1942 | const maybe_ident = try p.eatIdentifier(); | |
| 1943 | const l_brace = p.eatToken(.l_brace) orelse { | |
| 1944 | const ident = maybe_ident orelse { | |
| 1945 | try p.err(.ident_or_l_brace); | |
| 1946 | return error.ParsingFailed; | |
| 1947 | }; | |
| 1948 | // check if this is a reference to a previous type | |
| 1949 | const interned_name = try p.comp.intern(p.tokSlice(ident)); | |
| 1950 | if (try p.syms.findTag(p, interned_name, p.tok_ids[kind_tok], ident, p.tok_ids[p.tok_i])) |prev| { | |
| 1951 | return prev.ty; | |
| 1952 | } else { | |
| 1953 | // this is a forward declaration, create a new record Type. | |
| 1954 | const record_ty = try Type.Record.create(p.arena, interned_name); | |
| 1955 | const ty = try Attribute.applyTypeAttributes(p, .{ | |
| 1956 | .specifier = if (is_struct) .@"struct" else .@"union", | |
| 1957 | .data = .{ .record = record_ty }, | |
| 1958 | }, attr_buf_top, null); | |
| 1959 | try p.syms.syms.append(p.gpa, .{ | |
| 1960 | .kind = if (is_struct) .@"struct" else .@"union", | |
| 1961 | .name = interned_name, | |
| 1962 | .tok = ident, | |
| 1963 | .ty = ty, | |
| 1964 | .val = .{}, | |
| 1965 | }); | |
| 1966 | try p.decl_buf.append(try p.addNode(.{ | |
| 1967 | .tag = if (is_struct) .struct_forward_decl else .union_forward_decl, | |
| 1968 | .ty = ty, | |
| 1969 | .data = .{ .decl_ref = ident }, | |
| 1970 | })); | |
| 1971 | return ty; | |
| 1972 | } | |
| 1973 | }; | |
| 1974 | ||
| 1975 | var done = false; | |
| 1976 | errdefer if (!done) p.skipTo(.r_brace); | |
| 1977 | ||
| 1978 | // Get forward declared type or create a new one | |
| 1979 | var defined = false; | |
| 1980 | const record_ty: *Type.Record = if (maybe_ident) |ident| record_ty: { | |
| 1981 | const ident_str = p.tokSlice(ident); | |
| 1982 | const interned_name = try p.comp.intern(ident_str); | |
| 1983 | if (try p.syms.defineTag(p, interned_name, p.tok_ids[kind_tok], ident)) |prev| { | |
| 1984 | if (!prev.ty.hasIncompleteSize()) { | |
| 1985 | // if the record isn't incomplete, this is a redefinition | |
| 1986 | try p.errStr(.redefinition, ident, ident_str); | |
| 1987 | try p.errTok(.previous_definition, prev.tok); | |
| 1988 | } else { | |
| 1989 | defined = true; | |
| 1990 | break :record_ty prev.ty.get(if (is_struct) .@"struct" else .@"union").?.data.record; | |
| 1991 | } | |
| 1992 | } | |
| 1993 | break :record_ty try Type.Record.create(p.arena, interned_name); | |
| 1994 | } else try Type.Record.create(p.arena, try p.getAnonymousName(kind_tok)); | |
| 1995 | ||
| 1996 | // Initially create ty as a regular non-attributed type, since attributes for a record | |
| 1997 | // can be specified after the closing rbrace, which we haven't encountered yet. | |
| 1998 | var ty = Type{ | |
| 1999 | .specifier = if (is_struct) .@"struct" else .@"union", | |
| 2000 | .data = .{ .record = record_ty }, | |
| 2001 | }; | |
| 2002 | ||
| 2003 | // declare a symbol for the type | |
| 2004 | // We need to replace the symbol's type if it has attributes | |
| 2005 | var symbol_index: ?usize = null; | |
| 2006 | if (maybe_ident != null and !defined) { | |
| 2007 | symbol_index = p.syms.syms.len; | |
| 2008 | try p.syms.syms.append(p.gpa, .{ | |
| 2009 | .kind = if (is_struct) .@"struct" else .@"union", | |
| 2010 | .name = record_ty.name, | |
| 2011 | .tok = maybe_ident.?, | |
| 2012 | .ty = ty, | |
| 2013 | .val = .{}, | |
| 2014 | }); | |
| 2015 | } | |
| 2016 | ||
| 2017 | // reserve space for this record | |
| 2018 | try p.decl_buf.append(.none); | |
| 2019 | const decl_buf_top = p.decl_buf.items.len; | |
| 2020 | const record_buf_top = p.record_buf.items.len; | |
| 2021 | errdefer p.decl_buf.items.len = decl_buf_top - 1; | |
| 2022 | defer { | |
| 2023 | p.decl_buf.items.len = decl_buf_top; | |
| 2024 | p.record_buf.items.len = record_buf_top; | |
| 2025 | } | |
| 2026 | ||
| 2027 | const old_record = p.record; | |
| 2028 | const old_members = p.record_members.items.len; | |
| 2029 | const old_field_attr_start = p.field_attr_buf.items.len; | |
| 2030 | p.record = .{ | |
| 2031 | .kind = p.tok_ids[kind_tok], | |
| 2032 | .start = p.record_members.items.len, | |
| 2033 | .field_attr_start = p.field_attr_buf.items.len, | |
| 2034 | }; | |
| 2035 | defer p.record = old_record; | |
| 2036 | defer p.record_members.items.len = old_members; | |
| 2037 | defer p.field_attr_buf.items.len = old_field_attr_start; | |
| 2038 | ||
| 2039 | try p.recordDecls(); | |
| 2040 | ||
| 2041 | if (p.record.flexible_field) |some| { | |
| 2042 | if (p.record_buf.items[record_buf_top..].len == 1 and is_struct) { | |
| 2043 | try p.errTok(.flexible_in_empty, some); | |
| 2044 | } | |
| 2045 | } | |
| 2046 | ||
| 2047 | for (p.record_buf.items[record_buf_top..]) |field| { | |
| 2048 | if (field.ty.hasIncompleteSize() and !field.ty.is(.incomplete_array)) break; | |
| 2049 | } else { | |
| 2050 | record_ty.fields = try p.arena.dupe(Type.Record.Field, p.record_buf.items[record_buf_top..]); | |
| 2051 | } | |
| 2052 | if (old_field_attr_start < p.field_attr_buf.items.len) { | |
| 2053 | const field_attr_slice = p.field_attr_buf.items[old_field_attr_start..]; | |
| 2054 | const duped = try p.arena.dupe([]const Attribute, field_attr_slice); | |
| 2055 | record_ty.field_attributes = duped.ptr; | |
| 2056 | } | |
| 2057 | ||
| 2058 | if (p.record_buf.items.len == record_buf_top) { | |
| 2059 | try p.errStr(.empty_record, kind_tok, p.tokSlice(kind_tok)); | |
| 2060 | try p.errStr(.empty_record_size, kind_tok, p.tokSlice(kind_tok)); | |
| 2061 | } | |
| 2062 | try p.expectClosing(l_brace, .r_brace); | |
| 2063 | done = true; | |
| 2064 | try p.attributeSpecifier(); | |
| 2065 | ||
| 2066 | ty = try Attribute.applyTypeAttributes(p, .{ | |
| 2067 | .specifier = if (is_struct) .@"struct" else .@"union", | |
| 2068 | .data = .{ .record = record_ty }, | |
| 2069 | }, attr_buf_top, null); | |
| 2070 | if (ty.specifier == .attributed and symbol_index != null) { | |
| 2071 | p.syms.syms.items(.ty)[symbol_index.?] = ty; | |
| 2072 | } | |
| 2073 | ||
| 2074 | if (!ty.hasIncompleteSize()) { | |
| 2075 | const pragma_pack_value = switch (p.comp.langopts.emulate) { | |
| 2076 | .clang => starting_pragma_pack, | |
| 2077 | .gcc => p.pragma_pack, | |
| 2078 | // TODO: msvc considers `#pragma pack` on a per-field basis | |
| 2079 | .msvc => p.pragma_pack, | |
| 2080 | }; | |
| 2081 | record_layout.compute(record_ty, ty, p.pp.comp, pragma_pack_value); | |
| 2082 | } | |
| 2083 | ||
| 2084 | // finish by creating a node | |
| 2085 | var node: Tree.Node = .{ | |
| 2086 | .tag = if (is_struct) .struct_decl_two else .union_decl_two, | |
| 2087 | .ty = ty, | |
| 2088 | .data = .{ .bin = .{ .lhs = .none, .rhs = .none } }, | |
| 2089 | }; | |
| 2090 | const record_decls = p.decl_buf.items[decl_buf_top..]; | |
| 2091 | switch (record_decls.len) { | |
| 2092 | 0 => {}, | |
| 2093 | 1 => node.data = .{ .bin = .{ .lhs = record_decls[0], .rhs = .none } }, | |
| 2094 | 2 => node.data = .{ .bin = .{ .lhs = record_decls[0], .rhs = record_decls[1] } }, | |
| 2095 | else => { | |
| 2096 | node.tag = if (is_struct) .struct_decl else .union_decl; | |
| 2097 | node.data = .{ .range = try p.addList(record_decls) }; | |
| 2098 | }, | |
| 2099 | } | |
| 2100 | p.decl_buf.items[decl_buf_top - 1] = try p.addNode(node); | |
| 2101 | if (p.func.ty == null) { | |
| 2102 | _ = p.tentative_defs.remove(record_ty.name); | |
| 2103 | } | |
| 2104 | return ty; | |
| 2105 | } | |
| 2106 | ||
| 2107 | /// recordDecl | |
| 2108 | /// : specQual (recordDeclarator (',' recordDeclarator)*)? ; | |
| 2109 | /// | staticAssert | |
| 2110 | fn recordDecls(p: *Parser) Error!void { | |
| 2111 | while (true) { | |
| 2112 | if (try p.pragma()) continue; | |
| 2113 | if (try p.parseOrNextDecl(staticAssert)) continue; | |
| 2114 | if (p.eatToken(.keyword_extension)) |_| { | |
| 2115 | const saved_extension = p.extension_suppressed; | |
| 2116 | defer p.extension_suppressed = saved_extension; | |
| 2117 | p.extension_suppressed = true; | |
| 2118 | ||
| 2119 | if (try p.parseOrNextDecl(recordDeclarator)) continue; | |
| 2120 | try p.err(.expected_type); | |
| 2121 | p.nextExternDecl(); | |
| 2122 | continue; | |
| 2123 | } | |
| 2124 | if (try p.parseOrNextDecl(recordDeclarator)) continue; | |
| 2125 | break; | |
| 2126 | } | |
| 2127 | } | |
| 2128 | ||
| 2129 | /// recordDeclarator : keyword_extension? declarator (':' integerConstExpr)? | |
| 2130 | fn recordDeclarator(p: *Parser) Error!bool { | |
| 2131 | const attr_buf_top = p.attr_buf.len; | |
| 2132 | defer p.attr_buf.len = attr_buf_top; | |
| 2133 | const base_ty = (try p.specQual()) orelse return false; | |
| 2134 | ||
| 2135 | try p.attributeSpecifier(); // .record | |
| 2136 | while (true) { | |
| 2137 | const this_decl_top = p.attr_buf.len; | |
| 2138 | defer p.attr_buf.len = this_decl_top; | |
| 2139 | ||
| 2140 | try p.attributeSpecifier(); | |
| 2141 | ||
| 2142 | // 0 means unnamed | |
| 2143 | var name_tok: TokenIndex = 0; | |
| 2144 | var ty = base_ty; | |
| 2145 | if (ty.is(.auto_type)) { | |
| 2146 | try p.errStr(.auto_type_not_allowed, p.tok_i, if (p.record.kind == .keyword_struct) "struct member" else "union member"); | |
| 2147 | ty = Type.invalid; | |
| 2148 | } | |
| 2149 | var bits_node: NodeIndex = .none; | |
| 2150 | var bits: ?u32 = null; | |
| 2151 | const first_tok = p.tok_i; | |
| 2152 | if (try p.declarator(ty, .record)) |d| { | |
| 2153 | name_tok = d.name; | |
| 2154 | ty = d.ty; | |
| 2155 | } | |
| 2156 | ||
| 2157 | if (p.eatToken(.colon)) |_| bits: { | |
| 2158 | const bits_tok = p.tok_i; | |
| 2159 | const res = try p.integerConstExpr(.gnu_folding_extension); | |
| 2160 | if (!ty.isInt()) { | |
| 2161 | try p.errStr(.non_int_bitfield, first_tok, try p.typeStr(ty)); | |
| 2162 | break :bits; | |
| 2163 | } | |
| 2164 | ||
| 2165 | if (res.val.tag == .unavailable) { | |
| 2166 | try p.errTok(.expected_integer_constant_expr, bits_tok); | |
| 2167 | break :bits; | |
| 2168 | } else if (res.val.compare(.lt, Value.int(0), res.ty, p.comp)) { | |
| 2169 | try p.errExtra(.negative_bitwidth, first_tok, .{ | |
| 2170 | .signed = res.val.signExtend(res.ty, p.comp), | |
| 2171 | }); | |
| 2172 | break :bits; | |
| 2173 | } | |
| 2174 | ||
| 2175 | // incomplete size error is reported later | |
| 2176 | const bit_size = ty.bitSizeof(p.comp) orelse break :bits; | |
| 2177 | if (res.val.compare(.gt, Value.int(bit_size), res.ty, p.comp)) { | |
| 2178 | try p.errTok(.bitfield_too_big, name_tok); | |
| 2179 | break :bits; | |
| 2180 | } else if (res.val.isZero() and name_tok != 0) { | |
| 2181 | try p.errTok(.zero_width_named_field, name_tok); | |
| 2182 | break :bits; | |
| 2183 | } | |
| 2184 | ||
| 2185 | bits = res.val.getInt(u32); | |
| 2186 | bits_node = res.node; | |
| 2187 | } | |
| 2188 | ||
| 2189 | try p.attributeSpecifier(); // .record | |
| 2190 | const to_append = try Attribute.applyFieldAttributes(p, &ty, attr_buf_top); | |
| 2191 | ||
| 2192 | const any_fields_have_attrs = p.field_attr_buf.items.len > p.record.field_attr_start; | |
| 2193 | ||
| 2194 | if (any_fields_have_attrs) { | |
| 2195 | try p.field_attr_buf.append(to_append); | |
| 2196 | } else { | |
| 2197 | if (to_append.len > 0) { | |
| 2198 | const preceding = p.record_members.items.len - p.record.start; | |
| 2199 | if (preceding > 0) { | |
| 2200 | try p.field_attr_buf.appendNTimes(&.{}, preceding); | |
| 2201 | } | |
| 2202 | try p.field_attr_buf.append(to_append); | |
| 2203 | } | |
| 2204 | } | |
| 2205 | ||
| 2206 | if (name_tok == 0 and bits_node == .none) unnamed: { | |
| 2207 | if (ty.is(.@"enum") or ty.hasIncompleteSize()) break :unnamed; | |
| 2208 | if (ty.isAnonymousRecord(p.comp)) { | |
| 2209 | // An anonymous record appears as indirect fields on the parent | |
| 2210 | try p.record_buf.append(.{ | |
| 2211 | .name = try p.getAnonymousName(first_tok), | |
| 2212 | .ty = ty, | |
| 2213 | }); | |
| 2214 | const node = try p.addNode(.{ | |
| 2215 | .tag = .indirect_record_field_decl, | |
| 2216 | .ty = ty, | |
| 2217 | .data = undefined, | |
| 2218 | }); | |
| 2219 | try p.decl_buf.append(node); | |
| 2220 | try p.record.addFieldsFromAnonymous(p, ty); | |
| 2221 | break; // must be followed by a semicolon | |
| 2222 | } | |
| 2223 | try p.err(.missing_declaration); | |
| 2224 | } else { | |
| 2225 | const interned_name = if (name_tok != 0) try p.comp.intern(p.tokSlice(name_tok)) else try p.getAnonymousName(first_tok); | |
| 2226 | try p.record_buf.append(.{ | |
| 2227 | .name = interned_name, | |
| 2228 | .ty = ty, | |
| 2229 | .name_tok = name_tok, | |
| 2230 | .bit_width = bits, | |
| 2231 | }); | |
| 2232 | if (name_tok != 0) try p.record.addField(p, interned_name, name_tok); | |
| 2233 | const node = try p.addNode(.{ | |
| 2234 | .tag = .record_field_decl, | |
| 2235 | .ty = ty, | |
| 2236 | .data = .{ .decl = .{ .name = name_tok, .node = bits_node } }, | |
| 2237 | }); | |
| 2238 | try p.decl_buf.append(node); | |
| 2239 | } | |
| 2240 | ||
| 2241 | if (ty.isFunc()) { | |
| 2242 | try p.errTok(.func_field, first_tok); | |
| 2243 | } else if (ty.is(.variable_len_array)) { | |
| 2244 | try p.errTok(.vla_field, first_tok); | |
| 2245 | } else if (ty.is(.incomplete_array)) { | |
| 2246 | if (p.record.kind == .keyword_union) { | |
| 2247 | try p.errTok(.flexible_in_union, first_tok); | |
| 2248 | } | |
| 2249 | if (p.record.flexible_field) |some| { | |
| 2250 | if (p.record.kind == .keyword_struct) { | |
| 2251 | try p.errTok(.flexible_non_final, some); | |
| 2252 | } | |
| 2253 | } | |
| 2254 | p.record.flexible_field = first_tok; | |
| 2255 | } else if (ty.specifier != .invalid and ty.hasIncompleteSize()) { | |
| 2256 | try p.errStr(.field_incomplete_ty, first_tok, try p.typeStr(ty)); | |
| 2257 | } else if (p.record.flexible_field) |some| { | |
| 2258 | if (some != first_tok and p.record.kind == .keyword_struct) try p.errTok(.flexible_non_final, some); | |
| 2259 | } | |
| 2260 | if (p.eatToken(.comma) == null) break; | |
| 2261 | } | |
| 2262 | ||
| 2263 | if (p.eatToken(.semicolon) == null) { | |
| 2264 | const tok_id = p.tok_ids[p.tok_i]; | |
| 2265 | if (tok_id == .r_brace) { | |
| 2266 | try p.err(.missing_semicolon); | |
| 2267 | } else { | |
| 2268 | return p.errExpectedToken(.semicolon, tok_id); | |
| 2269 | } | |
| 2270 | } | |
| 2271 | ||
| 2272 | return true; | |
| 2273 | } | |
| 2274 | ||
| 2275 | /// specQual : (typeSpec | typeQual | alignSpec)+ | |
| 2276 | fn specQual(p: *Parser) Error!?Type { | |
| 2277 | var spec: Type.Builder = .{}; | |
| 2278 | if (try p.typeSpec(&spec)) { | |
| 2279 | return try spec.finish(p); | |
| 2280 | } | |
| 2281 | return null; | |
| 2282 | } | |
| 2283 | ||
| 2284 | /// enumSpec | |
| 2285 | /// : keyword_enum IDENTIFIER? (: typeName)? { enumerator (',' enumerator)? ',') } | |
| 2286 | /// | keyword_enum IDENTIFIER (: typeName)? | |
| 2287 | fn enumSpec(p: *Parser) Error!Type { | |
| 2288 | const enum_tok = p.tok_i; | |
| 2289 | p.tok_i += 1; | |
| 2290 | const attr_buf_top = p.attr_buf.len; | |
| 2291 | defer p.attr_buf.len = attr_buf_top; | |
| 2292 | try p.attributeSpecifier(); | |
| 2293 | ||
| 2294 | const maybe_ident = try p.eatIdentifier(); | |
| 2295 | const fixed_ty = if (p.eatToken(.colon)) |colon| fixed: { | |
| 2296 | const fixed = (try p.typeName()) orelse { | |
| 2297 | if (p.record.kind != .invalid) { | |
| 2298 | // This is a bit field. | |
| 2299 | p.tok_i -= 1; | |
| 2300 | break :fixed null; | |
| 2301 | } | |
| 2302 | try p.err(.expected_type); | |
| 2303 | try p.errTok(.enum_fixed, colon); | |
| 2304 | break :fixed null; | |
| 2305 | }; | |
| 2306 | try p.errTok(.enum_fixed, colon); | |
| 2307 | break :fixed fixed; | |
| 2308 | } else null; | |
| 2309 | ||
| 2310 | const l_brace = p.eatToken(.l_brace) orelse { | |
| 2311 | const ident = maybe_ident orelse { | |
| 2312 | try p.err(.ident_or_l_brace); | |
| 2313 | return error.ParsingFailed; | |
| 2314 | }; | |
| 2315 | // check if this is a reference to a previous type | |
| 2316 | const interned_name = try p.comp.intern(p.tokSlice(ident)); | |
| 2317 | if (try p.syms.findTag(p, interned_name, .keyword_enum, ident, p.tok_ids[p.tok_i])) |prev| { | |
| 2318 | try p.checkEnumFixedTy(fixed_ty, ident, prev); | |
| 2319 | return prev.ty; | |
| 2320 | } else { | |
| 2321 | // this is a forward declaration, create a new enum Type. | |
| 2322 | const enum_ty = try Type.Enum.create(p.arena, interned_name, fixed_ty); | |
| 2323 | const ty = try Attribute.applyTypeAttributes(p, .{ | |
| 2324 | .specifier = .@"enum", | |
| 2325 | .data = .{ .@"enum" = enum_ty }, | |
| 2326 | }, attr_buf_top, null); | |
| 2327 | try p.syms.syms.append(p.gpa, .{ | |
| 2328 | .kind = .@"enum", | |
| 2329 | .name = interned_name, | |
| 2330 | .tok = ident, | |
| 2331 | .ty = ty, | |
| 2332 | .val = .{}, | |
| 2333 | }); | |
| 2334 | try p.decl_buf.append(try p.addNode(.{ | |
| 2335 | .tag = .enum_forward_decl, | |
| 2336 | .ty = ty, | |
| 2337 | .data = .{ .decl_ref = ident }, | |
| 2338 | })); | |
| 2339 | return ty; | |
| 2340 | } | |
| 2341 | }; | |
| 2342 | ||
| 2343 | var done = false; | |
| 2344 | errdefer if (!done) p.skipTo(.r_brace); | |
| 2345 | ||
| 2346 | // Get forward declared type or create a new one | |
| 2347 | var defined = false; | |
| 2348 | const enum_ty: *Type.Enum = if (maybe_ident) |ident| enum_ty: { | |
| 2349 | const ident_str = p.tokSlice(ident); | |
| 2350 | const interned_name = try p.comp.intern(ident_str); | |
| 2351 | if (try p.syms.defineTag(p, interned_name, .keyword_enum, ident)) |prev| { | |
| 2352 | const enum_ty = prev.ty.get(.@"enum").?.data.@"enum"; | |
| 2353 | if (!enum_ty.isIncomplete() and !enum_ty.fixed) { | |
| 2354 | // if the enum isn't incomplete, this is a redefinition | |
| 2355 | try p.errStr(.redefinition, ident, ident_str); | |
| 2356 | try p.errTok(.previous_definition, prev.tok); | |
| 2357 | } else { | |
| 2358 | try p.checkEnumFixedTy(fixed_ty, ident, prev); | |
| 2359 | defined = true; | |
| 2360 | break :enum_ty enum_ty; | |
| 2361 | } | |
| 2362 | } | |
| 2363 | break :enum_ty try Type.Enum.create(p.arena, interned_name, fixed_ty); | |
| 2364 | } else try Type.Enum.create(p.arena, try p.getAnonymousName(enum_tok), fixed_ty); | |
| 2365 | ||
| 2366 | // reserve space for this enum | |
| 2367 | try p.decl_buf.append(.none); | |
| 2368 | const decl_buf_top = p.decl_buf.items.len; | |
| 2369 | const list_buf_top = p.list_buf.items.len; | |
| 2370 | const enum_buf_top = p.enum_buf.items.len; | |
| 2371 | errdefer p.decl_buf.items.len = decl_buf_top - 1; | |
| 2372 | defer { | |
| 2373 | p.decl_buf.items.len = decl_buf_top; | |
| 2374 | p.list_buf.items.len = list_buf_top; | |
| 2375 | p.enum_buf.items.len = enum_buf_top; | |
| 2376 | } | |
| 2377 | ||
| 2378 | const sym_stack_top = p.syms.syms.len; | |
| 2379 | var e = Enumerator.init(fixed_ty); | |
| 2380 | while (try p.enumerator(&e)) |field_and_node| { | |
| 2381 | try p.enum_buf.append(field_and_node.field); | |
| 2382 | try p.list_buf.append(field_and_node.node); | |
| 2383 | if (p.eatToken(.comma) == null) break; | |
| 2384 | } | |
| 2385 | ||
| 2386 | if (p.enum_buf.items.len == enum_buf_top) try p.err(.empty_enum); | |
| 2387 | try p.expectClosing(l_brace, .r_brace); | |
| 2388 | done = true; | |
| 2389 | try p.attributeSpecifier(); | |
| 2390 | ||
| 2391 | const ty = try Attribute.applyTypeAttributes(p, .{ | |
| 2392 | .specifier = .@"enum", | |
| 2393 | .data = .{ .@"enum" = enum_ty }, | |
| 2394 | }, attr_buf_top, null); | |
| 2395 | if (!enum_ty.fixed) { | |
| 2396 | const tag_specifier = try e.getTypeSpecifier(p, ty.enumIsPacked(p.comp), maybe_ident orelse enum_tok); | |
| 2397 | enum_ty.tag_ty = .{ .specifier = tag_specifier }; | |
| 2398 | } | |
| 2399 | ||
| 2400 | const enum_fields = p.enum_buf.items[enum_buf_top..]; | |
| 2401 | const field_nodes = p.list_buf.items[list_buf_top..]; | |
| 2402 | ||
| 2403 | if (fixed_ty == null) { | |
| 2404 | const vals = p.syms.syms.items(.val)[sym_stack_top..]; | |
| 2405 | const types = p.syms.syms.items(.ty)[sym_stack_top..]; | |
| 2406 | ||
| 2407 | for (enum_fields, 0..) |*field, i| { | |
| 2408 | if (field.ty.eql(Type.int, p.comp, false)) continue; | |
| 2409 | ||
| 2410 | var res = Result{ .node = field.node, .ty = field.ty, .val = vals[i] }; | |
| 2411 | const dest_ty = if (p.comp.fixedEnumTagSpecifier()) |some| | |
| 2412 | Type{ .specifier = some } | |
| 2413 | else if (res.intFitsInType(p, Type.int)) | |
| 2414 | Type.int | |
| 2415 | else if (!res.ty.eql(enum_ty.tag_ty, p.comp, false)) | |
| 2416 | enum_ty.tag_ty | |
| 2417 | else | |
| 2418 | continue; | |
| 2419 | ||
| 2420 | vals[i].intCast(field.ty, dest_ty, p.comp); | |
| 2421 | types[i] = dest_ty; | |
| 2422 | p.nodes.items(.ty)[@intFromEnum(field_nodes[i])] = dest_ty; | |
| 2423 | field.ty = dest_ty; | |
| 2424 | res.ty = dest_ty; | |
| 2425 | ||
| 2426 | if (res.node != .none) { | |
| 2427 | try res.implicitCast(p, .int_cast); | |
| 2428 | field.node = res.node; | |
| 2429 | p.nodes.items(.data)[@intFromEnum(field_nodes[i])].decl.node = res.node; | |
| 2430 | } | |
| 2431 | } | |
| 2432 | } | |
| 2433 | ||
| 2434 | enum_ty.fields = try p.arena.dupe(Type.Enum.Field, enum_fields); | |
| 2435 | ||
| 2436 | // declare a symbol for the type | |
| 2437 | if (maybe_ident != null and !defined) { | |
| 2438 | try p.syms.syms.append(p.gpa, .{ | |
| 2439 | .kind = .@"enum", | |
| 2440 | .name = enum_ty.name, | |
| 2441 | .ty = ty, | |
| 2442 | .tok = maybe_ident.?, | |
| 2443 | .val = .{}, | |
| 2444 | }); | |
| 2445 | } | |
| 2446 | ||
| 2447 | // finish by creating a node | |
| 2448 | var node: Tree.Node = .{ .tag = .enum_decl_two, .ty = ty, .data = .{ | |
| 2449 | .bin = .{ .lhs = .none, .rhs = .none }, | |
| 2450 | } }; | |
| 2451 | switch (field_nodes.len) { | |
| 2452 | 0 => {}, | |
| 2453 | 1 => node.data = .{ .bin = .{ .lhs = field_nodes[0], .rhs = .none } }, | |
| 2454 | 2 => node.data = .{ .bin = .{ .lhs = field_nodes[0], .rhs = field_nodes[1] } }, | |
| 2455 | else => { | |
| 2456 | node.tag = .enum_decl; | |
| 2457 | node.data = .{ .range = try p.addList(field_nodes) }; | |
| 2458 | }, | |
| 2459 | } | |
| 2460 | p.decl_buf.items[decl_buf_top - 1] = try p.addNode(node); | |
| 2461 | if (p.func.ty == null) { | |
| 2462 | _ = p.tentative_defs.remove(enum_ty.name); | |
| 2463 | } | |
| 2464 | return ty; | |
| 2465 | } | |
| 2466 | ||
| 2467 | fn checkEnumFixedTy(p: *Parser, fixed_ty: ?Type, ident_tok: TokenIndex, prev: Symbol) !void { | |
| 2468 | const enum_ty = prev.ty.get(.@"enum").?.data.@"enum"; | |
| 2469 | if (fixed_ty) |some| { | |
| 2470 | if (!enum_ty.fixed) { | |
| 2471 | try p.errTok(.enum_prev_nonfixed, ident_tok); | |
| 2472 | try p.errTok(.previous_definition, prev.tok); | |
| 2473 | return error.ParsingFailed; | |
| 2474 | } | |
| 2475 | ||
| 2476 | if (!enum_ty.tag_ty.eql(some, p.comp, false)) { | |
| 2477 | const str = try p.typePairStrExtra(some, " (was ", enum_ty.tag_ty); | |
| 2478 | try p.errStr(.enum_different_explicit_ty, ident_tok, str); | |
| 2479 | try p.errTok(.previous_definition, prev.tok); | |
| 2480 | return error.ParsingFailed; | |
| 2481 | } | |
| 2482 | } else if (enum_ty.fixed) { | |
| 2483 | try p.errTok(.enum_prev_fixed, ident_tok); | |
| 2484 | try p.errTok(.previous_definition, prev.tok); | |
| 2485 | return error.ParsingFailed; | |
| 2486 | } | |
| 2487 | } | |
| 2488 | ||
| 2489 | const Enumerator = struct { | |
| 2490 | res: Result, | |
| 2491 | num_positive_bits: usize = 0, | |
| 2492 | num_negative_bits: usize = 0, | |
| 2493 | fixed: bool, | |
| 2494 | ||
| 2495 | fn init(fixed_ty: ?Type) Enumerator { | |
| 2496 | return .{ | |
| 2497 | .res = .{ | |
| 2498 | .ty = fixed_ty orelse .{ .specifier = .int }, | |
| 2499 | .val = .{ .tag = .unavailable }, | |
| 2500 | }, | |
| 2501 | .fixed = fixed_ty != null, | |
| 2502 | }; | |
| 2503 | } | |
| 2504 | ||
| 2505 | /// Increment enumerator value adjusting type if needed. | |
| 2506 | fn incr(e: *Enumerator, p: *Parser, tok: TokenIndex) !void { | |
| 2507 | e.res.node = .none; | |
| 2508 | const old_val = e.res.val; | |
| 2509 | if (old_val.tag == .unavailable) { | |
| 2510 | // First enumerator, set to 0 fits in all types. | |
| 2511 | e.res.val = Value.int(0); | |
| 2512 | return; | |
| 2513 | } | |
| 2514 | if (e.res.val.add(e.res.val, Value.int(1), e.res.ty, p.comp)) { | |
| 2515 | const byte_size = e.res.ty.sizeof(p.comp).?; | |
| 2516 | const bit_size: u8 = @intCast(if (e.res.ty.isUnsignedInt(p.comp)) byte_size * 8 else byte_size * 8 - 1); | |
| 2517 | if (e.fixed) { | |
| 2518 | try p.errStr(.enum_not_representable_fixed, tok, try p.typeStr(e.res.ty)); | |
| 2519 | return; | |
| 2520 | } | |
| 2521 | const new_ty = if (p.comp.nextLargestIntSameSign(e.res.ty)) |larger| blk: { | |
| 2522 | try p.errTok(.enumerator_overflow, tok); | |
| 2523 | break :blk larger; | |
| 2524 | } else blk: { | |
| 2525 | try p.errExtra(.enum_not_representable, tok, .{ .pow_2_as_string = bit_size }); | |
| 2526 | break :blk Type{ .specifier = .ulong_long }; | |
| 2527 | }; | |
| 2528 | e.res.ty = new_ty; | |
| 2529 | _ = e.res.val.add(old_val, Value.int(1), e.res.ty, p.comp); | |
| 2530 | } | |
| 2531 | } | |
| 2532 | ||
| 2533 | /// Set enumerator value to specified value. | |
| 2534 | fn set(e: *Enumerator, p: *Parser, res: Result, tok: TokenIndex) !void { | |
| 2535 | if (res.ty.specifier == .invalid) return; | |
| 2536 | if (e.fixed and !res.ty.eql(e.res.ty, p.comp, false)) { | |
| 2537 | if (!res.intFitsInType(p, e.res.ty)) { | |
| 2538 | try p.errStr(.enum_not_representable_fixed, tok, try p.typeStr(e.res.ty)); | |
| 2539 | return error.ParsingFailed; | |
| 2540 | } | |
| 2541 | var copy = res; | |
| 2542 | copy.ty = e.res.ty; | |
| 2543 | try copy.implicitCast(p, .int_cast); | |
| 2544 | e.res = copy; | |
| 2545 | } else { | |
| 2546 | e.res = res; | |
| 2547 | try e.res.intCast(p, e.res.ty.integerPromotion(p.comp), tok); | |
| 2548 | } | |
| 2549 | } | |
| 2550 | ||
| 2551 | fn getTypeSpecifier(e: *const Enumerator, p: *Parser, is_packed: bool, tok: TokenIndex) !Type.Specifier { | |
| 2552 | if (p.comp.fixedEnumTagSpecifier()) |tag_specifier| return tag_specifier; | |
| 2553 | ||
| 2554 | const char_width = (Type{ .specifier = .schar }).sizeof(p.comp).? * 8; | |
| 2555 | const short_width = (Type{ .specifier = .short }).sizeof(p.comp).? * 8; | |
| 2556 | const int_width = (Type{ .specifier = .int }).sizeof(p.comp).? * 8; | |
| 2557 | if (e.num_negative_bits > 0) { | |
| 2558 | if (is_packed and e.num_negative_bits <= char_width and e.num_positive_bits < char_width) { | |
| 2559 | return .schar; | |
| 2560 | } else if (is_packed and e.num_negative_bits <= short_width and e.num_positive_bits < short_width) { | |
| 2561 | return .short; | |
| 2562 | } else if (e.num_negative_bits <= int_width and e.num_positive_bits < int_width) { | |
| 2563 | return .int; | |
| 2564 | } | |
| 2565 | const long_width = (Type{ .specifier = .long }).sizeof(p.comp).? * 8; | |
| 2566 | if (e.num_negative_bits <= long_width and e.num_positive_bits < long_width) { | |
| 2567 | return .long; | |
| 2568 | } | |
| 2569 | const long_long_width = (Type{ .specifier = .long_long }).sizeof(p.comp).? * 8; | |
| 2570 | if (e.num_negative_bits > long_long_width or e.num_positive_bits >= long_long_width) { | |
| 2571 | try p.errTok(.enum_too_large, tok); | |
| 2572 | } | |
| 2573 | return .long_long; | |
| 2574 | } | |
| 2575 | if (is_packed and e.num_positive_bits <= char_width) { | |
| 2576 | return .uchar; | |
| 2577 | } else if (is_packed and e.num_positive_bits <= short_width) { | |
| 2578 | return .ushort; | |
| 2579 | } else if (e.num_positive_bits <= int_width) { | |
| 2580 | return .uint; | |
| 2581 | } else if (e.num_positive_bits <= (Type{ .specifier = .long }).sizeof(p.comp).? * 8) { | |
| 2582 | return .ulong; | |
| 2583 | } | |
| 2584 | return .ulong_long; | |
| 2585 | } | |
| 2586 | }; | |
| 2587 | ||
| 2588 | const EnumFieldAndNode = struct { field: Type.Enum.Field, node: NodeIndex }; | |
| 2589 | ||
| 2590 | /// enumerator : IDENTIFIER ('=' integerConstExpr) | |
| 2591 | fn enumerator(p: *Parser, e: *Enumerator) Error!?EnumFieldAndNode { | |
| 2592 | _ = try p.pragma(); | |
| 2593 | const name_tok = (try p.eatIdentifier()) orelse { | |
| 2594 | if (p.tok_ids[p.tok_i] == .r_brace) return null; | |
| 2595 | try p.err(.expected_identifier); | |
| 2596 | p.skipTo(.r_brace); | |
| 2597 | return error.ParsingFailed; | |
| 2598 | }; | |
| 2599 | const attr_buf_top = p.attr_buf.len; | |
| 2600 | defer p.attr_buf.len = attr_buf_top; | |
| 2601 | try p.attributeSpecifier(); | |
| 2602 | ||
| 2603 | const err_start = p.comp.diag.list.items.len; | |
| 2604 | if (p.eatToken(.equal)) |_| { | |
| 2605 | const specified = try p.integerConstExpr(.gnu_folding_extension); | |
| 2606 | if (specified.val.tag == .unavailable) { | |
| 2607 | try p.errTok(.enum_val_unavailable, name_tok + 2); | |
| 2608 | try e.incr(p, name_tok); | |
| 2609 | } else { | |
| 2610 | try e.set(p, specified, name_tok); | |
| 2611 | } | |
| 2612 | } else { | |
| 2613 | try e.incr(p, name_tok); | |
| 2614 | } | |
| 2615 | ||
| 2616 | var res = e.res; | |
| 2617 | res.ty = try Attribute.applyEnumeratorAttributes(p, res.ty, attr_buf_top); | |
| 2618 | ||
| 2619 | if (res.ty.isUnsignedInt(p.comp) or res.val.compare(.gte, Value.int(0), res.ty, p.comp)) { | |
| 2620 | e.num_positive_bits = @max(e.num_positive_bits, res.val.minUnsignedBits(res.ty, p.comp)); | |
| 2621 | } else { | |
| 2622 | e.num_negative_bits = @max(e.num_negative_bits, res.val.minSignedBits(res.ty, p.comp)); | |
| 2623 | } | |
| 2624 | ||
| 2625 | if (err_start == p.comp.diag.list.items.len) { | |
| 2626 | // only do these warnings if we didn't already warn about overflow or non-representable values | |
| 2627 | if (e.res.val.compare(.lt, Value.int(0), e.res.ty, p.comp)) { | |
| 2628 | const val = e.res.val.getInt(i64); | |
| 2629 | if (val < (Type{ .specifier = .int }).minInt(p.comp)) { | |
| 2630 | try p.errExtra(.enumerator_too_small, name_tok, .{ | |
| 2631 | .signed = val, | |
| 2632 | }); | |
| 2633 | } | |
| 2634 | } else { | |
| 2635 | const val = e.res.val.getInt(u64); | |
| 2636 | if (val > (Type{ .specifier = .int }).maxInt(p.comp)) { | |
| 2637 | try p.errExtra(.enumerator_too_large, name_tok, .{ | |
| 2638 | .unsigned = val, | |
| 2639 | }); | |
| 2640 | } | |
| 2641 | } | |
| 2642 | } | |
| 2643 | ||
| 2644 | const interned_name = try p.comp.intern(p.tokSlice(name_tok)); | |
| 2645 | try p.syms.defineEnumeration(p, interned_name, res.ty, name_tok, e.res.val); | |
| 2646 | const node = try p.addNode(.{ | |
| 2647 | .tag = .enum_field_decl, | |
| 2648 | .ty = res.ty, | |
| 2649 | .data = .{ .decl = .{ | |
| 2650 | .name = name_tok, | |
| 2651 | .node = res.node, | |
| 2652 | } }, | |
| 2653 | }); | |
| 2654 | return EnumFieldAndNode{ .field = .{ | |
| 2655 | .name = interned_name, | |
| 2656 | .ty = res.ty, | |
| 2657 | .name_tok = name_tok, | |
| 2658 | .node = res.node, | |
| 2659 | }, .node = node }; | |
| 2660 | } | |
| 2661 | ||
| 2662 | /// typeQual : keyword_const | keyword_restrict | keyword_volatile | keyword_atomic | |
| 2663 | fn typeQual(p: *Parser, b: *Type.Qualifiers.Builder) Error!bool { | |
| 2664 | var any = false; | |
| 2665 | while (true) { | |
| 2666 | switch (p.tok_ids[p.tok_i]) { | |
| 2667 | .keyword_restrict, .keyword_restrict1, .keyword_restrict2 => { | |
| 2668 | if (b.restrict != null) | |
| 2669 | try p.errStr(.duplicate_decl_spec, p.tok_i, "restrict") | |
| 2670 | else | |
| 2671 | b.restrict = p.tok_i; | |
| 2672 | }, | |
| 2673 | .keyword_const, .keyword_const1, .keyword_const2 => { | |
| 2674 | if (b.@"const" != null) | |
| 2675 | try p.errStr(.duplicate_decl_spec, p.tok_i, "const") | |
| 2676 | else | |
| 2677 | b.@"const" = p.tok_i; | |
| 2678 | }, | |
| 2679 | .keyword_volatile, .keyword_volatile1, .keyword_volatile2 => { | |
| 2680 | if (b.@"volatile" != null) | |
| 2681 | try p.errStr(.duplicate_decl_spec, p.tok_i, "volatile") | |
| 2682 | else | |
| 2683 | b.@"volatile" = p.tok_i; | |
| 2684 | }, | |
| 2685 | .keyword_atomic => { | |
| 2686 | // _Atomic(typeName) instead of just _Atomic | |
| 2687 | if (p.tok_ids[p.tok_i + 1] == .l_paren) break; | |
| 2688 | if (b.atomic != null) | |
| 2689 | try p.errStr(.duplicate_decl_spec, p.tok_i, "atomic") | |
| 2690 | else | |
| 2691 | b.atomic = p.tok_i; | |
| 2692 | }, | |
| 2693 | else => break, | |
| 2694 | } | |
| 2695 | p.tok_i += 1; | |
| 2696 | any = true; | |
| 2697 | } | |
| 2698 | return any; | |
| 2699 | } | |
| 2700 | ||
| 2701 | const Declarator = struct { | |
| 2702 | name: TokenIndex, | |
| 2703 | ty: Type, | |
| 2704 | func_declarator: ?TokenIndex = null, | |
| 2705 | old_style_func: ?TokenIndex = null, | |
| 2706 | }; | |
| 2707 | const DeclaratorKind = enum { normal, abstract, param, record }; | |
| 2708 | ||
| 2709 | /// declarator : pointer? (IDENTIFIER | '(' declarator ')') directDeclarator* | |
| 2710 | /// abstractDeclarator | |
| 2711 | /// : pointer? ('(' abstractDeclarator ')')? directAbstractDeclarator* | |
| 2712 | fn declarator( | |
| 2713 | p: *Parser, | |
| 2714 | base_type: Type, | |
| 2715 | kind: DeclaratorKind, | |
| 2716 | ) Error!?Declarator { | |
| 2717 | const start = p.tok_i; | |
| 2718 | var d = Declarator{ .name = 0, .ty = try p.pointer(base_type) }; | |
| 2719 | if (base_type.is(.auto_type) and !d.ty.is(.auto_type)) { | |
| 2720 | try p.errTok(.auto_type_requires_plain_declarator, start); | |
| 2721 | return error.ParsingFailed; | |
| 2722 | } | |
| 2723 | ||
| 2724 | const maybe_ident = p.tok_i; | |
| 2725 | if (kind != .abstract and (try p.eatIdentifier()) != null) { | |
| 2726 | d.name = maybe_ident; | |
| 2727 | const combine_tok = p.tok_i; | |
| 2728 | d.ty = try p.directDeclarator(d.ty, &d, kind); | |
| 2729 | try d.ty.validateCombinedType(p, combine_tok); | |
| 2730 | return d; | |
| 2731 | } else if (p.eatToken(.l_paren)) |l_paren| blk: { | |
| 2732 | var res = (try p.declarator(.{ .specifier = .void }, kind)) orelse { | |
| 2733 | p.tok_i = l_paren; | |
| 2734 | break :blk; | |
| 2735 | }; | |
| 2736 | try p.expectClosing(l_paren, .r_paren); | |
| 2737 | const suffix_start = p.tok_i; | |
| 2738 | const outer = try p.directDeclarator(d.ty, &d, kind); | |
| 2739 | try res.ty.combine(outer); | |
| 2740 | try res.ty.validateCombinedType(p, suffix_start); | |
| 2741 | res.old_style_func = d.old_style_func; | |
| 2742 | return res; | |
| 2743 | } | |
| 2744 | ||
| 2745 | const expected_ident = p.tok_i; | |
| 2746 | ||
| 2747 | d.ty = try p.directDeclarator(d.ty, &d, kind); | |
| 2748 | ||
| 2749 | if (kind == .normal and !d.ty.isEnumOrRecord()) { | |
| 2750 | try p.errTok(.expected_ident_or_l_paren, expected_ident); | |
| 2751 | return error.ParsingFailed; | |
| 2752 | } | |
| 2753 | try d.ty.validateCombinedType(p, expected_ident); | |
| 2754 | if (start == p.tok_i) return null; | |
| 2755 | return d; | |
| 2756 | } | |
| 2757 | ||
| 2758 | /// directDeclarator | |
| 2759 | /// : '[' typeQual* assignExpr? ']' directDeclarator? | |
| 2760 | /// | '[' keyword_static typeQual* assignExpr ']' directDeclarator? | |
| 2761 | /// | '[' typeQual+ keyword_static assignExpr ']' directDeclarator? | |
| 2762 | /// | '[' typeQual* '*' ']' directDeclarator? | |
| 2763 | /// | '(' paramDecls ')' directDeclarator? | |
| 2764 | /// | '(' (IDENTIFIER (',' IDENTIFIER))? ')' directDeclarator? | |
| 2765 | /// directAbstractDeclarator | |
| 2766 | /// : '[' typeQual* assignExpr? ']' | |
| 2767 | /// | '[' keyword_static typeQual* assignExpr ']' | |
| 2768 | /// | '[' typeQual+ keyword_static assignExpr ']' | |
| 2769 | /// | '[' '*' ']' | |
| 2770 | /// | '(' paramDecls? ')' | |
| 2771 | fn directDeclarator(p: *Parser, base_type: Type, d: *Declarator, kind: DeclaratorKind) Error!Type { | |
| 2772 | if (p.eatToken(.l_bracket)) |l_bracket| { | |
| 2773 | if (p.tok_ids[p.tok_i] == .l_bracket) { | |
| 2774 | switch (kind) { | |
| 2775 | .normal, .record => if (p.comp.langopts.standard.atLeast(.c2x)) { | |
| 2776 | p.tok_i -= 1; | |
| 2777 | return base_type; | |
| 2778 | }, | |
| 2779 | .param, .abstract => {}, | |
| 2780 | } | |
| 2781 | try p.err(.expected_expr); | |
| 2782 | return error.ParsingFailed; | |
| 2783 | } | |
| 2784 | var res_ty = Type{ | |
| 2785 | // so that we can get any restrict type that might be present | |
| 2786 | .specifier = .pointer, | |
| 2787 | }; | |
| 2788 | var quals = Type.Qualifiers.Builder{}; | |
| 2789 | ||
| 2790 | var got_quals = try p.typeQual(&quals); | |
| 2791 | var static = p.eatToken(.keyword_static); | |
| 2792 | if (static != null and !got_quals) got_quals = try p.typeQual(&quals); | |
| 2793 | var star = p.eatToken(.asterisk); | |
| 2794 | const size_tok = p.tok_i; | |
| 2795 | ||
| 2796 | const const_decl_folding = p.const_decl_folding; | |
| 2797 | p.const_decl_folding = .gnu_vla_folding_extension; | |
| 2798 | const size = if (star) |_| Result{} else try p.assignExpr(); | |
| 2799 | p.const_decl_folding = const_decl_folding; | |
| 2800 | ||
| 2801 | try p.expectClosing(l_bracket, .r_bracket); | |
| 2802 | ||
| 2803 | if (star != null and static != null) { | |
| 2804 | try p.errTok(.invalid_static_star, static.?); | |
| 2805 | static = null; | |
| 2806 | } | |
| 2807 | if (kind != .param) { | |
| 2808 | if (static != null) | |
| 2809 | try p.errTok(.static_non_param, l_bracket) | |
| 2810 | else if (got_quals) | |
| 2811 | try p.errTok(.array_qualifiers, l_bracket); | |
| 2812 | if (star) |some| try p.errTok(.star_non_param, some); | |
| 2813 | static = null; | |
| 2814 | quals = .{}; | |
| 2815 | star = null; | |
| 2816 | } else { | |
| 2817 | try quals.finish(p, &res_ty); | |
| 2818 | } | |
| 2819 | if (static) |_| try size.expect(p); | |
| 2820 | ||
| 2821 | if (base_type.is(.auto_type)) { | |
| 2822 | try p.errStr(.array_of_auto_type, d.name, p.tokSlice(d.name)); | |
| 2823 | return error.ParsingFailed; | |
| 2824 | } | |
| 2825 | const outer = try p.directDeclarator(base_type, d, kind); | |
| 2826 | var max_bits = p.comp.target.ptrBitWidth(); | |
| 2827 | if (max_bits > 61) max_bits = 61; | |
| 2828 | const max_bytes = (@as(u64, 1) << @truncate(max_bits)) - 1; | |
| 2829 | // `outer` is validated later so it may be invalid here | |
| 2830 | const outer_size = outer.sizeof(p.comp); | |
| 2831 | const max_elems = max_bytes / @max(1, outer_size orelse 1); | |
| 2832 | ||
| 2833 | if (!size.ty.isInt()) { | |
| 2834 | try p.errStr(.array_size_non_int, size_tok, try p.typeStr(size.ty)); | |
| 2835 | return error.ParsingFailed; | |
| 2836 | } | |
| 2837 | if (size.val.tag == .unavailable) { | |
| 2838 | if (size.node != .none) { | |
| 2839 | try p.errTok(.vla, size_tok); | |
| 2840 | if (p.func.ty == null and kind != .param and p.record.kind == .invalid) { | |
| 2841 | try p.errTok(.variable_len_array_file_scope, d.name); | |
| 2842 | } | |
| 2843 | const expr_ty = try p.arena.create(Type.Expr); | |
| 2844 | expr_ty.ty = .{ .specifier = .void }; | |
| 2845 | expr_ty.node = size.node; | |
| 2846 | res_ty.data = .{ .expr = expr_ty }; | |
| 2847 | res_ty.specifier = .variable_len_array; | |
| 2848 | ||
| 2849 | if (static) |some| try p.errTok(.useless_static, some); | |
| 2850 | } else if (star) |_| { | |
| 2851 | const elem_ty = try p.arena.create(Type); | |
| 2852 | elem_ty.* = .{ .specifier = .void }; | |
| 2853 | res_ty.data = .{ .sub_type = elem_ty }; | |
| 2854 | res_ty.specifier = .unspecified_variable_len_array; | |
| 2855 | } else { | |
| 2856 | const arr_ty = try p.arena.create(Type.Array); | |
| 2857 | arr_ty.elem = .{ .specifier = .void }; | |
| 2858 | arr_ty.len = 0; | |
| 2859 | res_ty.data = .{ .array = arr_ty }; | |
| 2860 | res_ty.specifier = .incomplete_array; | |
| 2861 | } | |
| 2862 | } else { | |
| 2863 | var size_val = size.val; | |
| 2864 | const size_t = p.comp.types.size; | |
| 2865 | if (size_val.isZero()) { | |
| 2866 | try p.errTok(.zero_length_array, l_bracket); | |
| 2867 | } else if (size_val.compare(.lt, Value.int(0), size_t, p.comp)) { | |
| 2868 | try p.errTok(.negative_array_size, l_bracket); | |
| 2869 | return error.ParsingFailed; | |
| 2870 | } | |
| 2871 | const arr_ty = try p.arena.create(Type.Array); | |
| 2872 | arr_ty.elem = .{ .specifier = .void }; | |
| 2873 | if (size_val.compare(.gt, Value.int(max_elems), size_t, p.comp)) { | |
| 2874 | try p.errTok(.array_too_large, l_bracket); | |
| 2875 | arr_ty.len = max_elems; | |
| 2876 | } else { | |
| 2877 | arr_ty.len = size_val.getInt(u64); | |
| 2878 | } | |
| 2879 | res_ty.data = .{ .array = arr_ty }; | |
| 2880 | res_ty.specifier = .array; | |
| 2881 | } | |
| 2882 | ||
| 2883 | try res_ty.combine(outer); | |
| 2884 | return res_ty; | |
| 2885 | } else if (p.eatToken(.l_paren)) |l_paren| { | |
| 2886 | d.func_declarator = l_paren; | |
| 2887 | ||
| 2888 | const func_ty = try p.arena.create(Type.Func); | |
| 2889 | func_ty.params = &.{}; | |
| 2890 | func_ty.return_type.specifier = .void; | |
| 2891 | var specifier: Type.Specifier = .func; | |
| 2892 | ||
| 2893 | if (p.eatToken(.ellipsis)) |_| { | |
| 2894 | try p.err(.param_before_var_args); | |
| 2895 | try p.expectClosing(l_paren, .r_paren); | |
| 2896 | var res_ty = Type{ .specifier = .func, .data = .{ .func = func_ty } }; | |
| 2897 | ||
| 2898 | const outer = try p.directDeclarator(base_type, d, kind); | |
| 2899 | try res_ty.combine(outer); | |
| 2900 | return res_ty; | |
| 2901 | } | |
| 2902 | ||
| 2903 | if (try p.paramDecls()) |params| { | |
| 2904 | func_ty.params = params; | |
| 2905 | if (p.eatToken(.ellipsis)) |_| specifier = .var_args_func; | |
| 2906 | } else if (p.tok_ids[p.tok_i] == .r_paren) { | |
| 2907 | specifier = .var_args_func; | |
| 2908 | } else if (p.tok_ids[p.tok_i] == .identifier or p.tok_ids[p.tok_i] == .extended_identifier) { | |
| 2909 | d.old_style_func = p.tok_i; | |
| 2910 | const param_buf_top = p.param_buf.items.len; | |
| 2911 | try p.syms.pushScope(p); | |
| 2912 | defer { | |
| 2913 | p.param_buf.items.len = param_buf_top; | |
| 2914 | p.syms.popScope(); | |
| 2915 | } | |
| 2916 | ||
| 2917 | specifier = .old_style_func; | |
| 2918 | while (true) { | |
| 2919 | const name_tok = try p.expectIdentifier(); | |
| 2920 | const interned_name = try p.comp.intern(p.tokSlice(name_tok)); | |
| 2921 | try p.syms.defineParam(p, interned_name, undefined, name_tok); | |
| 2922 | try p.param_buf.append(.{ | |
| 2923 | .name = interned_name, | |
| 2924 | .name_tok = name_tok, | |
| 2925 | .ty = .{ .specifier = .int }, | |
| 2926 | }); | |
| 2927 | if (p.eatToken(.comma) == null) break; | |
| 2928 | } | |
| 2929 | func_ty.params = try p.arena.dupe(Type.Func.Param, p.param_buf.items[param_buf_top..]); | |
| 2930 | } else { | |
| 2931 | try p.err(.expected_param_decl); | |
| 2932 | } | |
| 2933 | ||
| 2934 | try p.expectClosing(l_paren, .r_paren); | |
| 2935 | var res_ty = Type{ | |
| 2936 | .specifier = specifier, | |
| 2937 | .data = .{ .func = func_ty }, | |
| 2938 | }; | |
| 2939 | ||
| 2940 | const outer = try p.directDeclarator(base_type, d, kind); | |
| 2941 | try res_ty.combine(outer); | |
| 2942 | return res_ty; | |
| 2943 | } else return base_type; | |
| 2944 | } | |
| 2945 | ||
| 2946 | /// pointer : '*' typeQual* pointer? | |
| 2947 | fn pointer(p: *Parser, base_ty: Type) Error!Type { | |
| 2948 | var ty = base_ty; | |
| 2949 | while (p.eatToken(.asterisk)) |_| { | |
| 2950 | const elem_ty = try p.arena.create(Type); | |
| 2951 | elem_ty.* = ty; | |
| 2952 | ty = Type{ | |
| 2953 | .specifier = .pointer, | |
| 2954 | .data = .{ .sub_type = elem_ty }, | |
| 2955 | }; | |
| 2956 | var quals = Type.Qualifiers.Builder{}; | |
| 2957 | _ = try p.typeQual(&quals); | |
| 2958 | try quals.finish(p, &ty); | |
| 2959 | } | |
| 2960 | return ty; | |
| 2961 | } | |
| 2962 | ||
| 2963 | /// paramDecls : paramDecl (',' paramDecl)* (',' '...') | |
| 2964 | /// paramDecl : declSpec (declarator | abstractDeclarator) | |
| 2965 | fn paramDecls(p: *Parser) Error!?[]Type.Func.Param { | |
| 2966 | // TODO warn about visibility of types declared here | |
| 2967 | const param_buf_top = p.param_buf.items.len; | |
| 2968 | defer p.param_buf.items.len = param_buf_top; | |
| 2969 | try p.syms.pushScope(p); | |
| 2970 | defer p.syms.popScope(); | |
| 2971 | ||
| 2972 | while (true) { | |
| 2973 | const attr_buf_top = p.attr_buf.len; | |
| 2974 | defer p.attr_buf.len = attr_buf_top; | |
| 2975 | const param_decl_spec = if (try p.declSpec()) |some| | |
| 2976 | some | |
| 2977 | else if (p.param_buf.items.len == param_buf_top) | |
| 2978 | return null | |
| 2979 | else blk: { | |
| 2980 | var spec: Type.Builder = .{}; | |
| 2981 | break :blk DeclSpec{ .ty = try spec.finish(p) }; | |
| 2982 | }; | |
| 2983 | ||
| 2984 | var name_tok: TokenIndex = 0; | |
| 2985 | const first_tok = p.tok_i; | |
| 2986 | var param_ty = param_decl_spec.ty; | |
| 2987 | if (try p.declarator(param_decl_spec.ty, .param)) |some| { | |
| 2988 | if (some.old_style_func) |tok_i| try p.errTok(.invalid_old_style_params, tok_i); | |
| 2989 | try p.attributeSpecifier(); | |
| 2990 | ||
| 2991 | name_tok = some.name; | |
| 2992 | param_ty = some.ty; | |
| 2993 | if (some.name != 0) { | |
| 2994 | const interned_name = try p.comp.intern(p.tokSlice(name_tok)); | |
| 2995 | try p.syms.defineParam(p, interned_name, param_ty, name_tok); | |
| 2996 | } | |
| 2997 | } | |
| 2998 | param_ty = try Attribute.applyParameterAttributes(p, param_ty, attr_buf_top, .alignas_on_param); | |
| 2999 | ||
| 3000 | if (param_ty.isFunc()) { | |
| 3001 | // params declared as functions are converted to function pointers | |
| 3002 | const elem_ty = try p.arena.create(Type); | |
| 3003 | elem_ty.* = param_ty; | |
| 3004 | param_ty = Type{ | |
| 3005 | .specifier = .pointer, | |
| 3006 | .data = .{ .sub_type = elem_ty }, | |
| 3007 | }; | |
| 3008 | } else if (param_ty.isArray()) { | |
| 3009 | // params declared as arrays are converted to pointers | |
| 3010 | param_ty.decayArray(); | |
| 3011 | } else if (param_ty.is(.void)) { | |
| 3012 | // validate void parameters | |
| 3013 | if (p.param_buf.items.len == param_buf_top) { | |
| 3014 | if (p.tok_ids[p.tok_i] != .r_paren) { | |
| 3015 | try p.err(.void_only_param); | |
| 3016 | if (param_ty.anyQual()) try p.err(.void_param_qualified); | |
| 3017 | return error.ParsingFailed; | |
| 3018 | } | |
| 3019 | return &[0]Type.Func.Param{}; | |
| 3020 | } | |
| 3021 | try p.err(.void_must_be_first_param); | |
| 3022 | return error.ParsingFailed; | |
| 3023 | } | |
| 3024 | ||
| 3025 | try param_decl_spec.validateParam(p, &param_ty); | |
| 3026 | try p.param_buf.append(.{ | |
| 3027 | .name = if (name_tok == 0) .empty else try p.comp.intern(p.tokSlice(name_tok)), | |
| 3028 | .name_tok = if (name_tok == 0) first_tok else name_tok, | |
| 3029 | .ty = param_ty, | |
| 3030 | }); | |
| 3031 | ||
| 3032 | if (p.eatToken(.comma) == null) break; | |
| 3033 | if (p.tok_ids[p.tok_i] == .ellipsis) break; | |
| 3034 | } | |
| 3035 | return try p.arena.dupe(Type.Func.Param, p.param_buf.items[param_buf_top..]); | |
| 3036 | } | |
| 3037 | ||
| 3038 | /// typeName : specQual abstractDeclarator | |
| 3039 | fn typeName(p: *Parser) Error!?Type { | |
| 3040 | const attr_buf_top = p.attr_buf.len; | |
| 3041 | defer p.attr_buf.len = attr_buf_top; | |
| 3042 | var ty = (try p.specQual()) orelse return null; | |
| 3043 | if (try p.declarator(ty, .abstract)) |some| { | |
| 3044 | if (some.old_style_func) |tok_i| try p.errTok(.invalid_old_style_params, tok_i); | |
| 3045 | return try Attribute.applyTypeAttributes(p, some.ty, attr_buf_top, .align_ignored); | |
| 3046 | } | |
| 3047 | return try Attribute.applyTypeAttributes(p, ty, attr_buf_top, .align_ignored); | |
| 3048 | } | |
| 3049 | ||
| 3050 | /// initializer | |
| 3051 | /// : assignExpr | |
| 3052 | /// | '{' initializerItems '}' | |
| 3053 | fn initializer(p: *Parser, init_ty: Type) Error!Result { | |
| 3054 | // fast path for non-braced initializers | |
| 3055 | if (p.tok_ids[p.tok_i] != .l_brace) { | |
| 3056 | const tok = p.tok_i; | |
| 3057 | var res = try p.assignExpr(); | |
| 3058 | try res.expect(p); | |
| 3059 | if (try p.coerceArrayInit(&res, tok, init_ty)) return res; | |
| 3060 | try p.coerceInit(&res, tok, init_ty); | |
| 3061 | return res; | |
| 3062 | } | |
| 3063 | if (init_ty.is(.auto_type)) { | |
| 3064 | try p.err(.auto_type_with_init_list); | |
| 3065 | return error.ParsingFailed; | |
| 3066 | } | |
| 3067 | ||
| 3068 | var il: InitList = .{}; | |
| 3069 | defer il.deinit(p.gpa); | |
| 3070 | ||
| 3071 | _ = try p.initializerItem(&il, init_ty); | |
| 3072 | ||
| 3073 | const res = try p.convertInitList(il, init_ty); | |
| 3074 | var res_ty = p.nodes.items(.ty)[@intFromEnum(res)]; | |
| 3075 | res_ty.qual = init_ty.qual; | |
| 3076 | return Result{ .ty = res_ty, .node = res }; | |
| 3077 | } | |
| 3078 | ||
| 3079 | /// initializerItems : designation? initializer (',' designation? initializer)* ','? | |
| 3080 | /// designation : designator+ '=' | |
| 3081 | /// designator | |
| 3082 | /// : '[' integerConstExpr ']' | |
| 3083 | /// | '.' identifier | |
| 3084 | fn initializerItem(p: *Parser, il: *InitList, init_ty: Type) Error!bool { | |
| 3085 | const l_brace = p.eatToken(.l_brace) orelse { | |
| 3086 | const tok = p.tok_i; | |
| 3087 | var res = try p.assignExpr(); | |
| 3088 | if (res.empty(p)) return false; | |
| 3089 | ||
| 3090 | const arr = try p.coerceArrayInit(&res, tok, init_ty); | |
| 3091 | if (!arr) try p.coerceInit(&res, tok, init_ty); | |
| 3092 | if (il.tok != 0) { | |
| 3093 | try p.errTok(.initializer_overrides, tok); | |
| 3094 | try p.errTok(.previous_initializer, il.tok); | |
| 3095 | } | |
| 3096 | il.node = res.node; | |
| 3097 | il.tok = tok; | |
| 3098 | return true; | |
| 3099 | }; | |
| 3100 | ||
| 3101 | const is_scalar = init_ty.isScalar(); | |
| 3102 | const is_complex = init_ty.isComplex(); | |
| 3103 | const scalar_inits_needed: usize = if (is_complex) 2 else 1; | |
| 3104 | if (p.eatToken(.r_brace)) |_| { | |
| 3105 | if (is_scalar) try p.errTok(.empty_scalar_init, l_brace); | |
| 3106 | if (il.tok != 0) { | |
| 3107 | try p.errTok(.initializer_overrides, l_brace); | |
| 3108 | try p.errTok(.previous_initializer, il.tok); | |
| 3109 | } | |
| 3110 | il.node = .none; | |
| 3111 | il.tok = l_brace; | |
| 3112 | return true; | |
| 3113 | } | |
| 3114 | ||
| 3115 | var count: u64 = 0; | |
| 3116 | var warned_excess = false; | |
| 3117 | var is_str_init = false; | |
| 3118 | var index_hint: ?u64 = null; | |
| 3119 | while (true) : (count += 1) { | |
| 3120 | errdefer p.skipTo(.r_brace); | |
| 3121 | ||
| 3122 | var first_tok = p.tok_i; | |
| 3123 | var cur_ty = init_ty; | |
| 3124 | var cur_il = il; | |
| 3125 | var designation = false; | |
| 3126 | var cur_index_hint: ?u64 = null; | |
| 3127 | while (true) { | |
| 3128 | if (p.eatToken(.l_bracket)) |l_bracket| { | |
| 3129 | if (!cur_ty.isArray()) { | |
| 3130 | try p.errStr(.invalid_array_designator, l_bracket, try p.typeStr(cur_ty)); | |
| 3131 | return error.ParsingFailed; | |
| 3132 | } | |
| 3133 | const expr_tok = p.tok_i; | |
| 3134 | const index_res = try p.integerConstExpr(.gnu_folding_extension); | |
| 3135 | try p.expectClosing(l_bracket, .r_bracket); | |
| 3136 | ||
| 3137 | if (index_res.val.tag == .unavailable) { | |
| 3138 | try p.errTok(.expected_integer_constant_expr, expr_tok); | |
| 3139 | return error.ParsingFailed; | |
| 3140 | } else if (index_res.val.compare(.lt, index_res.val.zero(), index_res.ty, p.comp)) { | |
| 3141 | try p.errExtra(.negative_array_designator, l_bracket + 1, .{ | |
| 3142 | .signed = index_res.val.signExtend(index_res.ty, p.comp), | |
| 3143 | }); | |
| 3144 | return error.ParsingFailed; | |
| 3145 | } | |
| 3146 | ||
| 3147 | const max_len = cur_ty.arrayLen() orelse std.math.maxInt(usize); | |
| 3148 | if (index_res.val.data.int >= max_len) { | |
| 3149 | try p.errExtra(.oob_array_designator, l_bracket + 1, .{ .unsigned = index_res.val.data.int }); | |
| 3150 | return error.ParsingFailed; | |
| 3151 | } | |
| 3152 | const checked = index_res.val.getInt(u64); | |
| 3153 | cur_index_hint = cur_index_hint orelse checked; | |
| 3154 | ||
| 3155 | cur_il = try cur_il.find(p.gpa, checked); | |
| 3156 | cur_ty = cur_ty.elemType(); | |
| 3157 | designation = true; | |
| 3158 | } else if (p.eatToken(.period)) |period| { | |
| 3159 | const field_tok = try p.expectIdentifier(); | |
| 3160 | const field_str = p.tokSlice(field_tok); | |
| 3161 | const field_name = try p.comp.intern(field_str); | |
| 3162 | cur_ty = cur_ty.canonicalize(.standard); | |
| 3163 | if (!cur_ty.isRecord()) { | |
| 3164 | try p.errStr(.invalid_field_designator, period, try p.typeStr(cur_ty)); | |
| 3165 | return error.ParsingFailed; | |
| 3166 | } else if (!cur_ty.hasField(field_name)) { | |
| 3167 | try p.errStr(.no_such_field_designator, period, field_str); | |
| 3168 | return error.ParsingFailed; | |
| 3169 | } | |
| 3170 | ||
| 3171 | // TODO check if union already has field set | |
| 3172 | outer: while (true) { | |
| 3173 | for (cur_ty.data.record.fields, 0..) |f, i| { | |
| 3174 | if (f.isAnonymousRecord()) { | |
| 3175 | // Recurse into anonymous field if it has a field by the name. | |
| 3176 | if (!f.ty.hasField(field_name)) continue; | |
| 3177 | cur_ty = f.ty.canonicalize(.standard); | |
| 3178 | cur_il = try il.find(p.gpa, i); | |
| 3179 | cur_index_hint = cur_index_hint orelse i; | |
| 3180 | continue :outer; | |
| 3181 | } | |
| 3182 | if (field_name == f.name) { | |
| 3183 | cur_il = try cur_il.find(p.gpa, i); | |
| 3184 | cur_ty = f.ty; | |
| 3185 | cur_index_hint = cur_index_hint orelse i; | |
| 3186 | break :outer; | |
| 3187 | } | |
| 3188 | } | |
| 3189 | unreachable; // we already checked that the starting type has this field | |
| 3190 | } | |
| 3191 | designation = true; | |
| 3192 | } else break; | |
| 3193 | } | |
| 3194 | if (designation) index_hint = null; | |
| 3195 | defer index_hint = cur_index_hint orelse null; | |
| 3196 | ||
| 3197 | if (designation) _ = try p.expectToken(.equal); | |
| 3198 | ||
| 3199 | if (!designation and cur_ty.hasAttribute(.designated_init)) { | |
| 3200 | try p.err(.designated_init_needed); | |
| 3201 | } | |
| 3202 | ||
| 3203 | var saw = false; | |
| 3204 | if (is_str_init and p.isStringInit(init_ty)) { | |
| 3205 | // discard further strings | |
| 3206 | var tmp_il = InitList{}; | |
| 3207 | defer tmp_il.deinit(p.gpa); | |
| 3208 | saw = try p.initializerItem(&tmp_il, .{ .specifier = .void }); | |
| 3209 | } else if (count == 0 and p.isStringInit(init_ty)) { | |
| 3210 | is_str_init = true; | |
| 3211 | saw = try p.initializerItem(il, init_ty); | |
| 3212 | } else if (is_scalar and count >= scalar_inits_needed) { | |
| 3213 | // discard further scalars | |
| 3214 | var tmp_il = InitList{}; | |
| 3215 | defer tmp_il.deinit(p.gpa); | |
| 3216 | saw = try p.initializerItem(&tmp_il, .{ .specifier = .void }); | |
| 3217 | } else if (p.tok_ids[p.tok_i] == .l_brace) { | |
| 3218 | if (designation) { | |
| 3219 | // designation overrides previous value, let existing mechanism handle it | |
| 3220 | saw = try p.initializerItem(cur_il, cur_ty); | |
| 3221 | } else if (try p.findAggregateInitializer(&cur_il, &cur_ty, &index_hint)) { | |
| 3222 | saw = try p.initializerItem(cur_il, cur_ty); | |
| 3223 | } else { | |
| 3224 | // discard further values | |
| 3225 | var tmp_il = InitList{}; | |
| 3226 | defer tmp_il.deinit(p.gpa); | |
| 3227 | saw = try p.initializerItem(&tmp_il, .{ .specifier = .void }); | |
| 3228 | if (!warned_excess) try p.errTok(if (init_ty.isArray()) .excess_array_init else .excess_struct_init, first_tok); | |
| 3229 | warned_excess = true; | |
| 3230 | } | |
| 3231 | } else single_item: { | |
| 3232 | first_tok = p.tok_i; | |
| 3233 | var res = try p.assignExpr(); | |
| 3234 | saw = !res.empty(p); | |
| 3235 | if (!saw) break :single_item; | |
| 3236 | ||
| 3237 | excess: { | |
| 3238 | if (index_hint) |*hint| { | |
| 3239 | if (try p.findScalarInitializerAt(&cur_il, &cur_ty, res.ty, first_tok, hint)) break :excess; | |
| 3240 | } else if (try p.findScalarInitializer(&cur_il, &cur_ty, res.ty, first_tok)) break :excess; | |
| 3241 | ||
| 3242 | if (designation) break :excess; | |
| 3243 | if (!warned_excess) try p.errTok(if (init_ty.isArray()) .excess_array_init else .excess_struct_init, first_tok); | |
| 3244 | warned_excess = true; | |
| 3245 | ||
| 3246 | break :single_item; | |
| 3247 | } | |
| 3248 | ||
| 3249 | const arr = try p.coerceArrayInit(&res, first_tok, cur_ty); | |
| 3250 | if (!arr) try p.coerceInit(&res, first_tok, cur_ty); | |
| 3251 | if (cur_il.tok != 0) { | |
| 3252 | try p.errTok(.initializer_overrides, first_tok); | |
| 3253 | try p.errTok(.previous_initializer, cur_il.tok); | |
| 3254 | } | |
| 3255 | cur_il.node = res.node; | |
| 3256 | cur_il.tok = first_tok; | |
| 3257 | } | |
| 3258 | ||
| 3259 | if (!saw) { | |
| 3260 | if (designation) { | |
| 3261 | try p.err(.expected_expr); | |
| 3262 | return error.ParsingFailed; | |
| 3263 | } | |
| 3264 | break; | |
| 3265 | } else if (count == 1) { | |
| 3266 | if (is_str_init) try p.errTok(.excess_str_init, first_tok); | |
| 3267 | if (is_scalar and !is_complex) try p.errTok(.excess_scalar_init, first_tok); | |
| 3268 | } else if (count == 2) { | |
| 3269 | if (is_scalar and is_complex) try p.errTok(.excess_scalar_init, first_tok); | |
| 3270 | } | |
| 3271 | ||
| 3272 | if (p.eatToken(.comma) == null) break; | |
| 3273 | } | |
| 3274 | try p.expectClosing(l_brace, .r_brace); | |
| 3275 | ||
| 3276 | if (is_complex and count == 1) { // count of 1 means we saw exactly 2 items in the initializer list | |
| 3277 | try p.errTok(.complex_component_init, l_brace); | |
| 3278 | } | |
| 3279 | if (is_scalar or is_str_init) return true; | |
| 3280 | if (il.tok != 0) { | |
| 3281 | try p.errTok(.initializer_overrides, l_brace); | |
| 3282 | try p.errTok(.previous_initializer, il.tok); | |
| 3283 | } | |
| 3284 | il.node = .none; | |
| 3285 | il.tok = l_brace; | |
| 3286 | return true; | |
| 3287 | } | |
| 3288 | ||
| 3289 | /// Returns true if the value is unused. | |
| 3290 | fn findScalarInitializerAt(p: *Parser, il: **InitList, ty: *Type, actual_ty: Type, first_tok: TokenIndex, start_index: *u64) Error!bool { | |
| 3291 | if (ty.isArray()) { | |
| 3292 | if (il.*.node != .none) return false; | |
| 3293 | start_index.* += 1; | |
| 3294 | ||
| 3295 | const arr_ty = ty.*; | |
| 3296 | const elem_count = arr_ty.arrayLen() orelse std.math.maxInt(u64); | |
| 3297 | if (elem_count == 0) { | |
| 3298 | try p.errTok(.empty_aggregate_init_braces, first_tok); | |
| 3299 | return error.ParsingFailed; | |
| 3300 | } | |
| 3301 | const elem_ty = arr_ty.elemType(); | |
| 3302 | const arr_il = il.*; | |
| 3303 | if (start_index.* < elem_count) { | |
| 3304 | ty.* = elem_ty; | |
| 3305 | il.* = try arr_il.find(p.gpa, start_index.*); | |
| 3306 | _ = try p.findScalarInitializer(il, ty, actual_ty, first_tok); | |
| 3307 | return true; | |
| 3308 | } | |
| 3309 | return false; | |
| 3310 | } else if (ty.get(.@"struct")) |struct_ty| { | |
| 3311 | if (il.*.node != .none) return false; | |
| 3312 | start_index.* += 1; | |
| 3313 | ||
| 3314 | const fields = struct_ty.data.record.fields; | |
| 3315 | if (fields.len == 0) { | |
| 3316 | try p.errTok(.empty_aggregate_init_braces, first_tok); | |
| 3317 | return error.ParsingFailed; | |
| 3318 | } | |
| 3319 | const struct_il = il.*; | |
| 3320 | if (start_index.* < fields.len) { | |
| 3321 | const field = fields[@intCast(start_index.*)]; | |
| 3322 | ty.* = field.ty; | |
| 3323 | il.* = try struct_il.find(p.gpa, start_index.*); | |
| 3324 | _ = try p.findScalarInitializer(il, ty, actual_ty, first_tok); | |
| 3325 | return true; | |
| 3326 | } | |
| 3327 | return false; | |
| 3328 | } else if (ty.get(.@"union")) |_| { | |
| 3329 | return false; | |
| 3330 | } | |
| 3331 | return il.*.node == .none; | |
| 3332 | } | |
| 3333 | ||
| 3334 | /// Returns true if the value is unused. | |
| 3335 | fn findScalarInitializer(p: *Parser, il: **InitList, ty: *Type, actual_ty: Type, first_tok: TokenIndex) Error!bool { | |
| 3336 | if (ty.isArray() or ty.isComplex()) { | |
| 3337 | if (il.*.node != .none) return false; | |
| 3338 | const start_index = il.*.list.items.len; | |
| 3339 | var index = if (start_index != 0) il.*.list.items[start_index - 1].index else start_index; | |
| 3340 | ||
| 3341 | const arr_ty = ty.*; | |
| 3342 | const elem_count: u64 = arr_ty.expectedInitListSize() orelse std.math.maxInt(u64); | |
| 3343 | if (elem_count == 0) { | |
| 3344 | try p.errTok(.empty_aggregate_init_braces, first_tok); | |
| 3345 | return error.ParsingFailed; | |
| 3346 | } | |
| 3347 | const elem_ty = arr_ty.elemType(); | |
| 3348 | const arr_il = il.*; | |
| 3349 | while (index < elem_count) : (index += 1) { | |
| 3350 | ty.* = elem_ty; | |
| 3351 | il.* = try arr_il.find(p.gpa, index); | |
| 3352 | if (il.*.node == .none and actual_ty.eql(elem_ty, p.comp, false)) return true; | |
| 3353 | if (try p.findScalarInitializer(il, ty, actual_ty, first_tok)) return true; | |
| 3354 | } | |
| 3355 | return false; | |
| 3356 | } else if (ty.get(.@"struct")) |struct_ty| { | |
| 3357 | if (il.*.node != .none) return false; | |
| 3358 | if (actual_ty.eql(ty.*, p.pp.comp, false)) return true; | |
| 3359 | const start_index = il.*.list.items.len; | |
| 3360 | var index = if (start_index != 0) il.*.list.items[start_index - 1].index + 1 else start_index; | |
| 3361 | ||
| 3362 | const fields = struct_ty.data.record.fields; | |
| 3363 | if (fields.len == 0) { | |
| 3364 | try p.errTok(.empty_aggregate_init_braces, first_tok); | |
| 3365 | return error.ParsingFailed; | |
| 3366 | } | |
| 3367 | const struct_il = il.*; | |
| 3368 | while (index < fields.len) : (index += 1) { | |
| 3369 | const field = fields[@intCast(index)]; | |
| 3370 | ty.* = field.ty; | |
| 3371 | il.* = try struct_il.find(p.gpa, index); | |
| 3372 | if (il.*.node == .none and actual_ty.eql(field.ty, p.comp, false)) return true; | |
| 3373 | if (try p.findScalarInitializer(il, ty, actual_ty, first_tok)) return true; | |
| 3374 | } | |
| 3375 | return false; | |
| 3376 | } else if (ty.get(.@"union")) |union_ty| { | |
| 3377 | if (il.*.node != .none) return false; | |
| 3378 | if (actual_ty.eql(ty.*, p.pp.comp, false)) return true; | |
| 3379 | if (union_ty.data.record.fields.len == 0) { | |
| 3380 | try p.errTok(.empty_aggregate_init_braces, first_tok); | |
| 3381 | return error.ParsingFailed; | |
| 3382 | } | |
| 3383 | ty.* = union_ty.data.record.fields[0].ty; | |
| 3384 | il.* = try il.*.find(p.gpa, 0); | |
| 3385 | // if (il.*.node == .none and actual_ty.eql(ty, p.pp.comp, false)) return true; | |
| 3386 | if (try p.findScalarInitializer(il, ty, actual_ty, first_tok)) return true; | |
| 3387 | return false; | |
| 3388 | } | |
| 3389 | return il.*.node == .none; | |
| 3390 | } | |
| 3391 | ||
| 3392 | fn findAggregateInitializer(p: *Parser, il: **InitList, ty: *Type, start_index: *?u64) Error!bool { | |
| 3393 | if (ty.isArray()) { | |
| 3394 | if (il.*.node != .none) return false; | |
| 3395 | const list_index = il.*.list.items.len; | |
| 3396 | const index = if (start_index.*) |*some| blk: { | |
| 3397 | some.* += 1; | |
| 3398 | break :blk some.*; | |
| 3399 | } else if (list_index != 0) | |
| 3400 | il.*.list.items[list_index - 1].index + 1 | |
| 3401 | else | |
| 3402 | list_index; | |
| 3403 | ||
| 3404 | const arr_ty = ty.*; | |
| 3405 | const elem_count = arr_ty.arrayLen() orelse std.math.maxInt(u64); | |
| 3406 | const elem_ty = arr_ty.elemType(); | |
| 3407 | if (index < elem_count) { | |
| 3408 | ty.* = elem_ty; | |
| 3409 | il.* = try il.*.find(p.gpa, index); | |
| 3410 | return true; | |
| 3411 | } | |
| 3412 | return false; | |
| 3413 | } else if (ty.get(.@"struct")) |struct_ty| { | |
| 3414 | if (il.*.node != .none) return false; | |
| 3415 | const list_index = il.*.list.items.len; | |
| 3416 | const index = if (start_index.*) |*some| blk: { | |
| 3417 | some.* += 1; | |
| 3418 | break :blk some.*; | |
| 3419 | } else if (list_index != 0) | |
| 3420 | il.*.list.items[list_index - 1].index + 1 | |
| 3421 | else | |
| 3422 | list_index; | |
| 3423 | ||
| 3424 | const field_count = struct_ty.data.record.fields.len; | |
| 3425 | if (index < field_count) { | |
| 3426 | ty.* = struct_ty.data.record.fields[@intCast(index)].ty; | |
| 3427 | il.* = try il.*.find(p.gpa, index); | |
| 3428 | return true; | |
| 3429 | } | |
| 3430 | return false; | |
| 3431 | } else if (ty.get(.@"union")) |union_ty| { | |
| 3432 | if (il.*.node != .none) return false; | |
| 3433 | if (start_index.*) |_| return false; // overrides | |
| 3434 | if (union_ty.data.record.fields.len == 0) return false; | |
| 3435 | ||
| 3436 | ty.* = union_ty.data.record.fields[0].ty; | |
| 3437 | il.* = try il.*.find(p.gpa, 0); | |
| 3438 | return true; | |
| 3439 | } else { | |
| 3440 | try p.err(.too_many_scalar_init_braces); | |
| 3441 | return il.*.node == .none; | |
| 3442 | } | |
| 3443 | } | |
| 3444 | ||
| 3445 | fn coerceArrayInit(p: *Parser, item: *Result, tok: TokenIndex, target: Type) !bool { | |
| 3446 | if (!target.isArray()) return false; | |
| 3447 | ||
| 3448 | const is_str_lit = p.nodeIs(item.node, .string_literal_expr); | |
| 3449 | if (!is_str_lit and !p.nodeIs(item.node, .compound_literal_expr) or !item.ty.isArray()) { | |
| 3450 | try p.errTok(.array_init_str, tok); | |
| 3451 | return true; // do not do further coercion | |
| 3452 | } | |
| 3453 | ||
| 3454 | const target_spec = target.elemType().canonicalize(.standard).specifier; | |
| 3455 | const item_spec = item.ty.elemType().canonicalize(.standard).specifier; | |
| 3456 | ||
| 3457 | const compatible = target.elemType().eql(item.ty.elemType(), p.comp, false) or | |
| 3458 | (is_str_lit and item_spec == .char and (target_spec == .uchar or target_spec == .schar)) or | |
| 3459 | (is_str_lit and item_spec == .uchar and (target_spec == .uchar or target_spec == .schar or target_spec == .char)); | |
| 3460 | if (!compatible) { | |
| 3461 | const e_msg = " with array of type "; | |
| 3462 | try p.errStr(.incompatible_array_init, tok, try p.typePairStrExtra(target, e_msg, item.ty)); | |
| 3463 | return true; // do not do further coercion | |
| 3464 | } | |
| 3465 | ||
| 3466 | if (target.get(.array)) |arr_ty| { | |
| 3467 | assert(item.ty.specifier == .array); | |
| 3468 | var len = item.ty.arrayLen().?; | |
| 3469 | const array_len = arr_ty.arrayLen().?; | |
| 3470 | if (is_str_lit) { | |
| 3471 | // the null byte of a string can be dropped | |
| 3472 | if (len - 1 > array_len) | |
| 3473 | try p.errTok(.str_init_too_long, tok); | |
| 3474 | } else if (len > array_len) { | |
| 3475 | try p.errStr( | |
| 3476 | .arr_init_too_long, | |
| 3477 | tok, | |
| 3478 | try p.typePairStrExtra(target, " with array of type ", item.ty), | |
| 3479 | ); | |
| 3480 | } | |
| 3481 | } | |
| 3482 | return true; | |
| 3483 | } | |
| 3484 | ||
| 3485 | fn coerceInit(p: *Parser, item: *Result, tok: TokenIndex, target: Type) !void { | |
| 3486 | if (target.is(.void)) return; // Do not do type coercion on excess items | |
| 3487 | ||
| 3488 | const node = item.node; | |
| 3489 | try item.lvalConversion(p); | |
| 3490 | if (target.is(.auto_type)) { | |
| 3491 | if (p.getNode(node, .member_access_expr) orelse p.getNode(node, .member_access_ptr_expr)) |member_node| { | |
| 3492 | if (Tree.isBitfield(p.nodes.slice(), member_node)) try p.errTok(.auto_type_from_bitfield, tok); | |
| 3493 | } | |
| 3494 | return; | |
| 3495 | } | |
| 3496 | ||
| 3497 | try item.coerce(p, target, tok, .init); | |
| 3498 | } | |
| 3499 | ||
| 3500 | fn isStringInit(p: *Parser, ty: Type) bool { | |
| 3501 | if (!ty.isArray() or !ty.elemType().isInt()) return false; | |
| 3502 | var i = p.tok_i; | |
| 3503 | while (true) : (i += 1) { | |
| 3504 | switch (p.tok_ids[i]) { | |
| 3505 | .l_paren => {}, | |
| 3506 | .string_literal, | |
| 3507 | .string_literal_utf_16, | |
| 3508 | .string_literal_utf_8, | |
| 3509 | .string_literal_utf_32, | |
| 3510 | .string_literal_wide, | |
| 3511 | => return true, | |
| 3512 | else => return false, | |
| 3513 | } | |
| 3514 | } | |
| 3515 | } | |
| 3516 | ||
| 3517 | /// Convert InitList into an AST | |
| 3518 | fn convertInitList(p: *Parser, il: InitList, init_ty: Type) Error!NodeIndex { | |
| 3519 | const is_complex = init_ty.isComplex(); | |
| 3520 | if (init_ty.isScalar() and !is_complex) { | |
| 3521 | if (il.node == .none) { | |
| 3522 | return p.addNode(.{ .tag = .default_init_expr, .ty = init_ty, .data = undefined }); | |
| 3523 | } | |
| 3524 | return il.node; | |
| 3525 | } else if (init_ty.is(.variable_len_array)) { | |
| 3526 | return error.ParsingFailed; // vla invalid, reported earlier | |
| 3527 | } else if (init_ty.isArray() or is_complex) { | |
| 3528 | if (il.node != .none) { | |
| 3529 | return il.node; | |
| 3530 | } | |
| 3531 | const list_buf_top = p.list_buf.items.len; | |
| 3532 | defer p.list_buf.items.len = list_buf_top; | |
| 3533 | ||
| 3534 | const elem_ty = init_ty.elemType(); | |
| 3535 | ||
| 3536 | const max_items: u64 = init_ty.expectedInitListSize() orelse std.math.maxInt(usize); | |
| 3537 | var start: u64 = 0; | |
| 3538 | for (il.list.items) |*init| { | |
| 3539 | if (init.index > start) { | |
| 3540 | const elem = try p.addNode(.{ | |
| 3541 | .tag = .array_filler_expr, | |
| 3542 | .ty = elem_ty, | |
| 3543 | .data = .{ .int = init.index - start }, | |
| 3544 | }); | |
| 3545 | try p.list_buf.append(elem); | |
| 3546 | } | |
| 3547 | start = init.index + 1; | |
| 3548 | ||
| 3549 | const elem = try p.convertInitList(init.list, elem_ty); | |
| 3550 | try p.list_buf.append(elem); | |
| 3551 | } | |
| 3552 | ||
| 3553 | var arr_init_node: Tree.Node = .{ | |
| 3554 | .tag = .array_init_expr_two, | |
| 3555 | .ty = init_ty, | |
| 3556 | .data = .{ .bin = .{ .lhs = .none, .rhs = .none } }, | |
| 3557 | }; | |
| 3558 | ||
| 3559 | if (init_ty.specifier == .incomplete_array) { | |
| 3560 | arr_init_node.ty.specifier = .array; | |
| 3561 | arr_init_node.ty.data.array.len = start; | |
| 3562 | } else if (init_ty.is(.incomplete_array)) { | |
| 3563 | const arr_ty = try p.arena.create(Type.Array); | |
| 3564 | arr_ty.* = .{ .elem = init_ty.elemType(), .len = start }; | |
| 3565 | arr_init_node.ty = .{ | |
| 3566 | .specifier = .array, | |
| 3567 | .data = .{ .array = arr_ty }, | |
| 3568 | }; | |
| 3569 | const attrs = init_ty.getAttributes(); | |
| 3570 | arr_init_node.ty = try arr_init_node.ty.withAttributes(p.arena, attrs); | |
| 3571 | } else if (start < max_items) { | |
| 3572 | const elem = try p.addNode(.{ | |
| 3573 | .tag = .array_filler_expr, | |
| 3574 | .ty = elem_ty, | |
| 3575 | .data = .{ .int = max_items - start }, | |
| 3576 | }); | |
| 3577 | try p.list_buf.append(elem); | |
| 3578 | } | |
| 3579 | ||
| 3580 | const items = p.list_buf.items[list_buf_top..]; | |
| 3581 | switch (items.len) { | |
| 3582 | 0 => {}, | |
| 3583 | 1 => arr_init_node.data.bin.lhs = items[0], | |
| 3584 | 2 => arr_init_node.data.bin = .{ .lhs = items[0], .rhs = items[1] }, | |
| 3585 | else => { | |
| 3586 | arr_init_node.tag = .array_init_expr; | |
| 3587 | arr_init_node.data = .{ .range = try p.addList(items) }; | |
| 3588 | }, | |
| 3589 | } | |
| 3590 | return try p.addNode(arr_init_node); | |
| 3591 | } else if (init_ty.get(.@"struct")) |struct_ty| { | |
| 3592 | assert(!struct_ty.hasIncompleteSize()); | |
| 3593 | if (il.node != .none) { | |
| 3594 | return il.node; | |
| 3595 | } | |
| 3596 | ||
| 3597 | const list_buf_top = p.list_buf.items.len; | |
| 3598 | defer p.list_buf.items.len = list_buf_top; | |
| 3599 | ||
| 3600 | var init_index: usize = 0; | |
| 3601 | for (struct_ty.data.record.fields, 0..) |f, i| { | |
| 3602 | if (init_index < il.list.items.len and il.list.items[init_index].index == i) { | |
| 3603 | const item = try p.convertInitList(il.list.items[init_index].list, f.ty); | |
| 3604 | try p.list_buf.append(item); | |
| 3605 | init_index += 1; | |
| 3606 | } else { | |
| 3607 | const item = try p.addNode(.{ .tag = .default_init_expr, .ty = f.ty, .data = undefined }); | |
| 3608 | try p.list_buf.append(item); | |
| 3609 | } | |
| 3610 | } | |
| 3611 | ||
| 3612 | var struct_init_node: Tree.Node = .{ | |
| 3613 | .tag = .struct_init_expr_two, | |
| 3614 | .ty = init_ty, | |
| 3615 | .data = .{ .bin = .{ .lhs = .none, .rhs = .none } }, | |
| 3616 | }; | |
| 3617 | const items = p.list_buf.items[list_buf_top..]; | |
| 3618 | switch (items.len) { | |
| 3619 | 0 => {}, | |
| 3620 | 1 => struct_init_node.data.bin.lhs = items[0], | |
| 3621 | 2 => struct_init_node.data.bin = .{ .lhs = items[0], .rhs = items[1] }, | |
| 3622 | else => { | |
| 3623 | struct_init_node.tag = .struct_init_expr; | |
| 3624 | struct_init_node.data = .{ .range = try p.addList(items) }; | |
| 3625 | }, | |
| 3626 | } | |
| 3627 | return try p.addNode(struct_init_node); | |
| 3628 | } else if (init_ty.get(.@"union")) |union_ty| { | |
| 3629 | if (il.node != .none) { | |
| 3630 | return il.node; | |
| 3631 | } | |
| 3632 | ||
| 3633 | var union_init_node: Tree.Node = .{ | |
| 3634 | .tag = .union_init_expr, | |
| 3635 | .ty = init_ty, | |
| 3636 | .data = .{ .union_init = .{ .field_index = 0, .node = .none } }, | |
| 3637 | }; | |
| 3638 | if (union_ty.data.record.fields.len == 0) { | |
| 3639 | // do nothing for empty unions | |
| 3640 | } else if (il.list.items.len == 0) { | |
| 3641 | union_init_node.data.union_init.node = try p.addNode(.{ | |
| 3642 | .tag = .default_init_expr, | |
| 3643 | .ty = init_ty, | |
| 3644 | .data = undefined, | |
| 3645 | }); | |
| 3646 | } else { | |
| 3647 | const init = il.list.items[0]; | |
| 3648 | const index: u32 = @truncate(init.index); | |
| 3649 | const field_ty = union_ty.data.record.fields[index].ty; | |
| 3650 | union_init_node.data.union_init = .{ | |
| 3651 | .field_index = index, | |
| 3652 | .node = try p.convertInitList(init.list, field_ty), | |
| 3653 | }; | |
| 3654 | } | |
| 3655 | return try p.addNode(union_init_node); | |
| 3656 | } else { | |
| 3657 | return error.ParsingFailed; // initializer target is invalid, reported earlier | |
| 3658 | } | |
| 3659 | } | |
| 3660 | ||
| 3661 | fn msvcAsmStmt(p: *Parser) Error!?NodeIndex { | |
| 3662 | return p.todo("MSVC assembly statements"); | |
| 3663 | } | |
| 3664 | ||
| 3665 | /// asmOperand : ('[' IDENTIFIER ']')? asmStr '(' expr ')' | |
| 3666 | fn asmOperand(p: *Parser, names: *std.ArrayList(?TokenIndex), constraints: *NodeList, exprs: *NodeList) Error!void { | |
| 3667 | if (p.eatToken(.l_bracket)) |l_bracket| { | |
| 3668 | const ident = (try p.eatIdentifier()) orelse { | |
| 3669 | try p.err(.expected_identifier); | |
| 3670 | return error.ParsingFailed; | |
| 3671 | }; | |
| 3672 | try names.append(ident); | |
| 3673 | try p.expectClosing(l_bracket, .r_bracket); | |
| 3674 | } else { | |
| 3675 | try names.append(null); | |
| 3676 | } | |
| 3677 | const constraint = try p.asmStr(); | |
| 3678 | try constraints.append(constraint.node); | |
| 3679 | ||
| 3680 | const l_paren = p.eatToken(.l_paren) orelse { | |
| 3681 | try p.errExtra(.expected_token, p.tok_i, .{ .tok_id = .{ .actual = p.tok_ids[p.tok_i], .expected = .l_paren } }); | |
| 3682 | return error.ParsingFailed; | |
| 3683 | }; | |
| 3684 | const res = try p.expr(); | |
| 3685 | try p.expectClosing(l_paren, .r_paren); | |
| 3686 | try res.expect(p); | |
| 3687 | try exprs.append(res.node); | |
| 3688 | } | |
| 3689 | ||
| 3690 | /// gnuAsmStmt | |
| 3691 | /// : asmStr | |
| 3692 | /// | asmStr ':' asmOperand* | |
| 3693 | /// | asmStr ':' asmOperand* ':' asmOperand* | |
| 3694 | /// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)* | |
| 3695 | /// | asmStr ':' asmOperand* ':' asmOperand* : asmStr? (',' asmStr)* : IDENTIFIER (',' IDENTIFIER)* | |
| 3696 | fn gnuAsmStmt(p: *Parser, quals: Tree.GNUAssemblyQualifiers, l_paren: TokenIndex) Error!NodeIndex { | |
| 3697 | const asm_str = try p.asmStr(); | |
| 3698 | try p.checkAsmStr(asm_str.val, l_paren); | |
| 3699 | ||
| 3700 | if (p.tok_ids[p.tok_i] == .r_paren) { | |
| 3701 | return p.addNode(.{ | |
| 3702 | .tag = .gnu_asm_simple, | |
| 3703 | .ty = .{ .specifier = .void }, | |
| 3704 | .data = .{ .un = asm_str.node }, | |
| 3705 | }); | |
| 3706 | } | |
| 3707 | ||
| 3708 | const expected_items = 8; // arbitrarily chosen, most assembly will have fewer than 8 inputs/outputs/constraints/names | |
| 3709 | const bytes_needed = expected_items * @sizeOf(?TokenIndex) + expected_items * 3 * @sizeOf(NodeIndex); | |
| 3710 | ||
| 3711 | var stack_fallback = std.heap.stackFallback(bytes_needed, p.comp.gpa); | |
| 3712 | const allocator = stack_fallback.get(); | |
| 3713 | ||
| 3714 | // TODO: Consider using a TokenIndex of 0 instead of null if we need to store the names in the tree | |
| 3715 | var names = std.ArrayList(?TokenIndex).initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded | |
| 3716 | defer names.deinit(); | |
| 3717 | var constraints = NodeList.initCapacity(allocator, expected_items) catch unreachable; // stack allocation already succeeded | |
| 3718 | defer constraints.deinit(); | |
| 3719 | var exprs = NodeList.initCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded | |
| 3720 | defer exprs.deinit(); | |
| 3721 | var clobbers = NodeList.initCapacity(allocator, expected_items) catch unreachable; //stack allocation already succeeded | |
| 3722 | defer clobbers.deinit(); | |
| 3723 | ||
| 3724 | // Outputs | |
| 3725 | var ate_extra_colon = false; | |
| 3726 | if (p.eatToken(.colon) orelse p.eatToken(.colon_colon)) |tok_i| { | |
| 3727 | ate_extra_colon = p.tok_ids[tok_i] == .colon_colon; | |
| 3728 | if (!ate_extra_colon) { | |
| 3729 | if (p.tok_ids[p.tok_i].isStringLiteral() or p.tok_ids[p.tok_i] == .l_bracket) { | |
| 3730 | while (true) { | |
| 3731 | try p.asmOperand(&names, &constraints, &exprs); | |
| 3732 | if (p.eatToken(.comma) == null) break; | |
| 3733 | } | |
| 3734 | } | |
| 3735 | } | |
| 3736 | } | |
| 3737 | ||
| 3738 | const num_outputs = names.items.len; | |
| 3739 | ||
| 3740 | // Inputs | |
| 3741 | if (ate_extra_colon or p.tok_ids[p.tok_i] == .colon or p.tok_ids[p.tok_i] == .colon_colon) { | |
| 3742 | if (ate_extra_colon) { | |
| 3743 | ate_extra_colon = false; | |
| 3744 | } else { | |
| 3745 | ate_extra_colon = p.tok_ids[p.tok_i] == .colon_colon; | |
| 3746 | p.tok_i += 1; | |
| 3747 | } | |
| 3748 | if (!ate_extra_colon) { | |
| 3749 | if (p.tok_ids[p.tok_i].isStringLiteral() or p.tok_ids[p.tok_i] == .l_bracket) { | |
| 3750 | while (true) { | |
| 3751 | try p.asmOperand(&names, &constraints, &exprs); | |
| 3752 | if (p.eatToken(.comma) == null) break; | |
| 3753 | } | |
| 3754 | } | |
| 3755 | } | |
| 3756 | } | |
| 3757 | std.debug.assert(names.items.len == constraints.items.len and constraints.items.len == exprs.items.len); | |
| 3758 | const num_inputs = names.items.len - num_outputs; | |
| 3759 | _ = num_inputs; | |
| 3760 | ||
| 3761 | // Clobbers | |
| 3762 | if (ate_extra_colon or p.tok_ids[p.tok_i] == .colon or p.tok_ids[p.tok_i] == .colon_colon) { | |
| 3763 | if (ate_extra_colon) { | |
| 3764 | ate_extra_colon = false; | |
| 3765 | } else { | |
| 3766 | ate_extra_colon = p.tok_ids[p.tok_i] == .colon_colon; | |
| 3767 | p.tok_i += 1; | |
| 3768 | } | |
| 3769 | if (!ate_extra_colon and p.tok_ids[p.tok_i].isStringLiteral()) { | |
| 3770 | while (true) { | |
| 3771 | const clobber = try p.asmStr(); | |
| 3772 | try clobbers.append(clobber.node); | |
| 3773 | if (p.eatToken(.comma) == null) break; | |
| 3774 | } | |
| 3775 | } | |
| 3776 | } | |
| 3777 | ||
| 3778 | if (!quals.goto and (p.tok_ids[p.tok_i] != .r_paren or ate_extra_colon)) { | |
| 3779 | try p.errExtra(.expected_token, p.tok_i, .{ .tok_id = .{ .actual = p.tok_ids[p.tok_i], .expected = .r_paren } }); | |
| 3780 | return error.ParsingFailed; | |
| 3781 | } | |
| 3782 | ||
| 3783 | // Goto labels | |
| 3784 | var num_labels: u32 = 0; | |
| 3785 | if (ate_extra_colon or p.tok_ids[p.tok_i] == .colon) { | |
| 3786 | if (!ate_extra_colon) { | |
| 3787 | p.tok_i += 1; | |
| 3788 | } | |
| 3789 | while (true) { | |
| 3790 | const ident = (try p.eatIdentifier()) orelse { | |
| 3791 | try p.err(.expected_identifier); | |
| 3792 | return error.ParsingFailed; | |
| 3793 | }; | |
| 3794 | const ident_str = p.tokSlice(ident); | |
| 3795 | const label = p.findLabel(ident_str) orelse blk: { | |
| 3796 | try p.labels.append(.{ .unresolved_goto = ident }); | |
| 3797 | break :blk ident; | |
| 3798 | }; | |
| 3799 | try names.append(ident); | |
| 3800 | ||
| 3801 | const elem_ty = try p.arena.create(Type); | |
| 3802 | elem_ty.* = .{ .specifier = .void }; | |
| 3803 | const result_ty = Type{ .specifier = .pointer, .data = .{ .sub_type = elem_ty } }; | |
| 3804 | ||
| 3805 | const label_addr_node = try p.addNode(.{ | |
| 3806 | .tag = .addr_of_label, | |
| 3807 | .data = .{ .decl_ref = label }, | |
| 3808 | .ty = result_ty, | |
| 3809 | }); | |
| 3810 | try exprs.append(label_addr_node); | |
| 3811 | ||
| 3812 | num_labels += 1; | |
| 3813 | if (p.eatToken(.comma) == null) break; | |
| 3814 | } | |
| 3815 | } else if (quals.goto) { | |
| 3816 | try p.errExtra(.expected_token, p.tok_i, .{ .tok_id = .{ .actual = p.tok_ids[p.tok_i], .expected = .colon } }); | |
| 3817 | return error.ParsingFailed; | |
| 3818 | } | |
| 3819 | ||
| 3820 | // TODO: validate and insert into AST | |
| 3821 | return .none; | |
| 3822 | } | |
| 3823 | ||
| 3824 | fn checkAsmStr(p: *Parser, asm_str: Value, tok: TokenIndex) !void { | |
| 3825 | if (!p.comp.langopts.gnu_asm) { | |
| 3826 | const str = asm_str.data.bytes; | |
| 3827 | if (str.len() > 1) { | |
| 3828 | // Empty string (just a NUL byte) is ok because it does not emit any assembly | |
| 3829 | try p.errTok(.gnu_asm_disabled, tok); | |
| 3830 | } | |
| 3831 | } | |
| 3832 | } | |
| 3833 | ||
| 3834 | /// assembly | |
| 3835 | /// : keyword_asm asmQual* '(' asmStr ')' | |
| 3836 | /// | keyword_asm asmQual* '(' gnuAsmStmt ')' | |
| 3837 | /// | keyword_asm msvcAsmStmt | |
| 3838 | fn assembly(p: *Parser, kind: enum { global, decl_label, stmt }) Error!?NodeIndex { | |
| 3839 | const asm_tok = p.tok_i; | |
| 3840 | switch (p.tok_ids[p.tok_i]) { | |
| 3841 | .keyword_asm => { | |
| 3842 | try p.err(.extension_token_used); | |
| 3843 | p.tok_i += 1; | |
| 3844 | }, | |
| 3845 | .keyword_asm1, .keyword_asm2 => p.tok_i += 1, | |
| 3846 | else => return null, | |
| 3847 | } | |
| 3848 | ||
| 3849 | if (!p.tok_ids[p.tok_i].canOpenGCCAsmStmt()) { | |
| 3850 | return p.msvcAsmStmt(); | |
| 3851 | } | |
| 3852 | ||
| 3853 | var quals: Tree.GNUAssemblyQualifiers = .{}; | |
| 3854 | while (true) : (p.tok_i += 1) switch (p.tok_ids[p.tok_i]) { | |
| 3855 | .keyword_volatile, .keyword_volatile1, .keyword_volatile2 => { | |
| 3856 | if (kind != .stmt) try p.errStr(.meaningless_asm_qual, p.tok_i, "volatile"); | |
| 3857 | if (quals.@"volatile") try p.errStr(.duplicate_asm_qual, p.tok_i, "volatile"); | |
| 3858 | quals.@"volatile" = true; | |
| 3859 | }, | |
| 3860 | .keyword_inline, .keyword_inline1, .keyword_inline2 => { | |
| 3861 | if (kind != .stmt) try p.errStr(.meaningless_asm_qual, p.tok_i, "inline"); | |
| 3862 | if (quals.@"inline") try p.errStr(.duplicate_asm_qual, p.tok_i, "inline"); | |
| 3863 | quals.@"inline" = true; | |
| 3864 | }, | |
| 3865 | .keyword_goto => { | |
| 3866 | if (kind != .stmt) try p.errStr(.meaningless_asm_qual, p.tok_i, "goto"); | |
| 3867 | if (quals.goto) try p.errStr(.duplicate_asm_qual, p.tok_i, "goto"); | |
| 3868 | quals.goto = true; | |
| 3869 | }, | |
| 3870 | else => break, | |
| 3871 | }; | |
| 3872 | ||
| 3873 | const l_paren = try p.expectToken(.l_paren); | |
| 3874 | var result_node: NodeIndex = .none; | |
| 3875 | switch (kind) { | |
| 3876 | .decl_label => { | |
| 3877 | const asm_str = try p.asmStr(); | |
| 3878 | const str = asm_str.val.data.bytes.trim(1); // remove null-terminator | |
| 3879 | const attr = Attribute{ .tag = .asm_label, .args = .{ .asm_label = .{ .name = str } }, .syntax = .keyword }; | |
| 3880 | try p.attr_buf.append(p.gpa, .{ .attr = attr, .tok = asm_tok }); | |
| 3881 | }, | |
| 3882 | .global => { | |
| 3883 | const asm_str = try p.asmStr(); | |
| 3884 | try p.checkAsmStr(asm_str.val, l_paren); | |
| 3885 | result_node = try p.addNode(.{ | |
| 3886 | .tag = .file_scope_asm, | |
| 3887 | .ty = .{ .specifier = .void }, | |
| 3888 | .data = .{ .decl = .{ .name = asm_tok, .node = asm_str.node } }, | |
| 3889 | }); | |
| 3890 | }, | |
| 3891 | .stmt => result_node = try p.gnuAsmStmt(quals, l_paren), | |
| 3892 | } | |
| 3893 | try p.expectClosing(l_paren, .r_paren); | |
| 3894 | ||
| 3895 | if (kind != .decl_label) _ = try p.expectToken(.semicolon); | |
| 3896 | return result_node; | |
| 3897 | } | |
| 3898 | ||
| 3899 | /// Same as stringLiteral but errors on unicode and wide string literals | |
| 3900 | fn asmStr(p: *Parser) Error!Result { | |
| 3901 | var i = p.tok_i; | |
| 3902 | while (true) : (i += 1) switch (p.tok_ids[i]) { | |
| 3903 | .string_literal => {}, | |
| 3904 | .string_literal_utf_16, .string_literal_utf_8, .string_literal_utf_32 => { | |
| 3905 | try p.errStr(.invalid_asm_str, p.tok_i, "unicode"); | |
| 3906 | return error.ParsingFailed; | |
| 3907 | }, | |
| 3908 | .string_literal_wide => { | |
| 3909 | try p.errStr(.invalid_asm_str, p.tok_i, "wide"); | |
| 3910 | return error.ParsingFailed; | |
| 3911 | }, | |
| 3912 | else => break, | |
| 3913 | }; | |
| 3914 | return try p.stringLiteral(); | |
| 3915 | } | |
| 3916 | ||
| 3917 | // ====== statements ====== | |
| 3918 | ||
| 3919 | /// stmt | |
| 3920 | /// : labeledStmt | |
| 3921 | /// | compoundStmt | |
| 3922 | /// | keyword_if '(' expr ')' stmt (keyword_else stmt)? | |
| 3923 | /// | keyword_switch '(' expr ')' stmt | |
| 3924 | /// | keyword_while '(' expr ')' stmt | |
| 3925 | /// | keyword_do stmt while '(' expr ')' ';' | |
| 3926 | /// | keyword_for '(' (decl | expr? ';') expr? ';' expr? ')' stmt | |
| 3927 | /// | keyword_goto (IDENTIFIER | ('*' expr)) ';' | |
| 3928 | /// | keyword_continue ';' | |
| 3929 | /// | keyword_break ';' | |
| 3930 | /// | keyword_return expr? ';' | |
| 3931 | /// | assembly ';' | |
| 3932 | /// | expr? ';' | |
| 3933 | fn stmt(p: *Parser) Error!NodeIndex { | |
| 3934 | if (try p.labeledStmt()) |some| return some; | |
| 3935 | if (try p.compoundStmt(false, null)) |some| return some; | |
| 3936 | if (p.eatToken(.keyword_if)) |_| { | |
| 3937 | const l_paren = try p.expectToken(.l_paren); | |
| 3938 | const cond_tok = p.tok_i; | |
| 3939 | var cond = try p.expr(); | |
| 3940 | try cond.expect(p); | |
| 3941 | try cond.lvalConversion(p); | |
| 3942 | try cond.usualUnaryConversion(p, cond_tok); | |
| 3943 | if (!cond.ty.isScalar()) | |
| 3944 | try p.errStr(.statement_scalar, l_paren + 1, try p.typeStr(cond.ty)); | |
| 3945 | try cond.saveValue(p); | |
| 3946 | try p.expectClosing(l_paren, .r_paren); | |
| 3947 | ||
| 3948 | const then = try p.stmt(); | |
| 3949 | const @"else" = if (p.eatToken(.keyword_else)) |_| try p.stmt() else .none; | |
| 3950 | ||
| 3951 | if (then != .none and @"else" != .none) | |
| 3952 | return try p.addNode(.{ | |
| 3953 | .tag = .if_then_else_stmt, | |
| 3954 | .data = .{ .if3 = .{ .cond = cond.node, .body = (try p.addList(&.{ then, @"else" })).start } }, | |
| 3955 | }) | |
| 3956 | else | |
| 3957 | return try p.addNode(.{ | |
| 3958 | .tag = .if_then_stmt, | |
| 3959 | .data = .{ .bin = .{ .lhs = cond.node, .rhs = then } }, | |
| 3960 | }); | |
| 3961 | } | |
| 3962 | if (p.eatToken(.keyword_switch)) |_| { | |
| 3963 | const l_paren = try p.expectToken(.l_paren); | |
| 3964 | const cond_tok = p.tok_i; | |
| 3965 | var cond = try p.expr(); | |
| 3966 | try cond.expect(p); | |
| 3967 | try cond.lvalConversion(p); | |
| 3968 | try cond.usualUnaryConversion(p, cond_tok); | |
| 3969 | ||
| 3970 | if (!cond.ty.isInt()) | |
| 3971 | try p.errStr(.statement_int, l_paren + 1, try p.typeStr(cond.ty)); | |
| 3972 | try cond.saveValue(p); | |
| 3973 | try p.expectClosing(l_paren, .r_paren); | |
| 3974 | ||
| 3975 | const old_switch = p.@"switch"; | |
| 3976 | var @"switch" = Switch{ | |
| 3977 | .ranges = std.ArrayList(Switch.Range).init(p.gpa), | |
| 3978 | .ty = cond.ty, | |
| 3979 | }; | |
| 3980 | p.@"switch" = &@"switch"; | |
| 3981 | defer { | |
| 3982 | @"switch".ranges.deinit(); | |
| 3983 | p.@"switch" = old_switch; | |
| 3984 | } | |
| 3985 | ||
| 3986 | const body = try p.stmt(); | |
| 3987 | ||
| 3988 | return try p.addNode(.{ | |
| 3989 | .tag = .switch_stmt, | |
| 3990 | .data = .{ .bin = .{ .lhs = cond.node, .rhs = body } }, | |
| 3991 | }); | |
| 3992 | } | |
| 3993 | if (p.eatToken(.keyword_while)) |_| { | |
| 3994 | const l_paren = try p.expectToken(.l_paren); | |
| 3995 | const cond_tok = p.tok_i; | |
| 3996 | var cond = try p.expr(); | |
| 3997 | try cond.expect(p); | |
| 3998 | try cond.lvalConversion(p); | |
| 3999 | try cond.usualUnaryConversion(p, cond_tok); | |
| 4000 | if (!cond.ty.isScalar()) | |
| 4001 | try p.errStr(.statement_scalar, l_paren + 1, try p.typeStr(cond.ty)); | |
| 4002 | try cond.saveValue(p); | |
| 4003 | try p.expectClosing(l_paren, .r_paren); | |
| 4004 | ||
| 4005 | const body = body: { | |
| 4006 | const old_loop = p.in_loop; | |
| 4007 | p.in_loop = true; | |
| 4008 | defer p.in_loop = old_loop; | |
| 4009 | break :body try p.stmt(); | |
| 4010 | }; | |
| 4011 | ||
| 4012 | return try p.addNode(.{ | |
| 4013 | .tag = .while_stmt, | |
| 4014 | .data = .{ .bin = .{ .lhs = cond.node, .rhs = body } }, | |
| 4015 | }); | |
| 4016 | } | |
| 4017 | if (p.eatToken(.keyword_do)) |_| { | |
| 4018 | const body = body: { | |
| 4019 | const old_loop = p.in_loop; | |
| 4020 | p.in_loop = true; | |
| 4021 | defer p.in_loop = old_loop; | |
| 4022 | break :body try p.stmt(); | |
| 4023 | }; | |
| 4024 | ||
| 4025 | _ = try p.expectToken(.keyword_while); | |
| 4026 | const l_paren = try p.expectToken(.l_paren); | |
| 4027 | const cond_tok = p.tok_i; | |
| 4028 | var cond = try p.expr(); | |
| 4029 | try cond.expect(p); | |
| 4030 | try cond.lvalConversion(p); | |
| 4031 | try cond.usualUnaryConversion(p, cond_tok); | |
| 4032 | ||
| 4033 | if (!cond.ty.isScalar()) | |
| 4034 | try p.errStr(.statement_scalar, l_paren + 1, try p.typeStr(cond.ty)); | |
| 4035 | try cond.saveValue(p); | |
| 4036 | try p.expectClosing(l_paren, .r_paren); | |
| 4037 | ||
| 4038 | _ = try p.expectToken(.semicolon); | |
| 4039 | return try p.addNode(.{ | |
| 4040 | .tag = .do_while_stmt, | |
| 4041 | .data = .{ .bin = .{ .lhs = cond.node, .rhs = body } }, | |
| 4042 | }); | |
| 4043 | } | |
| 4044 | if (p.eatToken(.keyword_for)) |_| { | |
| 4045 | try p.syms.pushScope(p); | |
| 4046 | defer p.syms.popScope(); | |
| 4047 | const decl_buf_top = p.decl_buf.items.len; | |
| 4048 | defer p.decl_buf.items.len = decl_buf_top; | |
| 4049 | ||
| 4050 | const l_paren = try p.expectToken(.l_paren); | |
| 4051 | const got_decl = try p.decl(); | |
| 4052 | ||
| 4053 | // for (init | |
| 4054 | const init_start = p.tok_i; | |
| 4055 | var err_start = p.comp.diag.list.items.len; | |
| 4056 | var init = if (!got_decl) try p.expr() else Result{}; | |
| 4057 | try init.saveValue(p); | |
| 4058 | try init.maybeWarnUnused(p, init_start, err_start); | |
| 4059 | if (!got_decl) _ = try p.expectToken(.semicolon); | |
| 4060 | ||
| 4061 | // for (init; cond | |
| 4062 | const cond_tok = p.tok_i; | |
| 4063 | var cond = try p.expr(); | |
| 4064 | if (cond.node != .none) { | |
| 4065 | try cond.lvalConversion(p); | |
| 4066 | try cond.usualUnaryConversion(p, cond_tok); | |
| 4067 | if (!cond.ty.isScalar()) | |
| 4068 | try p.errStr(.statement_scalar, l_paren + 1, try p.typeStr(cond.ty)); | |
| 4069 | } | |
| 4070 | try cond.saveValue(p); | |
| 4071 | _ = try p.expectToken(.semicolon); | |
| 4072 | ||
| 4073 | // for (init; cond; incr | |
| 4074 | const incr_start = p.tok_i; | |
| 4075 | err_start = p.comp.diag.list.items.len; | |
| 4076 | var incr = try p.expr(); | |
| 4077 | try incr.maybeWarnUnused(p, incr_start, err_start); | |
| 4078 | try incr.saveValue(p); | |
| 4079 | try p.expectClosing(l_paren, .r_paren); | |
| 4080 | ||
| 4081 | const body = body: { | |
| 4082 | const old_loop = p.in_loop; | |
| 4083 | p.in_loop = true; | |
| 4084 | defer p.in_loop = old_loop; | |
| 4085 | break :body try p.stmt(); | |
| 4086 | }; | |
| 4087 | ||
| 4088 | if (got_decl) { | |
| 4089 | const start = (try p.addList(p.decl_buf.items[decl_buf_top..])).start; | |
| 4090 | const end = (try p.addList(&.{ cond.node, incr.node, body })).end; | |
| 4091 | ||
| 4092 | return try p.addNode(.{ | |
| 4093 | .tag = .for_decl_stmt, | |
| 4094 | .data = .{ .range = .{ .start = start, .end = end } }, | |
| 4095 | }); | |
| 4096 | } else if (init.node == .none and cond.node == .none and incr.node == .none) { | |
| 4097 | return try p.addNode(.{ | |
| 4098 | .tag = .forever_stmt, | |
| 4099 | .data = .{ .un = body }, | |
| 4100 | }); | |
| 4101 | } else return try p.addNode(.{ .tag = .for_stmt, .data = .{ .if3 = .{ | |
| 4102 | .cond = body, | |
| 4103 | .body = (try p.addList(&.{ init.node, cond.node, incr.node })).start, | |
| 4104 | } } }); | |
| 4105 | } | |
| 4106 | if (p.eatToken(.keyword_goto)) |goto_tok| { | |
| 4107 | if (p.eatToken(.asterisk)) |_| { | |
| 4108 | const expr_tok = p.tok_i; | |
| 4109 | var e = try p.expr(); | |
| 4110 | try e.expect(p); | |
| 4111 | try e.lvalConversion(p); | |
| 4112 | p.computed_goto_tok = p.computed_goto_tok orelse goto_tok; | |
| 4113 | if (!e.ty.isPtr()) { | |
| 4114 | const elem_ty = try p.arena.create(Type); | |
| 4115 | elem_ty.* = .{ .specifier = .void, .qual = .{ .@"const" = true } }; | |
| 4116 | const result_ty = Type{ | |
| 4117 | .specifier = .pointer, | |
| 4118 | .data = .{ .sub_type = elem_ty }, | |
| 4119 | }; | |
| 4120 | if (!e.ty.isInt()) { | |
| 4121 | try p.errStr(.incompatible_arg, expr_tok, try p.typePairStrExtra(e.ty, " to parameter of incompatible type ", result_ty)); | |
| 4122 | return error.ParsingFailed; | |
| 4123 | } | |
| 4124 | if (e.val.isZero()) { | |
| 4125 | try e.nullCast(p, result_ty); | |
| 4126 | } else { | |
| 4127 | try p.errStr(.implicit_int_to_ptr, expr_tok, try p.typePairStrExtra(e.ty, " to ", result_ty)); | |
| 4128 | try e.ptrCast(p, result_ty); | |
| 4129 | } | |
| 4130 | } | |
| 4131 | ||
| 4132 | try e.un(p, .computed_goto_stmt); | |
| 4133 | _ = try p.expectToken(.semicolon); | |
| 4134 | return e.node; | |
| 4135 | } | |
| 4136 | const name_tok = try p.expectIdentifier(); | |
| 4137 | const str = p.tokSlice(name_tok); | |
| 4138 | if (p.findLabel(str) == null) { | |
| 4139 | try p.labels.append(.{ .unresolved_goto = name_tok }); | |
| 4140 | } | |
| 4141 | _ = try p.expectToken(.semicolon); | |
| 4142 | return try p.addNode(.{ | |
| 4143 | .tag = .goto_stmt, | |
| 4144 | .data = .{ .decl_ref = name_tok }, | |
| 4145 | }); | |
| 4146 | } | |
| 4147 | if (p.eatToken(.keyword_continue)) |cont| { | |
| 4148 | if (!p.in_loop) try p.errTok(.continue_not_in_loop, cont); | |
| 4149 | _ = try p.expectToken(.semicolon); | |
| 4150 | return try p.addNode(.{ .tag = .continue_stmt, .data = undefined }); | |
| 4151 | } | |
| 4152 | if (p.eatToken(.keyword_break)) |br| { | |
| 4153 | if (!p.in_loop and p.@"switch" == null) try p.errTok(.break_not_in_loop_or_switch, br); | |
| 4154 | _ = try p.expectToken(.semicolon); | |
| 4155 | return try p.addNode(.{ .tag = .break_stmt, .data = undefined }); | |
| 4156 | } | |
| 4157 | if (try p.returnStmt()) |some| return some; | |
| 4158 | if (try p.assembly(.stmt)) |some| return some; | |
| 4159 | ||
| 4160 | const expr_start = p.tok_i; | |
| 4161 | const err_start = p.comp.diag.list.items.len; | |
| 4162 | ||
| 4163 | const e = try p.expr(); | |
| 4164 | if (e.node != .none) { | |
| 4165 | _ = try p.expectToken(.semicolon); | |
| 4166 | try e.maybeWarnUnused(p, expr_start, err_start); | |
| 4167 | return e.node; | |
| 4168 | } | |
| 4169 | ||
| 4170 | const attr_buf_top = p.attr_buf.len; | |
| 4171 | defer p.attr_buf.len = attr_buf_top; | |
| 4172 | try p.attributeSpecifier(); | |
| 4173 | ||
| 4174 | if (p.eatToken(.semicolon)) |_| { | |
| 4175 | var null_node: Tree.Node = .{ .tag = .null_stmt, .data = undefined }; | |
| 4176 | null_node.ty = try Attribute.applyStatementAttributes(p, null_node.ty, expr_start, attr_buf_top); | |
| 4177 | return p.addNode(null_node); | |
| 4178 | } | |
| 4179 | ||
| 4180 | try p.err(.expected_stmt); | |
| 4181 | return error.ParsingFailed; | |
| 4182 | } | |
| 4183 | ||
| 4184 | /// labeledStmt | |
| 4185 | /// : IDENTIFIER ':' stmt | |
| 4186 | /// | keyword_case integerConstExpr ':' stmt | |
| 4187 | /// | keyword_default ':' stmt | |
| 4188 | fn labeledStmt(p: *Parser) Error!?NodeIndex { | |
| 4189 | if ((p.tok_ids[p.tok_i] == .identifier or p.tok_ids[p.tok_i] == .extended_identifier) and p.tok_ids[p.tok_i + 1] == .colon) { | |
| 4190 | const name_tok = p.expectIdentifier() catch unreachable; | |
| 4191 | const str = p.tokSlice(name_tok); | |
| 4192 | if (p.findLabel(str)) |some| { | |
| 4193 | try p.errStr(.duplicate_label, name_tok, str); | |
| 4194 | try p.errStr(.previous_label, some, str); | |
| 4195 | } else { | |
| 4196 | p.label_count += 1; | |
| 4197 | try p.labels.append(.{ .label = name_tok }); | |
| 4198 | var i: usize = 0; | |
| 4199 | while (i < p.labels.items.len) { | |
| 4200 | if (p.labels.items[i] == .unresolved_goto and | |
| 4201 | mem.eql(u8, p.tokSlice(p.labels.items[i].unresolved_goto), str)) | |
| 4202 | { | |
| 4203 | _ = p.labels.swapRemove(i); | |
| 4204 | } else i += 1; | |
| 4205 | } | |
| 4206 | } | |
| 4207 | ||
| 4208 | p.tok_i += 1; | |
| 4209 | const attr_buf_top = p.attr_buf.len; | |
| 4210 | defer p.attr_buf.len = attr_buf_top; | |
| 4211 | try p.attributeSpecifier(); | |
| 4212 | ||
| 4213 | var labeled_stmt = Tree.Node{ | |
| 4214 | .tag = .labeled_stmt, | |
| 4215 | .data = .{ .decl = .{ .name = name_tok, .node = try p.stmt() } }, | |
| 4216 | }; | |
| 4217 | labeled_stmt.ty = try Attribute.applyLabelAttributes(p, labeled_stmt.ty, attr_buf_top); | |
| 4218 | return try p.addNode(labeled_stmt); | |
| 4219 | } else if (p.eatToken(.keyword_case)) |case| { | |
| 4220 | const first_item = try p.integerConstExpr(.gnu_folding_extension); | |
| 4221 | const ellipsis = p.tok_i; | |
| 4222 | const second_item = if (p.eatToken(.ellipsis) != null) blk: { | |
| 4223 | try p.errTok(.gnu_switch_range, ellipsis); | |
| 4224 | break :blk try p.integerConstExpr(.gnu_folding_extension); | |
| 4225 | } else null; | |
| 4226 | _ = try p.expectToken(.colon); | |
| 4227 | ||
| 4228 | if (p.@"switch") |some| check: { | |
| 4229 | if (some.ty.hasIncompleteSize()) break :check; // error already reported for incomplete size | |
| 4230 | ||
| 4231 | const first = first_item.val; | |
| 4232 | const last = if (second_item) |second| second.val else first; | |
| 4233 | if (first.tag == .unavailable) { | |
| 4234 | try p.errTok(.case_val_unavailable, case + 1); | |
| 4235 | break :check; | |
| 4236 | } else if (last.tag == .unavailable) { | |
| 4237 | try p.errTok(.case_val_unavailable, ellipsis + 1); | |
| 4238 | break :check; | |
| 4239 | } else if (last.compare(.lt, first, some.ty, p.comp)) { | |
| 4240 | try p.errTok(.empty_case_range, case + 1); | |
| 4241 | break :check; | |
| 4242 | } | |
| 4243 | ||
| 4244 | // TODO cast to target type | |
| 4245 | const prev = (try some.add(p.comp, first, last, case + 1)) orelse break :check; | |
| 4246 | ||
| 4247 | // TODO check which value was already handled | |
| 4248 | if (some.ty.isUnsignedInt(p.comp)) { | |
| 4249 | try p.errExtra(.duplicate_switch_case_unsigned, case + 1, .{ | |
| 4250 | .unsigned = first.data.int, | |
| 4251 | }); | |
| 4252 | } else { | |
| 4253 | try p.errExtra(.duplicate_switch_case_signed, case + 1, .{ | |
| 4254 | .signed = first.signExtend(some.ty, p.comp), | |
| 4255 | }); | |
| 4256 | } | |
| 4257 | try p.errTok(.previous_case, prev.tok); | |
| 4258 | } else { | |
| 4259 | try p.errStr(.case_not_in_switch, case, "case"); | |
| 4260 | } | |
| 4261 | ||
| 4262 | const s = try p.stmt(); | |
| 4263 | if (second_item) |some| return try p.addNode(.{ | |
| 4264 | .tag = .case_range_stmt, | |
| 4265 | .data = .{ .if3 = .{ .cond = s, .body = (try p.addList(&.{ first_item.node, some.node })).start } }, | |
| 4266 | }) else return try p.addNode(.{ | |
| 4267 | .tag = .case_stmt, | |
| 4268 | .data = .{ .bin = .{ .lhs = first_item.node, .rhs = s } }, | |
| 4269 | }); | |
| 4270 | } else if (p.eatToken(.keyword_default)) |default| { | |
| 4271 | _ = try p.expectToken(.colon); | |
| 4272 | const s = try p.stmt(); | |
| 4273 | const node = try p.addNode(.{ | |
| 4274 | .tag = .default_stmt, | |
| 4275 | .data = .{ .un = s }, | |
| 4276 | }); | |
| 4277 | const @"switch" = p.@"switch" orelse { | |
| 4278 | try p.errStr(.case_not_in_switch, default, "default"); | |
| 4279 | return node; | |
| 4280 | }; | |
| 4281 | if (@"switch".default) |previous| { | |
| 4282 | try p.errTok(.multiple_default, default); | |
| 4283 | try p.errTok(.previous_case, previous); | |
| 4284 | } else { | |
| 4285 | @"switch".default = default; | |
| 4286 | } | |
| 4287 | return node; | |
| 4288 | } else return null; | |
| 4289 | } | |
| 4290 | ||
| 4291 | const StmtExprState = struct { | |
| 4292 | last_expr_tok: TokenIndex = 0, | |
| 4293 | last_expr_res: Result = .{ .ty = .{ .specifier = .void } }, | |
| 4294 | }; | |
| 4295 | ||
| 4296 | /// compoundStmt : '{' ( decl | keyword_extension decl | staticAssert | stmt)* '}' | |
| 4297 | fn compoundStmt(p: *Parser, is_fn_body: bool, stmt_expr_state: ?*StmtExprState) Error!?NodeIndex { | |
| 4298 | const l_brace = p.eatToken(.l_brace) orelse return null; | |
| 4299 | ||
| 4300 | const decl_buf_top = p.decl_buf.items.len; | |
| 4301 | defer p.decl_buf.items.len = decl_buf_top; | |
| 4302 | ||
| 4303 | // the parameters of a function are in the same scope as the body | |
| 4304 | if (!is_fn_body) try p.syms.pushScope(p); | |
| 4305 | defer if (!is_fn_body) p.syms.popScope(); | |
| 4306 | ||
| 4307 | var noreturn_index: ?TokenIndex = null; | |
| 4308 | var noreturn_label_count: u32 = 0; | |
| 4309 | ||
| 4310 | while (p.eatToken(.r_brace) == null) : (_ = try p.pragma()) { | |
| 4311 | if (stmt_expr_state) |state| state.* = .{}; | |
| 4312 | if (try p.parseOrNextStmt(staticAssert, l_brace)) continue; | |
| 4313 | if (try p.parseOrNextStmt(decl, l_brace)) continue; | |
| 4314 | if (p.eatToken(.keyword_extension)) |ext| { | |
| 4315 | const saved_extension = p.extension_suppressed; | |
| 4316 | defer p.extension_suppressed = saved_extension; | |
| 4317 | p.extension_suppressed = true; | |
| 4318 | ||
| 4319 | if (try p.parseOrNextStmt(decl, l_brace)) continue; | |
| 4320 | p.tok_i = ext; | |
| 4321 | } | |
| 4322 | const stmt_tok = p.tok_i; | |
| 4323 | const s = p.stmt() catch |er| switch (er) { | |
| 4324 | error.ParsingFailed => { | |
| 4325 | try p.nextStmt(l_brace); | |
| 4326 | continue; | |
| 4327 | }, | |
| 4328 | else => |e| return e, | |
| 4329 | }; | |
| 4330 | if (s == .none) continue; | |
| 4331 | if (stmt_expr_state) |state| { | |
| 4332 | state.* = .{ | |
| 4333 | .last_expr_tok = stmt_tok, | |
| 4334 | .last_expr_res = .{ | |
| 4335 | .node = s, | |
| 4336 | .ty = p.nodes.items(.ty)[@intFromEnum(s)], | |
| 4337 | }, | |
| 4338 | }; | |
| 4339 | } | |
| 4340 | try p.decl_buf.append(s); | |
| 4341 | ||
| 4342 | if (noreturn_index == null and p.nodeIsNoreturn(s) == .yes) { | |
| 4343 | noreturn_index = p.tok_i; | |
| 4344 | noreturn_label_count = p.label_count; | |
| 4345 | } | |
| 4346 | switch (p.nodes.items(.tag)[@intFromEnum(s)]) { | |
| 4347 | .case_stmt, .default_stmt, .labeled_stmt => noreturn_index = null, | |
| 4348 | else => {}, | |
| 4349 | } | |
| 4350 | } | |
| 4351 | ||
| 4352 | if (noreturn_index) |some| { | |
| 4353 | // if new labels were defined we cannot be certain that the code is unreachable | |
| 4354 | if (some != p.tok_i - 1 and noreturn_label_count == p.label_count) try p.errTok(.unreachable_code, some); | |
| 4355 | } | |
| 4356 | if (is_fn_body) { | |
| 4357 | const last_noreturn = if (p.decl_buf.items.len == decl_buf_top) | |
| 4358 | .no | |
| 4359 | else | |
| 4360 | p.nodeIsNoreturn(p.decl_buf.items[p.decl_buf.items.len - 1]); | |
| 4361 | ||
| 4362 | if (last_noreturn != .yes) { | |
| 4363 | const ret_ty = p.func.ty.?.returnType(); | |
| 4364 | var return_zero = false; | |
| 4365 | if (last_noreturn == .no and !ret_ty.is(.void) and !ret_ty.isFunc() and !ret_ty.isArray()) { | |
| 4366 | const func_name = p.tokSlice(p.func.name); | |
| 4367 | const interned_name = try p.comp.intern(func_name); | |
| 4368 | if (interned_name == p.string_ids.main_id and ret_ty.is(.int)) { | |
| 4369 | return_zero = true; | |
| 4370 | } else { | |
| 4371 | try p.errStr(.func_does_not_return, p.tok_i - 1, func_name); | |
| 4372 | } | |
| 4373 | } | |
| 4374 | try p.decl_buf.append(try p.addNode(.{ .tag = .implicit_return, .ty = p.func.ty.?.returnType(), .data = .{ .return_zero = return_zero } })); | |
| 4375 | } | |
| 4376 | if (p.func.ident) |some| try p.decl_buf.insert(decl_buf_top, some.node); | |
| 4377 | if (p.func.pretty_ident) |some| try p.decl_buf.insert(decl_buf_top, some.node); | |
| 4378 | } | |
| 4379 | ||
| 4380 | var node: Tree.Node = .{ | |
| 4381 | .tag = .compound_stmt_two, | |
| 4382 | .data = .{ .bin = .{ .lhs = .none, .rhs = .none } }, | |
| 4383 | }; | |
| 4384 | const statements = p.decl_buf.items[decl_buf_top..]; | |
| 4385 | switch (statements.len) { | |
| 4386 | 0 => {}, | |
| 4387 | 1 => node.data = .{ .bin = .{ .lhs = statements[0], .rhs = .none } }, | |
| 4388 | 2 => node.data = .{ .bin = .{ .lhs = statements[0], .rhs = statements[1] } }, | |
| 4389 | else => { | |
| 4390 | node.tag = .compound_stmt; | |
| 4391 | node.data = .{ .range = try p.addList(statements) }; | |
| 4392 | }, | |
| 4393 | } | |
| 4394 | return try p.addNode(node); | |
| 4395 | } | |
| 4396 | ||
| 4397 | const NoreturnKind = enum { no, yes, complex }; | |
| 4398 | ||
| 4399 | fn nodeIsNoreturn(p: *Parser, node: NodeIndex) NoreturnKind { | |
| 4400 | switch (p.nodes.items(.tag)[@intFromEnum(node)]) { | |
| 4401 | .break_stmt, .continue_stmt, .return_stmt => return .yes, | |
| 4402 | .if_then_else_stmt => { | |
| 4403 | const data = p.data.items[p.nodes.items(.data)[@intFromEnum(node)].if3.body..]; | |
| 4404 | const then_type = p.nodeIsNoreturn(data[0]); | |
| 4405 | const else_type = p.nodeIsNoreturn(data[1]); | |
| 4406 | if (then_type == .complex or else_type == .complex) return .complex; | |
| 4407 | if (then_type == .yes and else_type == .yes) return .yes; | |
| 4408 | return .no; | |
| 4409 | }, | |
| 4410 | .compound_stmt_two => { | |
| 4411 | const data = p.nodes.items(.data)[@intFromEnum(node)]; | |
| 4412 | if (data.bin.rhs != .none) return p.nodeIsNoreturn(data.bin.rhs); | |
| 4413 | if (data.bin.lhs != .none) return p.nodeIsNoreturn(data.bin.lhs); | |
| 4414 | return .no; | |
| 4415 | }, | |
| 4416 | .compound_stmt => { | |
| 4417 | const data = p.nodes.items(.data)[@intFromEnum(node)]; | |
| 4418 | return p.nodeIsNoreturn(p.data.items[data.range.end - 1]); | |
| 4419 | }, | |
| 4420 | .labeled_stmt => { | |
| 4421 | const data = p.nodes.items(.data)[@intFromEnum(node)]; | |
| 4422 | return p.nodeIsNoreturn(data.decl.node); | |
| 4423 | }, | |
| 4424 | .switch_stmt => { | |
| 4425 | const data = p.nodes.items(.data)[@intFromEnum(node)]; | |
| 4426 | if (data.bin.rhs == .none) return .complex; | |
| 4427 | if (p.nodeIsNoreturn(data.bin.rhs) == .yes) return .yes; | |
| 4428 | return .complex; | |
| 4429 | }, | |
| 4430 | else => return .no, | |
| 4431 | } | |
| 4432 | } | |
| 4433 | ||
| 4434 | fn parseOrNextStmt(p: *Parser, comptime func: fn (*Parser) Error!bool, l_brace: TokenIndex) !bool { | |
| 4435 | return func(p) catch |er| switch (er) { | |
| 4436 | error.ParsingFailed => { | |
| 4437 | try p.nextStmt(l_brace); | |
| 4438 | return true; | |
| 4439 | }, | |
| 4440 | else => |e| return e, | |
| 4441 | }; | |
| 4442 | } | |
| 4443 | ||
| 4444 | fn nextStmt(p: *Parser, l_brace: TokenIndex) !void { | |
| 4445 | var parens: u32 = 0; | |
| 4446 | while (p.tok_i < p.tok_ids.len) : (p.tok_i += 1) { | |
| 4447 | switch (p.tok_ids[p.tok_i]) { | |
| 4448 | .l_paren, .l_brace, .l_bracket => parens += 1, | |
| 4449 | .r_paren, .r_bracket => if (parens != 0) { | |
| 4450 | parens -= 1; | |
| 4451 | }, | |
| 4452 | .r_brace => if (parens == 0) | |
| 4453 | return | |
| 4454 | else { | |
| 4455 | parens -= 1; | |
| 4456 | }, | |
| 4457 | .semicolon, | |
| 4458 | .keyword_for, | |
| 4459 | .keyword_while, | |
| 4460 | .keyword_do, | |
| 4461 | .keyword_if, | |
| 4462 | .keyword_goto, | |
| 4463 | .keyword_switch, | |
| 4464 | .keyword_case, | |
| 4465 | .keyword_default, | |
| 4466 | .keyword_continue, | |
| 4467 | .keyword_break, | |
| 4468 | .keyword_return, | |
| 4469 | .keyword_typedef, | |
| 4470 | .keyword_extern, | |
| 4471 | .keyword_static, | |
| 4472 | .keyword_auto, | |
| 4473 | .keyword_register, | |
| 4474 | .keyword_thread_local, | |
| 4475 | .keyword_c23_thread_local, | |
| 4476 | .keyword_inline, | |
| 4477 | .keyword_inline1, | |
| 4478 | .keyword_inline2, | |
| 4479 | .keyword_noreturn, | |
| 4480 | .keyword_void, | |
| 4481 | .keyword_bool, | |
| 4482 | .keyword_c23_bool, | |
| 4483 | .keyword_char, | |
| 4484 | .keyword_short, | |
| 4485 | .keyword_int, | |
| 4486 | .keyword_long, | |
| 4487 | .keyword_signed, | |
| 4488 | .keyword_unsigned, | |
| 4489 | .keyword_float, | |
| 4490 | .keyword_double, | |
| 4491 | .keyword_complex, | |
| 4492 | .keyword_atomic, | |
| 4493 | .keyword_enum, | |
| 4494 | .keyword_struct, | |
| 4495 | .keyword_union, | |
| 4496 | .keyword_alignas, | |
| 4497 | .keyword_c23_alignas, | |
| 4498 | .keyword_typeof, | |
| 4499 | .keyword_typeof1, | |
| 4500 | .keyword_typeof2, | |
| 4501 | .keyword_extension, | |
| 4502 | => if (parens == 0) return, | |
| 4503 | .keyword_pragma => p.skipToPragmaSentinel(), | |
| 4504 | else => {}, | |
| 4505 | } | |
| 4506 | } | |
| 4507 | p.tok_i -= 1; // So we can consume EOF | |
| 4508 | try p.expectClosing(l_brace, .r_brace); | |
| 4509 | unreachable; | |
| 4510 | } | |
| 4511 | ||
| 4512 | fn returnStmt(p: *Parser) Error!?NodeIndex { | |
| 4513 | const ret_tok = p.eatToken(.keyword_return) orelse return null; | |
| 4514 | ||
| 4515 | const e_tok = p.tok_i; | |
| 4516 | var e = try p.expr(); | |
| 4517 | _ = try p.expectToken(.semicolon); | |
| 4518 | const ret_ty = p.func.ty.?.returnType(); | |
| 4519 | ||
| 4520 | if (p.func.ty.?.hasAttribute(.noreturn)) { | |
| 4521 | try p.errStr(.invalid_noreturn, e_tok, p.tokSlice(p.func.name)); | |
| 4522 | } | |
| 4523 | ||
| 4524 | if (e.node == .none) { | |
| 4525 | if (!ret_ty.is(.void)) try p.errStr(.func_should_return, ret_tok, p.tokSlice(p.func.name)); | |
| 4526 | return try p.addNode(.{ .tag = .return_stmt, .data = .{ .un = e.node } }); | |
| 4527 | } else if (ret_ty.is(.void)) { | |
| 4528 | try p.errStr(.void_func_returns_value, e_tok, p.tokSlice(p.func.name)); | |
| 4529 | return try p.addNode(.{ .tag = .return_stmt, .data = .{ .un = e.node } }); | |
| 4530 | } | |
| 4531 | ||
| 4532 | try e.lvalConversion(p); | |
| 4533 | try e.coerce(p, ret_ty, e_tok, .ret); | |
| 4534 | ||
| 4535 | try e.saveValue(p); | |
| 4536 | return try p.addNode(.{ .tag = .return_stmt, .data = .{ .un = e.node } }); | |
| 4537 | } | |
| 4538 | ||
| 4539 | // ====== expressions ====== | |
| 4540 | ||
| 4541 | pub fn macroExpr(p: *Parser) Compilation.Error!bool { | |
| 4542 | const res = p.condExpr() catch |e| switch (e) { | |
| 4543 | error.OutOfMemory => return error.OutOfMemory, | |
| 4544 | error.FatalError => return error.FatalError, | |
| 4545 | error.ParsingFailed => return false, | |
| 4546 | }; | |
| 4547 | if (res.val.tag == .unavailable) { | |
| 4548 | try p.errTok(.expected_expr, p.tok_i); | |
| 4549 | return false; | |
| 4550 | } | |
| 4551 | return res.val.getBool(); | |
| 4552 | } | |
| 4553 | ||
| 4554 | const CallExpr = union(enum) { | |
| 4555 | standard: NodeIndex, | |
| 4556 | builtin: struct { | |
| 4557 | node: NodeIndex, | |
| 4558 | tag: BuiltinFunction.Tag, | |
| 4559 | }, | |
| 4560 | ||
| 4561 | fn init(p: *Parser, call_node: NodeIndex, func_node: NodeIndex) CallExpr { | |
| 4562 | if (p.getNode(call_node, .builtin_call_expr_one)) |node| { | |
| 4563 | const data = p.nodes.items(.data)[@intFromEnum(node)]; | |
| 4564 | const name = p.tokSlice(data.decl.name); | |
| 4565 | const builtin_ty = p.comp.builtins.lookup(name); | |
| 4566 | return .{ .builtin = .{ .node = node, .tag = builtin_ty.builtin.tag } }; | |
| 4567 | } | |
| 4568 | return .{ .standard = func_node }; | |
| 4569 | } | |
| 4570 | ||
| 4571 | fn shouldPerformLvalConversion(self: CallExpr, arg_idx: u32) bool { | |
| 4572 | return switch (self) { | |
| 4573 | .standard => true, | |
| 4574 | .builtin => |builtin| switch (builtin.tag) { | |
| 4575 | .__builtin_va_start, .__va_start, .va_start => arg_idx != 1, | |
| 4576 | else => true, | |
| 4577 | }, | |
| 4578 | }; | |
| 4579 | } | |
| 4580 | ||
| 4581 | fn shouldPromoteVarArg(self: CallExpr, arg_idx: u32) bool { | |
| 4582 | return switch (self) { | |
| 4583 | .standard => true, | |
| 4584 | .builtin => |builtin| switch (builtin.tag) { | |
| 4585 | .__builtin_va_start, .__va_start, .va_start => arg_idx != 1, | |
| 4586 | .__builtin_complex => false, | |
| 4587 | else => true, | |
| 4588 | }, | |
| 4589 | }; | |
| 4590 | } | |
| 4591 | ||
| 4592 | fn shouldCoerceArg(self: CallExpr, arg_idx: u32) bool { | |
| 4593 | _ = self; | |
| 4594 | _ = arg_idx; | |
| 4595 | return true; | |
| 4596 | } | |
| 4597 | ||
| 4598 | fn checkVarArg(self: CallExpr, p: *Parser, first_after: TokenIndex, param_tok: TokenIndex, arg: *Result, arg_idx: u32) !void { | |
| 4599 | if (self == .standard) return; | |
| 4600 | ||
| 4601 | const builtin_tok = p.nodes.items(.data)[@intFromEnum(self.builtin.node)].decl.name; | |
| 4602 | switch (self.builtin.tag) { | |
| 4603 | .__builtin_va_start, .__va_start, .va_start => return p.checkVaStartArg(builtin_tok, first_after, param_tok, arg, arg_idx), | |
| 4604 | .__builtin_complex => return p.checkComplexArg(builtin_tok, first_after, param_tok, arg, arg_idx), | |
| 4605 | else => {}, | |
| 4606 | } | |
| 4607 | } | |
| 4608 | ||
| 4609 | /// Some functions cannot be expressed as standard C prototypes. For example `__builtin_complex` requires | |
| 4610 | /// two arguments of the same real floating point type (e.g. two doubles or two floats). These functions are | |
| 4611 | /// encoded as varargs functions with custom typechecking. Since varargs functions do not have a fixed number | |
| 4612 | /// of arguments, `paramCountOverride` is used to tell us how many arguments we should actually expect to see for | |
| 4613 | /// these custom-typechecked functions. | |
| 4614 | fn paramCountOverride(self: CallExpr) ?u32 { | |
| 4615 | return switch (self) { | |
| 4616 | .standard => null, | |
| 4617 | .builtin => |builtin| switch (builtin.tag) { | |
| 4618 | .__builtin_complex => 2, | |
| 4619 | else => null, | |
| 4620 | }, | |
| 4621 | }; | |
| 4622 | } | |
| 4623 | ||
| 4624 | fn returnType(self: CallExpr, p: *Parser, callable_ty: Type) Type { | |
| 4625 | return switch (self) { | |
| 4626 | .standard => callable_ty.returnType(), | |
| 4627 | .builtin => |builtin| switch (builtin.tag) { | |
| 4628 | .__builtin_complex => { | |
| 4629 | const last_param = p.list_buf.items[p.list_buf.items.len - 1]; | |
| 4630 | return p.nodes.items(.ty)[@intFromEnum(last_param)].makeComplex(); | |
| 4631 | }, | |
| 4632 | else => callable_ty.returnType(), | |
| 4633 | }, | |
| 4634 | }; | |
| 4635 | } | |
| 4636 | ||
| 4637 | fn finish(self: CallExpr, p: *Parser, ty: Type, list_buf_top: usize, arg_count: u32) Error!Result { | |
| 4638 | const ret_ty = self.returnType(p, ty); | |
| 4639 | switch (self) { | |
| 4640 | .standard => |func_node| { | |
| 4641 | var call_node: Tree.Node = .{ | |
| 4642 | .tag = .call_expr_one, | |
| 4643 | .ty = ret_ty, | |
| 4644 | .data = .{ .bin = .{ .lhs = func_node, .rhs = .none } }, | |
| 4645 | }; | |
| 4646 | const args = p.list_buf.items[list_buf_top..]; | |
| 4647 | switch (arg_count) { | |
| 4648 | 0 => {}, | |
| 4649 | 1 => call_node.data.bin.rhs = args[1], // args[0] == func.node | |
| 4650 | else => { | |
| 4651 | call_node.tag = .call_expr; | |
| 4652 | call_node.data = .{ .range = try p.addList(args) }; | |
| 4653 | }, | |
| 4654 | } | |
| 4655 | return Result{ .node = try p.addNode(call_node), .ty = ret_ty }; | |
| 4656 | }, | |
| 4657 | .builtin => |builtin| { | |
| 4658 | const index = @intFromEnum(builtin.node); | |
| 4659 | var call_node = p.nodes.get(index); | |
| 4660 | defer p.nodes.set(index, call_node); | |
| 4661 | call_node.ty = ret_ty; | |
| 4662 | const args = p.list_buf.items[list_buf_top..]; | |
| 4663 | switch (arg_count) { | |
| 4664 | 0 => {}, | |
| 4665 | 1 => call_node.data.decl.node = args[1], // args[0] == func.node | |
| 4666 | else => { | |
| 4667 | call_node.tag = .builtin_call_expr; | |
| 4668 | args[0] = @enumFromInt(call_node.data.decl.name); | |
| 4669 | call_node.data = .{ .range = try p.addList(args) }; | |
| 4670 | }, | |
| 4671 | } | |
| 4672 | return Result{ .node = builtin.node, .ty = ret_ty }; | |
| 4673 | }, | |
| 4674 | } | |
| 4675 | } | |
| 4676 | }; | |
| 4677 | ||
| 4678 | const Result = struct { | |
| 4679 | node: NodeIndex = .none, | |
| 4680 | ty: Type = .{ .specifier = .int }, | |
| 4681 | val: Value = .{}, | |
| 4682 | ||
| 4683 | fn expect(res: Result, p: *Parser) Error!void { | |
| 4684 | if (p.in_macro) { | |
| 4685 | if (res.val.tag == .unavailable) { | |
| 4686 | try p.errTok(.expected_expr, p.tok_i); | |
| 4687 | return error.ParsingFailed; | |
| 4688 | } | |
| 4689 | return; | |
| 4690 | } | |
| 4691 | if (res.node == .none) { | |
| 4692 | try p.errTok(.expected_expr, p.tok_i); | |
| 4693 | return error.ParsingFailed; | |
| 4694 | } | |
| 4695 | } | |
| 4696 | ||
| 4697 | fn empty(res: Result, p: *Parser) bool { | |
| 4698 | if (p.in_macro) return res.val.tag == .unavailable; | |
| 4699 | return res.node == .none; | |
| 4700 | } | |
| 4701 | ||
| 4702 | fn maybeWarnUnused(res: Result, p: *Parser, expr_start: TokenIndex, err_start: usize) Error!void { | |
| 4703 | if (res.ty.is(.void) or res.node == .none) return; | |
| 4704 | // don't warn about unused result if the expression contained errors besides other unused results | |
| 4705 | for (p.comp.diag.list.items[err_start..]) |err_item| { | |
| 4706 | if (err_item.tag != .unused_value) return; | |
| 4707 | } | |
| 4708 | var cur_node = res.node; | |
| 4709 | while (true) switch (p.nodes.items(.tag)[@intFromEnum(cur_node)]) { | |
| 4710 | .invalid, // So that we don't need to check for node == 0 | |
| 4711 | .assign_expr, | |
| 4712 | .mul_assign_expr, | |
| 4713 | .div_assign_expr, | |
| 4714 | .mod_assign_expr, | |
| 4715 | .add_assign_expr, | |
| 4716 | .sub_assign_expr, | |
| 4717 | .shl_assign_expr, | |
| 4718 | .shr_assign_expr, | |
| 4719 | .bit_and_assign_expr, | |
| 4720 | .bit_xor_assign_expr, | |
| 4721 | .bit_or_assign_expr, | |
| 4722 | .pre_inc_expr, | |
| 4723 | .pre_dec_expr, | |
| 4724 | .post_inc_expr, | |
| 4725 | .post_dec_expr, | |
| 4726 | => return, | |
| 4727 | .call_expr_one => { | |
| 4728 | const fn_ptr = p.nodes.items(.data)[@intFromEnum(cur_node)].bin.lhs; | |
| 4729 | const fn_ty = p.nodes.items(.ty)[@intFromEnum(fn_ptr)].elemType(); | |
| 4730 | if (fn_ty.hasAttribute(.nodiscard)) try p.errStr(.nodiscard_unused, expr_start, "TODO get name"); | |
| 4731 | if (fn_ty.hasAttribute(.warn_unused_result)) try p.errStr(.warn_unused_result, expr_start, "TODO get name"); | |
| 4732 | return; | |
| 4733 | }, | |
| 4734 | .call_expr => { | |
| 4735 | const fn_ptr = p.data.items[p.nodes.items(.data)[@intFromEnum(cur_node)].range.start]; | |
| 4736 | const fn_ty = p.nodes.items(.ty)[@intFromEnum(fn_ptr)].elemType(); | |
| 4737 | if (fn_ty.hasAttribute(.nodiscard)) try p.errStr(.nodiscard_unused, expr_start, "TODO get name"); | |
| 4738 | if (fn_ty.hasAttribute(.warn_unused_result)) try p.errStr(.warn_unused_result, expr_start, "TODO get name"); | |
| 4739 | return; | |
| 4740 | }, | |
| 4741 | .stmt_expr => { | |
| 4742 | const body = p.nodes.items(.data)[@intFromEnum(cur_node)].un; | |
| 4743 | switch (p.nodes.items(.tag)[@intFromEnum(body)]) { | |
| 4744 | .compound_stmt_two => { | |
| 4745 | const body_stmt = p.nodes.items(.data)[@intFromEnum(body)].bin; | |
| 4746 | cur_node = if (body_stmt.rhs != .none) body_stmt.rhs else body_stmt.lhs; | |
| 4747 | }, | |
| 4748 | .compound_stmt => { | |
| 4749 | const data = p.nodes.items(.data)[@intFromEnum(body)]; | |
| 4750 | cur_node = p.data.items[data.range.end - 1]; | |
| 4751 | }, | |
| 4752 | else => unreachable, | |
| 4753 | } | |
| 4754 | }, | |
| 4755 | .comma_expr => cur_node = p.nodes.items(.data)[@intFromEnum(cur_node)].bin.rhs, | |
| 4756 | .paren_expr => cur_node = p.nodes.items(.data)[@intFromEnum(cur_node)].un, | |
| 4757 | else => break, | |
| 4758 | }; | |
| 4759 | try p.errTok(.unused_value, expr_start); | |
| 4760 | } | |
| 4761 | ||
| 4762 | fn boolRes(lhs: *Result, p: *Parser, tag: Tree.Tag, rhs: Result) !void { | |
| 4763 | if (lhs.val.tag == .nullptr_t) { | |
| 4764 | lhs.val = Value.int(0); | |
| 4765 | } | |
| 4766 | if (lhs.ty.specifier != .invalid) { | |
| 4767 | lhs.ty = Type.int; | |
| 4768 | } | |
| 4769 | return lhs.bin(p, tag, rhs); | |
| 4770 | } | |
| 4771 | ||
| 4772 | fn bin(lhs: *Result, p: *Parser, tag: Tree.Tag, rhs: Result) !void { | |
| 4773 | lhs.node = try p.addNode(.{ | |
| 4774 | .tag = tag, | |
| 4775 | .ty = lhs.ty, | |
| 4776 | .data = .{ .bin = .{ .lhs = lhs.node, .rhs = rhs.node } }, | |
| 4777 | }); | |
| 4778 | } | |
| 4779 | ||
| 4780 | fn un(operand: *Result, p: *Parser, tag: Tree.Tag) Error!void { | |
| 4781 | operand.node = try p.addNode(.{ | |
| 4782 | .tag = tag, | |
| 4783 | .ty = operand.ty, | |
| 4784 | .data = .{ .un = operand.node }, | |
| 4785 | }); | |
| 4786 | } | |
| 4787 | ||
| 4788 | fn implicitCast(operand: *Result, p: *Parser, kind: Tree.CastKind) Error!void { | |
| 4789 | operand.node = try p.addNode(.{ | |
| 4790 | .tag = .implicit_cast, | |
| 4791 | .ty = operand.ty, | |
| 4792 | .data = .{ .cast = .{ .operand = operand.node, .kind = kind } }, | |
| 4793 | }); | |
| 4794 | } | |
| 4795 | ||
| 4796 | fn adjustCondExprPtrs(a: *Result, tok: TokenIndex, b: *Result, p: *Parser) !bool { | |
| 4797 | assert(a.ty.isPtr() and b.ty.isPtr()); | |
| 4798 | ||
| 4799 | const a_elem = a.ty.elemType(); | |
| 4800 | const b_elem = b.ty.elemType(); | |
| 4801 | if (a_elem.eql(b_elem, p.comp, true)) return true; | |
| 4802 | ||
| 4803 | var adjusted_elem_ty = try p.arena.create(Type); | |
| 4804 | adjusted_elem_ty.* = a_elem; | |
| 4805 | ||
| 4806 | const has_void_star_branch = a.ty.isVoidStar() or b.ty.isVoidStar(); | |
| 4807 | const only_quals_differ = a_elem.eql(b_elem, p.comp, false); | |
| 4808 | const pointers_compatible = only_quals_differ or has_void_star_branch; | |
| 4809 | ||
| 4810 | if (!pointers_compatible or has_void_star_branch) { | |
| 4811 | if (!pointers_compatible) { | |
| 4812 | try p.errStr(.pointer_mismatch, tok, try p.typePairStrExtra(a.ty, " and ", b.ty)); | |
| 4813 | } | |
| 4814 | adjusted_elem_ty.* = .{ .specifier = .void }; | |
| 4815 | } | |
| 4816 | if (pointers_compatible) { | |
| 4817 | adjusted_elem_ty.qual = a_elem.qual.mergeCV(b_elem.qual); | |
| 4818 | } | |
| 4819 | if (!adjusted_elem_ty.eql(a_elem, p.comp, true)) { | |
| 4820 | a.ty = .{ | |
| 4821 | .data = .{ .sub_type = adjusted_elem_ty }, | |
| 4822 | .specifier = .pointer, | |
| 4823 | }; | |
| 4824 | try a.implicitCast(p, .bitcast); | |
| 4825 | } | |
| 4826 | if (!adjusted_elem_ty.eql(b_elem, p.comp, true)) { | |
| 4827 | b.ty = .{ | |
| 4828 | .data = .{ .sub_type = adjusted_elem_ty }, | |
| 4829 | .specifier = .pointer, | |
| 4830 | }; | |
| 4831 | try b.implicitCast(p, .bitcast); | |
| 4832 | } | |
| 4833 | return true; | |
| 4834 | } | |
| 4835 | ||
| 4836 | /// Adjust types for binary operation, returns true if the result can and should be evaluated. | |
| 4837 | fn adjustTypes(a: *Result, tok: TokenIndex, b: *Result, p: *Parser, kind: enum { | |
| 4838 | integer, | |
| 4839 | arithmetic, | |
| 4840 | boolean_logic, | |
| 4841 | relational, | |
| 4842 | equality, | |
| 4843 | conditional, | |
| 4844 | add, | |
| 4845 | sub, | |
| 4846 | }) !bool { | |
| 4847 | if (b.ty.specifier == .invalid) { | |
| 4848 | try a.saveValue(p); | |
| 4849 | a.ty = Type.invalid; | |
| 4850 | } | |
| 4851 | if (a.ty.specifier == .invalid) { | |
| 4852 | return false; | |
| 4853 | } | |
| 4854 | try a.lvalConversion(p); | |
| 4855 | try b.lvalConversion(p); | |
| 4856 | ||
| 4857 | const a_vec = a.ty.is(.vector); | |
| 4858 | const b_vec = b.ty.is(.vector); | |
| 4859 | if (a_vec and b_vec) { | |
| 4860 | if (a.ty.eql(b.ty, p.comp, false)) { | |
| 4861 | return a.shouldEval(b, p); | |
| 4862 | } | |
| 4863 | return a.invalidBinTy(tok, b, p); | |
| 4864 | } else if (a_vec) { | |
| 4865 | if (b.coerceExtra(p, a.ty.elemType(), tok, .test_coerce)) { | |
| 4866 | try b.saveValue(p); | |
| 4867 | try b.implicitCast(p, .vector_splat); | |
| 4868 | return a.shouldEval(b, p); | |
| 4869 | } else |er| switch (er) { | |
| 4870 | error.CoercionFailed => return a.invalidBinTy(tok, b, p), | |
| 4871 | else => |e| return e, | |
| 4872 | } | |
| 4873 | } else if (b_vec) { | |
| 4874 | if (a.coerceExtra(p, b.ty.elemType(), tok, .test_coerce)) { | |
| 4875 | try a.saveValue(p); | |
| 4876 | try a.implicitCast(p, .vector_splat); | |
| 4877 | return a.shouldEval(b, p); | |
| 4878 | } else |er| switch (er) { | |
| 4879 | error.CoercionFailed => return a.invalidBinTy(tok, b, p), | |
| 4880 | else => |e| return e, | |
| 4881 | } | |
| 4882 | } | |
| 4883 | ||
| 4884 | const a_int = a.ty.isInt(); | |
| 4885 | const b_int = b.ty.isInt(); | |
| 4886 | if (a_int and b_int) { | |
| 4887 | try a.usualArithmeticConversion(b, p, tok); | |
| 4888 | return a.shouldEval(b, p); | |
| 4889 | } | |
| 4890 | if (kind == .integer) return a.invalidBinTy(tok, b, p); | |
| 4891 | ||
| 4892 | const a_float = a.ty.isFloat(); | |
| 4893 | const b_float = b.ty.isFloat(); | |
| 4894 | const a_arithmetic = a_int or a_float; | |
| 4895 | const b_arithmetic = b_int or b_float; | |
| 4896 | if (a_arithmetic and b_arithmetic) { | |
| 4897 | // <, <=, >, >= only work on real types | |
| 4898 | if (kind == .relational and (!a.ty.isReal() or !b.ty.isReal())) | |
| 4899 | return a.invalidBinTy(tok, b, p); | |
| 4900 | ||
| 4901 | try a.usualArithmeticConversion(b, p, tok); | |
| 4902 | return a.shouldEval(b, p); | |
| 4903 | } | |
| 4904 | if (kind == .arithmetic) return a.invalidBinTy(tok, b, p); | |
| 4905 | ||
| 4906 | const a_nullptr = a.ty.is(.nullptr_t); | |
| 4907 | const b_nullptr = b.ty.is(.nullptr_t); | |
| 4908 | const a_ptr = a.ty.isPtr(); | |
| 4909 | const b_ptr = b.ty.isPtr(); | |
| 4910 | const a_scalar = a_arithmetic or a_ptr; | |
| 4911 | const b_scalar = b_arithmetic or b_ptr; | |
| 4912 | switch (kind) { | |
| 4913 | .boolean_logic => { | |
| 4914 | if (!(a_scalar or a_nullptr) or !(b_scalar or b_nullptr)) return a.invalidBinTy(tok, b, p); | |
| 4915 | ||
| 4916 | // Do integer promotions but nothing else | |
| 4917 | if (a_int) try a.intCast(p, a.ty.integerPromotion(p.comp), tok); | |
| 4918 | if (b_int) try b.intCast(p, b.ty.integerPromotion(p.comp), tok); | |
| 4919 | return a.shouldEval(b, p); | |
| 4920 | }, | |
| 4921 | .relational, .equality => { | |
| 4922 | if (kind == .equality and (a_nullptr or b_nullptr)) { | |
| 4923 | if (a_nullptr and b_nullptr) return a.shouldEval(b, p); | |
| 4924 | const nullptr_res = if (a_nullptr) a else b; | |
| 4925 | const other_res = if (a_nullptr) b else a; | |
| 4926 | if (other_res.ty.isPtr()) { | |
| 4927 | try nullptr_res.nullCast(p, other_res.ty); | |
| 4928 | return other_res.shouldEval(nullptr_res, p); | |
| 4929 | } else if (other_res.val.isZero()) { | |
| 4930 | other_res.val = .{ .tag = .nullptr_t }; | |
| 4931 | try other_res.nullCast(p, nullptr_res.ty); | |
| 4932 | return other_res.shouldEval(nullptr_res, p); | |
| 4933 | } | |
| 4934 | return a.invalidBinTy(tok, b, p); | |
| 4935 | } | |
| 4936 | // comparisons between floats and pointes not allowed | |
| 4937 | if (!a_scalar or !b_scalar or (a_float and b_ptr) or (b_float and a_ptr)) | |
| 4938 | return a.invalidBinTy(tok, b, p); | |
| 4939 | ||
| 4940 | if ((a_int or b_int) and !(a.val.isZero() or b.val.isZero())) { | |
| 4941 | try p.errStr(.comparison_ptr_int, tok, try p.typePairStr(a.ty, b.ty)); | |
| 4942 | } else if (a_ptr and b_ptr) { | |
| 4943 | if (!a.ty.isVoidStar() and !b.ty.isVoidStar() and !a.ty.eql(b.ty, p.comp, false)) | |
| 4944 | try p.errStr(.comparison_distinct_ptr, tok, try p.typePairStr(a.ty, b.ty)); | |
| 4945 | } else if (a_ptr) { | |
| 4946 | try b.ptrCast(p, a.ty); | |
| 4947 | } else { | |
| 4948 | assert(b_ptr); | |
| 4949 | try a.ptrCast(p, b.ty); | |
| 4950 | } | |
| 4951 | ||
| 4952 | return a.shouldEval(b, p); | |
| 4953 | }, | |
| 4954 | .conditional => { | |
| 4955 | // doesn't matter what we return here, as the result is ignored | |
| 4956 | if (a.ty.is(.void) or b.ty.is(.void)) { | |
| 4957 | try a.toVoid(p); | |
| 4958 | try b.toVoid(p); | |
| 4959 | return true; | |
| 4960 | } | |
| 4961 | if (a_nullptr and b_nullptr) return true; | |
| 4962 | if ((a_ptr and b_int) or (a_int and b_ptr)) { | |
| 4963 | if (a.val.isZero() or b.val.isZero()) { | |
| 4964 | try a.nullCast(p, b.ty); | |
| 4965 | try b.nullCast(p, a.ty); | |
| 4966 | return true; | |
| 4967 | } | |
| 4968 | const int_ty = if (a_int) a else b; | |
| 4969 | const ptr_ty = if (a_ptr) a else b; | |
| 4970 | try p.errStr(.implicit_int_to_ptr, tok, try p.typePairStrExtra(int_ty.ty, " to ", ptr_ty.ty)); | |
| 4971 | try int_ty.ptrCast(p, ptr_ty.ty); | |
| 4972 | ||
| 4973 | return true; | |
| 4974 | } | |
| 4975 | if (a_ptr and b_ptr) return a.adjustCondExprPtrs(tok, b, p); | |
| 4976 | if ((a_ptr and b_nullptr) or (a_nullptr and b_ptr)) { | |
| 4977 | const nullptr_res = if (a_nullptr) a else b; | |
| 4978 | const ptr_res = if (a_nullptr) b else a; | |
| 4979 | try nullptr_res.nullCast(p, ptr_res.ty); | |
| 4980 | return true; | |
| 4981 | } | |
| 4982 | if (a.ty.isRecord() and b.ty.isRecord() and a.ty.eql(b.ty, p.comp, false)) { | |
| 4983 | return true; | |
| 4984 | } | |
| 4985 | return a.invalidBinTy(tok, b, p); | |
| 4986 | }, | |
| 4987 | .add => { | |
| 4988 | // if both aren't arithmetic one should be pointer and the other an integer | |
| 4989 | if (a_ptr == b_ptr or a_int == b_int) return a.invalidBinTy(tok, b, p); | |
| 4990 | ||
| 4991 | // Do integer promotions but nothing else | |
| 4992 | if (a_int) try a.intCast(p, a.ty.integerPromotion(p.comp), tok); | |
| 4993 | if (b_int) try b.intCast(p, b.ty.integerPromotion(p.comp), tok); | |
| 4994 | ||
| 4995 | // The result type is the type of the pointer operand | |
| 4996 | if (a_int) a.ty = b.ty else b.ty = a.ty; | |
| 4997 | return a.shouldEval(b, p); | |
| 4998 | }, | |
| 4999 | .sub => { | |
| 5000 | // if both aren't arithmetic then either both should be pointers or just a | |
| 5001 | if (!a_ptr or !(b_ptr or b_int)) return a.invalidBinTy(tok, b, p); | |
| 5002 | ||
| 5003 | if (a_ptr and b_ptr) { | |
| 5004 | if (!a.ty.eql(b.ty, p.comp, false)) try p.errStr(.incompatible_pointers, tok, try p.typePairStr(a.ty, b.ty)); | |
| 5005 | a.ty = p.comp.types.ptrdiff; | |
| 5006 | } | |
| 5007 | ||
| 5008 | // Do integer promotion on b if needed | |
| 5009 | if (b_int) try b.intCast(p, b.ty.integerPromotion(p.comp), tok); | |
| 5010 | return a.shouldEval(b, p); | |
| 5011 | }, | |
| 5012 | else => return a.invalidBinTy(tok, b, p), | |
| 5013 | } | |
| 5014 | } | |
| 5015 | ||
| 5016 | fn lvalConversion(res: *Result, p: *Parser) Error!void { | |
| 5017 | if (res.ty.isFunc()) { | |
| 5018 | var elem_ty = try p.arena.create(Type); | |
| 5019 | elem_ty.* = res.ty; | |
| 5020 | res.ty.specifier = .pointer; | |
| 5021 | res.ty.data = .{ .sub_type = elem_ty }; | |
| 5022 | try res.implicitCast(p, .function_to_pointer); | |
| 5023 | } else if (res.ty.isArray()) { | |
| 5024 | res.val.tag = .unavailable; | |
| 5025 | res.ty.decayArray(); | |
| 5026 | try res.implicitCast(p, .array_to_pointer); | |
| 5027 | } else if (!p.in_macro and Tree.isLval(p.nodes.slice(), p.data.items, p.value_map, res.node)) { | |
| 5028 | res.ty.qual = .{}; | |
| 5029 | try res.implicitCast(p, .lval_to_rval); | |
| 5030 | } | |
| 5031 | } | |
| 5032 | ||
| 5033 | fn boolCast(res: *Result, p: *Parser, bool_ty: Type, tok: TokenIndex) Error!void { | |
| 5034 | if (res.ty.isArray()) { | |
| 5035 | if (res.val.tag == .bytes) { | |
| 5036 | try p.errStr(.string_literal_to_bool, tok, try p.typePairStrExtra(res.ty, " to ", bool_ty)); | |
| 5037 | } else { | |
| 5038 | try p.errStr(.array_address_to_bool, tok, p.tokSlice(tok)); | |
| 5039 | } | |
| 5040 | try res.lvalConversion(p); | |
| 5041 | res.val = Value.int(1); | |
| 5042 | res.ty = bool_ty; | |
| 5043 | try res.implicitCast(p, .pointer_to_bool); | |
| 5044 | } else if (res.ty.isPtr()) { | |
| 5045 | res.val.toBool(); | |
| 5046 | res.ty = bool_ty; | |
| 5047 | try res.implicitCast(p, .pointer_to_bool); | |
| 5048 | } else if (res.ty.isInt() and !res.ty.is(.bool)) { | |
| 5049 | res.val.toBool(); | |
| 5050 | res.ty = bool_ty; | |
| 5051 | try res.implicitCast(p, .int_to_bool); | |
| 5052 | } else if (res.ty.isFloat()) { | |
| 5053 | const old_value = res.val; | |
| 5054 | const value_change_kind = res.val.floatToInt(res.ty, bool_ty, p.comp); | |
| 5055 | try res.floatToIntWarning(p, bool_ty, old_value, value_change_kind, tok); | |
| 5056 | if (!res.ty.isReal()) { | |
| 5057 | res.ty = res.ty.makeReal(); | |
| 5058 | try res.implicitCast(p, .complex_float_to_real); | |
| 5059 | } | |
| 5060 | res.ty = bool_ty; | |
| 5061 | try res.implicitCast(p, .float_to_bool); | |
| 5062 | } | |
| 5063 | } | |
| 5064 | ||
| 5065 | fn intCast(res: *Result, p: *Parser, int_ty: Type, tok: TokenIndex) Error!void { | |
| 5066 | if (int_ty.hasIncompleteSize()) return error.ParsingFailed; // Diagnostic already issued | |
| 5067 | if (res.ty.is(.bool)) { | |
| 5068 | res.ty = int_ty.makeReal(); | |
| 5069 | try res.implicitCast(p, .bool_to_int); | |
| 5070 | if (!int_ty.isReal()) { | |
| 5071 | res.ty = int_ty; | |
| 5072 | try res.implicitCast(p, .real_to_complex_int); | |
| 5073 | } | |
| 5074 | } else if (res.ty.isPtr()) { | |
| 5075 | res.ty = int_ty.makeReal(); | |
| 5076 | try res.implicitCast(p, .pointer_to_int); | |
| 5077 | if (!int_ty.isReal()) { | |
| 5078 | res.ty = int_ty; | |
| 5079 | try res.implicitCast(p, .real_to_complex_int); | |
| 5080 | } | |
| 5081 | } else if (res.ty.isFloat()) { | |
| 5082 | const old_value = res.val; | |
| 5083 | const value_change_kind = res.val.floatToInt(res.ty, int_ty, p.comp); | |
| 5084 | try res.floatToIntWarning(p, int_ty, old_value, value_change_kind, tok); | |
| 5085 | const old_real = res.ty.isReal(); | |
| 5086 | const new_real = int_ty.isReal(); | |
| 5087 | if (old_real and new_real) { | |
| 5088 | res.ty = int_ty; | |
| 5089 | try res.implicitCast(p, .float_to_int); | |
| 5090 | } else if (old_real) { | |
| 5091 | res.ty = int_ty.makeReal(); | |
| 5092 | try res.implicitCast(p, .float_to_int); | |
| 5093 | res.ty = int_ty; | |
| 5094 | try res.implicitCast(p, .real_to_complex_int); | |
| 5095 | } else if (new_real) { | |
| 5096 | res.ty = res.ty.makeReal(); | |
| 5097 | try res.implicitCast(p, .complex_float_to_real); | |
| 5098 | res.ty = int_ty; | |
| 5099 | try res.implicitCast(p, .float_to_int); | |
| 5100 | } else { | |
| 5101 | res.ty = int_ty; | |
| 5102 | try res.implicitCast(p, .complex_float_to_complex_int); | |
| 5103 | } | |
| 5104 | } else if (!res.ty.eql(int_ty, p.comp, true)) { | |
| 5105 | res.val.intCast(res.ty, int_ty, p.comp); | |
| 5106 | const old_real = res.ty.isReal(); | |
| 5107 | const new_real = int_ty.isReal(); | |
| 5108 | if (old_real and new_real) { | |
| 5109 | res.ty = int_ty; | |
| 5110 | try res.implicitCast(p, .int_cast); | |
| 5111 | } else if (old_real) { | |
| 5112 | const real_int_ty = int_ty.makeReal(); | |
| 5113 | if (!res.ty.eql(real_int_ty, p.comp, false)) { | |
| 5114 | res.ty = real_int_ty; | |
| 5115 | try res.implicitCast(p, .int_cast); | |
| 5116 | } | |
| 5117 | res.ty = int_ty; | |
| 5118 | try res.implicitCast(p, .real_to_complex_int); | |
| 5119 | } else if (new_real) { | |
| 5120 | res.ty = res.ty.makeReal(); | |
| 5121 | try res.implicitCast(p, .complex_int_to_real); | |
| 5122 | res.ty = int_ty; | |
| 5123 | try res.implicitCast(p, .int_cast); | |
| 5124 | } else { | |
| 5125 | res.ty = int_ty; | |
| 5126 | try res.implicitCast(p, .complex_int_cast); | |
| 5127 | } | |
| 5128 | } | |
| 5129 | } | |
| 5130 | ||
| 5131 | fn floatToIntWarning(res: *Result, p: *Parser, int_ty: Type, old_value: Value, change_kind: Value.FloatToIntChangeKind, tok: TokenIndex) !void { | |
| 5132 | switch (change_kind) { | |
| 5133 | .none => return p.errStr(.float_to_int, tok, try p.typePairStrExtra(res.ty, " to ", int_ty)), | |
| 5134 | .out_of_range => return p.errStr(.float_out_of_range, tok, try p.typePairStrExtra(res.ty, " to ", int_ty)), | |
| 5135 | .overflow => return p.errStr(.float_overflow_conversion, tok, try p.typePairStrExtra(res.ty, " to ", int_ty)), | |
| 5136 | .nonzero_to_zero => return p.errStr(.float_zero_conversion, tok, try p.floatValueChangedStr(res, old_value.getFloat(f64), int_ty)), | |
| 5137 | .value_changed => return p.errStr(.float_value_changed, tok, try p.floatValueChangedStr(res, old_value.getFloat(f64), int_ty)), | |
| 5138 | } | |
| 5139 | } | |
| 5140 | ||
| 5141 | fn floatCast(res: *Result, p: *Parser, float_ty: Type) Error!void { | |
| 5142 | if (res.ty.is(.bool)) { | |
| 5143 | res.val.intToFloat(res.ty, float_ty, p.comp); | |
| 5144 | res.ty = float_ty.makeReal(); | |
| 5145 | try res.implicitCast(p, .bool_to_float); | |
| 5146 | if (!float_ty.isReal()) { | |
| 5147 | res.ty = float_ty; | |
| 5148 | try res.implicitCast(p, .real_to_complex_float); | |
| 5149 | } | |
| 5150 | } else if (res.ty.isInt()) { | |
| 5151 | res.val.intToFloat(res.ty, float_ty, p.comp); | |
| 5152 | const old_real = res.ty.isReal(); | |
| 5153 | const new_real = float_ty.isReal(); | |
| 5154 | if (old_real and new_real) { | |
| 5155 | res.ty = float_ty; | |
| 5156 | try res.implicitCast(p, .int_to_float); | |
| 5157 | } else if (old_real) { | |
| 5158 | res.ty = float_ty.makeReal(); | |
| 5159 | try res.implicitCast(p, .int_to_float); | |
| 5160 | res.ty = float_ty; | |
| 5161 | try res.implicitCast(p, .real_to_complex_float); | |
| 5162 | } else if (new_real) { | |
| 5163 | res.ty = res.ty.makeReal(); | |
| 5164 | try res.implicitCast(p, .complex_int_to_real); | |
| 5165 | res.ty = float_ty; | |
| 5166 | try res.implicitCast(p, .int_to_float); | |
| 5167 | } else { | |
| 5168 | res.ty = float_ty; | |
| 5169 | try res.implicitCast(p, .complex_int_to_complex_float); | |
| 5170 | } | |
| 5171 | } else if (!res.ty.eql(float_ty, p.comp, true)) { | |
| 5172 | res.val.floatCast(res.ty, float_ty, p.comp); | |
| 5173 | const old_real = res.ty.isReal(); | |
| 5174 | const new_real = float_ty.isReal(); | |
| 5175 | if (old_real and new_real) { | |
| 5176 | res.ty = float_ty; | |
| 5177 | try res.implicitCast(p, .float_cast); | |
| 5178 | } else if (old_real) { | |
| 5179 | if (res.ty.floatRank() != float_ty.floatRank()) { | |
| 5180 | res.ty = float_ty.makeReal(); | |
| 5181 | try res.implicitCast(p, .float_cast); | |
| 5182 | } | |
| 5183 | res.ty = float_ty; | |
| 5184 | try res.implicitCast(p, .real_to_complex_float); | |
| 5185 | } else if (new_real) { | |
| 5186 | res.ty = res.ty.makeReal(); | |
| 5187 | try res.implicitCast(p, .complex_float_to_real); | |
| 5188 | if (res.ty.floatRank() != float_ty.floatRank()) { | |
| 5189 | res.ty = float_ty; | |
| 5190 | try res.implicitCast(p, .float_cast); | |
| 5191 | } | |
| 5192 | } else { | |
| 5193 | res.ty = float_ty; | |
| 5194 | try res.implicitCast(p, .complex_float_cast); | |
| 5195 | } | |
| 5196 | } | |
| 5197 | } | |
| 5198 | ||
| 5199 | /// Converts a bool or integer to a pointer | |
| 5200 | fn ptrCast(res: *Result, p: *Parser, ptr_ty: Type) Error!void { | |
| 5201 | if (res.ty.is(.bool)) { | |
| 5202 | res.ty = ptr_ty; | |
| 5203 | try res.implicitCast(p, .bool_to_pointer); | |
| 5204 | } else if (res.ty.isInt()) { | |
| 5205 | res.val.intCast(res.ty, ptr_ty, p.comp); | |
| 5206 | res.ty = ptr_ty; | |
| 5207 | try res.implicitCast(p, .int_to_pointer); | |
| 5208 | } | |
| 5209 | } | |
| 5210 | ||
| 5211 | /// Convert pointer to one with a different child type | |
| 5212 | fn ptrChildTypeCast(res: *Result, p: *Parser, ptr_ty: Type) Error!void { | |
| 5213 | res.ty = ptr_ty; | |
| 5214 | return res.implicitCast(p, .bitcast); | |
| 5215 | } | |
| 5216 | ||
| 5217 | fn toVoid(res: *Result, p: *Parser) Error!void { | |
| 5218 | if (!res.ty.is(.void)) { | |
| 5219 | res.ty = .{ .specifier = .void }; | |
| 5220 | try res.implicitCast(p, .to_void); | |
| 5221 | } | |
| 5222 | } | |
| 5223 | ||
| 5224 | fn nullCast(res: *Result, p: *Parser, ptr_ty: Type) Error!void { | |
| 5225 | if (!res.ty.is(.nullptr_t) and !res.val.isZero()) return; | |
| 5226 | res.ty = ptr_ty; | |
| 5227 | try res.implicitCast(p, .null_to_pointer); | |
| 5228 | } | |
| 5229 | ||
| 5230 | fn usualUnaryConversion(res: *Result, p: *Parser, tok: TokenIndex) Error!void { | |
| 5231 | if (res.ty.isFloat()) fp_eval: { | |
| 5232 | const eval_method = p.comp.langopts.fp_eval_method orelse break :fp_eval; | |
| 5233 | switch (eval_method) { | |
| 5234 | .source => {}, | |
| 5235 | .indeterminate => unreachable, | |
| 5236 | .double => { | |
| 5237 | if (res.ty.floatRank() < (Type{ .specifier = .double }).floatRank()) { | |
| 5238 | const spec: Type.Specifier = if (res.ty.isReal()) .double else .complex_double; | |
| 5239 | return res.floatCast(p, .{ .specifier = spec }); | |
| 5240 | } | |
| 5241 | }, | |
| 5242 | .extended => { | |
| 5243 | if (res.ty.floatRank() < (Type{ .specifier = .long_double }).floatRank()) { | |
| 5244 | const spec: Type.Specifier = if (res.ty.isReal()) .long_double else .complex_long_double; | |
| 5245 | return res.floatCast(p, .{ .specifier = spec }); | |
| 5246 | } | |
| 5247 | }, | |
| 5248 | } | |
| 5249 | } | |
| 5250 | ||
| 5251 | if (res.ty.is(.fp16) and !p.comp.langopts.use_native_half_type) { | |
| 5252 | return res.floatCast(p, .{ .specifier = .float }); | |
| 5253 | } | |
| 5254 | if (res.ty.isInt()) { | |
| 5255 | const slice = p.nodes.slice(); | |
| 5256 | if (Tree.bitfieldWidth(slice, res.node, true)) |width| { | |
| 5257 | if (res.ty.bitfieldPromotion(p.comp, width)) |promotion_ty| { | |
| 5258 | return res.intCast(p, promotion_ty, tok); | |
| 5259 | } | |
| 5260 | } | |
| 5261 | return res.intCast(p, res.ty.integerPromotion(p.comp), tok); | |
| 5262 | } | |
| 5263 | } | |
| 5264 | ||
| 5265 | fn usualArithmeticConversion(a: *Result, b: *Result, p: *Parser, tok: TokenIndex) Error!void { | |
| 5266 | try a.usualUnaryConversion(p, tok); | |
| 5267 | try b.usualUnaryConversion(p, tok); | |
| 5268 | ||
| 5269 | // if either is a float cast to that type | |
| 5270 | if (a.ty.isFloat() or b.ty.isFloat()) { | |
| 5271 | const float_types = [7][2]Type.Specifier{ | |
| 5272 | .{ .complex_long_double, .long_double }, | |
| 5273 | .{ .complex_float128, .float128 }, | |
| 5274 | .{ .complex_float80, .float80 }, | |
| 5275 | .{ .complex_double, .double }, | |
| 5276 | .{ .complex_float, .float }, | |
| 5277 | // No `_Complex __fp16` type | |
| 5278 | .{ .invalid, .fp16 }, | |
| 5279 | // No `_Complex _Float16` | |
| 5280 | .{ .invalid, .float16 }, | |
| 5281 | }; | |
| 5282 | const a_spec = a.ty.canonicalize(.standard).specifier; | |
| 5283 | const b_spec = b.ty.canonicalize(.standard).specifier; | |
| 5284 | if (p.comp.target.c_type_bit_size(.longdouble) == 128) { | |
| 5285 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return; | |
| 5286 | } | |
| 5287 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[1])) return; | |
| 5288 | if (p.comp.target.c_type_bit_size(.longdouble) == 80) { | |
| 5289 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return; | |
| 5290 | } | |
| 5291 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[2])) return; | |
| 5292 | if (p.comp.target.c_type_bit_size(.longdouble) == 64) { | |
| 5293 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[0])) return; | |
| 5294 | } | |
| 5295 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[3])) return; | |
| 5296 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[4])) return; | |
| 5297 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[5])) return; | |
| 5298 | if (try a.floatConversion(b, a_spec, b_spec, p, float_types[6])) return; | |
| 5299 | } | |
| 5300 | ||
| 5301 | if (a.ty.eql(b.ty, p.comp, true)) { | |
| 5302 | // cast to promoted type | |
| 5303 | try a.intCast(p, a.ty, tok); | |
| 5304 | try b.intCast(p, b.ty, tok); | |
| 5305 | return; | |
| 5306 | } | |
| 5307 | ||
| 5308 | const target = a.ty.integerConversion(b.ty, p.comp); | |
| 5309 | if (!target.isReal()) { | |
| 5310 | try a.saveValue(p); | |
| 5311 | try b.saveValue(p); | |
| 5312 | } | |
| 5313 | try a.intCast(p, target, tok); | |
| 5314 | try b.intCast(p, target, tok); | |
| 5315 | } | |
| 5316 | ||
| 5317 | fn floatConversion(a: *Result, b: *Result, a_spec: Type.Specifier, b_spec: Type.Specifier, p: *Parser, pair: [2]Type.Specifier) !bool { | |
| 5318 | if (a_spec == pair[0] or a_spec == pair[1] or | |
| 5319 | b_spec == pair[0] or b_spec == pair[1]) | |
| 5320 | { | |
| 5321 | const both_real = a.ty.isReal() and b.ty.isReal(); | |
| 5322 | const res_spec = pair[@intFromBool(both_real)]; | |
| 5323 | const ty = Type{ .specifier = res_spec }; | |
| 5324 | try a.floatCast(p, ty); | |
| 5325 | try b.floatCast(p, ty); | |
| 5326 | return true; | |
| 5327 | } | |
| 5328 | return false; | |
| 5329 | } | |
| 5330 | ||
| 5331 | fn invalidBinTy(a: *Result, tok: TokenIndex, b: *Result, p: *Parser) Error!bool { | |
| 5332 | try p.errStr(.invalid_bin_types, tok, try p.typePairStr(a.ty, b.ty)); | |
| 5333 | a.val.tag = .unavailable; | |
| 5334 | b.val.tag = .unavailable; | |
| 5335 | a.ty = Type.invalid; | |
| 5336 | return false; | |
| 5337 | } | |
| 5338 | ||
| 5339 | fn shouldEval(a: *Result, b: *Result, p: *Parser) Error!bool { | |
| 5340 | if (p.no_eval) return false; | |
| 5341 | if (a.val.tag != .unavailable and b.val.tag != .unavailable) | |
| 5342 | return true; | |
| 5343 | ||
| 5344 | try a.saveValue(p); | |
| 5345 | try b.saveValue(p); | |
| 5346 | return p.no_eval; | |
| 5347 | } | |
| 5348 | ||
| 5349 | /// Saves value and replaces it with `.unavailable`. | |
| 5350 | fn saveValue(res: *Result, p: *Parser) !void { | |
| 5351 | assert(!p.in_macro); | |
| 5352 | if (res.val.tag == .unavailable or res.val.tag == .nullptr_t) return; | |
| 5353 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 5354 | res.val.tag = .unavailable; | |
| 5355 | } | |
| 5356 | ||
| 5357 | fn castType(res: *Result, p: *Parser, to: Type, tok: TokenIndex) !void { | |
| 5358 | var cast_kind: Tree.CastKind = undefined; | |
| 5359 | ||
| 5360 | if (to.is(.void)) { | |
| 5361 | // everything can cast to void | |
| 5362 | cast_kind = .to_void; | |
| 5363 | res.val.tag = .unavailable; | |
| 5364 | } else if (to.is(.nullptr_t)) { | |
| 5365 | if (res.ty.is(.nullptr_t)) { | |
| 5366 | cast_kind = .no_op; | |
| 5367 | } else { | |
| 5368 | try p.errStr(.invalid_object_cast, tok, try p.typePairStrExtra(res.ty, " to ", to)); | |
| 5369 | return error.ParsingFailed; | |
| 5370 | } | |
| 5371 | } else if (res.ty.is(.nullptr_t)) { | |
| 5372 | if (to.is(.bool)) { | |
| 5373 | try res.nullCast(p, res.ty); | |
| 5374 | res.val.toBool(); | |
| 5375 | res.ty = .{ .specifier = .bool }; | |
| 5376 | try res.implicitCast(p, .pointer_to_bool); | |
| 5377 | try res.saveValue(p); | |
| 5378 | } else if (to.isPtr()) { | |
| 5379 | try res.nullCast(p, to); | |
| 5380 | } else { | |
| 5381 | try p.errStr(.invalid_object_cast, tok, try p.typePairStrExtra(res.ty, " to ", to)); | |
| 5382 | return error.ParsingFailed; | |
| 5383 | } | |
| 5384 | cast_kind = .no_op; | |
| 5385 | } else if (res.val.isZero() and to.isPtr()) { | |
| 5386 | cast_kind = .null_to_pointer; | |
| 5387 | } else if (to.isScalar()) cast: { | |
| 5388 | const old_float = res.ty.isFloat(); | |
| 5389 | const new_float = to.isFloat(); | |
| 5390 | ||
| 5391 | if (new_float and res.ty.isPtr()) { | |
| 5392 | try p.errStr(.invalid_cast_to_float, tok, try p.typeStr(to)); | |
| 5393 | return error.ParsingFailed; | |
| 5394 | } else if (old_float and to.isPtr()) { | |
| 5395 | try p.errStr(.invalid_cast_to_pointer, tok, try p.typeStr(res.ty)); | |
| 5396 | return error.ParsingFailed; | |
| 5397 | } | |
| 5398 | const old_real = res.ty.isReal(); | |
| 5399 | const new_real = to.isReal(); | |
| 5400 | ||
| 5401 | if (to.eql(res.ty, p.comp, false)) { | |
| 5402 | cast_kind = .no_op; | |
| 5403 | } else if (to.is(.bool)) { | |
| 5404 | if (res.ty.isPtr()) { | |
| 5405 | cast_kind = .pointer_to_bool; | |
| 5406 | } else if (res.ty.isInt()) { | |
| 5407 | if (!old_real) { | |
| 5408 | res.ty = res.ty.makeReal(); | |
| 5409 | try res.implicitCast(p, .complex_int_to_real); | |
| 5410 | } | |
| 5411 | cast_kind = .int_to_bool; | |
| 5412 | } else if (old_float) { | |
| 5413 | if (!old_real) { | |
| 5414 | res.ty = res.ty.makeReal(); | |
| 5415 | try res.implicitCast(p, .complex_float_to_real); | |
| 5416 | } | |
| 5417 | cast_kind = .float_to_bool; | |
| 5418 | } | |
| 5419 | } else if (to.isInt()) { | |
| 5420 | if (res.ty.is(.bool)) { | |
| 5421 | if (!new_real) { | |
| 5422 | res.ty = to.makeReal(); | |
| 5423 | try res.implicitCast(p, .bool_to_int); | |
| 5424 | cast_kind = .real_to_complex_int; | |
| 5425 | } else { | |
| 5426 | cast_kind = .bool_to_int; | |
| 5427 | } | |
| 5428 | } else if (res.ty.isInt()) { | |
| 5429 | if (old_real and new_real) { | |
| 5430 | cast_kind = .int_cast; | |
| 5431 | } else if (old_real) { | |
| 5432 | res.ty = to.makeReal(); | |
| 5433 | try res.implicitCast(p, .int_cast); | |
| 5434 | cast_kind = .real_to_complex_int; | |
| 5435 | } else if (new_real) { | |
| 5436 | res.ty = res.ty.makeReal(); | |
| 5437 | try res.implicitCast(p, .complex_int_to_real); | |
| 5438 | cast_kind = .int_cast; | |
| 5439 | } else { | |
| 5440 | cast_kind = .complex_int_cast; | |
| 5441 | } | |
| 5442 | } else if (res.ty.isPtr()) { | |
| 5443 | if (!new_real) { | |
| 5444 | res.ty = to.makeReal(); | |
| 5445 | try res.implicitCast(p, .pointer_to_int); | |
| 5446 | cast_kind = .real_to_complex_int; | |
| 5447 | } else { | |
| 5448 | cast_kind = .pointer_to_int; | |
| 5449 | } | |
| 5450 | } else if (old_real and new_real) { | |
| 5451 | cast_kind = .float_to_int; | |
| 5452 | } else if (old_real) { | |
| 5453 | res.ty = to.makeReal(); | |
| 5454 | try res.implicitCast(p, .float_to_int); | |
| 5455 | cast_kind = .real_to_complex_int; | |
| 5456 | } else if (new_real) { | |
| 5457 | res.ty = res.ty.makeReal(); | |
| 5458 | try res.implicitCast(p, .complex_float_to_real); | |
| 5459 | cast_kind = .float_to_int; | |
| 5460 | } else { | |
| 5461 | cast_kind = .complex_float_to_complex_int; | |
| 5462 | } | |
| 5463 | } else if (to.isPtr()) { | |
| 5464 | if (res.ty.isArray()) | |
| 5465 | cast_kind = .array_to_pointer | |
| 5466 | else if (res.ty.isPtr()) | |
| 5467 | cast_kind = .bitcast | |
| 5468 | else if (res.ty.isFunc()) | |
| 5469 | cast_kind = .function_to_pointer | |
| 5470 | else if (res.ty.is(.bool)) | |
| 5471 | cast_kind = .bool_to_pointer | |
| 5472 | else if (res.ty.isInt()) { | |
| 5473 | if (!old_real) { | |
| 5474 | res.ty = res.ty.makeReal(); | |
| 5475 | try res.implicitCast(p, .complex_int_to_real); | |
| 5476 | } | |
| 5477 | cast_kind = .int_to_pointer; | |
| 5478 | } | |
| 5479 | } else if (new_float) { | |
| 5480 | if (res.ty.is(.bool)) { | |
| 5481 | if (!new_real) { | |
| 5482 | res.ty = to.makeReal(); | |
| 5483 | try res.implicitCast(p, .bool_to_float); | |
| 5484 | cast_kind = .real_to_complex_float; | |
| 5485 | } else { | |
| 5486 | cast_kind = .bool_to_float; | |
| 5487 | } | |
| 5488 | } else if (res.ty.isInt()) { | |
| 5489 | if (old_real and new_real) { | |
| 5490 | cast_kind = .int_to_float; | |
| 5491 | } else if (old_real) { | |
| 5492 | res.ty = to.makeReal(); | |
| 5493 | try res.implicitCast(p, .int_to_float); | |
| 5494 | cast_kind = .real_to_complex_float; | |
| 5495 | } else if (new_real) { | |
| 5496 | res.ty = res.ty.makeReal(); | |
| 5497 | try res.implicitCast(p, .complex_int_to_real); | |
| 5498 | cast_kind = .int_to_float; | |
| 5499 | } else { | |
| 5500 | cast_kind = .complex_int_to_complex_float; | |
| 5501 | } | |
| 5502 | } else if (old_real and new_real) { | |
| 5503 | cast_kind = .float_cast; | |
| 5504 | } else if (old_real) { | |
| 5505 | res.ty = to.makeReal(); | |
| 5506 | try res.implicitCast(p, .float_cast); | |
| 5507 | cast_kind = .real_to_complex_float; | |
| 5508 | } else if (new_real) { | |
| 5509 | res.ty = res.ty.makeReal(); | |
| 5510 | try res.implicitCast(p, .complex_float_to_real); | |
| 5511 | cast_kind = .float_cast; | |
| 5512 | } else { | |
| 5513 | cast_kind = .complex_float_cast; | |
| 5514 | } | |
| 5515 | } | |
| 5516 | if (res.val.tag == .unavailable) break :cast; | |
| 5517 | ||
| 5518 | const old_int = res.ty.isInt() or res.ty.isPtr(); | |
| 5519 | const new_int = to.isInt() or to.isPtr(); | |
| 5520 | if (to.is(.bool)) { | |
| 5521 | res.val.toBool(); | |
| 5522 | } else if (old_float and new_int) { | |
| 5523 | // Explicit cast, no conversion warning | |
| 5524 | _ = res.val.floatToInt(res.ty, to, p.comp); | |
| 5525 | } else if (new_float and old_int) { | |
| 5526 | res.val.intToFloat(res.ty, to, p.comp); | |
| 5527 | } else if (new_float and old_float) { | |
| 5528 | res.val.floatCast(res.ty, to, p.comp); | |
| 5529 | } else if (old_int and new_int) { | |
| 5530 | if (to.hasIncompleteSize()) { | |
| 5531 | try p.errStr(.cast_to_incomplete_type, tok, try p.typeStr(to)); | |
| 5532 | return error.ParsingFailed; | |
| 5533 | } | |
| 5534 | res.val.intCast(res.ty, to, p.comp); | |
| 5535 | } | |
| 5536 | } else if (to.get(.@"union")) |union_ty| { | |
| 5537 | if (union_ty.data.record.hasFieldOfType(res.ty, p.comp)) { | |
| 5538 | cast_kind = .union_cast; | |
| 5539 | try p.errTok(.gnu_union_cast, tok); | |
| 5540 | } else { | |
| 5541 | if (union_ty.data.record.isIncomplete()) { | |
| 5542 | try p.errStr(.cast_to_incomplete_type, tok, try p.typeStr(to)); | |
| 5543 | } else { | |
| 5544 | try p.errStr(.invalid_union_cast, tok, try p.typeStr(res.ty)); | |
| 5545 | } | |
| 5546 | return error.ParsingFailed; | |
| 5547 | } | |
| 5548 | } else { | |
| 5549 | if (to.is(.auto_type)) { | |
| 5550 | try p.errTok(.invalid_cast_to_auto_type, tok); | |
| 5551 | } else { | |
| 5552 | try p.errStr(.invalid_cast_type, tok, try p.typeStr(to)); | |
| 5553 | } | |
| 5554 | return error.ParsingFailed; | |
| 5555 | } | |
| 5556 | if (to.anyQual()) try p.errStr(.qual_cast, tok, try p.typeStr(to)); | |
| 5557 | if (to.isInt() and res.ty.isPtr() and to.sizeCompare(res.ty, p.comp) == .lt) { | |
| 5558 | try p.errStr(.cast_to_smaller_int, tok, try p.typePairStrExtra(to, " from ", res.ty)); | |
| 5559 | } | |
| 5560 | res.ty = to; | |
| 5561 | res.ty.qual = .{}; | |
| 5562 | res.node = try p.addNode(.{ | |
| 5563 | .tag = .explicit_cast, | |
| 5564 | .ty = res.ty, | |
| 5565 | .data = .{ .cast = .{ .operand = res.node, .kind = cast_kind } }, | |
| 5566 | }); | |
| 5567 | } | |
| 5568 | ||
| 5569 | fn intFitsInType(res: Result, p: *Parser, ty: Type) bool { | |
| 5570 | const max_int = Value.int(ty.maxInt(p.comp)); | |
| 5571 | const min_int = Value.int(ty.minInt(p.comp)); | |
| 5572 | return res.val.compare(.lte, max_int, res.ty, p.comp) and | |
| 5573 | (res.ty.isUnsignedInt(p.comp) or res.val.compare(.gte, min_int, res.ty, p.comp)); | |
| 5574 | } | |
| 5575 | ||
| 5576 | const CoerceContext = union(enum) { | |
| 5577 | assign, | |
| 5578 | init, | |
| 5579 | ret, | |
| 5580 | arg: TokenIndex, | |
| 5581 | test_coerce, | |
| 5582 | ||
| 5583 | fn note(ctx: CoerceContext, p: *Parser) !void { | |
| 5584 | switch (ctx) { | |
| 5585 | .arg => |tok| try p.errTok(.parameter_here, tok), | |
| 5586 | .test_coerce => unreachable, | |
| 5587 | else => {}, | |
| 5588 | } | |
| 5589 | } | |
| 5590 | ||
| 5591 | fn typePairStr(ctx: CoerceContext, p: *Parser, dest_ty: Type, src_ty: Type) ![]const u8 { | |
| 5592 | switch (ctx) { | |
| 5593 | .assign, .init => return p.typePairStrExtra(dest_ty, " from incompatible type ", src_ty), | |
| 5594 | .ret => return p.typePairStrExtra(src_ty, " from a function with incompatible result type ", dest_ty), | |
| 5595 | .arg => return p.typePairStrExtra(src_ty, " to parameter of incompatible type ", dest_ty), | |
| 5596 | .test_coerce => unreachable, | |
| 5597 | } | |
| 5598 | } | |
| 5599 | }; | |
| 5600 | ||
| 5601 | /// Perform assignment-like coercion to `dest_ty`. | |
| 5602 | fn coerce(res: *Result, p: *Parser, dest_ty: Type, tok: TokenIndex, ctx: CoerceContext) Error!void { | |
| 5603 | if (res.ty.specifier == .invalid or dest_ty.specifier == .invalid) { | |
| 5604 | res.ty = Type.invalid; | |
| 5605 | return; | |
| 5606 | } | |
| 5607 | return res.coerceExtra(p, dest_ty, tok, ctx) catch |er| switch (er) { | |
| 5608 | error.CoercionFailed => unreachable, | |
| 5609 | else => |e| return e, | |
| 5610 | }; | |
| 5611 | } | |
| 5612 | ||
| 5613 | const Stage1Limitation = Error || error{CoercionFailed}; | |
| 5614 | fn coerceExtra(res: *Result, p: *Parser, dest_ty: Type, tok: TokenIndex, ctx: CoerceContext) Stage1Limitation!void { | |
| 5615 | // Subject of the coercion does not need to be qualified. | |
| 5616 | var unqual_ty = dest_ty.canonicalize(.standard); | |
| 5617 | unqual_ty.qual = .{}; | |
| 5618 | if (unqual_ty.is(.nullptr_t)) { | |
| 5619 | if (res.ty.is(.nullptr_t)) return; | |
| 5620 | } else if (unqual_ty.is(.bool)) { | |
| 5621 | if (res.ty.isScalar() and !res.ty.is(.nullptr_t)) { | |
| 5622 | // this is ridiculous but it's what clang does | |
| 5623 | try res.boolCast(p, unqual_ty, tok); | |
| 5624 | return; | |
| 5625 | } | |
| 5626 | } else if (unqual_ty.isInt()) { | |
| 5627 | if (res.ty.isInt() or res.ty.isFloat()) { | |
| 5628 | try res.intCast(p, unqual_ty, tok); | |
| 5629 | return; | |
| 5630 | } else if (res.ty.isPtr()) { | |
| 5631 | if (ctx == .test_coerce) return error.CoercionFailed; | |
| 5632 | try p.errStr(.implicit_ptr_to_int, tok, try p.typePairStrExtra(res.ty, " to ", dest_ty)); | |
| 5633 | try ctx.note(p); | |
| 5634 | try res.intCast(p, unqual_ty, tok); | |
| 5635 | return; | |
| 5636 | } | |
| 5637 | } else if (unqual_ty.isFloat()) { | |
| 5638 | if (res.ty.isInt() or res.ty.isFloat()) { | |
| 5639 | try res.floatCast(p, unqual_ty); | |
| 5640 | return; | |
| 5641 | } | |
| 5642 | } else if (unqual_ty.isPtr()) { | |
| 5643 | if (res.ty.is(.nullptr_t) or res.val.isZero()) { | |
| 5644 | try res.nullCast(p, dest_ty); | |
| 5645 | return; | |
| 5646 | } else if (res.ty.isInt() and res.ty.isReal()) { | |
| 5647 | if (ctx == .test_coerce) return error.CoercionFailed; | |
| 5648 | try p.errStr(.implicit_int_to_ptr, tok, try p.typePairStrExtra(res.ty, " to ", dest_ty)); | |
| 5649 | try ctx.note(p); | |
| 5650 | try res.ptrCast(p, unqual_ty); | |
| 5651 | return; | |
| 5652 | } else if (res.ty.isVoidStar() or unqual_ty.eql(res.ty, p.comp, true)) { | |
| 5653 | return; // ok | |
| 5654 | } else if (unqual_ty.isVoidStar() and res.ty.isPtr() or (res.ty.isInt() and res.ty.isReal())) { | |
| 5655 | return; // ok | |
| 5656 | } else if (unqual_ty.eql(res.ty, p.comp, false)) { | |
| 5657 | if (!unqual_ty.elemType().qual.hasQuals(res.ty.elemType().qual)) { | |
| 5658 | try p.errStr(switch (ctx) { | |
| 5659 | .assign => .ptr_assign_discards_quals, | |
| 5660 | .init => .ptr_init_discards_quals, | |
| 5661 | .ret => .ptr_ret_discards_quals, | |
| 5662 | .arg => .ptr_arg_discards_quals, | |
| 5663 | .test_coerce => return error.CoercionFailed, | |
| 5664 | }, tok, try ctx.typePairStr(p, dest_ty, res.ty)); | |
| 5665 | } | |
| 5666 | try res.ptrCast(p, unqual_ty); | |
| 5667 | return; | |
| 5668 | } else if (res.ty.isPtr()) { | |
| 5669 | const different_sign_only = unqual_ty.elemType().sameRankDifferentSign(res.ty.elemType(), p.comp); | |
| 5670 | try p.errStr(switch (ctx) { | |
| 5671 | .assign => ([2]Diagnostics.Tag{ .incompatible_ptr_assign, .incompatible_ptr_assign_sign })[@intFromBool(different_sign_only)], | |
| 5672 | .init => ([2]Diagnostics.Tag{ .incompatible_ptr_init, .incompatible_ptr_init_sign })[@intFromBool(different_sign_only)], | |
| 5673 | .ret => ([2]Diagnostics.Tag{ .incompatible_return, .incompatible_return_sign })[@intFromBool(different_sign_only)], | |
| 5674 | .arg => ([2]Diagnostics.Tag{ .incompatible_ptr_arg, .incompatible_ptr_arg_sign })[@intFromBool(different_sign_only)], | |
| 5675 | .test_coerce => return error.CoercionFailed, | |
| 5676 | }, tok, try ctx.typePairStr(p, dest_ty, res.ty)); | |
| 5677 | try ctx.note(p); | |
| 5678 | try res.ptrChildTypeCast(p, unqual_ty); | |
| 5679 | return; | |
| 5680 | } | |
| 5681 | } else if (unqual_ty.isRecord()) { | |
| 5682 | if (unqual_ty.eql(res.ty, p.comp, false)) { | |
| 5683 | return; // ok | |
| 5684 | } | |
| 5685 | ||
| 5686 | if (ctx == .arg) if (unqual_ty.get(.@"union")) |union_ty| { | |
| 5687 | if (dest_ty.hasAttribute(.transparent_union)) transparent_union: { | |
| 5688 | res.coerceExtra(p, union_ty.data.record.fields[0].ty, tok, .test_coerce) catch |er| switch (er) { | |
| 5689 | error.CoercionFailed => break :transparent_union, | |
| 5690 | else => |e| return e, | |
| 5691 | }; | |
| 5692 | res.node = try p.addNode(.{ | |
| 5693 | .tag = .union_init_expr, | |
| 5694 | .ty = dest_ty, | |
| 5695 | .data = .{ .union_init = .{ .field_index = 0, .node = res.node } }, | |
| 5696 | }); | |
| 5697 | res.ty = dest_ty; | |
| 5698 | return; | |
| 5699 | } | |
| 5700 | }; | |
| 5701 | } else if (unqual_ty.is(.vector)) { | |
| 5702 | if (unqual_ty.eql(res.ty, p.comp, false)) { | |
| 5703 | return; // ok | |
| 5704 | } | |
| 5705 | } else { | |
| 5706 | if (ctx == .assign and (unqual_ty.isArray() or unqual_ty.isFunc())) { | |
| 5707 | try p.errTok(.not_assignable, tok); | |
| 5708 | return; | |
| 5709 | } else if (ctx == .test_coerce) { | |
| 5710 | return error.CoercionFailed; | |
| 5711 | } | |
| 5712 | // This case should not be possible and an error should have already been emitted but we | |
| 5713 | // might still have attempted to parse further so return error.ParsingFailed here to stop. | |
| 5714 | return error.ParsingFailed; | |
| 5715 | } | |
| 5716 | ||
| 5717 | try p.errStr(switch (ctx) { | |
| 5718 | .assign => .incompatible_assign, | |
| 5719 | .init => .incompatible_init, | |
| 5720 | .ret => .incompatible_return, | |
| 5721 | .arg => .incompatible_arg, | |
| 5722 | .test_coerce => return error.CoercionFailed, | |
| 5723 | }, tok, try ctx.typePairStr(p, dest_ty, res.ty)); | |
| 5724 | try ctx.note(p); | |
| 5725 | } | |
| 5726 | }; | |
| 5727 | ||
| 5728 | /// expr : assignExpr (',' assignExpr)* | |
| 5729 | fn expr(p: *Parser) Error!Result { | |
| 5730 | var expr_start = p.tok_i; | |
| 5731 | var err_start = p.comp.diag.list.items.len; | |
| 5732 | var lhs = try p.assignExpr(); | |
| 5733 | if (p.tok_ids[p.tok_i] == .comma) try lhs.expect(p); | |
| 5734 | while (p.eatToken(.comma)) |_| { | |
| 5735 | try lhs.maybeWarnUnused(p, expr_start, err_start); | |
| 5736 | expr_start = p.tok_i; | |
| 5737 | err_start = p.comp.diag.list.items.len; | |
| 5738 | ||
| 5739 | var rhs = try p.assignExpr(); | |
| 5740 | try rhs.expect(p); | |
| 5741 | try rhs.lvalConversion(p); | |
| 5742 | lhs.val = rhs.val; | |
| 5743 | lhs.ty = rhs.ty; | |
| 5744 | try lhs.bin(p, .comma_expr, rhs); | |
| 5745 | } | |
| 5746 | return lhs; | |
| 5747 | } | |
| 5748 | ||
| 5749 | fn tokToTag(p: *Parser, tok: TokenIndex) Tree.Tag { | |
| 5750 | return switch (p.tok_ids[tok]) { | |
| 5751 | .equal => .assign_expr, | |
| 5752 | .asterisk_equal => .mul_assign_expr, | |
| 5753 | .slash_equal => .div_assign_expr, | |
| 5754 | .percent_equal => .mod_assign_expr, | |
| 5755 | .plus_equal => .add_assign_expr, | |
| 5756 | .minus_equal => .sub_assign_expr, | |
| 5757 | .angle_bracket_angle_bracket_left_equal => .shl_assign_expr, | |
| 5758 | .angle_bracket_angle_bracket_right_equal => .shr_assign_expr, | |
| 5759 | .ampersand_equal => .bit_and_assign_expr, | |
| 5760 | .caret_equal => .bit_xor_assign_expr, | |
| 5761 | .pipe_equal => .bit_or_assign_expr, | |
| 5762 | .equal_equal => .equal_expr, | |
| 5763 | .bang_equal => .not_equal_expr, | |
| 5764 | .angle_bracket_left => .less_than_expr, | |
| 5765 | .angle_bracket_left_equal => .less_than_equal_expr, | |
| 5766 | .angle_bracket_right => .greater_than_expr, | |
| 5767 | .angle_bracket_right_equal => .greater_than_equal_expr, | |
| 5768 | .angle_bracket_angle_bracket_left => .shl_expr, | |
| 5769 | .angle_bracket_angle_bracket_right => .shr_expr, | |
| 5770 | .plus => .add_expr, | |
| 5771 | .minus => .sub_expr, | |
| 5772 | .asterisk => .mul_expr, | |
| 5773 | .slash => .div_expr, | |
| 5774 | .percent => .mod_expr, | |
| 5775 | else => unreachable, | |
| 5776 | }; | |
| 5777 | } | |
| 5778 | ||
| 5779 | /// assignExpr | |
| 5780 | /// : condExpr | |
| 5781 | /// | unExpr ('=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=') assignExpr | |
| 5782 | fn assignExpr(p: *Parser) Error!Result { | |
| 5783 | var lhs = try p.condExpr(); | |
| 5784 | if (lhs.empty(p)) return lhs; | |
| 5785 | ||
| 5786 | const tok = p.tok_i; | |
| 5787 | const eq = p.eatToken(.equal); | |
| 5788 | const mul = eq orelse p.eatToken(.asterisk_equal); | |
| 5789 | const div = mul orelse p.eatToken(.slash_equal); | |
| 5790 | const mod = div orelse p.eatToken(.percent_equal); | |
| 5791 | const add = mod orelse p.eatToken(.plus_equal); | |
| 5792 | const sub = add orelse p.eatToken(.minus_equal); | |
| 5793 | const shl = sub orelse p.eatToken(.angle_bracket_angle_bracket_left_equal); | |
| 5794 | const shr = shl orelse p.eatToken(.angle_bracket_angle_bracket_right_equal); | |
| 5795 | const bit_and = shr orelse p.eatToken(.ampersand_equal); | |
| 5796 | const bit_xor = bit_and orelse p.eatToken(.caret_equal); | |
| 5797 | const bit_or = bit_xor orelse p.eatToken(.pipe_equal); | |
| 5798 | ||
| 5799 | const tag = p.tokToTag(bit_or orelse return lhs); | |
| 5800 | var rhs = try p.assignExpr(); | |
| 5801 | try rhs.expect(p); | |
| 5802 | try rhs.lvalConversion(p); | |
| 5803 | ||
| 5804 | var is_const: bool = undefined; | |
| 5805 | if (!Tree.isLvalExtra(p.nodes.slice(), p.data.items, p.value_map, lhs.node, &is_const) or is_const) { | |
| 5806 | try p.errTok(.not_assignable, tok); | |
| 5807 | return error.ParsingFailed; | |
| 5808 | } | |
| 5809 | ||
| 5810 | // adjustTypes will do do lvalue conversion but we do not want that | |
| 5811 | var lhs_copy = lhs; | |
| 5812 | switch (tag) { | |
| 5813 | .assign_expr => {}, // handle plain assignment separately | |
| 5814 | .mul_assign_expr, | |
| 5815 | .div_assign_expr, | |
| 5816 | .mod_assign_expr, | |
| 5817 | => { | |
| 5818 | if (rhs.val.isZero() and lhs.ty.isInt() and rhs.ty.isInt()) { | |
| 5819 | switch (tag) { | |
| 5820 | .div_assign_expr => try p.errStr(.division_by_zero, div.?, "division"), | |
| 5821 | .mod_assign_expr => try p.errStr(.division_by_zero, mod.?, "remainder"), | |
| 5822 | else => {}, | |
| 5823 | } | |
| 5824 | } | |
| 5825 | _ = try lhs_copy.adjustTypes(tok, &rhs, p, if (tag == .mod_assign_expr) .integer else .arithmetic); | |
| 5826 | try lhs.bin(p, tag, rhs); | |
| 5827 | return lhs; | |
| 5828 | }, | |
| 5829 | .sub_assign_expr, | |
| 5830 | .add_assign_expr, | |
| 5831 | => { | |
| 5832 | if (lhs.ty.isPtr() and rhs.ty.isInt()) { | |
| 5833 | try rhs.ptrCast(p, lhs.ty); | |
| 5834 | } else { | |
| 5835 | _ = try lhs_copy.adjustTypes(tok, &rhs, p, .arithmetic); | |
| 5836 | } | |
| 5837 | try lhs.bin(p, tag, rhs); | |
| 5838 | return lhs; | |
| 5839 | }, | |
| 5840 | .shl_assign_expr, | |
| 5841 | .shr_assign_expr, | |
| 5842 | .bit_and_assign_expr, | |
| 5843 | .bit_xor_assign_expr, | |
| 5844 | .bit_or_assign_expr, | |
| 5845 | => { | |
| 5846 | _ = try lhs_copy.adjustTypes(tok, &rhs, p, .integer); | |
| 5847 | try lhs.bin(p, tag, rhs); | |
| 5848 | return lhs; | |
| 5849 | }, | |
| 5850 | else => unreachable, | |
| 5851 | } | |
| 5852 | ||
| 5853 | try rhs.coerce(p, lhs.ty, tok, .assign); | |
| 5854 | ||
| 5855 | try lhs.bin(p, tag, rhs); | |
| 5856 | return lhs; | |
| 5857 | } | |
| 5858 | ||
| 5859 | /// Returns a parse error if the expression is not an integer constant | |
| 5860 | /// integerConstExpr : constExpr | |
| 5861 | fn integerConstExpr(p: *Parser, decl_folding: ConstDeclFoldingMode) Error!Result { | |
| 5862 | const start = p.tok_i; | |
| 5863 | const res = try p.constExpr(decl_folding); | |
| 5864 | if (!res.ty.isInt() and res.ty.specifier != .invalid) { | |
| 5865 | try p.errTok(.expected_integer_constant_expr, start); | |
| 5866 | return error.ParsingFailed; | |
| 5867 | } | |
| 5868 | return res; | |
| 5869 | } | |
| 5870 | ||
| 5871 | /// Caller is responsible for issuing a diagnostic if result is invalid/unavailable | |
| 5872 | /// constExpr : condExpr | |
| 5873 | fn constExpr(p: *Parser, decl_folding: ConstDeclFoldingMode) Error!Result { | |
| 5874 | const const_decl_folding = p.const_decl_folding; | |
| 5875 | defer p.const_decl_folding = const_decl_folding; | |
| 5876 | p.const_decl_folding = decl_folding; | |
| 5877 | ||
| 5878 | const res = try p.condExpr(); | |
| 5879 | try res.expect(p); | |
| 5880 | ||
| 5881 | if (res.ty.specifier == .invalid or res.val.tag == .unavailable) return res; | |
| 5882 | ||
| 5883 | // saveValue sets val to unavailable | |
| 5884 | var copy = res; | |
| 5885 | try copy.saveValue(p); | |
| 5886 | return res; | |
| 5887 | } | |
| 5888 | ||
| 5889 | /// condExpr : lorExpr ('?' expression? ':' condExpr)? | |
| 5890 | fn condExpr(p: *Parser) Error!Result { | |
| 5891 | const cond_tok = p.tok_i; | |
| 5892 | var cond = try p.lorExpr(); | |
| 5893 | if (cond.empty(p) or p.eatToken(.question_mark) == null) return cond; | |
| 5894 | try cond.lvalConversion(p); | |
| 5895 | const saved_eval = p.no_eval; | |
| 5896 | ||
| 5897 | if (!cond.ty.isScalar()) { | |
| 5898 | try p.errStr(.cond_expr_type, cond_tok, try p.typeStr(cond.ty)); | |
| 5899 | return error.ParsingFailed; | |
| 5900 | } | |
| 5901 | ||
| 5902 | // Prepare for possible binary conditional expression. | |
| 5903 | var maybe_colon = p.eatToken(.colon); | |
| 5904 | ||
| 5905 | // Depending on the value of the condition, avoid evaluating unreachable branches. | |
| 5906 | var then_expr = blk: { | |
| 5907 | defer p.no_eval = saved_eval; | |
| 5908 | if (cond.val.tag != .unavailable and !cond.val.getBool()) p.no_eval = true; | |
| 5909 | break :blk try p.expr(); | |
| 5910 | }; | |
| 5911 | try then_expr.expect(p); | |
| 5912 | ||
| 5913 | // If we saw a colon then this is a binary conditional expression. | |
| 5914 | if (maybe_colon) |colon| { | |
| 5915 | var cond_then = cond; | |
| 5916 | cond_then.node = try p.addNode(.{ .tag = .cond_dummy_expr, .ty = cond.ty, .data = .{ .un = cond.node } }); | |
| 5917 | _ = try cond_then.adjustTypes(colon, &then_expr, p, .conditional); | |
| 5918 | cond.ty = then_expr.ty; | |
| 5919 | cond.node = try p.addNode(.{ | |
| 5920 | .tag = .binary_cond_expr, | |
| 5921 | .ty = cond.ty, | |
| 5922 | .data = .{ .if3 = .{ .cond = cond.node, .body = (try p.addList(&.{ cond_then.node, then_expr.node })).start } }, | |
| 5923 | }); | |
| 5924 | return cond; | |
| 5925 | } | |
| 5926 | ||
| 5927 | const colon = try p.expectToken(.colon); | |
| 5928 | var else_expr = blk: { | |
| 5929 | defer p.no_eval = saved_eval; | |
| 5930 | if (cond.val.tag != .unavailable and cond.val.getBool()) p.no_eval = true; | |
| 5931 | break :blk try p.condExpr(); | |
| 5932 | }; | |
| 5933 | try else_expr.expect(p); | |
| 5934 | ||
| 5935 | _ = try then_expr.adjustTypes(colon, &else_expr, p, .conditional); | |
| 5936 | ||
| 5937 | if (cond.val.tag != .unavailable) { | |
| 5938 | cond.val = if (cond.val.getBool()) then_expr.val else else_expr.val; | |
| 5939 | } else { | |
| 5940 | try then_expr.saveValue(p); | |
| 5941 | try else_expr.saveValue(p); | |
| 5942 | } | |
| 5943 | cond.ty = then_expr.ty; | |
| 5944 | cond.node = try p.addNode(.{ | |
| 5945 | .tag = .cond_expr, | |
| 5946 | .ty = cond.ty, | |
| 5947 | .data = .{ .if3 = .{ .cond = cond.node, .body = (try p.addList(&.{ then_expr.node, else_expr.node })).start } }, | |
| 5948 | }); | |
| 5949 | return cond; | |
| 5950 | } | |
| 5951 | ||
| 5952 | /// lorExpr : landExpr ('||' landExpr)* | |
| 5953 | fn lorExpr(p: *Parser) Error!Result { | |
| 5954 | var lhs = try p.landExpr(); | |
| 5955 | if (lhs.empty(p)) return lhs; | |
| 5956 | const saved_eval = p.no_eval; | |
| 5957 | defer p.no_eval = saved_eval; | |
| 5958 | ||
| 5959 | while (p.eatToken(.pipe_pipe)) |tok| { | |
| 5960 | if (lhs.val.tag != .unavailable and lhs.val.getBool()) p.no_eval = true; | |
| 5961 | var rhs = try p.landExpr(); | |
| 5962 | try rhs.expect(p); | |
| 5963 | ||
| 5964 | if (try lhs.adjustTypes(tok, &rhs, p, .boolean_logic)) { | |
| 5965 | const res = @intFromBool(lhs.val.getBool() or rhs.val.getBool()); | |
| 5966 | lhs.val = Value.int(res); | |
| 5967 | } | |
| 5968 | try lhs.boolRes(p, .bool_or_expr, rhs); | |
| 5969 | } | |
| 5970 | return lhs; | |
| 5971 | } | |
| 5972 | ||
| 5973 | /// landExpr : orExpr ('&&' orExpr)* | |
| 5974 | fn landExpr(p: *Parser) Error!Result { | |
| 5975 | var lhs = try p.orExpr(); | |
| 5976 | if (lhs.empty(p)) return lhs; | |
| 5977 | const saved_eval = p.no_eval; | |
| 5978 | defer p.no_eval = saved_eval; | |
| 5979 | ||
| 5980 | while (p.eatToken(.ampersand_ampersand)) |tok| { | |
| 5981 | if (lhs.val.tag != .unavailable and !lhs.val.getBool()) p.no_eval = true; | |
| 5982 | var rhs = try p.orExpr(); | |
| 5983 | try rhs.expect(p); | |
| 5984 | ||
| 5985 | if (try lhs.adjustTypes(tok, &rhs, p, .boolean_logic)) { | |
| 5986 | const res = @intFromBool(lhs.val.getBool() and rhs.val.getBool()); | |
| 5987 | lhs.val = Value.int(res); | |
| 5988 | } | |
| 5989 | try lhs.boolRes(p, .bool_and_expr, rhs); | |
| 5990 | } | |
| 5991 | return lhs; | |
| 5992 | } | |
| 5993 | ||
| 5994 | /// orExpr : xorExpr ('|' xorExpr)* | |
| 5995 | fn orExpr(p: *Parser) Error!Result { | |
| 5996 | var lhs = try p.xorExpr(); | |
| 5997 | if (lhs.empty(p)) return lhs; | |
| 5998 | while (p.eatToken(.pipe)) |tok| { | |
| 5999 | var rhs = try p.xorExpr(); | |
| 6000 | try rhs.expect(p); | |
| 6001 | ||
| 6002 | if (try lhs.adjustTypes(tok, &rhs, p, .integer)) { | |
| 6003 | lhs.val = lhs.val.bitOr(rhs.val, lhs.ty, p.comp); | |
| 6004 | } | |
| 6005 | try lhs.bin(p, .bit_or_expr, rhs); | |
| 6006 | } | |
| 6007 | return lhs; | |
| 6008 | } | |
| 6009 | ||
| 6010 | /// xorExpr : andExpr ('^' andExpr)* | |
| 6011 | fn xorExpr(p: *Parser) Error!Result { | |
| 6012 | var lhs = try p.andExpr(); | |
| 6013 | if (lhs.empty(p)) return lhs; | |
| 6014 | while (p.eatToken(.caret)) |tok| { | |
| 6015 | var rhs = try p.andExpr(); | |
| 6016 | try rhs.expect(p); | |
| 6017 | ||
| 6018 | if (try lhs.adjustTypes(tok, &rhs, p, .integer)) { | |
| 6019 | lhs.val = lhs.val.bitXor(rhs.val, lhs.ty, p.comp); | |
| 6020 | } | |
| 6021 | try lhs.bin(p, .bit_xor_expr, rhs); | |
| 6022 | } | |
| 6023 | return lhs; | |
| 6024 | } | |
| 6025 | ||
| 6026 | /// andExpr : eqExpr ('&' eqExpr)* | |
| 6027 | fn andExpr(p: *Parser) Error!Result { | |
| 6028 | var lhs = try p.eqExpr(); | |
| 6029 | if (lhs.empty(p)) return lhs; | |
| 6030 | while (p.eatToken(.ampersand)) |tok| { | |
| 6031 | var rhs = try p.eqExpr(); | |
| 6032 | try rhs.expect(p); | |
| 6033 | ||
| 6034 | if (try lhs.adjustTypes(tok, &rhs, p, .integer)) { | |
| 6035 | lhs.val = lhs.val.bitAnd(rhs.val, lhs.ty, p.comp); | |
| 6036 | } | |
| 6037 | try lhs.bin(p, .bit_and_expr, rhs); | |
| 6038 | } | |
| 6039 | return lhs; | |
| 6040 | } | |
| 6041 | ||
| 6042 | /// eqExpr : compExpr (('==' | '!=') compExpr)* | |
| 6043 | fn eqExpr(p: *Parser) Error!Result { | |
| 6044 | var lhs = try p.compExpr(); | |
| 6045 | if (lhs.empty(p)) return lhs; | |
| 6046 | while (true) { | |
| 6047 | const eq = p.eatToken(.equal_equal); | |
| 6048 | const ne = eq orelse p.eatToken(.bang_equal); | |
| 6049 | const tag = p.tokToTag(ne orelse break); | |
| 6050 | var rhs = try p.compExpr(); | |
| 6051 | try rhs.expect(p); | |
| 6052 | ||
| 6053 | if (try lhs.adjustTypes(ne.?, &rhs, p, .equality)) { | |
| 6054 | const op: std.math.CompareOperator = if (tag == .equal_expr) .eq else .neq; | |
| 6055 | const res = lhs.val.compare(op, rhs.val, lhs.ty, p.comp); | |
| 6056 | lhs.val = Value.int(@intFromBool(res)); | |
| 6057 | } | |
| 6058 | try lhs.boolRes(p, tag, rhs); | |
| 6059 | } | |
| 6060 | return lhs; | |
| 6061 | } | |
| 6062 | ||
| 6063 | /// compExpr : shiftExpr (('<' | '<=' | '>' | '>=') shiftExpr)* | |
| 6064 | fn compExpr(p: *Parser) Error!Result { | |
| 6065 | var lhs = try p.shiftExpr(); | |
| 6066 | if (lhs.empty(p)) return lhs; | |
| 6067 | while (true) { | |
| 6068 | const lt = p.eatToken(.angle_bracket_left); | |
| 6069 | const le = lt orelse p.eatToken(.angle_bracket_left_equal); | |
| 6070 | const gt = le orelse p.eatToken(.angle_bracket_right); | |
| 6071 | const ge = gt orelse p.eatToken(.angle_bracket_right_equal); | |
| 6072 | const tag = p.tokToTag(ge orelse break); | |
| 6073 | var rhs = try p.shiftExpr(); | |
| 6074 | try rhs.expect(p); | |
| 6075 | ||
| 6076 | if (try lhs.adjustTypes(ge.?, &rhs, p, .relational)) { | |
| 6077 | const op: std.math.CompareOperator = switch (tag) { | |
| 6078 | .less_than_expr => .lt, | |
| 6079 | .less_than_equal_expr => .lte, | |
| 6080 | .greater_than_expr => .gt, | |
| 6081 | .greater_than_equal_expr => .gte, | |
| 6082 | else => unreachable, | |
| 6083 | }; | |
| 6084 | const res = lhs.val.compare(op, rhs.val, lhs.ty, p.comp); | |
| 6085 | lhs.val = Value.int(@intFromBool(res)); | |
| 6086 | } | |
| 6087 | try lhs.boolRes(p, tag, rhs); | |
| 6088 | } | |
| 6089 | return lhs; | |
| 6090 | } | |
| 6091 | ||
| 6092 | /// shiftExpr : addExpr (('<<' | '>>') addExpr)* | |
| 6093 | fn shiftExpr(p: *Parser) Error!Result { | |
| 6094 | var lhs = try p.addExpr(); | |
| 6095 | if (lhs.empty(p)) return lhs; | |
| 6096 | while (true) { | |
| 6097 | const shl = p.eatToken(.angle_bracket_angle_bracket_left); | |
| 6098 | const shr = shl orelse p.eatToken(.angle_bracket_angle_bracket_right); | |
| 6099 | const tag = p.tokToTag(shr orelse break); | |
| 6100 | var rhs = try p.addExpr(); | |
| 6101 | try rhs.expect(p); | |
| 6102 | ||
| 6103 | if (try lhs.adjustTypes(shr.?, &rhs, p, .integer)) { | |
| 6104 | if (shl != null) { | |
| 6105 | lhs.val = lhs.val.shl(rhs.val, lhs.ty, p.comp); | |
| 6106 | } else { | |
| 6107 | lhs.val = lhs.val.shr(rhs.val, lhs.ty, p.comp); | |
| 6108 | } | |
| 6109 | } | |
| 6110 | try lhs.bin(p, tag, rhs); | |
| 6111 | } | |
| 6112 | return lhs; | |
| 6113 | } | |
| 6114 | ||
| 6115 | /// addExpr : mulExpr (('+' | '-') mulExpr)* | |
| 6116 | fn addExpr(p: *Parser) Error!Result { | |
| 6117 | var lhs = try p.mulExpr(); | |
| 6118 | if (lhs.empty(p)) return lhs; | |
| 6119 | while (true) { | |
| 6120 | const plus = p.eatToken(.plus); | |
| 6121 | const minus = plus orelse p.eatToken(.minus); | |
| 6122 | const tag = p.tokToTag(minus orelse break); | |
| 6123 | var rhs = try p.mulExpr(); | |
| 6124 | try rhs.expect(p); | |
| 6125 | ||
| 6126 | const lhs_ty = lhs.ty; | |
| 6127 | if (try lhs.adjustTypes(minus.?, &rhs, p, if (plus != null) .add else .sub)) { | |
| 6128 | if (plus != null) { | |
| 6129 | if (lhs.val.add(lhs.val, rhs.val, lhs.ty, p.comp)) try p.errOverflow(plus.?, lhs); | |
| 6130 | } else { | |
| 6131 | if (lhs.val.sub(lhs.val, rhs.val, lhs.ty, p.comp)) try p.errOverflow(minus.?, lhs); | |
| 6132 | } | |
| 6133 | } | |
| 6134 | if (lhs.ty.specifier != .invalid and lhs_ty.isPtr() and !lhs_ty.isVoidStar() and lhs_ty.elemType().hasIncompleteSize()) { | |
| 6135 | try p.errStr(.ptr_arithmetic_incomplete, minus.?, try p.typeStr(lhs_ty.elemType())); | |
| 6136 | lhs.ty = Type.invalid; | |
| 6137 | } | |
| 6138 | try lhs.bin(p, tag, rhs); | |
| 6139 | } | |
| 6140 | return lhs; | |
| 6141 | } | |
| 6142 | ||
| 6143 | /// mulExpr : castExpr (('*' | '/' | '%') castExpr)*´ | |
| 6144 | fn mulExpr(p: *Parser) Error!Result { | |
| 6145 | var lhs = try p.castExpr(); | |
| 6146 | if (lhs.empty(p)) return lhs; | |
| 6147 | while (true) { | |
| 6148 | const mul = p.eatToken(.asterisk); | |
| 6149 | const div = mul orelse p.eatToken(.slash); | |
| 6150 | const percent = div orelse p.eatToken(.percent); | |
| 6151 | const tag = p.tokToTag(percent orelse break); | |
| 6152 | var rhs = try p.castExpr(); | |
| 6153 | try rhs.expect(p); | |
| 6154 | ||
| 6155 | if (rhs.val.isZero() and mul == null and !p.no_eval and lhs.ty.isInt() and rhs.ty.isInt()) { | |
| 6156 | const err_tag: Diagnostics.Tag = if (p.in_macro) .division_by_zero_macro else .division_by_zero; | |
| 6157 | lhs.val.tag = .unavailable; | |
| 6158 | if (div != null) { | |
| 6159 | try p.errStr(err_tag, div.?, "division"); | |
| 6160 | } else { | |
| 6161 | try p.errStr(err_tag, percent.?, "remainder"); | |
| 6162 | } | |
| 6163 | if (p.in_macro) return error.ParsingFailed; | |
| 6164 | } | |
| 6165 | ||
| 6166 | if (try lhs.adjustTypes(percent.?, &rhs, p, if (tag == .mod_expr) .integer else .arithmetic)) { | |
| 6167 | if (mul != null) { | |
| 6168 | if (lhs.val.mul(lhs.val, rhs.val, lhs.ty, p.comp)) try p.errOverflow(mul.?, lhs); | |
| 6169 | } else if (div != null) { | |
| 6170 | lhs.val = Value.div(lhs.val, rhs.val, lhs.ty, p.comp); | |
| 6171 | } else { | |
| 6172 | var res = Value.rem(lhs.val, rhs.val, lhs.ty, p.comp); | |
| 6173 | if (res.tag == .unavailable) { | |
| 6174 | if (p.in_macro) { | |
| 6175 | // match clang behavior by defining invalid remainder to be zero in macros | |
| 6176 | res = Value.int(0); | |
| 6177 | } else { | |
| 6178 | try lhs.saveValue(p); | |
| 6179 | try rhs.saveValue(p); | |
| 6180 | } | |
| 6181 | } | |
| 6182 | lhs.val = res; | |
| 6183 | } | |
| 6184 | } | |
| 6185 | ||
| 6186 | try lhs.bin(p, tag, rhs); | |
| 6187 | } | |
| 6188 | return lhs; | |
| 6189 | } | |
| 6190 | ||
| 6191 | /// This will always be the last message, if present | |
| 6192 | fn removeUnusedWarningForTok(p: *Parser, last_expr_tok: TokenIndex) void { | |
| 6193 | if (last_expr_tok == 0) return; | |
| 6194 | if (p.comp.diag.list.items.len == 0) return; | |
| 6195 | ||
| 6196 | const last_expr_loc = p.pp.tokens.items(.loc)[last_expr_tok]; | |
| 6197 | const last_msg = p.comp.diag.list.items[p.comp.diag.list.items.len - 1]; | |
| 6198 | ||
| 6199 | if (last_msg.tag == .unused_value and last_msg.loc.eql(last_expr_loc)) { | |
| 6200 | p.comp.diag.list.items.len = p.comp.diag.list.items.len - 1; | |
| 6201 | } | |
| 6202 | } | |
| 6203 | ||
| 6204 | /// castExpr | |
| 6205 | /// : '(' compoundStmt ')' | |
| 6206 | /// | '(' typeName ')' castExpr | |
| 6207 | /// | '(' typeName ')' '{' initializerItems '}' | |
| 6208 | /// | __builtin_choose_expr '(' integerConstExpr ',' assignExpr ',' assignExpr ')' | |
| 6209 | /// | __builtin_va_arg '(' assignExpr ',' typeName ')' | |
| 6210 | /// | __builtin_offsetof '(' typeName ',' offsetofMemberDesignator ')' | |
| 6211 | /// | __builtin_bitoffsetof '(' typeName ',' offsetofMemberDesignator ')' | |
| 6212 | /// | unExpr | |
| 6213 | fn castExpr(p: *Parser) Error!Result { | |
| 6214 | if (p.eatToken(.l_paren)) |l_paren| cast_expr: { | |
| 6215 | if (p.tok_ids[p.tok_i] == .l_brace) { | |
| 6216 | try p.err(.gnu_statement_expression); | |
| 6217 | if (p.func.ty == null) { | |
| 6218 | try p.err(.stmt_expr_not_allowed_file_scope); | |
| 6219 | return error.ParsingFailed; | |
| 6220 | } | |
| 6221 | var stmt_expr_state: StmtExprState = .{}; | |
| 6222 | const body_node = (try p.compoundStmt(false, &stmt_expr_state)).?; // compoundStmt only returns null if .l_brace isn't the first token | |
| 6223 | p.removeUnusedWarningForTok(stmt_expr_state.last_expr_tok); | |
| 6224 | ||
| 6225 | var res = Result{ | |
| 6226 | .node = body_node, | |
| 6227 | .ty = stmt_expr_state.last_expr_res.ty, | |
| 6228 | .val = stmt_expr_state.last_expr_res.val, | |
| 6229 | }; | |
| 6230 | try p.expectClosing(l_paren, .r_paren); | |
| 6231 | try res.un(p, .stmt_expr); | |
| 6232 | return res; | |
| 6233 | } | |
| 6234 | const ty = (try p.typeName()) orelse { | |
| 6235 | p.tok_i -= 1; | |
| 6236 | break :cast_expr; | |
| 6237 | }; | |
| 6238 | try p.expectClosing(l_paren, .r_paren); | |
| 6239 | ||
| 6240 | if (p.tok_ids[p.tok_i] == .l_brace) { | |
| 6241 | // Compound literal; handled in unExpr | |
| 6242 | p.tok_i = l_paren; | |
| 6243 | break :cast_expr; | |
| 6244 | } | |
| 6245 | ||
| 6246 | var operand = try p.castExpr(); | |
| 6247 | try operand.expect(p); | |
| 6248 | try operand.lvalConversion(p); | |
| 6249 | try operand.castType(p, ty, l_paren); | |
| 6250 | return operand; | |
| 6251 | } | |
| 6252 | switch (p.tok_ids[p.tok_i]) { | |
| 6253 | .builtin_choose_expr => return p.builtinChooseExpr(), | |
| 6254 | .builtin_va_arg => return p.builtinVaArg(), | |
| 6255 | .builtin_offsetof => return p.builtinOffsetof(false), | |
| 6256 | .builtin_bitoffsetof => return p.builtinOffsetof(true), | |
| 6257 | .builtin_types_compatible_p => return p.typesCompatible(), | |
| 6258 | // TODO: other special-cased builtins | |
| 6259 | else => {}, | |
| 6260 | } | |
| 6261 | return p.unExpr(); | |
| 6262 | } | |
| 6263 | ||
| 6264 | fn typesCompatible(p: *Parser) Error!Result { | |
| 6265 | p.tok_i += 1; | |
| 6266 | const l_paren = try p.expectToken(.l_paren); | |
| 6267 | ||
| 6268 | const first = (try p.typeName()) orelse { | |
| 6269 | try p.err(.expected_type); | |
| 6270 | p.skipTo(.r_paren); | |
| 6271 | return error.ParsingFailed; | |
| 6272 | }; | |
| 6273 | const lhs = try p.addNode(.{ .tag = .invalid, .ty = first, .data = undefined }); | |
| 6274 | _ = try p.expectToken(.comma); | |
| 6275 | ||
| 6276 | const second = (try p.typeName()) orelse { | |
| 6277 | try p.err(.expected_type); | |
| 6278 | p.skipTo(.r_paren); | |
| 6279 | return error.ParsingFailed; | |
| 6280 | }; | |
| 6281 | const rhs = try p.addNode(.{ .tag = .invalid, .ty = second, .data = undefined }); | |
| 6282 | ||
| 6283 | try p.expectClosing(l_paren, .r_paren); | |
| 6284 | ||
| 6285 | const compatible = first.compatible(second, p.comp); | |
| 6286 | ||
| 6287 | var res = Result{ | |
| 6288 | .val = Value.int(@intFromBool(compatible)), | |
| 6289 | .node = try p.addNode(.{ .tag = .builtin_types_compatible_p, .ty = Type.int, .data = .{ .bin = .{ | |
| 6290 | .lhs = lhs, | |
| 6291 | .rhs = rhs, | |
| 6292 | } } }), | |
| 6293 | }; | |
| 6294 | try p.value_map.put(res.node, res.val); | |
| 6295 | return res; | |
| 6296 | } | |
| 6297 | ||
| 6298 | fn builtinChooseExpr(p: *Parser) Error!Result { | |
| 6299 | p.tok_i += 1; | |
| 6300 | const l_paren = try p.expectToken(.l_paren); | |
| 6301 | const cond_tok = p.tok_i; | |
| 6302 | var cond = try p.integerConstExpr(.no_const_decl_folding); | |
| 6303 | if (cond.val.tag == .unavailable) { | |
| 6304 | try p.errTok(.builtin_choose_cond, cond_tok); | |
| 6305 | return error.ParsingFailed; | |
| 6306 | } | |
| 6307 | ||
| 6308 | _ = try p.expectToken(.comma); | |
| 6309 | ||
| 6310 | var then_expr = if (cond.val.getBool()) try p.assignExpr() else try p.parseNoEval(assignExpr); | |
| 6311 | try then_expr.expect(p); | |
| 6312 | ||
| 6313 | _ = try p.expectToken(.comma); | |
| 6314 | ||
| 6315 | var else_expr = if (!cond.val.getBool()) try p.assignExpr() else try p.parseNoEval(assignExpr); | |
| 6316 | try else_expr.expect(p); | |
| 6317 | ||
| 6318 | try p.expectClosing(l_paren, .r_paren); | |
| 6319 | ||
| 6320 | if (cond.val.getBool()) { | |
| 6321 | cond.val = then_expr.val; | |
| 6322 | cond.ty = then_expr.ty; | |
| 6323 | } else { | |
| 6324 | cond.val = else_expr.val; | |
| 6325 | cond.ty = else_expr.ty; | |
| 6326 | } | |
| 6327 | cond.node = try p.addNode(.{ | |
| 6328 | .tag = .builtin_choose_expr, | |
| 6329 | .ty = cond.ty, | |
| 6330 | .data = .{ .if3 = .{ .cond = cond.node, .body = (try p.addList(&.{ then_expr.node, else_expr.node })).start } }, | |
| 6331 | }); | |
| 6332 | return cond; | |
| 6333 | } | |
| 6334 | ||
| 6335 | fn builtinVaArg(p: *Parser) Error!Result { | |
| 6336 | const builtin_tok = p.tok_i; | |
| 6337 | p.tok_i += 1; | |
| 6338 | ||
| 6339 | const l_paren = try p.expectToken(.l_paren); | |
| 6340 | const va_list_tok = p.tok_i; | |
| 6341 | var va_list = try p.assignExpr(); | |
| 6342 | try va_list.expect(p); | |
| 6343 | try va_list.lvalConversion(p); | |
| 6344 | ||
| 6345 | _ = try p.expectToken(.comma); | |
| 6346 | ||
| 6347 | const ty = (try p.typeName()) orelse { | |
| 6348 | try p.err(.expected_type); | |
| 6349 | return error.ParsingFailed; | |
| 6350 | }; | |
| 6351 | try p.expectClosing(l_paren, .r_paren); | |
| 6352 | ||
| 6353 | if (!va_list.ty.eql(p.comp.types.va_list, p.comp, true)) { | |
| 6354 | try p.errStr(.incompatible_va_arg, va_list_tok, try p.typeStr(va_list.ty)); | |
| 6355 | return error.ParsingFailed; | |
| 6356 | } | |
| 6357 | ||
| 6358 | return Result{ .ty = ty, .node = try p.addNode(.{ | |
| 6359 | .tag = .special_builtin_call_one, | |
| 6360 | .ty = ty, | |
| 6361 | .data = .{ .decl = .{ .name = builtin_tok, .node = va_list.node } }, | |
| 6362 | }) }; | |
| 6363 | } | |
| 6364 | ||
| 6365 | fn builtinOffsetof(p: *Parser, want_bits: bool) Error!Result { | |
| 6366 | const builtin_tok = p.tok_i; | |
| 6367 | p.tok_i += 1; | |
| 6368 | ||
| 6369 | const l_paren = try p.expectToken(.l_paren); | |
| 6370 | const ty_tok = p.tok_i; | |
| 6371 | ||
| 6372 | const ty = (try p.typeName()) orelse { | |
| 6373 | try p.err(.expected_type); | |
| 6374 | p.skipTo(.r_paren); | |
| 6375 | return error.ParsingFailed; | |
| 6376 | }; | |
| 6377 | ||
| 6378 | if (!ty.isRecord()) { | |
| 6379 | try p.errStr(.offsetof_ty, ty_tok, try p.typeStr(ty)); | |
| 6380 | p.skipTo(.r_paren); | |
| 6381 | return error.ParsingFailed; | |
| 6382 | } else if (ty.hasIncompleteSize()) { | |
| 6383 | try p.errStr(.offsetof_incomplete, ty_tok, try p.typeStr(ty)); | |
| 6384 | p.skipTo(.r_paren); | |
| 6385 | return error.ParsingFailed; | |
| 6386 | } | |
| 6387 | ||
| 6388 | _ = try p.expectToken(.comma); | |
| 6389 | ||
| 6390 | const offsetof_expr = try p.offsetofMemberDesignator(ty); | |
| 6391 | ||
| 6392 | try p.expectClosing(l_paren, .r_paren); | |
| 6393 | ||
| 6394 | return Result{ | |
| 6395 | .ty = p.comp.types.size, | |
| 6396 | .val = if (offsetof_expr.val.tag == .int and !want_bits) | |
| 6397 | Value.int(offsetof_expr.val.data.int / 8) | |
| 6398 | else | |
| 6399 | offsetof_expr.val, | |
| 6400 | .node = try p.addNode(.{ | |
| 6401 | .tag = .special_builtin_call_one, | |
| 6402 | .ty = p.comp.types.size, | |
| 6403 | .data = .{ .decl = .{ .name = builtin_tok, .node = offsetof_expr.node } }, | |
| 6404 | }), | |
| 6405 | }; | |
| 6406 | } | |
| 6407 | ||
| 6408 | /// offsetofMemberDesignator: IDENTIFIER ('.' IDENTIFIER | '[' expr ']' )* | |
| 6409 | fn offsetofMemberDesignator(p: *Parser, base_ty: Type) Error!Result { | |
| 6410 | errdefer p.skipTo(.r_paren); | |
| 6411 | const base_field_name_tok = try p.expectIdentifier(); | |
| 6412 | const base_field_name = try p.comp.intern(p.tokSlice(base_field_name_tok)); | |
| 6413 | try p.validateFieldAccess(base_ty, base_ty, base_field_name_tok, base_field_name); | |
| 6414 | const base_node = try p.addNode(.{ .tag = .default_init_expr, .ty = base_ty, .data = undefined }); | |
| 6415 | ||
| 6416 | var offset_num: u64 = 0; | |
| 6417 | const base_record_ty = base_ty.canonicalize(.standard); | |
| 6418 | var lhs = try p.fieldAccessExtra(base_node, base_record_ty, base_field_name, false, &offset_num); | |
| 6419 | var bit_offset = Value.int(offset_num); | |
| 6420 | ||
| 6421 | while (true) switch (p.tok_ids[p.tok_i]) { | |
| 6422 | .period => { | |
| 6423 | p.tok_i += 1; | |
| 6424 | const field_name_tok = try p.expectIdentifier(); | |
| 6425 | const field_name = try p.comp.intern(p.tokSlice(field_name_tok)); | |
| 6426 | ||
| 6427 | if (!lhs.ty.isRecord()) { | |
| 6428 | try p.errStr(.offsetof_ty, field_name_tok, try p.typeStr(lhs.ty)); | |
| 6429 | return error.ParsingFailed; | |
| 6430 | } | |
| 6431 | try p.validateFieldAccess(lhs.ty, lhs.ty, field_name_tok, field_name); | |
| 6432 | const record_ty = lhs.ty.canonicalize(.standard); | |
| 6433 | lhs = try p.fieldAccessExtra(lhs.node, record_ty, field_name, false, &offset_num); | |
| 6434 | if (bit_offset.tag != .unavailable) { | |
| 6435 | bit_offset = Value.int(offset_num + bit_offset.getInt(u64)); | |
| 6436 | } | |
| 6437 | }, | |
| 6438 | .l_bracket => { | |
| 6439 | const l_bracket_tok = p.tok_i; | |
| 6440 | p.tok_i += 1; | |
| 6441 | var index = try p.expr(); | |
| 6442 | try index.expect(p); | |
| 6443 | _ = try p.expectClosing(l_bracket_tok, .r_bracket); | |
| 6444 | ||
| 6445 | if (!lhs.ty.isArray()) { | |
| 6446 | try p.errStr(.offsetof_array, l_bracket_tok, try p.typeStr(lhs.ty)); | |
| 6447 | return error.ParsingFailed; | |
| 6448 | } | |
| 6449 | var ptr = lhs; | |
| 6450 | try ptr.lvalConversion(p); | |
| 6451 | try index.lvalConversion(p); | |
| 6452 | ||
| 6453 | if (!index.ty.isInt()) try p.errTok(.invalid_index, l_bracket_tok); | |
| 6454 | try p.checkArrayBounds(index, lhs, l_bracket_tok); | |
| 6455 | ||
| 6456 | try index.saveValue(p); | |
| 6457 | try ptr.bin(p, .array_access_expr, index); | |
| 6458 | lhs = ptr; | |
| 6459 | }, | |
| 6460 | else => break, | |
| 6461 | }; | |
| 6462 | ||
| 6463 | return Result{ .ty = base_ty, .val = bit_offset, .node = lhs.node }; | |
| 6464 | } | |
| 6465 | ||
| 6466 | /// unExpr | |
| 6467 | /// : (compoundLiteral | primaryExpr) suffixExpr* | |
| 6468 | /// | '&&' IDENTIFIER | |
| 6469 | /// | ('&' | '*' | '+' | '-' | '~' | '!' | '++' | '--' | keyword_extension | keyword_imag | keyword_real) castExpr | |
| 6470 | /// | keyword_sizeof unExpr | |
| 6471 | /// | keyword_sizeof '(' typeName ')' | |
| 6472 | /// | keyword_alignof '(' typeName ')' | |
| 6473 | /// | keyword_c23_alignof '(' typeName ')' | |
| 6474 | fn unExpr(p: *Parser) Error!Result { | |
| 6475 | const tok = p.tok_i; | |
| 6476 | switch (p.tok_ids[tok]) { | |
| 6477 | .ampersand_ampersand => { | |
| 6478 | const address_tok = p.tok_i; | |
| 6479 | p.tok_i += 1; | |
| 6480 | const name_tok = try p.expectIdentifier(); | |
| 6481 | try p.errTok(.gnu_label_as_value, address_tok); | |
| 6482 | p.contains_address_of_label = true; | |
| 6483 | ||
| 6484 | const str = p.tokSlice(name_tok); | |
| 6485 | if (p.findLabel(str) == null) { | |
| 6486 | try p.labels.append(.{ .unresolved_goto = name_tok }); | |
| 6487 | } | |
| 6488 | const elem_ty = try p.arena.create(Type); | |
| 6489 | elem_ty.* = .{ .specifier = .void }; | |
| 6490 | const result_ty = Type{ .specifier = .pointer, .data = .{ .sub_type = elem_ty } }; | |
| 6491 | return Result{ | |
| 6492 | .node = try p.addNode(.{ | |
| 6493 | .tag = .addr_of_label, | |
| 6494 | .data = .{ .decl_ref = name_tok }, | |
| 6495 | .ty = result_ty, | |
| 6496 | }), | |
| 6497 | .ty = result_ty, | |
| 6498 | }; | |
| 6499 | }, | |
| 6500 | .ampersand => { | |
| 6501 | if (p.in_macro) { | |
| 6502 | try p.err(.invalid_preproc_operator); | |
| 6503 | return error.ParsingFailed; | |
| 6504 | } | |
| 6505 | p.tok_i += 1; | |
| 6506 | var operand = try p.castExpr(); | |
| 6507 | try operand.expect(p); | |
| 6508 | ||
| 6509 | const slice = p.nodes.slice(); | |
| 6510 | if (p.getNode(operand.node, .member_access_expr) orelse p.getNode(operand.node, .member_access_ptr_expr)) |member_node| { | |
| 6511 | if (Tree.isBitfield(slice, member_node)) try p.errTok(.addr_of_bitfield, tok); | |
| 6512 | } | |
| 6513 | if (!Tree.isLval(slice, p.data.items, p.value_map, operand.node)) { | |
| 6514 | try p.errTok(.addr_of_rvalue, tok); | |
| 6515 | } | |
| 6516 | if (operand.ty.qual.register) try p.errTok(.addr_of_register, tok); | |
| 6517 | ||
| 6518 | const elem_ty = try p.arena.create(Type); | |
| 6519 | elem_ty.* = operand.ty; | |
| 6520 | operand.ty = Type{ | |
| 6521 | .specifier = .pointer, | |
| 6522 | .data = .{ .sub_type = elem_ty }, | |
| 6523 | }; | |
| 6524 | try operand.saveValue(p); | |
| 6525 | try operand.un(p, .addr_of_expr); | |
| 6526 | return operand; | |
| 6527 | }, | |
| 6528 | .asterisk => { | |
| 6529 | const asterisk_loc = p.tok_i; | |
| 6530 | p.tok_i += 1; | |
| 6531 | var operand = try p.castExpr(); | |
| 6532 | try operand.expect(p); | |
| 6533 | ||
| 6534 | if (operand.ty.isArray() or operand.ty.isPtr() or operand.ty.isFunc()) { | |
| 6535 | try operand.lvalConversion(p); | |
| 6536 | operand.ty = operand.ty.elemType(); | |
| 6537 | } else { | |
| 6538 | try p.errTok(.indirection_ptr, tok); | |
| 6539 | } | |
| 6540 | if (operand.ty.hasIncompleteSize() and !operand.ty.is(.void)) { | |
| 6541 | try p.errStr(.deref_incomplete_ty_ptr, asterisk_loc, try p.typeStr(operand.ty)); | |
| 6542 | } | |
| 6543 | operand.ty.qual = .{}; | |
| 6544 | try operand.un(p, .deref_expr); | |
| 6545 | return operand; | |
| 6546 | }, | |
| 6547 | .plus => { | |
| 6548 | p.tok_i += 1; | |
| 6549 | ||
| 6550 | var operand = try p.castExpr(); | |
| 6551 | try operand.expect(p); | |
| 6552 | try operand.lvalConversion(p); | |
| 6553 | if (!operand.ty.isInt() and !operand.ty.isFloat()) | |
| 6554 | try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); | |
| 6555 | ||
| 6556 | try operand.usualUnaryConversion(p, tok); | |
| 6557 | ||
| 6558 | return operand; | |
| 6559 | }, | |
| 6560 | .minus => { | |
| 6561 | p.tok_i += 1; | |
| 6562 | ||
| 6563 | var operand = try p.castExpr(); | |
| 6564 | try operand.expect(p); | |
| 6565 | try operand.lvalConversion(p); | |
| 6566 | if (!operand.ty.isInt() and !operand.ty.isFloat()) | |
| 6567 | try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); | |
| 6568 | ||
| 6569 | try operand.usualUnaryConversion(p, tok); | |
| 6570 | if (operand.val.tag == .int or operand.val.tag == .float) { | |
| 6571 | _ = operand.val.sub(operand.val.zero(), operand.val, operand.ty, p.comp); | |
| 6572 | } else { | |
| 6573 | operand.val.tag = .unavailable; | |
| 6574 | } | |
| 6575 | try operand.un(p, .negate_expr); | |
| 6576 | return operand; | |
| 6577 | }, | |
| 6578 | .plus_plus => { | |
| 6579 | p.tok_i += 1; | |
| 6580 | ||
| 6581 | var operand = try p.castExpr(); | |
| 6582 | try operand.expect(p); | |
| 6583 | if (!operand.ty.isScalar()) | |
| 6584 | try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); | |
| 6585 | if (operand.ty.isComplex()) | |
| 6586 | try p.errStr(.complex_prefix_postfix_op, p.tok_i, try p.typeStr(operand.ty)); | |
| 6587 | ||
| 6588 | if (!Tree.isLval(p.nodes.slice(), p.data.items, p.value_map, operand.node) or operand.ty.isConst()) { | |
| 6589 | try p.errTok(.not_assignable, tok); | |
| 6590 | return error.ParsingFailed; | |
| 6591 | } | |
| 6592 | try operand.usualUnaryConversion(p, tok); | |
| 6593 | ||
| 6594 | if (operand.val.tag == .int or operand.val.tag == .float) { | |
| 6595 | if (operand.val.add(operand.val, operand.val.one(), operand.ty, p.comp)) | |
| 6596 | try p.errOverflow(tok, operand); | |
| 6597 | } else { | |
| 6598 | operand.val.tag = .unavailable; | |
| 6599 | } | |
| 6600 | ||
| 6601 | try operand.un(p, .pre_inc_expr); | |
| 6602 | return operand; | |
| 6603 | }, | |
| 6604 | .minus_minus => { | |
| 6605 | p.tok_i += 1; | |
| 6606 | ||
| 6607 | var operand = try p.castExpr(); | |
| 6608 | try operand.expect(p); | |
| 6609 | if (!operand.ty.isScalar()) | |
| 6610 | try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); | |
| 6611 | if (operand.ty.isComplex()) | |
| 6612 | try p.errStr(.complex_prefix_postfix_op, p.tok_i, try p.typeStr(operand.ty)); | |
| 6613 | ||
| 6614 | if (!Tree.isLval(p.nodes.slice(), p.data.items, p.value_map, operand.node) or operand.ty.isConst()) { | |
| 6615 | try p.errTok(.not_assignable, tok); | |
| 6616 | return error.ParsingFailed; | |
| 6617 | } | |
| 6618 | try operand.usualUnaryConversion(p, tok); | |
| 6619 | ||
| 6620 | if (operand.val.tag == .int or operand.val.tag == .float) { | |
| 6621 | if (operand.val.sub(operand.val, operand.val.one(), operand.ty, p.comp)) | |
| 6622 | try p.errOverflow(tok, operand); | |
| 6623 | } else { | |
| 6624 | operand.val.tag = .unavailable; | |
| 6625 | } | |
| 6626 | ||
| 6627 | try operand.un(p, .pre_dec_expr); | |
| 6628 | return operand; | |
| 6629 | }, | |
| 6630 | .tilde => { | |
| 6631 | p.tok_i += 1; | |
| 6632 | ||
| 6633 | var operand = try p.castExpr(); | |
| 6634 | try operand.expect(p); | |
| 6635 | try operand.lvalConversion(p); | |
| 6636 | try operand.usualUnaryConversion(p, tok); | |
| 6637 | if (operand.ty.isInt()) { | |
| 6638 | if (operand.val.tag == .int) { | |
| 6639 | operand.val = operand.val.bitNot(operand.ty, p.comp); | |
| 6640 | } | |
| 6641 | } else { | |
| 6642 | try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); | |
| 6643 | operand.val.tag = .unavailable; | |
| 6644 | } | |
| 6645 | try operand.un(p, .bit_not_expr); | |
| 6646 | return operand; | |
| 6647 | }, | |
| 6648 | .bang => { | |
| 6649 | p.tok_i += 1; | |
| 6650 | ||
| 6651 | var operand = try p.castExpr(); | |
| 6652 | try operand.expect(p); | |
| 6653 | try operand.lvalConversion(p); | |
| 6654 | if (!operand.ty.isScalar()) | |
| 6655 | try p.errStr(.invalid_argument_un, tok, try p.typeStr(operand.ty)); | |
| 6656 | ||
| 6657 | try operand.usualUnaryConversion(p, tok); | |
| 6658 | if (operand.val.tag == .int) { | |
| 6659 | const res = Value.int(@intFromBool(!operand.val.getBool())); | |
| 6660 | operand.val = res; | |
| 6661 | } else if (operand.val.tag == .nullptr_t) { | |
| 6662 | operand.val = Value.int(1); | |
| 6663 | } else { | |
| 6664 | if (operand.ty.isDecayed()) { | |
| 6665 | operand.val = Value.int(0); | |
| 6666 | } else { | |
| 6667 | operand.val.tag = .unavailable; | |
| 6668 | } | |
| 6669 | } | |
| 6670 | operand.ty = .{ .specifier = .int }; | |
| 6671 | try operand.un(p, .bool_not_expr); | |
| 6672 | return operand; | |
| 6673 | }, | |
| 6674 | .keyword_sizeof => { | |
| 6675 | p.tok_i += 1; | |
| 6676 | const expected_paren = p.tok_i; | |
| 6677 | var res = Result{}; | |
| 6678 | if (try p.typeName()) |ty| { | |
| 6679 | res.ty = ty; | |
| 6680 | try p.errTok(.expected_parens_around_typename, expected_paren); | |
| 6681 | } else if (p.eatToken(.l_paren)) |l_paren| { | |
| 6682 | if (try p.typeName()) |ty| { | |
| 6683 | res.ty = ty; | |
| 6684 | try p.expectClosing(l_paren, .r_paren); | |
| 6685 | } else { | |
| 6686 | p.tok_i = expected_paren; | |
| 6687 | res = try p.parseNoEval(unExpr); | |
| 6688 | } | |
| 6689 | } else { | |
| 6690 | res = try p.parseNoEval(unExpr); | |
| 6691 | } | |
| 6692 | ||
| 6693 | if (res.ty.is(.void)) { | |
| 6694 | try p.errStr(.pointer_arith_void, tok, "sizeof"); | |
| 6695 | } else if (res.ty.isDecayed()) { | |
| 6696 | const array_ty = res.ty.originalTypeOfDecayedArray(); | |
| 6697 | const err_str = try p.typePairStrExtra(res.ty, " instead of ", array_ty); | |
| 6698 | try p.errStr(.sizeof_array_arg, tok, err_str); | |
| 6699 | } | |
| 6700 | if (res.ty.sizeof(p.comp)) |size| { | |
| 6701 | if (size == 0) { | |
| 6702 | try p.errTok(.sizeof_returns_zero, tok); | |
| 6703 | } | |
| 6704 | res.val = Value.int(size); | |
| 6705 | res.ty = p.comp.types.size; | |
| 6706 | } else { | |
| 6707 | res.val.tag = .unavailable; | |
| 6708 | if (res.ty.hasIncompleteSize()) { | |
| 6709 | try p.errStr(.invalid_sizeof, expected_paren - 1, try p.typeStr(res.ty)); | |
| 6710 | res.ty = Type.invalid; | |
| 6711 | } else { | |
| 6712 | res.ty = p.comp.types.size; | |
| 6713 | } | |
| 6714 | } | |
| 6715 | try res.un(p, .sizeof_expr); | |
| 6716 | return res; | |
| 6717 | }, | |
| 6718 | .keyword_alignof, | |
| 6719 | .keyword_alignof1, | |
| 6720 | .keyword_alignof2, | |
| 6721 | .keyword_c23_alignof, | |
| 6722 | => { | |
| 6723 | p.tok_i += 1; | |
| 6724 | const expected_paren = p.tok_i; | |
| 6725 | var res = Result{}; | |
| 6726 | if (try p.typeName()) |ty| { | |
| 6727 | res.ty = ty; | |
| 6728 | try p.errTok(.expected_parens_around_typename, expected_paren); | |
| 6729 | } else if (p.eatToken(.l_paren)) |l_paren| { | |
| 6730 | if (try p.typeName()) |ty| { | |
| 6731 | res.ty = ty; | |
| 6732 | try p.expectClosing(l_paren, .r_paren); | |
| 6733 | } else { | |
| 6734 | p.tok_i = expected_paren; | |
| 6735 | res = try p.parseNoEval(unExpr); | |
| 6736 | try p.errTok(.alignof_expr, expected_paren); | |
| 6737 | } | |
| 6738 | } else { | |
| 6739 | res = try p.parseNoEval(unExpr); | |
| 6740 | try p.errTok(.alignof_expr, expected_paren); | |
| 6741 | } | |
| 6742 | ||
| 6743 | if (res.ty.is(.void)) { | |
| 6744 | try p.errStr(.pointer_arith_void, tok, "alignof"); | |
| 6745 | } | |
| 6746 | if (res.ty.alignable()) { | |
| 6747 | res.val = Value.int(res.ty.alignof(p.comp)); | |
| 6748 | res.ty = p.comp.types.size; | |
| 6749 | } else { | |
| 6750 | try p.errStr(.invalid_alignof, expected_paren, try p.typeStr(res.ty)); | |
| 6751 | res.ty = Type.invalid; | |
| 6752 | } | |
| 6753 | try res.un(p, .alignof_expr); | |
| 6754 | return res; | |
| 6755 | }, | |
| 6756 | .keyword_extension => { | |
| 6757 | p.tok_i += 1; | |
| 6758 | const saved_extension = p.extension_suppressed; | |
| 6759 | defer p.extension_suppressed = saved_extension; | |
| 6760 | p.extension_suppressed = true; | |
| 6761 | ||
| 6762 | var child = try p.castExpr(); | |
| 6763 | try child.expect(p); | |
| 6764 | return child; | |
| 6765 | }, | |
| 6766 | .keyword_imag1, .keyword_imag2 => { | |
| 6767 | const imag_tok = p.tok_i; | |
| 6768 | p.tok_i += 1; | |
| 6769 | ||
| 6770 | var operand = try p.castExpr(); | |
| 6771 | try operand.expect(p); | |
| 6772 | try operand.lvalConversion(p); | |
| 6773 | if (!operand.ty.isInt() and !operand.ty.isFloat()) { | |
| 6774 | try p.errStr(.invalid_imag, imag_tok, try p.typeStr(operand.ty)); | |
| 6775 | } | |
| 6776 | if (operand.ty.isReal()) { | |
| 6777 | switch (p.comp.langopts.emulate) { | |
| 6778 | .msvc => {}, // Doesn't support `_Complex` or `__imag` in the first place | |
| 6779 | .gcc => { | |
| 6780 | if (operand.ty.isInt()) { | |
| 6781 | operand.val = Value.int(0); | |
| 6782 | } else if (operand.ty.isFloat()) { | |
| 6783 | operand.val = Value.float(0); | |
| 6784 | } | |
| 6785 | }, | |
| 6786 | .clang => { | |
| 6787 | if (operand.val.tag == .int) { | |
| 6788 | operand.val = Value.int(0); | |
| 6789 | } else { | |
| 6790 | operand.val.tag = .unavailable; | |
| 6791 | } | |
| 6792 | }, | |
| 6793 | } | |
| 6794 | } | |
| 6795 | // convert _Complex T to T | |
| 6796 | operand.ty = operand.ty.makeReal(); | |
| 6797 | try operand.un(p, .imag_expr); | |
| 6798 | return operand; | |
| 6799 | }, | |
| 6800 | .keyword_real1, .keyword_real2 => { | |
| 6801 | const real_tok = p.tok_i; | |
| 6802 | p.tok_i += 1; | |
| 6803 | ||
| 6804 | var operand = try p.castExpr(); | |
| 6805 | try operand.expect(p); | |
| 6806 | try operand.lvalConversion(p); | |
| 6807 | if (!operand.ty.isInt() and !operand.ty.isFloat()) { | |
| 6808 | try p.errStr(.invalid_real, real_tok, try p.typeStr(operand.ty)); | |
| 6809 | } | |
| 6810 | // convert _Complex T to T | |
| 6811 | operand.ty = operand.ty.makeReal(); | |
| 6812 | try operand.un(p, .real_expr); | |
| 6813 | return operand; | |
| 6814 | }, | |
| 6815 | else => { | |
| 6816 | var lhs = try p.compoundLiteral(); | |
| 6817 | if (lhs.empty(p)) { | |
| 6818 | lhs = try p.primaryExpr(); | |
| 6819 | if (lhs.empty(p)) return lhs; | |
| 6820 | } | |
| 6821 | while (true) { | |
| 6822 | const suffix = try p.suffixExpr(lhs); | |
| 6823 | if (suffix.empty(p)) break; | |
| 6824 | lhs = suffix; | |
| 6825 | } | |
| 6826 | return lhs; | |
| 6827 | }, | |
| 6828 | } | |
| 6829 | } | |
| 6830 | ||
| 6831 | /// compoundLiteral | |
| 6832 | /// : '(' type_name ')' '{' initializer_list '}' | |
| 6833 | /// | '(' type_name ')' '{' initializer_list ',' '}' | |
| 6834 | fn compoundLiteral(p: *Parser) Error!Result { | |
| 6835 | const l_paren = p.eatToken(.l_paren) orelse return Result{}; | |
| 6836 | const ty = (try p.typeName()) orelse { | |
| 6837 | p.tok_i = l_paren; | |
| 6838 | return Result{}; | |
| 6839 | }; | |
| 6840 | try p.expectClosing(l_paren, .r_paren); | |
| 6841 | ||
| 6842 | if (ty.isFunc()) { | |
| 6843 | try p.err(.func_init); | |
| 6844 | } else if (ty.is(.variable_len_array)) { | |
| 6845 | try p.err(.vla_init); | |
| 6846 | } else if (ty.hasIncompleteSize() and !ty.is(.incomplete_array)) { | |
| 6847 | try p.errStr(.variable_incomplete_ty, p.tok_i, try p.typeStr(ty)); | |
| 6848 | return error.ParsingFailed; | |
| 6849 | } | |
| 6850 | var init_list_expr = try p.initializer(ty); | |
| 6851 | try init_list_expr.un(p, .compound_literal_expr); | |
| 6852 | return init_list_expr; | |
| 6853 | } | |
| 6854 | ||
| 6855 | /// suffixExpr | |
| 6856 | /// : '[' expr ']' | |
| 6857 | /// | '(' argumentExprList? ')' | |
| 6858 | /// | '.' IDENTIFIER | |
| 6859 | /// | '->' IDENTIFIER | |
| 6860 | /// | '++' | |
| 6861 | /// | '--' | |
| 6862 | /// argumentExprList : assignExpr (',' assignExpr)* | |
| 6863 | fn suffixExpr(p: *Parser, lhs: Result) Error!Result { | |
| 6864 | assert(!lhs.empty(p)); | |
| 6865 | switch (p.tok_ids[p.tok_i]) { | |
| 6866 | .l_paren => return p.callExpr(lhs), | |
| 6867 | .plus_plus => { | |
| 6868 | defer p.tok_i += 1; | |
| 6869 | ||
| 6870 | var operand = lhs; | |
| 6871 | if (!operand.ty.isScalar()) | |
| 6872 | try p.errStr(.invalid_argument_un, p.tok_i, try p.typeStr(operand.ty)); | |
| 6873 | if (operand.ty.isComplex()) | |
| 6874 | try p.errStr(.complex_prefix_postfix_op, p.tok_i, try p.typeStr(operand.ty)); | |
| 6875 | ||
| 6876 | if (!Tree.isLval(p.nodes.slice(), p.data.items, p.value_map, operand.node) or operand.ty.isConst()) { | |
| 6877 | try p.err(.not_assignable); | |
| 6878 | return error.ParsingFailed; | |
| 6879 | } | |
| 6880 | try operand.usualUnaryConversion(p, p.tok_i); | |
| 6881 | ||
| 6882 | try operand.un(p, .post_inc_expr); | |
| 6883 | return operand; | |
| 6884 | }, | |
| 6885 | .minus_minus => { | |
| 6886 | defer p.tok_i += 1; | |
| 6887 | ||
| 6888 | var operand = lhs; | |
| 6889 | if (!operand.ty.isScalar()) | |
| 6890 | try p.errStr(.invalid_argument_un, p.tok_i, try p.typeStr(operand.ty)); | |
| 6891 | if (operand.ty.isComplex()) | |
| 6892 | try p.errStr(.complex_prefix_postfix_op, p.tok_i, try p.typeStr(operand.ty)); | |
| 6893 | ||
| 6894 | if (!Tree.isLval(p.nodes.slice(), p.data.items, p.value_map, operand.node) or operand.ty.isConst()) { | |
| 6895 | try p.err(.not_assignable); | |
| 6896 | return error.ParsingFailed; | |
| 6897 | } | |
| 6898 | try operand.usualUnaryConversion(p, p.tok_i); | |
| 6899 | ||
| 6900 | try operand.un(p, .post_dec_expr); | |
| 6901 | return operand; | |
| 6902 | }, | |
| 6903 | .l_bracket => { | |
| 6904 | const l_bracket = p.tok_i; | |
| 6905 | p.tok_i += 1; | |
| 6906 | var index = try p.expr(); | |
| 6907 | try index.expect(p); | |
| 6908 | try p.expectClosing(l_bracket, .r_bracket); | |
| 6909 | ||
| 6910 | const array_before_conversion = lhs; | |
| 6911 | const index_before_conversion = index; | |
| 6912 | var ptr = lhs; | |
| 6913 | try ptr.lvalConversion(p); | |
| 6914 | try index.lvalConversion(p); | |
| 6915 | if (ptr.ty.isPtr()) { | |
| 6916 | ptr.ty = ptr.ty.elemType(); | |
| 6917 | if (!index.ty.isInt()) try p.errTok(.invalid_index, l_bracket); | |
| 6918 | try p.checkArrayBounds(index_before_conversion, array_before_conversion, l_bracket); | |
| 6919 | } else if (index.ty.isPtr()) { | |
| 6920 | index.ty = index.ty.elemType(); | |
| 6921 | if (!ptr.ty.isInt()) try p.errTok(.invalid_index, l_bracket); | |
| 6922 | try p.checkArrayBounds(array_before_conversion, index_before_conversion, l_bracket); | |
| 6923 | std.mem.swap(Result, &ptr, &index); | |
| 6924 | } else { | |
| 6925 | try p.errTok(.invalid_subscript, l_bracket); | |
| 6926 | } | |
| 6927 | ||
| 6928 | try ptr.saveValue(p); | |
| 6929 | try index.saveValue(p); | |
| 6930 | try ptr.bin(p, .array_access_expr, index); | |
| 6931 | return ptr; | |
| 6932 | }, | |
| 6933 | .period => { | |
| 6934 | p.tok_i += 1; | |
| 6935 | const name = try p.expectIdentifier(); | |
| 6936 | return p.fieldAccess(lhs, name, false); | |
| 6937 | }, | |
| 6938 | .arrow => { | |
| 6939 | p.tok_i += 1; | |
| 6940 | const name = try p.expectIdentifier(); | |
| 6941 | if (lhs.ty.isArray()) { | |
| 6942 | var copy = lhs; | |
| 6943 | copy.ty.decayArray(); | |
| 6944 | try copy.implicitCast(p, .array_to_pointer); | |
| 6945 | return p.fieldAccess(copy, name, true); | |
| 6946 | } | |
| 6947 | return p.fieldAccess(lhs, name, true); | |
| 6948 | }, | |
| 6949 | else => return Result{}, | |
| 6950 | } | |
| 6951 | } | |
| 6952 | ||
| 6953 | fn fieldAccess( | |
| 6954 | p: *Parser, | |
| 6955 | lhs: Result, | |
| 6956 | field_name_tok: TokenIndex, | |
| 6957 | is_arrow: bool, | |
| 6958 | ) !Result { | |
| 6959 | const expr_ty = lhs.ty; | |
| 6960 | const is_ptr = expr_ty.isPtr(); | |
| 6961 | const expr_base_ty = if (is_ptr) expr_ty.elemType() else expr_ty; | |
| 6962 | const record_ty = expr_base_ty.canonicalize(.standard); | |
| 6963 | ||
| 6964 | switch (record_ty.specifier) { | |
| 6965 | .@"struct", .@"union" => {}, | |
| 6966 | else => { | |
| 6967 | try p.errStr(.expected_record_ty, field_name_tok, try p.typeStr(expr_ty)); | |
| 6968 | return error.ParsingFailed; | |
| 6969 | }, | |
| 6970 | } | |
| 6971 | if (record_ty.hasIncompleteSize()) { | |
| 6972 | try p.errStr(.deref_incomplete_ty_ptr, field_name_tok - 2, try p.typeStr(expr_base_ty)); | |
| 6973 | return error.ParsingFailed; | |
| 6974 | } | |
| 6975 | if (is_arrow and !is_ptr) try p.errStr(.member_expr_not_ptr, field_name_tok, try p.typeStr(expr_ty)); | |
| 6976 | if (!is_arrow and is_ptr) try p.errStr(.member_expr_ptr, field_name_tok, try p.typeStr(expr_ty)); | |
| 6977 | ||
| 6978 | const field_name = try p.comp.intern(p.tokSlice(field_name_tok)); | |
| 6979 | try p.validateFieldAccess(record_ty, expr_ty, field_name_tok, field_name); | |
| 6980 | var discard: u64 = 0; | |
| 6981 | return p.fieldAccessExtra(lhs.node, record_ty, field_name, is_arrow, &discard); | |
| 6982 | } | |
| 6983 | ||
| 6984 | fn validateFieldAccess(p: *Parser, record_ty: Type, expr_ty: Type, field_name_tok: TokenIndex, field_name: StringId) Error!void { | |
| 6985 | if (record_ty.hasField(field_name)) return; | |
| 6986 | ||
| 6987 | p.strings.items.len = 0; | |
| 6988 | ||
| 6989 | try p.strings.writer().print("'{s}' in '", .{p.tokSlice(field_name_tok)}); | |
| 6990 | const mapper = p.comp.string_interner.getSlowTypeMapper(); | |
| 6991 | try expr_ty.print(mapper, p.comp.langopts, p.strings.writer()); | |
| 6992 | try p.strings.append('\''); | |
| 6993 | ||
| 6994 | const duped = try p.comp.diag.arena.allocator().dupe(u8, p.strings.items); | |
| 6995 | try p.errStr(.no_such_member, field_name_tok, duped); | |
| 6996 | return error.ParsingFailed; | |
| 6997 | } | |
| 6998 | ||
| 6999 | fn fieldAccessExtra(p: *Parser, lhs: NodeIndex, record_ty: Type, field_name: StringId, is_arrow: bool, offset_bits: *u64) Error!Result { | |
| 7000 | for (record_ty.data.record.fields, 0..) |f, i| { | |
| 7001 | if (f.isAnonymousRecord()) { | |
| 7002 | if (!f.ty.hasField(field_name)) continue; | |
| 7003 | const inner = try p.addNode(.{ | |
| 7004 | .tag = if (is_arrow) .member_access_ptr_expr else .member_access_expr, | |
| 7005 | .ty = f.ty, | |
| 7006 | .data = .{ .member = .{ .lhs = lhs, .index = @intCast(i) } }, | |
| 7007 | }); | |
| 7008 | const ret = p.fieldAccessExtra(inner, f.ty, field_name, false, offset_bits); | |
| 7009 | offset_bits.* += f.layout.offset_bits; | |
| 7010 | return ret; | |
| 7011 | } | |
| 7012 | if (field_name == f.name) { | |
| 7013 | offset_bits.* = f.layout.offset_bits; | |
| 7014 | return Result{ | |
| 7015 | .ty = f.ty, | |
| 7016 | .node = try p.addNode(.{ | |
| 7017 | .tag = if (is_arrow) .member_access_ptr_expr else .member_access_expr, | |
| 7018 | .ty = f.ty, | |
| 7019 | .data = .{ .member = .{ .lhs = lhs, .index = @intCast(i) } }, | |
| 7020 | }), | |
| 7021 | }; | |
| 7022 | } | |
| 7023 | } | |
| 7024 | // We already checked that this container has a field by the name. | |
| 7025 | unreachable; | |
| 7026 | } | |
| 7027 | ||
| 7028 | fn checkVaStartArg(p: *Parser, builtin_tok: TokenIndex, first_after: TokenIndex, param_tok: TokenIndex, arg: *Result, idx: u32) !void { | |
| 7029 | assert(idx != 0); | |
| 7030 | if (idx > 1) { | |
| 7031 | try p.errTok(.closing_paren, first_after); | |
| 7032 | return error.ParsingFailed; | |
| 7033 | } | |
| 7034 | ||
| 7035 | var func_ty = p.func.ty orelse { | |
| 7036 | try p.errTok(.va_start_not_in_func, builtin_tok); | |
| 7037 | return; | |
| 7038 | }; | |
| 7039 | const func_params = func_ty.params(); | |
| 7040 | if (func_ty.specifier != .var_args_func or func_params.len == 0) { | |
| 7041 | return p.errTok(.va_start_fixed_args, builtin_tok); | |
| 7042 | } | |
| 7043 | const last_param_name = func_params[func_params.len - 1].name; | |
| 7044 | const decl_ref = p.getNode(arg.node, .decl_ref_expr); | |
| 7045 | if (decl_ref == null or last_param_name != try p.comp.intern(p.tokSlice(p.nodes.items(.data)[@intFromEnum(decl_ref.?)].decl_ref))) { | |
| 7046 | try p.errTok(.va_start_not_last_param, param_tok); | |
| 7047 | } | |
| 7048 | } | |
| 7049 | ||
| 7050 | fn checkComplexArg(p: *Parser, builtin_tok: TokenIndex, first_after: TokenIndex, param_tok: TokenIndex, arg: *Result, idx: u32) !void { | |
| 7051 | _ = builtin_tok; | |
| 7052 | _ = first_after; | |
| 7053 | if (idx <= 1 and !arg.ty.isFloat()) { | |
| 7054 | try p.errStr(.not_floating_type, param_tok, try p.typeStr(arg.ty)); | |
| 7055 | } else if (idx == 1) { | |
| 7056 | const prev_idx = p.list_buf.items[p.list_buf.items.len - 1]; | |
| 7057 | const prev_ty = p.nodes.items(.ty)[@intFromEnum(prev_idx)]; | |
| 7058 | if (!prev_ty.eql(arg.ty, p.comp, false)) { | |
| 7059 | try p.errStr(.argument_types_differ, param_tok, try p.typePairStrExtra(prev_ty, " vs ", arg.ty)); | |
| 7060 | } | |
| 7061 | } | |
| 7062 | } | |
| 7063 | ||
| 7064 | fn checkVariableBuiltinArgument(p: *Parser, builtin_tok: TokenIndex, first_after: TokenIndex, param_tok: TokenIndex, arg: *Result, arg_idx: u32, tag: BuiltinFunction.Tag) !void { | |
| 7065 | switch (tag) { | |
| 7066 | .__builtin_va_start, .__va_start, .va_start => return p.checkVaStartArg(builtin_tok, first_after, param_tok, arg, arg_idx), | |
| 7067 | else => {}, | |
| 7068 | } | |
| 7069 | } | |
| 7070 | ||
| 7071 | fn callExpr(p: *Parser, lhs: Result) Error!Result { | |
| 7072 | const l_paren = p.tok_i; | |
| 7073 | p.tok_i += 1; | |
| 7074 | const ty = lhs.ty.isCallable() orelse { | |
| 7075 | try p.errStr(.not_callable, l_paren, try p.typeStr(lhs.ty)); | |
| 7076 | return error.ParsingFailed; | |
| 7077 | }; | |
| 7078 | const params = ty.params(); | |
| 7079 | var func = lhs; | |
| 7080 | try func.lvalConversion(p); | |
| 7081 | ||
| 7082 | const list_buf_top = p.list_buf.items.len; | |
| 7083 | defer p.list_buf.items.len = list_buf_top; | |
| 7084 | try p.list_buf.append(func.node); | |
| 7085 | var arg_count: u32 = 0; | |
| 7086 | var first_after = l_paren; | |
| 7087 | ||
| 7088 | const call_expr = CallExpr.init(p, lhs.node, func.node); | |
| 7089 | ||
| 7090 | while (p.eatToken(.r_paren) == null) { | |
| 7091 | const param_tok = p.tok_i; | |
| 7092 | if (arg_count == params.len) first_after = p.tok_i; | |
| 7093 | var arg = try p.assignExpr(); | |
| 7094 | try arg.expect(p); | |
| 7095 | ||
| 7096 | if (call_expr.shouldPerformLvalConversion(arg_count)) { | |
| 7097 | try arg.lvalConversion(p); | |
| 7098 | } | |
| 7099 | if (arg.ty.hasIncompleteSize() and !arg.ty.is(.void)) return error.ParsingFailed; | |
| 7100 | ||
| 7101 | if (arg_count >= params.len) { | |
| 7102 | if (call_expr.shouldPromoteVarArg(arg_count)) { | |
| 7103 | if (arg.ty.isInt()) try arg.intCast(p, arg.ty.integerPromotion(p.comp), param_tok); | |
| 7104 | if (arg.ty.is(.float)) try arg.floatCast(p, .{ .specifier = .double }); | |
| 7105 | } | |
| 7106 | try call_expr.checkVarArg(p, first_after, param_tok, &arg, arg_count); | |
| 7107 | try arg.saveValue(p); | |
| 7108 | try p.list_buf.append(arg.node); | |
| 7109 | arg_count += 1; | |
| 7110 | ||
| 7111 | _ = p.eatToken(.comma) orelse { | |
| 7112 | try p.expectClosing(l_paren, .r_paren); | |
| 7113 | break; | |
| 7114 | }; | |
| 7115 | continue; | |
| 7116 | } | |
| 7117 | const p_ty = params[arg_count].ty; | |
| 7118 | if (call_expr.shouldCoerceArg(arg_count)) { | |
| 7119 | try arg.coerce(p, p_ty, param_tok, .{ .arg = params[arg_count].name_tok }); | |
| 7120 | } | |
| 7121 | try arg.saveValue(p); | |
| 7122 | try p.list_buf.append(arg.node); | |
| 7123 | arg_count += 1; | |
| 7124 | ||
| 7125 | _ = p.eatToken(.comma) orelse { | |
| 7126 | try p.expectClosing(l_paren, .r_paren); | |
| 7127 | break; | |
| 7128 | }; | |
| 7129 | } | |
| 7130 | ||
| 7131 | const actual: u32 = @intCast(arg_count); | |
| 7132 | const extra = Diagnostics.Message.Extra{ .arguments = .{ | |
| 7133 | .expected = @intCast(params.len), | |
| 7134 | .actual = actual, | |
| 7135 | } }; | |
| 7136 | if (call_expr.paramCountOverride()) |expected| { | |
| 7137 | if (expected != actual) { | |
| 7138 | try p.errExtra(.expected_arguments, first_after, .{ .arguments = .{ .expected = expected, .actual = actual } }); | |
| 7139 | } | |
| 7140 | } else if (ty.is(.func) and params.len != arg_count) { | |
| 7141 | try p.errExtra(.expected_arguments, first_after, extra); | |
| 7142 | } else if (ty.is(.old_style_func) and params.len != arg_count) { | |
| 7143 | try p.errExtra(.expected_arguments_old, first_after, extra); | |
| 7144 | } else if (ty.is(.var_args_func) and arg_count < params.len) { | |
| 7145 | try p.errExtra(.expected_at_least_arguments, first_after, extra); | |
| 7146 | } | |
| 7147 | ||
| 7148 | return call_expr.finish(p, ty, list_buf_top, arg_count); | |
| 7149 | } | |
| 7150 | ||
| 7151 | fn checkArrayBounds(p: *Parser, index: Result, array: Result, tok: TokenIndex) !void { | |
| 7152 | if (index.val.tag == .unavailable) return; | |
| 7153 | ||
| 7154 | const array_len = array.ty.arrayLen() orelse return; | |
| 7155 | if (array_len == 0) return; | |
| 7156 | ||
| 7157 | if (array_len == 1) { | |
| 7158 | if (p.getNode(array.node, .member_access_expr) orelse p.getNode(array.node, .member_access_ptr_expr)) |node| { | |
| 7159 | const data = p.nodes.items(.data)[@intFromEnum(node)]; | |
| 7160 | var lhs = p.nodes.items(.ty)[@intFromEnum(data.member.lhs)]; | |
| 7161 | if (lhs.get(.pointer)) |ptr| { | |
| 7162 | lhs = ptr.data.sub_type.*; | |
| 7163 | } | |
| 7164 | if (lhs.is(.@"struct")) { | |
| 7165 | const record = lhs.getRecord().?; | |
| 7166 | if (data.member.index + 1 == record.fields.len) { | |
| 7167 | if (!index.val.isZero()) { | |
| 7168 | try p.errExtra(.old_style_flexible_struct, tok, .{ | |
| 7169 | .unsigned = index.val.data.int, | |
| 7170 | }); | |
| 7171 | } | |
| 7172 | return; | |
| 7173 | } | |
| 7174 | } | |
| 7175 | } | |
| 7176 | } | |
| 7177 | const len = Value.int(array_len); | |
| 7178 | ||
| 7179 | if (index.ty.isUnsignedInt(p.comp)) { | |
| 7180 | if (index.val.compare(.gte, len, p.comp.types.size, p.comp)) | |
| 7181 | try p.errExtra(.array_after, tok, .{ .unsigned = index.val.data.int }); | |
| 7182 | } else { | |
| 7183 | if (index.val.compare(.lt, Value.int(0), index.ty, p.comp)) { | |
| 7184 | try p.errExtra(.array_before, tok, .{ | |
| 7185 | .signed = index.val.signExtend(index.ty, p.comp), | |
| 7186 | }); | |
| 7187 | } else if (index.val.compare(.gte, len, p.comp.types.size, p.comp)) { | |
| 7188 | try p.errExtra(.array_after, tok, .{ .unsigned = index.val.data.int }); | |
| 7189 | } | |
| 7190 | } | |
| 7191 | } | |
| 7192 | ||
| 7193 | /// primaryExpr | |
| 7194 | /// : IDENTIFIER | |
| 7195 | /// | keyword_true | |
| 7196 | /// | keyword_false | |
| 7197 | /// | keyword_nullptr | |
| 7198 | /// | INTEGER_LITERAL | |
| 7199 | /// | FLOAT_LITERAL | |
| 7200 | /// | IMAGINARY_LITERAL | |
| 7201 | /// | CHAR_LITERAL | |
| 7202 | /// | STRING_LITERAL | |
| 7203 | /// | '(' expr ')' | |
| 7204 | /// | genericSelection | |
| 7205 | fn primaryExpr(p: *Parser) Error!Result { | |
| 7206 | if (p.eatToken(.l_paren)) |l_paren| { | |
| 7207 | var e = try p.expr(); | |
| 7208 | try e.expect(p); | |
| 7209 | try p.expectClosing(l_paren, .r_paren); | |
| 7210 | try e.un(p, .paren_expr); | |
| 7211 | return e; | |
| 7212 | } | |
| 7213 | switch (p.tok_ids[p.tok_i]) { | |
| 7214 | .identifier, .extended_identifier => { | |
| 7215 | const name_tok = p.expectIdentifier() catch unreachable; | |
| 7216 | const name = p.tokSlice(name_tok); | |
| 7217 | const interned_name = try p.comp.intern(name); | |
| 7218 | if (p.syms.findSymbol(interned_name)) |sym| { | |
| 7219 | try p.checkDeprecatedUnavailable(sym.ty, name_tok, sym.tok); | |
| 7220 | if (sym.kind == .constexpr) { | |
| 7221 | return Result{ | |
| 7222 | .val = sym.val, | |
| 7223 | .ty = sym.ty, | |
| 7224 | .node = try p.addNode(.{ | |
| 7225 | .tag = .decl_ref_expr, | |
| 7226 | .ty = sym.ty, | |
| 7227 | .data = .{ .decl_ref = name_tok }, | |
| 7228 | }), | |
| 7229 | }; | |
| 7230 | } | |
| 7231 | if (sym.val.tag == .int) { | |
| 7232 | switch (p.const_decl_folding) { | |
| 7233 | .gnu_folding_extension => try p.errTok(.const_decl_folded, name_tok), | |
| 7234 | .gnu_vla_folding_extension => try p.errTok(.const_decl_folded_vla, name_tok), | |
| 7235 | else => {}, | |
| 7236 | } | |
| 7237 | } | |
| 7238 | return Result{ | |
| 7239 | .val = if (p.const_decl_folding == .no_const_decl_folding and sym.kind != .enumeration) Value{} else sym.val, | |
| 7240 | .ty = sym.ty, | |
| 7241 | .node = try p.addNode(.{ | |
| 7242 | .tag = if (sym.kind == .enumeration) .enumeration_ref else .decl_ref_expr, | |
| 7243 | .ty = sym.ty, | |
| 7244 | .data = .{ .decl_ref = name_tok }, | |
| 7245 | }), | |
| 7246 | }; | |
| 7247 | } | |
| 7248 | if (try p.comp.builtins.getOrCreate(p.comp, name, p.arena)) |some| { | |
| 7249 | for (p.tok_ids[p.tok_i..]) |id| switch (id) { | |
| 7250 | .r_paren => {}, // closing grouped expr | |
| 7251 | .l_paren => break, // beginning of a call | |
| 7252 | else => { | |
| 7253 | try p.errTok(.builtin_must_be_called, name_tok); | |
| 7254 | return error.ParsingFailed; | |
| 7255 | }, | |
| 7256 | }; | |
| 7257 | if (some.builtin.properties.header != .none) { | |
| 7258 | try p.errStr(.implicit_builtin, name_tok, name); | |
| 7259 | try p.errExtra(.implicit_builtin_header_note, name_tok, .{ .builtin_with_header = .{ | |
| 7260 | .builtin = some.builtin.tag, | |
| 7261 | .header = some.builtin.properties.header, | |
| 7262 | } }); | |
| 7263 | } | |
| 7264 | ||
| 7265 | return Result{ | |
| 7266 | .ty = some.ty, | |
| 7267 | .node = try p.addNode(.{ | |
| 7268 | .tag = .builtin_call_expr_one, | |
| 7269 | .ty = some.ty, | |
| 7270 | .data = .{ .decl = .{ .name = name_tok, .node = .none } }, | |
| 7271 | }), | |
| 7272 | }; | |
| 7273 | } | |
| 7274 | if (p.tok_ids[p.tok_i] == .l_paren) { | |
| 7275 | // allow implicitly declaring functions before C99 like `puts("foo")` | |
| 7276 | if (mem.startsWith(u8, name, "__builtin_")) | |
| 7277 | try p.errStr(.unknown_builtin, name_tok, name) | |
| 7278 | else | |
| 7279 | try p.errStr(.implicit_func_decl, name_tok, name); | |
| 7280 | ||
| 7281 | const func_ty = try p.arena.create(Type.Func); | |
| 7282 | func_ty.* = .{ .return_type = .{ .specifier = .int }, .params = &.{} }; | |
| 7283 | const ty: Type = .{ .specifier = .old_style_func, .data = .{ .func = func_ty } }; | |
| 7284 | const node = try p.addNode(.{ | |
| 7285 | .ty = ty, | |
| 7286 | .tag = .fn_proto, | |
| 7287 | .data = .{ .decl = .{ .name = name_tok } }, | |
| 7288 | }); | |
| 7289 | ||
| 7290 | try p.decl_buf.append(node); | |
| 7291 | try p.syms.declareSymbol(p, interned_name, ty, name_tok, node); | |
| 7292 | ||
| 7293 | return Result{ | |
| 7294 | .ty = ty, | |
| 7295 | .node = try p.addNode(.{ | |
| 7296 | .tag = .decl_ref_expr, | |
| 7297 | .ty = ty, | |
| 7298 | .data = .{ .decl_ref = name_tok }, | |
| 7299 | }), | |
| 7300 | }; | |
| 7301 | } | |
| 7302 | try p.errStr(.undeclared_identifier, name_tok, p.tokSlice(name_tok)); | |
| 7303 | return error.ParsingFailed; | |
| 7304 | }, | |
| 7305 | .keyword_true, .keyword_false => |id| { | |
| 7306 | p.tok_i += 1; | |
| 7307 | const numeric_value = @intFromBool(id == .keyword_true); | |
| 7308 | const res = Result{ | |
| 7309 | .val = Value.int(numeric_value), | |
| 7310 | .ty = .{ .specifier = .bool }, | |
| 7311 | .node = try p.addNode(.{ | |
| 7312 | .tag = .bool_literal, | |
| 7313 | .ty = .{ .specifier = .bool }, | |
| 7314 | .data = .{ .int = numeric_value }, | |
| 7315 | }), | |
| 7316 | }; | |
| 7317 | std.debug.assert(!p.in_macro); // Should have been replaced with .one / .zero | |
| 7318 | try p.value_map.put(res.node, res.val); | |
| 7319 | return res; | |
| 7320 | }, | |
| 7321 | .keyword_nullptr => { | |
| 7322 | defer p.tok_i += 1; | |
| 7323 | try p.errStr(.pre_c2x_compat, p.tok_i, "'nullptr'"); | |
| 7324 | return Result{ | |
| 7325 | .val = .{ .tag = .nullptr_t }, | |
| 7326 | .ty = .{ .specifier = .nullptr_t }, | |
| 7327 | .node = try p.addNode(.{ | |
| 7328 | .tag = .nullptr_literal, | |
| 7329 | .ty = .{ .specifier = .nullptr_t }, | |
| 7330 | .data = undefined, | |
| 7331 | }), | |
| 7332 | }; | |
| 7333 | }, | |
| 7334 | .macro_func, .macro_function => { | |
| 7335 | defer p.tok_i += 1; | |
| 7336 | var ty: Type = undefined; | |
| 7337 | var tok = p.tok_i; | |
| 7338 | if (p.func.ident) |some| { | |
| 7339 | ty = some.ty; | |
| 7340 | tok = p.nodes.items(.data)[@intFromEnum(some.node)].decl.name; | |
| 7341 | } else if (p.func.ty) |_| { | |
| 7342 | const start: u32 = @intCast(p.retained_strings.items.len); | |
| 7343 | try p.retained_strings.appendSlice(p.tokSlice(p.func.name)); | |
| 7344 | try p.retained_strings.append(0); | |
| 7345 | const predef = try p.makePredefinedIdentifier(start); | |
| 7346 | ty = predef.ty; | |
| 7347 | p.func.ident = predef; | |
| 7348 | } else { | |
| 7349 | const start: u32 = @intCast(p.retained_strings.items.len); | |
| 7350 | try p.retained_strings.append(0); | |
| 7351 | const predef = try p.makePredefinedIdentifier(start); | |
| 7352 | ty = predef.ty; | |
| 7353 | p.func.ident = predef; | |
| 7354 | try p.decl_buf.append(predef.node); | |
| 7355 | } | |
| 7356 | if (p.func.ty == null) try p.err(.predefined_top_level); | |
| 7357 | return Result{ | |
| 7358 | .ty = ty, | |
| 7359 | .node = try p.addNode(.{ | |
| 7360 | .tag = .decl_ref_expr, | |
| 7361 | .ty = ty, | |
| 7362 | .data = .{ .decl_ref = tok }, | |
| 7363 | }), | |
| 7364 | }; | |
| 7365 | }, | |
| 7366 | .macro_pretty_func => { | |
| 7367 | defer p.tok_i += 1; | |
| 7368 | var ty: Type = undefined; | |
| 7369 | if (p.func.pretty_ident) |some| { | |
| 7370 | ty = some.ty; | |
| 7371 | } else if (p.func.ty) |func_ty| { | |
| 7372 | const mapper = p.comp.string_interner.getSlowTypeMapper(); | |
| 7373 | const start: u32 = @intCast(p.retained_strings.items.len); | |
| 7374 | try Type.printNamed(func_ty, p.tokSlice(p.func.name), mapper, p.comp.langopts, p.retained_strings.writer()); | |
| 7375 | try p.retained_strings.append(0); | |
| 7376 | const predef = try p.makePredefinedIdentifier(start); | |
| 7377 | ty = predef.ty; | |
| 7378 | p.func.pretty_ident = predef; | |
| 7379 | } else { | |
| 7380 | const start: u32 = @intCast(p.retained_strings.items.len); | |
| 7381 | try p.retained_strings.appendSlice("top level\x00"); | |
| 7382 | const predef = try p.makePredefinedIdentifier(start); | |
| 7383 | ty = predef.ty; | |
| 7384 | p.func.pretty_ident = predef; | |
| 7385 | try p.decl_buf.append(predef.node); | |
| 7386 | } | |
| 7387 | if (p.func.ty == null) try p.err(.predefined_top_level); | |
| 7388 | return Result{ | |
| 7389 | .ty = ty, | |
| 7390 | .node = try p.addNode(.{ | |
| 7391 | .tag = .decl_ref_expr, | |
| 7392 | .ty = ty, | |
| 7393 | .data = .{ .decl_ref = p.tok_i }, | |
| 7394 | }), | |
| 7395 | }; | |
| 7396 | }, | |
| 7397 | .string_literal, | |
| 7398 | .string_literal_utf_16, | |
| 7399 | .string_literal_utf_8, | |
| 7400 | .string_literal_utf_32, | |
| 7401 | .string_literal_wide, | |
| 7402 | => return p.stringLiteral(), | |
| 7403 | .char_literal, | |
| 7404 | .char_literal_utf_8, | |
| 7405 | .char_literal_utf_16, | |
| 7406 | .char_literal_utf_32, | |
| 7407 | .char_literal_wide, | |
| 7408 | => return p.charLiteral(), | |
| 7409 | .zero => { | |
| 7410 | p.tok_i += 1; | |
| 7411 | var res: Result = .{ .val = Value.int(0), .ty = if (p.in_macro) p.comp.types.intmax else Type.int }; | |
| 7412 | res.node = try p.addNode(.{ .tag = .int_literal, .ty = res.ty, .data = undefined }); | |
| 7413 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 7414 | return res; | |
| 7415 | }, | |
| 7416 | .one => { | |
| 7417 | p.tok_i += 1; | |
| 7418 | var res: Result = .{ .val = Value.int(1), .ty = if (p.in_macro) p.comp.types.intmax else Type.int }; | |
| 7419 | res.node = try p.addNode(.{ .tag = .int_literal, .ty = res.ty, .data = undefined }); | |
| 7420 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 7421 | return res; | |
| 7422 | }, | |
| 7423 | .pp_num => return p.ppNum(), | |
| 7424 | .embed_byte => { | |
| 7425 | assert(!p.in_macro); | |
| 7426 | const loc = p.pp.tokens.items(.loc)[p.tok_i]; | |
| 7427 | p.tok_i += 1; | |
| 7428 | const buf = p.comp.getSource(.generated).buf[loc.byte_offset..]; | |
| 7429 | var byte: u8 = buf[0] - '0'; | |
| 7430 | for (buf[1..]) |c| { | |
| 7431 | if (!std.ascii.isDigit(c)) break; | |
| 7432 | byte *= 10; | |
| 7433 | byte += c - '0'; | |
| 7434 | } | |
| 7435 | var res: Result = .{ .val = Value.int(byte) }; | |
| 7436 | res.node = try p.addNode(.{ .tag = .int_literal, .ty = res.ty, .data = undefined }); | |
| 7437 | try p.value_map.put(res.node, res.val); | |
| 7438 | return res; | |
| 7439 | }, | |
| 7440 | .keyword_generic => return p.genericSelection(), | |
| 7441 | else => return Result{}, | |
| 7442 | } | |
| 7443 | } | |
| 7444 | ||
| 7445 | fn makePredefinedIdentifier(p: *Parser, start: u32) !Result { | |
| 7446 | const end: u32 = @intCast(p.retained_strings.items.len); | |
| 7447 | const elem_ty = .{ .specifier = .char, .qual = .{ .@"const" = true } }; | |
| 7448 | const arr_ty = try p.arena.create(Type.Array); | |
| 7449 | arr_ty.* = .{ .elem = elem_ty, .len = end - start }; | |
| 7450 | const ty: Type = .{ .specifier = .array, .data = .{ .array = arr_ty } }; | |
| 7451 | ||
| 7452 | const val = Value.bytes(start, end); | |
| 7453 | const str_lit = try p.addNode(.{ .tag = .string_literal_expr, .ty = ty, .data = undefined }); | |
| 7454 | if (!p.in_macro) try p.value_map.put(str_lit, val); | |
| 7455 | ||
| 7456 | return Result{ .ty = ty, .node = try p.addNode(.{ | |
| 7457 | .tag = .implicit_static_var, | |
| 7458 | .ty = ty, | |
| 7459 | .data = .{ .decl = .{ .name = p.tok_i, .node = str_lit } }, | |
| 7460 | }) }; | |
| 7461 | } | |
| 7462 | ||
| 7463 | fn stringLiteral(p: *Parser) Error!Result { | |
| 7464 | var start = p.tok_i; | |
| 7465 | // use 1 for wchar_t | |
| 7466 | var width: ?u8 = null; | |
| 7467 | var is_u8_literal = false; | |
| 7468 | while (true) { | |
| 7469 | switch (p.tok_ids[p.tok_i]) { | |
| 7470 | .string_literal => {}, | |
| 7471 | .string_literal_utf_16 => if (width) |some| { | |
| 7472 | if (some != 16) try p.err(.unsupported_str_cat); | |
| 7473 | } else { | |
| 7474 | width = 16; | |
| 7475 | }, | |
| 7476 | .string_literal_utf_8 => { | |
| 7477 | is_u8_literal = true; | |
| 7478 | if (width) |some| { | |
| 7479 | if (some != 8) try p.err(.unsupported_str_cat); | |
| 7480 | } else { | |
| 7481 | width = 8; | |
| 7482 | } | |
| 7483 | }, | |
| 7484 | .string_literal_utf_32 => if (width) |some| { | |
| 7485 | if (some != 32) try p.err(.unsupported_str_cat); | |
| 7486 | } else { | |
| 7487 | width = 32; | |
| 7488 | }, | |
| 7489 | .string_literal_wide => if (width) |some| { | |
| 7490 | if (some != 1) try p.err(.unsupported_str_cat); | |
| 7491 | } else { | |
| 7492 | width = 1; | |
| 7493 | }, | |
| 7494 | else => break, | |
| 7495 | } | |
| 7496 | p.tok_i += 1; | |
| 7497 | } | |
| 7498 | if (width == null) width = 8; | |
| 7499 | if (width.? != 8) return p.todo("unicode string literals"); | |
| 7500 | ||
| 7501 | const string_start = p.retained_strings.items.len; | |
| 7502 | while (start < p.tok_i) : (start += 1) { | |
| 7503 | var slice = p.tokSlice(start); | |
| 7504 | slice = slice[0 .. slice.len - 1]; | |
| 7505 | var i = mem.indexOf(u8, slice, "\"").? + 1; | |
| 7506 | try p.retained_strings.ensureUnusedCapacity(slice.len); | |
| 7507 | while (i < slice.len) : (i += 1) { | |
| 7508 | switch (slice[i]) { | |
| 7509 | '\\' => { | |
| 7510 | i += 1; | |
| 7511 | switch (slice[i]) { | |
| 7512 | '\n' => i += 1, | |
| 7513 | '\r' => i += 2, | |
| 7514 | '\'', '\"', '\\', '?' => |c| p.retained_strings.appendAssumeCapacity(c), | |
| 7515 | 'n' => p.retained_strings.appendAssumeCapacity('\n'), | |
| 7516 | 'r' => p.retained_strings.appendAssumeCapacity('\r'), | |
| 7517 | 't' => p.retained_strings.appendAssumeCapacity('\t'), | |
| 7518 | 'a' => p.retained_strings.appendAssumeCapacity(0x07), | |
| 7519 | 'b' => p.retained_strings.appendAssumeCapacity(0x08), | |
| 7520 | 'e' => { | |
| 7521 | try p.errExtra(.non_standard_escape_char, start, .{ .unsigned = i - 1 }); | |
| 7522 | p.retained_strings.appendAssumeCapacity(0x1B); | |
| 7523 | }, | |
| 7524 | 'f' => p.retained_strings.appendAssumeCapacity(0x0C), | |
| 7525 | 'v' => p.retained_strings.appendAssumeCapacity(0x0B), | |
| 7526 | 'x' => p.retained_strings.appendAssumeCapacity(try p.parseNumberEscape(start, 16, slice, &i)), | |
| 7527 | '0'...'7' => p.retained_strings.appendAssumeCapacity(try p.parseNumberEscape(start, 8, slice, &i)), | |
| 7528 | 'u' => try p.parseUnicodeEscape(start, 4, slice, &i), | |
| 7529 | 'U' => try p.parseUnicodeEscape(start, 8, slice, &i), | |
| 7530 | else => unreachable, | |
| 7531 | } | |
| 7532 | }, | |
| 7533 | else => |c| p.retained_strings.appendAssumeCapacity(c), | |
| 7534 | } | |
| 7535 | } | |
| 7536 | } | |
| 7537 | try p.retained_strings.append(0); | |
| 7538 | const slice = p.retained_strings.items[string_start..]; | |
| 7539 | ||
| 7540 | const arr_ty = try p.arena.create(Type.Array); | |
| 7541 | const specifier: Type.Specifier = if (is_u8_literal and p.comp.langopts.hasChar8_T()) .uchar else .char; | |
| 7542 | ||
| 7543 | arr_ty.* = .{ .elem = .{ .specifier = specifier }, .len = slice.len }; | |
| 7544 | var res: Result = .{ | |
| 7545 | .ty = .{ | |
| 7546 | .specifier = .array, | |
| 7547 | .data = .{ .array = arr_ty }, | |
| 7548 | }, | |
| 7549 | .val = Value.bytes(@intCast(string_start), @intCast(p.retained_strings.items.len)), | |
| 7550 | }; | |
| 7551 | res.node = try p.addNode(.{ .tag = .string_literal_expr, .ty = res.ty, .data = undefined }); | |
| 7552 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 7553 | return res; | |
| 7554 | } | |
| 7555 | ||
| 7556 | fn parseNumberEscape(p: *Parser, tok: TokenIndex, base: u8, slice: []const u8, i: *usize) !u8 { | |
| 7557 | if (base == 16) i.* += 1; // skip x | |
| 7558 | var char: u8 = 0; | |
| 7559 | var reported = false; | |
| 7560 | while (i.* < slice.len) : (i.* += 1) { | |
| 7561 | const val = std.fmt.charToDigit(slice[i.*], base) catch break; // validated by Tokenizer | |
| 7562 | const product, const overflowed = @mulWithOverflow(char, base); | |
| 7563 | if (overflowed != 0 and !reported) { | |
| 7564 | try p.errExtra(.escape_sequence_overflow, tok, .{ .unsigned = i.* }); | |
| 7565 | reported = true; | |
| 7566 | } | |
| 7567 | char = product + val; | |
| 7568 | } | |
| 7569 | i.* -= 1; | |
| 7570 | return char; | |
| 7571 | } | |
| 7572 | ||
| 7573 | fn parseUnicodeEscape(p: *Parser, tok: TokenIndex, count: u8, slice: []const u8, i: *usize) !void { | |
| 7574 | const c = std.fmt.parseInt(u21, slice[i.* + 1 ..][0..count], 16) catch 0x110000; // count validated by tokenizer | |
| 7575 | i.* += count + 1; | |
| 7576 | if (!std.unicode.utf8ValidCodepoint(c) or (c < 0xa0 and c != '$' and c != '@' and c != '`')) { | |
| 7577 | try p.errExtra(.invalid_universal_character, tok, .{ .unsigned = i.* - count - 2 }); | |
| 7578 | return; | |
| 7579 | } | |
| 7580 | var buf: [4]u8 = undefined; | |
| 7581 | const to_write = std.unicode.utf8Encode(c, &buf) catch unreachable; // validated above | |
| 7582 | p.retained_strings.appendSliceAssumeCapacity(buf[0..to_write]); | |
| 7583 | } | |
| 7584 | ||
| 7585 | fn charLiteral(p: *Parser) Error!Result { | |
| 7586 | defer p.tok_i += 1; | |
| 7587 | const allow_multibyte = switch (p.tok_ids[p.tok_i]) { | |
| 7588 | .char_literal => false, | |
| 7589 | .char_literal_utf_8 => false, | |
| 7590 | .char_literal_wide => true, | |
| 7591 | .char_literal_utf_16 => true, | |
| 7592 | .char_literal_utf_32 => true, | |
| 7593 | else => unreachable, | |
| 7594 | }; | |
| 7595 | const ty: Type = switch (p.tok_ids[p.tok_i]) { | |
| 7596 | .char_literal => .{ .specifier = .int }, | |
| 7597 | .char_literal_utf_8 => .{ .specifier = .uchar }, | |
| 7598 | .char_literal_wide => p.comp.types.wchar, | |
| 7599 | .char_literal_utf_16 => .{ .specifier = .ushort }, | |
| 7600 | .char_literal_utf_32 => .{ .specifier = .ulong }, | |
| 7601 | else => unreachable, | |
| 7602 | }; | |
| 7603 | const max: u32 = switch (p.tok_ids[p.tok_i]) { | |
| 7604 | .char_literal => std.math.maxInt(u8), | |
| 7605 | .char_literal_wide => @intCast(p.comp.types.wchar.maxInt(p.comp)), | |
| 7606 | .char_literal_utf_8 => std.math.maxInt(u8), | |
| 7607 | .char_literal_utf_16 => std.math.maxInt(u16), | |
| 7608 | .char_literal_utf_32 => std.math.maxInt(u32), | |
| 7609 | else => unreachable, | |
| 7610 | }; | |
| 7611 | var multichar: u8 = switch (p.tok_ids[p.tok_i]) { | |
| 7612 | .char_literal => 0, | |
| 7613 | .char_literal_wide => 4, | |
| 7614 | .char_literal_utf_8 => 2, | |
| 7615 | .char_literal_utf_16 => 2, | |
| 7616 | .char_literal_utf_32 => 2, | |
| 7617 | else => unreachable, | |
| 7618 | }; | |
| 7619 | ||
| 7620 | var val: u32 = 0; | |
| 7621 | var overflow_reported = false; | |
| 7622 | var slice = p.tokSlice(p.tok_i); | |
| 7623 | slice = slice[0 .. slice.len - 1]; | |
| 7624 | var i = mem.indexOf(u8, slice, "\'").? + 1; | |
| 7625 | while (i < slice.len) : (i += 1) { | |
| 7626 | var c: u32 = slice[i]; | |
| 7627 | var multibyte = false; | |
| 7628 | switch (c) { | |
| 7629 | '\\' => { | |
| 7630 | i += 1; | |
| 7631 | switch (slice[i]) { | |
| 7632 | '\n' => i += 1, | |
| 7633 | '\r' => i += 2, | |
| 7634 | '\'', '\"', '\\', '?' => c = slice[i], | |
| 7635 | 'n' => c = '\n', | |
| 7636 | 'r' => c = '\r', | |
| 7637 | 't' => c = '\t', | |
| 7638 | 'a' => c = 0x07, | |
| 7639 | 'b' => c = 0x08, | |
| 7640 | 'e' => { | |
| 7641 | try p.errExtra(.non_standard_escape_char, p.tok_i, .{ .unsigned = i - 1 }); | |
| 7642 | c = 0x1B; | |
| 7643 | }, | |
| 7644 | 'f' => c = 0x0C, | |
| 7645 | 'v' => c = 0x0B, | |
| 7646 | 'x' => c = try p.parseNumberEscape(p.tok_i, 16, slice, &i), | |
| 7647 | '0'...'7' => c = try p.parseNumberEscape(p.tok_i, 8, slice, &i), | |
| 7648 | 'u', 'U' => return p.todo("unicode escapes in char literals"), | |
| 7649 | else => unreachable, | |
| 7650 | } | |
| 7651 | }, | |
| 7652 | // These are safe since the source is checked to be valid utf8. | |
| 7653 | 0b1100_0000...0b1101_1111 => { | |
| 7654 | c &= 0b00011111; | |
| 7655 | c <<= 6; | |
| 7656 | c |= slice[i + 1] & 0b00111111; | |
| 7657 | i += 1; | |
| 7658 | multibyte = true; | |
| 7659 | }, | |
| 7660 | 0b1110_0000...0b1110_1111 => { | |
| 7661 | c &= 0b00001111; | |
| 7662 | c <<= 6; | |
| 7663 | c |= slice[i + 1] & 0b00111111; | |
| 7664 | c <<= 6; | |
| 7665 | c |= slice[i + 2] & 0b00111111; | |
| 7666 | i += 2; | |
| 7667 | multibyte = true; | |
| 7668 | }, | |
| 7669 | 0b1111_0000...0b1111_0111 => { | |
| 7670 | c &= 0b00000111; | |
| 7671 | c <<= 6; | |
| 7672 | c |= slice[i + 1] & 0b00111111; | |
| 7673 | c <<= 6; | |
| 7674 | c |= slice[i + 2] & 0b00111111; | |
| 7675 | c <<= 6; | |
| 7676 | c |= slice[i + 3] & 0b00111111; | |
| 7677 | i += 3; | |
| 7678 | multibyte = true; | |
| 7679 | }, | |
| 7680 | else => {}, | |
| 7681 | } | |
| 7682 | if (c > max or (multibyte and !allow_multibyte)) try p.err(.char_too_large); | |
| 7683 | switch (multichar) { | |
| 7684 | 0, 2, 4 => multichar += 1, | |
| 7685 | 1 => { | |
| 7686 | multichar = 99; | |
| 7687 | try p.err(.multichar_literal); | |
| 7688 | }, | |
| 7689 | 3 => { | |
| 7690 | try p.err(.unicode_multichar_literal); | |
| 7691 | return error.ParsingFailed; | |
| 7692 | }, | |
| 7693 | 5 => { | |
| 7694 | try p.err(.wide_multichar_literal); | |
| 7695 | val = 0; | |
| 7696 | multichar = 6; | |
| 7697 | }, | |
| 7698 | 6 => val = 0, | |
| 7699 | else => {}, | |
| 7700 | } | |
| 7701 | const product, const overflowed = @mulWithOverflow(val, max +% 1); | |
| 7702 | if (overflowed != 0 and !overflow_reported) { | |
| 7703 | try p.errExtra(.char_lit_too_wide, p.tok_i, .{ .unsigned = i }); | |
| 7704 | overflow_reported = true; | |
| 7705 | } | |
| 7706 | val = product + c; | |
| 7707 | } | |
| 7708 | ||
| 7709 | // This is the type the literal will have if we're in a macro; macros always operate on intmax_t/uintmax_t values | |
| 7710 | const macro_ty = if (ty.isUnsignedInt(p.comp) or (p.tok_ids[p.tok_i] == .char_literal and p.comp.getCharSignedness() == .unsigned)) | |
| 7711 | p.comp.types.intmax.makeIntegerUnsigned() | |
| 7712 | else | |
| 7713 | p.comp.types.intmax; | |
| 7714 | ||
| 7715 | var res = Result{ | |
| 7716 | .ty = if (p.in_macro) macro_ty else ty, | |
| 7717 | .val = Value.int(val), | |
| 7718 | .node = try p.addNode(.{ .tag = .char_literal, .ty = ty, .data = undefined }), | |
| 7719 | }; | |
| 7720 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 7721 | return res; | |
| 7722 | } | |
| 7723 | ||
| 7724 | fn parseFloat(p: *Parser, buf: []const u8, suffix: NumberSuffix) !Result { | |
| 7725 | switch (suffix) { | |
| 7726 | .L => return p.todo("long double literals"), | |
| 7727 | .IL => { | |
| 7728 | try p.err(.gnu_imaginary_constant); | |
| 7729 | return p.todo("long double imaginary literals"); | |
| 7730 | }, | |
| 7731 | .None, .I, .F, .IF, .F16 => { | |
| 7732 | const ty = Type{ .specifier = switch (suffix) { | |
| 7733 | .None, .I => .double, | |
| 7734 | .F, .IF => .float, | |
| 7735 | .F16 => .float16, | |
| 7736 | else => unreachable, | |
| 7737 | } }; | |
| 7738 | const d_val = std.fmt.parseFloat(f64, buf) catch |er| switch (er) { | |
| 7739 | error.InvalidCharacter => return p.todo("c2x digit separators in floats"), | |
| 7740 | else => unreachable, | |
| 7741 | }; | |
| 7742 | const tag: Tree.Tag = switch (suffix) { | |
| 7743 | .None, .I => .double_literal, | |
| 7744 | .F, .IF => .float_literal, | |
| 7745 | .F16 => .float16_literal, | |
| 7746 | else => unreachable, | |
| 7747 | }; | |
| 7748 | var res = Result{ | |
| 7749 | .ty = ty, | |
| 7750 | .node = try p.addNode(.{ .tag = tag, .ty = ty, .data = undefined }), | |
| 7751 | .val = Value.float(d_val), | |
| 7752 | }; | |
| 7753 | if (suffix.isImaginary()) { | |
| 7754 | try p.err(.gnu_imaginary_constant); | |
| 7755 | res.ty = .{ .specifier = switch (suffix) { | |
| 7756 | .I => .complex_double, | |
| 7757 | .IF => .complex_float, | |
| 7758 | else => unreachable, | |
| 7759 | } }; | |
| 7760 | res.val.tag = .unavailable; | |
| 7761 | try res.un(p, .imaginary_literal); | |
| 7762 | } | |
| 7763 | return res; | |
| 7764 | }, | |
| 7765 | else => unreachable, | |
| 7766 | } | |
| 7767 | } | |
| 7768 | ||
| 7769 | fn getIntegerPart(p: *Parser, buf: []const u8, prefix: NumberPrefix, tok_i: TokenIndex) ![]const u8 { | |
| 7770 | if (buf[0] == '.') return ""; | |
| 7771 | ||
| 7772 | if (!prefix.digitAllowed(buf[0])) { | |
| 7773 | switch (prefix) { | |
| 7774 | .binary => try p.errExtra(.invalid_binary_digit, tok_i, .{ .ascii = @intCast(buf[0]) }), | |
| 7775 | .octal => try p.errExtra(.invalid_octal_digit, tok_i, .{ .ascii = @intCast(buf[0]) }), | |
| 7776 | .hex => try p.errStr(.invalid_int_suffix, tok_i, buf), | |
| 7777 | .decimal => unreachable, | |
| 7778 | } | |
| 7779 | return error.ParsingFailed; | |
| 7780 | } | |
| 7781 | ||
| 7782 | for (buf, 0..) |c, idx| { | |
| 7783 | if (idx == 0) continue; | |
| 7784 | switch (c) { | |
| 7785 | '.' => return buf[0..idx], | |
| 7786 | 'p', 'P' => return if (prefix == .hex) buf[0..idx] else { | |
| 7787 | try p.errStr(.invalid_int_suffix, tok_i, buf[idx..]); | |
| 7788 | return error.ParsingFailed; | |
| 7789 | }, | |
| 7790 | 'e', 'E' => { | |
| 7791 | switch (prefix) { | |
| 7792 | .hex => continue, | |
| 7793 | .decimal => return buf[0..idx], | |
| 7794 | .binary => try p.errExtra(.invalid_binary_digit, tok_i, .{ .ascii = @intCast(c) }), | |
| 7795 | .octal => try p.errExtra(.invalid_octal_digit, tok_i, .{ .ascii = @intCast(c) }), | |
| 7796 | } | |
| 7797 | return error.ParsingFailed; | |
| 7798 | }, | |
| 7799 | '0'...'9', 'a'...'d', 'A'...'D', 'f', 'F' => { | |
| 7800 | if (!prefix.digitAllowed(c)) { | |
| 7801 | switch (prefix) { | |
| 7802 | .binary => try p.errExtra(.invalid_binary_digit, tok_i, .{ .ascii = @intCast(c) }), | |
| 7803 | .octal => try p.errExtra(.invalid_octal_digit, tok_i, .{ .ascii = @intCast(c) }), | |
| 7804 | .decimal, .hex => try p.errStr(.invalid_int_suffix, tok_i, buf[idx..]), | |
| 7805 | } | |
| 7806 | return error.ParsingFailed; | |
| 7807 | } | |
| 7808 | }, | |
| 7809 | '\'' => {}, | |
| 7810 | else => return buf[0..idx], | |
| 7811 | } | |
| 7812 | } | |
| 7813 | return buf; | |
| 7814 | } | |
| 7815 | ||
| 7816 | fn fixedSizeInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok_i: TokenIndex) !Result { | |
| 7817 | var val: u64 = 0; | |
| 7818 | var overflow = false; | |
| 7819 | for (buf) |c| { | |
| 7820 | const digit: u64 = switch (c) { | |
| 7821 | '0'...'9' => c - '0', | |
| 7822 | 'A'...'Z' => c - 'A' + 10, | |
| 7823 | 'a'...'z' => c - 'a' + 10, | |
| 7824 | '\'' => continue, | |
| 7825 | else => unreachable, | |
| 7826 | }; | |
| 7827 | ||
| 7828 | if (val != 0) { | |
| 7829 | const product, const overflowed = @mulWithOverflow(val, base); | |
| 7830 | if (overflowed != 0) { | |
| 7831 | overflow = true; | |
| 7832 | } | |
| 7833 | val = product; | |
| 7834 | } | |
| 7835 | const sum, const overflowed = @addWithOverflow(val, digit); | |
| 7836 | if (overflowed != 0) overflow = true; | |
| 7837 | val = sum; | |
| 7838 | } | |
| 7839 | if (overflow) { | |
| 7840 | try p.errTok(.int_literal_too_big, tok_i); | |
| 7841 | var res: Result = .{ .ty = .{ .specifier = .ulong_long }, .val = Value.int(val) }; | |
| 7842 | res.node = try p.addNode(.{ .tag = .int_literal, .ty = res.ty, .data = undefined }); | |
| 7843 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 7844 | return res; | |
| 7845 | } | |
| 7846 | if (suffix.isSignedInteger()) { | |
| 7847 | if (val > p.comp.types.intmax.maxInt(p.comp)) { | |
| 7848 | try p.errTok(.implicitly_unsigned_literal, tok_i); | |
| 7849 | } | |
| 7850 | } | |
| 7851 | return if (base == 10) | |
| 7852 | switch (suffix) { | |
| 7853 | .None, .I => p.castInt(val, &.{ .int, .long, .long_long }), | |
| 7854 | .U, .IU => p.castInt(val, &.{ .uint, .ulong, .ulong_long }), | |
| 7855 | .L, .IL => p.castInt(val, &.{ .long, .long_long }), | |
| 7856 | .UL, .IUL => p.castInt(val, &.{ .ulong, .ulong_long }), | |
| 7857 | .LL, .ILL => p.castInt(val, &.{.long_long}), | |
| 7858 | .ULL, .IULL => p.castInt(val, &.{.ulong_long}), | |
| 7859 | else => unreachable, | |
| 7860 | } | |
| 7861 | else switch (suffix) { | |
| 7862 | .None, .I => p.castInt(val, &.{ .int, .uint, .long, .ulong, .long_long, .ulong_long }), | |
| 7863 | .U, .IU => p.castInt(val, &.{ .uint, .ulong, .ulong_long }), | |
| 7864 | .L, .IL => p.castInt(val, &.{ .long, .ulong, .long_long, .ulong_long }), | |
| 7865 | .UL, .IUL => p.castInt(val, &.{ .ulong, .ulong_long }), | |
| 7866 | .LL, .ILL => p.castInt(val, &.{ .long_long, .ulong_long }), | |
| 7867 | .ULL, .IULL => p.castInt(val, &.{.ulong_long}), | |
| 7868 | else => unreachable, | |
| 7869 | }; | |
| 7870 | } | |
| 7871 | ||
| 7872 | fn parseInt(p: *Parser, prefix: NumberPrefix, buf: []const u8, suffix: NumberSuffix, tok_i: TokenIndex) !Result { | |
| 7873 | if (prefix == .binary) { | |
| 7874 | try p.errTok(.binary_integer_literal, tok_i); | |
| 7875 | } | |
| 7876 | const base = @intFromEnum(prefix); | |
| 7877 | var res = if (suffix.isBitInt()) | |
| 7878 | try p.bitInt(base, buf, suffix, tok_i) | |
| 7879 | else | |
| 7880 | try p.fixedSizeInt(base, buf, suffix, tok_i); | |
| 7881 | ||
| 7882 | if (suffix.isImaginary()) { | |
| 7883 | try p.errTok(.gnu_imaginary_constant, tok_i); | |
| 7884 | res.ty = res.ty.makeComplex(); | |
| 7885 | res.val.tag = .unavailable; | |
| 7886 | try res.un(p, .imaginary_literal); | |
| 7887 | } | |
| 7888 | return res; | |
| 7889 | } | |
| 7890 | ||
| 7891 | fn bitInt(p: *Parser, base: u8, buf: []const u8, suffix: NumberSuffix, tok_i: TokenIndex) Error!Result { | |
| 7892 | try p.errStr(.pre_c2x_compat, tok_i, "'_BitInt' suffix for literals"); | |
| 7893 | try p.errTok(.bitint_suffix, tok_i); | |
| 7894 | ||
| 7895 | var managed = try big.int.Managed.init(p.comp.gpa); | |
| 7896 | defer managed.deinit(); | |
| 7897 | ||
| 7898 | managed.setString(base, buf) catch |e| switch (e) { | |
| 7899 | error.InvalidBase => unreachable, // `base` is one of 2, 8, 10, 16 | |
| 7900 | error.InvalidCharacter => unreachable, // digits validated by Tokenizer | |
| 7901 | else => |er| return er, | |
| 7902 | }; | |
| 7903 | const c = managed.toConst(); | |
| 7904 | const bits_needed: std.math.IntFittingRange(0, Compilation.bit_int_max_bits) = blk: { | |
| 7905 | // Literal `0` requires at least 1 bit | |
| 7906 | const count = @max(1, c.bitCountTwosComp()); | |
| 7907 | // The wb suffix results in a _BitInt that includes space for the sign bit even if the | |
| 7908 | // value of the constant is positive or was specified in hexadecimal or octal notation. | |
| 7909 | const sign_bits = @intFromBool(suffix.isSignedInteger()); | |
| 7910 | const bits_needed = count + sign_bits; | |
| 7911 | if (bits_needed > Compilation.bit_int_max_bits) { | |
| 7912 | const specifier: Type.Builder.Specifier = switch (suffix) { | |
| 7913 | .WB => .{ .bit_int = 0 }, | |
| 7914 | .UWB => .{ .ubit_int = 0 }, | |
| 7915 | .IWB => .{ .complex_bit_int = 0 }, | |
| 7916 | .IUWB => .{ .complex_ubit_int = 0 }, | |
| 7917 | else => unreachable, | |
| 7918 | }; | |
| 7919 | try p.errStr(.bit_int_too_big, tok_i, specifier.str(p.comp.langopts).?); | |
| 7920 | return error.ParsingFailed; | |
| 7921 | } | |
| 7922 | if (bits_needed > 64) { | |
| 7923 | return p.todo("_BitInt constants > 64 bits"); | |
| 7924 | } | |
| 7925 | break :blk @intCast(bits_needed); | |
| 7926 | }; | |
| 7927 | ||
| 7928 | const val = c.to(u64) catch |e| switch (e) { | |
| 7929 | error.NegativeIntoUnsigned => unreachable, // unary minus parsed elsewhere; we only see positive integers | |
| 7930 | error.TargetTooSmall => unreachable, // Validated above but Todo: handle larger _BitInt | |
| 7931 | }; | |
| 7932 | ||
| 7933 | var res: Result = .{ | |
| 7934 | .val = Value.int(val), | |
| 7935 | .ty = .{ | |
| 7936 | .specifier = .bit_int, | |
| 7937 | .data = .{ .int = .{ .bits = bits_needed, .signedness = suffix.signedness() } }, | |
| 7938 | }, | |
| 7939 | }; | |
| 7940 | res.node = try p.addNode(.{ .tag = .int_literal, .ty = res.ty, .data = .{ .int = val } }); | |
| 7941 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 7942 | return res; | |
| 7943 | } | |
| 7944 | ||
| 7945 | fn getFracPart(p: *Parser, buf: []const u8, prefix: NumberPrefix, tok_i: TokenIndex) ![]const u8 { | |
| 7946 | if (buf.len == 0 or buf[0] != '.') return ""; | |
| 7947 | assert(prefix != .octal); | |
| 7948 | if (prefix == .binary) { | |
| 7949 | try p.errStr(.invalid_int_suffix, tok_i, buf); | |
| 7950 | return error.ParsingFailed; | |
| 7951 | } | |
| 7952 | for (buf, 0..) |c, idx| { | |
| 7953 | if (idx == 0) continue; | |
| 7954 | if (c == '\'') continue; | |
| 7955 | if (!prefix.digitAllowed(c)) return buf[0..idx]; | |
| 7956 | } | |
| 7957 | return buf; | |
| 7958 | } | |
| 7959 | ||
| 7960 | fn getExponent(p: *Parser, buf: []const u8, prefix: NumberPrefix, tok_i: TokenIndex) ![]const u8 { | |
| 7961 | if (buf.len == 0) return ""; | |
| 7962 | ||
| 7963 | switch (buf[0]) { | |
| 7964 | 'e', 'E' => assert(prefix == .decimal), | |
| 7965 | 'p', 'P' => if (prefix != .hex) { | |
| 7966 | try p.errStr(.invalid_float_suffix, tok_i, buf); | |
| 7967 | return error.ParsingFailed; | |
| 7968 | }, | |
| 7969 | else => return "", | |
| 7970 | } | |
| 7971 | const end = for (buf, 0..) |c, idx| { | |
| 7972 | if (idx == 0) continue; | |
| 7973 | if (idx == 1 and (c == '+' or c == '-')) continue; | |
| 7974 | switch (c) { | |
| 7975 | '0'...'9' => {}, | |
| 7976 | '\'' => continue, | |
| 7977 | else => break idx, | |
| 7978 | } | |
| 7979 | } else buf.len; | |
| 7980 | const exponent = buf[0..end]; | |
| 7981 | if (std.mem.indexOfAny(u8, exponent, "0123456789") == null) { | |
| 7982 | try p.errTok(.exponent_has_no_digits, tok_i); | |
| 7983 | return error.ParsingFailed; | |
| 7984 | } | |
| 7985 | return exponent; | |
| 7986 | } | |
| 7987 | ||
| 7988 | /// Using an explicit `tok_i` parameter instead of `p.tok_i` makes it easier | |
| 7989 | /// to parse numbers in pragma handlers. | |
| 7990 | pub fn parseNumberToken(p: *Parser, tok_i: TokenIndex) !Result { | |
| 7991 | const buf = p.tokSlice(tok_i); | |
| 7992 | const prefix = NumberPrefix.fromString(buf); | |
| 7993 | const after_prefix = buf[prefix.stringLen()..]; | |
| 7994 | ||
| 7995 | const int_part = try p.getIntegerPart(after_prefix, prefix, tok_i); | |
| 7996 | ||
| 7997 | const after_int = after_prefix[int_part.len..]; | |
| 7998 | ||
| 7999 | const frac = try p.getFracPart(after_int, prefix, tok_i); | |
| 8000 | const after_frac = after_int[frac.len..]; | |
| 8001 | ||
| 8002 | const exponent = try p.getExponent(after_frac, prefix, tok_i); | |
| 8003 | const suffix_str = after_frac[exponent.len..]; | |
| 8004 | const is_float = (exponent.len > 0 or frac.len > 0); | |
| 8005 | const suffix = NumberSuffix.fromString(suffix_str, if (is_float) .float else .int) orelse { | |
| 8006 | if (is_float) { | |
| 8007 | try p.errStr(.invalid_float_suffix, tok_i, suffix_str); | |
| 8008 | } else { | |
| 8009 | try p.errStr(.invalid_int_suffix, tok_i, suffix_str); | |
| 8010 | } | |
| 8011 | return error.ParsingFailed; | |
| 8012 | }; | |
| 8013 | ||
| 8014 | if (is_float) { | |
| 8015 | assert(prefix == .hex or prefix == .decimal); | |
| 8016 | if (prefix == .hex and exponent.len == 0) { | |
| 8017 | try p.errTok(.hex_floating_constant_requires_exponent, tok_i); | |
| 8018 | return error.ParsingFailed; | |
| 8019 | } | |
| 8020 | const number = buf[0 .. buf.len - suffix_str.len]; | |
| 8021 | return p.parseFloat(number, suffix); | |
| 8022 | } else { | |
| 8023 | return p.parseInt(prefix, int_part, suffix, tok_i); | |
| 8024 | } | |
| 8025 | } | |
| 8026 | ||
| 8027 | fn ppNum(p: *Parser) Error!Result { | |
| 8028 | defer p.tok_i += 1; | |
| 8029 | var res = try p.parseNumberToken(p.tok_i); | |
| 8030 | if (p.in_macro) { | |
| 8031 | if (res.ty.isFloat() or !res.ty.isReal()) { | |
| 8032 | try p.errTok(.float_literal_in_pp_expr, p.tok_i); | |
| 8033 | return error.ParsingFailed; | |
| 8034 | } | |
| 8035 | res.ty = if (res.ty.isUnsignedInt(p.comp)) p.comp.types.intmax.makeIntegerUnsigned() else p.comp.types.intmax; | |
| 8036 | } else { | |
| 8037 | try p.value_map.put(res.node, res.val); | |
| 8038 | } | |
| 8039 | return res; | |
| 8040 | } | |
| 8041 | ||
| 8042 | fn castInt(p: *Parser, val: u64, specs: []const Type.Specifier) Error!Result { | |
| 8043 | var res: Result = .{ .val = Value.int(val) }; | |
| 8044 | for (specs) |spec| { | |
| 8045 | const ty = Type{ .specifier = spec }; | |
| 8046 | const unsigned = ty.isUnsignedInt(p.comp); | |
| 8047 | const size = ty.sizeof(p.comp).?; | |
| 8048 | res.ty = ty; | |
| 8049 | ||
| 8050 | if (unsigned) { | |
| 8051 | switch (size) { | |
| 8052 | 2 => if (val <= std.math.maxInt(u16)) break, | |
| 8053 | 4 => if (val <= std.math.maxInt(u32)) break, | |
| 8054 | 8 => if (val <= std.math.maxInt(u64)) break, | |
| 8055 | else => unreachable, | |
| 8056 | } | |
| 8057 | } else { | |
| 8058 | switch (size) { | |
| 8059 | 2 => if (val <= std.math.maxInt(i16)) break, | |
| 8060 | 4 => if (val <= std.math.maxInt(i32)) break, | |
| 8061 | 8 => if (val <= std.math.maxInt(i64)) break, | |
| 8062 | else => unreachable, | |
| 8063 | } | |
| 8064 | } | |
| 8065 | } else { | |
| 8066 | res.ty = .{ .specifier = .ulong_long }; | |
| 8067 | } | |
| 8068 | res.node = try p.addNode(.{ .tag = .int_literal, .ty = res.ty, .data = .{ .int = val } }); | |
| 8069 | if (!p.in_macro) try p.value_map.put(res.node, res.val); | |
| 8070 | return res; | |
| 8071 | } | |
| 8072 | ||
| 8073 | /// Run a parser function but do not evaluate the result | |
| 8074 | fn parseNoEval(p: *Parser, comptime func: fn (*Parser) Error!Result) Error!Result { | |
| 8075 | const no_eval = p.no_eval; | |
| 8076 | defer p.no_eval = no_eval; | |
| 8077 | p.no_eval = true; | |
| 8078 | const parsed = try func(p); | |
| 8079 | try parsed.expect(p); | |
| 8080 | return parsed; | |
| 8081 | } | |
| 8082 | ||
| 8083 | /// genericSelection : keyword_generic '(' assignExpr ',' genericAssoc (',' genericAssoc)* ')' | |
| 8084 | /// genericAssoc | |
| 8085 | /// : typeName ':' assignExpr | |
| 8086 | /// | keyword_default ':' assignExpr | |
| 8087 | fn genericSelection(p: *Parser) Error!Result { | |
| 8088 | p.tok_i += 1; | |
| 8089 | const l_paren = try p.expectToken(.l_paren); | |
| 8090 | const controlling_tok = p.tok_i; | |
| 8091 | const controlling = try p.parseNoEval(assignExpr); | |
| 8092 | _ = try p.expectToken(.comma); | |
| 8093 | var controlling_ty = controlling.ty; | |
| 8094 | if (controlling_ty.isArray()) controlling_ty.decayArray(); | |
| 8095 | ||
| 8096 | const list_buf_top = p.list_buf.items.len; | |
| 8097 | defer p.list_buf.items.len = list_buf_top; | |
| 8098 | try p.list_buf.append(controlling.node); | |
| 8099 | ||
| 8100 | // Use decl_buf to store the token indexes of previous cases | |
| 8101 | const decl_buf_top = p.decl_buf.items.len; | |
| 8102 | defer p.decl_buf.items.len = decl_buf_top; | |
| 8103 | ||
| 8104 | var default_tok: ?TokenIndex = null; | |
| 8105 | var default: Result = undefined; | |
| 8106 | var chosen_tok: TokenIndex = undefined; | |
| 8107 | var chosen: Result = .{}; | |
| 8108 | while (true) { | |
| 8109 | const start = p.tok_i; | |
| 8110 | if (try p.typeName()) |ty| blk: { | |
| 8111 | if (ty.isArray()) { | |
| 8112 | try p.errTok(.generic_array_type, start); | |
| 8113 | } else if (ty.isFunc()) { | |
| 8114 | try p.errTok(.generic_func_type, start); | |
| 8115 | } else if (ty.anyQual()) { | |
| 8116 | try p.errTok(.generic_qual_type, start); | |
| 8117 | } | |
| 8118 | _ = try p.expectToken(.colon); | |
| 8119 | const node = try p.assignExpr(); | |
| 8120 | try node.expect(p); | |
| 8121 | ||
| 8122 | if (ty.eql(controlling_ty, p.comp, false)) { | |
| 8123 | if (chosen.node == .none) { | |
| 8124 | chosen = node; | |
| 8125 | chosen_tok = start; | |
| 8126 | break :blk; | |
| 8127 | } | |
| 8128 | try p.errStr(.generic_duplicate, start, try p.typeStr(ty)); | |
| 8129 | try p.errStr(.generic_duplicate_here, chosen_tok, try p.typeStr(ty)); | |
| 8130 | } | |
| 8131 | for (p.list_buf.items[list_buf_top + 1 ..], p.decl_buf.items[decl_buf_top..]) |item, prev_tok| { | |
| 8132 | const prev_ty = p.nodes.items(.ty)[@intFromEnum(item)]; | |
| 8133 | if (prev_ty.eql(ty, p.comp, true)) { | |
| 8134 | try p.errStr(.generic_duplicate, start, try p.typeStr(ty)); | |
| 8135 | try p.errStr(.generic_duplicate_here, @intFromEnum(prev_tok), try p.typeStr(ty)); | |
| 8136 | } | |
| 8137 | } | |
| 8138 | try p.list_buf.append(try p.addNode(.{ | |
| 8139 | .tag = .generic_association_expr, | |
| 8140 | .ty = ty, | |
| 8141 | .data = .{ .un = node.node }, | |
| 8142 | })); | |
| 8143 | try p.decl_buf.append(@enumFromInt(start)); | |
| 8144 | } else if (p.eatToken(.keyword_default)) |tok| { | |
| 8145 | if (default_tok) |prev| { | |
| 8146 | try p.errTok(.generic_duplicate_default, tok); | |
| 8147 | try p.errTok(.previous_case, prev); | |
| 8148 | } | |
| 8149 | default_tok = tok; | |
| 8150 | _ = try p.expectToken(.colon); | |
| 8151 | default = try p.assignExpr(); | |
| 8152 | try default.expect(p); | |
| 8153 | } else { | |
| 8154 | if (p.list_buf.items.len == list_buf_top + 1) { | |
| 8155 | try p.err(.expected_type); | |
| 8156 | return error.ParsingFailed; | |
| 8157 | } | |
| 8158 | break; | |
| 8159 | } | |
| 8160 | if (p.eatToken(.comma) == null) break; | |
| 8161 | } | |
| 8162 | try p.expectClosing(l_paren, .r_paren); | |
| 8163 | ||
| 8164 | if (chosen.node == .none) { | |
| 8165 | if (default_tok != null) { | |
| 8166 | try p.list_buf.insert(list_buf_top + 1, try p.addNode(.{ | |
| 8167 | .tag = .generic_default_expr, | |
| 8168 | .data = .{ .un = default.node }, | |
| 8169 | })); | |
| 8170 | chosen = default; | |
| 8171 | } else { | |
| 8172 | try p.errStr(.generic_no_match, controlling_tok, try p.typeStr(controlling_ty)); | |
| 8173 | return error.ParsingFailed; | |
| 8174 | } | |
| 8175 | } else { | |
| 8176 | try p.list_buf.insert(list_buf_top + 1, try p.addNode(.{ | |
| 8177 | .tag = .generic_association_expr, | |
| 8178 | .data = .{ .un = chosen.node }, | |
| 8179 | })); | |
| 8180 | if (default_tok != null) { | |
| 8181 | try p.list_buf.append(try p.addNode(.{ | |
| 8182 | .tag = .generic_default_expr, | |
| 8183 | .data = .{ .un = chosen.node }, | |
| 8184 | })); | |
| 8185 | } | |
| 8186 | } | |
| 8187 | ||
| 8188 | var generic_node: Tree.Node = .{ | |
| 8189 | .tag = .generic_expr_one, | |
| 8190 | .ty = chosen.ty, | |
| 8191 | .data = .{ .bin = .{ .lhs = controlling.node, .rhs = chosen.node } }, | |
| 8192 | }; | |
| 8193 | const associations = p.list_buf.items[list_buf_top..]; | |
| 8194 | if (associations.len > 2) { // associations[0] == controlling.node | |
| 8195 | generic_node.tag = .generic_expr; | |
| 8196 | generic_node.data = .{ .range = try p.addList(associations) }; | |
| 8197 | } | |
| 8198 | chosen.node = try p.addNode(generic_node); | |
| 8199 | return chosen; | |
| 8200 | } |
deps/aro/Pragma.zig created+83| ... | ... | @@ -0,0 +1,83 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Compilation = @import("Compilation.zig"); | |
| 3 | const Preprocessor = @import("Preprocessor.zig"); | |
| 4 | const Parser = @import("Parser.zig"); | |
| 5 | const TokenIndex = @import("Tree.zig").TokenIndex; | |
| 6 | ||
| 7 | const Pragma = @This(); | |
| 8 | ||
| 9 | pub const Error = Compilation.Error || error{ UnknownPragma, StopPreprocessing }; | |
| 10 | ||
| 11 | /// Called during Preprocessor.init | |
| 12 | beforePreprocess: ?*const fn (*Pragma, *Compilation) void = null, | |
| 13 | ||
| 14 | /// Called at the beginning of Parser.parse | |
| 15 | beforeParse: ?*const fn (*Pragma, *Compilation) void = null, | |
| 16 | ||
| 17 | /// Called at the end of Parser.parse if a Tree was successfully parsed | |
| 18 | afterParse: ?*const fn (*Pragma, *Compilation) void = null, | |
| 19 | ||
| 20 | /// Called during Compilation.deinit | |
| 21 | deinit: *const fn (*Pragma, *Compilation) void, | |
| 22 | ||
| 23 | /// Called whenever the preprocessor encounters this pragma. `start_idx` is the index | |
| 24 | /// within `pp.tokens` of the pragma name token. The pragma end is indicated by a | |
| 25 | /// .nl token (which may be generated if the source ends with a pragma with no newline) | |
| 26 | /// As an example, given the following line: | |
| 27 | /// #pragma GCC diagnostic error "-Wnewline-eof" \n | |
| 28 | /// Then pp.tokens.get(start_idx) will return the `GCC` token. | |
| 29 | /// Return error.UnknownPragma to emit an `unknown_pragma` diagnostic | |
| 30 | /// Return error.StopPreprocessing to stop preprocessing the current file (see once.zig) | |
| 31 | preprocessorHandler: ?*const fn (*Pragma, *Preprocessor, start_idx: TokenIndex) Error!void = null, | |
| 32 | ||
| 33 | /// Called during token pretty-printing (`-E` option). If this returns true, the pragma will | |
| 34 | /// be printed; otherwise it will be omitted. start_idx is the index of the pragma name token | |
| 35 | preserveTokens: ?*const fn (*Pragma, *Preprocessor, start_idx: TokenIndex) bool = null, | |
| 36 | ||
| 37 | /// Same as preprocessorHandler except called during parsing | |
| 38 | /// The parser's `p.tok_i` field must not be changed | |
| 39 | parserHandler: ?*const fn (*Pragma, *Parser, start_idx: TokenIndex) Compilation.Error!void = null, | |
| 40 | ||
| 41 | pub fn pasteTokens(pp: *Preprocessor, start_idx: TokenIndex) ![]const u8 { | |
| 42 | if (pp.tokens.get(start_idx).id == .nl) return error.ExpectedStringLiteral; | |
| 43 | ||
| 44 | const char_top = pp.char_buf.items.len; | |
| 45 | defer pp.char_buf.items.len = char_top; | |
| 46 | var i: usize = 0; | |
| 47 | var lparen_count: u32 = 0; | |
| 48 | var rparen_count: u32 = 0; | |
| 49 | while (true) : (i += 1) { | |
| 50 | const tok = pp.tokens.get(start_idx + i); | |
| 51 | if (tok.id == .nl) break; | |
| 52 | switch (tok.id) { | |
| 53 | .l_paren => { | |
| 54 | if (lparen_count != i) return error.ExpectedStringLiteral; | |
| 55 | lparen_count += 1; | |
| 56 | }, | |
| 57 | .r_paren => rparen_count += 1, | |
| 58 | .string_literal => { | |
| 59 | if (rparen_count != 0) return error.ExpectedStringLiteral; | |
| 60 | const str = pp.expandedSlice(tok); | |
| 61 | try pp.char_buf.appendSlice(str[1 .. str.len - 1]); | |
| 62 | }, | |
| 63 | else => return error.ExpectedStringLiteral, | |
| 64 | } | |
| 65 | } | |
| 66 | if (lparen_count != rparen_count) return error.ExpectedStringLiteral; | |
| 67 | return pp.char_buf.items[char_top..]; | |
| 68 | } | |
| 69 | ||
| 70 | pub fn shouldPreserveTokens(self: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) bool { | |
| 71 | if (self.preserveTokens) |func| return func(self, pp, start_idx); | |
| 72 | return false; | |
| 73 | } | |
| 74 | ||
| 75 | pub fn preprocessorCB(self: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Error!void { | |
| 76 | if (self.preprocessorHandler) |func| return func(self, pp, start_idx); | |
| 77 | } | |
| 78 | ||
| 79 | pub fn parserCB(self: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { | |
| 80 | const tok_index = p.tok_i; | |
| 81 | defer std.debug.assert(tok_index == p.tok_i); | |
| 82 | if (self.parserHandler) |func| return func(self, p, start_idx); | |
| 83 | } |
deps/aro/Preprocessor.zig created+2691| ... | ... | @@ -0,0 +1,2691 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Allocator = mem.Allocator; | |
| 4 | const assert = std.debug.assert; | |
| 5 | const Compilation = @import("Compilation.zig"); | |
| 6 | const Error = Compilation.Error; | |
| 7 | const Source = @import("Source.zig"); | |
| 8 | const Tokenizer = @import("Tokenizer.zig"); | |
| 9 | const RawToken = Tokenizer.Token; | |
| 10 | const Parser = @import("Parser.zig"); | |
| 11 | const Diagnostics = @import("Diagnostics.zig"); | |
| 12 | const Token = @import("Tree.zig").Token; | |
| 13 | const Attribute = @import("Attribute.zig"); | |
| 14 | const features = @import("features.zig"); | |
| 15 | ||
| 16 | const Preprocessor = @This(); | |
| 17 | const DefineMap = std.StringHashMap(Macro); | |
| 18 | const RawTokenList = std.ArrayList(RawToken); | |
| 19 | const max_include_depth = 200; | |
| 20 | ||
| 21 | /// Errors that can be returned when expanding a macro. | |
| 22 | /// error.UnknownPragma can occur within Preprocessor.pragma() but | |
| 23 | /// it is handled there and doesn't escape that function | |
| 24 | const MacroError = Error || error{StopPreprocessing}; | |
| 25 | ||
| 26 | const Macro = struct { | |
| 27 | /// Parameters of the function type macro | |
| 28 | params: []const []const u8, | |
| 29 | ||
| 30 | /// Token constituting the macro body | |
| 31 | tokens: []const RawToken, | |
| 32 | ||
| 33 | /// If the function type macro has variable number of arguments | |
| 34 | var_args: bool, | |
| 35 | ||
| 36 | /// Is a function type macro | |
| 37 | is_func: bool, | |
| 38 | ||
| 39 | /// Is a predefined macro | |
| 40 | is_builtin: bool = false, | |
| 41 | ||
| 42 | /// Location of macro in the source | |
| 43 | /// `byte_offset` and `line` are used to define the range of tokens included | |
| 44 | /// in the macro. | |
| 45 | loc: Source.Location, | |
| 46 | ||
| 47 | fn eql(a: Macro, b: Macro, pp: *Preprocessor) bool { | |
| 48 | if (a.tokens.len != b.tokens.len) return false; | |
| 49 | if (a.is_builtin != b.is_builtin) return false; | |
| 50 | for (a.tokens, b.tokens) |a_tok, b_tok| if (!tokEql(pp, a_tok, b_tok)) return false; | |
| 51 | ||
| 52 | if (a.is_func and b.is_func) { | |
| 53 | if (a.var_args != b.var_args) return false; | |
| 54 | if (a.params.len != b.params.len) return false; | |
| 55 | for (a.params, b.params) |a_param, b_param| if (!mem.eql(u8, a_param, b_param)) return false; | |
| 56 | } | |
| 57 | ||
| 58 | return true; | |
| 59 | } | |
| 60 | ||
| 61 | fn tokEql(pp: *Preprocessor, a: RawToken, b: RawToken) bool { | |
| 62 | return mem.eql(u8, pp.tokSlice(a), pp.tokSlice(b)); | |
| 63 | } | |
| 64 | }; | |
| 65 | ||
| 66 | comp: *Compilation, | |
| 67 | gpa: mem.Allocator, | |
| 68 | arena: std.heap.ArenaAllocator, | |
| 69 | defines: DefineMap, | |
| 70 | tokens: Token.List = .{}, | |
| 71 | token_buf: RawTokenList, | |
| 72 | char_buf: std.ArrayList(u8), | |
| 73 | /// Counter that is incremented each time preprocess() is called | |
| 74 | /// Can be used to distinguish multiple preprocessings of the same file | |
| 75 | preprocess_count: u32 = 0, | |
| 76 | generated_line: u32 = 1, | |
| 77 | add_expansion_nl: u32 = 0, | |
| 78 | include_depth: u8 = 0, | |
| 79 | counter: u32 = 0, | |
| 80 | expansion_source_loc: Source.Location = undefined, | |
| 81 | poisoned_identifiers: std.StringHashMap(void), | |
| 82 | /// Map from Source.Id to macro name in the `#ifndef` condition which guards the source, if any | |
| 83 | include_guards: std.AutoHashMapUnmanaged(Source.Id, []const u8) = .{}, | |
| 84 | ||
| 85 | /// Memory is retained to avoid allocation on every single token. | |
| 86 | top_expansion_buf: ExpandBuf, | |
| 87 | ||
| 88 | /// Dump current state to stderr. | |
| 89 | verbose: bool = false, | |
| 90 | preserve_whitespace: bool = false, | |
| 91 | ||
| 92 | pub fn init(comp: *Compilation) Preprocessor { | |
| 93 | const pp = Preprocessor{ | |
| 94 | .comp = comp, | |
| 95 | .gpa = comp.gpa, | |
| 96 | .arena = std.heap.ArenaAllocator.init(comp.gpa), | |
| 97 | .defines = DefineMap.init(comp.gpa), | |
| 98 | .token_buf = RawTokenList.init(comp.gpa), | |
| 99 | .char_buf = std.ArrayList(u8).init(comp.gpa), | |
| 100 | .poisoned_identifiers = std.StringHashMap(void).init(comp.gpa), | |
| 101 | .top_expansion_buf = ExpandBuf.init(comp.gpa), | |
| 102 | }; | |
| 103 | comp.pragmaEvent(.before_preprocess); | |
| 104 | return pp; | |
| 105 | } | |
| 106 | ||
| 107 | const builtin_macros = struct { | |
| 108 | const args = [1][]const u8{"X"}; | |
| 109 | ||
| 110 | const has_attribute = [1]RawToken{.{ | |
| 111 | .id = .macro_param_has_attribute, | |
| 112 | .source = .generated, | |
| 113 | }}; | |
| 114 | const has_warning = [1]RawToken{.{ | |
| 115 | .id = .macro_param_has_warning, | |
| 116 | .source = .generated, | |
| 117 | }}; | |
| 118 | const has_feature = [1]RawToken{.{ | |
| 119 | .id = .macro_param_has_feature, | |
| 120 | .source = .generated, | |
| 121 | }}; | |
| 122 | const has_extension = [1]RawToken{.{ | |
| 123 | .id = .macro_param_has_extension, | |
| 124 | .source = .generated, | |
| 125 | }}; | |
| 126 | const has_builtin = [1]RawToken{.{ | |
| 127 | .id = .macro_param_has_builtin, | |
| 128 | .source = .generated, | |
| 129 | }}; | |
| 130 | const has_include = [1]RawToken{.{ | |
| 131 | .id = .macro_param_has_include, | |
| 132 | .source = .generated, | |
| 133 | }}; | |
| 134 | const has_include_next = [1]RawToken{.{ | |
| 135 | .id = .macro_param_has_include_next, | |
| 136 | .source = .generated, | |
| 137 | }}; | |
| 138 | ||
| 139 | const is_identifier = [1]RawToken{.{ | |
| 140 | .id = .macro_param_is_identifier, | |
| 141 | .source = .generated, | |
| 142 | }}; | |
| 143 | ||
| 144 | const pragma_operator = [1]RawToken{.{ | |
| 145 | .id = .macro_param_pragma_operator, | |
| 146 | .source = .generated, | |
| 147 | }}; | |
| 148 | ||
| 149 | const file = [1]RawToken{.{ | |
| 150 | .id = .macro_file, | |
| 151 | .source = .generated, | |
| 152 | }}; | |
| 153 | const line = [1]RawToken{.{ | |
| 154 | .id = .macro_line, | |
| 155 | .source = .generated, | |
| 156 | }}; | |
| 157 | const counter = [1]RawToken{.{ | |
| 158 | .id = .macro_counter, | |
| 159 | .source = .generated, | |
| 160 | }}; | |
| 161 | }; | |
| 162 | ||
| 163 | fn addBuiltinMacro(pp: *Preprocessor, name: []const u8, is_func: bool, tokens: []const RawToken) !void { | |
| 164 | try pp.defines.putNoClobber(name, .{ | |
| 165 | .params = &builtin_macros.args, | |
| 166 | .tokens = tokens, | |
| 167 | .var_args = false, | |
| 168 | .is_func = is_func, | |
| 169 | .loc = .{ .id = .generated }, | |
| 170 | .is_builtin = true, | |
| 171 | }); | |
| 172 | } | |
| 173 | ||
| 174 | pub fn addBuiltinMacros(pp: *Preprocessor) !void { | |
| 175 | try pp.addBuiltinMacro("__has_attribute", true, &builtin_macros.has_attribute); | |
| 176 | try pp.addBuiltinMacro("__has_warning", true, &builtin_macros.has_warning); | |
| 177 | try pp.addBuiltinMacro("__has_feature", true, &builtin_macros.has_feature); | |
| 178 | try pp.addBuiltinMacro("__has_extension", true, &builtin_macros.has_extension); | |
| 179 | try pp.addBuiltinMacro("__has_builtin", true, &builtin_macros.has_builtin); | |
| 180 | try pp.addBuiltinMacro("__has_include", true, &builtin_macros.has_include); | |
| 181 | try pp.addBuiltinMacro("__has_include_next", true, &builtin_macros.has_include_next); | |
| 182 | try pp.addBuiltinMacro("__is_identifier", true, &builtin_macros.is_identifier); | |
| 183 | try pp.addBuiltinMacro("_Pragma", true, &builtin_macros.pragma_operator); | |
| 184 | ||
| 185 | try pp.addBuiltinMacro("__FILE__", false, &builtin_macros.file); | |
| 186 | try pp.addBuiltinMacro("__LINE__", false, &builtin_macros.line); | |
| 187 | try pp.addBuiltinMacro("__COUNTER__", false, &builtin_macros.counter); | |
| 188 | } | |
| 189 | ||
| 190 | pub fn deinit(pp: *Preprocessor) void { | |
| 191 | pp.defines.deinit(); | |
| 192 | for (pp.tokens.items(.expansion_locs)) |loc| Token.free(loc, pp.gpa); | |
| 193 | pp.tokens.deinit(pp.gpa); | |
| 194 | pp.arena.deinit(); | |
| 195 | pp.token_buf.deinit(); | |
| 196 | pp.char_buf.deinit(); | |
| 197 | pp.poisoned_identifiers.deinit(); | |
| 198 | pp.include_guards.deinit(pp.gpa); | |
| 199 | pp.top_expansion_buf.deinit(); | |
| 200 | } | |
| 201 | ||
| 202 | /// Preprocess a source file, returns eof token. | |
| 203 | pub fn preprocess(pp: *Preprocessor, source: Source) Error!Token { | |
| 204 | return pp.preprocessExtra(source) catch |er| switch (er) { | |
| 205 | // This cannot occur in the main file and is handled in `include`. | |
| 206 | error.StopPreprocessing => unreachable, | |
| 207 | else => |e| return e, | |
| 208 | }; | |
| 209 | } | |
| 210 | ||
| 211 | /// Return the name of the #ifndef guard macro that starts a source, if any. | |
| 212 | fn findIncludeGuard(pp: *Preprocessor, source: Source) ?[]const u8 { | |
| 213 | var tokenizer = Tokenizer{ | |
| 214 | .buf = source.buf, | |
| 215 | .comp = pp.comp, | |
| 216 | .source = source.id, | |
| 217 | }; | |
| 218 | var hash = tokenizer.nextNoWS(); | |
| 219 | while (hash.id == .nl) hash = tokenizer.nextNoWS(); | |
| 220 | if (hash.id != .hash) return null; | |
| 221 | const ifndef = tokenizer.nextNoWS(); | |
| 222 | if (ifndef.id != .keyword_ifndef) return null; | |
| 223 | const guard = tokenizer.nextNoWS(); | |
| 224 | if (guard.id != .identifier) return null; | |
| 225 | return pp.tokSlice(guard); | |
| 226 | } | |
| 227 | ||
| 228 | fn preprocessExtra(pp: *Preprocessor, source: Source) MacroError!Token { | |
| 229 | if (pp.comp.invalid_utf8_locs.get(source.id)) |offset| { | |
| 230 | try pp.comp.diag.add(.{ | |
| 231 | .tag = .invalid_utf8, | |
| 232 | // Todo: compute line number | |
| 233 | .loc = .{ .id = source.id, .byte_offset = offset }, | |
| 234 | }, &.{}); | |
| 235 | return error.FatalError; | |
| 236 | } | |
| 237 | var guard_name = pp.findIncludeGuard(source); | |
| 238 | ||
| 239 | pp.preprocess_count += 1; | |
| 240 | var tokenizer = Tokenizer{ | |
| 241 | .buf = source.buf, | |
| 242 | .comp = pp.comp, | |
| 243 | .source = source.id, | |
| 244 | }; | |
| 245 | ||
| 246 | // Estimate how many new tokens this source will contain. | |
| 247 | const estimated_token_count = source.buf.len / 8; | |
| 248 | try pp.tokens.ensureTotalCapacity(pp.gpa, pp.tokens.len + estimated_token_count); | |
| 249 | ||
| 250 | var if_level: u8 = 0; | |
| 251 | var if_kind = std.PackedIntArray(u2, 256).init([1]u2{0} ** 256); | |
| 252 | const until_else = 0; | |
| 253 | const until_endif = 1; | |
| 254 | const until_endif_seen_else = 2; | |
| 255 | ||
| 256 | var start_of_line = true; | |
| 257 | while (true) { | |
| 258 | var tok = tokenizer.next(); | |
| 259 | switch (tok.id) { | |
| 260 | .hash => if (!start_of_line) try pp.tokens.append(pp.gpa, tokFromRaw(tok)) else { | |
| 261 | const directive = tokenizer.nextNoWS(); | |
| 262 | switch (directive.id) { | |
| 263 | .keyword_error, .keyword_warning => { | |
| 264 | // #error tokens.. | |
| 265 | pp.top_expansion_buf.items.len = 0; | |
| 266 | const char_top = pp.char_buf.items.len; | |
| 267 | defer pp.char_buf.items.len = char_top; | |
| 268 | ||
| 269 | while (true) { | |
| 270 | tok = tokenizer.next(); | |
| 271 | if (tok.id == .nl or tok.id == .eof) break; | |
| 272 | if (tok.id == .whitespace) tok.id = .macro_ws; | |
| 273 | try pp.top_expansion_buf.append(tokFromRaw(tok)); | |
| 274 | } | |
| 275 | try pp.stringify(pp.top_expansion_buf.items); | |
| 276 | const slice = pp.char_buf.items[char_top + 1 .. pp.char_buf.items.len - 2]; | |
| 277 | const duped = try pp.comp.diag.arena.allocator().dupe(u8, slice); | |
| 278 | ||
| 279 | try pp.comp.diag.add(.{ | |
| 280 | .tag = if (directive.id == .keyword_error) .error_directive else .warning_directive, | |
| 281 | .loc = .{ .id = tok.source, .byte_offset = directive.start, .line = directive.line }, | |
| 282 | .extra = .{ .str = duped }, | |
| 283 | }, &.{}); | |
| 284 | }, | |
| 285 | .keyword_if => { | |
| 286 | const sum, const overflowed = @addWithOverflow(if_level, 1); | |
| 287 | if (overflowed != 0) | |
| 288 | return pp.fatal(directive, "too many #if nestings", .{}); | |
| 289 | if_level = sum; | |
| 290 | ||
| 291 | if (try pp.expr(&tokenizer)) { | |
| 292 | if_kind.set(if_level, until_endif); | |
| 293 | if (pp.verbose) { | |
| 294 | pp.verboseLog(directive, "entering then branch of #if", .{}); | |
| 295 | } | |
| 296 | } else { | |
| 297 | if_kind.set(if_level, until_else); | |
| 298 | try pp.skip(&tokenizer, .until_else); | |
| 299 | if (pp.verbose) { | |
| 300 | pp.verboseLog(directive, "entering else branch of #if", .{}); | |
| 301 | } | |
| 302 | } | |
| 303 | }, | |
| 304 | .keyword_ifdef => { | |
| 305 | const sum, const overflowed = @addWithOverflow(if_level, 1); | |
| 306 | if (overflowed != 0) | |
| 307 | return pp.fatal(directive, "too many #if nestings", .{}); | |
| 308 | if_level = sum; | |
| 309 | ||
| 310 | const macro_name = (try pp.expectMacroName(&tokenizer)) orelse continue; | |
| 311 | try pp.expectNl(&tokenizer); | |
| 312 | if (pp.defines.get(macro_name) != null) { | |
| 313 | if_kind.set(if_level, until_endif); | |
| 314 | if (pp.verbose) { | |
| 315 | pp.verboseLog(directive, "entering then branch of #ifdef", .{}); | |
| 316 | } | |
| 317 | } else { | |
| 318 | if_kind.set(if_level, until_else); | |
| 319 | try pp.skip(&tokenizer, .until_else); | |
| 320 | if (pp.verbose) { | |
| 321 | pp.verboseLog(directive, "entering else branch of #ifdef", .{}); | |
| 322 | } | |
| 323 | } | |
| 324 | }, | |
| 325 | .keyword_ifndef => { | |
| 326 | const sum, const overflowed = @addWithOverflow(if_level, 1); | |
| 327 | if (overflowed != 0) | |
| 328 | return pp.fatal(directive, "too many #if nestings", .{}); | |
| 329 | if_level = sum; | |
| 330 | ||
| 331 | const macro_name = (try pp.expectMacroName(&tokenizer)) orelse continue; | |
| 332 | try pp.expectNl(&tokenizer); | |
| 333 | if (pp.defines.get(macro_name) == null) { | |
| 334 | if_kind.set(if_level, until_endif); | |
| 335 | } else { | |
| 336 | if_kind.set(if_level, until_else); | |
| 337 | try pp.skip(&tokenizer, .until_else); | |
| 338 | } | |
| 339 | }, | |
| 340 | .keyword_elif => { | |
| 341 | if (if_level == 0) { | |
| 342 | try pp.err(directive, .elif_without_if); | |
| 343 | if_level += 1; | |
| 344 | if_kind.set(if_level, until_else); | |
| 345 | } else if (if_level == 1) { | |
| 346 | guard_name = null; | |
| 347 | } | |
| 348 | switch (if_kind.get(if_level)) { | |
| 349 | until_else => if (try pp.expr(&tokenizer)) { | |
| 350 | if_kind.set(if_level, until_endif); | |
| 351 | if (pp.verbose) { | |
| 352 | pp.verboseLog(directive, "entering then branch of #elif", .{}); | |
| 353 | } | |
| 354 | } else { | |
| 355 | try pp.skip(&tokenizer, .until_else); | |
| 356 | if (pp.verbose) { | |
| 357 | pp.verboseLog(directive, "entering else branch of #elif", .{}); | |
| 358 | } | |
| 359 | }, | |
| 360 | until_endif => try pp.skip(&tokenizer, .until_endif), | |
| 361 | until_endif_seen_else => { | |
| 362 | try pp.err(directive, .elif_after_else); | |
| 363 | skipToNl(&tokenizer); | |
| 364 | }, | |
| 365 | else => unreachable, | |
| 366 | } | |
| 367 | }, | |
| 368 | .keyword_elifdef => { | |
| 369 | if (if_level == 0) { | |
| 370 | try pp.err(directive, .elifdef_without_if); | |
| 371 | if_level += 1; | |
| 372 | if_kind.set(if_level, until_else); | |
| 373 | } else if (if_level == 1) { | |
| 374 | guard_name = null; | |
| 375 | } | |
| 376 | switch (if_kind.get(if_level)) { | |
| 377 | until_else => { | |
| 378 | const macro_name = try pp.expectMacroName(&tokenizer); | |
| 379 | if (macro_name == null) { | |
| 380 | if_kind.set(if_level, until_else); | |
| 381 | try pp.skip(&tokenizer, .until_else); | |
| 382 | if (pp.verbose) { | |
| 383 | pp.verboseLog(directive, "entering else branch of #elifdef", .{}); | |
| 384 | } | |
| 385 | } else { | |
| 386 | try pp.expectNl(&tokenizer); | |
| 387 | if (pp.defines.get(macro_name.?) != null) { | |
| 388 | if_kind.set(if_level, until_endif); | |
| 389 | if (pp.verbose) { | |
| 390 | pp.verboseLog(directive, "entering then branch of #elifdef", .{}); | |
| 391 | } | |
| 392 | } else { | |
| 393 | if_kind.set(if_level, until_else); | |
| 394 | try pp.skip(&tokenizer, .until_else); | |
| 395 | if (pp.verbose) { | |
| 396 | pp.verboseLog(directive, "entering else branch of #elifdef", .{}); | |
| 397 | } | |
| 398 | } | |
| 399 | } | |
| 400 | }, | |
| 401 | until_endif => try pp.skip(&tokenizer, .until_endif), | |
| 402 | until_endif_seen_else => { | |
| 403 | try pp.err(directive, .elifdef_after_else); | |
| 404 | skipToNl(&tokenizer); | |
| 405 | }, | |
| 406 | else => unreachable, | |
| 407 | } | |
| 408 | }, | |
| 409 | .keyword_elifndef => { | |
| 410 | if (if_level == 0) { | |
| 411 | try pp.err(directive, .elifdef_without_if); | |
| 412 | if_level += 1; | |
| 413 | if_kind.set(if_level, until_else); | |
| 414 | } else if (if_level == 1) { | |
| 415 | guard_name = null; | |
| 416 | } | |
| 417 | switch (if_kind.get(if_level)) { | |
| 418 | until_else => { | |
| 419 | const macro_name = try pp.expectMacroName(&tokenizer); | |
| 420 | if (macro_name == null) { | |
| 421 | if_kind.set(if_level, until_else); | |
| 422 | try pp.skip(&tokenizer, .until_else); | |
| 423 | if (pp.verbose) { | |
| 424 | pp.verboseLog(directive, "entering else branch of #elifndef", .{}); | |
| 425 | } | |
| 426 | } else { | |
| 427 | try pp.expectNl(&tokenizer); | |
| 428 | if (pp.defines.get(macro_name.?) == null) { | |
| 429 | if_kind.set(if_level, until_endif); | |
| 430 | if (pp.verbose) { | |
| 431 | pp.verboseLog(directive, "entering then branch of #elifndef", .{}); | |
| 432 | } | |
| 433 | } else { | |
| 434 | if_kind.set(if_level, until_else); | |
| 435 | try pp.skip(&tokenizer, .until_else); | |
| 436 | if (pp.verbose) { | |
| 437 | pp.verboseLog(directive, "entering else branch of #elifndef", .{}); | |
| 438 | } | |
| 439 | } | |
| 440 | } | |
| 441 | }, | |
| 442 | until_endif => try pp.skip(&tokenizer, .until_endif), | |
| 443 | until_endif_seen_else => { | |
| 444 | try pp.err(directive, .elifdef_after_else); | |
| 445 | skipToNl(&tokenizer); | |
| 446 | }, | |
| 447 | else => unreachable, | |
| 448 | } | |
| 449 | }, | |
| 450 | .keyword_else => { | |
| 451 | try pp.expectNl(&tokenizer); | |
| 452 | if (if_level == 0) { | |
| 453 | try pp.err(directive, .else_without_if); | |
| 454 | continue; | |
| 455 | } else if (if_level == 1) { | |
| 456 | guard_name = null; | |
| 457 | } | |
| 458 | switch (if_kind.get(if_level)) { | |
| 459 | until_else => { | |
| 460 | if_kind.set(if_level, until_endif_seen_else); | |
| 461 | if (pp.verbose) { | |
| 462 | pp.verboseLog(directive, "#else branch here", .{}); | |
| 463 | } | |
| 464 | }, | |
| 465 | until_endif => try pp.skip(&tokenizer, .until_endif_seen_else), | |
| 466 | until_endif_seen_else => { | |
| 467 | try pp.err(directive, .else_after_else); | |
| 468 | skipToNl(&tokenizer); | |
| 469 | }, | |
| 470 | else => unreachable, | |
| 471 | } | |
| 472 | }, | |
| 473 | .keyword_endif => { | |
| 474 | try pp.expectNl(&tokenizer); | |
| 475 | if (if_level == 0) { | |
| 476 | guard_name = null; | |
| 477 | try pp.err(directive, .endif_without_if); | |
| 478 | continue; | |
| 479 | } else if (if_level == 1) { | |
| 480 | const saved_tokenizer = tokenizer; | |
| 481 | defer tokenizer = saved_tokenizer; | |
| 482 | ||
| 483 | var next = tokenizer.nextNoWS(); | |
| 484 | while (next.id == .nl) : (next = tokenizer.nextNoWS()) {} | |
| 485 | if (next.id != .eof) guard_name = null; | |
| 486 | } | |
| 487 | if_level -= 1; | |
| 488 | }, | |
| 489 | .keyword_define => try pp.define(&tokenizer), | |
| 490 | .keyword_undef => { | |
| 491 | const macro_name = (try pp.expectMacroName(&tokenizer)) orelse continue; | |
| 492 | ||
| 493 | _ = pp.defines.remove(macro_name); | |
| 494 | try pp.expectNl(&tokenizer); | |
| 495 | }, | |
| 496 | .keyword_include => try pp.include(&tokenizer, .first), | |
| 497 | .keyword_include_next => { | |
| 498 | try pp.comp.diag.add(.{ | |
| 499 | .tag = .include_next, | |
| 500 | .loc = .{ .id = tok.source, .byte_offset = directive.start, .line = directive.line }, | |
| 501 | }, &.{}); | |
| 502 | if (pp.include_depth == 0) { | |
| 503 | try pp.comp.diag.add(.{ | |
| 504 | .tag = .include_next_outside_header, | |
| 505 | .loc = .{ .id = tok.source, .byte_offset = directive.start, .line = directive.line }, | |
| 506 | }, &.{}); | |
| 507 | try pp.include(&tokenizer, .first); | |
| 508 | } else { | |
| 509 | try pp.include(&tokenizer, .next); | |
| 510 | } | |
| 511 | }, | |
| 512 | .keyword_embed => try pp.embed(&tokenizer), | |
| 513 | .keyword_pragma => try pp.pragma(&tokenizer, directive, null, &.{}), | |
| 514 | .keyword_line => { | |
| 515 | // #line number "file" | |
| 516 | const digits = tokenizer.nextNoWS(); | |
| 517 | if (digits.id != .pp_num) try pp.err(digits, .line_simple_digit); | |
| 518 | // TODO: validate that the pp_num token is solely digits | |
| 519 | ||
| 520 | if (digits.id == .eof or digits.id == .nl) continue; | |
| 521 | const name = tokenizer.nextNoWS(); | |
| 522 | if (name.id == .eof or name.id == .nl) continue; | |
| 523 | if (name.id != .string_literal) try pp.err(name, .line_invalid_filename); | |
| 524 | try pp.expectNl(&tokenizer); | |
| 525 | }, | |
| 526 | .pp_num => { | |
| 527 | // # number "file" flags | |
| 528 | // TODO: validate that the pp_num token is solely digits | |
| 529 | // if not, emit `GNU line marker directive requires a simple digit sequence` | |
| 530 | const name = tokenizer.nextNoWS(); | |
| 531 | if (name.id == .eof or name.id == .nl) continue; | |
| 532 | if (name.id != .string_literal) try pp.err(name, .line_invalid_filename); | |
| 533 | ||
| 534 | const flag_1 = tokenizer.nextNoWS(); | |
| 535 | if (flag_1.id == .eof or flag_1.id == .nl) continue; | |
| 536 | const flag_2 = tokenizer.nextNoWS(); | |
| 537 | if (flag_2.id == .eof or flag_2.id == .nl) continue; | |
| 538 | const flag_3 = tokenizer.nextNoWS(); | |
| 539 | if (flag_3.id == .eof or flag_3.id == .nl) continue; | |
| 540 | const flag_4 = tokenizer.nextNoWS(); | |
| 541 | if (flag_4.id == .eof or flag_4.id == .nl) continue; | |
| 542 | try pp.expectNl(&tokenizer); | |
| 543 | }, | |
| 544 | .nl => {}, | |
| 545 | .eof => { | |
| 546 | if (if_level != 0) try pp.err(tok, .unterminated_conditional_directive); | |
| 547 | return tokFromRaw(directive); | |
| 548 | }, | |
| 549 | else => { | |
| 550 | try pp.err(tok, .invalid_preprocessing_directive); | |
| 551 | skipToNl(&tokenizer); | |
| 552 | }, | |
| 553 | } | |
| 554 | }, | |
| 555 | .whitespace => if (pp.preserve_whitespace) try pp.tokens.append(pp.gpa, tokFromRaw(tok)), | |
| 556 | .nl => { | |
| 557 | start_of_line = true; | |
| 558 | if (pp.preserve_whitespace) try pp.tokens.append(pp.gpa, tokFromRaw(tok)); | |
| 559 | }, | |
| 560 | .eof => { | |
| 561 | if (if_level != 0) try pp.err(tok, .unterminated_conditional_directive); | |
| 562 | // The following check needs to occur here and not at the top of the function | |
| 563 | // because a pragma may change the level during preprocessing | |
| 564 | if (source.buf.len > 0 and source.buf[source.buf.len - 1] != '\n') { | |
| 565 | try pp.err(tok, .newline_eof); | |
| 566 | } | |
| 567 | if (guard_name) |name| { | |
| 568 | if (try pp.include_guards.fetchPut(pp.gpa, source.id, name)) |prev| { | |
| 569 | assert(mem.eql(u8, name, prev.value)); | |
| 570 | } | |
| 571 | } | |
| 572 | return tokFromRaw(tok); | |
| 573 | }, | |
| 574 | else => { | |
| 575 | if (tok.id.isMacroIdentifier() and pp.poisoned_identifiers.get(pp.tokSlice(tok)) != null) { | |
| 576 | try pp.err(tok, .poisoned_identifier); | |
| 577 | } | |
| 578 | // Add the token to the buffer doing any necessary expansions. | |
| 579 | start_of_line = false; | |
| 580 | try pp.expandMacro(&tokenizer, tok); | |
| 581 | }, | |
| 582 | } | |
| 583 | } | |
| 584 | } | |
| 585 | ||
| 586 | /// Get raw token source string. | |
| 587 | /// Returned slice is invalidated when comp.generated_buf is updated. | |
| 588 | pub fn tokSlice(pp: *Preprocessor, token: RawToken) []const u8 { | |
| 589 | if (token.id.lexeme()) |some| return some; | |
| 590 | const source = pp.comp.getSource(token.source); | |
| 591 | return source.buf[token.start..token.end]; | |
| 592 | } | |
| 593 | ||
| 594 | /// Convert a token from the Tokenizer into a token used by the parser. | |
| 595 | fn tokFromRaw(raw: RawToken) Token { | |
| 596 | return .{ | |
| 597 | .id = raw.id, | |
| 598 | .loc = .{ | |
| 599 | .id = raw.source, | |
| 600 | .byte_offset = raw.start, | |
| 601 | .line = raw.line, | |
| 602 | }, | |
| 603 | }; | |
| 604 | } | |
| 605 | ||
| 606 | fn err(pp: *Preprocessor, raw: RawToken, tag: Diagnostics.Tag) !void { | |
| 607 | try pp.comp.diag.add(.{ | |
| 608 | .tag = tag, | |
| 609 | .loc = .{ | |
| 610 | .id = raw.source, | |
| 611 | .byte_offset = raw.start, | |
| 612 | .line = raw.line, | |
| 613 | }, | |
| 614 | }, &.{}); | |
| 615 | } | |
| 616 | ||
| 617 | fn fatal(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) Compilation.Error { | |
| 618 | const source = pp.comp.getSource(raw.source); | |
| 619 | const line_col = source.lineCol(.{ .id = raw.source, .line = raw.line, .byte_offset = raw.start }); | |
| 620 | return pp.comp.diag.fatal(source.path, line_col.line, raw.line, line_col.col, fmt, args); | |
| 621 | } | |
| 622 | ||
| 623 | fn verboseLog(pp: *Preprocessor, raw: RawToken, comptime fmt: []const u8, args: anytype) void { | |
| 624 | const source = pp.comp.getSource(raw.source); | |
| 625 | const line_col = source.lineCol(.{ .id = raw.source, .line = raw.line, .byte_offset = raw.start }); | |
| 626 | ||
| 627 | const stderr = std.io.getStdErr().writer(); | |
| 628 | var buf_writer = std.io.bufferedWriter(stderr); | |
| 629 | const writer = buf_writer.writer(); | |
| 630 | defer buf_writer.flush() catch {}; | |
| 631 | writer.print("{s}:{d}:{d}: ", .{ source.path, line_col.line_no, line_col.col }) catch return; | |
| 632 | writer.print(fmt, args) catch return; | |
| 633 | writer.writeByte('\n') catch return; | |
| 634 | writer.writeAll(line_col.line) catch return; | |
| 635 | writer.writeByte('\n') catch return; | |
| 636 | } | |
| 637 | ||
| 638 | /// Consume next token, error if it is not an identifier. | |
| 639 | fn expectMacroName(pp: *Preprocessor, tokenizer: *Tokenizer) Error!?[]const u8 { | |
| 640 | const macro_name = tokenizer.nextNoWS(); | |
| 641 | if (!macro_name.id.isMacroIdentifier()) { | |
| 642 | try pp.err(macro_name, .macro_name_missing); | |
| 643 | skipToNl(tokenizer); | |
| 644 | return null; | |
| 645 | } | |
| 646 | return pp.tokSlice(macro_name); | |
| 647 | } | |
| 648 | ||
| 649 | /// Skip until after a newline, error if extra tokens before it. | |
| 650 | fn expectNl(pp: *Preprocessor, tokenizer: *Tokenizer) Error!void { | |
| 651 | var sent_err = false; | |
| 652 | while (true) { | |
| 653 | const tok = tokenizer.next(); | |
| 654 | if (tok.id == .nl or tok.id == .eof) return; | |
| 655 | if (tok.id == .whitespace) continue; | |
| 656 | if (!sent_err) { | |
| 657 | sent_err = true; | |
| 658 | try pp.err(tok, .extra_tokens_directive_end); | |
| 659 | } | |
| 660 | } | |
| 661 | } | |
| 662 | ||
| 663 | /// Consume all tokens until a newline and parse the result into a boolean. | |
| 664 | fn expr(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!bool { | |
| 665 | const start = pp.tokens.len; | |
| 666 | defer { | |
| 667 | for (pp.top_expansion_buf.items) |tok| Token.free(tok.expansion_locs, pp.gpa); | |
| 668 | pp.tokens.len = start; | |
| 669 | } | |
| 670 | ||
| 671 | pp.top_expansion_buf.items.len = 0; | |
| 672 | const eof = while (true) { | |
| 673 | var tok = tokenizer.next(); | |
| 674 | switch (tok.id) { | |
| 675 | .nl, .eof => break tok, | |
| 676 | .whitespace => if (pp.top_expansion_buf.items.len == 0) continue, | |
| 677 | else => {}, | |
| 678 | } | |
| 679 | try pp.top_expansion_buf.append(tokFromRaw(tok)); | |
| 680 | } else unreachable; | |
| 681 | if (pp.top_expansion_buf.items.len != 0) { | |
| 682 | pp.expansion_source_loc = pp.top_expansion_buf.items[0].loc; | |
| 683 | try pp.expandMacroExhaustive(tokenizer, &pp.top_expansion_buf, 0, pp.top_expansion_buf.items.len, false, .expr); | |
| 684 | } | |
| 685 | for (pp.top_expansion_buf.items) |tok| { | |
| 686 | if (tok.id == .macro_ws) continue; | |
| 687 | if (!tok.id.validPreprocessorExprStart()) { | |
| 688 | try pp.comp.diag.add(.{ | |
| 689 | .tag = .invalid_preproc_expr_start, | |
| 690 | .loc = tok.loc, | |
| 691 | }, tok.expansionSlice()); | |
| 692 | return false; | |
| 693 | } | |
| 694 | break; | |
| 695 | } else { | |
| 696 | try pp.err(eof, .expected_value_in_expr); | |
| 697 | return false; | |
| 698 | } | |
| 699 | ||
| 700 | // validate the tokens in the expression | |
| 701 | try pp.tokens.ensureUnusedCapacity(pp.gpa, pp.top_expansion_buf.items.len); | |
| 702 | var i: usize = 0; | |
| 703 | const items = pp.top_expansion_buf.items; | |
| 704 | while (i < items.len) : (i += 1) { | |
| 705 | var tok = items[i]; | |
| 706 | switch (tok.id) { | |
| 707 | .string_literal, | |
| 708 | .string_literal_utf_16, | |
| 709 | .string_literal_utf_8, | |
| 710 | .string_literal_utf_32, | |
| 711 | .string_literal_wide, | |
| 712 | => { | |
| 713 | try pp.comp.diag.add(.{ | |
| 714 | .tag = .string_literal_in_pp_expr, | |
| 715 | .loc = tok.loc, | |
| 716 | }, tok.expansionSlice()); | |
| 717 | return false; | |
| 718 | }, | |
| 719 | .plus_plus, | |
| 720 | .minus_minus, | |
| 721 | .plus_equal, | |
| 722 | .minus_equal, | |
| 723 | .asterisk_equal, | |
| 724 | .slash_equal, | |
| 725 | .percent_equal, | |
| 726 | .angle_bracket_angle_bracket_left_equal, | |
| 727 | .angle_bracket_angle_bracket_right_equal, | |
| 728 | .ampersand_equal, | |
| 729 | .caret_equal, | |
| 730 | .pipe_equal, | |
| 731 | .l_bracket, | |
| 732 | .r_bracket, | |
| 733 | .l_brace, | |
| 734 | .r_brace, | |
| 735 | .ellipsis, | |
| 736 | .semicolon, | |
| 737 | .hash, | |
| 738 | .hash_hash, | |
| 739 | .equal, | |
| 740 | .arrow, | |
| 741 | .period, | |
| 742 | => { | |
| 743 | try pp.comp.diag.add(.{ | |
| 744 | .tag = .invalid_preproc_operator, | |
| 745 | .loc = tok.loc, | |
| 746 | }, tok.expansionSlice()); | |
| 747 | return false; | |
| 748 | }, | |
| 749 | .macro_ws, .whitespace => continue, | |
| 750 | .keyword_false => tok.id = .zero, | |
| 751 | .keyword_true => tok.id = .one, | |
| 752 | else => if (tok.id.isMacroIdentifier()) { | |
| 753 | if (tok.id == .keyword_defined) { | |
| 754 | const tokens_consumed = try pp.handleKeywordDefined(&tok, items[i + 1 ..], eof); | |
| 755 | i += tokens_consumed; | |
| 756 | } else { | |
| 757 | try pp.comp.diag.add(.{ | |
| 758 | .tag = .undefined_macro, | |
| 759 | .loc = tok.loc, | |
| 760 | .extra = .{ .str = pp.expandedSlice(tok) }, | |
| 761 | }, tok.expansionSlice()); | |
| 762 | ||
| 763 | if (i + 1 < pp.top_expansion_buf.items.len and | |
| 764 | pp.top_expansion_buf.items[i + 1].id == .l_paren) | |
| 765 | { | |
| 766 | try pp.comp.diag.add(.{ | |
| 767 | .tag = .fn_macro_undefined, | |
| 768 | .loc = tok.loc, | |
| 769 | .extra = .{ .str = pp.expandedSlice(tok) }, | |
| 770 | }, tok.expansionSlice()); | |
| 771 | return false; | |
| 772 | } | |
| 773 | ||
| 774 | tok.id = .zero; // undefined macro | |
| 775 | } | |
| 776 | }, | |
| 777 | } | |
| 778 | pp.tokens.appendAssumeCapacity(tok); | |
| 779 | } | |
| 780 | try pp.tokens.append(pp.gpa, .{ | |
| 781 | .id = .eof, | |
| 782 | .loc = tokFromRaw(eof).loc, | |
| 783 | }); | |
| 784 | ||
| 785 | // Actually parse it. | |
| 786 | var parser = Parser{ | |
| 787 | .pp = pp, | |
| 788 | .comp = pp.comp, | |
| 789 | .gpa = pp.gpa, | |
| 790 | .tok_ids = pp.tokens.items(.id), | |
| 791 | .tok_i = @intCast(start), | |
| 792 | .arena = pp.arena.allocator(), | |
| 793 | .in_macro = true, | |
| 794 | .data = undefined, | |
| 795 | .strings = undefined, | |
| 796 | .retained_strings = undefined, | |
| 797 | .value_map = undefined, | |
| 798 | .labels = undefined, | |
| 799 | .decl_buf = undefined, | |
| 800 | .list_buf = undefined, | |
| 801 | .param_buf = undefined, | |
| 802 | .enum_buf = undefined, | |
| 803 | .record_buf = undefined, | |
| 804 | .attr_buf = undefined, | |
| 805 | .field_attr_buf = undefined, | |
| 806 | .string_ids = undefined, | |
| 807 | }; | |
| 808 | return parser.macroExpr(); | |
| 809 | } | |
| 810 | ||
| 811 | /// Turns macro_tok from .keyword_defined into .zero or .one depending on whether the argument is defined | |
| 812 | /// Returns the number of tokens consumed | |
| 813 | fn handleKeywordDefined(pp: *Preprocessor, macro_tok: *Token, tokens: []const Token, eof: RawToken) !usize { | |
| 814 | std.debug.assert(macro_tok.id == .keyword_defined); | |
| 815 | var it = TokenIterator.init(tokens); | |
| 816 | const first = it.nextNoWS() orelse { | |
| 817 | try pp.err(eof, .macro_name_missing); | |
| 818 | return it.i; | |
| 819 | }; | |
| 820 | switch (first.id) { | |
| 821 | .l_paren => {}, | |
| 822 | else => { | |
| 823 | if (!first.id.isMacroIdentifier()) { | |
| 824 | try pp.comp.diag.add(.{ | |
| 825 | .tag = .macro_name_must_be_identifier, | |
| 826 | .loc = first.loc, | |
| 827 | .extra = .{ .str = pp.expandedSlice(first) }, | |
| 828 | }, first.expansionSlice()); | |
| 829 | } | |
| 830 | macro_tok.id = if (pp.defines.contains(pp.expandedSlice(first))) .one else .zero; | |
| 831 | return it.i; | |
| 832 | }, | |
| 833 | } | |
| 834 | const second = it.nextNoWS() orelse { | |
| 835 | try pp.err(eof, .macro_name_missing); | |
| 836 | return it.i; | |
| 837 | }; | |
| 838 | if (!second.id.isMacroIdentifier()) { | |
| 839 | try pp.comp.diag.add(.{ | |
| 840 | .tag = .macro_name_must_be_identifier, | |
| 841 | .loc = second.loc, | |
| 842 | }, second.expansionSlice()); | |
| 843 | return it.i; | |
| 844 | } | |
| 845 | macro_tok.id = if (pp.defines.contains(pp.expandedSlice(second))) .one else .zero; | |
| 846 | ||
| 847 | const last = it.nextNoWS(); | |
| 848 | if (last == null or last.?.id != .r_paren) { | |
| 849 | const tok = last orelse tokFromRaw(eof); | |
| 850 | try pp.comp.diag.add(.{ | |
| 851 | .tag = .closing_paren, | |
| 852 | .loc = tok.loc, | |
| 853 | }, tok.expansionSlice()); | |
| 854 | try pp.comp.diag.add(.{ | |
| 855 | .tag = .to_match_paren, | |
| 856 | .loc = first.loc, | |
| 857 | }, first.expansionSlice()); | |
| 858 | } | |
| 859 | ||
| 860 | return it.i; | |
| 861 | } | |
| 862 | ||
| 863 | /// Skip until #else #elif #endif, return last directive token id. | |
| 864 | /// Also skips nested #if ... #endifs. | |
| 865 | fn skip( | |
| 866 | pp: *Preprocessor, | |
| 867 | tokenizer: *Tokenizer, | |
| 868 | cont: enum { until_else, until_endif, until_endif_seen_else }, | |
| 869 | ) Error!void { | |
| 870 | var ifs_seen: u32 = 0; | |
| 871 | var line_start = true; | |
| 872 | while (tokenizer.index < tokenizer.buf.len) { | |
| 873 | if (line_start) { | |
| 874 | const saved_tokenizer = tokenizer.*; | |
| 875 | const hash = tokenizer.nextNoWS(); | |
| 876 | if (hash.id == .nl) continue; | |
| 877 | line_start = false; | |
| 878 | if (hash.id != .hash) continue; | |
| 879 | const directive = tokenizer.nextNoWS(); | |
| 880 | switch (directive.id) { | |
| 881 | .keyword_else => { | |
| 882 | if (ifs_seen != 0) continue; | |
| 883 | if (cont == .until_endif_seen_else) { | |
| 884 | try pp.err(directive, .else_after_else); | |
| 885 | continue; | |
| 886 | } | |
| 887 | tokenizer.* = saved_tokenizer; | |
| 888 | return; | |
| 889 | }, | |
| 890 | .keyword_elif => { | |
| 891 | if (ifs_seen != 0 or cont == .until_endif) continue; | |
| 892 | if (cont == .until_endif_seen_else) { | |
| 893 | try pp.err(directive, .elif_after_else); | |
| 894 | continue; | |
| 895 | } | |
| 896 | tokenizer.* = saved_tokenizer; | |
| 897 | return; | |
| 898 | }, | |
| 899 | .keyword_elifdef => { | |
| 900 | if (ifs_seen != 0 or cont == .until_endif) continue; | |
| 901 | if (cont == .until_endif_seen_else) { | |
| 902 | try pp.err(directive, .elifdef_after_else); | |
| 903 | continue; | |
| 904 | } | |
| 905 | tokenizer.* = saved_tokenizer; | |
| 906 | return; | |
| 907 | }, | |
| 908 | .keyword_elifndef => { | |
| 909 | if (ifs_seen != 0 or cont == .until_endif) continue; | |
| 910 | if (cont == .until_endif_seen_else) { | |
| 911 | try pp.err(directive, .elifndef_after_else); | |
| 912 | continue; | |
| 913 | } | |
| 914 | tokenizer.* = saved_tokenizer; | |
| 915 | return; | |
| 916 | }, | |
| 917 | .keyword_endif => { | |
| 918 | if (ifs_seen == 0) { | |
| 919 | tokenizer.* = saved_tokenizer; | |
| 920 | return; | |
| 921 | } | |
| 922 | ifs_seen -= 1; | |
| 923 | }, | |
| 924 | .keyword_if, .keyword_ifdef, .keyword_ifndef => ifs_seen += 1, | |
| 925 | else => {}, | |
| 926 | } | |
| 927 | } else if (tokenizer.buf[tokenizer.index] == '\n') { | |
| 928 | line_start = true; | |
| 929 | tokenizer.index += 1; | |
| 930 | tokenizer.line += 1; | |
| 931 | } else { | |
| 932 | line_start = false; | |
| 933 | tokenizer.index += 1; | |
| 934 | } | |
| 935 | } else { | |
| 936 | const eof = tokenizer.next(); | |
| 937 | return pp.err(eof, .unterminated_conditional_directive); | |
| 938 | } | |
| 939 | } | |
| 940 | ||
| 941 | // Skip until newline, ignore other tokens. | |
| 942 | fn skipToNl(tokenizer: *Tokenizer) void { | |
| 943 | while (true) { | |
| 944 | const tok = tokenizer.next(); | |
| 945 | if (tok.id == .nl or tok.id == .eof) return; | |
| 946 | } | |
| 947 | } | |
| 948 | ||
| 949 | const ExpandBuf = std.ArrayList(Token); | |
| 950 | fn removePlacemarkers(buf: *ExpandBuf) void { | |
| 951 | var i: usize = buf.items.len -% 1; | |
| 952 | while (i < buf.items.len) : (i -%= 1) { | |
| 953 | if (buf.items[i].id == .placemarker) { | |
| 954 | const placemarker = buf.orderedRemove(i); | |
| 955 | Token.free(placemarker.expansion_locs, buf.allocator); | |
| 956 | } | |
| 957 | } | |
| 958 | } | |
| 959 | ||
| 960 | const MacroArguments = std.ArrayList([]const Token); | |
| 961 | fn deinitMacroArguments(allocator: Allocator, args: *const MacroArguments) void { | |
| 962 | for (args.items) |item| { | |
| 963 | for (item) |tok| Token.free(tok.expansion_locs, allocator); | |
| 964 | allocator.free(item); | |
| 965 | } | |
| 966 | args.deinit(); | |
| 967 | } | |
| 968 | ||
| 969 | fn expandObjMacro(pp: *Preprocessor, simple_macro: *const Macro) Error!ExpandBuf { | |
| 970 | var buf = ExpandBuf.init(pp.gpa); | |
| 971 | errdefer buf.deinit(); | |
| 972 | try buf.ensureTotalCapacity(simple_macro.tokens.len); | |
| 973 | ||
| 974 | // Add all of the simple_macros tokens to the new buffer handling any concats. | |
| 975 | var i: usize = 0; | |
| 976 | while (i < simple_macro.tokens.len) : (i += 1) { | |
| 977 | const raw = simple_macro.tokens[i]; | |
| 978 | const tok = tokFromRaw(raw); | |
| 979 | switch (raw.id) { | |
| 980 | .hash_hash => { | |
| 981 | var rhs = tokFromRaw(simple_macro.tokens[i + 1]); | |
| 982 | i += 1; | |
| 983 | while (rhs.id == .whitespace) { | |
| 984 | rhs = tokFromRaw(simple_macro.tokens[i + 1]); | |
| 985 | i += 1; | |
| 986 | } | |
| 987 | try pp.pasteTokens(&buf, &.{rhs}); | |
| 988 | }, | |
| 989 | .whitespace => if (pp.preserve_whitespace) buf.appendAssumeCapacity(tok), | |
| 990 | .macro_file => { | |
| 991 | const start = pp.comp.generated_buf.items.len; | |
| 992 | const source = pp.comp.getSource(pp.expansion_source_loc.id); | |
| 993 | try pp.comp.generated_buf.writer().print("\"{s}\"\n", .{source.path}); | |
| 994 | ||
| 995 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .string_literal, tok)); | |
| 996 | }, | |
| 997 | .macro_line => { | |
| 998 | const start = pp.comp.generated_buf.items.len; | |
| 999 | const source = pp.comp.getSource(pp.expansion_source_loc.id); | |
| 1000 | try pp.comp.generated_buf.writer().print("{d}\n", .{source.physicalLine(pp.expansion_source_loc)}); | |
| 1001 | ||
| 1002 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok)); | |
| 1003 | }, | |
| 1004 | .macro_counter => { | |
| 1005 | defer pp.counter += 1; | |
| 1006 | const start = pp.comp.generated_buf.items.len; | |
| 1007 | try pp.comp.generated_buf.writer().print("{d}\n", .{pp.counter}); | |
| 1008 | ||
| 1009 | buf.appendAssumeCapacity(try pp.makeGeneratedToken(start, .pp_num, tok)); | |
| 1010 | }, | |
| 1011 | else => buf.appendAssumeCapacity(tok), | |
| 1012 | } | |
| 1013 | } | |
| 1014 | ||
| 1015 | return buf; | |
| 1016 | } | |
| 1017 | ||
| 1018 | /// Join a possibly-parenthesized series of string literal tokens into a single string without | |
| 1019 | /// leading or trailing quotes. The returned slice is invalidated if pp.char_buf changes. | |
| 1020 | /// Returns error.ExpectedStringLiteral if parentheses are not balanced, a non-string-literal | |
| 1021 | /// is encountered, or if no string literals are encountered | |
| 1022 | /// TODO: destringize (replace all '\\' with a single `\` and all '\"' with a '"') | |
| 1023 | fn pasteStringsUnsafe(pp: *Preprocessor, toks: []const Token) ![]const u8 { | |
| 1024 | const char_top = pp.char_buf.items.len; | |
| 1025 | defer pp.char_buf.items.len = char_top; | |
| 1026 | var unwrapped = toks; | |
| 1027 | if (toks.len >= 2 and toks[0].id == .l_paren and toks[toks.len - 1].id == .r_paren) { | |
| 1028 | unwrapped = toks[1 .. toks.len - 1]; | |
| 1029 | } | |
| 1030 | if (unwrapped.len == 0) return error.ExpectedStringLiteral; | |
| 1031 | ||
| 1032 | for (unwrapped) |tok| { | |
| 1033 | if (tok.id == .macro_ws) continue; | |
| 1034 | if (tok.id != .string_literal) return error.ExpectedStringLiteral; | |
| 1035 | const str = pp.expandedSlice(tok); | |
| 1036 | try pp.char_buf.appendSlice(str[1 .. str.len - 1]); | |
| 1037 | } | |
| 1038 | return pp.char_buf.items[char_top..]; | |
| 1039 | } | |
| 1040 | ||
| 1041 | /// Handle the _Pragma operator (implemented as a builtin macro) | |
| 1042 | fn pragmaOperator(pp: *Preprocessor, arg_tok: Token, operator_loc: Source.Location) !void { | |
| 1043 | const arg_slice = pp.expandedSlice(arg_tok); | |
| 1044 | const content = arg_slice[1 .. arg_slice.len - 1]; | |
| 1045 | const directive = "#pragma "; | |
| 1046 | ||
| 1047 | pp.char_buf.clearRetainingCapacity(); | |
| 1048 | const total_len = directive.len + content.len + 1; // destringify can never grow the string, + 1 for newline | |
| 1049 | try pp.char_buf.ensureUnusedCapacity(total_len); | |
| 1050 | pp.char_buf.appendSliceAssumeCapacity(directive); | |
| 1051 | pp.destringify(content); | |
| 1052 | pp.char_buf.appendAssumeCapacity('\n'); | |
| 1053 | ||
| 1054 | const start = pp.comp.generated_buf.items.len; | |
| 1055 | try pp.comp.generated_buf.appendSlice(pp.char_buf.items); | |
| 1056 | var tmp_tokenizer = Tokenizer{ | |
| 1057 | .buf = pp.comp.generated_buf.items, | |
| 1058 | .comp = pp.comp, | |
| 1059 | .index = @intCast(start), | |
| 1060 | .source = .generated, | |
| 1061 | .line = pp.generated_line, | |
| 1062 | }; | |
| 1063 | pp.generated_line += 1; | |
| 1064 | const hash_tok = tmp_tokenizer.next(); | |
| 1065 | assert(hash_tok.id == .hash); | |
| 1066 | const pragma_tok = tmp_tokenizer.next(); | |
| 1067 | assert(pragma_tok.id == .keyword_pragma); | |
| 1068 | try pp.pragma(&tmp_tokenizer, pragma_tok, operator_loc, arg_tok.expansionSlice()); | |
| 1069 | } | |
| 1070 | ||
| 1071 | /// Inverts the output of the preprocessor stringify (#) operation | |
| 1072 | /// (except all whitespace is condensed to a single space) | |
| 1073 | /// writes output to pp.char_buf; assumes capacity is sufficient | |
| 1074 | /// backslash backslash -> backslash | |
| 1075 | /// backslash doublequote -> doublequote | |
| 1076 | /// All other characters remain the same | |
| 1077 | fn destringify(pp: *Preprocessor, str: []const u8) void { | |
| 1078 | var state: enum { start, backslash_seen } = .start; | |
| 1079 | for (str) |c| { | |
| 1080 | switch (c) { | |
| 1081 | '\\' => { | |
| 1082 | if (state == .backslash_seen) pp.char_buf.appendAssumeCapacity(c); | |
| 1083 | state = if (state == .start) .backslash_seen else .start; | |
| 1084 | }, | |
| 1085 | else => { | |
| 1086 | if (state == .backslash_seen and c != '"') pp.char_buf.appendAssumeCapacity('\\'); | |
| 1087 | pp.char_buf.appendAssumeCapacity(c); | |
| 1088 | state = .start; | |
| 1089 | }, | |
| 1090 | } | |
| 1091 | } | |
| 1092 | } | |
| 1093 | ||
| 1094 | /// Stringify `tokens` into pp.char_buf. | |
| 1095 | /// See https://gcc.gnu.org/onlinedocs/gcc-11.2.0/cpp/Stringizing.html#Stringizing | |
| 1096 | fn stringify(pp: *Preprocessor, tokens: []const Token) !void { | |
| 1097 | try pp.char_buf.append('"'); | |
| 1098 | var ws_state: enum { start, need, not_needed } = .start; | |
| 1099 | for (tokens) |tok| { | |
| 1100 | if (tok.id == .macro_ws) { | |
| 1101 | if (ws_state == .start) continue; | |
| 1102 | ws_state = .need; | |
| 1103 | continue; | |
| 1104 | } | |
| 1105 | if (ws_state == .need) try pp.char_buf.append(' '); | |
| 1106 | ws_state = .not_needed; | |
| 1107 | ||
| 1108 | // backslashes not inside strings are not escaped | |
| 1109 | const is_str = switch (tok.id) { | |
| 1110 | .string_literal, | |
| 1111 | .string_literal_utf_16, | |
| 1112 | .string_literal_utf_8, | |
| 1113 | .string_literal_utf_32, | |
| 1114 | .string_literal_wide, | |
| 1115 | .char_literal, | |
| 1116 | .char_literal_utf_16, | |
| 1117 | .char_literal_utf_32, | |
| 1118 | .char_literal_wide, | |
| 1119 | => true, | |
| 1120 | else => false, | |
| 1121 | }; | |
| 1122 | ||
| 1123 | for (pp.expandedSlice(tok)) |c| { | |
| 1124 | if (c == '"') | |
| 1125 | try pp.char_buf.appendSlice("\\\"") | |
| 1126 | else if (c == '\\' and is_str) | |
| 1127 | try pp.char_buf.appendSlice("\\\\") | |
| 1128 | else | |
| 1129 | try pp.char_buf.append(c); | |
| 1130 | } | |
| 1131 | } | |
| 1132 | if (pp.char_buf.items[pp.char_buf.items.len - 1] == '\\') { | |
| 1133 | const tok = tokens[tokens.len - 1]; | |
| 1134 | try pp.comp.diag.add(.{ | |
| 1135 | .tag = .invalid_pp_stringify_escape, | |
| 1136 | .loc = tok.loc, | |
| 1137 | }, tok.expansionSlice()); | |
| 1138 | pp.char_buf.items.len -= 1; | |
| 1139 | } | |
| 1140 | try pp.char_buf.appendSlice("\"\n"); | |
| 1141 | } | |
| 1142 | ||
| 1143 | fn reconstructIncludeString(pp: *Preprocessor, param_toks: []const Token) !?[]const u8 { | |
| 1144 | const char_top = pp.char_buf.items.len; | |
| 1145 | defer pp.char_buf.items.len = char_top; | |
| 1146 | ||
| 1147 | // Trim leading/trailing whitespace | |
| 1148 | var begin: usize = 0; | |
| 1149 | var end: usize = param_toks.len; | |
| 1150 | while (begin < end and param_toks[begin].id == .macro_ws) : (begin += 1) {} | |
| 1151 | while (end > begin and param_toks[end - 1].id == .macro_ws) : (end -= 1) {} | |
| 1152 | const params = param_toks[begin..end]; | |
| 1153 | ||
| 1154 | if (params.len == 0) { | |
| 1155 | try pp.comp.diag.add(.{ | |
| 1156 | .tag = .expected_filename, | |
| 1157 | .loc = param_toks[0].loc, | |
| 1158 | }, param_toks[0].expansionSlice()); | |
| 1159 | return null; | |
| 1160 | } | |
| 1161 | // no string pasting | |
| 1162 | if (params[0].id == .string_literal and params.len > 1) { | |
| 1163 | try pp.comp.diag.add(.{ | |
| 1164 | .tag = .closing_paren, | |
| 1165 | .loc = params[1].loc, | |
| 1166 | }, params[1].expansionSlice()); | |
| 1167 | return null; | |
| 1168 | } | |
| 1169 | ||
| 1170 | for (params) |tok| { | |
| 1171 | const str = pp.expandedSliceExtra(tok, .preserve_macro_ws); | |
| 1172 | try pp.char_buf.appendSlice(str); | |
| 1173 | } | |
| 1174 | ||
| 1175 | const include_str = pp.char_buf.items[char_top..]; | |
| 1176 | if (include_str.len < 3) { | |
| 1177 | try pp.comp.diag.add(.{ | |
| 1178 | .tag = .empty_filename, | |
| 1179 | .loc = params[0].loc, | |
| 1180 | }, params[0].expansionSlice()); | |
| 1181 | return null; | |
| 1182 | } | |
| 1183 | ||
| 1184 | switch (include_str[0]) { | |
| 1185 | '<' => { | |
| 1186 | if (include_str[include_str.len - 1] != '>') { | |
| 1187 | // Ugly hack to find out where the '>' should go, since we don't have the closing ')' location | |
| 1188 | const start = params[0].loc; | |
| 1189 | try pp.comp.diag.add(.{ | |
| 1190 | .tag = .header_str_closing, | |
| 1191 | .loc = .{ .id = start.id, .byte_offset = start.byte_offset + @as(u32, @intCast(include_str.len)) + 1, .line = start.line }, | |
| 1192 | }, params[0].expansionSlice()); | |
| 1193 | try pp.comp.diag.add(.{ | |
| 1194 | .tag = .header_str_match, | |
| 1195 | .loc = params[0].loc, | |
| 1196 | }, params[0].expansionSlice()); | |
| 1197 | return null; | |
| 1198 | } | |
| 1199 | return include_str; | |
| 1200 | }, | |
| 1201 | '"' => return include_str, | |
| 1202 | else => { | |
| 1203 | try pp.comp.diag.add(.{ | |
| 1204 | .tag = .expected_filename, | |
| 1205 | .loc = params[0].loc, | |
| 1206 | }, params[0].expansionSlice()); | |
| 1207 | return null; | |
| 1208 | }, | |
| 1209 | } | |
| 1210 | } | |
| 1211 | ||
| 1212 | fn handleBuiltinMacro(pp: *Preprocessor, builtin: RawToken.Id, param_toks: []const Token, src_loc: Source.Location) Error!bool { | |
| 1213 | switch (builtin) { | |
| 1214 | .macro_param_has_attribute, | |
| 1215 | .macro_param_has_feature, | |
| 1216 | .macro_param_has_extension, | |
| 1217 | .macro_param_has_builtin, | |
| 1218 | => { | |
| 1219 | var invalid: ?Token = null; | |
| 1220 | var identifier: ?Token = null; | |
| 1221 | for (param_toks) |tok| { | |
| 1222 | if (tok.id == .macro_ws) continue; | |
| 1223 | if (!tok.id.isMacroIdentifier()) { | |
| 1224 | invalid = tok; | |
| 1225 | break; | |
| 1226 | } | |
| 1227 | if (identifier) |_| invalid = tok else identifier = tok; | |
| 1228 | } | |
| 1229 | if (identifier == null and invalid == null) invalid = .{ .id = .eof, .loc = src_loc }; | |
| 1230 | if (invalid) |some| { | |
| 1231 | try pp.comp.diag.add( | |
| 1232 | .{ .tag = .feature_check_requires_identifier, .loc = some.loc }, | |
| 1233 | some.expansionSlice(), | |
| 1234 | ); | |
| 1235 | return false; | |
| 1236 | } | |
| 1237 | ||
| 1238 | const ident_str = pp.expandedSlice(identifier.?); | |
| 1239 | return switch (builtin) { | |
| 1240 | .macro_param_has_attribute => Attribute.fromString(.gnu, null, ident_str) != null, | |
| 1241 | .macro_param_has_feature => features.hasFeature(pp.comp, ident_str), | |
| 1242 | .macro_param_has_extension => features.hasExtension(pp.comp, ident_str), | |
| 1243 | .macro_param_has_builtin => pp.comp.hasBuiltin(ident_str), | |
| 1244 | else => unreachable, | |
| 1245 | }; | |
| 1246 | }, | |
| 1247 | .macro_param_has_warning => { | |
| 1248 | const actual_param = pp.pasteStringsUnsafe(param_toks) catch |er| switch (er) { | |
| 1249 | error.ExpectedStringLiteral => { | |
| 1250 | try pp.comp.diag.add(.{ | |
| 1251 | .tag = .expected_str_literal_in, | |
| 1252 | .loc = param_toks[0].loc, | |
| 1253 | .extra = .{ .str = "__has_warning" }, | |
| 1254 | }, param_toks[0].expansionSlice()); | |
| 1255 | return false; | |
| 1256 | }, | |
| 1257 | else => |e| return e, | |
| 1258 | }; | |
| 1259 | if (!mem.startsWith(u8, actual_param, "-W")) { | |
| 1260 | try pp.comp.diag.add(.{ | |
| 1261 | .tag = .malformed_warning_check, | |
| 1262 | .loc = param_toks[0].loc, | |
| 1263 | .extra = .{ .str = "__has_warning" }, | |
| 1264 | }, param_toks[0].expansionSlice()); | |
| 1265 | return false; | |
| 1266 | } | |
| 1267 | const warning_name = actual_param[2..]; | |
| 1268 | return Diagnostics.warningExists(warning_name); | |
| 1269 | }, | |
| 1270 | .macro_param_is_identifier => { | |
| 1271 | var invalid: ?Token = null; | |
| 1272 | var identifier: ?Token = null; | |
| 1273 | for (param_toks) |tok| switch (tok.id) { | |
| 1274 | .macro_ws => continue, | |
| 1275 | else => { | |
| 1276 | if (identifier) |_| invalid = tok else identifier = tok; | |
| 1277 | }, | |
| 1278 | }; | |
| 1279 | if (identifier == null and invalid == null) invalid = .{ .id = .eof, .loc = src_loc }; | |
| 1280 | if (invalid) |some| { | |
| 1281 | try pp.comp.diag.add(.{ | |
| 1282 | .tag = .missing_tok_builtin, | |
| 1283 | .loc = some.loc, | |
| 1284 | .extra = .{ .tok_id_expected = .r_paren }, | |
| 1285 | }, some.expansionSlice()); | |
| 1286 | return false; | |
| 1287 | } | |
| 1288 | ||
| 1289 | const id = identifier.?.id; | |
| 1290 | return id == .identifier or id == .extended_identifier; | |
| 1291 | }, | |
| 1292 | .macro_param_has_include, .macro_param_has_include_next => { | |
| 1293 | const include_str = (try pp.reconstructIncludeString(param_toks)) orelse return false; | |
| 1294 | const include_type: Compilation.IncludeType = switch (include_str[0]) { | |
| 1295 | '"' => .quotes, | |
| 1296 | '<' => .angle_brackets, | |
| 1297 | else => unreachable, | |
| 1298 | }; | |
| 1299 | const filename = include_str[1 .. include_str.len - 1]; | |
| 1300 | if (builtin == .macro_param_has_include or pp.include_depth == 0) { | |
| 1301 | if (builtin == .macro_param_has_include_next) { | |
| 1302 | try pp.comp.diag.add(.{ | |
| 1303 | .tag = .include_next_outside_header, | |
| 1304 | .loc = src_loc, | |
| 1305 | }, &.{}); | |
| 1306 | } | |
| 1307 | return pp.comp.hasInclude(filename, src_loc.id, include_type, .first); | |
| 1308 | } | |
| 1309 | return pp.comp.hasInclude(filename, src_loc.id, include_type, .next); | |
| 1310 | }, | |
| 1311 | else => unreachable, | |
| 1312 | } | |
| 1313 | } | |
| 1314 | ||
| 1315 | fn expandFuncMacro( | |
| 1316 | pp: *Preprocessor, | |
| 1317 | loc: Source.Location, | |
| 1318 | func_macro: *const Macro, | |
| 1319 | args: *const MacroArguments, | |
| 1320 | expanded_args: *const MacroArguments, | |
| 1321 | ) MacroError!ExpandBuf { | |
| 1322 | var buf = ExpandBuf.init(pp.gpa); | |
| 1323 | try buf.ensureTotalCapacity(func_macro.tokens.len); | |
| 1324 | errdefer buf.deinit(); | |
| 1325 | ||
| 1326 | var expanded_variable_arguments = ExpandBuf.init(pp.gpa); | |
| 1327 | defer expanded_variable_arguments.deinit(); | |
| 1328 | var variable_arguments = ExpandBuf.init(pp.gpa); | |
| 1329 | defer variable_arguments.deinit(); | |
| 1330 | ||
| 1331 | if (func_macro.var_args) { | |
| 1332 | var i: usize = func_macro.params.len; | |
| 1333 | while (i < expanded_args.items.len) : (i += 1) { | |
| 1334 | try variable_arguments.appendSlice(args.items[i]); | |
| 1335 | try expanded_variable_arguments.appendSlice(expanded_args.items[i]); | |
| 1336 | if (i != expanded_args.items.len - 1) { | |
| 1337 | const comma = Token{ .id = .comma, .loc = .{ .id = .generated } }; | |
| 1338 | try variable_arguments.append(comma); | |
| 1339 | try expanded_variable_arguments.append(comma); | |
| 1340 | } | |
| 1341 | } | |
| 1342 | } | |
| 1343 | ||
| 1344 | // token concatenation and expansion phase | |
| 1345 | var tok_i: usize = 0; | |
| 1346 | while (tok_i < func_macro.tokens.len) : (tok_i += 1) { | |
| 1347 | const raw = func_macro.tokens[tok_i]; | |
| 1348 | switch (raw.id) { | |
| 1349 | .hash_hash => while (tok_i + 1 < func_macro.tokens.len) { | |
| 1350 | const raw_next = func_macro.tokens[tok_i + 1]; | |
| 1351 | tok_i += 1; | |
| 1352 | ||
| 1353 | const next = switch (raw_next.id) { | |
| 1354 | .macro_ws => continue, | |
| 1355 | .hash_hash => continue, | |
| 1356 | .macro_param, .macro_param_no_expand => if (args.items[raw_next.end].len > 0) | |
| 1357 | args.items[raw_next.end] | |
| 1358 | else | |
| 1359 | &[1]Token{tokFromRaw(.{ .id = .placemarker, .source = .generated })}, | |
| 1360 | .keyword_va_args => variable_arguments.items, | |
| 1361 | else => &[1]Token{tokFromRaw(raw_next)}, | |
| 1362 | }; | |
| 1363 | ||
| 1364 | try pp.pasteTokens(&buf, next); | |
| 1365 | if (next.len != 0) break; | |
| 1366 | }, | |
| 1367 | .macro_param_no_expand => { | |
| 1368 | const slice = if (args.items[raw.end].len > 0) | |
| 1369 | args.items[raw.end] | |
| 1370 | else | |
| 1371 | &[1]Token{tokFromRaw(.{ .id = .placemarker, .source = .generated })}; | |
| 1372 | const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line }; | |
| 1373 | try bufCopyTokens(&buf, slice, &.{raw_loc}); | |
| 1374 | }, | |
| 1375 | .macro_param => { | |
| 1376 | const arg = expanded_args.items[raw.end]; | |
| 1377 | const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line }; | |
| 1378 | try bufCopyTokens(&buf, arg, &.{raw_loc}); | |
| 1379 | }, | |
| 1380 | .keyword_va_args => { | |
| 1381 | const raw_loc = Source.Location{ .id = raw.source, .byte_offset = raw.start, .line = raw.line }; | |
| 1382 | try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc}); | |
| 1383 | }, | |
| 1384 | .stringify_param, .stringify_va_args => { | |
| 1385 | const arg = if (raw.id == .stringify_va_args) | |
| 1386 | variable_arguments.items | |
| 1387 | else | |
| 1388 | args.items[raw.end]; | |
| 1389 | ||
| 1390 | pp.char_buf.clearRetainingCapacity(); | |
| 1391 | try pp.stringify(arg); | |
| 1392 | ||
| 1393 | const start = pp.comp.generated_buf.items.len; | |
| 1394 | try pp.comp.generated_buf.appendSlice(pp.char_buf.items); | |
| 1395 | ||
| 1396 | try buf.append(try pp.makeGeneratedToken(start, .string_literal, tokFromRaw(raw))); | |
| 1397 | }, | |
| 1398 | .macro_param_has_attribute, | |
| 1399 | .macro_param_has_warning, | |
| 1400 | .macro_param_has_feature, | |
| 1401 | .macro_param_has_extension, | |
| 1402 | .macro_param_has_builtin, | |
| 1403 | .macro_param_has_include, | |
| 1404 | .macro_param_has_include_next, | |
| 1405 | .macro_param_is_identifier, | |
| 1406 | => { | |
| 1407 | const arg = expanded_args.items[0]; | |
| 1408 | const result = if (arg.len == 0) blk: { | |
| 1409 | const extra = Diagnostics.Message.Extra{ .arguments = .{ .expected = 1, .actual = 0 } }; | |
| 1410 | try pp.comp.diag.add(.{ .tag = .expected_arguments, .loc = loc, .extra = extra }, &.{}); | |
| 1411 | break :blk false; | |
| 1412 | } else try pp.handleBuiltinMacro(raw.id, arg, loc); | |
| 1413 | const start = pp.comp.generated_buf.items.len; | |
| 1414 | try pp.comp.generated_buf.writer().print("{}\n", .{@intFromBool(result)}); | |
| 1415 | try buf.append(try pp.makeGeneratedToken(start, .pp_num, tokFromRaw(raw))); | |
| 1416 | }, | |
| 1417 | .macro_param_pragma_operator => { | |
| 1418 | const param_toks = expanded_args.items[0]; | |
| 1419 | // Clang and GCC require exactly one token (so, no parentheses or string pasting) | |
| 1420 | // even though their error messages indicate otherwise. Ours is slightly more | |
| 1421 | // descriptive. | |
| 1422 | var invalid: ?Token = null; | |
| 1423 | var string: ?Token = null; | |
| 1424 | for (param_toks) |tok| switch (tok.id) { | |
| 1425 | .string_literal => { | |
| 1426 | if (string) |_| invalid = tok else string = tok; | |
| 1427 | }, | |
| 1428 | .macro_ws => continue, | |
| 1429 | else => { | |
| 1430 | invalid = tok; | |
| 1431 | break; | |
| 1432 | }, | |
| 1433 | }; | |
| 1434 | if (string == null and invalid == null) invalid = .{ .loc = loc, .id = .eof }; | |
| 1435 | if (invalid) |some| try pp.comp.diag.add( | |
| 1436 | .{ .tag = .pragma_operator_string_literal, .loc = some.loc }, | |
| 1437 | some.expansionSlice(), | |
| 1438 | ) else try pp.pragmaOperator(string.?, loc); | |
| 1439 | }, | |
| 1440 | .comma => { | |
| 1441 | if (tok_i + 2 < func_macro.tokens.len and func_macro.tokens[tok_i + 1].id == .hash_hash) { | |
| 1442 | const hash_hash = func_macro.tokens[tok_i + 1]; | |
| 1443 | var maybe_va_args = func_macro.tokens[tok_i + 2]; | |
| 1444 | var consumed: usize = 2; | |
| 1445 | if (maybe_va_args.id == .macro_ws and tok_i + 3 < func_macro.tokens.len) { | |
| 1446 | consumed = 3; | |
| 1447 | maybe_va_args = func_macro.tokens[tok_i + 3]; | |
| 1448 | } | |
| 1449 | if (maybe_va_args.id == .keyword_va_args) { | |
| 1450 | // GNU extension: `, ##__VA_ARGS__` deletes the comma if __VA_ARGS__ is empty | |
| 1451 | tok_i += consumed; | |
| 1452 | if (func_macro.params.len == expanded_args.items.len) { | |
| 1453 | // Empty __VA_ARGS__, drop the comma | |
| 1454 | try pp.err(hash_hash, .comma_deletion_va_args); | |
| 1455 | } else if (func_macro.params.len == 0 and expanded_args.items.len == 1 and expanded_args.items[0].len == 0) { | |
| 1456 | // Ambiguous whether this is "empty __VA_ARGS__" or "__VA_ARGS__ omitted" | |
| 1457 | if (pp.comp.langopts.standard.isGNU()) { | |
| 1458 | // GNU standard, drop the comma | |
| 1459 | try pp.err(hash_hash, .comma_deletion_va_args); | |
| 1460 | } else { | |
| 1461 | // C standard, retain the comma | |
| 1462 | try buf.append(tokFromRaw(raw)); | |
| 1463 | } | |
| 1464 | } else { | |
| 1465 | try buf.append(tokFromRaw(raw)); | |
| 1466 | if (expanded_variable_arguments.items.len > 0 or variable_arguments.items.len == func_macro.params.len) { | |
| 1467 | try pp.err(hash_hash, .comma_deletion_va_args); | |
| 1468 | } | |
| 1469 | const raw_loc = Source.Location{ | |
| 1470 | .id = maybe_va_args.source, | |
| 1471 | .byte_offset = maybe_va_args.start, | |
| 1472 | .line = maybe_va_args.line, | |
| 1473 | }; | |
| 1474 | try bufCopyTokens(&buf, expanded_variable_arguments.items, &.{raw_loc}); | |
| 1475 | } | |
| 1476 | continue; | |
| 1477 | } | |
| 1478 | } | |
| 1479 | // Regular comma, no token pasting with __VA_ARGS__ | |
| 1480 | try buf.append(tokFromRaw(raw)); | |
| 1481 | }, | |
| 1482 | else => try buf.append(tokFromRaw(raw)), | |
| 1483 | } | |
| 1484 | } | |
| 1485 | removePlacemarkers(&buf); | |
| 1486 | ||
| 1487 | return buf; | |
| 1488 | } | |
| 1489 | ||
| 1490 | fn shouldExpand(tok: Token, macro: *Macro) bool { | |
| 1491 | // macro.loc.line contains the macros end index | |
| 1492 | if (tok.loc.id == macro.loc.id and | |
| 1493 | tok.loc.byte_offset >= macro.loc.byte_offset and | |
| 1494 | tok.loc.byte_offset <= macro.loc.line) | |
| 1495 | return false; | |
| 1496 | for (tok.expansionSlice()) |loc| { | |
| 1497 | if (loc.id == macro.loc.id and | |
| 1498 | loc.byte_offset >= macro.loc.byte_offset and | |
| 1499 | loc.byte_offset <= macro.loc.line) | |
| 1500 | return false; | |
| 1501 | } | |
| 1502 | if (tok.flags.expansion_disabled) return false; | |
| 1503 | ||
| 1504 | return true; | |
| 1505 | } | |
| 1506 | ||
| 1507 | fn bufCopyTokens(buf: *ExpandBuf, tokens: []const Token, src: []const Source.Location) !void { | |
| 1508 | try buf.ensureUnusedCapacity(tokens.len); | |
| 1509 | for (tokens) |tok| { | |
| 1510 | var copy = try tok.dupe(buf.allocator); | |
| 1511 | errdefer Token.free(copy.expansion_locs, buf.allocator); | |
| 1512 | try copy.addExpansionLocation(buf.allocator, src); | |
| 1513 | buf.appendAssumeCapacity(copy); | |
| 1514 | } | |
| 1515 | } | |
| 1516 | ||
| 1517 | fn nextBufToken( | |
| 1518 | pp: *Preprocessor, | |
| 1519 | tokenizer: *Tokenizer, | |
| 1520 | buf: *ExpandBuf, | |
| 1521 | start_idx: *usize, | |
| 1522 | end_idx: *usize, | |
| 1523 | extend_buf: bool, | |
| 1524 | ) Error!Token { | |
| 1525 | start_idx.* += 1; | |
| 1526 | if (start_idx.* == buf.items.len and start_idx.* >= end_idx.*) { | |
| 1527 | if (extend_buf) { | |
| 1528 | const raw_tok = tokenizer.next(); | |
| 1529 | if (raw_tok.id.isMacroIdentifier() and | |
| 1530 | pp.poisoned_identifiers.get(pp.tokSlice(raw_tok)) != null) | |
| 1531 | try pp.err(raw_tok, .poisoned_identifier); | |
| 1532 | ||
| 1533 | if (raw_tok.id == .nl) pp.add_expansion_nl += 1; | |
| 1534 | ||
| 1535 | const new_tok = tokFromRaw(raw_tok); | |
| 1536 | end_idx.* += 1; | |
| 1537 | try buf.append(new_tok); | |
| 1538 | return new_tok; | |
| 1539 | } else { | |
| 1540 | return Token{ .id = .eof, .loc = .{ .id = .generated } }; | |
| 1541 | } | |
| 1542 | } else { | |
| 1543 | return buf.items[start_idx.*]; | |
| 1544 | } | |
| 1545 | } | |
| 1546 | ||
| 1547 | fn collectMacroFuncArguments( | |
| 1548 | pp: *Preprocessor, | |
| 1549 | tokenizer: *Tokenizer, | |
| 1550 | buf: *ExpandBuf, | |
| 1551 | start_idx: *usize, | |
| 1552 | end_idx: *usize, | |
| 1553 | extend_buf: bool, | |
| 1554 | is_builtin: bool, | |
| 1555 | ) !MacroArguments { | |
| 1556 | const name_tok = buf.items[start_idx.*]; | |
| 1557 | const saved_tokenizer = tokenizer.*; | |
| 1558 | const old_end = end_idx.*; | |
| 1559 | ||
| 1560 | while (true) { | |
| 1561 | const tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf); | |
| 1562 | switch (tok.id) { | |
| 1563 | .nl, .whitespace, .macro_ws => {}, | |
| 1564 | .l_paren => break, | |
| 1565 | else => { | |
| 1566 | if (is_builtin) { | |
| 1567 | try pp.comp.diag.add(.{ | |
| 1568 | .tag = .missing_lparen_after_builtin, | |
| 1569 | .loc = name_tok.loc, | |
| 1570 | .extra = .{ .str = pp.expandedSlice(name_tok) }, | |
| 1571 | }, tok.expansionSlice()); | |
| 1572 | } | |
| 1573 | // Not a macro function call, go over normal identifier, rewind | |
| 1574 | tokenizer.* = saved_tokenizer; | |
| 1575 | end_idx.* = old_end; | |
| 1576 | return error.MissingLParen; | |
| 1577 | }, | |
| 1578 | } | |
| 1579 | } | |
| 1580 | ||
| 1581 | // collect the arguments. | |
| 1582 | var parens: u32 = 0; | |
| 1583 | var args = MacroArguments.init(pp.gpa); | |
| 1584 | errdefer deinitMacroArguments(pp.gpa, &args); | |
| 1585 | var curArgument = std.ArrayList(Token).init(pp.gpa); | |
| 1586 | defer curArgument.deinit(); | |
| 1587 | while (true) { | |
| 1588 | var tok = try nextBufToken(pp, tokenizer, buf, start_idx, end_idx, extend_buf); | |
| 1589 | tok.flags.is_macro_arg = true; | |
| 1590 | switch (tok.id) { | |
| 1591 | .comma => { | |
| 1592 | if (parens == 0) { | |
| 1593 | const owned = try curArgument.toOwnedSlice(); | |
| 1594 | errdefer pp.gpa.free(owned); | |
| 1595 | try args.append(owned); | |
| 1596 | } else { | |
| 1597 | const duped = try tok.dupe(pp.gpa); | |
| 1598 | errdefer Token.free(duped.expansion_locs, pp.gpa); | |
| 1599 | try curArgument.append(duped); | |
| 1600 | } | |
| 1601 | }, | |
| 1602 | .l_paren => { | |
| 1603 | const duped = try tok.dupe(pp.gpa); | |
| 1604 | errdefer Token.free(duped.expansion_locs, pp.gpa); | |
| 1605 | try curArgument.append(duped); | |
| 1606 | parens += 1; | |
| 1607 | }, | |
| 1608 | .r_paren => { | |
| 1609 | if (parens == 0) { | |
| 1610 | const owned = try curArgument.toOwnedSlice(); | |
| 1611 | errdefer pp.gpa.free(owned); | |
| 1612 | try args.append(owned); | |
| 1613 | break; | |
| 1614 | } else { | |
| 1615 | const duped = try tok.dupe(pp.gpa); | |
| 1616 | errdefer Token.free(duped.expansion_locs, pp.gpa); | |
| 1617 | try curArgument.append(duped); | |
| 1618 | parens -= 1; | |
| 1619 | } | |
| 1620 | }, | |
| 1621 | .eof => { | |
| 1622 | { | |
| 1623 | const owned = try curArgument.toOwnedSlice(); | |
| 1624 | errdefer pp.gpa.free(owned); | |
| 1625 | try args.append(owned); | |
| 1626 | } | |
| 1627 | tokenizer.* = saved_tokenizer; | |
| 1628 | try pp.comp.diag.add( | |
| 1629 | .{ .tag = .unterminated_macro_arg_list, .loc = name_tok.loc }, | |
| 1630 | name_tok.expansionSlice(), | |
| 1631 | ); | |
| 1632 | return error.Unterminated; | |
| 1633 | }, | |
| 1634 | .nl, .whitespace => { | |
| 1635 | try curArgument.append(.{ .id = .macro_ws, .loc = tok.loc }); | |
| 1636 | }, | |
| 1637 | else => { | |
| 1638 | const duped = try tok.dupe(pp.gpa); | |
| 1639 | errdefer Token.free(duped.expansion_locs, pp.gpa); | |
| 1640 | try curArgument.append(duped); | |
| 1641 | }, | |
| 1642 | } | |
| 1643 | } | |
| 1644 | ||
| 1645 | return args; | |
| 1646 | } | |
| 1647 | ||
| 1648 | fn removeExpandedTokens(pp: *Preprocessor, buf: *ExpandBuf, start: usize, len: usize, moving_end_idx: *usize) !void { | |
| 1649 | for (buf.items[start .. start + len]) |tok| Token.free(tok.expansion_locs, pp.gpa); | |
| 1650 | try buf.replaceRange(start, len, &.{}); | |
| 1651 | moving_end_idx.* -|= len; | |
| 1652 | } | |
| 1653 | ||
| 1654 | /// The behavior of `defined` depends on whether we are in a preprocessor | |
| 1655 | /// expression context (#if or #elif) or not. | |
| 1656 | /// In a non-expression context it's just an identifier. Within a preprocessor | |
| 1657 | /// expression it is a unary operator or one-argument function. | |
| 1658 | const EvalContext = enum { | |
| 1659 | expr, | |
| 1660 | non_expr, | |
| 1661 | }; | |
| 1662 | ||
| 1663 | /// Helper for safely iterating over a slice of tokens while skipping whitespace | |
| 1664 | const TokenIterator = struct { | |
| 1665 | toks: []const Token, | |
| 1666 | i: usize, | |
| 1667 | ||
| 1668 | fn init(toks: []const Token) TokenIterator { | |
| 1669 | return .{ .toks = toks, .i = 0 }; | |
| 1670 | } | |
| 1671 | ||
| 1672 | fn nextNoWS(self: *TokenIterator) ?Token { | |
| 1673 | while (self.i < self.toks.len) : (self.i += 1) { | |
| 1674 | const tok = self.toks[self.i]; | |
| 1675 | if (tok.id == .whitespace or tok.id == .macro_ws) continue; | |
| 1676 | ||
| 1677 | self.i += 1; | |
| 1678 | return tok; | |
| 1679 | } | |
| 1680 | return null; | |
| 1681 | } | |
| 1682 | }; | |
| 1683 | ||
| 1684 | fn expandMacroExhaustive( | |
| 1685 | pp: *Preprocessor, | |
| 1686 | tokenizer: *Tokenizer, | |
| 1687 | buf: *ExpandBuf, | |
| 1688 | start_idx: usize, | |
| 1689 | end_idx: usize, | |
| 1690 | extend_buf: bool, | |
| 1691 | eval_ctx: EvalContext, | |
| 1692 | ) MacroError!void { | |
| 1693 | var moving_end_idx = end_idx; | |
| 1694 | var advance_index: usize = 0; | |
| 1695 | // rescan loop | |
| 1696 | var do_rescan = true; | |
| 1697 | while (do_rescan) { | |
| 1698 | do_rescan = false; | |
| 1699 | // expansion loop | |
| 1700 | var idx: usize = start_idx + advance_index; | |
| 1701 | while (idx < moving_end_idx) { | |
| 1702 | const macro_tok = buf.items[idx]; | |
| 1703 | if (macro_tok.id == .keyword_defined and eval_ctx == .expr) { | |
| 1704 | idx += 1; | |
| 1705 | var it = TokenIterator.init(buf.items[idx..moving_end_idx]); | |
| 1706 | if (it.nextNoWS()) |tok| { | |
| 1707 | switch (tok.id) { | |
| 1708 | .l_paren => { | |
| 1709 | _ = it.nextNoWS(); // eat (what should be) identifier | |
| 1710 | _ = it.nextNoWS(); // eat (what should be) r paren | |
| 1711 | }, | |
| 1712 | .identifier, .extended_identifier => {}, | |
| 1713 | else => {}, | |
| 1714 | } | |
| 1715 | } | |
| 1716 | idx += it.i; | |
| 1717 | continue; | |
| 1718 | } | |
| 1719 | const macro_entry = pp.defines.getPtr(pp.expandedSlice(macro_tok)); | |
| 1720 | if (macro_entry == null or !shouldExpand(buf.items[idx], macro_entry.?)) { | |
| 1721 | idx += 1; | |
| 1722 | continue; | |
| 1723 | } | |
| 1724 | if (macro_entry) |macro| macro_handler: { | |
| 1725 | if (macro.is_func) { | |
| 1726 | var macro_scan_idx = idx; | |
| 1727 | // to be saved in case this doesn't turn out to be a call | |
| 1728 | const args = pp.collectMacroFuncArguments( | |
| 1729 | tokenizer, | |
| 1730 | buf, | |
| 1731 | &macro_scan_idx, | |
| 1732 | &moving_end_idx, | |
| 1733 | extend_buf, | |
| 1734 | macro.is_builtin, | |
| 1735 | ) catch |er| switch (er) { | |
| 1736 | error.MissingLParen => { | |
| 1737 | if (!buf.items[idx].flags.is_macro_arg) buf.items[idx].flags.expansion_disabled = true; | |
| 1738 | idx += 1; | |
| 1739 | break :macro_handler; | |
| 1740 | }, | |
| 1741 | error.Unterminated => { | |
| 1742 | if (pp.comp.langopts.emulate == .gcc) idx += 1; | |
| 1743 | try pp.removeExpandedTokens(buf, idx, macro_scan_idx - idx, &moving_end_idx); | |
| 1744 | break :macro_handler; | |
| 1745 | }, | |
| 1746 | else => |e| return e, | |
| 1747 | }; | |
| 1748 | defer { | |
| 1749 | for (args.items) |item| { | |
| 1750 | pp.gpa.free(item); | |
| 1751 | } | |
| 1752 | args.deinit(); | |
| 1753 | } | |
| 1754 | ||
| 1755 | var args_count: u32 = @intCast(args.items.len); | |
| 1756 | // if the macro has zero arguments g() args_count is still 1 | |
| 1757 | // an empty token list g() and a whitespace-only token list g( ) | |
| 1758 | // counts as zero arguments for the purposes of argument-count validation | |
| 1759 | if (args_count == 1 and macro.params.len == 0) { | |
| 1760 | for (args.items[0]) |tok| { | |
| 1761 | if (tok.id != .macro_ws) break; | |
| 1762 | } else { | |
| 1763 | args_count = 0; | |
| 1764 | } | |
| 1765 | } | |
| 1766 | ||
| 1767 | // Validate argument count. | |
| 1768 | const extra = Diagnostics.Message.Extra{ | |
| 1769 | .arguments = .{ .expected = @intCast(macro.params.len), .actual = args_count }, | |
| 1770 | }; | |
| 1771 | if (macro.var_args and args_count < macro.params.len) { | |
| 1772 | try pp.comp.diag.add( | |
| 1773 | .{ .tag = .expected_at_least_arguments, .loc = buf.items[idx].loc, .extra = extra }, | |
| 1774 | buf.items[idx].expansionSlice(), | |
| 1775 | ); | |
| 1776 | idx += 1; | |
| 1777 | try pp.removeExpandedTokens(buf, idx, macro_scan_idx - idx + 1, &moving_end_idx); | |
| 1778 | continue; | |
| 1779 | } | |
| 1780 | if (!macro.var_args and args_count != macro.params.len) { | |
| 1781 | try pp.comp.diag.add( | |
| 1782 | .{ .tag = .expected_arguments, .loc = buf.items[idx].loc, .extra = extra }, | |
| 1783 | buf.items[idx].expansionSlice(), | |
| 1784 | ); | |
| 1785 | idx += 1; | |
| 1786 | try pp.removeExpandedTokens(buf, idx, macro_scan_idx - idx + 1, &moving_end_idx); | |
| 1787 | continue; | |
| 1788 | } | |
| 1789 | var expanded_args = MacroArguments.init(pp.gpa); | |
| 1790 | defer deinitMacroArguments(pp.gpa, &expanded_args); | |
| 1791 | try expanded_args.ensureTotalCapacity(args.items.len); | |
| 1792 | for (args.items) |arg| { | |
| 1793 | var expand_buf = ExpandBuf.init(pp.gpa); | |
| 1794 | errdefer expand_buf.deinit(); | |
| 1795 | try expand_buf.appendSlice(arg); | |
| 1796 | ||
| 1797 | try pp.expandMacroExhaustive(tokenizer, &expand_buf, 0, expand_buf.items.len, false, eval_ctx); | |
| 1798 | ||
| 1799 | expanded_args.appendAssumeCapacity(try expand_buf.toOwnedSlice()); | |
| 1800 | } | |
| 1801 | ||
| 1802 | var res = try pp.expandFuncMacro(macro_tok.loc, macro, &args, &expanded_args); | |
| 1803 | defer res.deinit(); | |
| 1804 | const tokens_added = res.items.len; | |
| 1805 | ||
| 1806 | const macro_expansion_locs = macro_tok.expansionSlice(); | |
| 1807 | for (res.items) |*tok| { | |
| 1808 | try tok.addExpansionLocation(pp.gpa, &.{macro_tok.loc}); | |
| 1809 | try tok.addExpansionLocation(pp.gpa, macro_expansion_locs); | |
| 1810 | } | |
| 1811 | ||
| 1812 | const tokens_removed = macro_scan_idx - idx + 1; | |
| 1813 | for (buf.items[idx .. idx + tokens_removed]) |tok| Token.free(tok.expansion_locs, pp.gpa); | |
| 1814 | try buf.replaceRange(idx, tokens_removed, res.items); | |
| 1815 | ||
| 1816 | moving_end_idx += tokens_added; | |
| 1817 | // Overflow here means that we encountered an unterminated argument list | |
| 1818 | // while expanding the body of this macro. | |
| 1819 | moving_end_idx -|= tokens_removed; | |
| 1820 | idx += tokens_added; | |
| 1821 | do_rescan = true; | |
| 1822 | } else { | |
| 1823 | const res = try pp.expandObjMacro(macro); | |
| 1824 | defer res.deinit(); | |
| 1825 | ||
| 1826 | const macro_expansion_locs = macro_tok.expansionSlice(); | |
| 1827 | var increment_idx_by = res.items.len; | |
| 1828 | for (res.items, 0..) |*tok, i| { | |
| 1829 | tok.flags.is_macro_arg = macro_tok.flags.is_macro_arg; | |
| 1830 | try tok.addExpansionLocation(pp.gpa, &.{macro_tok.loc}); | |
| 1831 | try tok.addExpansionLocation(pp.gpa, macro_expansion_locs); | |
| 1832 | if (tok.id == .keyword_defined and eval_ctx == .expr) { | |
| 1833 | try pp.comp.diag.add(.{ | |
| 1834 | .tag = .expansion_to_defined, | |
| 1835 | .loc = tok.loc, | |
| 1836 | }, tok.expansionSlice()); | |
| 1837 | } | |
| 1838 | ||
| 1839 | if (i < increment_idx_by and (tok.id == .keyword_defined or pp.defines.contains(pp.expandedSlice(tok.*)))) { | |
| 1840 | increment_idx_by = i; | |
| 1841 | } | |
| 1842 | } | |
| 1843 | ||
| 1844 | Token.free(buf.items[idx].expansion_locs, pp.gpa); | |
| 1845 | try buf.replaceRange(idx, 1, res.items); | |
| 1846 | idx += increment_idx_by; | |
| 1847 | moving_end_idx = moving_end_idx + res.items.len - 1; | |
| 1848 | do_rescan = true; | |
| 1849 | } | |
| 1850 | } | |
| 1851 | if (idx - start_idx == advance_index + 1 and !do_rescan) { | |
| 1852 | advance_index += 1; | |
| 1853 | } | |
| 1854 | } // end of replacement phase | |
| 1855 | } | |
| 1856 | // end of scanning phase | |
| 1857 | ||
| 1858 | // trim excess buffer | |
| 1859 | for (buf.items[moving_end_idx..]) |item| { | |
| 1860 | Token.free(item.expansion_locs, pp.gpa); | |
| 1861 | } | |
| 1862 | buf.items.len = moving_end_idx; | |
| 1863 | } | |
| 1864 | ||
| 1865 | /// Try to expand a macro after a possible candidate has been read from the `tokenizer` | |
| 1866 | /// into the `raw` token passed as argument | |
| 1867 | fn expandMacro(pp: *Preprocessor, tokenizer: *Tokenizer, raw: RawToken) MacroError!void { | |
| 1868 | var source_tok = tokFromRaw(raw); | |
| 1869 | if (!raw.id.isMacroIdentifier()) { | |
| 1870 | source_tok.id.simplifyMacroKeyword(); | |
| 1871 | return pp.tokens.append(pp.gpa, source_tok); | |
| 1872 | } | |
| 1873 | pp.top_expansion_buf.items.len = 0; | |
| 1874 | try pp.top_expansion_buf.append(source_tok); | |
| 1875 | pp.expansion_source_loc = source_tok.loc; | |
| 1876 | ||
| 1877 | try pp.expandMacroExhaustive(tokenizer, &pp.top_expansion_buf, 0, 1, true, .non_expr); | |
| 1878 | try pp.tokens.ensureUnusedCapacity(pp.gpa, pp.top_expansion_buf.items.len); | |
| 1879 | for (pp.top_expansion_buf.items) |*tok| { | |
| 1880 | if (tok.id == .macro_ws and !pp.preserve_whitespace) { | |
| 1881 | Token.free(tok.expansion_locs, pp.gpa); | |
| 1882 | continue; | |
| 1883 | } | |
| 1884 | tok.id.simplifyMacroKeywordExtra(true); | |
| 1885 | pp.tokens.appendAssumeCapacity(tok.*); | |
| 1886 | } | |
| 1887 | if (pp.preserve_whitespace) { | |
| 1888 | try pp.tokens.ensureUnusedCapacity(pp.gpa, pp.add_expansion_nl); | |
| 1889 | while (pp.add_expansion_nl > 0) : (pp.add_expansion_nl -= 1) { | |
| 1890 | pp.tokens.appendAssumeCapacity(.{ .id = .nl, .loc = .{ .id = .generated } }); | |
| 1891 | } | |
| 1892 | } | |
| 1893 | } | |
| 1894 | ||
| 1895 | fn expandedSliceExtra(pp: *const Preprocessor, tok: Token, macro_ws_handling: enum { single_macro_ws, preserve_macro_ws }) []const u8 { | |
| 1896 | if (tok.id.lexeme()) |some| { | |
| 1897 | if (!tok.id.allowsDigraphs(pp.comp) and !(tok.id == .macro_ws and macro_ws_handling == .preserve_macro_ws)) return some; | |
| 1898 | } | |
| 1899 | var tmp_tokenizer = Tokenizer{ | |
| 1900 | .buf = pp.comp.getSource(tok.loc.id).buf, | |
| 1901 | .comp = pp.comp, | |
| 1902 | .index = tok.loc.byte_offset, | |
| 1903 | .source = .generated, | |
| 1904 | }; | |
| 1905 | if (tok.id == .macro_string) { | |
| 1906 | while (true) : (tmp_tokenizer.index += 1) { | |
| 1907 | if (tmp_tokenizer.buf[tmp_tokenizer.index] == '>') break; | |
| 1908 | } | |
| 1909 | return tmp_tokenizer.buf[tok.loc.byte_offset .. tmp_tokenizer.index + 1]; | |
| 1910 | } | |
| 1911 | const res = tmp_tokenizer.next(); | |
| 1912 | return tmp_tokenizer.buf[res.start..res.end]; | |
| 1913 | } | |
| 1914 | ||
| 1915 | /// Get expanded token source string. | |
| 1916 | pub fn expandedSlice(pp: *Preprocessor, tok: Token) []const u8 { | |
| 1917 | return pp.expandedSliceExtra(tok, .single_macro_ws); | |
| 1918 | } | |
| 1919 | ||
| 1920 | /// Concat two tokens and add the result to pp.generated | |
| 1921 | fn pasteTokens(pp: *Preprocessor, lhs_toks: *ExpandBuf, rhs_toks: []const Token) Error!void { | |
| 1922 | const lhs = while (lhs_toks.popOrNull()) |lhs| { | |
| 1923 | if (lhs.id == .macro_ws) | |
| 1924 | Token.free(lhs.expansion_locs, pp.gpa) | |
| 1925 | else | |
| 1926 | break lhs; | |
| 1927 | } else { | |
| 1928 | return bufCopyTokens(lhs_toks, rhs_toks, &.{}); | |
| 1929 | }; | |
| 1930 | ||
| 1931 | var rhs_rest: u32 = 1; | |
| 1932 | const rhs = for (rhs_toks) |rhs| { | |
| 1933 | if (rhs.id != .macro_ws) break rhs; | |
| 1934 | rhs_rest += 1; | |
| 1935 | } else { | |
| 1936 | return lhs_toks.appendAssumeCapacity(lhs); | |
| 1937 | }; | |
| 1938 | defer Token.free(lhs.expansion_locs, pp.gpa); | |
| 1939 | ||
| 1940 | const start = pp.comp.generated_buf.items.len; | |
| 1941 | const end = start + pp.expandedSlice(lhs).len + pp.expandedSlice(rhs).len; | |
| 1942 | try pp.comp.generated_buf.ensureTotalCapacity(end + 1); // +1 for a newline | |
| 1943 | // We cannot use the same slices here since they might be invalidated by `ensureCapacity` | |
| 1944 | pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(lhs)); | |
| 1945 | pp.comp.generated_buf.appendSliceAssumeCapacity(pp.expandedSlice(rhs)); | |
| 1946 | pp.comp.generated_buf.appendAssumeCapacity('\n'); | |
| 1947 | ||
| 1948 | // Try to tokenize the result. | |
| 1949 | var tmp_tokenizer = Tokenizer{ | |
| 1950 | .buf = pp.comp.generated_buf.items, | |
| 1951 | .comp = pp.comp, | |
| 1952 | .index = @intCast(start), | |
| 1953 | .source = .generated, | |
| 1954 | }; | |
| 1955 | const pasted_token = tmp_tokenizer.nextNoWS(); | |
| 1956 | const next = tmp_tokenizer.nextNoWS().id; | |
| 1957 | if (next != .nl and next != .eof) { | |
| 1958 | try pp.comp.diag.add(.{ | |
| 1959 | .tag = .pasting_formed_invalid, | |
| 1960 | .loc = lhs.loc, | |
| 1961 | .extra = .{ .str = try pp.comp.diag.arena.allocator().dupe( | |
| 1962 | u8, | |
| 1963 | pp.comp.generated_buf.items[start..end], | |
| 1964 | ) }, | |
| 1965 | }, lhs.expansionSlice()); | |
| 1966 | } | |
| 1967 | ||
| 1968 | const pasted_id = if (lhs.id == .placemarker and rhs.id == .placemarker) | |
| 1969 | .placemarker | |
| 1970 | else | |
| 1971 | pasted_token.id; | |
| 1972 | try lhs_toks.append(try pp.makeGeneratedToken(start, pasted_id, lhs)); | |
| 1973 | try bufCopyTokens(lhs_toks, rhs_toks[rhs_rest..], &.{}); | |
| 1974 | } | |
| 1975 | ||
| 1976 | fn makeGeneratedToken(pp: *Preprocessor, start: usize, id: Token.Id, source: Token) !Token { | |
| 1977 | var pasted_token = Token{ .id = id, .loc = .{ | |
| 1978 | .id = .generated, | |
| 1979 | .byte_offset = @intCast(start), | |
| 1980 | .line = pp.generated_line, | |
| 1981 | } }; | |
| 1982 | pp.generated_line += 1; | |
| 1983 | try pasted_token.addExpansionLocation(pp.gpa, &.{source.loc}); | |
| 1984 | try pasted_token.addExpansionLocation(pp.gpa, source.expansionSlice()); | |
| 1985 | return pasted_token; | |
| 1986 | } | |
| 1987 | ||
| 1988 | /// Defines a new macro and warns if it is a duplicate | |
| 1989 | fn defineMacro(pp: *Preprocessor, name_tok: RawToken, macro: Macro) Error!void { | |
| 1990 | const name_str = pp.tokSlice(name_tok); | |
| 1991 | const gop = try pp.defines.getOrPut(name_str); | |
| 1992 | if (gop.found_existing and !gop.value_ptr.eql(macro, pp)) { | |
| 1993 | try pp.comp.diag.add(.{ | |
| 1994 | .tag = if (gop.value_ptr.is_builtin) .builtin_macro_redefined else .macro_redefined, | |
| 1995 | .loc = .{ .id = name_tok.source, .byte_offset = name_tok.start, .line = name_tok.line }, | |
| 1996 | .extra = .{ .str = name_str }, | |
| 1997 | }, &.{}); | |
| 1998 | // TODO add a previous definition note | |
| 1999 | } | |
| 2000 | if (pp.verbose) { | |
| 2001 | pp.verboseLog(name_tok, "macro {s} defined", .{name_str}); | |
| 2002 | } | |
| 2003 | gop.value_ptr.* = macro; | |
| 2004 | } | |
| 2005 | ||
| 2006 | /// Handle a #define directive. | |
| 2007 | fn define(pp: *Preprocessor, tokenizer: *Tokenizer) Error!void { | |
| 2008 | // Get macro name and validate it. | |
| 2009 | const macro_name = tokenizer.nextNoWS(); | |
| 2010 | if (macro_name.id == .keyword_defined) { | |
| 2011 | try pp.err(macro_name, .defined_as_macro_name); | |
| 2012 | return skipToNl(tokenizer); | |
| 2013 | } | |
| 2014 | if (!macro_name.id.isMacroIdentifier()) { | |
| 2015 | try pp.err(macro_name, .macro_name_must_be_identifier); | |
| 2016 | return skipToNl(tokenizer); | |
| 2017 | } | |
| 2018 | var macro_name_token_id = macro_name.id; | |
| 2019 | macro_name_token_id.simplifyMacroKeyword(); | |
| 2020 | switch (macro_name_token_id) { | |
| 2021 | .identifier, .extended_identifier => {}, | |
| 2022 | else => if (macro_name_token_id.isMacroIdentifier()) { | |
| 2023 | try pp.err(macro_name, .keyword_macro); | |
| 2024 | }, | |
| 2025 | } | |
| 2026 | ||
| 2027 | // Check for function macros and empty defines. | |
| 2028 | var first = tokenizer.next(); | |
| 2029 | switch (first.id) { | |
| 2030 | .nl, .eof => return pp.defineMacro(macro_name, .{ | |
| 2031 | .params = undefined, | |
| 2032 | .tokens = undefined, | |
| 2033 | .var_args = false, | |
| 2034 | .loc = undefined, | |
| 2035 | .is_func = false, | |
| 2036 | }), | |
| 2037 | .whitespace => first = tokenizer.next(), | |
| 2038 | .l_paren => return pp.defineFn(tokenizer, macro_name, first), | |
| 2039 | else => try pp.err(first, .whitespace_after_macro_name), | |
| 2040 | } | |
| 2041 | if (first.id == .hash_hash) { | |
| 2042 | try pp.err(first, .hash_hash_at_start); | |
| 2043 | return skipToNl(tokenizer); | |
| 2044 | } | |
| 2045 | first.id.simplifyMacroKeyword(); | |
| 2046 | ||
| 2047 | pp.token_buf.items.len = 0; // Safe to use since we can only be in one directive at a time. | |
| 2048 | ||
| 2049 | var need_ws = false; | |
| 2050 | // Collect the token body and validate any ## found. | |
| 2051 | var tok = first; | |
| 2052 | const end_index = while (true) { | |
| 2053 | tok.id.simplifyMacroKeyword(); | |
| 2054 | switch (tok.id) { | |
| 2055 | .hash_hash => { | |
| 2056 | const next = tokenizer.nextNoWS(); | |
| 2057 | switch (next.id) { | |
| 2058 | .nl, .eof => { | |
| 2059 | try pp.err(tok, .hash_hash_at_end); | |
| 2060 | return; | |
| 2061 | }, | |
| 2062 | .hash_hash => { | |
| 2063 | try pp.err(next, .hash_hash_at_end); | |
| 2064 | return; | |
| 2065 | }, | |
| 2066 | else => {}, | |
| 2067 | } | |
| 2068 | try pp.token_buf.append(tok); | |
| 2069 | try pp.token_buf.append(next); | |
| 2070 | }, | |
| 2071 | .nl, .eof => break tok.start, | |
| 2072 | .whitespace => need_ws = true, | |
| 2073 | else => { | |
| 2074 | if (tok.id != .whitespace and need_ws) { | |
| 2075 | need_ws = false; | |
| 2076 | try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated }); | |
| 2077 | } | |
| 2078 | try pp.token_buf.append(tok); | |
| 2079 | }, | |
| 2080 | } | |
| 2081 | tok = tokenizer.next(); | |
| 2082 | } else unreachable; | |
| 2083 | ||
| 2084 | const list = try pp.arena.allocator().dupe(RawToken, pp.token_buf.items); | |
| 2085 | try pp.defineMacro(macro_name, .{ | |
| 2086 | .loc = .{ | |
| 2087 | .id = macro_name.source, | |
| 2088 | .byte_offset = first.start, | |
| 2089 | .line = end_index, | |
| 2090 | }, | |
| 2091 | .tokens = list, | |
| 2092 | .params = undefined, | |
| 2093 | .is_func = false, | |
| 2094 | .var_args = false, | |
| 2095 | }); | |
| 2096 | } | |
| 2097 | ||
| 2098 | /// Handle a function like #define directive. | |
| 2099 | fn defineFn(pp: *Preprocessor, tokenizer: *Tokenizer, macro_name: RawToken, l_paren: RawToken) Error!void { | |
| 2100 | assert(macro_name.id.isMacroIdentifier()); | |
| 2101 | var params = std.ArrayList([]const u8).init(pp.gpa); | |
| 2102 | defer params.deinit(); | |
| 2103 | ||
| 2104 | // Parse the parameter list. | |
| 2105 | var gnu_var_args: []const u8 = ""; | |
| 2106 | var var_args = false; | |
| 2107 | const start_index = while (true) { | |
| 2108 | var tok = tokenizer.nextNoWS(); | |
| 2109 | if (tok.id == .r_paren) break tok.end; | |
| 2110 | if (tok.id == .eof) return pp.err(tok, .unterminated_macro_param_list); | |
| 2111 | if (tok.id == .ellipsis) { | |
| 2112 | var_args = true; | |
| 2113 | const r_paren = tokenizer.nextNoWS(); | |
| 2114 | if (r_paren.id != .r_paren) { | |
| 2115 | try pp.err(r_paren, .missing_paren_param_list); | |
| 2116 | try pp.err(l_paren, .to_match_paren); | |
| 2117 | return skipToNl(tokenizer); | |
| 2118 | } | |
| 2119 | break r_paren.end; | |
| 2120 | } | |
| 2121 | if (!tok.id.isMacroIdentifier()) { | |
| 2122 | try pp.err(tok, .invalid_token_param_list); | |
| 2123 | return skipToNl(tokenizer); | |
| 2124 | } | |
| 2125 | ||
| 2126 | try params.append(pp.tokSlice(tok)); | |
| 2127 | ||
| 2128 | tok = tokenizer.nextNoWS(); | |
| 2129 | if (tok.id == .ellipsis) { | |
| 2130 | try pp.err(tok, .gnu_va_macro); | |
| 2131 | gnu_var_args = params.pop(); | |
| 2132 | const r_paren = tokenizer.nextNoWS(); | |
| 2133 | if (r_paren.id != .r_paren) { | |
| 2134 | try pp.err(r_paren, .missing_paren_param_list); | |
| 2135 | try pp.err(l_paren, .to_match_paren); | |
| 2136 | return skipToNl(tokenizer); | |
| 2137 | } | |
| 2138 | break r_paren.end; | |
| 2139 | } else if (tok.id == .r_paren) { | |
| 2140 | break tok.end; | |
| 2141 | } else if (tok.id != .comma) { | |
| 2142 | try pp.err(tok, .expected_comma_param_list); | |
| 2143 | return skipToNl(tokenizer); | |
| 2144 | } | |
| 2145 | } else unreachable; | |
| 2146 | ||
| 2147 | var need_ws = false; | |
| 2148 | // Collect the body tokens and validate # and ##'s found. | |
| 2149 | pp.token_buf.items.len = 0; // Safe to use since we can only be in one directive at a time. | |
| 2150 | const end_index = tok_loop: while (true) { | |
| 2151 | var tok = tokenizer.next(); | |
| 2152 | switch (tok.id) { | |
| 2153 | .nl, .eof => break tok.start, | |
| 2154 | .whitespace => need_ws = pp.token_buf.items.len != 0, | |
| 2155 | .hash => { | |
| 2156 | if (tok.id != .whitespace and need_ws) { | |
| 2157 | need_ws = false; | |
| 2158 | try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated }); | |
| 2159 | } | |
| 2160 | const param = tokenizer.nextNoWS(); | |
| 2161 | blk: { | |
| 2162 | if (var_args and param.id == .keyword_va_args) { | |
| 2163 | tok.id = .stringify_va_args; | |
| 2164 | try pp.token_buf.append(tok); | |
| 2165 | continue :tok_loop; | |
| 2166 | } | |
| 2167 | if (!param.id.isMacroIdentifier()) break :blk; | |
| 2168 | const s = pp.tokSlice(param); | |
| 2169 | if (mem.eql(u8, s, gnu_var_args)) { | |
| 2170 | tok.id = .stringify_va_args; | |
| 2171 | try pp.token_buf.append(tok); | |
| 2172 | continue :tok_loop; | |
| 2173 | } | |
| 2174 | for (params.items, 0..) |p, i| { | |
| 2175 | if (mem.eql(u8, p, s)) { | |
| 2176 | tok.id = .stringify_param; | |
| 2177 | tok.end = @intCast(i); | |
| 2178 | try pp.token_buf.append(tok); | |
| 2179 | continue :tok_loop; | |
| 2180 | } | |
| 2181 | } | |
| 2182 | } | |
| 2183 | try pp.err(param, .hash_not_followed_param); | |
| 2184 | return skipToNl(tokenizer); | |
| 2185 | }, | |
| 2186 | .hash_hash => { | |
| 2187 | need_ws = false; | |
| 2188 | // if ## appears at the beginning, the token buf is still empty | |
| 2189 | // in this case, error out | |
| 2190 | if (pp.token_buf.items.len == 0) { | |
| 2191 | try pp.err(tok, .hash_hash_at_start); | |
| 2192 | return skipToNl(tokenizer); | |
| 2193 | } | |
| 2194 | const saved_tokenizer = tokenizer.*; | |
| 2195 | const next = tokenizer.nextNoWS(); | |
| 2196 | if (next.id == .nl or next.id == .eof) { | |
| 2197 | try pp.err(tok, .hash_hash_at_end); | |
| 2198 | return; | |
| 2199 | } | |
| 2200 | tokenizer.* = saved_tokenizer; | |
| 2201 | // convert the previous token to .macro_param_no_expand if it was .macro_param | |
| 2202 | if (pp.token_buf.items[pp.token_buf.items.len - 1].id == .macro_param) { | |
| 2203 | pp.token_buf.items[pp.token_buf.items.len - 1].id = .macro_param_no_expand; | |
| 2204 | } | |
| 2205 | try pp.token_buf.append(tok); | |
| 2206 | }, | |
| 2207 | else => { | |
| 2208 | if (tok.id != .whitespace and need_ws) { | |
| 2209 | need_ws = false; | |
| 2210 | try pp.token_buf.append(.{ .id = .macro_ws, .source = .generated }); | |
| 2211 | } | |
| 2212 | if (var_args and tok.id == .keyword_va_args) { | |
| 2213 | // do nothing | |
| 2214 | } else if (tok.id.isMacroIdentifier()) { | |
| 2215 | tok.id.simplifyMacroKeyword(); | |
| 2216 | const s = pp.tokSlice(tok); | |
| 2217 | if (mem.eql(u8, gnu_var_args, s)) { | |
| 2218 | tok.id = .keyword_va_args; | |
| 2219 | } else for (params.items, 0..) |param, i| { | |
| 2220 | if (mem.eql(u8, param, s)) { | |
| 2221 | // NOTE: it doesn't matter to assign .macro_param_no_expand | |
| 2222 | // here in case a ## was the previous token, because | |
| 2223 | // ## processing will eat this token with the same semantics | |
| 2224 | tok.id = .macro_param; | |
| 2225 | tok.end = @intCast(i); | |
| 2226 | break; | |
| 2227 | } | |
| 2228 | } | |
| 2229 | } | |
| 2230 | try pp.token_buf.append(tok); | |
| 2231 | }, | |
| 2232 | } | |
| 2233 | } else unreachable; | |
| 2234 | ||
| 2235 | const param_list = try pp.arena.allocator().dupe([]const u8, params.items); | |
| 2236 | const token_list = try pp.arena.allocator().dupe(RawToken, pp.token_buf.items); | |
| 2237 | try pp.defineMacro(macro_name, .{ | |
| 2238 | .is_func = true, | |
| 2239 | .params = param_list, | |
| 2240 | .var_args = var_args or gnu_var_args.len != 0, | |
| 2241 | .tokens = token_list, | |
| 2242 | .loc = .{ | |
| 2243 | .id = macro_name.source, | |
| 2244 | .byte_offset = start_index, | |
| 2245 | .line = end_index, | |
| 2246 | }, | |
| 2247 | }); | |
| 2248 | } | |
| 2249 | ||
| 2250 | /// Handle an #embed directive | |
| 2251 | fn embed(pp: *Preprocessor, tokenizer: *Tokenizer) MacroError!void { | |
| 2252 | const first = tokenizer.nextNoWS(); | |
| 2253 | const filename_tok = pp.findIncludeFilenameToken(first, tokenizer, .expect_nl_eof) catch |er| switch (er) { | |
| 2254 | error.InvalidInclude => return, | |
| 2255 | else => |e| return e, | |
| 2256 | }; | |
| 2257 | ||
| 2258 | // Check for empty filename. | |
| 2259 | const tok_slice = pp.expandedSlice(filename_tok); | |
| 2260 | if (tok_slice.len < 3) { | |
| 2261 | try pp.err(first, .empty_filename); | |
| 2262 | return; | |
| 2263 | } | |
| 2264 | const filename = tok_slice[1 .. tok_slice.len - 1]; | |
| 2265 | const include_type: Compilation.IncludeType = switch (filename_tok.id) { | |
| 2266 | .string_literal => .quotes, | |
| 2267 | .macro_string => .angle_brackets, | |
| 2268 | else => unreachable, | |
| 2269 | }; | |
| 2270 | ||
| 2271 | const embed_bytes = (try pp.comp.findEmbed(filename, first.source, include_type)) orelse return pp.fatal(first, "'{s}' not found", .{filename}); | |
| 2272 | defer pp.comp.gpa.free(embed_bytes); | |
| 2273 | ||
| 2274 | if (embed_bytes.len == 0) return; | |
| 2275 | ||
| 2276 | try pp.tokens.ensureUnusedCapacity(pp.comp.gpa, 2 * embed_bytes.len - 1); // N bytes and N-1 commas | |
| 2277 | ||
| 2278 | // TODO: We currently only support systems with CHAR_BIT == 8 | |
| 2279 | // If the target's CHAR_BIT is not 8, we need to write out correctly-sized embed_bytes | |
| 2280 | // and correctly account for the target's endianness | |
| 2281 | const writer = pp.comp.generated_buf.writer(); | |
| 2282 | ||
| 2283 | { | |
| 2284 | const byte = embed_bytes[0]; | |
| 2285 | const start = pp.comp.generated_buf.items.len; | |
| 2286 | try writer.print("{d}", .{byte}); | |
| 2287 | pp.tokens.appendAssumeCapacity(try pp.makeGeneratedToken(start, .embed_byte, filename_tok)); | |
| 2288 | } | |
| 2289 | ||
| 2290 | for (embed_bytes[1..]) |byte| { | |
| 2291 | const start = pp.comp.generated_buf.items.len; | |
| 2292 | try writer.print(",{d}", .{byte}); | |
| 2293 | pp.tokens.appendAssumeCapacity(.{ .id = .comma, .loc = .{ .id = .generated, .byte_offset = @intCast(start) } }); | |
| 2294 | pp.tokens.appendAssumeCapacity(try pp.makeGeneratedToken(start + 1, .embed_byte, filename_tok)); | |
| 2295 | } | |
| 2296 | try pp.comp.generated_buf.append('\n'); | |
| 2297 | } | |
| 2298 | ||
| 2299 | // Handle a #include directive. | |
| 2300 | fn include(pp: *Preprocessor, tokenizer: *Tokenizer, which: Compilation.WhichInclude) MacroError!void { | |
| 2301 | const first = tokenizer.nextNoWS(); | |
| 2302 | const new_source = findIncludeSource(pp, tokenizer, first, which) catch |er| switch (er) { | |
| 2303 | error.InvalidInclude => return, | |
| 2304 | else => |e| return e, | |
| 2305 | }; | |
| 2306 | ||
| 2307 | // Prevent stack overflow | |
| 2308 | pp.include_depth += 1; | |
| 2309 | defer pp.include_depth -= 1; | |
| 2310 | if (pp.include_depth > max_include_depth) { | |
| 2311 | try pp.comp.diag.add(.{ | |
| 2312 | .tag = .too_many_includes, | |
| 2313 | .loc = .{ .id = first.source, .byte_offset = first.start, .line = first.line }, | |
| 2314 | }, &.{}); | |
| 2315 | return error.StopPreprocessing; | |
| 2316 | } | |
| 2317 | ||
| 2318 | if (pp.include_guards.get(new_source.id)) |guard| { | |
| 2319 | if (pp.defines.contains(guard)) return; | |
| 2320 | } | |
| 2321 | ||
| 2322 | if (pp.verbose) { | |
| 2323 | pp.verboseLog(first, "include file {s}", .{new_source.path}); | |
| 2324 | } | |
| 2325 | ||
| 2326 | _ = pp.preprocessExtra(new_source) catch |er| switch (er) { | |
| 2327 | error.StopPreprocessing => {}, | |
| 2328 | else => |e| return e, | |
| 2329 | }; | |
| 2330 | } | |
| 2331 | ||
| 2332 | /// tokens that are part of a pragma directive can happen in 3 ways: | |
| 2333 | /// 1. directly in the text via `#pragma ...` | |
| 2334 | /// 2. Via a string literal argument to `_Pragma` | |
| 2335 | /// 3. Via a stringified macro argument which is used as an argument to `_Pragma` | |
| 2336 | /// operator_loc: Location of `_Pragma`; null if this is from #pragma | |
| 2337 | /// arg_locs: expansion locations of the argument to _Pragma. empty if #pragma or a raw string literal was used | |
| 2338 | fn makePragmaToken(pp: *Preprocessor, raw: RawToken, operator_loc: ?Source.Location, arg_locs: []const Source.Location) !Token { | |
| 2339 | var tok = tokFromRaw(raw); | |
| 2340 | if (operator_loc) |loc| { | |
| 2341 | try tok.addExpansionLocation(pp.gpa, &.{loc}); | |
| 2342 | } | |
| 2343 | try tok.addExpansionLocation(pp.gpa, arg_locs); | |
| 2344 | return tok; | |
| 2345 | } | |
| 2346 | ||
| 2347 | /// Handle a pragma directive | |
| 2348 | fn pragma(pp: *Preprocessor, tokenizer: *Tokenizer, pragma_tok: RawToken, operator_loc: ?Source.Location, arg_locs: []const Source.Location) !void { | |
| 2349 | const name_tok = tokenizer.nextNoWS(); | |
| 2350 | if (name_tok.id == .nl or name_tok.id == .eof) return; | |
| 2351 | ||
| 2352 | const name = pp.tokSlice(name_tok); | |
| 2353 | try pp.tokens.append(pp.gpa, try pp.makePragmaToken(pragma_tok, operator_loc, arg_locs)); | |
| 2354 | const pragma_start: u32 = @intCast(pp.tokens.len); | |
| 2355 | ||
| 2356 | const pragma_name_tok = try pp.makePragmaToken(name_tok, operator_loc, arg_locs); | |
| 2357 | try pp.tokens.append(pp.gpa, pragma_name_tok); | |
| 2358 | while (true) { | |
| 2359 | const next_tok = tokenizer.next(); | |
| 2360 | if (next_tok.id == .whitespace) continue; | |
| 2361 | if (next_tok.id == .eof) { | |
| 2362 | try pp.tokens.append(pp.gpa, .{ | |
| 2363 | .id = .nl, | |
| 2364 | .loc = .{ .id = .generated }, | |
| 2365 | }); | |
| 2366 | break; | |
| 2367 | } | |
| 2368 | try pp.tokens.append(pp.gpa, try pp.makePragmaToken(next_tok, operator_loc, arg_locs)); | |
| 2369 | if (next_tok.id == .nl) break; | |
| 2370 | } | |
| 2371 | if (pp.comp.getPragma(name)) |prag| unknown: { | |
| 2372 | return prag.preprocessorCB(pp, pragma_start) catch |er| switch (er) { | |
| 2373 | error.UnknownPragma => break :unknown, | |
| 2374 | else => |e| return e, | |
| 2375 | }; | |
| 2376 | } | |
| 2377 | return pp.comp.diag.add(.{ | |
| 2378 | .tag = .unknown_pragma, | |
| 2379 | .loc = pragma_name_tok.loc, | |
| 2380 | }, pragma_name_tok.expansionSlice()); | |
| 2381 | } | |
| 2382 | ||
| 2383 | fn findIncludeFilenameToken( | |
| 2384 | pp: *Preprocessor, | |
| 2385 | first_token: RawToken, | |
| 2386 | tokenizer: *Tokenizer, | |
| 2387 | trailing_token_behavior: enum { ignore_trailing_tokens, expect_nl_eof }, | |
| 2388 | ) !Token { | |
| 2389 | const start = pp.tokens.len; | |
| 2390 | defer pp.tokens.len = start; | |
| 2391 | var first = first_token; | |
| 2392 | ||
| 2393 | if (first.id == .angle_bracket_left) to_end: { | |
| 2394 | // The tokenizer does not handle <foo> include strings so do it here. | |
| 2395 | while (tokenizer.index < tokenizer.buf.len) : (tokenizer.index += 1) { | |
| 2396 | switch (tokenizer.buf[tokenizer.index]) { | |
| 2397 | '>' => { | |
| 2398 | tokenizer.index += 1; | |
| 2399 | first.end = tokenizer.index; | |
| 2400 | first.id = .macro_string; | |
| 2401 | break :to_end; | |
| 2402 | }, | |
| 2403 | '\n' => break, | |
| 2404 | else => {}, | |
| 2405 | } | |
| 2406 | } | |
| 2407 | try pp.comp.diag.add(.{ | |
| 2408 | .tag = .header_str_closing, | |
| 2409 | .loc = .{ .id = first.source, .byte_offset = tokenizer.index, .line = first.line }, | |
| 2410 | }, &.{}); | |
| 2411 | try pp.err(first, .header_str_match); | |
| 2412 | } | |
| 2413 | // Try to expand if the argument is a macro. | |
| 2414 | try pp.expandMacro(tokenizer, first); | |
| 2415 | ||
| 2416 | // Check that we actually got a string. | |
| 2417 | const filename_tok = pp.tokens.get(start); | |
| 2418 | switch (filename_tok.id) { | |
| 2419 | .string_literal, .macro_string => {}, | |
| 2420 | else => { | |
| 2421 | try pp.err(first, .expected_filename); | |
| 2422 | try pp.expectNl(tokenizer); | |
| 2423 | return error.InvalidInclude; | |
| 2424 | }, | |
| 2425 | } | |
| 2426 | switch (trailing_token_behavior) { | |
| 2427 | .expect_nl_eof => { | |
| 2428 | // Error on extra tokens. | |
| 2429 | const nl = tokenizer.nextNoWS(); | |
| 2430 | if ((nl.id != .nl and nl.id != .eof) or pp.tokens.len > start + 1) { | |
| 2431 | skipToNl(tokenizer); | |
| 2432 | try pp.err(first, .extra_tokens_directive_end); | |
| 2433 | } | |
| 2434 | }, | |
| 2435 | .ignore_trailing_tokens => {}, | |
| 2436 | } | |
| 2437 | return filename_tok; | |
| 2438 | } | |
| 2439 | ||
| 2440 | fn findIncludeSource(pp: *Preprocessor, tokenizer: *Tokenizer, first: RawToken, which: Compilation.WhichInclude) !Source { | |
| 2441 | const filename_tok = try pp.findIncludeFilenameToken(first, tokenizer, .expect_nl_eof); | |
| 2442 | ||
| 2443 | // Check for empty filename. | |
| 2444 | const tok_slice = pp.expandedSlice(filename_tok); | |
| 2445 | if (tok_slice.len < 3) { | |
| 2446 | try pp.err(first, .empty_filename); | |
| 2447 | return error.InvalidInclude; | |
| 2448 | } | |
| 2449 | ||
| 2450 | // Find the file. | |
| 2451 | const filename = tok_slice[1 .. tok_slice.len - 1]; | |
| 2452 | const include_type: Compilation.IncludeType = switch (filename_tok.id) { | |
| 2453 | .string_literal => .quotes, | |
| 2454 | .macro_string => .angle_brackets, | |
| 2455 | else => unreachable, | |
| 2456 | }; | |
| 2457 | ||
| 2458 | return (try pp.comp.findInclude(filename, first.source, include_type, which)) orelse | |
| 2459 | pp.fatal(first, "'{s}' not found", .{filename}); | |
| 2460 | } | |
| 2461 | ||
| 2462 | /// Pretty print tokens and try to preserve whitespace. | |
| 2463 | pub fn prettyPrintTokens(pp: *Preprocessor, w: anytype) !void { | |
| 2464 | var i: u32 = 0; | |
| 2465 | while (true) : (i += 1) { | |
| 2466 | var cur: Token = pp.tokens.get(i); | |
| 2467 | switch (cur.id) { | |
| 2468 | .eof => { | |
| 2469 | if (pp.tokens.len > 1 and pp.tokens.items(.id)[i - 1] != .nl) try w.writeByte('\n'); | |
| 2470 | break; | |
| 2471 | }, | |
| 2472 | .nl => try w.writeAll("\n"), | |
| 2473 | .keyword_pragma => { | |
| 2474 | const pragma_name = pp.expandedSlice(pp.tokens.get(i + 1)); | |
| 2475 | const end_idx = mem.indexOfScalarPos(Token.Id, pp.tokens.items(.id), i, .nl) orelse i + 1; | |
| 2476 | const pragma_len = @as(u32, @intCast(end_idx)) - i; | |
| 2477 | ||
| 2478 | if (pp.comp.getPragma(pragma_name)) |prag| { | |
| 2479 | if (!prag.shouldPreserveTokens(pp, i + 1)) { | |
| 2480 | i += pragma_len; | |
| 2481 | cur = pp.tokens.get(i); | |
| 2482 | continue; | |
| 2483 | } | |
| 2484 | } | |
| 2485 | try w.writeAll("#pragma"); | |
| 2486 | i += 1; | |
| 2487 | while (true) : (i += 1) { | |
| 2488 | cur = pp.tokens.get(i); | |
| 2489 | if (cur.id == .nl) { | |
| 2490 | try w.writeByte('\n'); | |
| 2491 | break; | |
| 2492 | } | |
| 2493 | try w.writeByte(' '); | |
| 2494 | const slice = pp.expandedSlice(cur); | |
| 2495 | try w.writeAll(slice); | |
| 2496 | } | |
| 2497 | }, | |
| 2498 | .whitespace => { | |
| 2499 | var slice = pp.expandedSlice(cur); | |
| 2500 | while (mem.indexOfScalar(u8, slice, '\n')) |some| { | |
| 2501 | try w.writeByte('\n'); | |
| 2502 | slice = slice[some + 1 ..]; | |
| 2503 | } | |
| 2504 | for (slice) |_| try w.writeByte(' '); | |
| 2505 | }, | |
| 2506 | else => { | |
| 2507 | const slice = pp.expandedSlice(cur); | |
| 2508 | try w.writeAll(slice); | |
| 2509 | }, | |
| 2510 | } | |
| 2511 | } | |
| 2512 | } | |
| 2513 | ||
| 2514 | test "Preserve pragma tokens sometimes" { | |
| 2515 | const allocator = std.testing.allocator; | |
| 2516 | const Test = struct { | |
| 2517 | fn runPreprocessor(source_text: []const u8) ![]const u8 { | |
| 2518 | var buf = std.ArrayList(u8).init(allocator); | |
| 2519 | defer buf.deinit(); | |
| 2520 | ||
| 2521 | var comp = Compilation.init(allocator); | |
| 2522 | defer comp.deinit(); | |
| 2523 | ||
| 2524 | try comp.addDefaultPragmaHandlers(); | |
| 2525 | ||
| 2526 | var pp = Preprocessor.init(&comp); | |
| 2527 | defer pp.deinit(); | |
| 2528 | ||
| 2529 | pp.preserve_whitespace = true; | |
| 2530 | ||
| 2531 | const test_runner_macros = try comp.addSourceFromBuffer("<test_runner>", source_text); | |
| 2532 | const eof = try pp.preprocess(test_runner_macros); | |
| 2533 | try pp.tokens.append(pp.gpa, eof); | |
| 2534 | try pp.prettyPrintTokens(buf.writer()); | |
| 2535 | return allocator.dupe(u8, buf.items); | |
| 2536 | } | |
| 2537 | ||
| 2538 | fn check(source_text: []const u8, expected: []const u8) !void { | |
| 2539 | const output = try runPreprocessor(source_text); | |
| 2540 | defer allocator.free(output); | |
| 2541 | ||
| 2542 | try std.testing.expectEqualStrings(expected, output); | |
| 2543 | } | |
| 2544 | }; | |
| 2545 | const preserve_gcc_diagnostic = | |
| 2546 | \\#pragma GCC diagnostic error "-Wnewline-eof" | |
| 2547 | \\#pragma GCC warning error "-Wnewline-eof" | |
| 2548 | \\int x; | |
| 2549 | \\#pragma GCC ignored error "-Wnewline-eof" | |
| 2550 | \\ | |
| 2551 | ; | |
| 2552 | try Test.check(preserve_gcc_diagnostic, preserve_gcc_diagnostic); | |
| 2553 | ||
| 2554 | const omit_once = | |
| 2555 | \\#pragma once | |
| 2556 | \\int x; | |
| 2557 | \\#pragma once | |
| 2558 | \\ | |
| 2559 | ; | |
| 2560 | try Test.check(omit_once, "int x;\n"); | |
| 2561 | ||
| 2562 | const omit_poison = | |
| 2563 | \\#pragma GCC poison foobar | |
| 2564 | \\ | |
| 2565 | ; | |
| 2566 | try Test.check(omit_poison, ""); | |
| 2567 | } | |
| 2568 | ||
| 2569 | test "destringify" { | |
| 2570 | const allocator = std.testing.allocator; | |
| 2571 | const Test = struct { | |
| 2572 | fn testDestringify(pp: *Preprocessor, stringified: []const u8, destringified: []const u8) !void { | |
| 2573 | pp.char_buf.clearRetainingCapacity(); | |
| 2574 | try pp.char_buf.ensureUnusedCapacity(stringified.len); | |
| 2575 | pp.destringify(stringified); | |
| 2576 | try std.testing.expectEqualStrings(destringified, pp.char_buf.items); | |
| 2577 | } | |
| 2578 | }; | |
| 2579 | var comp = Compilation.init(allocator); | |
| 2580 | defer comp.deinit(); | |
| 2581 | var pp = Preprocessor.init(&comp); | |
| 2582 | defer pp.deinit(); | |
| 2583 | ||
| 2584 | try Test.testDestringify(&pp, "hello\tworld\n", "hello\tworld\n"); | |
| 2585 | try Test.testDestringify(&pp, | |
| 2586 | \\ \"FOO BAR BAZ\" | |
| 2587 | , | |
| 2588 | \\ "FOO BAR BAZ" | |
| 2589 | ); | |
| 2590 | try Test.testDestringify(&pp, | |
| 2591 | \\ \\t\\n | |
| 2592 | \\ | |
| 2593 | , | |
| 2594 | \\ \t\n | |
| 2595 | \\ | |
| 2596 | ); | |
| 2597 | } | |
| 2598 | ||
| 2599 | test "Include guards" { | |
| 2600 | const Test = struct { | |
| 2601 | /// This is here so that when #elifdef / #elifndef are added we don't forget | |
| 2602 | /// to test that they don't accidentally break include guard detection | |
| 2603 | fn pairsWithIfndef(tok_id: RawToken.Id) bool { | |
| 2604 | return switch (tok_id) { | |
| 2605 | .keyword_elif, | |
| 2606 | .keyword_elifdef, | |
| 2607 | .keyword_elifndef, | |
| 2608 | .keyword_else, | |
| 2609 | => true, | |
| 2610 | ||
| 2611 | .keyword_include, | |
| 2612 | .keyword_include_next, | |
| 2613 | .keyword_embed, | |
| 2614 | .keyword_define, | |
| 2615 | .keyword_defined, | |
| 2616 | .keyword_undef, | |
| 2617 | .keyword_ifdef, | |
| 2618 | .keyword_ifndef, | |
| 2619 | .keyword_error, | |
| 2620 | .keyword_warning, | |
| 2621 | .keyword_pragma, | |
| 2622 | .keyword_line, | |
| 2623 | .keyword_endif, | |
| 2624 | => false, | |
| 2625 | else => unreachable, | |
| 2626 | }; | |
| 2627 | } | |
| 2628 | ||
| 2629 | fn skippable(tok_id: RawToken.Id) bool { | |
| 2630 | return switch (tok_id) { | |
| 2631 | .keyword_defined, .keyword_va_args, .keyword_endif => true, | |
| 2632 | else => false, | |
| 2633 | }; | |
| 2634 | } | |
| 2635 | ||
| 2636 | fn testIncludeGuard(allocator: std.mem.Allocator, comptime template: []const u8, tok_id: RawToken.Id, expected_guards: u32) !void { | |
| 2637 | var comp = Compilation.init(allocator); | |
| 2638 | defer comp.deinit(); | |
| 2639 | var pp = Preprocessor.init(&comp); | |
| 2640 | defer pp.deinit(); | |
| 2641 | ||
| 2642 | const path = try std.fs.path.join(allocator, &.{ ".", "bar.h" }); | |
| 2643 | defer allocator.free(path); | |
| 2644 | ||
| 2645 | _ = try comp.addSourceFromBuffer(path, "int bar = 5;\n"); | |
| 2646 | ||
| 2647 | var buf = std.ArrayList(u8).init(allocator); | |
| 2648 | defer buf.deinit(); | |
| 2649 | ||
| 2650 | var writer = buf.writer(); | |
| 2651 | switch (tok_id) { | |
| 2652 | .keyword_include, .keyword_include_next => try writer.print(template, .{ tok_id.lexeme().?, " \"bar.h\"" }), | |
| 2653 | .keyword_define, .keyword_undef => try writer.print(template, .{ tok_id.lexeme().?, " BAR" }), | |
| 2654 | .keyword_ifndef, | |
| 2655 | .keyword_ifdef, | |
| 2656 | .keyword_elifdef, | |
| 2657 | .keyword_elifndef, | |
| 2658 | => try writer.print(template, .{ tok_id.lexeme().?, " BAR\n#endif" }), | |
| 2659 | else => try writer.print(template, .{ tok_id.lexeme().?, "" }), | |
| 2660 | } | |
| 2661 | const source = try comp.addSourceFromBuffer("test.h", buf.items); | |
| 2662 | _ = try pp.preprocess(source); | |
| 2663 | ||
| 2664 | try std.testing.expectEqual(expected_guards, pp.include_guards.count()); | |
| 2665 | } | |
| 2666 | }; | |
| 2667 | const tags = std.meta.tags(RawToken.Id); | |
| 2668 | for (tags) |tag| { | |
| 2669 | if (Test.skippable(tag)) continue; | |
| 2670 | var copy = tag; | |
| 2671 | copy.simplifyMacroKeyword(); | |
| 2672 | if (copy != tag or tag == .keyword_else) { | |
| 2673 | const inside_ifndef_template = | |
| 2674 | \\//Leading comment (should be ignored) | |
| 2675 | \\ | |
| 2676 | \\#ifndef FOO | |
| 2677 | \\#{s}{s} | |
| 2678 | \\#endif | |
| 2679 | ; | |
| 2680 | const expected_guards: u32 = if (Test.pairsWithIfndef(tag)) 0 else 1; | |
| 2681 | try Test.testIncludeGuard(std.testing.allocator, inside_ifndef_template, tag, expected_guards); | |
| 2682 | ||
| 2683 | const outside_ifndef_template = | |
| 2684 | \\#ifndef FOO | |
| 2685 | \\#endif | |
| 2686 | \\#{s}{s} | |
| 2687 | ; | |
| 2688 | try Test.testIncludeGuard(std.testing.allocator, outside_ifndef_template, tag, 0); | |
| 2689 | } | |
| 2690 | } | |
| 2691 | } |
deps/aro/Source.zig created+125| ... | ... | @@ -0,0 +1,125 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Source = @This(); | |
| 3 | ||
| 4 | pub const Id = enum(u32) { | |
| 5 | unused = 0, | |
| 6 | generated = 1, | |
| 7 | _, | |
| 8 | }; | |
| 9 | ||
| 10 | pub const Location = struct { | |
| 11 | id: Id = .unused, | |
| 12 | byte_offset: u32 = 0, | |
| 13 | line: u32 = 0, | |
| 14 | ||
| 15 | pub fn eql(a: Location, b: Location) bool { | |
| 16 | return a.id == b.id and a.byte_offset == b.byte_offset and a.line == b.line; | |
| 17 | } | |
| 18 | }; | |
| 19 | ||
| 20 | path: []const u8, | |
| 21 | buf: []const u8, | |
| 22 | id: Id, | |
| 23 | /// each entry represents a byte position within `buf` where a backslash+newline was deleted | |
| 24 | /// from the original raw buffer. The same position can appear multiple times if multiple | |
| 25 | /// consecutive splices happened. Guaranteed to be non-decreasing | |
| 26 | splice_locs: []const u32, | |
| 27 | ||
| 28 | /// Todo: binary search instead of scanning entire `splice_locs`. | |
| 29 | pub fn numSplicesBefore(source: Source, byte_offset: u32) u32 { | |
| 30 | for (source.splice_locs, 0..) |splice_offset, i| { | |
| 31 | if (splice_offset > byte_offset) return @intCast(i); | |
| 32 | } | |
| 33 | return @intCast(source.splice_locs.len); | |
| 34 | } | |
| 35 | ||
| 36 | /// Returns the actual line number (before newline splicing) of a Location | |
| 37 | /// This corresponds to what the user would actually see in their text editor | |
| 38 | pub fn physicalLine(source: Source, loc: Location) u32 { | |
| 39 | return loc.line + source.numSplicesBefore(loc.byte_offset); | |
| 40 | } | |
| 41 | ||
| 42 | const LineCol = struct { line: []const u8, line_no: u32, col: u32, width: u32, end_with_splice: bool }; | |
| 43 | ||
| 44 | pub fn lineCol(source: Source, loc: Location) LineCol { | |
| 45 | var start: usize = 0; | |
| 46 | // find the start of the line which is either a newline or a splice | |
| 47 | if (std.mem.lastIndexOfScalar(u8, source.buf[0..loc.byte_offset], '\n')) |some| start = some + 1; | |
| 48 | const splice_index: u32 = for (source.splice_locs, 0..) |splice_offset, i| { | |
| 49 | if (splice_offset > start) { | |
| 50 | if (splice_offset < loc.byte_offset) { | |
| 51 | start = splice_offset; | |
| 52 | break @as(u32, @intCast(i)) + 1; | |
| 53 | } | |
| 54 | break @intCast(i); | |
| 55 | } | |
| 56 | } else @intCast(source.splice_locs.len); | |
| 57 | var i: usize = start; | |
| 58 | var col: u32 = 1; | |
| 59 | var width: u32 = 0; | |
| 60 | ||
| 61 | while (i < loc.byte_offset) : (col += 1) { // TODO this is still incorrect, but better | |
| 62 | const len = std.unicode.utf8ByteSequenceLength(source.buf[i]) catch unreachable; | |
| 63 | const cp = std.unicode.utf8Decode(source.buf[i..][0..len]) catch unreachable; | |
| 64 | width += codepointWidth(cp); | |
| 65 | i += len; | |
| 66 | } | |
| 67 | ||
| 68 | // find the end of the line which is either a newline, EOF or a splice | |
| 69 | var nl = source.buf.len; | |
| 70 | var end_with_splice = false; | |
| 71 | if (std.mem.indexOfScalar(u8, source.buf[start..], '\n')) |some| nl = some + start; | |
| 72 | if (source.splice_locs.len > splice_index and nl > source.splice_locs[splice_index] and source.splice_locs[splice_index] > start) { | |
| 73 | end_with_splice = true; | |
| 74 | nl = source.splice_locs[splice_index]; | |
| 75 | } | |
| 76 | return .{ | |
| 77 | .line = source.buf[start..nl], | |
| 78 | .line_no = loc.line + splice_index, | |
| 79 | .col = col, | |
| 80 | .width = width, | |
| 81 | .end_with_splice = end_with_splice, | |
| 82 | }; | |
| 83 | } | |
| 84 | ||
| 85 | fn codepointWidth(cp: u32) u32 { | |
| 86 | return switch (cp) { | |
| 87 | 0x1100...0x115F, | |
| 88 | 0x2329, | |
| 89 | 0x232A, | |
| 90 | 0x2E80...0x303F, | |
| 91 | 0x3040...0x3247, | |
| 92 | 0x3250...0x4DBF, | |
| 93 | 0x4E00...0xA4C6, | |
| 94 | 0xA960...0xA97C, | |
| 95 | 0xAC00...0xD7A3, | |
| 96 | 0xF900...0xFAFF, | |
| 97 | 0xFE10...0xFE19, | |
| 98 | 0xFE30...0xFE6B, | |
| 99 | 0xFF01...0xFF60, | |
| 100 | 0xFFE0...0xFFE6, | |
| 101 | 0x1B000...0x1B001, | |
| 102 | 0x1F200...0x1F251, | |
| 103 | 0x20000...0x3FFFD, | |
| 104 | 0x1F300...0x1F5FF, | |
| 105 | 0x1F900...0x1F9FF, | |
| 106 | => 2, | |
| 107 | else => 1, | |
| 108 | }; | |
| 109 | } | |
| 110 | ||
| 111 | /// Returns the first offset, if any, in buf where an invalid utf8 sequence | |
| 112 | /// is found. Code adapted from std.unicode.utf8ValidateSlice | |
| 113 | pub fn offsetOfInvalidUtf8(self: Source) ?u32 { | |
| 114 | const buf = self.buf; | |
| 115 | std.debug.assert(buf.len <= std.math.maxInt(u32)); | |
| 116 | var i: u32 = 0; | |
| 117 | while (i < buf.len) { | |
| 118 | if (std.unicode.utf8ByteSequenceLength(buf[i])) |cp_len| { | |
| 119 | if (i + cp_len > buf.len) return i; | |
| 120 | if (std.meta.isError(std.unicode.utf8Decode(buf[i .. i + cp_len]))) return i; | |
| 121 | i += cp_len; | |
| 122 | } else |_| return i; | |
| 123 | } | |
| 124 | return null; | |
| 125 | } |
deps/aro/StringInterner.zig created+78| ... | ... | @@ -0,0 +1,78 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | ||
| 4 | const StringInterner = @This(); | |
| 5 | ||
| 6 | const StringToIdMap = std.StringHashMapUnmanaged(StringId); | |
| 7 | ||
| 8 | pub const StringId = enum(u32) { | |
| 9 | empty, | |
| 10 | _, | |
| 11 | }; | |
| 12 | ||
| 13 | pub const TypeMapper = struct { | |
| 14 | const LookupSpeed = enum { | |
| 15 | fast, | |
| 16 | slow, | |
| 17 | }; | |
| 18 | ||
| 19 | data: union(LookupSpeed) { | |
| 20 | fast: []const []const u8, | |
| 21 | slow: *const StringToIdMap, | |
| 22 | }, | |
| 23 | ||
| 24 | pub fn lookup(self: TypeMapper, string_id: StringInterner.StringId) []const u8 { | |
| 25 | if (string_id == .empty) return ""; | |
| 26 | switch (self.data) { | |
| 27 | .fast => |arr| return arr[@intFromEnum(string_id)], | |
| 28 | .slow => |map| { | |
| 29 | var it = map.iterator(); | |
| 30 | while (it.next()) |entry| { | |
| 31 | if (entry.value_ptr.* == string_id) return entry.key_ptr.*; | |
| 32 | } | |
| 33 | unreachable; | |
| 34 | }, | |
| 35 | } | |
| 36 | } | |
| 37 | ||
| 38 | pub fn deinit(self: TypeMapper, allocator: mem.Allocator) void { | |
| 39 | switch (self.data) { | |
| 40 | .slow => {}, | |
| 41 | .fast => |arr| allocator.free(arr), | |
| 42 | } | |
| 43 | } | |
| 44 | }; | |
| 45 | ||
| 46 | string_table: StringToIdMap = .{}, | |
| 47 | next_id: StringId = @enumFromInt(@intFromEnum(StringId.empty) + 1), | |
| 48 | ||
| 49 | pub fn deinit(self: *StringInterner, allocator: mem.Allocator) void { | |
| 50 | self.string_table.deinit(allocator); | |
| 51 | } | |
| 52 | ||
| 53 | pub fn intern(self: *StringInterner, allocator: mem.Allocator, str: []const u8) !StringId { | |
| 54 | if (str.len == 0) return .empty; | |
| 55 | ||
| 56 | const gop = try self.string_table.getOrPut(allocator, str); | |
| 57 | if (gop.found_existing) return gop.value_ptr.*; | |
| 58 | ||
| 59 | defer self.next_id = @enumFromInt(@intFromEnum(self.next_id) + 1); | |
| 60 | gop.value_ptr.* = self.next_id; | |
| 61 | return self.next_id; | |
| 62 | } | |
| 63 | ||
| 64 | /// deinit for the returned TypeMapper is a no-op and does not need to be called | |
| 65 | pub fn getSlowTypeMapper(self: *const StringInterner) TypeMapper { | |
| 66 | return TypeMapper{ .data = .{ .slow = &self.string_table } }; | |
| 67 | } | |
| 68 | ||
| 69 | /// Caller must call `deinit` on the returned TypeMapper | |
| 70 | pub fn getFastTypeMapper(self: *const StringInterner, allocator: mem.Allocator) !TypeMapper { | |
| 71 | var strings = try allocator.alloc([]const u8, @intFromEnum(self.next_id)); | |
| 72 | var it = self.string_table.iterator(); | |
| 73 | strings[0] = ""; | |
| 74 | while (it.next()) |entry| { | |
| 75 | strings[@intFromEnum(entry.value_ptr.*)] = entry.key_ptr.*; | |
| 76 | } | |
| 77 | return TypeMapper{ .data = .{ .fast = strings } }; | |
| 78 | } |
deps/aro/SymbolStack.zig created+375| ... | ... | @@ -0,0 +1,375 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Allocator = mem.Allocator; | |
| 4 | const assert = std.debug.assert; | |
| 5 | const Tree = @import("Tree.zig"); | |
| 6 | const Token = Tree.Token; | |
| 7 | const TokenIndex = Tree.TokenIndex; | |
| 8 | const NodeIndex = Tree.NodeIndex; | |
| 9 | const Type = @import("Type.zig"); | |
| 10 | const Parser = @import("Parser.zig"); | |
| 11 | const Value = @import("Value.zig"); | |
| 12 | const StringId = @import("StringInterner.zig").StringId; | |
| 13 | ||
| 14 | const SymbolStack = @This(); | |
| 15 | ||
| 16 | pub const Symbol = struct { | |
| 17 | name: StringId, | |
| 18 | ty: Type, | |
| 19 | tok: TokenIndex, | |
| 20 | node: NodeIndex = .none, | |
| 21 | kind: Kind, | |
| 22 | val: Value, | |
| 23 | }; | |
| 24 | ||
| 25 | pub const Kind = enum { | |
| 26 | typedef, | |
| 27 | @"struct", | |
| 28 | @"union", | |
| 29 | @"enum", | |
| 30 | decl, | |
| 31 | def, | |
| 32 | enumeration, | |
| 33 | constexpr, | |
| 34 | }; | |
| 35 | ||
| 36 | syms: std.MultiArrayList(Symbol) = .{}, | |
| 37 | scopes: std.ArrayListUnmanaged(u32) = .{}, | |
| 38 | ||
| 39 | pub fn deinit(s: *SymbolStack, gpa: Allocator) void { | |
| 40 | s.syms.deinit(gpa); | |
| 41 | s.scopes.deinit(gpa); | |
| 42 | s.* = undefined; | |
| 43 | } | |
| 44 | ||
| 45 | pub fn scopeEnd(s: SymbolStack) u32 { | |
| 46 | if (s.scopes.items.len == 0) return 0; | |
| 47 | return s.scopes.items[s.scopes.items.len - 1]; | |
| 48 | } | |
| 49 | ||
| 50 | pub fn pushScope(s: *SymbolStack, p: *Parser) !void { | |
| 51 | try s.scopes.append(p.pp.comp.gpa, @intCast(s.syms.len)); | |
| 52 | } | |
| 53 | ||
| 54 | pub fn popScope(s: *SymbolStack) void { | |
| 55 | s.syms.len = s.scopes.pop(); | |
| 56 | } | |
| 57 | ||
| 58 | pub fn findTypedef(s: *SymbolStack, p: *Parser, name: StringId, name_tok: TokenIndex, no_type_yet: bool) !?Symbol { | |
| 59 | const kinds = s.syms.items(.kind); | |
| 60 | const names = s.syms.items(.name); | |
| 61 | var i = s.syms.len; | |
| 62 | while (i > 0) { | |
| 63 | i -= 1; | |
| 64 | switch (kinds[i]) { | |
| 65 | .typedef => if (names[i] == name) return s.syms.get(i), | |
| 66 | .@"struct" => if (names[i] == name) { | |
| 67 | if (no_type_yet) return null; | |
| 68 | try p.errStr(.must_use_struct, name_tok, p.tokSlice(name_tok)); | |
| 69 | return s.syms.get(i); | |
| 70 | }, | |
| 71 | .@"union" => if (names[i] == name) { | |
| 72 | if (no_type_yet) return null; | |
| 73 | try p.errStr(.must_use_union, name_tok, p.tokSlice(name_tok)); | |
| 74 | return s.syms.get(i); | |
| 75 | }, | |
| 76 | .@"enum" => if (names[i] == name) { | |
| 77 | if (no_type_yet) return null; | |
| 78 | try p.errStr(.must_use_enum, name_tok, p.tokSlice(name_tok)); | |
| 79 | return s.syms.get(i); | |
| 80 | }, | |
| 81 | .def, .decl, .constexpr => if (names[i] == name) return null, | |
| 82 | else => {}, | |
| 83 | } | |
| 84 | } | |
| 85 | return null; | |
| 86 | } | |
| 87 | ||
| 88 | pub fn findSymbol(s: *SymbolStack, name: StringId) ?Symbol { | |
| 89 | const kinds = s.syms.items(.kind); | |
| 90 | const names = s.syms.items(.name); | |
| 91 | var i = s.syms.len; | |
| 92 | while (i > 0) { | |
| 93 | i -= 1; | |
| 94 | switch (kinds[i]) { | |
| 95 | .def, .decl, .enumeration, .constexpr => if (names[i] == name) return s.syms.get(i), | |
| 96 | else => {}, | |
| 97 | } | |
| 98 | } | |
| 99 | return null; | |
| 100 | } | |
| 101 | ||
| 102 | pub fn findTag( | |
| 103 | s: *SymbolStack, | |
| 104 | p: *Parser, | |
| 105 | name: StringId, | |
| 106 | kind: Token.Id, | |
| 107 | name_tok: TokenIndex, | |
| 108 | next_tok_id: Token.Id, | |
| 109 | ) !?Symbol { | |
| 110 | const kinds = s.syms.items(.kind); | |
| 111 | const names = s.syms.items(.name); | |
| 112 | // `tag Name;` should always result in a new type if in a new scope. | |
| 113 | const end = if (next_tok_id == .semicolon) s.scopeEnd() else 0; | |
| 114 | var i = s.syms.len; | |
| 115 | while (i > end) { | |
| 116 | i -= 1; | |
| 117 | switch (kinds[i]) { | |
| 118 | .@"enum" => if (names[i] == name) { | |
| 119 | if (kind == .keyword_enum) return s.syms.get(i); | |
| 120 | break; | |
| 121 | }, | |
| 122 | .@"struct" => if (names[i] == name) { | |
| 123 | if (kind == .keyword_struct) return s.syms.get(i); | |
| 124 | break; | |
| 125 | }, | |
| 126 | .@"union" => if (names[i] == name) { | |
| 127 | if (kind == .keyword_union) return s.syms.get(i); | |
| 128 | break; | |
| 129 | }, | |
| 130 | else => {}, | |
| 131 | } | |
| 132 | } else return null; | |
| 133 | ||
| 134 | if (i < s.scopeEnd()) return null; | |
| 135 | try p.errStr(.wrong_tag, name_tok, p.tokSlice(name_tok)); | |
| 136 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 137 | return null; | |
| 138 | } | |
| 139 | ||
| 140 | pub fn defineTypedef( | |
| 141 | s: *SymbolStack, | |
| 142 | p: *Parser, | |
| 143 | name: StringId, | |
| 144 | ty: Type, | |
| 145 | tok: TokenIndex, | |
| 146 | node: NodeIndex, | |
| 147 | ) !void { | |
| 148 | const kinds = s.syms.items(.kind); | |
| 149 | const names = s.syms.items(.name); | |
| 150 | const end = s.scopeEnd(); | |
| 151 | var i = s.syms.len; | |
| 152 | while (i > end) { | |
| 153 | i -= 1; | |
| 154 | switch (kinds[i]) { | |
| 155 | .typedef => if (names[i] == name) { | |
| 156 | const prev_ty = s.syms.items(.ty)[i]; | |
| 157 | if (ty.eql(prev_ty, p.pp.comp, true)) break; | |
| 158 | try p.errStr(.redefinition_of_typedef, tok, try p.typePairStrExtra(ty, " vs ", prev_ty)); | |
| 159 | const previous_tok = s.syms.items(.tok)[i]; | |
| 160 | if (previous_tok != 0) try p.errTok(.previous_definition, previous_tok); | |
| 161 | break; | |
| 162 | }, | |
| 163 | else => {}, | |
| 164 | } | |
| 165 | } | |
| 166 | try s.syms.append(p.pp.comp.gpa, .{ | |
| 167 | .kind = .typedef, | |
| 168 | .name = name, | |
| 169 | .tok = tok, | |
| 170 | .ty = ty, | |
| 171 | .node = node, | |
| 172 | .val = .{}, | |
| 173 | }); | |
| 174 | } | |
| 175 | ||
| 176 | pub fn defineSymbol( | |
| 177 | s: *SymbolStack, | |
| 178 | p: *Parser, | |
| 179 | name: StringId, | |
| 180 | ty: Type, | |
| 181 | tok: TokenIndex, | |
| 182 | node: NodeIndex, | |
| 183 | val: Value, | |
| 184 | constexpr: bool, | |
| 185 | ) !void { | |
| 186 | const kinds = s.syms.items(.kind); | |
| 187 | const names = s.syms.items(.name); | |
| 188 | const end = s.scopeEnd(); | |
| 189 | var i = s.syms.len; | |
| 190 | while (i > end) { | |
| 191 | i -= 1; | |
| 192 | switch (kinds[i]) { | |
| 193 | .enumeration => if (names[i] == name) { | |
| 194 | try p.errStr(.redefinition_different_sym, tok, p.tokSlice(tok)); | |
| 195 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 196 | break; | |
| 197 | }, | |
| 198 | .decl => if (names[i] == name) { | |
| 199 | const prev_ty = s.syms.items(.ty)[i]; | |
| 200 | if (!ty.eql(prev_ty, p.pp.comp, true)) { // TODO adjusted equality check | |
| 201 | try p.errStr(.redefinition_incompatible, tok, p.tokSlice(tok)); | |
| 202 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 203 | } | |
| 204 | break; | |
| 205 | }, | |
| 206 | .def, .constexpr => if (names[i] == name) { | |
| 207 | try p.errStr(.redefinition, tok, p.tokSlice(tok)); | |
| 208 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 209 | break; | |
| 210 | }, | |
| 211 | else => {}, | |
| 212 | } | |
| 213 | } | |
| 214 | try s.syms.append(p.pp.comp.gpa, .{ | |
| 215 | .kind = if (constexpr) .constexpr else .def, | |
| 216 | .name = name, | |
| 217 | .tok = tok, | |
| 218 | .ty = ty, | |
| 219 | .node = node, | |
| 220 | .val = val, | |
| 221 | }); | |
| 222 | } | |
| 223 | ||
| 224 | pub fn declareSymbol( | |
| 225 | s: *SymbolStack, | |
| 226 | p: *Parser, | |
| 227 | name: StringId, | |
| 228 | ty: Type, | |
| 229 | tok: TokenIndex, | |
| 230 | node: NodeIndex, | |
| 231 | ) !void { | |
| 232 | const kinds = s.syms.items(.kind); | |
| 233 | const names = s.syms.items(.name); | |
| 234 | const end = s.scopeEnd(); | |
| 235 | var i = s.syms.len; | |
| 236 | while (i > end) { | |
| 237 | i -= 1; | |
| 238 | switch (kinds[i]) { | |
| 239 | .enumeration => if (names[i] == name) { | |
| 240 | try p.errStr(.redefinition_different_sym, tok, p.tokSlice(tok)); | |
| 241 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 242 | break; | |
| 243 | }, | |
| 244 | .decl => if (names[i] == name) { | |
| 245 | const prev_ty = s.syms.items(.ty)[i]; | |
| 246 | if (!ty.eql(prev_ty, p.pp.comp, true)) { // TODO adjusted equality check | |
| 247 | try p.errStr(.redefinition_incompatible, tok, p.tokSlice(tok)); | |
| 248 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 249 | } | |
| 250 | break; | |
| 251 | }, | |
| 252 | .def, .constexpr => if (names[i] == name) { | |
| 253 | const prev_ty = s.syms.items(.ty)[i]; | |
| 254 | if (!ty.eql(prev_ty, p.pp.comp, true)) { // TODO adjusted equality check | |
| 255 | try p.errStr(.redefinition_incompatible, tok, p.tokSlice(tok)); | |
| 256 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 257 | break; | |
| 258 | } | |
| 259 | return; | |
| 260 | }, | |
| 261 | else => {}, | |
| 262 | } | |
| 263 | } | |
| 264 | try s.syms.append(p.pp.comp.gpa, .{ | |
| 265 | .kind = .decl, | |
| 266 | .name = name, | |
| 267 | .tok = tok, | |
| 268 | .ty = ty, | |
| 269 | .node = node, | |
| 270 | .val = .{}, | |
| 271 | }); | |
| 272 | } | |
| 273 | ||
| 274 | pub fn defineParam(s: *SymbolStack, p: *Parser, name: StringId, ty: Type, tok: TokenIndex) !void { | |
| 275 | const kinds = s.syms.items(.kind); | |
| 276 | const names = s.syms.items(.name); | |
| 277 | const end = s.scopeEnd(); | |
| 278 | var i = s.syms.len; | |
| 279 | while (i > end) { | |
| 280 | i -= 1; | |
| 281 | switch (kinds[i]) { | |
| 282 | .enumeration, .decl, .def, .constexpr => if (names[i] == name) { | |
| 283 | try p.errStr(.redefinition_of_parameter, tok, p.tokSlice(tok)); | |
| 284 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 285 | break; | |
| 286 | }, | |
| 287 | else => {}, | |
| 288 | } | |
| 289 | } | |
| 290 | if (ty.is(.fp16) and !p.comp.hasHalfPrecisionFloatABI()) { | |
| 291 | try p.errStr(.suggest_pointer_for_invalid_fp16, tok, "parameters"); | |
| 292 | } | |
| 293 | try s.syms.append(p.pp.comp.gpa, .{ | |
| 294 | .kind = .def, | |
| 295 | .name = name, | |
| 296 | .tok = tok, | |
| 297 | .ty = ty, | |
| 298 | .val = .{}, | |
| 299 | }); | |
| 300 | } | |
| 301 | ||
| 302 | pub fn defineTag( | |
| 303 | s: *SymbolStack, | |
| 304 | p: *Parser, | |
| 305 | name: StringId, | |
| 306 | kind: Token.Id, | |
| 307 | tok: TokenIndex, | |
| 308 | ) !?Symbol { | |
| 309 | const kinds = s.syms.items(.kind); | |
| 310 | const names = s.syms.items(.name); | |
| 311 | const end = s.scopeEnd(); | |
| 312 | var i = s.syms.len; | |
| 313 | while (i > end) { | |
| 314 | i -= 1; | |
| 315 | switch (kinds[i]) { | |
| 316 | .@"enum" => if (names[i] == name) { | |
| 317 | if (kind == .keyword_enum) return s.syms.get(i); | |
| 318 | try p.errStr(.wrong_tag, tok, p.tokSlice(tok)); | |
| 319 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 320 | return null; | |
| 321 | }, | |
| 322 | .@"struct" => if (names[i] == name) { | |
| 323 | if (kind == .keyword_struct) return s.syms.get(i); | |
| 324 | try p.errStr(.wrong_tag, tok, p.tokSlice(tok)); | |
| 325 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 326 | return null; | |
| 327 | }, | |
| 328 | .@"union" => if (names[i] == name) { | |
| 329 | if (kind == .keyword_union) return s.syms.get(i); | |
| 330 | try p.errStr(.wrong_tag, tok, p.tokSlice(tok)); | |
| 331 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 332 | return null; | |
| 333 | }, | |
| 334 | else => {}, | |
| 335 | } | |
| 336 | } | |
| 337 | return null; | |
| 338 | } | |
| 339 | ||
| 340 | pub fn defineEnumeration( | |
| 341 | s: *SymbolStack, | |
| 342 | p: *Parser, | |
| 343 | name: StringId, | |
| 344 | ty: Type, | |
| 345 | tok: TokenIndex, | |
| 346 | val: Value, | |
| 347 | ) !void { | |
| 348 | const kinds = s.syms.items(.kind); | |
| 349 | const names = s.syms.items(.name); | |
| 350 | const end = s.scopeEnd(); | |
| 351 | var i = s.syms.len; | |
| 352 | while (i > end) { | |
| 353 | i -= 1; | |
| 354 | switch (kinds[i]) { | |
| 355 | .enumeration => if (names[i] == name) { | |
| 356 | try p.errStr(.redefinition, tok, p.tokSlice(tok)); | |
| 357 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 358 | return; | |
| 359 | }, | |
| 360 | .decl, .def, .constexpr => if (names[i] == name) { | |
| 361 | try p.errStr(.redefinition_different_sym, tok, p.tokSlice(tok)); | |
| 362 | try p.errTok(.previous_definition, s.syms.items(.tok)[i]); | |
| 363 | return; | |
| 364 | }, | |
| 365 | else => {}, | |
| 366 | } | |
| 367 | } | |
| 368 | try s.syms.append(p.pp.comp.gpa, .{ | |
| 369 | .kind = .enumeration, | |
| 370 | .name = name, | |
| 371 | .tok = tok, | |
| 372 | .ty = ty, | |
| 373 | .val = val, | |
| 374 | }); | |
| 375 | } |
deps/aro/Tokenizer.zig created+2140| ... | ... | @@ -0,0 +1,2140 @@ |
| 1 | const std = @import("std"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | const Compilation = @import("Compilation.zig"); | |
| 4 | const Source = @import("Source.zig"); | |
| 5 | const LangOpts = @import("LangOpts.zig"); | |
| 6 | const CharInfo = @import("CharInfo.zig"); | |
| 7 | const unicode = @import("unicode.zig"); | |
| 8 | ||
| 9 | const Tokenizer = @This(); | |
| 10 | ||
| 11 | pub const Token = struct { | |
| 12 | id: Id, | |
| 13 | source: Source.Id, | |
| 14 | start: u32 = 0, | |
| 15 | end: u32 = 0, | |
| 16 | line: u32 = 0, | |
| 17 | ||
| 18 | pub const Id = enum(u8) { | |
| 19 | invalid, | |
| 20 | nl, | |
| 21 | whitespace, | |
| 22 | eof, | |
| 23 | /// identifier containing solely basic character set characters | |
| 24 | identifier, | |
| 25 | /// identifier with at least one extended character | |
| 26 | extended_identifier, | |
| 27 | ||
| 28 | // string literals with prefixes | |
| 29 | string_literal, | |
| 30 | string_literal_utf_16, | |
| 31 | string_literal_utf_8, | |
| 32 | string_literal_utf_32, | |
| 33 | string_literal_wide, | |
| 34 | ||
| 35 | // <foobar> only generated by preprocessor | |
| 36 | macro_string, | |
| 37 | ||
| 38 | // char literals with prefixes | |
| 39 | char_literal, | |
| 40 | char_literal_utf_8, | |
| 41 | char_literal_utf_16, | |
| 42 | char_literal_utf_32, | |
| 43 | char_literal_wide, | |
| 44 | ||
| 45 | /// Integer literal tokens generated by preprocessor. | |
| 46 | one, | |
| 47 | zero, | |
| 48 | ||
| 49 | bang, | |
| 50 | bang_equal, | |
| 51 | pipe, | |
| 52 | pipe_pipe, | |
| 53 | pipe_equal, | |
| 54 | equal, | |
| 55 | equal_equal, | |
| 56 | l_paren, | |
| 57 | r_paren, | |
| 58 | l_brace, | |
| 59 | r_brace, | |
| 60 | l_bracket, | |
| 61 | r_bracket, | |
| 62 | period, | |
| 63 | ellipsis, | |
| 64 | caret, | |
| 65 | caret_equal, | |
| 66 | plus, | |
| 67 | plus_plus, | |
| 68 | plus_equal, | |
| 69 | minus, | |
| 70 | minus_minus, | |
| 71 | minus_equal, | |
| 72 | asterisk, | |
| 73 | asterisk_equal, | |
| 74 | percent, | |
| 75 | percent_equal, | |
| 76 | arrow, | |
| 77 | colon, | |
| 78 | colon_colon, | |
| 79 | semicolon, | |
| 80 | slash, | |
| 81 | slash_equal, | |
| 82 | comma, | |
| 83 | ampersand, | |
| 84 | ampersand_ampersand, | |
| 85 | ampersand_equal, | |
| 86 | question_mark, | |
| 87 | angle_bracket_left, | |
| 88 | angle_bracket_left_equal, | |
| 89 | angle_bracket_angle_bracket_left, | |
| 90 | angle_bracket_angle_bracket_left_equal, | |
| 91 | angle_bracket_right, | |
| 92 | angle_bracket_right_equal, | |
| 93 | angle_bracket_angle_bracket_right, | |
| 94 | angle_bracket_angle_bracket_right_equal, | |
| 95 | tilde, | |
| 96 | hash, | |
| 97 | hash_hash, | |
| 98 | ||
| 99 | /// Special token to speed up preprocessing, `loc.end` will be an index to the param list. | |
| 100 | macro_param, | |
| 101 | /// Special token to signal that the argument must be replaced without expansion (e.g. in concatenation) | |
| 102 | macro_param_no_expand, | |
| 103 | /// Special token to speed up preprocessing, `loc.end` will be an index to the param list. | |
| 104 | stringify_param, | |
| 105 | /// Same as stringify_param, but for var args | |
| 106 | stringify_va_args, | |
| 107 | /// Special macro whitespace, always equal to a single space | |
| 108 | macro_ws, | |
| 109 | /// Special token for implementing __has_attribute | |
| 110 | macro_param_has_attribute, | |
| 111 | /// Special token for implementing __has_warning | |
| 112 | macro_param_has_warning, | |
| 113 | /// Special token for implementing __has_feature | |
| 114 | macro_param_has_feature, | |
| 115 | /// Special token for implementing __has_extension | |
| 116 | macro_param_has_extension, | |
| 117 | /// Special token for implementing __has_builtin | |
| 118 | macro_param_has_builtin, | |
| 119 | /// Special token for implementing __has_include | |
| 120 | macro_param_has_include, | |
| 121 | /// Special token for implementing __has_include_next | |
| 122 | macro_param_has_include_next, | |
| 123 | /// Special token for implementing __is_identifier | |
| 124 | macro_param_is_identifier, | |
| 125 | /// Special token for implementing __FILE__ | |
| 126 | macro_file, | |
| 127 | /// Special token for implementing __LINE__ | |
| 128 | macro_line, | |
| 129 | /// Special token for implementing __COUNTER__ | |
| 130 | macro_counter, | |
| 131 | /// Special token for implementing _Pragma | |
| 132 | macro_param_pragma_operator, | |
| 133 | ||
| 134 | /// Special identifier for implementing __func__ | |
| 135 | macro_func, | |
| 136 | /// Special identifier for implementing __FUNCTION__ | |
| 137 | macro_function, | |
| 138 | /// Special identifier for implementing __PRETTY_FUNCTION__ | |
| 139 | macro_pretty_func, | |
| 140 | ||
| 141 | keyword_auto, | |
| 142 | keyword_auto_type, | |
| 143 | keyword_break, | |
| 144 | keyword_case, | |
| 145 | keyword_char, | |
| 146 | keyword_const, | |
| 147 | keyword_continue, | |
| 148 | keyword_default, | |
| 149 | keyword_do, | |
| 150 | keyword_double, | |
| 151 | keyword_else, | |
| 152 | keyword_enum, | |
| 153 | keyword_extern, | |
| 154 | keyword_float, | |
| 155 | keyword_for, | |
| 156 | keyword_goto, | |
| 157 | keyword_if, | |
| 158 | keyword_int, | |
| 159 | keyword_long, | |
| 160 | keyword_register, | |
| 161 | keyword_return, | |
| 162 | keyword_short, | |
| 163 | keyword_signed, | |
| 164 | keyword_sizeof, | |
| 165 | keyword_static, | |
| 166 | keyword_struct, | |
| 167 | keyword_switch, | |
| 168 | keyword_typedef, | |
| 169 | keyword_typeof1, | |
| 170 | keyword_typeof2, | |
| 171 | keyword_union, | |
| 172 | keyword_unsigned, | |
| 173 | keyword_void, | |
| 174 | keyword_volatile, | |
| 175 | keyword_while, | |
| 176 | ||
| 177 | // ISO C99 | |
| 178 | keyword_bool, | |
| 179 | keyword_complex, | |
| 180 | keyword_imaginary, | |
| 181 | keyword_inline, | |
| 182 | keyword_restrict, | |
| 183 | ||
| 184 | // ISO C11 | |
| 185 | keyword_alignas, | |
| 186 | keyword_alignof, | |
| 187 | keyword_atomic, | |
| 188 | keyword_generic, | |
| 189 | keyword_noreturn, | |
| 190 | keyword_static_assert, | |
| 191 | keyword_thread_local, | |
| 192 | ||
| 193 | // ISO C23 | |
| 194 | keyword_bit_int, | |
| 195 | keyword_c23_alignas, | |
| 196 | keyword_c23_alignof, | |
| 197 | keyword_c23_bool, | |
| 198 | keyword_c23_static_assert, | |
| 199 | keyword_c23_thread_local, | |
| 200 | keyword_constexpr, | |
| 201 | keyword_true, | |
| 202 | keyword_false, | |
| 203 | keyword_nullptr, | |
| 204 | ||
| 205 | // Preprocessor directives | |
| 206 | keyword_include, | |
| 207 | keyword_include_next, | |
| 208 | keyword_embed, | |
| 209 | keyword_define, | |
| 210 | keyword_defined, | |
| 211 | keyword_undef, | |
| 212 | keyword_ifdef, | |
| 213 | keyword_ifndef, | |
| 214 | keyword_elif, | |
| 215 | keyword_elifdef, | |
| 216 | keyword_elifndef, | |
| 217 | keyword_endif, | |
| 218 | keyword_error, | |
| 219 | keyword_warning, | |
| 220 | keyword_pragma, | |
| 221 | keyword_line, | |
| 222 | keyword_va_args, | |
| 223 | ||
| 224 | // gcc keywords | |
| 225 | keyword_const1, | |
| 226 | keyword_const2, | |
| 227 | keyword_inline1, | |
| 228 | keyword_inline2, | |
| 229 | keyword_volatile1, | |
| 230 | keyword_volatile2, | |
| 231 | keyword_restrict1, | |
| 232 | keyword_restrict2, | |
| 233 | keyword_alignof1, | |
| 234 | keyword_alignof2, | |
| 235 | keyword_typeof, | |
| 236 | keyword_attribute1, | |
| 237 | keyword_attribute2, | |
| 238 | keyword_extension, | |
| 239 | keyword_asm, | |
| 240 | keyword_asm1, | |
| 241 | keyword_asm2, | |
| 242 | keyword_float80, | |
| 243 | keyword_float128, | |
| 244 | keyword_int128, | |
| 245 | keyword_imag1, | |
| 246 | keyword_imag2, | |
| 247 | keyword_real1, | |
| 248 | keyword_real2, | |
| 249 | keyword_float16, | |
| 250 | ||
| 251 | // clang keywords | |
| 252 | keyword_fp16, | |
| 253 | ||
| 254 | // ms keywords | |
| 255 | keyword_declspec, | |
| 256 | keyword_int64, | |
| 257 | keyword_int64_2, | |
| 258 | keyword_int32, | |
| 259 | keyword_int32_2, | |
| 260 | keyword_int16, | |
| 261 | keyword_int16_2, | |
| 262 | keyword_int8, | |
| 263 | keyword_int8_2, | |
| 264 | keyword_stdcall, | |
| 265 | keyword_stdcall2, | |
| 266 | keyword_thiscall, | |
| 267 | keyword_thiscall2, | |
| 268 | keyword_vectorcall, | |
| 269 | keyword_vectorcall2, | |
| 270 | ||
| 271 | // builtins that require special parsing | |
| 272 | builtin_choose_expr, | |
| 273 | builtin_va_arg, | |
| 274 | builtin_offsetof, | |
| 275 | builtin_bitoffsetof, | |
| 276 | builtin_types_compatible_p, | |
| 277 | ||
| 278 | /// Generated by #embed directive | |
| 279 | /// Decimal value with no prefix or suffix | |
| 280 | embed_byte, | |
| 281 | ||
| 282 | /// preprocessor number | |
| 283 | /// An optional period, followed by a digit 0-9, followed by any number of letters | |
| 284 | /// digits, underscores, periods, and exponents (e+, e-, E+, E-, p+, p-, P+, P-) | |
| 285 | pp_num, | |
| 286 | ||
| 287 | /// preprocessor placemarker token | |
| 288 | /// generated if `##` is used with a zero-token argument | |
| 289 | /// removed after substitution, so the parser should never see this | |
| 290 | /// See C99 6.10.3.3.2 | |
| 291 | placemarker, | |
| 292 | ||
| 293 | /// Return true if token is identifier or keyword. | |
| 294 | pub fn isMacroIdentifier(id: Id) bool { | |
| 295 | switch (id) { | |
| 296 | .keyword_include, | |
| 297 | .keyword_include_next, | |
| 298 | .keyword_embed, | |
| 299 | .keyword_define, | |
| 300 | .keyword_defined, | |
| 301 | .keyword_undef, | |
| 302 | .keyword_ifdef, | |
| 303 | .keyword_ifndef, | |
| 304 | .keyword_elif, | |
| 305 | .keyword_elifdef, | |
| 306 | .keyword_elifndef, | |
| 307 | .keyword_endif, | |
| 308 | .keyword_error, | |
| 309 | .keyword_warning, | |
| 310 | .keyword_pragma, | |
| 311 | .keyword_line, | |
| 312 | .keyword_va_args, | |
| 313 | .macro_func, | |
| 314 | .macro_function, | |
| 315 | .macro_pretty_func, | |
| 316 | .keyword_auto, | |
| 317 | .keyword_auto_type, | |
| 318 | .keyword_break, | |
| 319 | .keyword_case, | |
| 320 | .keyword_char, | |
| 321 | .keyword_const, | |
| 322 | .keyword_continue, | |
| 323 | .keyword_default, | |
| 324 | .keyword_do, | |
| 325 | .keyword_double, | |
| 326 | .keyword_else, | |
| 327 | .keyword_enum, | |
| 328 | .keyword_extern, | |
| 329 | .keyword_float, | |
| 330 | .keyword_for, | |
| 331 | .keyword_goto, | |
| 332 | .keyword_if, | |
| 333 | .keyword_int, | |
| 334 | .keyword_long, | |
| 335 | .keyword_register, | |
| 336 | .keyword_return, | |
| 337 | .keyword_short, | |
| 338 | .keyword_signed, | |
| 339 | .keyword_sizeof, | |
| 340 | .keyword_static, | |
| 341 | .keyword_struct, | |
| 342 | .keyword_switch, | |
| 343 | .keyword_typedef, | |
| 344 | .keyword_union, | |
| 345 | .keyword_unsigned, | |
| 346 | .keyword_void, | |
| 347 | .keyword_volatile, | |
| 348 | .keyword_while, | |
| 349 | .keyword_bool, | |
| 350 | .keyword_complex, | |
| 351 | .keyword_imaginary, | |
| 352 | .keyword_inline, | |
| 353 | .keyword_restrict, | |
| 354 | .keyword_alignas, | |
| 355 | .keyword_alignof, | |
| 356 | .keyword_atomic, | |
| 357 | .keyword_generic, | |
| 358 | .keyword_noreturn, | |
| 359 | .keyword_static_assert, | |
| 360 | .keyword_thread_local, | |
| 361 | .identifier, | |
| 362 | .extended_identifier, | |
| 363 | .keyword_typeof, | |
| 364 | .keyword_typeof1, | |
| 365 | .keyword_typeof2, | |
| 366 | .keyword_const1, | |
| 367 | .keyword_const2, | |
| 368 | .keyword_inline1, | |
| 369 | .keyword_inline2, | |
| 370 | .keyword_volatile1, | |
| 371 | .keyword_volatile2, | |
| 372 | .keyword_restrict1, | |
| 373 | .keyword_restrict2, | |
| 374 | .keyword_alignof1, | |
| 375 | .keyword_alignof2, | |
| 376 | .builtin_choose_expr, | |
| 377 | .builtin_va_arg, | |
| 378 | .builtin_offsetof, | |
| 379 | .builtin_bitoffsetof, | |
| 380 | .builtin_types_compatible_p, | |
| 381 | .keyword_attribute1, | |
| 382 | .keyword_attribute2, | |
| 383 | .keyword_extension, | |
| 384 | .keyword_asm, | |
| 385 | .keyword_asm1, | |
| 386 | .keyword_asm2, | |
| 387 | .keyword_float80, | |
| 388 | .keyword_float128, | |
| 389 | .keyword_int128, | |
| 390 | .keyword_imag1, | |
| 391 | .keyword_imag2, | |
| 392 | .keyword_real1, | |
| 393 | .keyword_real2, | |
| 394 | .keyword_float16, | |
| 395 | .keyword_fp16, | |
| 396 | .keyword_declspec, | |
| 397 | .keyword_int64, | |
| 398 | .keyword_int64_2, | |
| 399 | .keyword_int32, | |
| 400 | .keyword_int32_2, | |
| 401 | .keyword_int16, | |
| 402 | .keyword_int16_2, | |
| 403 | .keyword_int8, | |
| 404 | .keyword_int8_2, | |
| 405 | .keyword_stdcall, | |
| 406 | .keyword_stdcall2, | |
| 407 | .keyword_thiscall, | |
| 408 | .keyword_thiscall2, | |
| 409 | .keyword_vectorcall, | |
| 410 | .keyword_vectorcall2, | |
| 411 | .keyword_bit_int, | |
| 412 | .keyword_c23_alignas, | |
| 413 | .keyword_c23_alignof, | |
| 414 | .keyword_c23_bool, | |
| 415 | .keyword_c23_static_assert, | |
| 416 | .keyword_c23_thread_local, | |
| 417 | .keyword_constexpr, | |
| 418 | .keyword_true, | |
| 419 | .keyword_false, | |
| 420 | .keyword_nullptr, | |
| 421 | => return true, | |
| 422 | else => return false, | |
| 423 | } | |
| 424 | } | |
| 425 | ||
| 426 | /// Turn macro keywords into identifiers. | |
| 427 | /// `keyword_defined` is special since it should only turn into an identifier if | |
| 428 | /// we are *not* in an #if or #elif expression | |
| 429 | pub fn simplifyMacroKeywordExtra(id: *Id, defined_to_identifier: bool) void { | |
| 430 | switch (id.*) { | |
| 431 | .keyword_include, | |
| 432 | .keyword_include_next, | |
| 433 | .keyword_embed, | |
| 434 | .keyword_define, | |
| 435 | .keyword_undef, | |
| 436 | .keyword_ifdef, | |
| 437 | .keyword_ifndef, | |
| 438 | .keyword_elif, | |
| 439 | .keyword_elifdef, | |
| 440 | .keyword_elifndef, | |
| 441 | .keyword_endif, | |
| 442 | .keyword_error, | |
| 443 | .keyword_warning, | |
| 444 | .keyword_pragma, | |
| 445 | .keyword_line, | |
| 446 | .keyword_va_args, | |
| 447 | => id.* = .identifier, | |
| 448 | .keyword_defined => if (defined_to_identifier) { | |
| 449 | id.* = .identifier; | |
| 450 | }, | |
| 451 | else => {}, | |
| 452 | } | |
| 453 | } | |
| 454 | ||
| 455 | pub fn simplifyMacroKeyword(id: *Id) void { | |
| 456 | simplifyMacroKeywordExtra(id, false); | |
| 457 | } | |
| 458 | ||
| 459 | pub fn lexeme(id: Id) ?[]const u8 { | |
| 460 | return switch (id) { | |
| 461 | .invalid, | |
| 462 | .identifier, | |
| 463 | .extended_identifier, | |
| 464 | .string_literal, | |
| 465 | .string_literal_utf_16, | |
| 466 | .string_literal_utf_8, | |
| 467 | .string_literal_utf_32, | |
| 468 | .string_literal_wide, | |
| 469 | .char_literal, | |
| 470 | .char_literal_utf_8, | |
| 471 | .char_literal_utf_16, | |
| 472 | .char_literal_utf_32, | |
| 473 | .char_literal_wide, | |
| 474 | .macro_string, | |
| 475 | .whitespace, | |
| 476 | .pp_num, | |
| 477 | .embed_byte, | |
| 478 | => null, | |
| 479 | ||
| 480 | .zero => "0", | |
| 481 | .one => "1", | |
| 482 | ||
| 483 | .nl, | |
| 484 | .eof, | |
| 485 | .macro_param, | |
| 486 | .macro_param_no_expand, | |
| 487 | .stringify_param, | |
| 488 | .stringify_va_args, | |
| 489 | .macro_param_has_attribute, | |
| 490 | .macro_param_has_warning, | |
| 491 | .macro_param_has_feature, | |
| 492 | .macro_param_has_extension, | |
| 493 | .macro_param_has_builtin, | |
| 494 | .macro_param_has_include, | |
| 495 | .macro_param_has_include_next, | |
| 496 | .macro_param_is_identifier, | |
| 497 | .macro_file, | |
| 498 | .macro_line, | |
| 499 | .macro_counter, | |
| 500 | .macro_param_pragma_operator, | |
| 501 | .placemarker, | |
| 502 | => "", | |
| 503 | .macro_ws => " ", | |
| 504 | ||
| 505 | .macro_func => "__func__", | |
| 506 | .macro_function => "__FUNCTION__", | |
| 507 | .macro_pretty_func => "__PRETTY_FUNCTION__", | |
| 508 | ||
| 509 | .bang => "!", | |
| 510 | .bang_equal => "!=", | |
| 511 | .pipe => "|", | |
| 512 | .pipe_pipe => "||", | |
| 513 | .pipe_equal => "|=", | |
| 514 | .equal => "=", | |
| 515 | .equal_equal => "==", | |
| 516 | .l_paren => "(", | |
| 517 | .r_paren => ")", | |
| 518 | .l_brace => "{", | |
| 519 | .r_brace => "}", | |
| 520 | .l_bracket => "[", | |
| 521 | .r_bracket => "]", | |
| 522 | .period => ".", | |
| 523 | .ellipsis => "...", | |
| 524 | .caret => "^", | |
| 525 | .caret_equal => "^=", | |
| 526 | .plus => "+", | |
| 527 | .plus_plus => "++", | |
| 528 | .plus_equal => "+=", | |
| 529 | .minus => "-", | |
| 530 | .minus_minus => "--", | |
| 531 | .minus_equal => "-=", | |
| 532 | .asterisk => "*", | |
| 533 | .asterisk_equal => "*=", | |
| 534 | .percent => "%", | |
| 535 | .percent_equal => "%=", | |
| 536 | .arrow => "->", | |
| 537 | .colon => ":", | |
| 538 | .colon_colon => "::", | |
| 539 | .semicolon => ";", | |
| 540 | .slash => "/", | |
| 541 | .slash_equal => "/=", | |
| 542 | .comma => ",", | |
| 543 | .ampersand => "&", | |
| 544 | .ampersand_ampersand => "&&", | |
| 545 | .ampersand_equal => "&=", | |
| 546 | .question_mark => "?", | |
| 547 | .angle_bracket_left => "<", | |
| 548 | .angle_bracket_left_equal => "<=", | |
| 549 | .angle_bracket_angle_bracket_left => "<<", | |
| 550 | .angle_bracket_angle_bracket_left_equal => "<<=", | |
| 551 | .angle_bracket_right => ">", | |
| 552 | .angle_bracket_right_equal => ">=", | |
| 553 | .angle_bracket_angle_bracket_right => ">>", | |
| 554 | .angle_bracket_angle_bracket_right_equal => ">>=", | |
| 555 | .tilde => "~", | |
| 556 | .hash => "#", | |
| 557 | .hash_hash => "##", | |
| 558 | ||
| 559 | .keyword_auto => "auto", | |
| 560 | .keyword_auto_type => "__auto_type", | |
| 561 | .keyword_break => "break", | |
| 562 | .keyword_case => "case", | |
| 563 | .keyword_char => "char", | |
| 564 | .keyword_const => "const", | |
| 565 | .keyword_continue => "continue", | |
| 566 | .keyword_default => "default", | |
| 567 | .keyword_do => "do", | |
| 568 | .keyword_double => "double", | |
| 569 | .keyword_else => "else", | |
| 570 | .keyword_enum => "enum", | |
| 571 | .keyword_extern => "extern", | |
| 572 | .keyword_float => "float", | |
| 573 | .keyword_for => "for", | |
| 574 | .keyword_goto => "goto", | |
| 575 | .keyword_if => "if", | |
| 576 | .keyword_int => "int", | |
| 577 | .keyword_long => "long", | |
| 578 | .keyword_register => "register", | |
| 579 | .keyword_return => "return", | |
| 580 | .keyword_short => "short", | |
| 581 | .keyword_signed => "signed", | |
| 582 | .keyword_sizeof => "sizeof", | |
| 583 | .keyword_static => "static", | |
| 584 | .keyword_struct => "struct", | |
| 585 | .keyword_switch => "switch", | |
| 586 | .keyword_typedef => "typedef", | |
| 587 | .keyword_typeof => "typeof", | |
| 588 | .keyword_union => "union", | |
| 589 | .keyword_unsigned => "unsigned", | |
| 590 | .keyword_void => "void", | |
| 591 | .keyword_volatile => "volatile", | |
| 592 | .keyword_while => "while", | |
| 593 | .keyword_bool => "_Bool", | |
| 594 | .keyword_complex => "_Complex", | |
| 595 | .keyword_imaginary => "_Imaginary", | |
| 596 | .keyword_inline => "inline", | |
| 597 | .keyword_restrict => "restrict", | |
| 598 | .keyword_alignas => "_Alignas", | |
| 599 | .keyword_alignof => "_Alignof", | |
| 600 | .keyword_atomic => "_Atomic", | |
| 601 | .keyword_generic => "_Generic", | |
| 602 | .keyword_noreturn => "_Noreturn", | |
| 603 | .keyword_static_assert => "_Static_assert", | |
| 604 | .keyword_thread_local => "_Thread_local", | |
| 605 | .keyword_bit_int => "_BitInt", | |
| 606 | .keyword_c23_alignas => "alignas", | |
| 607 | .keyword_c23_alignof => "alignof", | |
| 608 | .keyword_c23_bool => "bool", | |
| 609 | .keyword_c23_static_assert => "static_assert", | |
| 610 | .keyword_c23_thread_local => "thread_local", | |
| 611 | .keyword_constexpr => "constexpr", | |
| 612 | .keyword_true => "true", | |
| 613 | .keyword_false => "false", | |
| 614 | .keyword_nullptr => "nullptr", | |
| 615 | .keyword_include => "include", | |
| 616 | .keyword_include_next => "include_next", | |
| 617 | .keyword_embed => "embed", | |
| 618 | .keyword_define => "define", | |
| 619 | .keyword_defined => "defined", | |
| 620 | .keyword_undef => "undef", | |
| 621 | .keyword_ifdef => "ifdef", | |
| 622 | .keyword_ifndef => "ifndef", | |
| 623 | .keyword_elif => "elif", | |
| 624 | .keyword_elifdef => "elifdef", | |
| 625 | .keyword_elifndef => "elifndef", | |
| 626 | .keyword_endif => "endif", | |
| 627 | .keyword_error => "error", | |
| 628 | .keyword_warning => "warning", | |
| 629 | .keyword_pragma => "pragma", | |
| 630 | .keyword_line => "line", | |
| 631 | .keyword_va_args => "__VA_ARGS__", | |
| 632 | .keyword_const1 => "__const", | |
| 633 | .keyword_const2 => "__const__", | |
| 634 | .keyword_inline1 => "__inline", | |
| 635 | .keyword_inline2 => "__inline__", | |
| 636 | .keyword_volatile1 => "__volatile", | |
| 637 | .keyword_volatile2 => "__volatile__", | |
| 638 | .keyword_restrict1 => "__restrict", | |
| 639 | .keyword_restrict2 => "__restrict__", | |
| 640 | .keyword_alignof1 => "__alignof", | |
| 641 | .keyword_alignof2 => "__alignof__", | |
| 642 | .keyword_typeof1 => "__typeof", | |
| 643 | .keyword_typeof2 => "__typeof__", | |
| 644 | .builtin_choose_expr => "__builtin_choose_expr", | |
| 645 | .builtin_va_arg => "__builtin_va_arg", | |
| 646 | .builtin_offsetof => "__builtin_offsetof", | |
| 647 | .builtin_bitoffsetof => "__builtin_bitoffsetof", | |
| 648 | .builtin_types_compatible_p => "__builtin_types_compatible_p", | |
| 649 | .keyword_attribute1 => "__attribute", | |
| 650 | .keyword_attribute2 => "__attribute__", | |
| 651 | .keyword_extension => "__extension__", | |
| 652 | .keyword_asm => "asm", | |
| 653 | .keyword_asm1 => "__asm", | |
| 654 | .keyword_asm2 => "__asm__", | |
| 655 | .keyword_float80 => "__float80", | |
| 656 | .keyword_float128 => "__float18", | |
| 657 | .keyword_int128 => "__int128", | |
| 658 | .keyword_imag1 => "__imag", | |
| 659 | .keyword_imag2 => "__imag__", | |
| 660 | .keyword_real1 => "__real", | |
| 661 | .keyword_real2 => "__real__", | |
| 662 | .keyword_float16 => "_Float16", | |
| 663 | .keyword_fp16 => "__fp16", | |
| 664 | .keyword_declspec => "__declspec", | |
| 665 | .keyword_int64 => "__int64", | |
| 666 | .keyword_int64_2 => "_int64", | |
| 667 | .keyword_int32 => "__int32", | |
| 668 | .keyword_int32_2 => "_int32", | |
| 669 | .keyword_int16 => "__int16", | |
| 670 | .keyword_int16_2 => "_int16", | |
| 671 | .keyword_int8 => "__int8", | |
| 672 | .keyword_int8_2 => "_int8", | |
| 673 | .keyword_stdcall => "__stdcall", | |
| 674 | .keyword_stdcall2 => "_stdcall", | |
| 675 | .keyword_thiscall => "__thiscall", | |
| 676 | .keyword_thiscall2 => "_thiscall", | |
| 677 | .keyword_vectorcall => "__vectorcall", | |
| 678 | .keyword_vectorcall2 => "_vectorcall", | |
| 679 | }; | |
| 680 | } | |
| 681 | ||
| 682 | pub fn symbol(id: Id) []const u8 { | |
| 683 | return switch (id) { | |
| 684 | .macro_string, .invalid => unreachable, | |
| 685 | .identifier, | |
| 686 | .extended_identifier, | |
| 687 | .macro_func, | |
| 688 | .macro_function, | |
| 689 | .macro_pretty_func, | |
| 690 | .builtin_choose_expr, | |
| 691 | .builtin_va_arg, | |
| 692 | .builtin_offsetof, | |
| 693 | .builtin_bitoffsetof, | |
| 694 | .builtin_types_compatible_p, | |
| 695 | => "an identifier", | |
| 696 | .string_literal, | |
| 697 | .string_literal_utf_16, | |
| 698 | .string_literal_utf_8, | |
| 699 | .string_literal_utf_32, | |
| 700 | .string_literal_wide, | |
| 701 | => "a string literal", | |
| 702 | .char_literal, | |
| 703 | .char_literal_utf_8, | |
| 704 | .char_literal_utf_16, | |
| 705 | .char_literal_utf_32, | |
| 706 | .char_literal_wide, | |
| 707 | => "a character literal", | |
| 708 | .pp_num, .embed_byte => "A number", | |
| 709 | else => id.lexeme().?, | |
| 710 | }; | |
| 711 | } | |
| 712 | ||
| 713 | /// tokens that can start an expression parsed by Preprocessor.expr | |
| 714 | /// Note that eof, r_paren, and string literals cannot actually start a | |
| 715 | /// preprocessor expression, but we include them here so that a nicer | |
| 716 | /// error message can be generated by the parser. | |
| 717 | pub fn validPreprocessorExprStart(id: Id) bool { | |
| 718 | return switch (id) { | |
| 719 | .eof, | |
| 720 | .r_paren, | |
| 721 | .string_literal, | |
| 722 | .string_literal_utf_16, | |
| 723 | .string_literal_utf_8, | |
| 724 | .string_literal_utf_32, | |
| 725 | .string_literal_wide, | |
| 726 | ||
| 727 | .char_literal, | |
| 728 | .char_literal_utf_8, | |
| 729 | .char_literal_utf_16, | |
| 730 | .char_literal_utf_32, | |
| 731 | .char_literal_wide, | |
| 732 | .l_paren, | |
| 733 | .plus, | |
| 734 | .minus, | |
| 735 | .tilde, | |
| 736 | .bang, | |
| 737 | .identifier, | |
| 738 | .extended_identifier, | |
| 739 | .keyword_defined, | |
| 740 | .one, | |
| 741 | .zero, | |
| 742 | .pp_num, | |
| 743 | .keyword_true, | |
| 744 | .keyword_false, | |
| 745 | => true, | |
| 746 | else => false, | |
| 747 | }; | |
| 748 | } | |
| 749 | ||
| 750 | pub fn allowsDigraphs(id: Id, comp: *const Compilation) bool { | |
| 751 | return switch (id) { | |
| 752 | .l_bracket, | |
| 753 | .r_bracket, | |
| 754 | .l_brace, | |
| 755 | .r_brace, | |
| 756 | .hash, | |
| 757 | .hash_hash, | |
| 758 | => comp.langopts.hasDigraphs(), | |
| 759 | else => false, | |
| 760 | }; | |
| 761 | } | |
| 762 | ||
| 763 | pub fn canOpenGCCAsmStmt(id: Id) bool { | |
| 764 | return switch (id) { | |
| 765 | .keyword_volatile, .keyword_volatile1, .keyword_volatile2, .keyword_inline, .keyword_inline1, .keyword_inline2, .keyword_goto, .l_paren => true, | |
| 766 | else => false, | |
| 767 | }; | |
| 768 | } | |
| 769 | ||
| 770 | pub fn isStringLiteral(id: Id) bool { | |
| 771 | return switch (id) { | |
| 772 | .string_literal, .string_literal_utf_16, .string_literal_utf_8, .string_literal_utf_32, .string_literal_wide => true, | |
| 773 | else => false, | |
| 774 | }; | |
| 775 | } | |
| 776 | }; | |
| 777 | ||
| 778 | /// double underscore and underscore + capital letter identifiers | |
| 779 | /// belong to the implementation namespace, so we always convert them | |
| 780 | /// to keywords. | |
| 781 | pub fn getTokenId(comp: *const Compilation, str: []const u8) Token.Id { | |
| 782 | const kw = all_kws.get(str) orelse return .identifier; | |
| 783 | const standard = comp.langopts.standard; | |
| 784 | return switch (kw) { | |
| 785 | .keyword_inline => if (standard.isGNU() or standard.atLeast(.c99)) kw else .identifier, | |
| 786 | .keyword_restrict => if (standard.atLeast(.c99)) kw else .identifier, | |
| 787 | .keyword_typeof => if (standard.isGNU() or standard.atLeast(.c2x)) kw else .identifier, | |
| 788 | .keyword_asm => if (standard.isGNU()) kw else .identifier, | |
| 789 | .keyword_declspec => if (comp.langopts.declspec_attrs) kw else .identifier, | |
| 790 | ||
| 791 | .keyword_c23_alignas, | |
| 792 | .keyword_c23_alignof, | |
| 793 | .keyword_c23_bool, | |
| 794 | .keyword_c23_static_assert, | |
| 795 | .keyword_c23_thread_local, | |
| 796 | .keyword_constexpr, | |
| 797 | .keyword_true, | |
| 798 | .keyword_false, | |
| 799 | .keyword_nullptr, | |
| 800 | .keyword_elifdef, | |
| 801 | .keyword_elifndef, | |
| 802 | => if (standard.atLeast(.c2x)) kw else .identifier, | |
| 803 | ||
| 804 | .keyword_int64, | |
| 805 | .keyword_int64_2, | |
| 806 | .keyword_int32, | |
| 807 | .keyword_int32_2, | |
| 808 | .keyword_int16, | |
| 809 | .keyword_int16_2, | |
| 810 | .keyword_int8, | |
| 811 | .keyword_int8_2, | |
| 812 | .keyword_stdcall2, | |
| 813 | .keyword_thiscall2, | |
| 814 | .keyword_vectorcall2, | |
| 815 | => if (comp.langopts.ms_extensions) kw else .identifier, | |
| 816 | else => kw, | |
| 817 | }; | |
| 818 | } | |
| 819 | ||
| 820 | /// Check if codepoint may appear in specified context | |
| 821 | /// does not check basic character set chars because the tokenizer handles them separately to keep the common | |
| 822 | /// case on the fast path | |
| 823 | pub fn mayAppearInIdent(comp: *const Compilation, codepoint: u21, where: enum { start, inside }) bool { | |
| 824 | if (codepoint == '$') return comp.langopts.dollars_in_identifiers; | |
| 825 | if (codepoint <= 0x7F) return false; | |
| 826 | return switch (where) { | |
| 827 | .start => if (comp.langopts.standard.atLeast(.c11)) | |
| 828 | CharInfo.isC11IdChar(codepoint) and !CharInfo.isC11DisallowedInitialIdChar(codepoint) | |
| 829 | else | |
| 830 | CharInfo.isC99IdChar(codepoint) and !CharInfo.isC99DisallowedInitialIDChar(codepoint), | |
| 831 | .inside => if (comp.langopts.standard.atLeast(.c11)) | |
| 832 | CharInfo.isC11IdChar(codepoint) | |
| 833 | else | |
| 834 | CharInfo.isC99IdChar(codepoint), | |
| 835 | }; | |
| 836 | } | |
| 837 | ||
| 838 | const all_kws = std.ComptimeStringMap(Id, .{ | |
| 839 | .{ "auto", auto: { | |
| 840 | @setEvalBranchQuota(3000); | |
| 841 | break :auto .keyword_auto; | |
| 842 | } }, | |
| 843 | .{ "break", .keyword_break }, | |
| 844 | .{ "case", .keyword_case }, | |
| 845 | .{ "char", .keyword_char }, | |
| 846 | .{ "const", .keyword_const }, | |
| 847 | .{ "continue", .keyword_continue }, | |
| 848 | .{ "default", .keyword_default }, | |
| 849 | .{ "do", .keyword_do }, | |
| 850 | .{ "double", .keyword_double }, | |
| 851 | .{ "else", .keyword_else }, | |
| 852 | .{ "enum", .keyword_enum }, | |
| 853 | .{ "extern", .keyword_extern }, | |
| 854 | .{ "float", .keyword_float }, | |
| 855 | .{ "for", .keyword_for }, | |
| 856 | .{ "goto", .keyword_goto }, | |
| 857 | .{ "if", .keyword_if }, | |
| 858 | .{ "int", .keyword_int }, | |
| 859 | .{ "long", .keyword_long }, | |
| 860 | .{ "register", .keyword_register }, | |
| 861 | .{ "return", .keyword_return }, | |
| 862 | .{ "short", .keyword_short }, | |
| 863 | .{ "signed", .keyword_signed }, | |
| 864 | .{ "sizeof", .keyword_sizeof }, | |
| 865 | .{ "static", .keyword_static }, | |
| 866 | .{ "struct", .keyword_struct }, | |
| 867 | .{ "switch", .keyword_switch }, | |
| 868 | .{ "typedef", .keyword_typedef }, | |
| 869 | .{ "union", .keyword_union }, | |
| 870 | .{ "unsigned", .keyword_unsigned }, | |
| 871 | .{ "void", .keyword_void }, | |
| 872 | .{ "volatile", .keyword_volatile }, | |
| 873 | .{ "while", .keyword_while }, | |
| 874 | .{ "__typeof__", .keyword_typeof2 }, | |
| 875 | .{ "__typeof", .keyword_typeof1 }, | |
| 876 | ||
| 877 | // ISO C99 | |
| 878 | .{ "_Bool", .keyword_bool }, | |
| 879 | .{ "_Complex", .keyword_complex }, | |
| 880 | .{ "_Imaginary", .keyword_imaginary }, | |
| 881 | .{ "inline", .keyword_inline }, | |
| 882 | .{ "restrict", .keyword_restrict }, | |
| 883 | ||
| 884 | // ISO C11 | |
| 885 | .{ "_Alignas", .keyword_alignas }, | |
| 886 | .{ "_Alignof", .keyword_alignof }, | |
| 887 | .{ "_Atomic", .keyword_atomic }, | |
| 888 | .{ "_Generic", .keyword_generic }, | |
| 889 | .{ "_Noreturn", .keyword_noreturn }, | |
| 890 | .{ "_Static_assert", .keyword_static_assert }, | |
| 891 | .{ "_Thread_local", .keyword_thread_local }, | |
| 892 | ||
| 893 | // ISO C23 | |
| 894 | .{ "_BitInt", .keyword_bit_int }, | |
| 895 | .{ "alignas", .keyword_c23_alignas }, | |
| 896 | .{ "alignof", .keyword_c23_alignof }, | |
| 897 | .{ "bool", .keyword_c23_bool }, | |
| 898 | .{ "static_assert", .keyword_c23_static_assert }, | |
| 899 | .{ "thread_local", .keyword_c23_thread_local }, | |
| 900 | .{ "constexpr", .keyword_constexpr }, | |
| 901 | .{ "true", .keyword_true }, | |
| 902 | .{ "false", .keyword_false }, | |
| 903 | .{ "nullptr", .keyword_nullptr }, | |
| 904 | ||
| 905 | // Preprocessor directives | |
| 906 | .{ "include", .keyword_include }, | |
| 907 | .{ "include_next", .keyword_include_next }, | |
| 908 | .{ "embed", .keyword_embed }, | |
| 909 | .{ "define", .keyword_define }, | |
| 910 | .{ "defined", .keyword_defined }, | |
| 911 | .{ "undef", .keyword_undef }, | |
| 912 | .{ "ifdef", .keyword_ifdef }, | |
| 913 | .{ "ifndef", .keyword_ifndef }, | |
| 914 | .{ "elif", .keyword_elif }, | |
| 915 | .{ "elifdef", .keyword_elifdef }, | |
| 916 | .{ "elifndef", .keyword_elifndef }, | |
| 917 | .{ "endif", .keyword_endif }, | |
| 918 | .{ "error", .keyword_error }, | |
| 919 | .{ "warning", .keyword_warning }, | |
| 920 | .{ "pragma", .keyword_pragma }, | |
| 921 | .{ "line", .keyword_line }, | |
| 922 | .{ "__VA_ARGS__", .keyword_va_args }, | |
| 923 | .{ "__func__", .macro_func }, | |
| 924 | .{ "__FUNCTION__", .macro_function }, | |
| 925 | .{ "__PRETTY_FUNCTION__", .macro_pretty_func }, | |
| 926 | ||
| 927 | // gcc keywords | |
| 928 | .{ "__auto_type", .keyword_auto_type }, | |
| 929 | .{ "__const", .keyword_const1 }, | |
| 930 | .{ "__const__", .keyword_const2 }, | |
| 931 | .{ "__inline", .keyword_inline1 }, | |
| 932 | .{ "__inline__", .keyword_inline2 }, | |
| 933 | .{ "__volatile", .keyword_volatile1 }, | |
| 934 | .{ "__volatile__", .keyword_volatile2 }, | |
| 935 | .{ "__restrict", .keyword_restrict1 }, | |
| 936 | .{ "__restrict__", .keyword_restrict2 }, | |
| 937 | .{ "__alignof", .keyword_alignof1 }, | |
| 938 | .{ "__alignof__", .keyword_alignof2 }, | |
| 939 | .{ "typeof", .keyword_typeof }, | |
| 940 | .{ "__attribute", .keyword_attribute1 }, | |
| 941 | .{ "__attribute__", .keyword_attribute2 }, | |
| 942 | .{ "__extension__", .keyword_extension }, | |
| 943 | .{ "asm", .keyword_asm }, | |
| 944 | .{ "__asm", .keyword_asm1 }, | |
| 945 | .{ "__asm__", .keyword_asm2 }, | |
| 946 | .{ "__float80", .keyword_float80 }, | |
| 947 | .{ "__float128", .keyword_float128 }, | |
| 948 | .{ "__int128", .keyword_int128 }, | |
| 949 | .{ "__imag", .keyword_imag1 }, | |
| 950 | .{ "__imag__", .keyword_imag2 }, | |
| 951 | .{ "__real", .keyword_real1 }, | |
| 952 | .{ "__real__", .keyword_real2 }, | |
| 953 | .{ "_Float16", .keyword_float16 }, | |
| 954 | ||
| 955 | // clang keywords | |
| 956 | .{ "__fp16", .keyword_fp16 }, | |
| 957 | ||
| 958 | // ms keywords | |
| 959 | .{ "__declspec", .keyword_declspec }, | |
| 960 | .{ "__int64", .keyword_int64 }, | |
| 961 | .{ "_int64", .keyword_int64_2 }, | |
| 962 | .{ "__int32", .keyword_int32 }, | |
| 963 | .{ "_int32", .keyword_int32_2 }, | |
| 964 | .{ "__int16", .keyword_int16 }, | |
| 965 | .{ "_int16", .keyword_int16_2 }, | |
| 966 | .{ "__int8", .keyword_int8 }, | |
| 967 | .{ "_int8", .keyword_int8_2 }, | |
| 968 | .{ "__stdcall", .keyword_stdcall }, | |
| 969 | .{ "_stdcall", .keyword_stdcall2 }, | |
| 970 | .{ "__thiscall", .keyword_thiscall }, | |
| 971 | .{ "_thiscall", .keyword_thiscall2 }, | |
| 972 | .{ "__vectorcall", .keyword_vectorcall }, | |
| 973 | .{ "_vectorcall", .keyword_vectorcall2 }, | |
| 974 | ||
| 975 | // builtins that require special parsing | |
| 976 | .{ "__builtin_choose_expr", .builtin_choose_expr }, | |
| 977 | .{ "__builtin_va_arg", .builtin_va_arg }, | |
| 978 | .{ "__builtin_offsetof", .builtin_offsetof }, | |
| 979 | .{ "__builtin_bitoffsetof", .builtin_bitoffsetof }, | |
| 980 | .{ "__builtin_types_compatible_p", .builtin_types_compatible_p }, | |
| 981 | }); | |
| 982 | }; | |
| 983 | ||
| 984 | buf: []const u8, | |
| 985 | index: u32 = 0, | |
| 986 | source: Source.Id, | |
| 987 | comp: *const Compilation, | |
| 988 | line: u32 = 1, | |
| 989 | ||
| 990 | pub fn next(self: *Tokenizer) Token { | |
| 991 | var state: enum { | |
| 992 | start, | |
| 993 | whitespace, | |
| 994 | u, | |
| 995 | u8, | |
| 996 | U, | |
| 997 | L, | |
| 998 | string_literal, | |
| 999 | char_literal_start, | |
| 1000 | char_literal, | |
| 1001 | escape_sequence, | |
| 1002 | octal_escape, | |
| 1003 | hex_escape, | |
| 1004 | unicode_escape, | |
| 1005 | identifier, | |
| 1006 | extended_identifier, | |
| 1007 | equal, | |
| 1008 | bang, | |
| 1009 | pipe, | |
| 1010 | colon, | |
| 1011 | percent, | |
| 1012 | asterisk, | |
| 1013 | plus, | |
| 1014 | angle_bracket_left, | |
| 1015 | angle_bracket_angle_bracket_left, | |
| 1016 | angle_bracket_right, | |
| 1017 | angle_bracket_angle_bracket_right, | |
| 1018 | caret, | |
| 1019 | period, | |
| 1020 | period2, | |
| 1021 | minus, | |
| 1022 | slash, | |
| 1023 | ampersand, | |
| 1024 | hash, | |
| 1025 | hash_digraph, | |
| 1026 | hash_hash_digraph_partial, | |
| 1027 | line_comment, | |
| 1028 | multi_line_comment, | |
| 1029 | multi_line_comment_asterisk, | |
| 1030 | multi_line_comment_done, | |
| 1031 | pp_num, | |
| 1032 | pp_num_exponent, | |
| 1033 | pp_num_digit_separator, | |
| 1034 | } = .start; | |
| 1035 | ||
| 1036 | var start = self.index; | |
| 1037 | var id: Token.Id = .eof; | |
| 1038 | ||
| 1039 | var return_state = state; | |
| 1040 | var counter: u32 = 0; | |
| 1041 | var codepoint_len: u3 = undefined; | |
| 1042 | while (self.index < self.buf.len) : (self.index += codepoint_len) { | |
| 1043 | // Source files get checked for valid utf-8 before being tokenized so it is safe to use | |
| 1044 | // these versions. | |
| 1045 | codepoint_len = unicode.utf8ByteSequenceLength_unsafe(self.buf[self.index]); | |
| 1046 | const c: u21 = switch (codepoint_len) { | |
| 1047 | 1 => @as(u21, self.buf[self.index]), | |
| 1048 | 2 => unicode.utf8Decode2_unsafe(self.buf[self.index..]), | |
| 1049 | 3 => unicode.utf8Decode3_unsafe(self.buf[self.index..]), | |
| 1050 | 4 => unicode.utf8Decode4_unsafe(self.buf[self.index..]), | |
| 1051 | else => unreachable, | |
| 1052 | }; | |
| 1053 | switch (state) { | |
| 1054 | .start => switch (c) { | |
| 1055 | '\n' => { | |
| 1056 | id = .nl; | |
| 1057 | self.index += 1; | |
| 1058 | self.line += 1; | |
| 1059 | break; | |
| 1060 | }, | |
| 1061 | '"' => { | |
| 1062 | id = .string_literal; | |
| 1063 | state = .string_literal; | |
| 1064 | }, | |
| 1065 | '\'' => { | |
| 1066 | id = .char_literal; | |
| 1067 | state = .char_literal_start; | |
| 1068 | }, | |
| 1069 | 'u' => state = .u, | |
| 1070 | 'U' => state = .U, | |
| 1071 | 'L' => state = .L, | |
| 1072 | 'a'...'t', 'v'...'z', 'A'...'K', 'M'...'T', 'V'...'Z', '_' => state = .identifier, | |
| 1073 | '=' => state = .equal, | |
| 1074 | '!' => state = .bang, | |
| 1075 | '|' => state = .pipe, | |
| 1076 | '(' => { | |
| 1077 | id = .l_paren; | |
| 1078 | self.index += 1; | |
| 1079 | break; | |
| 1080 | }, | |
| 1081 | ')' => { | |
| 1082 | id = .r_paren; | |
| 1083 | self.index += 1; | |
| 1084 | break; | |
| 1085 | }, | |
| 1086 | '[' => { | |
| 1087 | id = .l_bracket; | |
| 1088 | self.index += 1; | |
| 1089 | break; | |
| 1090 | }, | |
| 1091 | ']' => { | |
| 1092 | id = .r_bracket; | |
| 1093 | self.index += 1; | |
| 1094 | break; | |
| 1095 | }, | |
| 1096 | ';' => { | |
| 1097 | id = .semicolon; | |
| 1098 | self.index += 1; | |
| 1099 | break; | |
| 1100 | }, | |
| 1101 | ',' => { | |
| 1102 | id = .comma; | |
| 1103 | self.index += 1; | |
| 1104 | break; | |
| 1105 | }, | |
| 1106 | '?' => { | |
| 1107 | id = .question_mark; | |
| 1108 | self.index += 1; | |
| 1109 | break; | |
| 1110 | }, | |
| 1111 | ':' => state = .colon, | |
| 1112 | '%' => state = .percent, | |
| 1113 | '*' => state = .asterisk, | |
| 1114 | '+' => state = .plus, | |
| 1115 | '<' => state = .angle_bracket_left, | |
| 1116 | '>' => state = .angle_bracket_right, | |
| 1117 | '^' => state = .caret, | |
| 1118 | '{' => { | |
| 1119 | id = .l_brace; | |
| 1120 | self.index += 1; | |
| 1121 | break; | |
| 1122 | }, | |
| 1123 | '}' => { | |
| 1124 | id = .r_brace; | |
| 1125 | self.index += 1; | |
| 1126 | break; | |
| 1127 | }, | |
| 1128 | '~' => { | |
| 1129 | id = .tilde; | |
| 1130 | self.index += 1; | |
| 1131 | break; | |
| 1132 | }, | |
| 1133 | '.' => state = .period, | |
| 1134 | '-' => state = .minus, | |
| 1135 | '/' => state = .slash, | |
| 1136 | '&' => state = .ampersand, | |
| 1137 | '#' => state = .hash, | |
| 1138 | '0'...'9' => state = .pp_num, | |
| 1139 | '\t', '\x0B', '\x0C', ' ' => state = .whitespace, | |
| 1140 | else => if (Token.mayAppearInIdent(self.comp, c, .start)) { | |
| 1141 | state = .extended_identifier; | |
| 1142 | } else { | |
| 1143 | id = .invalid; | |
| 1144 | self.index += codepoint_len; | |
| 1145 | break; | |
| 1146 | }, | |
| 1147 | }, | |
| 1148 | .whitespace => switch (c) { | |
| 1149 | '\t', '\x0B', '\x0C', ' ' => {}, | |
| 1150 | else => { | |
| 1151 | id = .whitespace; | |
| 1152 | break; | |
| 1153 | }, | |
| 1154 | }, | |
| 1155 | .u => switch (c) { | |
| 1156 | '8' => { | |
| 1157 | state = .u8; | |
| 1158 | }, | |
| 1159 | '\'' => { | |
| 1160 | id = .char_literal_utf_16; | |
| 1161 | state = .char_literal_start; | |
| 1162 | }, | |
| 1163 | '\"' => { | |
| 1164 | id = .string_literal_utf_16; | |
| 1165 | state = .string_literal; | |
| 1166 | }, | |
| 1167 | else => { | |
| 1168 | codepoint_len = 0; | |
| 1169 | state = .identifier; | |
| 1170 | }, | |
| 1171 | }, | |
| 1172 | .u8 => switch (c) { | |
| 1173 | '\"' => { | |
| 1174 | id = .string_literal_utf_8; | |
| 1175 | state = .string_literal; | |
| 1176 | }, | |
| 1177 | '\'' => { | |
| 1178 | id = .char_literal_utf_8; | |
| 1179 | state = .char_literal_start; | |
| 1180 | }, | |
| 1181 | else => { | |
| 1182 | codepoint_len = 0; | |
| 1183 | state = .identifier; | |
| 1184 | }, | |
| 1185 | }, | |
| 1186 | .U => switch (c) { | |
| 1187 | '\'' => { | |
| 1188 | id = .char_literal_utf_32; | |
| 1189 | state = .char_literal_start; | |
| 1190 | }, | |
| 1191 | '\"' => { | |
| 1192 | id = .string_literal_utf_32; | |
| 1193 | state = .string_literal; | |
| 1194 | }, | |
| 1195 | else => { | |
| 1196 | codepoint_len = 0; | |
| 1197 | state = .identifier; | |
| 1198 | }, | |
| 1199 | }, | |
| 1200 | .L => switch (c) { | |
| 1201 | '\'' => { | |
| 1202 | id = .char_literal_wide; | |
| 1203 | state = .char_literal_start; | |
| 1204 | }, | |
| 1205 | '\"' => { | |
| 1206 | id = .string_literal_wide; | |
| 1207 | state = .string_literal; | |
| 1208 | }, | |
| 1209 | else => { | |
| 1210 | codepoint_len = 0; | |
| 1211 | state = .identifier; | |
| 1212 | }, | |
| 1213 | }, | |
| 1214 | .string_literal => switch (c) { | |
| 1215 | '\\' => { | |
| 1216 | return_state = .string_literal; | |
| 1217 | state = .escape_sequence; | |
| 1218 | }, | |
| 1219 | '"' => { | |
| 1220 | self.index += 1; | |
| 1221 | break; | |
| 1222 | }, | |
| 1223 | '\n' => { | |
| 1224 | id = .invalid; | |
| 1225 | break; | |
| 1226 | }, | |
| 1227 | '\r' => unreachable, | |
| 1228 | else => {}, | |
| 1229 | }, | |
| 1230 | .char_literal_start => switch (c) { | |
| 1231 | '\\' => { | |
| 1232 | return_state = .char_literal; | |
| 1233 | state = .escape_sequence; | |
| 1234 | }, | |
| 1235 | ||
| 1236 | '\'', '\n' => { | |
| 1237 | id = .invalid; | |
| 1238 | break; | |
| 1239 | }, | |
| 1240 | else => { | |
| 1241 | state = .char_literal; | |
| 1242 | }, | |
| 1243 | }, | |
| 1244 | .char_literal => switch (c) { | |
| 1245 | '\\' => { | |
| 1246 | return_state = .char_literal; | |
| 1247 | state = .escape_sequence; | |
| 1248 | }, | |
| 1249 | '\'' => { | |
| 1250 | self.index += 1; | |
| 1251 | break; | |
| 1252 | }, | |
| 1253 | '\n' => { | |
| 1254 | id = .invalid; | |
| 1255 | break; | |
| 1256 | }, | |
| 1257 | else => {}, | |
| 1258 | }, | |
| 1259 | .escape_sequence => switch (c) { | |
| 1260 | '\'', '"', '?', '\\', 'a', 'b', 'e', 'f', 'n', 'r', 't', 'v' => { | |
| 1261 | state = return_state; | |
| 1262 | }, | |
| 1263 | '\n' => { | |
| 1264 | state = return_state; | |
| 1265 | self.line += 1; | |
| 1266 | }, | |
| 1267 | '0'...'7' => { | |
| 1268 | counter = 1; | |
| 1269 | state = .octal_escape; | |
| 1270 | }, | |
| 1271 | 'x' => state = .hex_escape, | |
| 1272 | 'u' => { | |
| 1273 | counter = 4; | |
| 1274 | state = .unicode_escape; | |
| 1275 | }, | |
| 1276 | 'U' => { | |
| 1277 | counter = 8; | |
| 1278 | state = .unicode_escape; | |
| 1279 | }, | |
| 1280 | else => { | |
| 1281 | id = .invalid; | |
| 1282 | break; | |
| 1283 | }, | |
| 1284 | }, | |
| 1285 | .octal_escape => switch (c) { | |
| 1286 | '0'...'7' => { | |
| 1287 | counter += 1; | |
| 1288 | if (counter == 3) state = return_state; | |
| 1289 | }, | |
| 1290 | else => { | |
| 1291 | codepoint_len = 0; | |
| 1292 | state = return_state; | |
| 1293 | }, | |
| 1294 | }, | |
| 1295 | .hex_escape => switch (c) { | |
| 1296 | '0'...'9', 'a'...'f', 'A'...'F' => {}, | |
| 1297 | else => { | |
| 1298 | codepoint_len = 0; | |
| 1299 | state = return_state; | |
| 1300 | }, | |
| 1301 | }, | |
| 1302 | .unicode_escape => switch (c) { | |
| 1303 | '0'...'9', 'a'...'f', 'A'...'F' => { | |
| 1304 | counter -= 1; | |
| 1305 | if (counter == 0) state = return_state; | |
| 1306 | }, | |
| 1307 | else => { | |
| 1308 | id = .invalid; | |
| 1309 | break; | |
| 1310 | }, | |
| 1311 | }, | |
| 1312 | .identifier, .extended_identifier => switch (c) { | |
| 1313 | 'a'...'z', 'A'...'Z', '_', '0'...'9' => {}, | |
| 1314 | else => { | |
| 1315 | if (!Token.mayAppearInIdent(self.comp, c, .inside)) { | |
| 1316 | id = if (state == .identifier) Token.getTokenId(self.comp, self.buf[start..self.index]) else .extended_identifier; | |
| 1317 | break; | |
| 1318 | } | |
| 1319 | state = .extended_identifier; | |
| 1320 | }, | |
| 1321 | }, | |
| 1322 | .equal => switch (c) { | |
| 1323 | '=' => { | |
| 1324 | id = .equal_equal; | |
| 1325 | self.index += 1; | |
| 1326 | break; | |
| 1327 | }, | |
| 1328 | else => { | |
| 1329 | id = .equal; | |
| 1330 | break; | |
| 1331 | }, | |
| 1332 | }, | |
| 1333 | .bang => switch (c) { | |
| 1334 | '=' => { | |
| 1335 | id = .bang_equal; | |
| 1336 | self.index += 1; | |
| 1337 | break; | |
| 1338 | }, | |
| 1339 | else => { | |
| 1340 | id = .bang; | |
| 1341 | break; | |
| 1342 | }, | |
| 1343 | }, | |
| 1344 | .pipe => switch (c) { | |
| 1345 | '=' => { | |
| 1346 | id = .pipe_equal; | |
| 1347 | self.index += 1; | |
| 1348 | break; | |
| 1349 | }, | |
| 1350 | '|' => { | |
| 1351 | id = .pipe_pipe; | |
| 1352 | self.index += 1; | |
| 1353 | break; | |
| 1354 | }, | |
| 1355 | else => { | |
| 1356 | id = .pipe; | |
| 1357 | break; | |
| 1358 | }, | |
| 1359 | }, | |
| 1360 | .colon => switch (c) { | |
| 1361 | '>' => { | |
| 1362 | if (self.comp.langopts.hasDigraphs()) { | |
| 1363 | id = .r_bracket; | |
| 1364 | self.index += 1; | |
| 1365 | } else { | |
| 1366 | id = .colon; | |
| 1367 | } | |
| 1368 | break; | |
| 1369 | }, | |
| 1370 | ':' => { | |
| 1371 | if (self.comp.langopts.standard.atLeast(.c2x)) { | |
| 1372 | id = .colon_colon; | |
| 1373 | self.index += 1; | |
| 1374 | break; | |
| 1375 | } else { | |
| 1376 | id = .colon; | |
| 1377 | break; | |
| 1378 | } | |
| 1379 | }, | |
| 1380 | else => { | |
| 1381 | id = .colon; | |
| 1382 | break; | |
| 1383 | }, | |
| 1384 | }, | |
| 1385 | .percent => switch (c) { | |
| 1386 | '=' => { | |
| 1387 | id = .percent_equal; | |
| 1388 | self.index += 1; | |
| 1389 | break; | |
| 1390 | }, | |
| 1391 | '>' => { | |
| 1392 | if (self.comp.langopts.hasDigraphs()) { | |
| 1393 | id = .r_brace; | |
| 1394 | self.index += 1; | |
| 1395 | } else { | |
| 1396 | id = .percent; | |
| 1397 | } | |
| 1398 | break; | |
| 1399 | }, | |
| 1400 | ':' => { | |
| 1401 | if (self.comp.langopts.hasDigraphs()) { | |
| 1402 | state = .hash_digraph; | |
| 1403 | } else { | |
| 1404 | id = .percent; | |
| 1405 | break; | |
| 1406 | } | |
| 1407 | }, | |
| 1408 | else => { | |
| 1409 | id = .percent; | |
| 1410 | break; | |
| 1411 | }, | |
| 1412 | }, | |
| 1413 | .asterisk => switch (c) { | |
| 1414 | '=' => { | |
| 1415 | id = .asterisk_equal; | |
| 1416 | self.index += 1; | |
| 1417 | break; | |
| 1418 | }, | |
| 1419 | else => { | |
| 1420 | id = .asterisk; | |
| 1421 | break; | |
| 1422 | }, | |
| 1423 | }, | |
| 1424 | .plus => switch (c) { | |
| 1425 | '=' => { | |
| 1426 | id = .plus_equal; | |
| 1427 | self.index += 1; | |
| 1428 | break; | |
| 1429 | }, | |
| 1430 | '+' => { | |
| 1431 | id = .plus_plus; | |
| 1432 | self.index += 1; | |
| 1433 | break; | |
| 1434 | }, | |
| 1435 | else => { | |
| 1436 | id = .plus; | |
| 1437 | break; | |
| 1438 | }, | |
| 1439 | }, | |
| 1440 | .angle_bracket_left => switch (c) { | |
| 1441 | '<' => state = .angle_bracket_angle_bracket_left, | |
| 1442 | '=' => { | |
| 1443 | id = .angle_bracket_left_equal; | |
| 1444 | self.index += 1; | |
| 1445 | break; | |
| 1446 | }, | |
| 1447 | ':' => { | |
| 1448 | if (self.comp.langopts.hasDigraphs()) { | |
| 1449 | id = .l_bracket; | |
| 1450 | self.index += 1; | |
| 1451 | } else { | |
| 1452 | id = .angle_bracket_left; | |
| 1453 | } | |
| 1454 | break; | |
| 1455 | }, | |
| 1456 | '%' => { | |
| 1457 | if (self.comp.langopts.hasDigraphs()) { | |
| 1458 | id = .l_brace; | |
| 1459 | self.index += 1; | |
| 1460 | } else { | |
| 1461 | id = .angle_bracket_left; | |
| 1462 | } | |
| 1463 | break; | |
| 1464 | }, | |
| 1465 | else => { | |
| 1466 | id = .angle_bracket_left; | |
| 1467 | break; | |
| 1468 | }, | |
| 1469 | }, | |
| 1470 | .angle_bracket_angle_bracket_left => switch (c) { | |
| 1471 | '=' => { | |
| 1472 | id = .angle_bracket_angle_bracket_left_equal; | |
| 1473 | self.index += 1; | |
| 1474 | break; | |
| 1475 | }, | |
| 1476 | else => { | |
| 1477 | id = .angle_bracket_angle_bracket_left; | |
| 1478 | break; | |
| 1479 | }, | |
| 1480 | }, | |
| 1481 | .angle_bracket_right => switch (c) { | |
| 1482 | '>' => state = .angle_bracket_angle_bracket_right, | |
| 1483 | '=' => { | |
| 1484 | id = .angle_bracket_right_equal; | |
| 1485 | self.index += 1; | |
| 1486 | break; | |
| 1487 | }, | |
| 1488 | else => { | |
| 1489 | id = .angle_bracket_right; | |
| 1490 | break; | |
| 1491 | }, | |
| 1492 | }, | |
| 1493 | .angle_bracket_angle_bracket_right => switch (c) { | |
| 1494 | '=' => { | |
| 1495 | id = .angle_bracket_angle_bracket_right_equal; | |
| 1496 | self.index += 1; | |
| 1497 | break; | |
| 1498 | }, | |
| 1499 | else => { | |
| 1500 | id = .angle_bracket_angle_bracket_right; | |
| 1501 | break; | |
| 1502 | }, | |
| 1503 | }, | |
| 1504 | .caret => switch (c) { | |
| 1505 | '=' => { | |
| 1506 | id = .caret_equal; | |
| 1507 | self.index += 1; | |
| 1508 | break; | |
| 1509 | }, | |
| 1510 | else => { | |
| 1511 | id = .caret; | |
| 1512 | break; | |
| 1513 | }, | |
| 1514 | }, | |
| 1515 | .period => switch (c) { | |
| 1516 | '.' => state = .period2, | |
| 1517 | '0'...'9' => state = .pp_num, | |
| 1518 | else => { | |
| 1519 | id = .period; | |
| 1520 | break; | |
| 1521 | }, | |
| 1522 | }, | |
| 1523 | .period2 => switch (c) { | |
| 1524 | '.' => { | |
| 1525 | id = .ellipsis; | |
| 1526 | self.index += 1; | |
| 1527 | break; | |
| 1528 | }, | |
| 1529 | else => { | |
| 1530 | id = .period; | |
| 1531 | self.index -= 1; | |
| 1532 | break; | |
| 1533 | }, | |
| 1534 | }, | |
| 1535 | .minus => switch (c) { | |
| 1536 | '>' => { | |
| 1537 | id = .arrow; | |
| 1538 | self.index += 1; | |
| 1539 | break; | |
| 1540 | }, | |
| 1541 | '=' => { | |
| 1542 | id = .minus_equal; | |
| 1543 | self.index += 1; | |
| 1544 | break; | |
| 1545 | }, | |
| 1546 | '-' => { | |
| 1547 | id = .minus_minus; | |
| 1548 | self.index += 1; | |
| 1549 | break; | |
| 1550 | }, | |
| 1551 | else => { | |
| 1552 | id = .minus; | |
| 1553 | break; | |
| 1554 | }, | |
| 1555 | }, | |
| 1556 | .ampersand => switch (c) { | |
| 1557 | '&' => { | |
| 1558 | id = .ampersand_ampersand; | |
| 1559 | self.index += 1; | |
| 1560 | break; | |
| 1561 | }, | |
| 1562 | '=' => { | |
| 1563 | id = .ampersand_equal; | |
| 1564 | self.index += 1; | |
| 1565 | break; | |
| 1566 | }, | |
| 1567 | else => { | |
| 1568 | id = .ampersand; | |
| 1569 | break; | |
| 1570 | }, | |
| 1571 | }, | |
| 1572 | .hash => switch (c) { | |
| 1573 | '#' => { | |
| 1574 | id = .hash_hash; | |
| 1575 | self.index += 1; | |
| 1576 | break; | |
| 1577 | }, | |
| 1578 | else => { | |
| 1579 | id = .hash; | |
| 1580 | break; | |
| 1581 | }, | |
| 1582 | }, | |
| 1583 | .hash_digraph => switch (c) { | |
| 1584 | '%' => state = .hash_hash_digraph_partial, | |
| 1585 | else => { | |
| 1586 | id = .hash; | |
| 1587 | break; | |
| 1588 | }, | |
| 1589 | }, | |
| 1590 | .hash_hash_digraph_partial => switch (c) { | |
| 1591 | ':' => { | |
| 1592 | id = .hash_hash; | |
| 1593 | self.index += 1; | |
| 1594 | break; | |
| 1595 | }, | |
| 1596 | else => { | |
| 1597 | id = .hash; | |
| 1598 | self.index -= 1; // re-tokenize the percent | |
| 1599 | break; | |
| 1600 | }, | |
| 1601 | }, | |
| 1602 | .slash => switch (c) { | |
| 1603 | '/' => state = .line_comment, | |
| 1604 | '*' => state = .multi_line_comment, | |
| 1605 | '=' => { | |
| 1606 | id = .slash_equal; | |
| 1607 | self.index += 1; | |
| 1608 | break; | |
| 1609 | }, | |
| 1610 | else => { | |
| 1611 | id = .slash; | |
| 1612 | break; | |
| 1613 | }, | |
| 1614 | }, | |
| 1615 | .line_comment => switch (c) { | |
| 1616 | '\n' => { | |
| 1617 | self.index -= 1; | |
| 1618 | state = .start; | |
| 1619 | }, | |
| 1620 | else => {}, | |
| 1621 | }, | |
| 1622 | .multi_line_comment => switch (c) { | |
| 1623 | '*' => state = .multi_line_comment_asterisk, | |
| 1624 | '\n' => self.line += 1, | |
| 1625 | else => {}, | |
| 1626 | }, | |
| 1627 | .multi_line_comment_asterisk => switch (c) { | |
| 1628 | '/' => state = .multi_line_comment_done, | |
| 1629 | '\n' => { | |
| 1630 | self.line += 1; | |
| 1631 | state = .multi_line_comment; | |
| 1632 | }, | |
| 1633 | '*' => {}, | |
| 1634 | else => state = .multi_line_comment, | |
| 1635 | }, | |
| 1636 | .multi_line_comment_done => switch (c) { | |
| 1637 | '\n' => { | |
| 1638 | start = self.index; | |
| 1639 | id = .nl; | |
| 1640 | self.index += 1; | |
| 1641 | self.line += 1; | |
| 1642 | break; | |
| 1643 | }, | |
| 1644 | '\r' => unreachable, | |
| 1645 | '\t', '\x0B', '\x0C', ' ' => { | |
| 1646 | start = self.index; | |
| 1647 | state = .whitespace; | |
| 1648 | }, | |
| 1649 | else => { | |
| 1650 | id = .whitespace; | |
| 1651 | break; | |
| 1652 | }, | |
| 1653 | }, | |
| 1654 | .pp_num => switch (c) { | |
| 1655 | 'a'...'d', | |
| 1656 | 'A'...'D', | |
| 1657 | 'f'...'o', | |
| 1658 | 'F'...'O', | |
| 1659 | 'q'...'z', | |
| 1660 | 'Q'...'Z', | |
| 1661 | '0'...'9', | |
| 1662 | '_', | |
| 1663 | '.', | |
| 1664 | => {}, | |
| 1665 | 'e', 'E', 'p', 'P' => state = .pp_num_exponent, | |
| 1666 | '\'' => if (self.comp.langopts.standard.atLeast(.c2x)) { | |
| 1667 | state = .pp_num_digit_separator; | |
| 1668 | } else { | |
| 1669 | id = .pp_num; | |
| 1670 | break; | |
| 1671 | }, | |
| 1672 | else => { | |
| 1673 | id = .pp_num; | |
| 1674 | break; | |
| 1675 | }, | |
| 1676 | }, | |
| 1677 | .pp_num_digit_separator => switch (c) { | |
| 1678 | 'a'...'d', | |
| 1679 | 'A'...'D', | |
| 1680 | 'f'...'o', | |
| 1681 | 'F'...'O', | |
| 1682 | 'q'...'z', | |
| 1683 | 'Q'...'Z', | |
| 1684 | '0'...'9', | |
| 1685 | '_', | |
| 1686 | => state = .pp_num, | |
| 1687 | else => { | |
| 1688 | self.index -= 1; | |
| 1689 | id = .pp_num; | |
| 1690 | break; | |
| 1691 | }, | |
| 1692 | }, | |
| 1693 | .pp_num_exponent => switch (c) { | |
| 1694 | 'a'...'z', | |
| 1695 | 'A'...'Z', | |
| 1696 | '0'...'9', | |
| 1697 | '_', | |
| 1698 | '.', | |
| 1699 | '+', | |
| 1700 | '-', | |
| 1701 | => state = .pp_num, | |
| 1702 | else => { | |
| 1703 | id = .pp_num; | |
| 1704 | break; | |
| 1705 | }, | |
| 1706 | }, | |
| 1707 | } | |
| 1708 | } else if (self.index == self.buf.len) { | |
| 1709 | switch (state) { | |
| 1710 | .start, .line_comment => {}, | |
| 1711 | .u, .u8, .U, .L, .identifier => id = Token.getTokenId(self.comp, self.buf[start..self.index]), | |
| 1712 | .extended_identifier => id = .extended_identifier, | |
| 1713 | .period2, | |
| 1714 | .string_literal, | |
| 1715 | .char_literal_start, | |
| 1716 | .char_literal, | |
| 1717 | .escape_sequence, | |
| 1718 | .octal_escape, | |
| 1719 | .hex_escape, | |
| 1720 | .unicode_escape, | |
| 1721 | .multi_line_comment, | |
| 1722 | .multi_line_comment_asterisk, | |
| 1723 | => id = .invalid, | |
| 1724 | ||
| 1725 | .whitespace => id = .whitespace, | |
| 1726 | .multi_line_comment_done => id = .whitespace, | |
| 1727 | ||
| 1728 | .equal => id = .equal, | |
| 1729 | .bang => id = .bang, | |
| 1730 | .minus => id = .minus, | |
| 1731 | .slash => id = .slash, | |
| 1732 | .ampersand => id = .ampersand, | |
| 1733 | .hash => id = .hash, | |
| 1734 | .period => id = .period, | |
| 1735 | .pipe => id = .pipe, | |
| 1736 | .angle_bracket_angle_bracket_right => id = .angle_bracket_angle_bracket_right, | |
| 1737 | .angle_bracket_right => id = .angle_bracket_right, | |
| 1738 | .angle_bracket_angle_bracket_left => id = .angle_bracket_angle_bracket_left, | |
| 1739 | .angle_bracket_left => id = .angle_bracket_left, | |
| 1740 | .plus => id = .plus, | |
| 1741 | .colon => id = .colon, | |
| 1742 | .percent => id = .percent, | |
| 1743 | .caret => id = .caret, | |
| 1744 | .asterisk => id = .asterisk, | |
| 1745 | .hash_digraph => id = .hash, | |
| 1746 | .hash_hash_digraph_partial => { | |
| 1747 | id = .hash; | |
| 1748 | self.index -= 1; // re-tokenize the percent | |
| 1749 | }, | |
| 1750 | .pp_num, .pp_num_exponent, .pp_num_digit_separator => id = .pp_num, | |
| 1751 | } | |
| 1752 | } | |
| 1753 | ||
| 1754 | return .{ | |
| 1755 | .id = id, | |
| 1756 | .start = start, | |
| 1757 | .end = self.index, | |
| 1758 | .line = self.line, | |
| 1759 | .source = self.source, | |
| 1760 | }; | |
| 1761 | } | |
| 1762 | ||
| 1763 | pub fn nextNoWS(self: *Tokenizer) Token { | |
| 1764 | var tok = self.next(); | |
| 1765 | while (tok.id == .whitespace) tok = self.next(); | |
| 1766 | return tok; | |
| 1767 | } | |
| 1768 | ||
| 1769 | test "operators" { | |
| 1770 | try expectTokens( | |
| 1771 | \\ ! != | || |= = == | |
| 1772 | \\ ( ) { } [ ] . .. ... | |
| 1773 | \\ ^ ^= + ++ += - -- -= | |
| 1774 | \\ * *= % %= -> : ; / /= | |
| 1775 | \\ , & && &= ? < <= << | |
| 1776 | \\ <<= > >= >> >>= ~ # ## | |
| 1777 | \\ | |
| 1778 | , &.{ | |
| 1779 | .bang, | |
| 1780 | .bang_equal, | |
| 1781 | .pipe, | |
| 1782 | .pipe_pipe, | |
| 1783 | .pipe_equal, | |
| 1784 | .equal, | |
| 1785 | .equal_equal, | |
| 1786 | .nl, | |
| 1787 | .l_paren, | |
| 1788 | .r_paren, | |
| 1789 | .l_brace, | |
| 1790 | .r_brace, | |
| 1791 | .l_bracket, | |
| 1792 | .r_bracket, | |
| 1793 | .period, | |
| 1794 | .period, | |
| 1795 | .period, | |
| 1796 | .ellipsis, | |
| 1797 | .nl, | |
| 1798 | .caret, | |
| 1799 | .caret_equal, | |
| 1800 | .plus, | |
| 1801 | .plus_plus, | |
| 1802 | .plus_equal, | |
| 1803 | .minus, | |
| 1804 | .minus_minus, | |
| 1805 | .minus_equal, | |
| 1806 | .nl, | |
| 1807 | .asterisk, | |
| 1808 | .asterisk_equal, | |
| 1809 | .percent, | |
| 1810 | .percent_equal, | |
| 1811 | .arrow, | |
| 1812 | .colon, | |
| 1813 | .semicolon, | |
| 1814 | .slash, | |
| 1815 | .slash_equal, | |
| 1816 | .nl, | |
| 1817 | .comma, | |
| 1818 | .ampersand, | |
| 1819 | .ampersand_ampersand, | |
| 1820 | .ampersand_equal, | |
| 1821 | .question_mark, | |
| 1822 | .angle_bracket_left, | |
| 1823 | .angle_bracket_left_equal, | |
| 1824 | .angle_bracket_angle_bracket_left, | |
| 1825 | .nl, | |
| 1826 | .angle_bracket_angle_bracket_left_equal, | |
| 1827 | .angle_bracket_right, | |
| 1828 | .angle_bracket_right_equal, | |
| 1829 | .angle_bracket_angle_bracket_right, | |
| 1830 | .angle_bracket_angle_bracket_right_equal, | |
| 1831 | .tilde, | |
| 1832 | .hash, | |
| 1833 | .hash_hash, | |
| 1834 | .nl, | |
| 1835 | }); | |
| 1836 | } | |
| 1837 | ||
| 1838 | test "keywords" { | |
| 1839 | try expectTokens( | |
| 1840 | \\auto __auto_type break case char const continue default do | |
| 1841 | \\double else enum extern float for goto if int | |
| 1842 | \\long register return short signed sizeof static | |
| 1843 | \\struct switch typedef union unsigned void volatile | |
| 1844 | \\while _Bool _Complex _Imaginary inline restrict _Alignas | |
| 1845 | \\_Alignof _Atomic _Generic _Noreturn _Static_assert _Thread_local | |
| 1846 | \\__attribute __attribute__ | |
| 1847 | \\ | |
| 1848 | , &.{ | |
| 1849 | .keyword_auto, | |
| 1850 | .keyword_auto_type, | |
| 1851 | .keyword_break, | |
| 1852 | .keyword_case, | |
| 1853 | .keyword_char, | |
| 1854 | .keyword_const, | |
| 1855 | .keyword_continue, | |
| 1856 | .keyword_default, | |
| 1857 | .keyword_do, | |
| 1858 | .nl, | |
| 1859 | .keyword_double, | |
| 1860 | .keyword_else, | |
| 1861 | .keyword_enum, | |
| 1862 | .keyword_extern, | |
| 1863 | .keyword_float, | |
| 1864 | .keyword_for, | |
| 1865 | .keyword_goto, | |
| 1866 | .keyword_if, | |
| 1867 | .keyword_int, | |
| 1868 | .nl, | |
| 1869 | .keyword_long, | |
| 1870 | .keyword_register, | |
| 1871 | .keyword_return, | |
| 1872 | .keyword_short, | |
| 1873 | .keyword_signed, | |
| 1874 | .keyword_sizeof, | |
| 1875 | .keyword_static, | |
| 1876 | .nl, | |
| 1877 | .keyword_struct, | |
| 1878 | .keyword_switch, | |
| 1879 | .keyword_typedef, | |
| 1880 | .keyword_union, | |
| 1881 | .keyword_unsigned, | |
| 1882 | .keyword_void, | |
| 1883 | .keyword_volatile, | |
| 1884 | .nl, | |
| 1885 | .keyword_while, | |
| 1886 | .keyword_bool, | |
| 1887 | .keyword_complex, | |
| 1888 | .keyword_imaginary, | |
| 1889 | .keyword_inline, | |
| 1890 | .keyword_restrict, | |
| 1891 | .keyword_alignas, | |
| 1892 | .nl, | |
| 1893 | .keyword_alignof, | |
| 1894 | .keyword_atomic, | |
| 1895 | .keyword_generic, | |
| 1896 | .keyword_noreturn, | |
| 1897 | .keyword_static_assert, | |
| 1898 | .keyword_thread_local, | |
| 1899 | .nl, | |
| 1900 | .keyword_attribute1, | |
| 1901 | .keyword_attribute2, | |
| 1902 | .nl, | |
| 1903 | }); | |
| 1904 | } | |
| 1905 | ||
| 1906 | test "preprocessor keywords" { | |
| 1907 | try expectTokens( | |
| 1908 | \\#include | |
| 1909 | \\#include_next | |
| 1910 | \\#embed | |
| 1911 | \\#define | |
| 1912 | \\#ifdef | |
| 1913 | \\#ifndef | |
| 1914 | \\#error | |
| 1915 | \\#pragma | |
| 1916 | \\ | |
| 1917 | , &.{ | |
| 1918 | .hash, | |
| 1919 | .keyword_include, | |
| 1920 | .nl, | |
| 1921 | .hash, | |
| 1922 | .keyword_include_next, | |
| 1923 | .nl, | |
| 1924 | .hash, | |
| 1925 | .keyword_embed, | |
| 1926 | .nl, | |
| 1927 | .hash, | |
| 1928 | .keyword_define, | |
| 1929 | .nl, | |
| 1930 | .hash, | |
| 1931 | .keyword_ifdef, | |
| 1932 | .nl, | |
| 1933 | .hash, | |
| 1934 | .keyword_ifndef, | |
| 1935 | .nl, | |
| 1936 | .hash, | |
| 1937 | .keyword_error, | |
| 1938 | .nl, | |
| 1939 | .hash, | |
| 1940 | .keyword_pragma, | |
| 1941 | .nl, | |
| 1942 | }); | |
| 1943 | } | |
| 1944 | ||
| 1945 | test "line continuation" { | |
| 1946 | try expectTokens( | |
| 1947 | \\#define foo \ | |
| 1948 | \\ bar | |
| 1949 | \\"foo\ | |
| 1950 | \\ bar" | |
| 1951 | \\#define "foo" | |
| 1952 | \\ "bar" | |
| 1953 | \\#define "foo" \ | |
| 1954 | \\ "bar" | |
| 1955 | , &.{ | |
| 1956 | .hash, | |
| 1957 | .keyword_define, | |
| 1958 | .identifier, | |
| 1959 | .identifier, | |
| 1960 | .nl, | |
| 1961 | .string_literal, | |
| 1962 | .nl, | |
| 1963 | .hash, | |
| 1964 | .keyword_define, | |
| 1965 | .string_literal, | |
| 1966 | .nl, | |
| 1967 | .string_literal, | |
| 1968 | .nl, | |
| 1969 | .hash, | |
| 1970 | .keyword_define, | |
| 1971 | .string_literal, | |
| 1972 | .string_literal, | |
| 1973 | }); | |
| 1974 | } | |
| 1975 | ||
| 1976 | test "string prefix" { | |
| 1977 | try expectTokens( | |
| 1978 | \\"foo" | |
| 1979 | \\u"foo" | |
| 1980 | \\u8"foo" | |
| 1981 | \\U"foo" | |
| 1982 | \\L"foo" | |
| 1983 | \\'foo' | |
| 1984 | \\u8'A' | |
| 1985 | \\u'foo' | |
| 1986 | \\U'foo' | |
| 1987 | \\L'foo' | |
| 1988 | \\ | |
| 1989 | , &.{ | |
| 1990 | .string_literal, | |
| 1991 | .nl, | |
| 1992 | .string_literal_utf_16, | |
| 1993 | .nl, | |
| 1994 | .string_literal_utf_8, | |
| 1995 | .nl, | |
| 1996 | .string_literal_utf_32, | |
| 1997 | .nl, | |
| 1998 | .string_literal_wide, | |
| 1999 | .nl, | |
| 2000 | .char_literal, | |
| 2001 | .nl, | |
| 2002 | .char_literal_utf_8, | |
| 2003 | .nl, | |
| 2004 | .char_literal_utf_16, | |
| 2005 | .nl, | |
| 2006 | .char_literal_utf_32, | |
| 2007 | .nl, | |
| 2008 | .char_literal_wide, | |
| 2009 | .nl, | |
| 2010 | }); | |
| 2011 | } | |
| 2012 | ||
| 2013 | test "num suffixes" { | |
| 2014 | try expectTokens( | |
| 2015 | \\ 1.0f 1.0L 1.0 .0 1. 0x1p0f 0X1p0 | |
| 2016 | \\ 0l 0lu 0ll 0llu 0 | |
| 2017 | \\ 1u 1ul 1ull 1 | |
| 2018 | \\ 1.0i 1.0I | |
| 2019 | \\ 1.0if 1.0If 1.0fi 1.0fI | |
| 2020 | \\ 1.0il 1.0Il 1.0li 1.0lI | |
| 2021 | \\ | |
| 2022 | , &.{ | |
| 2023 | .pp_num, | |
| 2024 | .pp_num, | |
| 2025 | .pp_num, | |
| 2026 | .pp_num, | |
| 2027 | .pp_num, | |
| 2028 | .pp_num, | |
| 2029 | .pp_num, | |
| 2030 | .nl, | |
| 2031 | .pp_num, | |
| 2032 | .pp_num, | |
| 2033 | .pp_num, | |
| 2034 | .pp_num, | |
| 2035 | .pp_num, | |
| 2036 | .nl, | |
| 2037 | .pp_num, | |
| 2038 | .pp_num, | |
| 2039 | .pp_num, | |
| 2040 | .pp_num, | |
| 2041 | .nl, | |
| 2042 | .pp_num, | |
| 2043 | .pp_num, | |
| 2044 | .nl, | |
| 2045 | .pp_num, | |
| 2046 | .pp_num, | |
| 2047 | .pp_num, | |
| 2048 | .pp_num, | |
| 2049 | .nl, | |
| 2050 | .pp_num, | |
| 2051 | .pp_num, | |
| 2052 | .pp_num, | |
| 2053 | .pp_num, | |
| 2054 | .nl, | |
| 2055 | }); | |
| 2056 | } | |
| 2057 | ||
| 2058 | test "comments" { | |
| 2059 | try expectTokens( | |
| 2060 | \\//foo | |
| 2061 | \\#foo | |
| 2062 | , &.{ | |
| 2063 | .nl, | |
| 2064 | .hash, | |
| 2065 | .identifier, | |
| 2066 | }); | |
| 2067 | } | |
| 2068 | ||
| 2069 | test "extended identifiers" { | |
| 2070 | try expectTokens("𝓪𝓻𝓸𝓬𝓬", &.{.extended_identifier}); | |
| 2071 | try expectTokens("u𝓪𝓻𝓸𝓬𝓬", &.{.extended_identifier}); | |
| 2072 | try expectTokens("u8𝓪𝓻𝓸𝓬𝓬", &.{.extended_identifier}); | |
| 2073 | try expectTokens("U𝓪𝓻𝓸𝓬𝓬", &.{.extended_identifier}); | |
| 2074 | try expectTokens("L𝓪𝓻𝓸𝓬𝓬", &.{.extended_identifier}); | |
| 2075 | try expectTokens("1™", &.{ .pp_num, .extended_identifier }); | |
| 2076 | try expectTokens("1.™", &.{ .pp_num, .extended_identifier }); | |
| 2077 | try expectTokens("..™", &.{ .period, .period, .extended_identifier }); | |
| 2078 | try expectTokens("0™", &.{ .pp_num, .extended_identifier }); | |
| 2079 | try expectTokens("0b\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2080 | try expectTokens("0b0\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2081 | try expectTokens("01\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2082 | try expectTokens("010\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2083 | try expectTokens("0x\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2084 | try expectTokens("0x0\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2085 | try expectTokens("\"\\0\u{E0000}\"", &.{.string_literal}); | |
| 2086 | try expectTokens("\"\\x\u{E0000}\"", &.{.string_literal}); | |
| 2087 | try expectTokens("\"\\u\u{E0000}\"", &.{ .invalid, .extended_identifier, .invalid }); | |
| 2088 | try expectTokens("1e\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2089 | try expectTokens("1e1\u{E0000}", &.{ .pp_num, .extended_identifier }); | |
| 2090 | } | |
| 2091 | ||
| 2092 | test "digraphs" { | |
| 2093 | try expectTokens("%:<::><%%>%:%:", &.{ .hash, .l_bracket, .r_bracket, .l_brace, .r_brace, .hash_hash }); | |
| 2094 | try expectTokens("\"%:<::><%%>%:%:\"", &.{.string_literal}); | |
| 2095 | try expectTokens("%:%42 %:%", &.{ .hash, .percent, .pp_num, .hash, .percent }); | |
| 2096 | } | |
| 2097 | ||
| 2098 | test "C23 keywords" { | |
| 2099 | try expectTokensExtra("true false alignas alignof bool static_assert thread_local nullptr", &.{ | |
| 2100 | .keyword_true, | |
| 2101 | .keyword_false, | |
| 2102 | .keyword_c23_alignas, | |
| 2103 | .keyword_c23_alignof, | |
| 2104 | .keyword_c23_bool, | |
| 2105 | .keyword_c23_static_assert, | |
| 2106 | .keyword_c23_thread_local, | |
| 2107 | .keyword_nullptr, | |
| 2108 | }, .c2x); | |
| 2109 | } | |
| 2110 | ||
| 2111 | fn expectTokensExtra(contents: []const u8, expected_tokens: []const Token.Id, standard: ?LangOpts.Standard) !void { | |
| 2112 | var comp = Compilation.init(std.testing.allocator); | |
| 2113 | defer comp.deinit(); | |
| 2114 | if (standard) |provided| { | |
| 2115 | comp.langopts.standard = provided; | |
| 2116 | } | |
| 2117 | const source = try comp.addSourceFromBuffer("path", contents); | |
| 2118 | var tokenizer = Tokenizer{ | |
| 2119 | .buf = source.buf, | |
| 2120 | .source = source.id, | |
| 2121 | .comp = &comp, | |
| 2122 | }; | |
| 2123 | var i: usize = 0; | |
| 2124 | while (i < expected_tokens.len) { | |
| 2125 | const token = tokenizer.next(); | |
| 2126 | if (token.id == .whitespace) continue; | |
| 2127 | const expected_token_id = expected_tokens[i]; | |
| 2128 | i += 1; | |
| 2129 | if (!std.meta.eql(token.id, expected_token_id)) { | |
| 2130 | std.debug.print("expected {s}, found {s}\n", .{ @tagName(expected_token_id), @tagName(token.id) }); | |
| 2131 | return error.TokensDoNotEqual; | |
| 2132 | } | |
| 2133 | } | |
| 2134 | const last_token = tokenizer.next(); | |
| 2135 | try std.testing.expect(last_token.id == .eof); | |
| 2136 | } | |
| 2137 | ||
| 2138 | fn expectTokens(contents: []const u8, expected_tokens: []const Token.Id) !void { | |
| 2139 | return expectTokensExtra(contents, expected_tokens, null); | |
| 2140 | } |
deps/aro/Toolchain.zig created+493| ... | ... | @@ -0,0 +1,493 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Driver = @import("Driver.zig"); | |
| 3 | const Compilation = @import("Compilation.zig"); | |
| 4 | const util = @import("util.zig"); | |
| 5 | const mem = std.mem; | |
| 6 | const system_defaults = @import("system_defaults"); | |
| 7 | const target_util = @import("target.zig"); | |
| 8 | const Linux = @import("toolchains/Linux.zig"); | |
| 9 | const Multilib = @import("Driver/Multilib.zig"); | |
| 10 | const Filesystem = @import("Driver/Filesystem.zig").Filesystem; | |
| 11 | ||
| 12 | const Toolchain = @This(); | |
| 13 | ||
| 14 | pub const PathList = std.ArrayListUnmanaged([]const u8); | |
| 15 | ||
| 16 | pub const RuntimeLibKind = enum { | |
| 17 | compiler_rt, | |
| 18 | libgcc, | |
| 19 | }; | |
| 20 | ||
| 21 | pub const FileKind = enum { | |
| 22 | object, | |
| 23 | static, | |
| 24 | shared, | |
| 25 | }; | |
| 26 | ||
| 27 | pub const LibGCCKind = enum { | |
| 28 | unspecified, | |
| 29 | static, | |
| 30 | shared, | |
| 31 | }; | |
| 32 | ||
| 33 | pub const UnwindLibKind = enum { | |
| 34 | none, | |
| 35 | compiler_rt, | |
| 36 | libgcc, | |
| 37 | }; | |
| 38 | ||
| 39 | const Inner = union(enum) { | |
| 40 | uninitialized, | |
| 41 | linux: Linux, | |
| 42 | unknown: void, | |
| 43 | ||
| 44 | fn deinit(self: *Inner, allocator: mem.Allocator) void { | |
| 45 | switch (self.*) { | |
| 46 | .linux => |*linux| linux.deinit(allocator), | |
| 47 | .uninitialized, .unknown => {}, | |
| 48 | } | |
| 49 | } | |
| 50 | }; | |
| 51 | ||
| 52 | filesystem: Filesystem = .{ .real = {} }, | |
| 53 | driver: *Driver, | |
| 54 | arena: mem.Allocator, | |
| 55 | ||
| 56 | /// The list of toolchain specific path prefixes to search for libraries. | |
| 57 | library_paths: PathList = .{}, | |
| 58 | ||
| 59 | /// The list of toolchain specific path prefixes to search for files. | |
| 60 | file_paths: PathList = .{}, | |
| 61 | ||
| 62 | /// The list of toolchain specific path prefixes to search for programs. | |
| 63 | program_paths: PathList = .{}, | |
| 64 | ||
| 65 | selected_multilib: Multilib = .{}, | |
| 66 | ||
| 67 | inner: Inner = .{ .uninitialized = {} }, | |
| 68 | ||
| 69 | pub fn getTarget(tc: *const Toolchain) std.Target { | |
| 70 | return tc.driver.comp.target; | |
| 71 | } | |
| 72 | ||
| 73 | fn getDefaultLinker(tc: *const Toolchain) []const u8 { | |
| 74 | return switch (tc.inner) { | |
| 75 | .uninitialized => unreachable, | |
| 76 | .linux => |linux| linux.getDefaultLinker(tc.getTarget()), | |
| 77 | .unknown => "ld", | |
| 78 | }; | |
| 79 | } | |
| 80 | ||
| 81 | /// Call this after driver has finished parsing command line arguments to find the toolchain | |
| 82 | pub fn discover(tc: *Toolchain) !void { | |
| 83 | if (tc.inner != .uninitialized) return; | |
| 84 | ||
| 85 | const target = tc.getTarget(); | |
| 86 | tc.inner = switch (target.os.tag) { | |
| 87 | .elfiamcu, | |
| 88 | .linux, | |
| 89 | => if (target.cpu.arch == .hexagon) | |
| 90 | .{ .unknown = {} } // TODO | |
| 91 | else if (target.cpu.arch.isMIPS()) | |
| 92 | .{ .unknown = {} } // TODO | |
| 93 | else if (target.cpu.arch.isPPC()) | |
| 94 | .{ .unknown = {} } // TODO | |
| 95 | else if (target.cpu.arch == .ve) | |
| 96 | .{ .unknown = {} } // TODO | |
| 97 | else | |
| 98 | .{ .linux = .{} }, | |
| 99 | else => .{ .unknown = {} }, // TODO | |
| 100 | }; | |
| 101 | return switch (tc.inner) { | |
| 102 | .uninitialized => unreachable, | |
| 103 | .linux => |*linux| linux.discover(tc), | |
| 104 | .unknown => {}, | |
| 105 | }; | |
| 106 | } | |
| 107 | ||
| 108 | pub fn deinit(tc: *Toolchain) void { | |
| 109 | const gpa = tc.driver.comp.gpa; | |
| 110 | tc.inner.deinit(gpa); | |
| 111 | ||
| 112 | tc.library_paths.deinit(gpa); | |
| 113 | tc.file_paths.deinit(gpa); | |
| 114 | tc.program_paths.deinit(gpa); | |
| 115 | } | |
| 116 | ||
| 117 | /// Write linker path to `buf` and return a slice of it | |
| 118 | pub fn getLinkerPath(tc: *const Toolchain, buf: []u8) ![]const u8 { | |
| 119 | // --ld-path= takes precedence over -fuse-ld= and specifies the executable | |
| 120 | // name. -B, COMPILER_PATH and PATH are consulted if the value does not | |
| 121 | // contain a path component separator. | |
| 122 | // -fuse-ld=lld can be used with --ld-path= to indicate that the binary | |
| 123 | // that --ld-path= points to is lld. | |
| 124 | const use_linker = tc.driver.use_linker orelse system_defaults.linker; | |
| 125 | ||
| 126 | if (tc.driver.linker_path) |ld_path| { | |
| 127 | var path = ld_path; | |
| 128 | if (path.len > 0) { | |
| 129 | if (std.fs.path.dirname(path) == null) { | |
| 130 | path = tc.getProgramPath(path, buf); | |
| 131 | } | |
| 132 | if (tc.filesystem.canExecute(path)) { | |
| 133 | return path; | |
| 134 | } | |
| 135 | } | |
| 136 | return tc.driver.fatal( | |
| 137 | "invalid linker name in argument '--ld-path={s}'", | |
| 138 | .{path}, | |
| 139 | ); | |
| 140 | } | |
| 141 | ||
| 142 | // If we're passed -fuse-ld= with no argument, or with the argument ld, | |
| 143 | // then use whatever the default system linker is. | |
| 144 | if (use_linker.len == 0 or mem.eql(u8, use_linker, "ld")) { | |
| 145 | const default = tc.getDefaultLinker(); | |
| 146 | if (std.fs.path.isAbsolute(default)) return default; | |
| 147 | return tc.getProgramPath(default, buf); | |
| 148 | } | |
| 149 | ||
| 150 | // Extending -fuse-ld= to an absolute or relative path is unexpected. Checking | |
| 151 | // for the linker flavor is brittle. In addition, prepending "ld." or "ld64." | |
| 152 | // to a relative path is surprising. This is more complex due to priorities | |
| 153 | // among -B, COMPILER_PATH and PATH. --ld-path= should be used instead. | |
| 154 | if (mem.indexOfScalar(u8, use_linker, '/') != null) { | |
| 155 | try tc.driver.comp.diag.add(.{ .tag = .fuse_ld_path }, &.{}); | |
| 156 | } | |
| 157 | ||
| 158 | if (std.fs.path.isAbsolute(use_linker)) { | |
| 159 | if (tc.filesystem.canExecute(use_linker)) { | |
| 160 | return use_linker; | |
| 161 | } | |
| 162 | } else { | |
| 163 | var linker_name = try std.ArrayList(u8).initCapacity(tc.driver.comp.gpa, 5 + use_linker.len); // "ld64." ++ use_linker | |
| 164 | defer linker_name.deinit(); | |
| 165 | if (tc.getTarget().isDarwin()) { | |
| 166 | linker_name.appendSliceAssumeCapacity("ld64."); | |
| 167 | } else { | |
| 168 | linker_name.appendSliceAssumeCapacity("ld."); | |
| 169 | } | |
| 170 | linker_name.appendSliceAssumeCapacity(use_linker); | |
| 171 | const linker_path = tc.getProgramPath(linker_name.items, buf); | |
| 172 | if (tc.filesystem.canExecute(linker_path)) { | |
| 173 | return linker_path; | |
| 174 | } | |
| 175 | } | |
| 176 | ||
| 177 | if (tc.driver.use_linker) |linker| { | |
| 178 | return tc.driver.fatal( | |
| 179 | "invalid linker name in argument '-fuse-ld={s}'", | |
| 180 | .{linker}, | |
| 181 | ); | |
| 182 | } | |
| 183 | const default_linker = tc.getDefaultLinker(); | |
| 184 | return tc.getProgramPath(default_linker, buf); | |
| 185 | } | |
| 186 | ||
| 187 | const TargetSpecificToolName = std.BoundedArray(u8, 64); | |
| 188 | ||
| 189 | /// If an explicit target is provided, also check the prefixed tool-specific name | |
| 190 | /// TODO: this isn't exactly right since our target names don't necessarily match up | |
| 191 | /// with GCC's. | |
| 192 | /// For example the Zig target `arm-freestanding-eabi` would need the `arm-none-eabi` tools | |
| 193 | fn possibleProgramNames(raw_triple: ?[]const u8, name: []const u8, target_specific: *TargetSpecificToolName) std.BoundedArray([]const u8, 2) { | |
| 194 | var possible_names: std.BoundedArray([]const u8, 2) = .{}; | |
| 195 | if (raw_triple) |triple| { | |
| 196 | const w = target_specific.writer(); | |
| 197 | if (w.print("{s}-{s}", .{ triple, name })) { | |
| 198 | possible_names.appendAssumeCapacity(target_specific.constSlice()); | |
| 199 | } else |_| {} | |
| 200 | } | |
| 201 | possible_names.appendAssumeCapacity(name); | |
| 202 | ||
| 203 | return possible_names; | |
| 204 | } | |
| 205 | ||
| 206 | /// Add toolchain `file_paths` to argv as `-L` arguments | |
| 207 | pub fn addFilePathLibArgs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 208 | try argv.ensureUnusedCapacity(tc.file_paths.items.len); | |
| 209 | ||
| 210 | var bytes_needed: usize = 0; | |
| 211 | for (tc.file_paths.items) |path| { | |
| 212 | bytes_needed += path.len + 2; // +2 for `-L` | |
| 213 | } | |
| 214 | var bytes = try tc.arena.alloc(u8, bytes_needed); | |
| 215 | var index: usize = 0; | |
| 216 | for (tc.file_paths.items) |path| { | |
| 217 | @memcpy(bytes[index..][0..2], "-L"); | |
| 218 | @memcpy(bytes[index + 2 ..][0..path.len], path); | |
| 219 | argv.appendAssumeCapacity(bytes[index..][0 .. path.len + 2]); | |
| 220 | index += path.len + 2; | |
| 221 | } | |
| 222 | } | |
| 223 | ||
| 224 | /// Search for an executable called `name` or `{triple}-{name} in program_paths and the $PATH environment variable | |
| 225 | /// If not found there, just use `name` | |
| 226 | /// Writes the result to `buf` and returns a slice of it | |
| 227 | fn getProgramPath(tc: *const Toolchain, name: []const u8, buf: []u8) []const u8 { | |
| 228 | var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 229 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); | |
| 230 | ||
| 231 | var tool_specific_name: TargetSpecificToolName = .{}; | |
| 232 | const possible_names = possibleProgramNames(tc.driver.raw_target_triple, name, &tool_specific_name); | |
| 233 | ||
| 234 | for (possible_names.constSlice()) |tool_name| { | |
| 235 | for (tc.program_paths.items) |program_path| { | |
| 236 | defer fib.reset(); | |
| 237 | ||
| 238 | const candidate = std.fs.path.join(fib.allocator(), &.{ program_path, tool_name }) catch continue; | |
| 239 | ||
| 240 | if (tc.filesystem.canExecute(candidate) and candidate.len <= buf.len) { | |
| 241 | @memcpy(buf[0..candidate.len], candidate); | |
| 242 | return buf[0..candidate.len]; | |
| 243 | } | |
| 244 | } | |
| 245 | return tc.filesystem.findProgramByName(tc.driver.comp.gpa, name, tc.driver.comp.environment.path, buf) orelse continue; | |
| 246 | } | |
| 247 | @memcpy(buf[0..name.len], name); | |
| 248 | return buf[0..name.len]; | |
| 249 | } | |
| 250 | ||
| 251 | pub fn getSysroot(tc: *const Toolchain) []const u8 { | |
| 252 | return tc.driver.sysroot orelse system_defaults.sysroot; | |
| 253 | } | |
| 254 | ||
| 255 | /// Search for `name` in a variety of places | |
| 256 | /// TODO: cache results based on `name` so we're not repeatedly allocating the same strings? | |
| 257 | pub fn getFilePath(tc: *const Toolchain, name: []const u8) ![]const u8 { | |
| 258 | var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 259 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); | |
| 260 | const allocator = fib.allocator(); | |
| 261 | ||
| 262 | const sysroot = tc.getSysroot(); | |
| 263 | ||
| 264 | // todo check resource dir | |
| 265 | // todo check compiler RT path | |
| 266 | const aro_dir = std.fs.path.dirname(tc.driver.aro_name) orelse ""; | |
| 267 | const candidate = try std.fs.path.join(allocator, &.{ aro_dir, "..", name }); | |
| 268 | if (tc.filesystem.exists(candidate)) { | |
| 269 | return tc.arena.dupe(u8, candidate); | |
| 270 | } | |
| 271 | ||
| 272 | if (tc.searchPaths(&fib, sysroot, tc.library_paths.items, name)) |path| { | |
| 273 | return tc.arena.dupe(u8, path); | |
| 274 | } | |
| 275 | ||
| 276 | if (tc.searchPaths(&fib, sysroot, tc.file_paths.items, name)) |path| { | |
| 277 | return try tc.arena.dupe(u8, path); | |
| 278 | } | |
| 279 | ||
| 280 | return name; | |
| 281 | } | |
| 282 | ||
| 283 | /// Search a list of `path_prefixes` for the existence `name` | |
| 284 | /// Assumes that `fba` is a fixed-buffer allocator, so does not free joined path candidates | |
| 285 | fn searchPaths(tc: *const Toolchain, fib: *std.heap.FixedBufferAllocator, sysroot: []const u8, path_prefixes: []const []const u8, name: []const u8) ?[]const u8 { | |
| 286 | for (path_prefixes) |path| { | |
| 287 | fib.reset(); | |
| 288 | if (path.len == 0) continue; | |
| 289 | ||
| 290 | const candidate = if (path[0] == '=') | |
| 291 | std.fs.path.join(fib.allocator(), &.{ sysroot, path[1..], name }) catch continue | |
| 292 | else | |
| 293 | std.fs.path.join(fib.allocator(), &.{ path, name }) catch continue; | |
| 294 | ||
| 295 | if (tc.filesystem.exists(candidate)) { | |
| 296 | return candidate; | |
| 297 | } | |
| 298 | } | |
| 299 | return null; | |
| 300 | } | |
| 301 | ||
| 302 | const PathKind = enum { | |
| 303 | library, | |
| 304 | file, | |
| 305 | program, | |
| 306 | }; | |
| 307 | ||
| 308 | /// Join `components` into a path. If the path exists, dupe it into the toolchain arena and | |
| 309 | /// add it to the specified path list. | |
| 310 | pub fn addPathIfExists(tc: *Toolchain, components: []const []const u8, dest_kind: PathKind) !void { | |
| 311 | var path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 312 | var fib = std.heap.FixedBufferAllocator.init(&path_buf); | |
| 313 | ||
| 314 | const candidate = try std.fs.path.join(fib.allocator(), components); | |
| 315 | ||
| 316 | if (tc.filesystem.exists(candidate)) { | |
| 317 | const duped = try tc.arena.dupe(u8, candidate); | |
| 318 | const dest = switch (dest_kind) { | |
| 319 | .library => &tc.library_paths, | |
| 320 | .file => &tc.file_paths, | |
| 321 | .program => &tc.program_paths, | |
| 322 | }; | |
| 323 | try dest.append(tc.driver.comp.gpa, duped); | |
| 324 | } | |
| 325 | } | |
| 326 | ||
| 327 | /// Join `components` using the toolchain arena and add the resulting path to `dest_kind`. Does not check | |
| 328 | /// whether the path actually exists | |
| 329 | pub fn addPathFromComponents(tc: *Toolchain, components: []const []const u8, dest_kind: PathKind) !void { | |
| 330 | const full_path = try std.fs.path.join(tc.arena, components); | |
| 331 | const dest = switch (dest_kind) { | |
| 332 | .library => &tc.library_paths, | |
| 333 | .file => &tc.file_paths, | |
| 334 | .program => &tc.program_paths, | |
| 335 | }; | |
| 336 | try dest.append(tc.driver.comp.gpa, full_path); | |
| 337 | } | |
| 338 | ||
| 339 | /// Add linker args to `argv`. Does not add path to linker executable as first item; that must be handled separately | |
| 340 | /// Items added to `argv` will be string literals or owned by `tc.arena` so they must not be individually freed | |
| 341 | pub fn buildLinkerArgs(tc: *Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 342 | return switch (tc.inner) { | |
| 343 | .uninitialized => unreachable, | |
| 344 | .linux => |*linux| linux.buildLinkerArgs(tc, argv), | |
| 345 | .unknown => @panic("This toolchain does not support linking yet"), | |
| 346 | }; | |
| 347 | } | |
| 348 | ||
| 349 | fn getDefaultRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind { | |
| 350 | if (tc.getTarget().isAndroid()) { | |
| 351 | return .compiler_rt; | |
| 352 | } | |
| 353 | return .libgcc; | |
| 354 | } | |
| 355 | ||
| 356 | pub fn getRuntimeLibKind(tc: *const Toolchain) RuntimeLibKind { | |
| 357 | const libname = tc.driver.rtlib orelse system_defaults.rtlib; | |
| 358 | if (mem.eql(u8, libname, "compiler-rt")) | |
| 359 | return .compiler_rt | |
| 360 | else if (mem.eql(u8, libname, "libgcc")) | |
| 361 | return .libgcc | |
| 362 | else | |
| 363 | return tc.getDefaultRuntimeLibKind(); | |
| 364 | } | |
| 365 | ||
| 366 | /// TODO | |
| 367 | pub fn getCompilerRt(tc: *const Toolchain, component: []const u8, file_kind: FileKind) ![]const u8 { | |
| 368 | _ = file_kind; | |
| 369 | _ = component; | |
| 370 | _ = tc; | |
| 371 | return ""; | |
| 372 | } | |
| 373 | ||
| 374 | fn getLibGCCKind(tc: *const Toolchain) LibGCCKind { | |
| 375 | const target = tc.getTarget(); | |
| 376 | if (tc.driver.static_libgcc or tc.driver.static or tc.driver.static_pie or target.isAndroid()) { | |
| 377 | return .static; | |
| 378 | } | |
| 379 | if (tc.driver.shared_libgcc) { | |
| 380 | return .shared; | |
| 381 | } | |
| 382 | return .unspecified; | |
| 383 | } | |
| 384 | ||
| 385 | fn getUnwindLibKind(tc: *const Toolchain) !UnwindLibKind { | |
| 386 | const libname = tc.driver.unwindlib orelse system_defaults.unwindlib; | |
| 387 | if (libname.len == 0 or mem.eql(u8, libname, "platform")) { | |
| 388 | switch (tc.getRuntimeLibKind()) { | |
| 389 | .compiler_rt => { | |
| 390 | const target = tc.getTarget(); | |
| 391 | if (target.isAndroid() or target.os.tag == .aix) { | |
| 392 | return .compiler_rt; | |
| 393 | } else { | |
| 394 | return .none; | |
| 395 | } | |
| 396 | }, | |
| 397 | .libgcc => return .libgcc, | |
| 398 | } | |
| 399 | } else if (mem.eql(u8, libname, "none")) { | |
| 400 | return .none; | |
| 401 | } else if (mem.eql(u8, libname, "libgcc")) { | |
| 402 | return .libgcc; | |
| 403 | } else if (mem.eql(u8, libname, "libunwind")) { | |
| 404 | if (tc.getRuntimeLibKind() == .libgcc) { | |
| 405 | try tc.driver.comp.diag.add(.{ .tag = .incompatible_unwindlib }, &.{}); | |
| 406 | } | |
| 407 | return .compiler_rt; | |
| 408 | } else { | |
| 409 | unreachable; | |
| 410 | } | |
| 411 | } | |
| 412 | ||
| 413 | fn getAsNeededOption(is_solaris: bool, needed: bool) []const u8 { | |
| 414 | if (is_solaris) { | |
| 415 | return if (needed) "-zignore" else "-zrecord"; | |
| 416 | } else { | |
| 417 | return if (needed) "--as-needed" else "--no-as-needed"; | |
| 418 | } | |
| 419 | } | |
| 420 | ||
| 421 | fn addUnwindLibrary(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 422 | const unw = try tc.getUnwindLibKind(); | |
| 423 | const target = tc.getTarget(); | |
| 424 | if ((target.isAndroid() and unw == .libgcc) or | |
| 425 | target.os.tag == .elfiamcu or | |
| 426 | target.ofmt == .wasm or | |
| 427 | target_util.isWindowsMSVCEnvironment(target) or | |
| 428 | unw == .none) return; | |
| 429 | ||
| 430 | const lgk = tc.getLibGCCKind(); | |
| 431 | const as_needed = lgk == .unspecified and !target.isAndroid() and !target_util.isCygwinMinGW(target) and target.os.tag != .aix; | |
| 432 | if (as_needed) { | |
| 433 | try argv.append(getAsNeededOption(target.os.tag == .solaris, true)); | |
| 434 | } | |
| 435 | switch (unw) { | |
| 436 | .none => return, | |
| 437 | .libgcc => if (lgk == .static) try argv.append("-lgcc_eh") else try argv.append("-lgcc_s"), | |
| 438 | .compiler_rt => if (target.os.tag == .aix) { | |
| 439 | if (lgk != .static) { | |
| 440 | try argv.append("-lunwind"); | |
| 441 | } | |
| 442 | } else if (lgk == .static) { | |
| 443 | try argv.append("-l:libunwind.a"); | |
| 444 | } else if (lgk == .shared) { | |
| 445 | if (target_util.isCygwinMinGW(target)) { | |
| 446 | try argv.append("-l:libunwind.dll.a"); | |
| 447 | } else { | |
| 448 | try argv.append("-l:libunwind.so"); | |
| 449 | } | |
| 450 | } else { | |
| 451 | try argv.append("-lunwind"); | |
| 452 | }, | |
| 453 | } | |
| 454 | ||
| 455 | if (as_needed) { | |
| 456 | try argv.append(getAsNeededOption(target.os.tag == .solaris, false)); | |
| 457 | } | |
| 458 | } | |
| 459 | ||
| 460 | fn addLibGCC(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 461 | const libgcc_kind = tc.getLibGCCKind(); | |
| 462 | if (libgcc_kind == .static or libgcc_kind == .unspecified) { | |
| 463 | try argv.append("-lgcc"); | |
| 464 | } | |
| 465 | try tc.addUnwindLibrary(argv); | |
| 466 | if (libgcc_kind == .shared) { | |
| 467 | try argv.append("-lgcc"); | |
| 468 | } | |
| 469 | } | |
| 470 | ||
| 471 | pub fn addRuntimeLibs(tc: *const Toolchain, argv: *std.ArrayList([]const u8)) !void { | |
| 472 | const target = tc.getTarget(); | |
| 473 | const rlt = tc.getRuntimeLibKind(); | |
| 474 | switch (rlt) { | |
| 475 | .compiler_rt => { | |
| 476 | // TODO | |
| 477 | }, | |
| 478 | .libgcc => { | |
| 479 | if (target_util.isKnownWindowsMSVCEnvironment(target)) { | |
| 480 | const rtlib_str = tc.driver.rtlib orelse system_defaults.rtlib; | |
| 481 | if (!mem.eql(u8, rtlib_str, "platform")) { | |
| 482 | try tc.driver.comp.diag.add(.{ .tag = .unsupported_rtlib_gcc, .extra = .{ .str = "MSVC" } }, &.{}); | |
| 483 | } | |
| 484 | } else { | |
| 485 | try tc.addLibGCC(argv); | |
| 486 | } | |
| 487 | }, | |
| 488 | } | |
| 489 | ||
| 490 | if (target.isAndroid() and !tc.driver.static and !tc.driver.static_pie) { | |
| 491 | try argv.append("-ldl"); | |
| 492 | } | |
| 493 | } |
deps/aro/Tree.zig created+1312| ... | ... | @@ -0,0 +1,1312 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Type = @import("Type.zig"); | |
| 3 | const Tokenizer = @import("Tokenizer.zig"); | |
| 4 | const Compilation = @import("Compilation.zig"); | |
| 5 | const Source = @import("Source.zig"); | |
| 6 | const Attribute = @import("Attribute.zig"); | |
| 7 | const Value = @import("Value.zig"); | |
| 8 | const StringInterner = @import("StringInterner.zig"); | |
| 9 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 10 | ||
| 11 | const Tree = @This(); | |
| 12 | ||
| 13 | pub const Token = struct { | |
| 14 | id: Id, | |
| 15 | flags: packed struct { | |
| 16 | expansion_disabled: bool = false, | |
| 17 | is_macro_arg: bool = false, | |
| 18 | } = .{}, | |
| 19 | /// This location contains the actual token slice which might be generated. | |
| 20 | /// If it is generated then there is guaranteed to be at least one | |
| 21 | /// expansion location. | |
| 22 | loc: Source.Location, | |
| 23 | expansion_locs: ?[*]Source.Location = null, | |
| 24 | ||
| 25 | pub fn expansionSlice(tok: Token) []const Source.Location { | |
| 26 | const locs = tok.expansion_locs orelse return &[0]Source.Location{}; | |
| 27 | var i: usize = 0; | |
| 28 | while (locs[i].id != .unused) : (i += 1) {} | |
| 29 | return locs[0..i]; | |
| 30 | } | |
| 31 | ||
| 32 | pub fn addExpansionLocation(tok: *Token, gpa: std.mem.Allocator, new: []const Source.Location) !void { | |
| 33 | if (new.len == 0 or tok.id == .whitespace) return; | |
| 34 | var list = std.ArrayList(Source.Location).init(gpa); | |
| 35 | defer { | |
| 36 | @memset(list.items.ptr[list.items.len..list.capacity], .{}); | |
| 37 | // Add a sentinel to indicate the end of the list since | |
| 38 | // the ArrayList's capacity isn't guaranteed to be exactly | |
| 39 | // what we ask for. | |
| 40 | if (list.capacity > 0) { | |
| 41 | list.items.ptr[list.capacity - 1].byte_offset = 1; | |
| 42 | } | |
| 43 | tok.expansion_locs = list.items.ptr; | |
| 44 | } | |
| 45 | ||
| 46 | if (tok.expansion_locs) |locs| { | |
| 47 | var i: usize = 0; | |
| 48 | while (locs[i].id != .unused) : (i += 1) {} | |
| 49 | list.items = locs[0..i]; | |
| 50 | while (locs[i].byte_offset != 1) : (i += 1) {} | |
| 51 | list.capacity = i + 1; | |
| 52 | } | |
| 53 | ||
| 54 | const min_len = @max(list.items.len + new.len + 1, 4); | |
| 55 | const wanted_len = std.math.ceilPowerOfTwo(usize, min_len) catch | |
| 56 | return error.OutOfMemory; | |
| 57 | try list.ensureTotalCapacity(wanted_len); | |
| 58 | ||
| 59 | for (new) |new_loc| { | |
| 60 | if (new_loc.id == .generated) continue; | |
| 61 | list.appendAssumeCapacity(new_loc); | |
| 62 | } | |
| 63 | } | |
| 64 | ||
| 65 | pub fn free(expansion_locs: ?[*]Source.Location, gpa: std.mem.Allocator) void { | |
| 66 | const locs = expansion_locs orelse return; | |
| 67 | var i: usize = 0; | |
| 68 | while (locs[i].id != .unused) : (i += 1) {} | |
| 69 | while (locs[i].byte_offset != 1) : (i += 1) {} | |
| 70 | gpa.free(locs[0 .. i + 1]); | |
| 71 | } | |
| 72 | ||
| 73 | pub fn dupe(tok: Token, gpa: std.mem.Allocator) !Token { | |
| 74 | var copy = tok; | |
| 75 | copy.expansion_locs = null; | |
| 76 | try copy.addExpansionLocation(gpa, tok.expansionSlice()); | |
| 77 | return copy; | |
| 78 | } | |
| 79 | ||
| 80 | pub const List = std.MultiArrayList(Token); | |
| 81 | pub const Id = Tokenizer.Token.Id; | |
| 82 | }; | |
| 83 | ||
| 84 | pub const TokenIndex = u32; | |
| 85 | pub const NodeIndex = enum(u32) { none, _ }; | |
| 86 | pub const ValueMap = std.AutoHashMap(NodeIndex, Value); | |
| 87 | ||
| 88 | comp: *Compilation, | |
| 89 | arena: std.heap.ArenaAllocator, | |
| 90 | generated: []const u8, | |
| 91 | tokens: Token.List.Slice, | |
| 92 | nodes: Node.List.Slice, | |
| 93 | data: []const NodeIndex, | |
| 94 | root_decls: []const NodeIndex, | |
| 95 | strings: []const u8, | |
| 96 | value_map: ValueMap, | |
| 97 | ||
| 98 | pub fn deinit(tree: *Tree) void { | |
| 99 | tree.comp.gpa.free(tree.root_decls); | |
| 100 | tree.comp.gpa.free(tree.data); | |
| 101 | tree.comp.gpa.free(tree.strings); | |
| 102 | tree.nodes.deinit(tree.comp.gpa); | |
| 103 | tree.arena.deinit(); | |
| 104 | tree.value_map.deinit(); | |
| 105 | } | |
| 106 | ||
| 107 | pub const GNUAssemblyQualifiers = struct { | |
| 108 | @"volatile": bool = false, | |
| 109 | @"inline": bool = false, | |
| 110 | goto: bool = false, | |
| 111 | }; | |
| 112 | ||
| 113 | pub const Node = struct { | |
| 114 | tag: Tag, | |
| 115 | ty: Type = .{ .specifier = .void }, | |
| 116 | data: Data, | |
| 117 | ||
| 118 | pub const Range = struct { start: u32, end: u32 }; | |
| 119 | ||
| 120 | pub const Data = union { | |
| 121 | decl: struct { | |
| 122 | name: TokenIndex, | |
| 123 | node: NodeIndex = .none, | |
| 124 | }, | |
| 125 | decl_ref: TokenIndex, | |
| 126 | range: Range, | |
| 127 | if3: struct { | |
| 128 | cond: NodeIndex, | |
| 129 | body: u32, | |
| 130 | }, | |
| 131 | un: NodeIndex, | |
| 132 | bin: struct { | |
| 133 | lhs: NodeIndex, | |
| 134 | rhs: NodeIndex, | |
| 135 | }, | |
| 136 | member: struct { | |
| 137 | lhs: NodeIndex, | |
| 138 | index: u32, | |
| 139 | }, | |
| 140 | union_init: struct { | |
| 141 | field_index: u32, | |
| 142 | node: NodeIndex, | |
| 143 | }, | |
| 144 | cast: struct { | |
| 145 | operand: NodeIndex, | |
| 146 | kind: CastKind, | |
| 147 | }, | |
| 148 | int: u64, | |
| 149 | return_zero: bool, | |
| 150 | ||
| 151 | pub fn forDecl(data: Data, tree: Tree) struct { | |
| 152 | decls: []const NodeIndex, | |
| 153 | cond: NodeIndex, | |
| 154 | incr: NodeIndex, | |
| 155 | body: NodeIndex, | |
| 156 | } { | |
| 157 | const items = tree.data[data.range.start..data.range.end]; | |
| 158 | const decls = items[0 .. items.len - 3]; | |
| 159 | ||
| 160 | return .{ | |
| 161 | .decls = decls, | |
| 162 | .cond = items[items.len - 3], | |
| 163 | .incr = items[items.len - 2], | |
| 164 | .body = items[items.len - 1], | |
| 165 | }; | |
| 166 | } | |
| 167 | ||
| 168 | pub fn forStmt(data: Data, tree: Tree) struct { | |
| 169 | init: NodeIndex, | |
| 170 | cond: NodeIndex, | |
| 171 | incr: NodeIndex, | |
| 172 | body: NodeIndex, | |
| 173 | } { | |
| 174 | const items = tree.data[data.if3.body..]; | |
| 175 | ||
| 176 | return .{ | |
| 177 | .init = items[0], | |
| 178 | .cond = items[1], | |
| 179 | .incr = items[2], | |
| 180 | .body = data.if3.cond, | |
| 181 | }; | |
| 182 | } | |
| 183 | }; | |
| 184 | ||
| 185 | pub const List = std.MultiArrayList(Node); | |
| 186 | }; | |
| 187 | ||
| 188 | pub const CastKind = enum(u8) { | |
| 189 | /// Does nothing except possibly add qualifiers | |
| 190 | no_op, | |
| 191 | /// Interpret one bit pattern as another. Used for operands which have the same | |
| 192 | /// size and unrelated types, e.g. casting one pointer type to another | |
| 193 | bitcast, | |
| 194 | /// Convert T[] to T * | |
| 195 | array_to_pointer, | |
| 196 | /// Converts an lvalue to an rvalue | |
| 197 | lval_to_rval, | |
| 198 | /// Convert a function type to a pointer to a function | |
| 199 | function_to_pointer, | |
| 200 | /// Convert a pointer type to a _Bool | |
| 201 | pointer_to_bool, | |
| 202 | /// Convert a pointer type to an integer type | |
| 203 | pointer_to_int, | |
| 204 | /// Convert _Bool to an integer type | |
| 205 | bool_to_int, | |
| 206 | /// Convert _Bool to a floating type | |
| 207 | bool_to_float, | |
| 208 | /// Convert a _Bool to a pointer; will cause a warning | |
| 209 | bool_to_pointer, | |
| 210 | /// Convert an integer type to _Bool | |
| 211 | int_to_bool, | |
| 212 | /// Convert an integer to a floating type | |
| 213 | int_to_float, | |
| 214 | /// Convert a complex integer to a complex floating type | |
| 215 | complex_int_to_complex_float, | |
| 216 | /// Convert an integer type to a pointer type | |
| 217 | int_to_pointer, | |
| 218 | /// Convert a floating type to a _Bool | |
| 219 | float_to_bool, | |
| 220 | /// Convert a floating type to an integer | |
| 221 | float_to_int, | |
| 222 | /// Convert a complex floating type to a complex integer | |
| 223 | complex_float_to_complex_int, | |
| 224 | /// Convert one integer type to another | |
| 225 | int_cast, | |
| 226 | /// Convert one complex integer type to another | |
| 227 | complex_int_cast, | |
| 228 | /// Convert real part of complex integer to a integer | |
| 229 | complex_int_to_real, | |
| 230 | /// Create a complex integer type using operand as the real part | |
| 231 | real_to_complex_int, | |
| 232 | /// Convert one floating type to another | |
| 233 | float_cast, | |
| 234 | /// Convert one complex floating type to another | |
| 235 | complex_float_cast, | |
| 236 | /// Convert real part of complex float to a float | |
| 237 | complex_float_to_real, | |
| 238 | /// Create a complex floating type using operand as the real part | |
| 239 | real_to_complex_float, | |
| 240 | /// Convert type to void | |
| 241 | to_void, | |
| 242 | /// Convert a literal 0 to a null pointer | |
| 243 | null_to_pointer, | |
| 244 | /// GNU cast-to-union extension | |
| 245 | union_cast, | |
| 246 | /// Create vector where each value is same as the input scalar. | |
| 247 | vector_splat, | |
| 248 | }; | |
| 249 | ||
| 250 | pub const Tag = enum(u8) { | |
| 251 | /// Must appear at index 0. Also used as the tag for __builtin_types_compatible_p arguments, since the arguments are types | |
| 252 | /// Reaching it is always the result of a bug. | |
| 253 | invalid, | |
| 254 | ||
| 255 | // ====== Decl ====== | |
| 256 | ||
| 257 | // _Static_assert | |
| 258 | static_assert, | |
| 259 | ||
| 260 | // function prototype | |
| 261 | fn_proto, | |
| 262 | static_fn_proto, | |
| 263 | inline_fn_proto, | |
| 264 | inline_static_fn_proto, | |
| 265 | ||
| 266 | // function definition | |
| 267 | fn_def, | |
| 268 | static_fn_def, | |
| 269 | inline_fn_def, | |
| 270 | inline_static_fn_def, | |
| 271 | ||
| 272 | // variable declaration | |
| 273 | @"var", | |
| 274 | extern_var, | |
| 275 | static_var, | |
| 276 | // same as static_var, used for __func__, __FUNCTION__ and __PRETTY_FUNCTION__ | |
| 277 | implicit_static_var, | |
| 278 | threadlocal_var, | |
| 279 | threadlocal_extern_var, | |
| 280 | threadlocal_static_var, | |
| 281 | ||
| 282 | /// __asm__("...") at file scope | |
| 283 | file_scope_asm, | |
| 284 | ||
| 285 | // typedef declaration | |
| 286 | typedef, | |
| 287 | ||
| 288 | // container declarations | |
| 289 | /// { lhs; rhs; } | |
| 290 | struct_decl_two, | |
| 291 | /// { lhs; rhs; } | |
| 292 | union_decl_two, | |
| 293 | /// { lhs, rhs, } | |
| 294 | enum_decl_two, | |
| 295 | /// { range } | |
| 296 | struct_decl, | |
| 297 | /// { range } | |
| 298 | union_decl, | |
| 299 | /// { range } | |
| 300 | enum_decl, | |
| 301 | /// struct decl_ref; | |
| 302 | struct_forward_decl, | |
| 303 | /// union decl_ref; | |
| 304 | union_forward_decl, | |
| 305 | /// enum decl_ref; | |
| 306 | enum_forward_decl, | |
| 307 | ||
| 308 | /// name = node | |
| 309 | enum_field_decl, | |
| 310 | /// ty name : node | |
| 311 | /// name == 0 means unnamed | |
| 312 | record_field_decl, | |
| 313 | /// Used when a record has an unnamed record as a field | |
| 314 | indirect_record_field_decl, | |
| 315 | ||
| 316 | // ====== Stmt ====== | |
| 317 | ||
| 318 | labeled_stmt, | |
| 319 | /// { first; second; } first and second may be null | |
| 320 | compound_stmt_two, | |
| 321 | /// { data } | |
| 322 | compound_stmt, | |
| 323 | /// if (first) data[second] else data[second+1]; | |
| 324 | if_then_else_stmt, | |
| 325 | /// if (first) second; second may be null | |
| 326 | if_then_stmt, | |
| 327 | /// switch (first) second | |
| 328 | switch_stmt, | |
| 329 | /// case first: second | |
| 330 | case_stmt, | |
| 331 | /// case data[body]...data[body+1]: cond | |
| 332 | case_range_stmt, | |
| 333 | /// default: first | |
| 334 | default_stmt, | |
| 335 | /// while (first) second | |
| 336 | while_stmt, | |
| 337 | /// do second while(first); | |
| 338 | do_while_stmt, | |
| 339 | /// for (data[..]; data[len-3]; data[len-2]) data[len-1] | |
| 340 | for_decl_stmt, | |
| 341 | /// for (;;;) first | |
| 342 | forever_stmt, | |
| 343 | /// for (data[first]; data[first+1]; data[first+2]) second | |
| 344 | for_stmt, | |
| 345 | /// goto first; | |
| 346 | goto_stmt, | |
| 347 | /// goto *un; | |
| 348 | computed_goto_stmt, | |
| 349 | // continue; first and second unused | |
| 350 | continue_stmt, | |
| 351 | // break; first and second unused | |
| 352 | break_stmt, | |
| 353 | // null statement (just a semicolon); first and second unused | |
| 354 | null_stmt, | |
| 355 | /// return first; first may be null | |
| 356 | return_stmt, | |
| 357 | /// Assembly statement of the form __asm__("string literal") | |
| 358 | gnu_asm_simple, | |
| 359 | ||
| 360 | // ====== Expr ====== | |
| 361 | ||
| 362 | /// lhs , rhs | |
| 363 | comma_expr, | |
| 364 | /// lhs ? data[0] : data[1] | |
| 365 | binary_cond_expr, | |
| 366 | /// Used as the base for casts of the lhs in `binary_cond_expr`. | |
| 367 | cond_dummy_expr, | |
| 368 | /// lhs ? data[0] : data[1] | |
| 369 | cond_expr, | |
| 370 | /// lhs = rhs | |
| 371 | assign_expr, | |
| 372 | /// lhs *= rhs | |
| 373 | mul_assign_expr, | |
| 374 | /// lhs /= rhs | |
| 375 | div_assign_expr, | |
| 376 | /// lhs %= rhs | |
| 377 | mod_assign_expr, | |
| 378 | /// lhs += rhs | |
| 379 | add_assign_expr, | |
| 380 | /// lhs -= rhs | |
| 381 | sub_assign_expr, | |
| 382 | /// lhs <<= rhs | |
| 383 | shl_assign_expr, | |
| 384 | /// lhs >>= rhs | |
| 385 | shr_assign_expr, | |
| 386 | /// lhs &= rhs | |
| 387 | bit_and_assign_expr, | |
| 388 | /// lhs ^= rhs | |
| 389 | bit_xor_assign_expr, | |
| 390 | /// lhs |= rhs | |
| 391 | bit_or_assign_expr, | |
| 392 | /// lhs || rhs | |
| 393 | bool_or_expr, | |
| 394 | /// lhs && rhs | |
| 395 | bool_and_expr, | |
| 396 | /// lhs | rhs | |
| 397 | bit_or_expr, | |
| 398 | /// lhs ^ rhs | |
| 399 | bit_xor_expr, | |
| 400 | /// lhs & rhs | |
| 401 | bit_and_expr, | |
| 402 | /// lhs == rhs | |
| 403 | equal_expr, | |
| 404 | /// lhs != rhs | |
| 405 | not_equal_expr, | |
| 406 | /// lhs < rhs | |
| 407 | less_than_expr, | |
| 408 | /// lhs <= rhs | |
| 409 | less_than_equal_expr, | |
| 410 | /// lhs > rhs | |
| 411 | greater_than_expr, | |
| 412 | /// lhs >= rhs | |
| 413 | greater_than_equal_expr, | |
| 414 | /// lhs << rhs | |
| 415 | shl_expr, | |
| 416 | /// lhs >> rhs | |
| 417 | shr_expr, | |
| 418 | /// lhs + rhs | |
| 419 | add_expr, | |
| 420 | /// lhs - rhs | |
| 421 | sub_expr, | |
| 422 | /// lhs * rhs | |
| 423 | mul_expr, | |
| 424 | /// lhs / rhs | |
| 425 | div_expr, | |
| 426 | /// lhs % rhs | |
| 427 | mod_expr, | |
| 428 | /// Explicit: (type) cast | |
| 429 | explicit_cast, | |
| 430 | /// Implicit: cast | |
| 431 | implicit_cast, | |
| 432 | /// &un | |
| 433 | addr_of_expr, | |
| 434 | /// &&decl_ref | |
| 435 | addr_of_label, | |
| 436 | /// *un | |
| 437 | deref_expr, | |
| 438 | /// +un | |
| 439 | plus_expr, | |
| 440 | /// -un | |
| 441 | negate_expr, | |
| 442 | /// ~un | |
| 443 | bit_not_expr, | |
| 444 | /// !un | |
| 445 | bool_not_expr, | |
| 446 | /// ++un | |
| 447 | pre_inc_expr, | |
| 448 | /// --un | |
| 449 | pre_dec_expr, | |
| 450 | /// __imag un | |
| 451 | imag_expr, | |
| 452 | /// __real un | |
| 453 | real_expr, | |
| 454 | /// lhs[rhs] lhs is pointer/array type, rhs is integer type | |
| 455 | array_access_expr, | |
| 456 | /// first(second) second may be 0 | |
| 457 | call_expr_one, | |
| 458 | /// data[0](data[1..]) | |
| 459 | call_expr, | |
| 460 | /// decl | |
| 461 | builtin_call_expr_one, | |
| 462 | builtin_call_expr, | |
| 463 | /// lhs.member | |
| 464 | member_access_expr, | |
| 465 | /// lhs->member | |
| 466 | member_access_ptr_expr, | |
| 467 | /// un++ | |
| 468 | post_inc_expr, | |
| 469 | /// un-- | |
| 470 | post_dec_expr, | |
| 471 | /// (un) | |
| 472 | paren_expr, | |
| 473 | /// decl_ref | |
| 474 | decl_ref_expr, | |
| 475 | /// decl_ref | |
| 476 | enumeration_ref, | |
| 477 | /// C23 bool literal `true` / `false` | |
| 478 | bool_literal, | |
| 479 | /// C23 nullptr literal | |
| 480 | nullptr_literal, | |
| 481 | /// integer literal, always unsigned | |
| 482 | int_literal, | |
| 483 | /// Same as int_literal, but originates from a char literal | |
| 484 | char_literal, | |
| 485 | /// _Float16 literal | |
| 486 | float16_literal, | |
| 487 | /// f32 literal | |
| 488 | float_literal, | |
| 489 | /// f64 literal | |
| 490 | double_literal, | |
| 491 | /// wraps a float or double literal: un | |
| 492 | imaginary_literal, | |
| 493 | /// tree.str[index..][0..len] | |
| 494 | string_literal_expr, | |
| 495 | /// sizeof(un?) | |
| 496 | sizeof_expr, | |
| 497 | /// _Alignof(un?) | |
| 498 | alignof_expr, | |
| 499 | /// _Generic(controlling lhs, chosen rhs) | |
| 500 | generic_expr_one, | |
| 501 | /// _Generic(controlling range[0], chosen range[1], rest range[2..]) | |
| 502 | generic_expr, | |
| 503 | /// ty: un | |
| 504 | generic_association_expr, | |
| 505 | // default: un | |
| 506 | generic_default_expr, | |
| 507 | /// __builtin_choose_expr(lhs, data[0], data[1]) | |
| 508 | builtin_choose_expr, | |
| 509 | /// __builtin_types_compatible_p(lhs, rhs) | |
| 510 | builtin_types_compatible_p, | |
| 511 | /// decl - special builtins require custom parsing | |
| 512 | special_builtin_call_one, | |
| 513 | /// ({ un }) | |
| 514 | stmt_expr, | |
| 515 | ||
| 516 | // ====== Initializer expressions ====== | |
| 517 | ||
| 518 | /// { lhs, rhs } | |
| 519 | array_init_expr_two, | |
| 520 | /// { range } | |
| 521 | array_init_expr, | |
| 522 | /// { lhs, rhs } | |
| 523 | struct_init_expr_two, | |
| 524 | /// { range } | |
| 525 | struct_init_expr, | |
| 526 | /// { union_init } | |
| 527 | union_init_expr, | |
| 528 | /// (ty){ un } | |
| 529 | compound_literal_expr, | |
| 530 | ||
| 531 | /// Inserted at the end of a function body if no return stmt is found. | |
| 532 | /// ty is the functions return type | |
| 533 | /// data is return_zero which is true if the function is called "main" and ty is compatible with int | |
| 534 | implicit_return, | |
| 535 | ||
| 536 | /// Inserted in array_init_expr to represent unspecified elements. | |
| 537 | /// data.int contains the amount of elements. | |
| 538 | array_filler_expr, | |
| 539 | /// Inserted in record and scalar initializers for unspecified elements. | |
| 540 | default_init_expr, | |
| 541 | ||
| 542 | pub fn isImplicit(tag: Tag) bool { | |
| 543 | return switch (tag) { | |
| 544 | .implicit_cast, | |
| 545 | .implicit_return, | |
| 546 | .array_filler_expr, | |
| 547 | .default_init_expr, | |
| 548 | .implicit_static_var, | |
| 549 | .cond_dummy_expr, | |
| 550 | => true, | |
| 551 | else => false, | |
| 552 | }; | |
| 553 | } | |
| 554 | }; | |
| 555 | ||
| 556 | pub fn isBitfield(nodes: Node.List.Slice, node: NodeIndex) bool { | |
| 557 | return bitfieldWidth(nodes, node, false) != null; | |
| 558 | } | |
| 559 | ||
| 560 | /// Returns null if node is not a bitfield. If inspect_lval is true, this function will | |
| 561 | /// recurse into implicit lval_to_rval casts (useful for arithmetic conversions) | |
| 562 | pub fn bitfieldWidth(nodes: Node.List.Slice, node: NodeIndex, inspect_lval: bool) ?u32 { | |
| 563 | if (node == .none) return null; | |
| 564 | switch (nodes.items(.tag)[@intFromEnum(node)]) { | |
| 565 | .member_access_expr, .member_access_ptr_expr => { | |
| 566 | const member = nodes.items(.data)[@intFromEnum(node)].member; | |
| 567 | var ty = nodes.items(.ty)[@intFromEnum(member.lhs)]; | |
| 568 | if (ty.isPtr()) ty = ty.elemType(); | |
| 569 | const record_ty = ty.get(.@"struct") orelse ty.get(.@"union") orelse return null; | |
| 570 | const field = record_ty.data.record.fields[member.index]; | |
| 571 | return field.bit_width; | |
| 572 | }, | |
| 573 | .implicit_cast => { | |
| 574 | if (!inspect_lval) return null; | |
| 575 | ||
| 576 | const data = nodes.items(.data)[@intFromEnum(node)]; | |
| 577 | return switch (data.cast.kind) { | |
| 578 | .lval_to_rval => bitfieldWidth(nodes, data.cast.operand, false), | |
| 579 | else => null, | |
| 580 | }; | |
| 581 | }, | |
| 582 | else => return null, | |
| 583 | } | |
| 584 | } | |
| 585 | ||
| 586 | pub fn isLval(nodes: Node.List.Slice, extra: []const NodeIndex, value_map: ValueMap, node: NodeIndex) bool { | |
| 587 | var is_const: bool = undefined; | |
| 588 | return isLvalExtra(nodes, extra, value_map, node, &is_const); | |
| 589 | } | |
| 590 | ||
| 591 | pub fn isLvalExtra(nodes: Node.List.Slice, extra: []const NodeIndex, value_map: ValueMap, node: NodeIndex, is_const: *bool) bool { | |
| 592 | is_const.* = false; | |
| 593 | switch (nodes.items(.tag)[@intFromEnum(node)]) { | |
| 594 | .compound_literal_expr => { | |
| 595 | is_const.* = nodes.items(.ty)[@intFromEnum(node)].isConst(); | |
| 596 | return true; | |
| 597 | }, | |
| 598 | .string_literal_expr => return true, | |
| 599 | .member_access_ptr_expr => { | |
| 600 | const lhs_expr = nodes.items(.data)[@intFromEnum(node)].member.lhs; | |
| 601 | const ptr_ty = nodes.items(.ty)[@intFromEnum(lhs_expr)]; | |
| 602 | if (ptr_ty.isPtr()) is_const.* = ptr_ty.elemType().isConst(); | |
| 603 | return true; | |
| 604 | }, | |
| 605 | .array_access_expr => { | |
| 606 | const lhs_expr = nodes.items(.data)[@intFromEnum(node)].bin.lhs; | |
| 607 | if (lhs_expr != .none) { | |
| 608 | const array_ty = nodes.items(.ty)[@intFromEnum(lhs_expr)]; | |
| 609 | if (array_ty.isPtr() or array_ty.isArray()) is_const.* = array_ty.elemType().isConst(); | |
| 610 | } | |
| 611 | return true; | |
| 612 | }, | |
| 613 | .decl_ref_expr => { | |
| 614 | const decl_ty = nodes.items(.ty)[@intFromEnum(node)]; | |
| 615 | is_const.* = decl_ty.isConst(); | |
| 616 | return true; | |
| 617 | }, | |
| 618 | .deref_expr => { | |
| 619 | const data = nodes.items(.data)[@intFromEnum(node)]; | |
| 620 | const operand_ty = nodes.items(.ty)[@intFromEnum(data.un)]; | |
| 621 | if (operand_ty.isFunc()) return false; | |
| 622 | if (operand_ty.isPtr() or operand_ty.isArray()) is_const.* = operand_ty.elemType().isConst(); | |
| 623 | return true; | |
| 624 | }, | |
| 625 | .member_access_expr => { | |
| 626 | const data = nodes.items(.data)[@intFromEnum(node)]; | |
| 627 | return isLvalExtra(nodes, extra, value_map, data.member.lhs, is_const); | |
| 628 | }, | |
| 629 | .paren_expr => { | |
| 630 | const data = nodes.items(.data)[@intFromEnum(node)]; | |
| 631 | return isLvalExtra(nodes, extra, value_map, data.un, is_const); | |
| 632 | }, | |
| 633 | .builtin_choose_expr => { | |
| 634 | const data = nodes.items(.data)[@intFromEnum(node)]; | |
| 635 | ||
| 636 | if (value_map.get(data.if3.cond)) |val| { | |
| 637 | const offset = @intFromBool(val.isZero()); | |
| 638 | return isLvalExtra(nodes, extra, value_map, extra[data.if3.body + offset], is_const); | |
| 639 | } | |
| 640 | return false; | |
| 641 | }, | |
| 642 | else => return false, | |
| 643 | } | |
| 644 | } | |
| 645 | ||
| 646 | pub fn dumpStr(retained_strings: []const u8, range: Value.ByteRange, tag: Tag, writer: anytype) !void { | |
| 647 | switch (tag) { | |
| 648 | .string_literal_expr => { | |
| 649 | const lit_range = range.trim(1); // remove null-terminator | |
| 650 | const str = lit_range.slice(retained_strings); | |
| 651 | try writer.print("\"{}\"", .{std.zig.fmtEscapes(str)}); | |
| 652 | }, | |
| 653 | else => unreachable, | |
| 654 | } | |
| 655 | } | |
| 656 | ||
| 657 | pub fn tokSlice(tree: Tree, tok_i: TokenIndex) []const u8 { | |
| 658 | if (tree.tokens.items(.id)[tok_i].lexeme()) |some| return some; | |
| 659 | const loc = tree.tokens.items(.loc)[tok_i]; | |
| 660 | var tmp_tokenizer = Tokenizer{ | |
| 661 | .buf = tree.comp.getSource(loc.id).buf, | |
| 662 | .comp = tree.comp, | |
| 663 | .index = loc.byte_offset, | |
| 664 | .source = .generated, | |
| 665 | }; | |
| 666 | const tok = tmp_tokenizer.next(); | |
| 667 | return tmp_tokenizer.buf[tok.start..tok.end]; | |
| 668 | } | |
| 669 | ||
| 670 | pub fn dump(tree: Tree, color: bool, writer: anytype) @TypeOf(writer).Error!void { | |
| 671 | const mapper = tree.comp.string_interner.getFastTypeMapper(tree.comp.gpa) catch tree.comp.string_interner.getSlowTypeMapper(); | |
| 672 | defer mapper.deinit(tree.comp.gpa); | |
| 673 | ||
| 674 | for (tree.root_decls) |i| { | |
| 675 | try tree.dumpNode(i, 0, mapper, color, writer); | |
| 676 | try writer.writeByte('\n'); | |
| 677 | } | |
| 678 | } | |
| 679 | ||
| 680 | fn dumpFieldAttributes(attributes: []const Attribute, level: u32, strings: []const u8, writer: anytype) !void { | |
| 681 | for (attributes) |attr| { | |
| 682 | try writer.writeByteNTimes(' ', level); | |
| 683 | try writer.print("field attr: {s}", .{@tagName(attr.tag)}); | |
| 684 | try dumpAttribute(attr, strings, writer); | |
| 685 | } | |
| 686 | } | |
| 687 | ||
| 688 | fn dumpAttribute(attr: Attribute, strings: []const u8, writer: anytype) !void { | |
| 689 | switch (attr.tag) { | |
| 690 | inline else => |tag| { | |
| 691 | const args = @field(attr.args, @tagName(tag)); | |
| 692 | if (@TypeOf(args) == void) { | |
| 693 | try writer.writeByte('\n'); | |
| 694 | return; | |
| 695 | } | |
| 696 | try writer.writeByte(' '); | |
| 697 | inline for (@typeInfo(@TypeOf(args)).Struct.fields, 0..) |f, i| { | |
| 698 | if (comptime std.mem.eql(u8, f.name, "__name_tok")) continue; | |
| 699 | if (i != 0) { | |
| 700 | try writer.writeAll(", "); | |
| 701 | } | |
| 702 | try writer.writeAll(f.name); | |
| 703 | try writer.writeAll(": "); | |
| 704 | switch (f.type) { | |
| 705 | Value.ByteRange => try writer.print("\"{s}\"", .{@field(args, f.name).slice(strings)}), | |
| 706 | ?Value.ByteRange => try writer.print("\"{?s}\"", .{if (@field(args, f.name)) |range| range.slice(strings) else null}), | |
| 707 | else => switch (@typeInfo(f.type)) { | |
| 708 | .Enum => try writer.writeAll(@tagName(@field(args, f.name))), | |
| 709 | else => try writer.print("{any}", .{@field(args, f.name)}), | |
| 710 | }, | |
| 711 | } | |
| 712 | } | |
| 713 | try writer.writeByte('\n'); | |
| 714 | return; | |
| 715 | }, | |
| 716 | } | |
| 717 | } | |
| 718 | ||
| 719 | fn dumpNode(tree: Tree, node: NodeIndex, level: u32, mapper: StringInterner.TypeMapper, color: bool, w: anytype) @TypeOf(w).Error!void { | |
| 720 | const delta = 2; | |
| 721 | const half = delta / 2; | |
| 722 | const util = @import("util.zig"); | |
| 723 | const TYPE = util.Color.purple; | |
| 724 | const TAG = util.Color.cyan; | |
| 725 | const IMPLICIT = util.Color.blue; | |
| 726 | const NAME = util.Color.red; | |
| 727 | const LITERAL = util.Color.green; | |
| 728 | const ATTRIBUTE = util.Color.yellow; | |
| 729 | std.debug.assert(node != .none); | |
| 730 | ||
| 731 | const tag = tree.nodes.items(.tag)[@intFromEnum(node)]; | |
| 732 | const data = tree.nodes.items(.data)[@intFromEnum(node)]; | |
| 733 | const ty = tree.nodes.items(.ty)[@intFromEnum(node)]; | |
| 734 | try w.writeByteNTimes(' ', level); | |
| 735 | ||
| 736 | if (color) util.setColor(if (tag.isImplicit()) IMPLICIT else TAG, w); | |
| 737 | try w.print("{s}: ", .{@tagName(tag)}); | |
| 738 | if (tag == .implicit_cast or tag == .explicit_cast) { | |
| 739 | if (color) util.setColor(.white, w); | |
| 740 | try w.print("({s}) ", .{@tagName(data.cast.kind)}); | |
| 741 | } | |
| 742 | if (color) util.setColor(TYPE, w); | |
| 743 | try w.writeByte('\''); | |
| 744 | try ty.dump(mapper, tree.comp.langopts, w); | |
| 745 | try w.writeByte('\''); | |
| 746 | ||
| 747 | if (isLval(tree.nodes, tree.data, tree.value_map, node)) { | |
| 748 | if (color) util.setColor(ATTRIBUTE, w); | |
| 749 | try w.writeAll(" lvalue"); | |
| 750 | } | |
| 751 | if (isBitfield(tree.nodes, node)) { | |
| 752 | if (color) util.setColor(ATTRIBUTE, w); | |
| 753 | try w.writeAll(" bitfield"); | |
| 754 | } | |
| 755 | if (tree.value_map.get(node)) |val| { | |
| 756 | if (color) util.setColor(LITERAL, w); | |
| 757 | try w.writeAll(" (value: "); | |
| 758 | try val.dump(ty, tree.comp, tree.strings, w); | |
| 759 | try w.writeByte(')'); | |
| 760 | } | |
| 761 | if (tag == .implicit_return and data.return_zero) { | |
| 762 | if (color) util.setColor(IMPLICIT, w); | |
| 763 | try w.writeAll(" (value: 0)"); | |
| 764 | if (color) util.setColor(.reset, w); | |
| 765 | } | |
| 766 | ||
| 767 | try w.writeAll("\n"); | |
| 768 | if (color) util.setColor(.reset, w); | |
| 769 | ||
| 770 | if (ty.specifier == .attributed) { | |
| 771 | if (color) util.setColor(ATTRIBUTE, w); | |
| 772 | for (ty.data.attributed.attributes) |attr| { | |
| 773 | try w.writeByteNTimes(' ', level + half); | |
| 774 | try w.print("attr: {s}", .{@tagName(attr.tag)}); | |
| 775 | try dumpAttribute(attr, tree.strings, w); | |
| 776 | } | |
| 777 | if (color) util.setColor(.reset, w); | |
| 778 | } | |
| 779 | ||
| 780 | switch (tag) { | |
| 781 | .invalid => unreachable, | |
| 782 | .file_scope_asm => { | |
| 783 | try w.writeByteNTimes(' ', level + 1); | |
| 784 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 785 | }, | |
| 786 | .gnu_asm_simple => { | |
| 787 | try w.writeByteNTimes(' ', level); | |
| 788 | try tree.dumpNode(data.un, level, mapper, color, w); | |
| 789 | }, | |
| 790 | .static_assert => { | |
| 791 | try w.writeByteNTimes(' ', level + 1); | |
| 792 | try w.writeAll("condition:\n"); | |
| 793 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 794 | if (data.bin.rhs != .none) { | |
| 795 | try w.writeByteNTimes(' ', level + 1); | |
| 796 | try w.writeAll("diagnostic:\n"); | |
| 797 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 798 | } | |
| 799 | }, | |
| 800 | .fn_proto, | |
| 801 | .static_fn_proto, | |
| 802 | .inline_fn_proto, | |
| 803 | .inline_static_fn_proto, | |
| 804 | => { | |
| 805 | try w.writeByteNTimes(' ', level + half); | |
| 806 | try w.writeAll("name: "); | |
| 807 | if (color) util.setColor(NAME, w); | |
| 808 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 809 | if (color) util.setColor(.reset, w); | |
| 810 | }, | |
| 811 | .fn_def, | |
| 812 | .static_fn_def, | |
| 813 | .inline_fn_def, | |
| 814 | .inline_static_fn_def, | |
| 815 | => { | |
| 816 | try w.writeByteNTimes(' ', level + half); | |
| 817 | try w.writeAll("name: "); | |
| 818 | if (color) util.setColor(NAME, w); | |
| 819 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 820 | if (color) util.setColor(.reset, w); | |
| 821 | try w.writeByteNTimes(' ', level + half); | |
| 822 | try w.writeAll("body:\n"); | |
| 823 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 824 | }, | |
| 825 | .typedef, | |
| 826 | .@"var", | |
| 827 | .extern_var, | |
| 828 | .static_var, | |
| 829 | .implicit_static_var, | |
| 830 | .threadlocal_var, | |
| 831 | .threadlocal_extern_var, | |
| 832 | .threadlocal_static_var, | |
| 833 | => { | |
| 834 | try w.writeByteNTimes(' ', level + half); | |
| 835 | try w.writeAll("name: "); | |
| 836 | if (color) util.setColor(NAME, w); | |
| 837 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 838 | if (color) util.setColor(.reset, w); | |
| 839 | if (data.decl.node != .none) { | |
| 840 | try w.writeByteNTimes(' ', level + half); | |
| 841 | try w.writeAll("init:\n"); | |
| 842 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 843 | } | |
| 844 | }, | |
| 845 | .enum_field_decl => { | |
| 846 | try w.writeByteNTimes(' ', level + half); | |
| 847 | try w.writeAll("name: "); | |
| 848 | if (color) util.setColor(NAME, w); | |
| 849 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 850 | if (color) util.setColor(.reset, w); | |
| 851 | if (data.decl.node != .none) { | |
| 852 | try w.writeByteNTimes(' ', level + half); | |
| 853 | try w.writeAll("value:\n"); | |
| 854 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 855 | } | |
| 856 | }, | |
| 857 | .record_field_decl => { | |
| 858 | if (data.decl.name != 0) { | |
| 859 | try w.writeByteNTimes(' ', level + half); | |
| 860 | try w.writeAll("name: "); | |
| 861 | if (color) util.setColor(NAME, w); | |
| 862 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 863 | if (color) util.setColor(.reset, w); | |
| 864 | } | |
| 865 | if (data.decl.node != .none) { | |
| 866 | try w.writeByteNTimes(' ', level + half); | |
| 867 | try w.writeAll("bits:\n"); | |
| 868 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 869 | } | |
| 870 | }, | |
| 871 | .indirect_record_field_decl => {}, | |
| 872 | .compound_stmt, | |
| 873 | .array_init_expr, | |
| 874 | .struct_init_expr, | |
| 875 | .enum_decl, | |
| 876 | .struct_decl, | |
| 877 | .union_decl, | |
| 878 | => { | |
| 879 | const maybe_field_attributes = if (ty.getRecord()) |record| record.field_attributes else null; | |
| 880 | for (tree.data[data.range.start..data.range.end], 0..) |stmt, i| { | |
| 881 | if (i != 0) try w.writeByte('\n'); | |
| 882 | try tree.dumpNode(stmt, level + delta, mapper, color, w); | |
| 883 | if (maybe_field_attributes) |field_attributes| { | |
| 884 | if (field_attributes[i].len == 0) continue; | |
| 885 | ||
| 886 | if (color) util.setColor(ATTRIBUTE, w); | |
| 887 | try dumpFieldAttributes(field_attributes[i], level + delta + half, tree.strings, w); | |
| 888 | if (color) util.setColor(.reset, w); | |
| 889 | } | |
| 890 | } | |
| 891 | }, | |
| 892 | .compound_stmt_two, | |
| 893 | .array_init_expr_two, | |
| 894 | .struct_init_expr_two, | |
| 895 | .enum_decl_two, | |
| 896 | .struct_decl_two, | |
| 897 | .union_decl_two, | |
| 898 | => { | |
| 899 | var attr_array = [2][]const Attribute{ &.{}, &.{} }; | |
| 900 | const empty: [][]const Attribute = &attr_array; | |
| 901 | const field_attributes = if (ty.getRecord()) |record| (record.field_attributes orelse empty.ptr) else empty.ptr; | |
| 902 | if (data.bin.lhs != .none) { | |
| 903 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 904 | if (field_attributes[0].len > 0) { | |
| 905 | if (color) util.setColor(ATTRIBUTE, w); | |
| 906 | try dumpFieldAttributes(field_attributes[0], level + delta + half, tree.strings, w); | |
| 907 | if (color) util.setColor(.reset, w); | |
| 908 | } | |
| 909 | } | |
| 910 | if (data.bin.rhs != .none) { | |
| 911 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 912 | if (field_attributes[1].len > 0) { | |
| 913 | if (color) util.setColor(ATTRIBUTE, w); | |
| 914 | try dumpFieldAttributes(field_attributes[1], level + delta + half, tree.strings, w); | |
| 915 | if (color) util.setColor(.reset, w); | |
| 916 | } | |
| 917 | } | |
| 918 | }, | |
| 919 | .union_init_expr => { | |
| 920 | try w.writeByteNTimes(' ', level + half); | |
| 921 | try w.writeAll("field index: "); | |
| 922 | if (color) util.setColor(LITERAL, w); | |
| 923 | try w.print("{d}\n", .{data.union_init.field_index}); | |
| 924 | if (color) util.setColor(.reset, w); | |
| 925 | if (data.union_init.node != .none) { | |
| 926 | try tree.dumpNode(data.union_init.node, level + delta, mapper, color, w); | |
| 927 | } | |
| 928 | }, | |
| 929 | .compound_literal_expr => { | |
| 930 | try tree.dumpNode(data.un, level + half, mapper, color, w); | |
| 931 | }, | |
| 932 | .labeled_stmt => { | |
| 933 | try w.writeByteNTimes(' ', level + half); | |
| 934 | try w.writeAll("label: "); | |
| 935 | if (color) util.setColor(LITERAL, w); | |
| 936 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 937 | if (color) util.setColor(.reset, w); | |
| 938 | if (data.decl.node != .none) { | |
| 939 | try w.writeByteNTimes(' ', level + half); | |
| 940 | try w.writeAll("stmt:\n"); | |
| 941 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 942 | } | |
| 943 | }, | |
| 944 | .case_stmt => { | |
| 945 | try w.writeByteNTimes(' ', level + half); | |
| 946 | try w.writeAll("value:\n"); | |
| 947 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 948 | if (data.bin.rhs != .none) { | |
| 949 | try w.writeByteNTimes(' ', level + half); | |
| 950 | try w.writeAll("stmt:\n"); | |
| 951 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 952 | } | |
| 953 | }, | |
| 954 | .case_range_stmt => { | |
| 955 | try w.writeByteNTimes(' ', level + half); | |
| 956 | try w.writeAll("range start:\n"); | |
| 957 | try tree.dumpNode(tree.data[data.if3.body], level + delta, mapper, color, w); | |
| 958 | ||
| 959 | try w.writeByteNTimes(' ', level + half); | |
| 960 | try w.writeAll("range end:\n"); | |
| 961 | try tree.dumpNode(tree.data[data.if3.body + 1], level + delta, mapper, color, w); | |
| 962 | ||
| 963 | if (data.if3.cond != .none) { | |
| 964 | try w.writeByteNTimes(' ', level + half); | |
| 965 | try w.writeAll("stmt:\n"); | |
| 966 | try tree.dumpNode(data.if3.cond, level + delta, mapper, color, w); | |
| 967 | } | |
| 968 | }, | |
| 969 | .default_stmt => { | |
| 970 | if (data.un != .none) { | |
| 971 | try w.writeByteNTimes(' ', level + half); | |
| 972 | try w.writeAll("stmt:\n"); | |
| 973 | try tree.dumpNode(data.un, level + delta, mapper, color, w); | |
| 974 | } | |
| 975 | }, | |
| 976 | .binary_cond_expr, .cond_expr, .if_then_else_stmt, .builtin_choose_expr => { | |
| 977 | try w.writeByteNTimes(' ', level + half); | |
| 978 | try w.writeAll("cond:\n"); | |
| 979 | try tree.dumpNode(data.if3.cond, level + delta, mapper, color, w); | |
| 980 | ||
| 981 | try w.writeByteNTimes(' ', level + half); | |
| 982 | try w.writeAll("then:\n"); | |
| 983 | try tree.dumpNode(tree.data[data.if3.body], level + delta, mapper, color, w); | |
| 984 | ||
| 985 | try w.writeByteNTimes(' ', level + half); | |
| 986 | try w.writeAll("else:\n"); | |
| 987 | try tree.dumpNode(tree.data[data.if3.body + 1], level + delta, mapper, color, w); | |
| 988 | }, | |
| 989 | .builtin_types_compatible_p => { | |
| 990 | std.debug.assert(tree.nodes.items(.tag)[@intFromEnum(data.bin.lhs)] == .invalid); | |
| 991 | std.debug.assert(tree.nodes.items(.tag)[@intFromEnum(data.bin.rhs)] == .invalid); | |
| 992 | ||
| 993 | try w.writeByteNTimes(' ', level + half); | |
| 994 | try w.writeAll("lhs: "); | |
| 995 | ||
| 996 | const lhs_ty = tree.nodes.items(.ty)[@intFromEnum(data.bin.lhs)]; | |
| 997 | if (color) util.setColor(TYPE, w); | |
| 998 | try lhs_ty.dump(mapper, tree.comp.langopts, w); | |
| 999 | if (color) util.setColor(.reset, w); | |
| 1000 | try w.writeByte('\n'); | |
| 1001 | ||
| 1002 | try w.writeByteNTimes(' ', level + half); | |
| 1003 | try w.writeAll("rhs: "); | |
| 1004 | ||
| 1005 | const rhs_ty = tree.nodes.items(.ty)[@intFromEnum(data.bin.rhs)]; | |
| 1006 | if (color) util.setColor(TYPE, w); | |
| 1007 | try rhs_ty.dump(mapper, tree.comp.langopts, w); | |
| 1008 | if (color) util.setColor(.reset, w); | |
| 1009 | try w.writeByte('\n'); | |
| 1010 | }, | |
| 1011 | .if_then_stmt => { | |
| 1012 | try w.writeByteNTimes(' ', level + half); | |
| 1013 | try w.writeAll("cond:\n"); | |
| 1014 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 1015 | ||
| 1016 | if (data.bin.rhs != .none) { | |
| 1017 | try w.writeByteNTimes(' ', level + half); | |
| 1018 | try w.writeAll("then:\n"); | |
| 1019 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 1020 | } | |
| 1021 | }, | |
| 1022 | .switch_stmt, .while_stmt, .do_while_stmt => { | |
| 1023 | try w.writeByteNTimes(' ', level + half); | |
| 1024 | try w.writeAll("cond:\n"); | |
| 1025 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 1026 | ||
| 1027 | if (data.bin.rhs != .none) { | |
| 1028 | try w.writeByteNTimes(' ', level + half); | |
| 1029 | try w.writeAll("body:\n"); | |
| 1030 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 1031 | } | |
| 1032 | }, | |
| 1033 | .for_decl_stmt => { | |
| 1034 | const for_decl = data.forDecl(tree); | |
| 1035 | ||
| 1036 | try w.writeByteNTimes(' ', level + half); | |
| 1037 | try w.writeAll("decl:\n"); | |
| 1038 | for (for_decl.decls) |decl| { | |
| 1039 | try tree.dumpNode(decl, level + delta, mapper, color, w); | |
| 1040 | try w.writeByte('\n'); | |
| 1041 | } | |
| 1042 | if (for_decl.cond != .none) { | |
| 1043 | try w.writeByteNTimes(' ', level + half); | |
| 1044 | try w.writeAll("cond:\n"); | |
| 1045 | try tree.dumpNode(for_decl.cond, level + delta, mapper, color, w); | |
| 1046 | } | |
| 1047 | if (for_decl.incr != .none) { | |
| 1048 | try w.writeByteNTimes(' ', level + half); | |
| 1049 | try w.writeAll("incr:\n"); | |
| 1050 | try tree.dumpNode(for_decl.incr, level + delta, mapper, color, w); | |
| 1051 | } | |
| 1052 | if (for_decl.body != .none) { | |
| 1053 | try w.writeByteNTimes(' ', level + half); | |
| 1054 | try w.writeAll("body:\n"); | |
| 1055 | try tree.dumpNode(for_decl.body, level + delta, mapper, color, w); | |
| 1056 | } | |
| 1057 | }, | |
| 1058 | .forever_stmt => { | |
| 1059 | if (data.un != .none) { | |
| 1060 | try w.writeByteNTimes(' ', level + half); | |
| 1061 | try w.writeAll("body:\n"); | |
| 1062 | try tree.dumpNode(data.un, level + delta, mapper, color, w); | |
| 1063 | } | |
| 1064 | }, | |
| 1065 | .for_stmt => { | |
| 1066 | const for_stmt = data.forStmt(tree); | |
| 1067 | ||
| 1068 | if (for_stmt.init != .none) { | |
| 1069 | try w.writeByteNTimes(' ', level + half); | |
| 1070 | try w.writeAll("init:\n"); | |
| 1071 | try tree.dumpNode(for_stmt.init, level + delta, mapper, color, w); | |
| 1072 | } | |
| 1073 | if (for_stmt.cond != .none) { | |
| 1074 | try w.writeByteNTimes(' ', level + half); | |
| 1075 | try w.writeAll("cond:\n"); | |
| 1076 | try tree.dumpNode(for_stmt.cond, level + delta, mapper, color, w); | |
| 1077 | } | |
| 1078 | if (for_stmt.incr != .none) { | |
| 1079 | try w.writeByteNTimes(' ', level + half); | |
| 1080 | try w.writeAll("incr:\n"); | |
| 1081 | try tree.dumpNode(for_stmt.incr, level + delta, mapper, color, w); | |
| 1082 | } | |
| 1083 | if (for_stmt.body != .none) { | |
| 1084 | try w.writeByteNTimes(' ', level + half); | |
| 1085 | try w.writeAll("body:\n"); | |
| 1086 | try tree.dumpNode(for_stmt.body, level + delta, mapper, color, w); | |
| 1087 | } | |
| 1088 | }, | |
| 1089 | .goto_stmt, .addr_of_label => { | |
| 1090 | try w.writeByteNTimes(' ', level + half); | |
| 1091 | try w.writeAll("label: "); | |
| 1092 | if (color) util.setColor(LITERAL, w); | |
| 1093 | try w.print("{s}\n", .{tree.tokSlice(data.decl_ref)}); | |
| 1094 | if (color) util.setColor(.reset, w); | |
| 1095 | }, | |
| 1096 | .continue_stmt, .break_stmt, .implicit_return, .null_stmt => {}, | |
| 1097 | .return_stmt => { | |
| 1098 | if (data.un != .none) { | |
| 1099 | try w.writeByteNTimes(' ', level + half); | |
| 1100 | try w.writeAll("expr:\n"); | |
| 1101 | try tree.dumpNode(data.un, level + delta, mapper, color, w); | |
| 1102 | } | |
| 1103 | }, | |
| 1104 | .call_expr => { | |
| 1105 | try w.writeByteNTimes(' ', level + half); | |
| 1106 | try w.writeAll("lhs:\n"); | |
| 1107 | try tree.dumpNode(tree.data[data.range.start], level + delta, mapper, color, w); | |
| 1108 | ||
| 1109 | try w.writeByteNTimes(' ', level + half); | |
| 1110 | try w.writeAll("args:\n"); | |
| 1111 | for (tree.data[data.range.start + 1 .. data.range.end]) |arg| try tree.dumpNode(arg, level + delta, mapper, color, w); | |
| 1112 | }, | |
| 1113 | .call_expr_one => { | |
| 1114 | try w.writeByteNTimes(' ', level + half); | |
| 1115 | try w.writeAll("lhs:\n"); | |
| 1116 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 1117 | if (data.bin.rhs != .none) { | |
| 1118 | try w.writeByteNTimes(' ', level + half); | |
| 1119 | try w.writeAll("arg:\n"); | |
| 1120 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 1121 | } | |
| 1122 | }, | |
| 1123 | .builtin_call_expr => { | |
| 1124 | try w.writeByteNTimes(' ', level + half); | |
| 1125 | try w.writeAll("name: "); | |
| 1126 | if (color) util.setColor(NAME, w); | |
| 1127 | try w.print("{s}\n", .{tree.tokSlice(@intFromEnum(tree.data[data.range.start]))}); | |
| 1128 | if (color) util.setColor(.reset, w); | |
| 1129 | ||
| 1130 | try w.writeByteNTimes(' ', level + half); | |
| 1131 | try w.writeAll("args:\n"); | |
| 1132 | for (tree.data[data.range.start + 1 .. data.range.end]) |arg| try tree.dumpNode(arg, level + delta, mapper, color, w); | |
| 1133 | }, | |
| 1134 | .builtin_call_expr_one => { | |
| 1135 | try w.writeByteNTimes(' ', level + half); | |
| 1136 | try w.writeAll("name: "); | |
| 1137 | if (color) util.setColor(NAME, w); | |
| 1138 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 1139 | if (color) util.setColor(.reset, w); | |
| 1140 | if (data.decl.node != .none) { | |
| 1141 | try w.writeByteNTimes(' ', level + half); | |
| 1142 | try w.writeAll("arg:\n"); | |
| 1143 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 1144 | } | |
| 1145 | }, | |
| 1146 | .special_builtin_call_one => { | |
| 1147 | try w.writeByteNTimes(' ', level + half); | |
| 1148 | try w.writeAll("name: "); | |
| 1149 | if (color) util.setColor(NAME, w); | |
| 1150 | try w.print("{s}\n", .{tree.tokSlice(data.decl.name)}); | |
| 1151 | if (color) util.setColor(.reset, w); | |
| 1152 | if (data.decl.node != .none) { | |
| 1153 | try w.writeByteNTimes(' ', level + half); | |
| 1154 | try w.writeAll("arg:\n"); | |
| 1155 | try tree.dumpNode(data.decl.node, level + delta, mapper, color, w); | |
| 1156 | } | |
| 1157 | }, | |
| 1158 | .comma_expr, | |
| 1159 | .assign_expr, | |
| 1160 | .mul_assign_expr, | |
| 1161 | .div_assign_expr, | |
| 1162 | .mod_assign_expr, | |
| 1163 | .add_assign_expr, | |
| 1164 | .sub_assign_expr, | |
| 1165 | .shl_assign_expr, | |
| 1166 | .shr_assign_expr, | |
| 1167 | .bit_and_assign_expr, | |
| 1168 | .bit_xor_assign_expr, | |
| 1169 | .bit_or_assign_expr, | |
| 1170 | .bool_or_expr, | |
| 1171 | .bool_and_expr, | |
| 1172 | .bit_or_expr, | |
| 1173 | .bit_xor_expr, | |
| 1174 | .bit_and_expr, | |
| 1175 | .equal_expr, | |
| 1176 | .not_equal_expr, | |
| 1177 | .less_than_expr, | |
| 1178 | .less_than_equal_expr, | |
| 1179 | .greater_than_expr, | |
| 1180 | .greater_than_equal_expr, | |
| 1181 | .shl_expr, | |
| 1182 | .shr_expr, | |
| 1183 | .add_expr, | |
| 1184 | .sub_expr, | |
| 1185 | .mul_expr, | |
| 1186 | .div_expr, | |
| 1187 | .mod_expr, | |
| 1188 | => { | |
| 1189 | try w.writeByteNTimes(' ', level + 1); | |
| 1190 | try w.writeAll("lhs:\n"); | |
| 1191 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 1192 | try w.writeByteNTimes(' ', level + 1); | |
| 1193 | try w.writeAll("rhs:\n"); | |
| 1194 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 1195 | }, | |
| 1196 | .explicit_cast, .implicit_cast => try tree.dumpNode(data.cast.operand, level + delta, mapper, color, w), | |
| 1197 | .addr_of_expr, | |
| 1198 | .computed_goto_stmt, | |
| 1199 | .deref_expr, | |
| 1200 | .plus_expr, | |
| 1201 | .negate_expr, | |
| 1202 | .bit_not_expr, | |
| 1203 | .bool_not_expr, | |
| 1204 | .pre_inc_expr, | |
| 1205 | .pre_dec_expr, | |
| 1206 | .imag_expr, | |
| 1207 | .real_expr, | |
| 1208 | .post_inc_expr, | |
| 1209 | .post_dec_expr, | |
| 1210 | .paren_expr, | |
| 1211 | => { | |
| 1212 | try w.writeByteNTimes(' ', level + 1); | |
| 1213 | try w.writeAll("operand:\n"); | |
| 1214 | try tree.dumpNode(data.un, level + delta, mapper, color, w); | |
| 1215 | }, | |
| 1216 | .decl_ref_expr => { | |
| 1217 | try w.writeByteNTimes(' ', level + 1); | |
| 1218 | try w.writeAll("name: "); | |
| 1219 | if (color) util.setColor(NAME, w); | |
| 1220 | try w.print("{s}\n", .{tree.tokSlice(data.decl_ref)}); | |
| 1221 | if (color) util.setColor(.reset, w); | |
| 1222 | }, | |
| 1223 | .enumeration_ref => { | |
| 1224 | try w.writeByteNTimes(' ', level + 1); | |
| 1225 | try w.writeAll("name: "); | |
| 1226 | if (color) util.setColor(NAME, w); | |
| 1227 | try w.print("{s}\n", .{tree.tokSlice(data.decl_ref)}); | |
| 1228 | if (color) util.setColor(.reset, w); | |
| 1229 | }, | |
| 1230 | .bool_literal, | |
| 1231 | .nullptr_literal, | |
| 1232 | .int_literal, | |
| 1233 | .char_literal, | |
| 1234 | .float16_literal, | |
| 1235 | .float_literal, | |
| 1236 | .double_literal, | |
| 1237 | .string_literal_expr, | |
| 1238 | => {}, | |
| 1239 | .member_access_expr, .member_access_ptr_expr => { | |
| 1240 | try w.writeByteNTimes(' ', level + 1); | |
| 1241 | try w.writeAll("lhs:\n"); | |
| 1242 | try tree.dumpNode(data.member.lhs, level + delta, mapper, color, w); | |
| 1243 | ||
| 1244 | var lhs_ty = tree.nodes.items(.ty)[@intFromEnum(data.member.lhs)]; | |
| 1245 | if (lhs_ty.isPtr()) lhs_ty = lhs_ty.elemType(); | |
| 1246 | lhs_ty = lhs_ty.canonicalize(.standard); | |
| 1247 | ||
| 1248 | try w.writeByteNTimes(' ', level + 1); | |
| 1249 | try w.writeAll("name: "); | |
| 1250 | if (color) util.setColor(NAME, w); | |
| 1251 | try w.print("{s}\n", .{mapper.lookup(lhs_ty.data.record.fields[data.member.index].name)}); | |
| 1252 | if (color) util.setColor(.reset, w); | |
| 1253 | }, | |
| 1254 | .array_access_expr => { | |
| 1255 | if (data.bin.lhs != .none) { | |
| 1256 | try w.writeByteNTimes(' ', level + 1); | |
| 1257 | try w.writeAll("lhs:\n"); | |
| 1258 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 1259 | } | |
| 1260 | try w.writeByteNTimes(' ', level + 1); | |
| 1261 | try w.writeAll("index:\n"); | |
| 1262 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 1263 | }, | |
| 1264 | .sizeof_expr, .alignof_expr => { | |
| 1265 | if (data.un != .none) { | |
| 1266 | try w.writeByteNTimes(' ', level + 1); | |
| 1267 | try w.writeAll("expr:\n"); | |
| 1268 | try tree.dumpNode(data.un, level + delta, mapper, color, w); | |
| 1269 | } | |
| 1270 | }, | |
| 1271 | .generic_expr_one => { | |
| 1272 | try w.writeByteNTimes(' ', level + 1); | |
| 1273 | try w.writeAll("controlling:\n"); | |
| 1274 | try tree.dumpNode(data.bin.lhs, level + delta, mapper, color, w); | |
| 1275 | try w.writeByteNTimes(' ', level + 1); | |
| 1276 | if (data.bin.rhs != .none) { | |
| 1277 | try w.writeAll("chosen:\n"); | |
| 1278 | try tree.dumpNode(data.bin.rhs, level + delta, mapper, color, w); | |
| 1279 | } | |
| 1280 | }, | |
| 1281 | .generic_expr => { | |
| 1282 | const nodes = tree.data[data.range.start..data.range.end]; | |
| 1283 | try w.writeByteNTimes(' ', level + 1); | |
| 1284 | try w.writeAll("controlling:\n"); | |
| 1285 | try tree.dumpNode(nodes[0], level + delta, mapper, color, w); | |
| 1286 | try w.writeByteNTimes(' ', level + 1); | |
| 1287 | try w.writeAll("chosen:\n"); | |
| 1288 | try tree.dumpNode(nodes[1], level + delta, mapper, color, w); | |
| 1289 | try w.writeByteNTimes(' ', level + 1); | |
| 1290 | try w.writeAll("rest:\n"); | |
| 1291 | for (nodes[2..]) |expr| { | |
| 1292 | try tree.dumpNode(expr, level + delta, mapper, color, w); | |
| 1293 | } | |
| 1294 | }, | |
| 1295 | .generic_association_expr, .generic_default_expr, .stmt_expr, .imaginary_literal => { | |
| 1296 | try tree.dumpNode(data.un, level + delta, mapper, color, w); | |
| 1297 | }, | |
| 1298 | .array_filler_expr => { | |
| 1299 | try w.writeByteNTimes(' ', level + 1); | |
| 1300 | try w.writeAll("count: "); | |
| 1301 | if (color) util.setColor(LITERAL, w); | |
| 1302 | try w.print("{d}\n", .{data.int}); | |
| 1303 | if (color) util.setColor(.reset, w); | |
| 1304 | }, | |
| 1305 | .struct_forward_decl, | |
| 1306 | .union_forward_decl, | |
| 1307 | .enum_forward_decl, | |
| 1308 | .default_init_expr, | |
| 1309 | .cond_dummy_expr, | |
| 1310 | => {}, | |
| 1311 | } | |
| 1312 | } |
deps/aro/Type.zig created+2692| ... | ... | @@ -0,0 +1,2692 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Tree = @import("Tree.zig"); | |
| 3 | const TokenIndex = Tree.TokenIndex; | |
| 4 | const NodeIndex = Tree.NodeIndex; | |
| 5 | const Parser = @import("Parser.zig"); | |
| 6 | const Compilation = @import("Compilation.zig"); | |
| 7 | const Attribute = @import("Attribute.zig"); | |
| 8 | const StringInterner = @import("StringInterner.zig"); | |
| 9 | const StringId = StringInterner.StringId; | |
| 10 | const target_util = @import("target.zig"); | |
| 11 | const LangOpts = @import("LangOpts.zig"); | |
| 12 | const BuiltinFunction = @import("builtins/BuiltinFunction.zig"); | |
| 13 | ||
| 14 | const Type = @This(); | |
| 15 | ||
| 16 | pub const Qualifiers = packed struct { | |
| 17 | @"const": bool = false, | |
| 18 | atomic: bool = false, | |
| 19 | @"volatile": bool = false, | |
| 20 | restrict: bool = false, | |
| 21 | ||
| 22 | // for function parameters only, stored here since it fits in the padding | |
| 23 | register: bool = false, | |
| 24 | ||
| 25 | pub fn any(quals: Qualifiers) bool { | |
| 26 | return quals.@"const" or quals.restrict or quals.@"volatile" or quals.atomic; | |
| 27 | } | |
| 28 | ||
| 29 | pub fn dump(quals: Qualifiers, w: anytype) !void { | |
| 30 | if (quals.@"const") try w.writeAll("const "); | |
| 31 | if (quals.atomic) try w.writeAll("_Atomic "); | |
| 32 | if (quals.@"volatile") try w.writeAll("volatile "); | |
| 33 | if (quals.restrict) try w.writeAll("restrict "); | |
| 34 | if (quals.register) try w.writeAll("register "); | |
| 35 | } | |
| 36 | ||
| 37 | /// Merge the const/volatile qualifiers, used by type resolution | |
| 38 | /// of the conditional operator | |
| 39 | pub fn mergeCV(a: Qualifiers, b: Qualifiers) Qualifiers { | |
| 40 | return .{ | |
| 41 | .@"const" = a.@"const" or b.@"const", | |
| 42 | .@"volatile" = a.@"volatile" or b.@"volatile", | |
| 43 | }; | |
| 44 | } | |
| 45 | ||
| 46 | /// Merge all qualifiers, used by typeof() | |
| 47 | fn mergeAll(a: Qualifiers, b: Qualifiers) Qualifiers { | |
| 48 | return .{ | |
| 49 | .@"const" = a.@"const" or b.@"const", | |
| 50 | .atomic = a.atomic or b.atomic, | |
| 51 | .@"volatile" = a.@"volatile" or b.@"volatile", | |
| 52 | .restrict = a.restrict or b.restrict, | |
| 53 | .register = a.register or b.register, | |
| 54 | }; | |
| 55 | } | |
| 56 | ||
| 57 | /// Checks if a has all the qualifiers of b | |
| 58 | pub fn hasQuals(a: Qualifiers, b: Qualifiers) bool { | |
| 59 | if (b.@"const" and !a.@"const") return false; | |
| 60 | if (b.@"volatile" and !a.@"volatile") return false; | |
| 61 | if (b.atomic and !a.atomic) return false; | |
| 62 | return true; | |
| 63 | } | |
| 64 | ||
| 65 | /// register is a storage class and not actually a qualifier | |
| 66 | /// so it is not preserved by typeof() | |
| 67 | pub fn inheritFromTypeof(quals: Qualifiers) Qualifiers { | |
| 68 | var res = quals; | |
| 69 | res.register = false; | |
| 70 | return res; | |
| 71 | } | |
| 72 | ||
| 73 | pub const Builder = struct { | |
| 74 | @"const": ?TokenIndex = null, | |
| 75 | atomic: ?TokenIndex = null, | |
| 76 | @"volatile": ?TokenIndex = null, | |
| 77 | restrict: ?TokenIndex = null, | |
| 78 | ||
| 79 | pub fn finish(b: Qualifiers.Builder, p: *Parser, ty: *Type) !void { | |
| 80 | if (ty.specifier != .pointer and b.restrict != null) { | |
| 81 | try p.errStr(.restrict_non_pointer, b.restrict.?, try p.typeStr(ty.*)); | |
| 82 | } | |
| 83 | if (b.atomic) |some| { | |
| 84 | if (ty.isArray()) try p.errStr(.atomic_array, some, try p.typeStr(ty.*)); | |
| 85 | if (ty.isFunc()) try p.errStr(.atomic_func, some, try p.typeStr(ty.*)); | |
| 86 | if (ty.hasIncompleteSize()) try p.errStr(.atomic_incomplete, some, try p.typeStr(ty.*)); | |
| 87 | } | |
| 88 | ||
| 89 | if (b.@"const" != null) ty.qual.@"const" = true; | |
| 90 | if (b.atomic != null) ty.qual.atomic = true; | |
| 91 | if (b.@"volatile" != null) ty.qual.@"volatile" = true; | |
| 92 | if (b.restrict != null) ty.qual.restrict = true; | |
| 93 | } | |
| 94 | }; | |
| 95 | }; | |
| 96 | ||
| 97 | // TODO improve memory usage | |
| 98 | pub const Func = struct { | |
| 99 | return_type: Type, | |
| 100 | params: []Param, | |
| 101 | ||
| 102 | pub const Param = struct { | |
| 103 | ty: Type, | |
| 104 | name: StringId, | |
| 105 | name_tok: TokenIndex, | |
| 106 | }; | |
| 107 | }; | |
| 108 | ||
| 109 | pub const Array = struct { | |
| 110 | len: u64, | |
| 111 | elem: Type, | |
| 112 | }; | |
| 113 | ||
| 114 | pub const Expr = struct { | |
| 115 | node: NodeIndex, | |
| 116 | ty: Type, | |
| 117 | }; | |
| 118 | ||
| 119 | pub const Attributed = struct { | |
| 120 | attributes: []Attribute, | |
| 121 | base: Type, | |
| 122 | ||
| 123 | pub fn create(allocator: std.mem.Allocator, base: Type, existing_attributes: []const Attribute, attributes: []const Attribute) !*Attributed { | |
| 124 | var attributed_type = try allocator.create(Attributed); | |
| 125 | errdefer allocator.destroy(attributed_type); | |
| 126 | ||
| 127 | var all_attrs = try allocator.alloc(Attribute, existing_attributes.len + attributes.len); | |
| 128 | std.mem.copy(Attribute, all_attrs, existing_attributes); | |
| 129 | std.mem.copy(Attribute, all_attrs[existing_attributes.len..], attributes); | |
| 130 | ||
| 131 | attributed_type.* = .{ | |
| 132 | .attributes = all_attrs, | |
| 133 | .base = base, | |
| 134 | }; | |
| 135 | return attributed_type; | |
| 136 | } | |
| 137 | }; | |
| 138 | ||
| 139 | // TODO improve memory usage | |
| 140 | pub const Enum = struct { | |
| 141 | fields: []Field, | |
| 142 | tag_ty: Type, | |
| 143 | name: StringId, | |
| 144 | fixed: bool, | |
| 145 | ||
| 146 | pub const Field = struct { | |
| 147 | ty: Type, | |
| 148 | name: StringId, | |
| 149 | name_tok: TokenIndex, | |
| 150 | node: NodeIndex, | |
| 151 | }; | |
| 152 | ||
| 153 | pub fn isIncomplete(e: Enum) bool { | |
| 154 | return e.fields.len == std.math.maxInt(usize); | |
| 155 | } | |
| 156 | ||
| 157 | pub fn create(allocator: std.mem.Allocator, name: StringId, fixed_ty: ?Type) !*Enum { | |
| 158 | var e = try allocator.create(Enum); | |
| 159 | e.name = name; | |
| 160 | e.fields.len = std.math.maxInt(usize); | |
| 161 | if (fixed_ty) |some| e.tag_ty = some; | |
| 162 | e.fixed = fixed_ty != null; | |
| 163 | return e; | |
| 164 | } | |
| 165 | }; | |
| 166 | ||
| 167 | // might not need all 4 of these when finished, | |
| 168 | // but currently it helps having all 4 when diff-ing | |
| 169 | // the rust code. | |
| 170 | pub const TypeLayout = struct { | |
| 171 | /// The size of the type in bits. | |
| 172 | /// | |
| 173 | /// This is the value returned by `sizeof` and C and `std::mem::size_of` in Rust | |
| 174 | /// (but in bits instead of bytes). This is a multiple of `pointer_alignment_bits`. | |
| 175 | size_bits: u64, | |
| 176 | /// The alignment of the type, in bits, when used as a field in a record. | |
| 177 | /// | |
| 178 | /// This is usually the value returned by `_Alignof` in C, but there are some edge | |
| 179 | /// cases in GCC where `_Alignof` returns a smaller value. | |
| 180 | field_alignment_bits: u32, | |
| 181 | /// The alignment, in bits, of valid pointers to this type. | |
| 182 | /// | |
| 183 | /// This is the value returned by `std::mem::align_of` in Rust | |
| 184 | /// (but in bits instead of bytes). `size_bits` is a multiple of this value. | |
| 185 | pointer_alignment_bits: u32, | |
| 186 | /// The required alignment of the type in bits. | |
| 187 | /// | |
| 188 | /// This value is only used by MSVC targets. It is 8 on all other | |
| 189 | /// targets. On MSVC targets, this value restricts the effects of `#pragma pack` except | |
| 190 | /// in some cases involving bit-fields. | |
| 191 | required_alignment_bits: u32, | |
| 192 | }; | |
| 193 | ||
| 194 | pub const FieldLayout = struct { | |
| 195 | /// `offset_bits` and `size_bits` should both be INVALID if and only if the field | |
| 196 | /// is an unnamed bitfield. There is no way to reference an unnamed bitfield in C, so | |
| 197 | /// there should be no way to observe these values. If it is used, this value will | |
| 198 | /// maximize the chance that a safety-checked overflow will occur. | |
| 199 | const INVALID = std.math.maxInt(u64); | |
| 200 | ||
| 201 | /// The offset of the field, in bits, from the start of the struct. | |
| 202 | offset_bits: u64 = INVALID, | |
| 203 | /// The size, in bits, of the field. | |
| 204 | /// | |
| 205 | /// For bit-fields, this is the width of the field. | |
| 206 | size_bits: u64 = INVALID, | |
| 207 | ||
| 208 | pub fn isUnnamed(self: FieldLayout) bool { | |
| 209 | return self.offset_bits == INVALID and self.size_bits == INVALID; | |
| 210 | } | |
| 211 | }; | |
| 212 | ||
| 213 | // TODO improve memory usage | |
| 214 | pub const Record = struct { | |
| 215 | fields: []Field, | |
| 216 | type_layout: TypeLayout, | |
| 217 | /// If this is null, none of the fields have attributes | |
| 218 | /// Otherwise, it's a pointer to N items (where N == number of fields) | |
| 219 | /// and the item at index i is the attributes for the field at index i | |
| 220 | field_attributes: ?[*][]const Attribute, | |
| 221 | name: StringId, | |
| 222 | ||
| 223 | pub const Field = struct { | |
| 224 | ty: Type, | |
| 225 | name: StringId, | |
| 226 | /// zero for anonymous fields | |
| 227 | name_tok: TokenIndex = 0, | |
| 228 | bit_width: ?u32 = null, | |
| 229 | layout: FieldLayout = .{ | |
| 230 | .offset_bits = 0, | |
| 231 | .size_bits = 0, | |
| 232 | }, | |
| 233 | ||
| 234 | pub fn isNamed(f: *const Field) bool { | |
| 235 | return f.name_tok != 0; | |
| 236 | } | |
| 237 | ||
| 238 | pub fn isAnonymousRecord(f: Field) bool { | |
| 239 | return !f.isNamed() and f.ty.isRecord(); | |
| 240 | } | |
| 241 | ||
| 242 | /// false for bitfields | |
| 243 | pub fn isRegularField(f: *const Field) bool { | |
| 244 | return f.bit_width == null; | |
| 245 | } | |
| 246 | ||
| 247 | /// bit width as specified in the C source. Asserts that `f` is a bitfield. | |
| 248 | pub fn specifiedBitWidth(f: *const Field) u32 { | |
| 249 | return f.bit_width.?; | |
| 250 | } | |
| 251 | }; | |
| 252 | ||
| 253 | pub fn isIncomplete(r: Record) bool { | |
| 254 | return r.fields.len == std.math.maxInt(usize); | |
| 255 | } | |
| 256 | ||
| 257 | pub fn create(allocator: std.mem.Allocator, name: StringId) !*Record { | |
| 258 | var r = try allocator.create(Record); | |
| 259 | r.name = name; | |
| 260 | r.fields.len = std.math.maxInt(usize); | |
| 261 | r.field_attributes = null; | |
| 262 | r.type_layout = .{ | |
| 263 | .size_bits = 8, | |
| 264 | .field_alignment_bits = 8, | |
| 265 | .pointer_alignment_bits = 8, | |
| 266 | .required_alignment_bits = 8, | |
| 267 | }; | |
| 268 | return r; | |
| 269 | } | |
| 270 | ||
| 271 | pub fn hasFieldOfType(self: *const Record, ty: Type, comp: *const Compilation) bool { | |
| 272 | if (self.isIncomplete()) return false; | |
| 273 | for (self.fields) |f| { | |
| 274 | if (ty.eql(f.ty, comp, false)) return true; | |
| 275 | } | |
| 276 | return false; | |
| 277 | } | |
| 278 | }; | |
| 279 | ||
| 280 | pub const Specifier = enum { | |
| 281 | /// A NaN-like poison value | |
| 282 | invalid, | |
| 283 | ||
| 284 | /// GNU auto type | |
| 285 | /// This is a placeholder specifier - it must be replaced by the actual type specifier (determined by the initializer) | |
| 286 | auto_type, | |
| 287 | ||
| 288 | void, | |
| 289 | bool, | |
| 290 | ||
| 291 | // integers | |
| 292 | char, | |
| 293 | schar, | |
| 294 | uchar, | |
| 295 | short, | |
| 296 | ushort, | |
| 297 | int, | |
| 298 | uint, | |
| 299 | long, | |
| 300 | ulong, | |
| 301 | long_long, | |
| 302 | ulong_long, | |
| 303 | int128, | |
| 304 | uint128, | |
| 305 | complex_char, | |
| 306 | complex_schar, | |
| 307 | complex_uchar, | |
| 308 | complex_short, | |
| 309 | complex_ushort, | |
| 310 | complex_int, | |
| 311 | complex_uint, | |
| 312 | complex_long, | |
| 313 | complex_ulong, | |
| 314 | complex_long_long, | |
| 315 | complex_ulong_long, | |
| 316 | complex_int128, | |
| 317 | complex_uint128, | |
| 318 | ||
| 319 | // data.int | |
| 320 | bit_int, | |
| 321 | complex_bit_int, | |
| 322 | ||
| 323 | // floating point numbers | |
| 324 | fp16, | |
| 325 | float16, | |
| 326 | float, | |
| 327 | double, | |
| 328 | long_double, | |
| 329 | float80, | |
| 330 | float128, | |
| 331 | complex_float, | |
| 332 | complex_double, | |
| 333 | complex_long_double, | |
| 334 | complex_float80, | |
| 335 | complex_float128, | |
| 336 | ||
| 337 | // data.sub_type | |
| 338 | pointer, | |
| 339 | unspecified_variable_len_array, | |
| 340 | decayed_unspecified_variable_len_array, | |
| 341 | // data.func | |
| 342 | /// int foo(int bar, char baz) and int (void) | |
| 343 | func, | |
| 344 | /// int foo(int bar, char baz, ...) | |
| 345 | var_args_func, | |
| 346 | /// int foo(bar, baz) and int foo() | |
| 347 | /// is also var args, but we can give warnings about incorrect amounts of parameters | |
| 348 | old_style_func, | |
| 349 | ||
| 350 | // data.array | |
| 351 | array, | |
| 352 | decayed_array, | |
| 353 | static_array, | |
| 354 | decayed_static_array, | |
| 355 | incomplete_array, | |
| 356 | decayed_incomplete_array, | |
| 357 | vector, | |
| 358 | // data.expr | |
| 359 | variable_len_array, | |
| 360 | decayed_variable_len_array, | |
| 361 | ||
| 362 | // data.record | |
| 363 | @"struct", | |
| 364 | @"union", | |
| 365 | ||
| 366 | // data.enum | |
| 367 | @"enum", | |
| 368 | ||
| 369 | /// typeof(type-name) | |
| 370 | typeof_type, | |
| 371 | /// decayed array created with typeof(type-name) | |
| 372 | decayed_typeof_type, | |
| 373 | ||
| 374 | /// typeof(expression) | |
| 375 | typeof_expr, | |
| 376 | /// decayed array created with typeof(expression) | |
| 377 | decayed_typeof_expr, | |
| 378 | ||
| 379 | /// data.attributed | |
| 380 | attributed, | |
| 381 | ||
| 382 | /// C23 nullptr_t | |
| 383 | nullptr_t, | |
| 384 | }; | |
| 385 | ||
| 386 | /// All fields of Type except data may be mutated | |
| 387 | data: union { | |
| 388 | sub_type: *Type, | |
| 389 | func: *Func, | |
| 390 | array: *Array, | |
| 391 | expr: *Expr, | |
| 392 | @"enum": *Enum, | |
| 393 | record: *Record, | |
| 394 | attributed: *Attributed, | |
| 395 | none: void, | |
| 396 | int: struct { | |
| 397 | bits: u8, | |
| 398 | signedness: std.builtin.Signedness, | |
| 399 | }, | |
| 400 | } = .{ .none = {} }, | |
| 401 | specifier: Specifier, | |
| 402 | qual: Qualifiers = .{}, | |
| 403 | ||
| 404 | pub const int = Type{ .specifier = .int }; | |
| 405 | pub const invalid = Type{ .specifier = .invalid }; | |
| 406 | ||
| 407 | /// Determine if type matches the given specifier, recursing into typeof | |
| 408 | /// types if necessary. | |
| 409 | pub fn is(ty: Type, specifier: Specifier) bool { | |
| 410 | std.debug.assert(specifier != .typeof_type and specifier != .typeof_expr); | |
| 411 | return ty.get(specifier) != null; | |
| 412 | } | |
| 413 | ||
| 414 | pub fn withAttributes(self: Type, allocator: std.mem.Allocator, attributes: []const Attribute) !Type { | |
| 415 | if (attributes.len == 0) return self; | |
| 416 | const attributed_type = try Type.Attributed.create(allocator, self, self.getAttributes(), attributes); | |
| 417 | return Type{ .specifier = .attributed, .data = .{ .attributed = attributed_type } }; | |
| 418 | } | |
| 419 | ||
| 420 | pub fn isCallable(ty: Type) ?Type { | |
| 421 | return switch (ty.specifier) { | |
| 422 | .func, .var_args_func, .old_style_func => ty, | |
| 423 | .pointer => if (ty.data.sub_type.isFunc()) ty.data.sub_type.* else null, | |
| 424 | .typeof_type => ty.data.sub_type.isCallable(), | |
| 425 | .typeof_expr => ty.data.expr.ty.isCallable(), | |
| 426 | .attributed => ty.data.attributed.base.isCallable(), | |
| 427 | else => null, | |
| 428 | }; | |
| 429 | } | |
| 430 | ||
| 431 | pub fn isFunc(ty: Type) bool { | |
| 432 | return switch (ty.specifier) { | |
| 433 | .func, .var_args_func, .old_style_func => true, | |
| 434 | .typeof_type => ty.data.sub_type.isFunc(), | |
| 435 | .typeof_expr => ty.data.expr.ty.isFunc(), | |
| 436 | .attributed => ty.data.attributed.base.isFunc(), | |
| 437 | else => false, | |
| 438 | }; | |
| 439 | } | |
| 440 | ||
| 441 | pub fn isArray(ty: Type) bool { | |
| 442 | return switch (ty.specifier) { | |
| 443 | .array, .static_array, .incomplete_array, .variable_len_array, .unspecified_variable_len_array => true, | |
| 444 | .typeof_type => ty.data.sub_type.isArray(), | |
| 445 | .typeof_expr => ty.data.expr.ty.isArray(), | |
| 446 | .attributed => ty.data.attributed.base.isArray(), | |
| 447 | else => false, | |
| 448 | }; | |
| 449 | } | |
| 450 | ||
| 451 | pub fn isScalar(ty: Type) bool { | |
| 452 | return ty.isInt() or ty.isScalarNonInt(); | |
| 453 | } | |
| 454 | ||
| 455 | /// To avoid calling isInt() twice for allowable loop/if controlling expressions | |
| 456 | pub fn isScalarNonInt(ty: Type) bool { | |
| 457 | return ty.isFloat() or ty.isPtr() or ty.is(.nullptr_t); | |
| 458 | } | |
| 459 | ||
| 460 | pub fn isDecayed(ty: Type) bool { | |
| 461 | const decayed = switch (ty.specifier) { | |
| 462 | .decayed_array, | |
| 463 | .decayed_static_array, | |
| 464 | .decayed_incomplete_array, | |
| 465 | .decayed_variable_len_array, | |
| 466 | .decayed_unspecified_variable_len_array, | |
| 467 | .decayed_typeof_type, | |
| 468 | .decayed_typeof_expr, | |
| 469 | => true, | |
| 470 | else => false, | |
| 471 | }; | |
| 472 | std.debug.assert(decayed or !std.mem.startsWith(u8, @tagName(ty.specifier), "decayed")); | |
| 473 | return decayed; | |
| 474 | } | |
| 475 | ||
| 476 | pub fn isPtr(ty: Type) bool { | |
| 477 | return switch (ty.specifier) { | |
| 478 | .pointer, | |
| 479 | .decayed_array, | |
| 480 | .decayed_static_array, | |
| 481 | .decayed_incomplete_array, | |
| 482 | .decayed_variable_len_array, | |
| 483 | .decayed_unspecified_variable_len_array, | |
| 484 | .decayed_typeof_type, | |
| 485 | .decayed_typeof_expr, | |
| 486 | => true, | |
| 487 | .typeof_type => ty.data.sub_type.isPtr(), | |
| 488 | .typeof_expr => ty.data.expr.ty.isPtr(), | |
| 489 | .attributed => ty.data.attributed.base.isPtr(), | |
| 490 | else => false, | |
| 491 | }; | |
| 492 | } | |
| 493 | ||
| 494 | pub fn isInt(ty: Type) bool { | |
| 495 | return switch (ty.specifier) { | |
| 496 | // zig fmt: off | |
| 497 | .@"enum", .bool, .char, .schar, .uchar, .short, .ushort, .int, .uint, .long, .ulong, | |
| 498 | .long_long, .ulong_long, .int128, .uint128, .complex_char, .complex_schar, .complex_uchar, | |
| 499 | .complex_short, .complex_ushort, .complex_int, .complex_uint, .complex_long, .complex_ulong, | |
| 500 | .complex_long_long, .complex_ulong_long, .complex_int128, .complex_uint128, | |
| 501 | .bit_int, .complex_bit_int => true, | |
| 502 | // zig fmt: on | |
| 503 | .typeof_type => ty.data.sub_type.isInt(), | |
| 504 | .typeof_expr => ty.data.expr.ty.isInt(), | |
| 505 | .attributed => ty.data.attributed.base.isInt(), | |
| 506 | else => false, | |
| 507 | }; | |
| 508 | } | |
| 509 | ||
| 510 | pub fn isFloat(ty: Type) bool { | |
| 511 | return switch (ty.specifier) { | |
| 512 | // zig fmt: off | |
| 513 | .float, .double, .long_double, .complex_float, .complex_double, .complex_long_double, | |
| 514 | .fp16, .float16, .float80, .float128, .complex_float80, .complex_float128 => true, | |
| 515 | // zig fmt: on | |
| 516 | .typeof_type => ty.data.sub_type.isFloat(), | |
| 517 | .typeof_expr => ty.data.expr.ty.isFloat(), | |
| 518 | .attributed => ty.data.attributed.base.isFloat(), | |
| 519 | else => false, | |
| 520 | }; | |
| 521 | } | |
| 522 | ||
| 523 | pub fn isReal(ty: Type) bool { | |
| 524 | return switch (ty.specifier) { | |
| 525 | // zig fmt: off | |
| 526 | .complex_float, .complex_double, .complex_long_double, .complex_float80, | |
| 527 | .complex_float128, .complex_char, .complex_schar, .complex_uchar, .complex_short, | |
| 528 | .complex_ushort, .complex_int, .complex_uint, .complex_long, .complex_ulong, | |
| 529 | .complex_long_long, .complex_ulong_long, .complex_int128, .complex_uint128, | |
| 530 | .complex_bit_int => false, | |
| 531 | // zig fmt: on | |
| 532 | .typeof_type => ty.data.sub_type.isReal(), | |
| 533 | .typeof_expr => ty.data.expr.ty.isReal(), | |
| 534 | .attributed => ty.data.attributed.base.isReal(), | |
| 535 | else => true, | |
| 536 | }; | |
| 537 | } | |
| 538 | ||
| 539 | pub fn isComplex(ty: Type) bool { | |
| 540 | return switch (ty.specifier) { | |
| 541 | // zig fmt: off | |
| 542 | .complex_float, .complex_double, .complex_long_double, .complex_float80, | |
| 543 | .complex_float128, .complex_char, .complex_schar, .complex_uchar, .complex_short, | |
| 544 | .complex_ushort, .complex_int, .complex_uint, .complex_long, .complex_ulong, | |
| 545 | .complex_long_long, .complex_ulong_long, .complex_int128, .complex_uint128, | |
| 546 | .complex_bit_int => true, | |
| 547 | // zig fmt: on | |
| 548 | .typeof_type => ty.data.sub_type.isComplex(), | |
| 549 | .typeof_expr => ty.data.expr.ty.isComplex(), | |
| 550 | .attributed => ty.data.attributed.base.isComplex(), | |
| 551 | else => false, | |
| 552 | }; | |
| 553 | } | |
| 554 | ||
| 555 | pub fn isVoidStar(ty: Type) bool { | |
| 556 | return switch (ty.specifier) { | |
| 557 | .pointer => ty.data.sub_type.specifier == .void, | |
| 558 | .typeof_type => ty.data.sub_type.isVoidStar(), | |
| 559 | .typeof_expr => ty.data.expr.ty.isVoidStar(), | |
| 560 | .attributed => ty.data.attributed.base.isVoidStar(), | |
| 561 | else => false, | |
| 562 | }; | |
| 563 | } | |
| 564 | ||
| 565 | pub fn isTypeof(ty: Type) bool { | |
| 566 | return switch (ty.specifier) { | |
| 567 | .typeof_type, .typeof_expr, .decayed_typeof_type, .decayed_typeof_expr => true, | |
| 568 | else => false, | |
| 569 | }; | |
| 570 | } | |
| 571 | ||
| 572 | pub fn isConst(ty: Type) bool { | |
| 573 | return switch (ty.specifier) { | |
| 574 | .typeof_type, .decayed_typeof_type => ty.qual.@"const" or ty.data.sub_type.isConst(), | |
| 575 | .typeof_expr, .decayed_typeof_expr => ty.qual.@"const" or ty.data.expr.ty.isConst(), | |
| 576 | .attributed => ty.data.attributed.base.isConst(), | |
| 577 | else => ty.qual.@"const", | |
| 578 | }; | |
| 579 | } | |
| 580 | ||
| 581 | pub fn isUnsignedInt(ty: Type, comp: *const Compilation) bool { | |
| 582 | return switch (ty.specifier) { | |
| 583 | // zig fmt: off | |
| 584 | .char, .complex_char => return comp.getCharSignedness() == .unsigned, | |
| 585 | .uchar, .ushort, .uint, .ulong, .ulong_long, .bool, .complex_uchar, .complex_ushort, | |
| 586 | .complex_uint, .complex_ulong, .complex_ulong_long, .complex_uint128 => true, | |
| 587 | // zig fmt: on | |
| 588 | .bit_int, .complex_bit_int => return ty.data.int.signedness == .unsigned, | |
| 589 | .typeof_type => ty.data.sub_type.isUnsignedInt(comp), | |
| 590 | .typeof_expr => ty.data.expr.ty.isUnsignedInt(comp), | |
| 591 | .attributed => ty.data.attributed.base.isUnsignedInt(comp), | |
| 592 | else => false, | |
| 593 | }; | |
| 594 | } | |
| 595 | ||
| 596 | pub fn isEnumOrRecord(ty: Type) bool { | |
| 597 | return switch (ty.specifier) { | |
| 598 | .@"enum", .@"struct", .@"union" => true, | |
| 599 | .typeof_type => ty.data.sub_type.isEnumOrRecord(), | |
| 600 | .typeof_expr => ty.data.expr.ty.isEnumOrRecord(), | |
| 601 | .attributed => ty.data.attributed.base.isEnumOrRecord(), | |
| 602 | else => false, | |
| 603 | }; | |
| 604 | } | |
| 605 | ||
| 606 | pub fn isRecord(ty: Type) bool { | |
| 607 | return switch (ty.specifier) { | |
| 608 | .@"struct", .@"union" => true, | |
| 609 | .typeof_type => ty.data.sub_type.isRecord(), | |
| 610 | .typeof_expr => ty.data.expr.ty.isRecord(), | |
| 611 | .attributed => ty.data.attributed.base.isRecord(), | |
| 612 | else => false, | |
| 613 | }; | |
| 614 | } | |
| 615 | ||
| 616 | pub fn isAnonymousRecord(ty: Type, comp: *const Compilation) bool { | |
| 617 | return switch (ty.specifier) { | |
| 618 | // anonymous records can be recognized by their names which are in | |
| 619 | // the format "(anonymous TAG at path:line:col)". | |
| 620 | .@"struct", .@"union" => { | |
| 621 | const mapper = comp.string_interner.getSlowTypeMapper(); | |
| 622 | return mapper.lookup(ty.data.record.name)[0] == '('; | |
| 623 | }, | |
| 624 | .typeof_type => ty.data.sub_type.isAnonymousRecord(comp), | |
| 625 | .typeof_expr => ty.data.expr.ty.isAnonymousRecord(comp), | |
| 626 | .attributed => ty.data.attributed.base.isAnonymousRecord(comp), | |
| 627 | else => false, | |
| 628 | }; | |
| 629 | } | |
| 630 | ||
| 631 | pub fn elemType(ty: Type) Type { | |
| 632 | return switch (ty.specifier) { | |
| 633 | .pointer, .unspecified_variable_len_array, .decayed_unspecified_variable_len_array => ty.data.sub_type.*, | |
| 634 | .array, .static_array, .incomplete_array, .decayed_array, .decayed_static_array, .decayed_incomplete_array, .vector => ty.data.array.elem, | |
| 635 | .variable_len_array, .decayed_variable_len_array => ty.data.expr.ty, | |
| 636 | .typeof_type, .decayed_typeof_type, .typeof_expr, .decayed_typeof_expr => { | |
| 637 | const unwrapped = ty.canonicalize(.preserve_quals); | |
| 638 | var elem = unwrapped.elemType(); | |
| 639 | elem.qual = elem.qual.mergeAll(unwrapped.qual); | |
| 640 | return elem; | |
| 641 | }, | |
| 642 | .attributed => ty.data.attributed.base, | |
| 643 | .invalid => Type.invalid, | |
| 644 | // zig fmt: off | |
| 645 | .complex_float, .complex_double, .complex_long_double, .complex_float80, | |
| 646 | .complex_float128, .complex_char, .complex_schar, .complex_uchar, .complex_short, | |
| 647 | .complex_ushort, .complex_int, .complex_uint, .complex_long, .complex_ulong, | |
| 648 | .complex_long_long, .complex_ulong_long, .complex_int128, .complex_uint128, | |
| 649 | .complex_bit_int => ty.makeReal(), | |
| 650 | // zig fmt: on | |
| 651 | else => unreachable, | |
| 652 | }; | |
| 653 | } | |
| 654 | ||
| 655 | pub fn returnType(ty: Type) Type { | |
| 656 | return switch (ty.specifier) { | |
| 657 | .func, .var_args_func, .old_style_func => ty.data.func.return_type, | |
| 658 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.returnType(), | |
| 659 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.returnType(), | |
| 660 | .attributed => ty.data.attributed.base.returnType(), | |
| 661 | .invalid => Type.invalid, | |
| 662 | else => unreachable, | |
| 663 | }; | |
| 664 | } | |
| 665 | ||
| 666 | pub fn params(ty: Type) []Func.Param { | |
| 667 | return switch (ty.specifier) { | |
| 668 | .func, .var_args_func, .old_style_func => ty.data.func.params, | |
| 669 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.params(), | |
| 670 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.params(), | |
| 671 | .attributed => ty.data.attributed.base.params(), | |
| 672 | .invalid => &.{}, | |
| 673 | else => unreachable, | |
| 674 | }; | |
| 675 | } | |
| 676 | ||
| 677 | pub fn arrayLen(ty: Type) ?u64 { | |
| 678 | return switch (ty.specifier) { | |
| 679 | .array, .static_array, .decayed_array, .decayed_static_array => ty.data.array.len, | |
| 680 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.arrayLen(), | |
| 681 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.arrayLen(), | |
| 682 | .attributed => ty.data.attributed.base.arrayLen(), | |
| 683 | else => null, | |
| 684 | }; | |
| 685 | } | |
| 686 | ||
| 687 | /// Complex numbers are scalars but they can be initialized with a 2-element initList | |
| 688 | pub fn expectedInitListSize(ty: Type) ?u64 { | |
| 689 | return if (ty.isComplex()) 2 else ty.arrayLen(); | |
| 690 | } | |
| 691 | ||
| 692 | pub fn anyQual(ty: Type) bool { | |
| 693 | return switch (ty.specifier) { | |
| 694 | .typeof_type => ty.qual.any() or ty.data.sub_type.anyQual(), | |
| 695 | .typeof_expr => ty.qual.any() or ty.data.expr.ty.anyQual(), | |
| 696 | else => ty.qual.any(), | |
| 697 | }; | |
| 698 | } | |
| 699 | ||
| 700 | pub fn getAttributes(ty: Type) []const Attribute { | |
| 701 | return switch (ty.specifier) { | |
| 702 | .attributed => ty.data.attributed.attributes, | |
| 703 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.getAttributes(), | |
| 704 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.getAttributes(), | |
| 705 | else => &.{}, | |
| 706 | }; | |
| 707 | } | |
| 708 | ||
| 709 | pub fn getRecord(ty: Type) ?*const Type.Record { | |
| 710 | return switch (ty.specifier) { | |
| 711 | .attributed => ty.data.attributed.base.getRecord(), | |
| 712 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.getRecord(), | |
| 713 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.getRecord(), | |
| 714 | .@"struct", .@"union" => ty.data.record, | |
| 715 | else => null, | |
| 716 | }; | |
| 717 | } | |
| 718 | ||
| 719 | fn compareIntegerRanks(a: Type, b: Type, comp: *const Compilation) std.math.Order { | |
| 720 | std.debug.assert(a.isInt() and b.isInt()); | |
| 721 | if (a.eql(b, comp, false)) return .eq; | |
| 722 | ||
| 723 | const a_unsigned = a.isUnsignedInt(comp); | |
| 724 | const b_unsigned = b.isUnsignedInt(comp); | |
| 725 | ||
| 726 | const a_rank = a.integerRank(comp); | |
| 727 | const b_rank = b.integerRank(comp); | |
| 728 | if (a_unsigned == b_unsigned) { | |
| 729 | return std.math.order(a_rank, b_rank); | |
| 730 | } | |
| 731 | if (a_unsigned) { | |
| 732 | if (a_rank >= b_rank) return .gt; | |
| 733 | return .lt; | |
| 734 | } | |
| 735 | std.debug.assert(b_unsigned); | |
| 736 | if (b_rank >= a_rank) return .lt; | |
| 737 | return .gt; | |
| 738 | } | |
| 739 | ||
| 740 | fn realIntegerConversion(a: Type, b: Type, comp: *const Compilation) Type { | |
| 741 | std.debug.assert(a.isReal() and b.isReal()); | |
| 742 | const type_order = a.compareIntegerRanks(b, comp); | |
| 743 | const a_signed = !a.isUnsignedInt(comp); | |
| 744 | const b_signed = !b.isUnsignedInt(comp); | |
| 745 | if (a_signed == b_signed) { | |
| 746 | // If both have the same sign, use higher-rank type. | |
| 747 | return switch (type_order) { | |
| 748 | .lt => b, | |
| 749 | .eq, .gt => a, | |
| 750 | }; | |
| 751 | } else if (type_order != if (a_signed) std.math.Order.gt else std.math.Order.lt) { | |
| 752 | // Only one is signed; and the unsigned type has rank >= the signed type | |
| 753 | // Use the unsigned type | |
| 754 | return if (b_signed) a else b; | |
| 755 | } else if (a.bitSizeof(comp).? != b.bitSizeof(comp).?) { | |
| 756 | // Signed type is higher rank and sizes are not equal | |
| 757 | // Use the signed type | |
| 758 | return if (a_signed) a else b; | |
| 759 | } else { | |
| 760 | // Signed type is higher rank but same size as unsigned type | |
| 761 | // e.g. `long` and `unsigned` on x86-linux-gnu | |
| 762 | // Use unsigned version of the signed type | |
| 763 | return if (a_signed) a.makeIntegerUnsigned() else b.makeIntegerUnsigned(); | |
| 764 | } | |
| 765 | } | |
| 766 | ||
| 767 | pub fn makeIntegerUnsigned(ty: Type) Type { | |
| 768 | // TODO discards attributed/typeof | |
| 769 | var base = ty.canonicalize(.standard); | |
| 770 | switch (base.specifier) { | |
| 771 | // zig fmt: off | |
| 772 | .uchar, .ushort, .uint, .ulong, .ulong_long, .uint128, | |
| 773 | .complex_uchar, .complex_ushort, .complex_uint, .complex_ulong, .complex_ulong_long, .complex_uint128, | |
| 774 | => return ty, | |
| 775 | // zig fmt: on | |
| 776 | ||
| 777 | .char, .complex_char => { | |
| 778 | base.specifier = @enumFromInt(@intFromEnum(base.specifier) + 2); | |
| 779 | return base; | |
| 780 | }, | |
| 781 | ||
| 782 | // zig fmt: off | |
| 783 | .schar, .short, .int, .long, .long_long, .int128, | |
| 784 | .complex_schar, .complex_short, .complex_int, .complex_long, .complex_long_long, .complex_int128 => { | |
| 785 | base.specifier = @enumFromInt(@intFromEnum(base.specifier) + 1); | |
| 786 | return base; | |
| 787 | }, | |
| 788 | // zig fmt: on | |
| 789 | ||
| 790 | .bit_int, .complex_bit_int => { | |
| 791 | base.data.int.signedness = .unsigned; | |
| 792 | return base; | |
| 793 | }, | |
| 794 | else => unreachable, | |
| 795 | } | |
| 796 | } | |
| 797 | ||
| 798 | /// Find the common type of a and b for binary operations | |
| 799 | pub fn integerConversion(a: Type, b: Type, comp: *const Compilation) Type { | |
| 800 | const a_real = a.isReal(); | |
| 801 | const b_real = b.isReal(); | |
| 802 | const target_ty = a.makeReal().realIntegerConversion(b.makeReal(), comp); | |
| 803 | return if (a_real and b_real) target_ty else target_ty.makeComplex(); | |
| 804 | } | |
| 805 | ||
| 806 | pub fn integerPromotion(ty: Type, comp: *Compilation) Type { | |
| 807 | var specifier = ty.specifier; | |
| 808 | switch (specifier) { | |
| 809 | .@"enum" => { | |
| 810 | if (ty.hasIncompleteSize()) return .{ .specifier = .int }; | |
| 811 | specifier = ty.data.@"enum".tag_ty.specifier; | |
| 812 | }, | |
| 813 | .bit_int, .complex_bit_int => return .{ .specifier = specifier, .data = ty.data }, | |
| 814 | else => {}, | |
| 815 | } | |
| 816 | return switch (specifier) { | |
| 817 | else => .{ | |
| 818 | .specifier = switch (specifier) { | |
| 819 | // zig fmt: off | |
| 820 | .bool, .char, .schar, .uchar, .short => .int, | |
| 821 | .ushort => if (ty.sizeof(comp).? == sizeof(.{ .specifier = .int }, comp)) Specifier.uint else .int, | |
| 822 | .int, .uint, .long, .ulong, .long_long, .ulong_long, .int128, .uint128, .complex_char, | |
| 823 | .complex_schar, .complex_uchar, .complex_short, .complex_ushort, .complex_int, | |
| 824 | .complex_uint, .complex_long, .complex_ulong, .complex_long_long, .complex_ulong_long, | |
| 825 | .complex_int128, .complex_uint128 => specifier, | |
| 826 | // zig fmt: on | |
| 827 | .typeof_type => return ty.data.sub_type.integerPromotion(comp), | |
| 828 | .typeof_expr => return ty.data.expr.ty.integerPromotion(comp), | |
| 829 | .attributed => return ty.data.attributed.base.integerPromotion(comp), | |
| 830 | .invalid => .invalid, | |
| 831 | else => unreachable, // _BitInt, or not an integer type | |
| 832 | }, | |
| 833 | }, | |
| 834 | }; | |
| 835 | } | |
| 836 | ||
| 837 | /// Promote a bitfield. If `int` can hold all the values of the underlying field, | |
| 838 | /// promote to int. Otherwise, promote to unsigned int | |
| 839 | /// Returns null if no promotion is necessary | |
| 840 | pub fn bitfieldPromotion(ty: Type, comp: *Compilation, width: u32) ?Type { | |
| 841 | const type_size_bits = ty.bitSizeof(comp).?; | |
| 842 | ||
| 843 | // Note: GCC and clang will promote `long: 3` to int even though the C standard does not allow this | |
| 844 | if (width < type_size_bits) { | |
| 845 | return int; | |
| 846 | } | |
| 847 | ||
| 848 | if (width == type_size_bits) { | |
| 849 | return if (ty.isUnsignedInt(comp)) .{ .specifier = .uint } else int; | |
| 850 | } | |
| 851 | ||
| 852 | return null; | |
| 853 | } | |
| 854 | ||
| 855 | pub fn hasIncompleteSize(ty: Type) bool { | |
| 856 | return switch (ty.specifier) { | |
| 857 | .void, .incomplete_array, .invalid => true, | |
| 858 | .@"enum" => ty.data.@"enum".isIncomplete() and !ty.data.@"enum".fixed, | |
| 859 | .@"struct", .@"union" => ty.data.record.isIncomplete(), | |
| 860 | .array, .static_array => ty.data.array.elem.hasIncompleteSize(), | |
| 861 | .typeof_type => ty.data.sub_type.hasIncompleteSize(), | |
| 862 | .typeof_expr => ty.data.expr.ty.hasIncompleteSize(), | |
| 863 | .attributed => ty.data.attributed.base.hasIncompleteSize(), | |
| 864 | else => false, | |
| 865 | }; | |
| 866 | } | |
| 867 | ||
| 868 | pub fn hasUnboundVLA(ty: Type) bool { | |
| 869 | var cur = ty; | |
| 870 | while (true) { | |
| 871 | switch (cur.specifier) { | |
| 872 | .unspecified_variable_len_array, | |
| 873 | .decayed_unspecified_variable_len_array, | |
| 874 | => return true, | |
| 875 | .array, | |
| 876 | .static_array, | |
| 877 | .incomplete_array, | |
| 878 | .variable_len_array, | |
| 879 | .decayed_array, | |
| 880 | .decayed_static_array, | |
| 881 | .decayed_incomplete_array, | |
| 882 | .decayed_variable_len_array, | |
| 883 | => cur = cur.elemType(), | |
| 884 | .typeof_type, .decayed_typeof_type => cur = cur.data.sub_type.*, | |
| 885 | .typeof_expr, .decayed_typeof_expr => cur = cur.data.expr.ty, | |
| 886 | .attributed => cur = cur.data.attributed.base, | |
| 887 | else => return false, | |
| 888 | } | |
| 889 | } | |
| 890 | } | |
| 891 | ||
| 892 | pub fn hasField(ty: Type, name: StringId) bool { | |
| 893 | switch (ty.specifier) { | |
| 894 | .@"struct" => { | |
| 895 | std.debug.assert(!ty.data.record.isIncomplete()); | |
| 896 | for (ty.data.record.fields) |f| { | |
| 897 | if (f.isAnonymousRecord() and f.ty.hasField(name)) return true; | |
| 898 | if (name == f.name) return true; | |
| 899 | } | |
| 900 | }, | |
| 901 | .@"union" => { | |
| 902 | std.debug.assert(!ty.data.record.isIncomplete()); | |
| 903 | for (ty.data.record.fields) |f| { | |
| 904 | if (f.isAnonymousRecord() and f.ty.hasField(name)) return true; | |
| 905 | if (name == f.name) return true; | |
| 906 | } | |
| 907 | }, | |
| 908 | .typeof_type => return ty.data.sub_type.hasField(name), | |
| 909 | .typeof_expr => return ty.data.expr.ty.hasField(name), | |
| 910 | .attributed => return ty.data.attributed.base.hasField(name), | |
| 911 | .invalid => return false, | |
| 912 | else => unreachable, | |
| 913 | } | |
| 914 | return false; | |
| 915 | } | |
| 916 | ||
| 917 | pub fn minInt(ty: Type, comp: *const Compilation) i64 { | |
| 918 | std.debug.assert(ty.isInt()); | |
| 919 | if (ty.isUnsignedInt(comp)) return 0; | |
| 920 | return switch (ty.sizeof(comp).?) { | |
| 921 | 1 => std.math.minInt(i8), | |
| 922 | 2 => std.math.minInt(i16), | |
| 923 | 4 => std.math.minInt(i32), | |
| 924 | 8 => std.math.minInt(i64), | |
| 925 | else => unreachable, | |
| 926 | }; | |
| 927 | } | |
| 928 | ||
| 929 | pub fn maxInt(ty: Type, comp: *const Compilation) u64 { | |
| 930 | std.debug.assert(ty.isInt()); | |
| 931 | return switch (ty.sizeof(comp).?) { | |
| 932 | 1 => if (ty.isUnsignedInt(comp)) @as(u64, std.math.maxInt(u8)) else std.math.maxInt(i8), | |
| 933 | 2 => if (ty.isUnsignedInt(comp)) @as(u64, std.math.maxInt(u16)) else std.math.maxInt(i16), | |
| 934 | 4 => if (ty.isUnsignedInt(comp)) @as(u64, std.math.maxInt(u32)) else std.math.maxInt(i32), | |
| 935 | 8 => if (ty.isUnsignedInt(comp)) @as(u64, std.math.maxInt(u64)) else std.math.maxInt(i64), | |
| 936 | else => unreachable, | |
| 937 | }; | |
| 938 | } | |
| 939 | ||
| 940 | const TypeSizeOrder = enum { | |
| 941 | lt, | |
| 942 | gt, | |
| 943 | eq, | |
| 944 | indeterminate, | |
| 945 | }; | |
| 946 | ||
| 947 | pub fn sizeCompare(a: Type, b: Type, comp: *Compilation) TypeSizeOrder { | |
| 948 | const a_size = a.sizeof(comp) orelse return .indeterminate; | |
| 949 | const b_size = b.sizeof(comp) orelse return .indeterminate; | |
| 950 | return switch (std.math.order(a_size, b_size)) { | |
| 951 | .lt => .lt, | |
| 952 | .gt => .gt, | |
| 953 | .eq => .eq, | |
| 954 | }; | |
| 955 | } | |
| 956 | ||
| 957 | /// Size of type as reported by sizeof | |
| 958 | pub fn sizeof(ty: Type, comp: *const Compilation) ?u64 { | |
| 959 | return switch (ty.specifier) { | |
| 960 | .auto_type => unreachable, | |
| 961 | .variable_len_array, .unspecified_variable_len_array => return null, | |
| 962 | .incomplete_array => return if (comp.langopts.emulate == .msvc) @as(?u64, 0) else null, | |
| 963 | .func, .var_args_func, .old_style_func, .void, .bool => 1, | |
| 964 | .char, .schar, .uchar => 1, | |
| 965 | .short => comp.target.c_type_byte_size(.short), | |
| 966 | .ushort => comp.target.c_type_byte_size(.ushort), | |
| 967 | .int => comp.target.c_type_byte_size(.int), | |
| 968 | .uint => comp.target.c_type_byte_size(.uint), | |
| 969 | .long => comp.target.c_type_byte_size(.long), | |
| 970 | .ulong => comp.target.c_type_byte_size(.ulong), | |
| 971 | .long_long => comp.target.c_type_byte_size(.longlong), | |
| 972 | .ulong_long => comp.target.c_type_byte_size(.ulonglong), | |
| 973 | .long_double => comp.target.c_type_byte_size(.longdouble), | |
| 974 | .int128, .uint128 => 16, | |
| 975 | .fp16, .float16 => 2, | |
| 976 | .float => comp.target.c_type_byte_size(.float), | |
| 977 | .double => comp.target.c_type_byte_size(.double), | |
| 978 | .float80 => 16, | |
| 979 | .float128 => 16, | |
| 980 | .bit_int => { | |
| 981 | return std.mem.alignForward(u64, (ty.data.int.bits + 7) / 8, ty.alignof(comp)); | |
| 982 | }, | |
| 983 | // zig fmt: off | |
| 984 | .complex_char, .complex_schar, .complex_uchar, .complex_short, .complex_ushort, .complex_int, | |
| 985 | .complex_uint, .complex_long, .complex_ulong, .complex_long_long, .complex_ulong_long, | |
| 986 | .complex_int128, .complex_uint128, .complex_float, .complex_double, | |
| 987 | .complex_long_double, .complex_float80, .complex_float128, .complex_bit_int, | |
| 988 | => return 2 * ty.makeReal().sizeof(comp).?, | |
| 989 | // zig fmt: on | |
| 990 | .pointer, | |
| 991 | .decayed_array, | |
| 992 | .decayed_static_array, | |
| 993 | .decayed_incomplete_array, | |
| 994 | .decayed_variable_len_array, | |
| 995 | .decayed_unspecified_variable_len_array, | |
| 996 | .decayed_typeof_type, | |
| 997 | .decayed_typeof_expr, | |
| 998 | .static_array, | |
| 999 | .nullptr_t, | |
| 1000 | => comp.target.ptrBitWidth() / 8, | |
| 1001 | .array, .vector => { | |
| 1002 | const size = ty.data.array.elem.sizeof(comp) orelse return null; | |
| 1003 | const arr_size = size * ty.data.array.len; | |
| 1004 | if (comp.langopts.emulate == .msvc) { | |
| 1005 | // msvc ignores array type alignment. | |
| 1006 | // Since the size might not be a multiple of the field | |
| 1007 | // alignment, the address of the second element might not be properly aligned | |
| 1008 | // for the field alignment. A flexible array has size 0. See test case 0018. | |
| 1009 | return arr_size; | |
| 1010 | } else { | |
| 1011 | return std.mem.alignForward(u64, arr_size, ty.alignof(comp)); | |
| 1012 | } | |
| 1013 | }, | |
| 1014 | .@"struct", .@"union" => if (ty.data.record.isIncomplete()) null else @as(u64, ty.data.record.type_layout.size_bits / 8), | |
| 1015 | .@"enum" => if (ty.data.@"enum".isIncomplete() and !ty.data.@"enum".fixed) null else ty.data.@"enum".tag_ty.sizeof(comp), | |
| 1016 | .typeof_type => ty.data.sub_type.sizeof(comp), | |
| 1017 | .typeof_expr => ty.data.expr.ty.sizeof(comp), | |
| 1018 | .attributed => ty.data.attributed.base.sizeof(comp), | |
| 1019 | .invalid => return null, | |
| 1020 | }; | |
| 1021 | } | |
| 1022 | ||
| 1023 | pub fn bitSizeof(ty: Type, comp: *const Compilation) ?u64 { | |
| 1024 | return switch (ty.specifier) { | |
| 1025 | .bool => if (comp.langopts.emulate == .msvc) @as(u64, 8) else 1, | |
| 1026 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.bitSizeof(comp), | |
| 1027 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.bitSizeof(comp), | |
| 1028 | .attributed => ty.data.attributed.base.bitSizeof(comp), | |
| 1029 | .bit_int => return ty.data.int.bits, | |
| 1030 | .long_double => comp.target.c_type_bit_size(.longdouble), | |
| 1031 | .float80 => return 80, | |
| 1032 | else => 8 * (ty.sizeof(comp) orelse return null), | |
| 1033 | }; | |
| 1034 | } | |
| 1035 | ||
| 1036 | pub fn alignable(ty: Type) bool { | |
| 1037 | return ty.isArray() or !ty.hasIncompleteSize() or ty.is(.void); | |
| 1038 | } | |
| 1039 | ||
| 1040 | /// Get the alignment of a type | |
| 1041 | pub fn alignof(ty: Type, comp: *const Compilation) u29 { | |
| 1042 | // don't return the attribute for records | |
| 1043 | // layout has already accounted for requested alignment | |
| 1044 | if (ty.requestedAlignment(comp)) |requested| { | |
| 1045 | // gcc does not respect alignment on enums | |
| 1046 | if (ty.get(.@"enum")) |ty_enum| { | |
| 1047 | if (comp.langopts.emulate == .gcc) { | |
| 1048 | return ty_enum.alignof(comp); | |
| 1049 | } | |
| 1050 | } else if (ty.getRecord()) |rec| { | |
| 1051 | if (ty.hasIncompleteSize()) return 0; | |
| 1052 | const computed: u29 = @intCast(@divExact(rec.type_layout.field_alignment_bits, 8)); | |
| 1053 | return @max(requested, computed); | |
| 1054 | } else if (comp.langopts.emulate == .msvc) { | |
| 1055 | const type_align = ty.data.attributed.base.alignof(comp); | |
| 1056 | return @max(requested, type_align); | |
| 1057 | } | |
| 1058 | return requested; | |
| 1059 | } | |
| 1060 | ||
| 1061 | return switch (ty.specifier) { | |
| 1062 | .invalid => unreachable, | |
| 1063 | .auto_type => unreachable, | |
| 1064 | ||
| 1065 | .variable_len_array, | |
| 1066 | .incomplete_array, | |
| 1067 | .unspecified_variable_len_array, | |
| 1068 | .array, | |
| 1069 | .vector, | |
| 1070 | => ty.elemType().alignof(comp), | |
| 1071 | .func, .var_args_func, .old_style_func => target_util.defaultFunctionAlignment(comp.target), | |
| 1072 | .char, .schar, .uchar, .void, .bool => 1, | |
| 1073 | ||
| 1074 | // zig fmt: off | |
| 1075 | .complex_char, .complex_schar, .complex_uchar, .complex_short, .complex_ushort, .complex_int, | |
| 1076 | .complex_uint, .complex_long, .complex_ulong, .complex_long_long, .complex_ulong_long, | |
| 1077 | .complex_int128, .complex_uint128, .complex_float, .complex_double, | |
| 1078 | .complex_long_double, .complex_float80, .complex_float128, .complex_bit_int, | |
| 1079 | => return ty.makeReal().alignof(comp), | |
| 1080 | // zig fmt: on | |
| 1081 | ||
| 1082 | .short => comp.target.c_type_alignment(.short), | |
| 1083 | .ushort => comp.target.c_type_alignment(.ushort), | |
| 1084 | .int => comp.target.c_type_alignment(.int), | |
| 1085 | .uint => comp.target.c_type_alignment(.uint), | |
| 1086 | ||
| 1087 | .long => comp.target.c_type_alignment(.long), | |
| 1088 | .ulong => comp.target.c_type_alignment(.ulong), | |
| 1089 | .long_long => comp.target.c_type_alignment(.longlong), | |
| 1090 | .ulong_long => comp.target.c_type_alignment(.ulonglong), | |
| 1091 | ||
| 1092 | .bit_int => @min( | |
| 1093 | std.math.ceilPowerOfTwoPromote(u16, (ty.data.int.bits + 7) / 8), | |
| 1094 | comp.target.maxIntAlignment(), | |
| 1095 | ), | |
| 1096 | ||
| 1097 | .float => comp.target.c_type_alignment(.float), | |
| 1098 | .double => comp.target.c_type_alignment(.double), | |
| 1099 | .long_double => comp.target.c_type_alignment(.longdouble), | |
| 1100 | ||
| 1101 | .int128, .uint128 => if (comp.target.cpu.arch == .s390x and comp.target.os.tag == .linux and comp.target.isGnu()) 8 else 16, | |
| 1102 | .fp16, .float16 => 2, | |
| 1103 | ||
| 1104 | .float80, .float128 => 16, | |
| 1105 | .pointer, | |
| 1106 | .decayed_array, | |
| 1107 | .decayed_static_array, | |
| 1108 | .decayed_incomplete_array, | |
| 1109 | .decayed_variable_len_array, | |
| 1110 | .decayed_unspecified_variable_len_array, | |
| 1111 | .static_array, | |
| 1112 | .nullptr_t, | |
| 1113 | => switch (comp.target.cpu.arch) { | |
| 1114 | .avr => 1, | |
| 1115 | else => comp.target.ptrBitWidth() / 8, | |
| 1116 | }, | |
| 1117 | .@"struct", .@"union" => if (ty.data.record.isIncomplete()) 0 else @intCast(ty.data.record.type_layout.field_alignment_bits / 8), | |
| 1118 | .@"enum" => if (ty.data.@"enum".isIncomplete() and !ty.data.@"enum".fixed) 0 else ty.data.@"enum".tag_ty.alignof(comp), | |
| 1119 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.alignof(comp), | |
| 1120 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.alignof(comp), | |
| 1121 | .attributed => ty.data.attributed.base.alignof(comp), | |
| 1122 | }; | |
| 1123 | } | |
| 1124 | ||
| 1125 | /// Canonicalize a possibly-typeof() type. If the type is not a typeof() type, simply | |
| 1126 | /// return it. Otherwise, determine the actual qualified type. | |
| 1127 | /// The `qual_handling` parameter can be used to return the full set of qualifiers | |
| 1128 | /// added by typeof() operations, which is useful when determining the elemType of | |
| 1129 | /// arrays and pointers. | |
| 1130 | pub fn canonicalize(ty: Type, qual_handling: enum { standard, preserve_quals }) Type { | |
| 1131 | var cur = ty; | |
| 1132 | if (cur.specifier == .attributed) cur = cur.data.attributed.base; | |
| 1133 | if (!cur.isTypeof()) return cur; | |
| 1134 | ||
| 1135 | var qual = cur.qual; | |
| 1136 | while (true) { | |
| 1137 | switch (cur.specifier) { | |
| 1138 | .typeof_type => cur = cur.data.sub_type.*, | |
| 1139 | .typeof_expr => cur = cur.data.expr.ty, | |
| 1140 | .decayed_typeof_type => { | |
| 1141 | cur = cur.data.sub_type.*; | |
| 1142 | cur.decayArray(); | |
| 1143 | }, | |
| 1144 | .decayed_typeof_expr => { | |
| 1145 | cur = cur.data.expr.ty; | |
| 1146 | cur.decayArray(); | |
| 1147 | }, | |
| 1148 | else => break, | |
| 1149 | } | |
| 1150 | qual = qual.mergeAll(cur.qual); | |
| 1151 | } | |
| 1152 | if ((cur.isArray() or cur.isPtr()) and qual_handling == .standard) { | |
| 1153 | cur.qual = .{}; | |
| 1154 | } else { | |
| 1155 | cur.qual = qual; | |
| 1156 | } | |
| 1157 | return cur; | |
| 1158 | } | |
| 1159 | ||
| 1160 | pub fn get(ty: *const Type, specifier: Specifier) ?*const Type { | |
| 1161 | std.debug.assert(specifier != .typeof_type and specifier != .typeof_expr); | |
| 1162 | return switch (ty.specifier) { | |
| 1163 | .typeof_type => ty.data.sub_type.get(specifier), | |
| 1164 | .typeof_expr => ty.data.expr.ty.get(specifier), | |
| 1165 | .attributed => ty.data.attributed.base.get(specifier), | |
| 1166 | else => if (ty.specifier == specifier) ty else null, | |
| 1167 | }; | |
| 1168 | } | |
| 1169 | ||
| 1170 | pub fn requestedAlignment(ty: Type, comp: *const Compilation) ?u29 { | |
| 1171 | return switch (ty.specifier) { | |
| 1172 | .typeof_type, .decayed_typeof_type => ty.data.sub_type.requestedAlignment(comp), | |
| 1173 | .typeof_expr, .decayed_typeof_expr => ty.data.expr.ty.requestedAlignment(comp), | |
| 1174 | .attributed => annotationAlignment(comp, ty.data.attributed.attributes), | |
| 1175 | else => null, | |
| 1176 | }; | |
| 1177 | } | |
| 1178 | ||
| 1179 | pub fn enumIsPacked(ty: Type, comp: *const Compilation) bool { | |
| 1180 | std.debug.assert(ty.is(.@"enum")); | |
| 1181 | return comp.langopts.short_enums or target_util.packAllEnums(comp.target) or ty.hasAttribute(.@"packed"); | |
| 1182 | } | |
| 1183 | ||
| 1184 | pub fn annotationAlignment(comp: *const Compilation, attrs: ?[]const Attribute) ?u29 { | |
| 1185 | const a = attrs orelse return null; | |
| 1186 | ||
| 1187 | var max_requested: ?u29 = null; | |
| 1188 | for (a) |attribute| { | |
| 1189 | if (attribute.tag != .aligned) continue; | |
| 1190 | const requested = if (attribute.args.aligned.alignment) |alignment| alignment.requested else target_util.defaultAlignment(comp.target); | |
| 1191 | if (max_requested == null or max_requested.? < requested) { | |
| 1192 | max_requested = requested; | |
| 1193 | } | |
| 1194 | } | |
| 1195 | return max_requested; | |
| 1196 | } | |
| 1197 | ||
| 1198 | /// Checks type compatibility for __builtin_types_compatible_p | |
| 1199 | /// Returns true if the unqualified version of `a_param` and `b_param` are the same | |
| 1200 | /// Ignores top-level qualifiers (e.g. `int` and `const int` are compatible) but `int *` and `const int *` are not | |
| 1201 | /// Two types that are typedefed are considered compatible if their underlying types are compatible. | |
| 1202 | /// An enum type is not considered to be compatible with another enum type even if both are compatible with the same integer type; | |
| 1203 | /// `A[]` and `A[N]` for a type `A` and integer `N` are compatible | |
| 1204 | pub fn compatible(a_param: Type, b_param: Type, comp: *const Compilation) bool { | |
| 1205 | var a_unqual = a_param.canonicalize(.standard); | |
| 1206 | a_unqual.qual.@"const" = false; | |
| 1207 | a_unqual.qual.@"volatile" = false; | |
| 1208 | var b_unqual = b_param.canonicalize(.standard); | |
| 1209 | b_unqual.qual.@"const" = false; | |
| 1210 | b_unqual.qual.@"volatile" = false; | |
| 1211 | ||
| 1212 | if (a_unqual.eql(b_unqual, comp, true)) return true; | |
| 1213 | if (!a_unqual.isArray() or !b_unqual.isArray()) return false; | |
| 1214 | ||
| 1215 | if (a_unqual.arrayLen() == null or b_unqual.arrayLen() == null) { | |
| 1216 | // incomplete arrays are compatible with arrays of the same element type | |
| 1217 | // GCC and clang ignore cv-qualifiers on arrays | |
| 1218 | return a_unqual.elemType().compatible(b_unqual.elemType(), comp); | |
| 1219 | } | |
| 1220 | return false; | |
| 1221 | } | |
| 1222 | ||
| 1223 | pub fn eql(a_param: Type, b_param: Type, comp: *const Compilation, check_qualifiers: bool) bool { | |
| 1224 | const a = a_param.canonicalize(.standard); | |
| 1225 | const b = b_param.canonicalize(.standard); | |
| 1226 | ||
| 1227 | if (a.specifier == .invalid or b.specifier == .invalid) return false; | |
| 1228 | if (a.alignof(comp) != b.alignof(comp)) return false; | |
| 1229 | if (a.isPtr()) { | |
| 1230 | if (!b.isPtr()) return false; | |
| 1231 | } else if (a.isFunc()) { | |
| 1232 | if (!b.isFunc()) return false; | |
| 1233 | } else if (a.isArray()) { | |
| 1234 | if (!b.isArray()) return false; | |
| 1235 | } else if (a.specifier != b.specifier) return false; | |
| 1236 | ||
| 1237 | if (a.qual.atomic != b.qual.atomic) return false; | |
| 1238 | if (check_qualifiers) { | |
| 1239 | if (a.qual.@"const" != b.qual.@"const") return false; | |
| 1240 | if (a.qual.@"volatile" != b.qual.@"volatile") return false; | |
| 1241 | } | |
| 1242 | ||
| 1243 | switch (a.specifier) { | |
| 1244 | .pointer, | |
| 1245 | .decayed_array, | |
| 1246 | .decayed_static_array, | |
| 1247 | .decayed_incomplete_array, | |
| 1248 | .decayed_variable_len_array, | |
| 1249 | .decayed_unspecified_variable_len_array, | |
| 1250 | => if (!a_param.elemType().eql(b_param.elemType(), comp, check_qualifiers)) return false, | |
| 1251 | ||
| 1252 | .func, | |
| 1253 | .var_args_func, | |
| 1254 | .old_style_func, | |
| 1255 | => { | |
| 1256 | // TODO validate this | |
| 1257 | if (a.data.func.params.len != b.data.func.params.len) return false; | |
| 1258 | // return type cannot have qualifiers | |
| 1259 | if (!a.returnType().eql(b.returnType(), comp, false)) return false; | |
| 1260 | for (a.data.func.params, b.data.func.params) |param, b_qual| { | |
| 1261 | var a_unqual = param.ty; | |
| 1262 | a_unqual.qual.@"const" = false; | |
| 1263 | a_unqual.qual.@"volatile" = false; | |
| 1264 | var b_unqual = b_qual.ty; | |
| 1265 | b_unqual.qual.@"const" = false; | |
| 1266 | b_unqual.qual.@"volatile" = false; | |
| 1267 | if (!a_unqual.eql(b_unqual, comp, check_qualifiers)) return false; | |
| 1268 | } | |
| 1269 | }, | |
| 1270 | ||
| 1271 | .array, | |
| 1272 | .static_array, | |
| 1273 | .incomplete_array, | |
| 1274 | .vector, | |
| 1275 | => { | |
| 1276 | if (!std.meta.eql(a.arrayLen(), b.arrayLen())) return false; | |
| 1277 | if (!a.elemType().eql(b.elemType(), comp, check_qualifiers)) return false; | |
| 1278 | }, | |
| 1279 | .variable_len_array => if (!a.elemType().eql(b.elemType(), comp, check_qualifiers)) return false, | |
| 1280 | ||
| 1281 | .@"struct", .@"union" => if (a.data.record != b.data.record) return false, | |
| 1282 | .@"enum" => if (a.data.@"enum" != b.data.@"enum") return false, | |
| 1283 | .bit_int, .complex_bit_int => return a.data.int.bits == b.data.int.bits and a.data.int.signedness == b.data.int.signedness, | |
| 1284 | ||
| 1285 | else => {}, | |
| 1286 | } | |
| 1287 | return true; | |
| 1288 | } | |
| 1289 | ||
| 1290 | /// Decays an array to a pointer | |
| 1291 | pub fn decayArray(ty: *Type) void { | |
| 1292 | // the decayed array type is the current specifier +1 | |
| 1293 | ty.specifier = @enumFromInt(@intFromEnum(ty.specifier) + 1); | |
| 1294 | } | |
| 1295 | ||
| 1296 | pub fn originalTypeOfDecayedArray(ty: Type) Type { | |
| 1297 | std.debug.assert(ty.isDecayed()); | |
| 1298 | var copy = ty; | |
| 1299 | copy.specifier = @enumFromInt(@intFromEnum(ty.specifier) - 1); | |
| 1300 | return copy; | |
| 1301 | } | |
| 1302 | ||
| 1303 | /// Rank for floating point conversions, ignoring domain (complex vs real) | |
| 1304 | /// Asserts that ty is a floating point type | |
| 1305 | pub fn floatRank(ty: Type) usize { | |
| 1306 | const real = ty.makeReal(); | |
| 1307 | return switch (real.specifier) { | |
| 1308 | // TODO: bfloat16 => 0 | |
| 1309 | .float16 => 1, | |
| 1310 | .fp16 => 2, | |
| 1311 | .float => 3, | |
| 1312 | .double => 4, | |
| 1313 | .long_double => 5, | |
| 1314 | .float128 => 6, | |
| 1315 | // TODO: ibm128 => 7 | |
| 1316 | else => unreachable, | |
| 1317 | }; | |
| 1318 | } | |
| 1319 | ||
| 1320 | /// Rank for integer conversions, ignoring domain (complex vs real) | |
| 1321 | /// Asserts that ty is an integer type | |
| 1322 | pub fn integerRank(ty: Type, comp: *const Compilation) usize { | |
| 1323 | const real = ty.makeReal(); | |
| 1324 | return @intCast(switch (real.specifier) { | |
| 1325 | .bit_int => @as(u64, real.data.int.bits) << 3, | |
| 1326 | ||
| 1327 | .bool => 1 + (ty.bitSizeof(comp).? << 3), | |
| 1328 | .char, .schar, .uchar => 2 + (ty.bitSizeof(comp).? << 3), | |
| 1329 | .short, .ushort => 3 + (ty.bitSizeof(comp).? << 3), | |
| 1330 | .int, .uint => 4 + (ty.bitSizeof(comp).? << 3), | |
| 1331 | .long, .ulong => 5 + (ty.bitSizeof(comp).? << 3), | |
| 1332 | .long_long, .ulong_long => 6 + (ty.bitSizeof(comp).? << 3), | |
| 1333 | .int128, .uint128 => 7 + (ty.bitSizeof(comp).? << 3), | |
| 1334 | ||
| 1335 | else => unreachable, | |
| 1336 | }); | |
| 1337 | } | |
| 1338 | ||
| 1339 | /// Returns true if `a` and `b` are integer types that differ only in sign | |
| 1340 | pub fn sameRankDifferentSign(a: Type, b: Type, comp: *const Compilation) bool { | |
| 1341 | if (!a.isInt() or !b.isInt()) return false; | |
| 1342 | if (a.integerRank(comp) != b.integerRank(comp)) return false; | |
| 1343 | return a.isUnsignedInt(comp) != b.isUnsignedInt(comp); | |
| 1344 | } | |
| 1345 | ||
| 1346 | pub fn makeReal(ty: Type) Type { | |
| 1347 | // TODO discards attributed/typeof | |
| 1348 | var base = ty.canonicalize(.standard); | |
| 1349 | switch (base.specifier) { | |
| 1350 | .complex_float, .complex_double, .complex_long_double, .complex_float80, .complex_float128 => { | |
| 1351 | base.specifier = @enumFromInt(@intFromEnum(base.specifier) - 5); | |
| 1352 | return base; | |
| 1353 | }, | |
| 1354 | .complex_char, .complex_schar, .complex_uchar, .complex_short, .complex_ushort, .complex_int, .complex_uint, .complex_long, .complex_ulong, .complex_long_long, .complex_ulong_long, .complex_int128, .complex_uint128 => { | |
| 1355 | base.specifier = @enumFromInt(@intFromEnum(base.specifier) - 13); | |
| 1356 | return base; | |
| 1357 | }, | |
| 1358 | .complex_bit_int => { | |
| 1359 | base.specifier = .bit_int; | |
| 1360 | return base; | |
| 1361 | }, | |
| 1362 | else => return ty, | |
| 1363 | } | |
| 1364 | } | |
| 1365 | ||
| 1366 | pub fn makeComplex(ty: Type) Type { | |
| 1367 | // TODO discards attributed/typeof | |
| 1368 | var base = ty.canonicalize(.standard); | |
| 1369 | switch (base.specifier) { | |
| 1370 | .float, .double, .long_double, .float80, .float128 => { | |
| 1371 | base.specifier = @enumFromInt(@intFromEnum(base.specifier) + 5); | |
| 1372 | return base; | |
| 1373 | }, | |
| 1374 | .char, .schar, .uchar, .short, .ushort, .int, .uint, .long, .ulong, .long_long, .ulong_long, .int128, .uint128 => { | |
| 1375 | base.specifier = @enumFromInt(@intFromEnum(base.specifier) + 13); | |
| 1376 | return base; | |
| 1377 | }, | |
| 1378 | .bit_int => { | |
| 1379 | base.specifier = .complex_bit_int; | |
| 1380 | return base; | |
| 1381 | }, | |
| 1382 | else => return ty, | |
| 1383 | } | |
| 1384 | } | |
| 1385 | ||
| 1386 | /// Combines types recursively in the order they were parsed, uses `.void` specifier as a sentinel value. | |
| 1387 | pub fn combine(inner: *Type, outer: Type) Parser.Error!void { | |
| 1388 | switch (inner.specifier) { | |
| 1389 | .pointer => return inner.data.sub_type.combine(outer), | |
| 1390 | .unspecified_variable_len_array => { | |
| 1391 | try inner.data.sub_type.combine(outer); | |
| 1392 | }, | |
| 1393 | .variable_len_array => { | |
| 1394 | try inner.data.expr.ty.combine(outer); | |
| 1395 | }, | |
| 1396 | .array, .static_array, .incomplete_array => { | |
| 1397 | try inner.data.array.elem.combine(outer); | |
| 1398 | }, | |
| 1399 | .func, .var_args_func, .old_style_func => { | |
| 1400 | try inner.data.func.return_type.combine(outer); | |
| 1401 | }, | |
| 1402 | .decayed_array, | |
| 1403 | .decayed_static_array, | |
| 1404 | .decayed_incomplete_array, | |
| 1405 | .decayed_variable_len_array, | |
| 1406 | .decayed_unspecified_variable_len_array, | |
| 1407 | .decayed_typeof_type, | |
| 1408 | .decayed_typeof_expr, | |
| 1409 | => unreachable, // type should not be able to decay before being combined | |
| 1410 | .void => inner.* = outer, | |
| 1411 | else => unreachable, | |
| 1412 | } | |
| 1413 | } | |
| 1414 | ||
| 1415 | pub fn validateCombinedType(ty: Type, p: *Parser, source_tok: TokenIndex) Parser.Error!void { | |
| 1416 | switch (ty.specifier) { | |
| 1417 | .pointer => return ty.data.sub_type.validateCombinedType(p, source_tok), | |
| 1418 | .unspecified_variable_len_array, | |
| 1419 | .variable_len_array, | |
| 1420 | .array, | |
| 1421 | .static_array, | |
| 1422 | .incomplete_array, | |
| 1423 | => { | |
| 1424 | const elem_ty = ty.elemType(); | |
| 1425 | if (elem_ty.hasIncompleteSize()) { | |
| 1426 | try p.errStr(.array_incomplete_elem, source_tok, try p.typeStr(elem_ty)); | |
| 1427 | return error.ParsingFailed; | |
| 1428 | } | |
| 1429 | if (elem_ty.isFunc()) { | |
| 1430 | try p.errTok(.array_func_elem, source_tok); | |
| 1431 | return error.ParsingFailed; | |
| 1432 | } | |
| 1433 | if (elem_ty.specifier == .static_array and elem_ty.isArray()) { | |
| 1434 | try p.errTok(.static_non_outermost_array, source_tok); | |
| 1435 | } | |
| 1436 | if (elem_ty.anyQual() and elem_ty.isArray()) { | |
| 1437 | try p.errTok(.qualifier_non_outermost_array, source_tok); | |
| 1438 | } | |
| 1439 | }, | |
| 1440 | .func, .var_args_func, .old_style_func => { | |
| 1441 | const ret_ty = &ty.data.func.return_type; | |
| 1442 | if (ret_ty.isArray()) try p.errTok(.func_cannot_return_array, source_tok); | |
| 1443 | if (ret_ty.isFunc()) try p.errTok(.func_cannot_return_func, source_tok); | |
| 1444 | if (ret_ty.qual.@"const") { | |
| 1445 | try p.errStr(.qual_on_ret_type, source_tok, "const"); | |
| 1446 | ret_ty.qual.@"const" = false; | |
| 1447 | } | |
| 1448 | if (ret_ty.qual.@"volatile") { | |
| 1449 | try p.errStr(.qual_on_ret_type, source_tok, "volatile"); | |
| 1450 | ret_ty.qual.@"volatile" = false; | |
| 1451 | } | |
| 1452 | if (ret_ty.qual.atomic) { | |
| 1453 | try p.errStr(.qual_on_ret_type, source_tok, "atomic"); | |
| 1454 | ret_ty.qual.atomic = false; | |
| 1455 | } | |
| 1456 | if (ret_ty.is(.fp16) and !p.comp.hasHalfPrecisionFloatABI()) { | |
| 1457 | try p.errStr(.suggest_pointer_for_invalid_fp16, source_tok, "function return value"); | |
| 1458 | } | |
| 1459 | }, | |
| 1460 | .typeof_type, .decayed_typeof_type => return ty.data.sub_type.validateCombinedType(p, source_tok), | |
| 1461 | .typeof_expr, .decayed_typeof_expr => return ty.data.expr.ty.validateCombinedType(p, source_tok), | |
| 1462 | .attributed => return ty.data.attributed.base.validateCombinedType(p, source_tok), | |
| 1463 | else => {}, | |
| 1464 | } | |
| 1465 | } | |
| 1466 | ||
| 1467 | /// An unfinished Type | |
| 1468 | pub const Builder = struct { | |
| 1469 | complex_tok: ?TokenIndex = null, | |
| 1470 | bit_int_tok: ?TokenIndex = null, | |
| 1471 | auto_type_tok: ?TokenIndex = null, | |
| 1472 | typedef: ?struct { | |
| 1473 | tok: TokenIndex, | |
| 1474 | ty: Type, | |
| 1475 | } = null, | |
| 1476 | specifier: Builder.Specifier = .none, | |
| 1477 | qual: Qualifiers.Builder = .{}, | |
| 1478 | typeof: ?Type = null, | |
| 1479 | /// When true an error is returned instead of adding a diagnostic message. | |
| 1480 | /// Used for trying to combine typedef types. | |
| 1481 | error_on_invalid: bool = false, | |
| 1482 | ||
| 1483 | pub const Specifier = union(enum) { | |
| 1484 | none, | |
| 1485 | void, | |
| 1486 | /// GNU __auto_type extension | |
| 1487 | auto_type, | |
| 1488 | nullptr_t, | |
| 1489 | bool, | |
| 1490 | char, | |
| 1491 | schar, | |
| 1492 | uchar, | |
| 1493 | complex_char, | |
| 1494 | complex_schar, | |
| 1495 | complex_uchar, | |
| 1496 | ||
| 1497 | unsigned, | |
| 1498 | signed, | |
| 1499 | short, | |
| 1500 | sshort, | |
| 1501 | ushort, | |
| 1502 | short_int, | |
| 1503 | sshort_int, | |
| 1504 | ushort_int, | |
| 1505 | int, | |
| 1506 | sint, | |
| 1507 | uint, | |
| 1508 | long, | |
| 1509 | slong, | |
| 1510 | ulong, | |
| 1511 | long_int, | |
| 1512 | slong_int, | |
| 1513 | ulong_int, | |
| 1514 | long_long, | |
| 1515 | slong_long, | |
| 1516 | ulong_long, | |
| 1517 | long_long_int, | |
| 1518 | slong_long_int, | |
| 1519 | ulong_long_int, | |
| 1520 | int128, | |
| 1521 | sint128, | |
| 1522 | uint128, | |
| 1523 | complex_unsigned, | |
| 1524 | complex_signed, | |
| 1525 | complex_short, | |
| 1526 | complex_sshort, | |
| 1527 | complex_ushort, | |
| 1528 | complex_short_int, | |
| 1529 | complex_sshort_int, | |
| 1530 | complex_ushort_int, | |
| 1531 | complex_int, | |
| 1532 | complex_sint, | |
| 1533 | complex_uint, | |
| 1534 | complex_long, | |
| 1535 | complex_slong, | |
| 1536 | complex_ulong, | |
| 1537 | complex_long_int, | |
| 1538 | complex_slong_int, | |
| 1539 | complex_ulong_int, | |
| 1540 | complex_long_long, | |
| 1541 | complex_slong_long, | |
| 1542 | complex_ulong_long, | |
| 1543 | complex_long_long_int, | |
| 1544 | complex_slong_long_int, | |
| 1545 | complex_ulong_long_int, | |
| 1546 | complex_int128, | |
| 1547 | complex_sint128, | |
| 1548 | complex_uint128, | |
| 1549 | bit_int: i16, | |
| 1550 | sbit_int: i16, | |
| 1551 | ubit_int: i16, | |
| 1552 | complex_bit_int: i16, | |
| 1553 | complex_sbit_int: i16, | |
| 1554 | complex_ubit_int: i16, | |
| 1555 | ||
| 1556 | fp16, | |
| 1557 | float16, | |
| 1558 | float, | |
| 1559 | double, | |
| 1560 | long_double, | |
| 1561 | float80, | |
| 1562 | float128, | |
| 1563 | complex, | |
| 1564 | complex_float, | |
| 1565 | complex_double, | |
| 1566 | complex_long_double, | |
| 1567 | complex_float80, | |
| 1568 | complex_float128, | |
| 1569 | ||
| 1570 | pointer: *Type, | |
| 1571 | unspecified_variable_len_array: *Type, | |
| 1572 | decayed_unspecified_variable_len_array: *Type, | |
| 1573 | func: *Func, | |
| 1574 | var_args_func: *Func, | |
| 1575 | old_style_func: *Func, | |
| 1576 | array: *Array, | |
| 1577 | decayed_array: *Array, | |
| 1578 | static_array: *Array, | |
| 1579 | decayed_static_array: *Array, | |
| 1580 | incomplete_array: *Array, | |
| 1581 | decayed_incomplete_array: *Array, | |
| 1582 | vector: *Array, | |
| 1583 | variable_len_array: *Expr, | |
| 1584 | decayed_variable_len_array: *Expr, | |
| 1585 | @"struct": *Record, | |
| 1586 | @"union": *Record, | |
| 1587 | @"enum": *Enum, | |
| 1588 | typeof_type: *Type, | |
| 1589 | decayed_typeof_type: *Type, | |
| 1590 | typeof_expr: *Expr, | |
| 1591 | decayed_typeof_expr: *Expr, | |
| 1592 | ||
| 1593 | attributed: *Attributed, | |
| 1594 | ||
| 1595 | pub fn str(spec: Builder.Specifier, langopts: LangOpts) ?[]const u8 { | |
| 1596 | return switch (spec) { | |
| 1597 | .none => unreachable, | |
| 1598 | .void => "void", | |
| 1599 | .auto_type => "__auto_type", | |
| 1600 | .nullptr_t => "nullptr_t", | |
| 1601 | .bool => if (langopts.standard.atLeast(.c2x)) "bool" else "_Bool", | |
| 1602 | .char => "char", | |
| 1603 | .schar => "signed char", | |
| 1604 | .uchar => "unsigned char", | |
| 1605 | .unsigned => "unsigned", | |
| 1606 | .signed => "signed", | |
| 1607 | .short => "short", | |
| 1608 | .ushort => "unsigned short", | |
| 1609 | .sshort => "signed short", | |
| 1610 | .short_int => "short int", | |
| 1611 | .sshort_int => "signed short int", | |
| 1612 | .ushort_int => "unsigned short int", | |
| 1613 | .int => "int", | |
| 1614 | .sint => "signed int", | |
| 1615 | .uint => "unsigned int", | |
| 1616 | .long => "long", | |
| 1617 | .slong => "signed long", | |
| 1618 | .ulong => "unsigned long", | |
| 1619 | .long_int => "long int", | |
| 1620 | .slong_int => "signed long int", | |
| 1621 | .ulong_int => "unsigned long int", | |
| 1622 | .long_long => "long long", | |
| 1623 | .slong_long => "signed long long", | |
| 1624 | .ulong_long => "unsigned long long", | |
| 1625 | .long_long_int => "long long int", | |
| 1626 | .slong_long_int => "signed long long int", | |
| 1627 | .ulong_long_int => "unsigned long long int", | |
| 1628 | .int128 => "__int128", | |
| 1629 | .sint128 => "signed __int128", | |
| 1630 | .uint128 => "unsigned __int128", | |
| 1631 | .bit_int => "_BitInt", | |
| 1632 | .sbit_int => "signed _BitInt", | |
| 1633 | .ubit_int => "unsigned _BitInt", | |
| 1634 | .complex_char => "_Complex char", | |
| 1635 | .complex_schar => "_Complex signed char", | |
| 1636 | .complex_uchar => "_Complex unsigned char", | |
| 1637 | .complex_unsigned => "_Complex unsigned", | |
| 1638 | .complex_signed => "_Complex signed", | |
| 1639 | .complex_short => "_Complex short", | |
| 1640 | .complex_ushort => "_Complex unsigned short", | |
| 1641 | .complex_sshort => "_Complex signed short", | |
| 1642 | .complex_short_int => "_Complex short int", | |
| 1643 | .complex_sshort_int => "_Complex signed short int", | |
| 1644 | .complex_ushort_int => "_Complex unsigned short int", | |
| 1645 | .complex_int => "_Complex int", | |
| 1646 | .complex_sint => "_Complex signed int", | |
| 1647 | .complex_uint => "_Complex unsigned int", | |
| 1648 | .complex_long => "_Complex long", | |
| 1649 | .complex_slong => "_Complex signed long", | |
| 1650 | .complex_ulong => "_Complex unsigned long", | |
| 1651 | .complex_long_int => "_Complex long int", | |
| 1652 | .complex_slong_int => "_Complex signed long int", | |
| 1653 | .complex_ulong_int => "_Complex unsigned long int", | |
| 1654 | .complex_long_long => "_Complex long long", | |
| 1655 | .complex_slong_long => "_Complex signed long long", | |
| 1656 | .complex_ulong_long => "_Complex unsigned long long", | |
| 1657 | .complex_long_long_int => "_Complex long long int", | |
| 1658 | .complex_slong_long_int => "_Complex signed long long int", | |
| 1659 | .complex_ulong_long_int => "_Complex unsigned long long int", | |
| 1660 | .complex_int128 => "_Complex __int128", | |
| 1661 | .complex_sint128 => "_Complex signed __int128", | |
| 1662 | .complex_uint128 => "_Complex unsigned __int128", | |
| 1663 | .complex_bit_int => "_Complex _BitInt", | |
| 1664 | .complex_sbit_int => "_Complex signed _BitInt", | |
| 1665 | .complex_ubit_int => "_Complex unsigned _BitInt", | |
| 1666 | ||
| 1667 | .fp16 => "__fp16", | |
| 1668 | .float16 => "_Float16", | |
| 1669 | .float => "float", | |
| 1670 | .double => "double", | |
| 1671 | .long_double => "long double", | |
| 1672 | .float80 => "__float80", | |
| 1673 | .float128 => "__float128", | |
| 1674 | .complex => "_Complex", | |
| 1675 | .complex_float => "_Complex float", | |
| 1676 | .complex_double => "_Complex double", | |
| 1677 | .complex_long_double => "_Complex long double", | |
| 1678 | .complex_float80 => "_Complex __float80", | |
| 1679 | .complex_float128 => "_Complex __float128", | |
| 1680 | ||
| 1681 | .attributed => |attributed| Builder.fromType(attributed.base).str(langopts), | |
| 1682 | ||
| 1683 | else => null, | |
| 1684 | }; | |
| 1685 | } | |
| 1686 | }; | |
| 1687 | ||
| 1688 | pub fn finish(b: Builder, p: *Parser) Parser.Error!Type { | |
| 1689 | var ty: Type = .{ .specifier = undefined }; | |
| 1690 | if (b.typedef) |typedef| { | |
| 1691 | ty = typedef.ty; | |
| 1692 | if (ty.isArray()) { | |
| 1693 | var elem = ty.elemType(); | |
| 1694 | try b.qual.finish(p, &elem); | |
| 1695 | // TODO this really should be easier | |
| 1696 | switch (ty.specifier) { | |
| 1697 | .array, .static_array, .incomplete_array => { | |
| 1698 | var old = ty.data.array; | |
| 1699 | ty.data.array = try p.arena.create(Array); | |
| 1700 | ty.data.array.* = .{ | |
| 1701 | .len = old.len, | |
| 1702 | .elem = elem, | |
| 1703 | }; | |
| 1704 | }, | |
| 1705 | .variable_len_array, .unspecified_variable_len_array => { | |
| 1706 | var old = ty.data.expr; | |
| 1707 | ty.data.expr = try p.arena.create(Expr); | |
| 1708 | ty.data.expr.* = .{ | |
| 1709 | .node = old.node, | |
| 1710 | .ty = elem, | |
| 1711 | }; | |
| 1712 | }, | |
| 1713 | .typeof_type => {}, // TODO handle | |
| 1714 | .typeof_expr => {}, // TODO handle | |
| 1715 | .attributed => {}, // TODO handle | |
| 1716 | else => unreachable, | |
| 1717 | } | |
| 1718 | ||
| 1719 | return ty; | |
| 1720 | } | |
| 1721 | try b.qual.finish(p, &ty); | |
| 1722 | return ty; | |
| 1723 | } | |
| 1724 | switch (b.specifier) { | |
| 1725 | .none => { | |
| 1726 | if (b.typeof) |typeof| { | |
| 1727 | ty = typeof; | |
| 1728 | } else { | |
| 1729 | ty.specifier = .int; | |
| 1730 | try p.err(.missing_type_specifier); | |
| 1731 | } | |
| 1732 | }, | |
| 1733 | .void => ty.specifier = .void, | |
| 1734 | .auto_type => ty.specifier = .auto_type, | |
| 1735 | .nullptr_t => unreachable, // nullptr_t can only be accessed via typeof(nullptr) | |
| 1736 | .bool => ty.specifier = .bool, | |
| 1737 | .char => ty.specifier = .char, | |
| 1738 | .schar => ty.specifier = .schar, | |
| 1739 | .uchar => ty.specifier = .uchar, | |
| 1740 | .complex_char => ty.specifier = .complex_char, | |
| 1741 | .complex_schar => ty.specifier = .complex_schar, | |
| 1742 | .complex_uchar => ty.specifier = .complex_uchar, | |
| 1743 | ||
| 1744 | .unsigned => ty.specifier = .uint, | |
| 1745 | .signed => ty.specifier = .int, | |
| 1746 | .short_int, .sshort_int, .short, .sshort => ty.specifier = .short, | |
| 1747 | .ushort, .ushort_int => ty.specifier = .ushort, | |
| 1748 | .int, .sint => ty.specifier = .int, | |
| 1749 | .uint => ty.specifier = .uint, | |
| 1750 | .long, .slong, .long_int, .slong_int => ty.specifier = .long, | |
| 1751 | .ulong, .ulong_int => ty.specifier = .ulong, | |
| 1752 | .long_long, .slong_long, .long_long_int, .slong_long_int => ty.specifier = .long_long, | |
| 1753 | .ulong_long, .ulong_long_int => ty.specifier = .ulong_long, | |
| 1754 | .int128, .sint128 => ty.specifier = .int128, | |
| 1755 | .uint128 => ty.specifier = .uint128, | |
| 1756 | .complex_unsigned => ty.specifier = .complex_uint, | |
| 1757 | .complex_signed => ty.specifier = .complex_int, | |
| 1758 | .complex_short_int, .complex_sshort_int, .complex_short, .complex_sshort => ty.specifier = .complex_short, | |
| 1759 | .complex_ushort, .complex_ushort_int => ty.specifier = .complex_ushort, | |
| 1760 | .complex_int, .complex_sint => ty.specifier = .complex_int, | |
| 1761 | .complex_uint => ty.specifier = .complex_uint, | |
| 1762 | .complex_long, .complex_slong, .complex_long_int, .complex_slong_int => ty.specifier = .complex_long, | |
| 1763 | .complex_ulong, .complex_ulong_int => ty.specifier = .complex_ulong, | |
| 1764 | .complex_long_long, .complex_slong_long, .complex_long_long_int, .complex_slong_long_int => ty.specifier = .complex_long_long, | |
| 1765 | .complex_ulong_long, .complex_ulong_long_int => ty.specifier = .complex_ulong_long, | |
| 1766 | .complex_int128, .complex_sint128 => ty.specifier = .complex_int128, | |
| 1767 | .complex_uint128 => ty.specifier = .complex_uint128, | |
| 1768 | .bit_int, .sbit_int, .ubit_int, .complex_bit_int, .complex_ubit_int, .complex_sbit_int => |bits| { | |
| 1769 | const unsigned = b.specifier == .ubit_int or b.specifier == .complex_ubit_int; | |
| 1770 | if (unsigned) { | |
| 1771 | if (bits < 1) { | |
| 1772 | try p.errStr(.unsigned_bit_int_too_small, b.bit_int_tok.?, b.specifier.str(p.comp.langopts).?); | |
| 1773 | return error.ParsingFailed; | |
| 1774 | } | |
| 1775 | } else { | |
| 1776 | if (bits < 2) { | |
| 1777 | try p.errStr(.signed_bit_int_too_small, b.bit_int_tok.?, b.specifier.str(p.comp.langopts).?); | |
| 1778 | return error.ParsingFailed; | |
| 1779 | } | |
| 1780 | } | |
| 1781 | if (bits > Compilation.bit_int_max_bits) { | |
| 1782 | try p.errStr(.bit_int_too_big, b.bit_int_tok.?, b.specifier.str(p.comp.langopts).?); | |
| 1783 | return error.ParsingFailed; | |
| 1784 | } | |
| 1785 | ty.specifier = if (b.complex_tok != null) .complex_bit_int else .bit_int; | |
| 1786 | ty.data = .{ .int = .{ | |
| 1787 | .signedness = if (unsigned) .unsigned else .signed, | |
| 1788 | .bits = @intCast(bits), | |
| 1789 | } }; | |
| 1790 | }, | |
| 1791 | ||
| 1792 | .fp16 => ty.specifier = .fp16, | |
| 1793 | .float16 => ty.specifier = .float16, | |
| 1794 | .float => ty.specifier = .float, | |
| 1795 | .double => ty.specifier = .double, | |
| 1796 | .long_double => ty.specifier = .long_double, | |
| 1797 | .float80 => ty.specifier = .float80, | |
| 1798 | .float128 => ty.specifier = .float128, | |
| 1799 | .complex_float => ty.specifier = .complex_float, | |
| 1800 | .complex_double => ty.specifier = .complex_double, | |
| 1801 | .complex_long_double => ty.specifier = .complex_long_double, | |
| 1802 | .complex_float80 => ty.specifier = .complex_float80, | |
| 1803 | .complex_float128 => ty.specifier = .complex_float128, | |
| 1804 | .complex => { | |
| 1805 | try p.errTok(.plain_complex, p.tok_i - 1); | |
| 1806 | ty.specifier = .complex_double; | |
| 1807 | }, | |
| 1808 | ||
| 1809 | .pointer => |data| { | |
| 1810 | ty.specifier = .pointer; | |
| 1811 | ty.data = .{ .sub_type = data }; | |
| 1812 | }, | |
| 1813 | .unspecified_variable_len_array => |data| { | |
| 1814 | ty.specifier = .unspecified_variable_len_array; | |
| 1815 | ty.data = .{ .sub_type = data }; | |
| 1816 | }, | |
| 1817 | .decayed_unspecified_variable_len_array => |data| { | |
| 1818 | ty.specifier = .decayed_unspecified_variable_len_array; | |
| 1819 | ty.data = .{ .sub_type = data }; | |
| 1820 | }, | |
| 1821 | .func => |data| { | |
| 1822 | ty.specifier = .func; | |
| 1823 | ty.data = .{ .func = data }; | |
| 1824 | }, | |
| 1825 | .var_args_func => |data| { | |
| 1826 | ty.specifier = .var_args_func; | |
| 1827 | ty.data = .{ .func = data }; | |
| 1828 | }, | |
| 1829 | .old_style_func => |data| { | |
| 1830 | ty.specifier = .old_style_func; | |
| 1831 | ty.data = .{ .func = data }; | |
| 1832 | }, | |
| 1833 | .array => |data| { | |
| 1834 | ty.specifier = .array; | |
| 1835 | ty.data = .{ .array = data }; | |
| 1836 | }, | |
| 1837 | .decayed_array => |data| { | |
| 1838 | ty.specifier = .decayed_array; | |
| 1839 | ty.data = .{ .array = data }; | |
| 1840 | }, | |
| 1841 | .static_array => |data| { | |
| 1842 | ty.specifier = .static_array; | |
| 1843 | ty.data = .{ .array = data }; | |
| 1844 | }, | |
| 1845 | .decayed_static_array => |data| { | |
| 1846 | ty.specifier = .decayed_static_array; | |
| 1847 | ty.data = .{ .array = data }; | |
| 1848 | }, | |
| 1849 | .incomplete_array => |data| { | |
| 1850 | ty.specifier = .incomplete_array; | |
| 1851 | ty.data = .{ .array = data }; | |
| 1852 | }, | |
| 1853 | .decayed_incomplete_array => |data| { | |
| 1854 | ty.specifier = .decayed_incomplete_array; | |
| 1855 | ty.data = .{ .array = data }; | |
| 1856 | }, | |
| 1857 | .vector => |data| { | |
| 1858 | ty.specifier = .vector; | |
| 1859 | ty.data = .{ .array = data }; | |
| 1860 | }, | |
| 1861 | .variable_len_array => |data| { | |
| 1862 | ty.specifier = .variable_len_array; | |
| 1863 | ty.data = .{ .expr = data }; | |
| 1864 | }, | |
| 1865 | .decayed_variable_len_array => |data| { | |
| 1866 | ty.specifier = .decayed_variable_len_array; | |
| 1867 | ty.data = .{ .expr = data }; | |
| 1868 | }, | |
| 1869 | .@"struct" => |data| { | |
| 1870 | ty.specifier = .@"struct"; | |
| 1871 | ty.data = .{ .record = data }; | |
| 1872 | }, | |
| 1873 | .@"union" => |data| { | |
| 1874 | ty.specifier = .@"union"; | |
| 1875 | ty.data = .{ .record = data }; | |
| 1876 | }, | |
| 1877 | .@"enum" => |data| { | |
| 1878 | ty.specifier = .@"enum"; | |
| 1879 | ty.data = .{ .@"enum" = data }; | |
| 1880 | }, | |
| 1881 | .typeof_type => |data| { | |
| 1882 | ty.specifier = .typeof_type; | |
| 1883 | ty.data = .{ .sub_type = data }; | |
| 1884 | }, | |
| 1885 | .decayed_typeof_type => |data| { | |
| 1886 | ty.specifier = .decayed_typeof_type; | |
| 1887 | ty.data = .{ .sub_type = data }; | |
| 1888 | }, | |
| 1889 | .typeof_expr => |data| { | |
| 1890 | ty.specifier = .typeof_expr; | |
| 1891 | ty.data = .{ .expr = data }; | |
| 1892 | }, | |
| 1893 | .decayed_typeof_expr => |data| { | |
| 1894 | ty.specifier = .decayed_typeof_expr; | |
| 1895 | ty.data = .{ .expr = data }; | |
| 1896 | }, | |
| 1897 | .attributed => |data| { | |
| 1898 | ty.specifier = .attributed; | |
| 1899 | ty.data = .{ .attributed = data }; | |
| 1900 | }, | |
| 1901 | } | |
| 1902 | if (!ty.isReal() and ty.isInt()) { | |
| 1903 | if (b.complex_tok) |tok| try p.errTok(.complex_int, tok); | |
| 1904 | } | |
| 1905 | try b.qual.finish(p, &ty); | |
| 1906 | return ty; | |
| 1907 | } | |
| 1908 | ||
| 1909 | fn cannotCombine(b: Builder, p: *Parser, source_tok: TokenIndex) !void { | |
| 1910 | if (b.error_on_invalid) return error.CannotCombine; | |
| 1911 | const ty_str = b.specifier.str(p.comp.langopts) orelse try p.typeStr(try b.finish(p)); | |
| 1912 | try p.errExtra(.cannot_combine_spec, source_tok, .{ .str = ty_str }); | |
| 1913 | if (b.typedef) |some| try p.errStr(.spec_from_typedef, some.tok, try p.typeStr(some.ty)); | |
| 1914 | } | |
| 1915 | ||
| 1916 | fn duplicateSpec(b: *Builder, p: *Parser, source_tok: TokenIndex, spec: []const u8) !void { | |
| 1917 | if (b.error_on_invalid) return error.CannotCombine; | |
| 1918 | if (p.comp.langopts.emulate != .clang) return b.cannotCombine(p, source_tok); | |
| 1919 | try p.errStr(.duplicate_decl_spec, p.tok_i, spec); | |
| 1920 | } | |
| 1921 | ||
| 1922 | pub fn combineFromTypeof(b: *Builder, p: *Parser, new: Type, source_tok: TokenIndex) Compilation.Error!void { | |
| 1923 | if (b.typeof != null) return p.errStr(.cannot_combine_spec, source_tok, "typeof"); | |
| 1924 | if (b.specifier != .none) return p.errStr(.invalid_typeof, source_tok, @tagName(b.specifier)); | |
| 1925 | const inner = switch (new.specifier) { | |
| 1926 | .typeof_type => new.data.sub_type.*, | |
| 1927 | .typeof_expr => new.data.expr.ty, | |
| 1928 | .nullptr_t => new, // typeof(nullptr) is special-cased to be an unwrapped typeof-expr | |
| 1929 | else => unreachable, | |
| 1930 | }; | |
| 1931 | ||
| 1932 | b.typeof = switch (inner.specifier) { | |
| 1933 | .attributed => inner.data.attributed.base, | |
| 1934 | else => new, | |
| 1935 | }; | |
| 1936 | } | |
| 1937 | ||
| 1938 | /// Try to combine type from typedef, returns true if successful. | |
| 1939 | pub fn combineTypedef(b: *Builder, p: *Parser, typedef_ty: Type, name_tok: TokenIndex) bool { | |
| 1940 | b.error_on_invalid = true; | |
| 1941 | defer b.error_on_invalid = false; | |
| 1942 | ||
| 1943 | const new_spec = fromType(typedef_ty); | |
| 1944 | b.combineExtra(p, new_spec, 0) catch |err| switch (err) { | |
| 1945 | error.FatalError => unreachable, // we do not add any diagnostics | |
| 1946 | error.OutOfMemory => unreachable, // we do not add any diagnostics | |
| 1947 | error.ParsingFailed => unreachable, // we do not add any diagnostics | |
| 1948 | error.CannotCombine => return false, | |
| 1949 | }; | |
| 1950 | b.typedef = .{ .tok = name_tok, .ty = typedef_ty }; | |
| 1951 | return true; | |
| 1952 | } | |
| 1953 | ||
| 1954 | pub fn combine(b: *Builder, p: *Parser, new: Builder.Specifier, source_tok: TokenIndex) !void { | |
| 1955 | b.combineExtra(p, new, source_tok) catch |err| switch (err) { | |
| 1956 | error.CannotCombine => unreachable, | |
| 1957 | else => |e| return e, | |
| 1958 | }; | |
| 1959 | } | |
| 1960 | ||
| 1961 | fn combineExtra(b: *Builder, p: *Parser, new: Builder.Specifier, source_tok: TokenIndex) !void { | |
| 1962 | if (b.typeof != null) { | |
| 1963 | if (b.error_on_invalid) return error.CannotCombine; | |
| 1964 | try p.errStr(.invalid_typeof, source_tok, @tagName(new)); | |
| 1965 | } | |
| 1966 | ||
| 1967 | switch (new) { | |
| 1968 | .complex => b.complex_tok = source_tok, | |
| 1969 | .bit_int => b.bit_int_tok = source_tok, | |
| 1970 | .auto_type => b.auto_type_tok = source_tok, | |
| 1971 | else => {}, | |
| 1972 | } | |
| 1973 | ||
| 1974 | if (new == .int128 and !target_util.hasInt128(p.comp.target)) { | |
| 1975 | try p.errStr(.type_not_supported_on_target, source_tok, "__int128"); | |
| 1976 | } | |
| 1977 | ||
| 1978 | switch (new) { | |
| 1979 | else => switch (b.specifier) { | |
| 1980 | .none => b.specifier = new, | |
| 1981 | else => return b.cannotCombine(p, source_tok), | |
| 1982 | }, | |
| 1983 | .signed => b.specifier = switch (b.specifier) { | |
| 1984 | .none => .signed, | |
| 1985 | .char => .schar, | |
| 1986 | .short => .sshort, | |
| 1987 | .short_int => .sshort_int, | |
| 1988 | .int => .sint, | |
| 1989 | .long => .slong, | |
| 1990 | .long_int => .slong_int, | |
| 1991 | .long_long => .slong_long, | |
| 1992 | .long_long_int => .slong_long_int, | |
| 1993 | .int128 => .sint128, | |
| 1994 | .bit_int => |bits| .{ .sbit_int = bits }, | |
| 1995 | .complex => .complex_signed, | |
| 1996 | .complex_char => .complex_schar, | |
| 1997 | .complex_short => .complex_sshort, | |
| 1998 | .complex_short_int => .complex_sshort_int, | |
| 1999 | .complex_int => .complex_sint, | |
| 2000 | .complex_long => .complex_slong, | |
| 2001 | .complex_long_int => .complex_slong_int, | |
| 2002 | .complex_long_long => .complex_slong_long, | |
| 2003 | .complex_long_long_int => .complex_slong_long_int, | |
| 2004 | .complex_int128 => .complex_sint128, | |
| 2005 | .complex_bit_int => |bits| .{ .complex_sbit_int = bits }, | |
| 2006 | .signed, | |
| 2007 | .sshort, | |
| 2008 | .sshort_int, | |
| 2009 | .sint, | |
| 2010 | .slong, | |
| 2011 | .slong_int, | |
| 2012 | .slong_long, | |
| 2013 | .slong_long_int, | |
| 2014 | .sint128, | |
| 2015 | .sbit_int, | |
| 2016 | .complex_schar, | |
| 2017 | .complex_signed, | |
| 2018 | .complex_sshort, | |
| 2019 | .complex_sshort_int, | |
| 2020 | .complex_sint, | |
| 2021 | .complex_slong, | |
| 2022 | .complex_slong_int, | |
| 2023 | .complex_slong_long, | |
| 2024 | .complex_slong_long_int, | |
| 2025 | .complex_sint128, | |
| 2026 | .complex_sbit_int, | |
| 2027 | => return b.duplicateSpec(p, source_tok, "signed"), | |
| 2028 | else => return b.cannotCombine(p, source_tok), | |
| 2029 | }, | |
| 2030 | .unsigned => b.specifier = switch (b.specifier) { | |
| 2031 | .none => .unsigned, | |
| 2032 | .char => .uchar, | |
| 2033 | .short => .ushort, | |
| 2034 | .short_int => .ushort_int, | |
| 2035 | .int => .uint, | |
| 2036 | .long => .ulong, | |
| 2037 | .long_int => .ulong_int, | |
| 2038 | .long_long => .ulong_long, | |
| 2039 | .long_long_int => .ulong_long_int, | |
| 2040 | .int128 => .uint128, | |
| 2041 | .bit_int => |bits| .{ .ubit_int = bits }, | |
| 2042 | .complex => .complex_unsigned, | |
| 2043 | .complex_char => .complex_uchar, | |
| 2044 | .complex_short => .complex_ushort, | |
| 2045 | .complex_short_int => .complex_ushort_int, | |
| 2046 | .complex_int => .complex_uint, | |
| 2047 | .complex_long => .complex_ulong, | |
| 2048 | .complex_long_int => .complex_ulong_int, | |
| 2049 | .complex_long_long => .complex_ulong_long, | |
| 2050 | .complex_long_long_int => .complex_ulong_long_int, | |
| 2051 | .complex_int128 => .complex_uint128, | |
| 2052 | .complex_bit_int => |bits| .{ .complex_ubit_int = bits }, | |
| 2053 | .unsigned, | |
| 2054 | .ushort, | |
| 2055 | .ushort_int, | |
| 2056 | .uint, | |
| 2057 | .ulong, | |
| 2058 | .ulong_int, | |
| 2059 | .ulong_long, | |
| 2060 | .ulong_long_int, | |
| 2061 | .uint128, | |
| 2062 | .ubit_int, | |
| 2063 | .complex_uchar, | |
| 2064 | .complex_unsigned, | |
| 2065 | .complex_ushort, | |
| 2066 | .complex_ushort_int, | |
| 2067 | .complex_uint, | |
| 2068 | .complex_ulong, | |
| 2069 | .complex_ulong_int, | |
| 2070 | .complex_ulong_long, | |
| 2071 | .complex_ulong_long_int, | |
| 2072 | .complex_uint128, | |
| 2073 | .complex_ubit_int, | |
| 2074 | => return b.duplicateSpec(p, source_tok, "unsigned"), | |
| 2075 | else => return b.cannotCombine(p, source_tok), | |
| 2076 | }, | |
| 2077 | .char => b.specifier = switch (b.specifier) { | |
| 2078 | .none => .char, | |
| 2079 | .unsigned => .uchar, | |
| 2080 | .signed => .schar, | |
| 2081 | .complex => .complex_char, | |
| 2082 | .complex_signed => .complex_schar, | |
| 2083 | .complex_unsigned => .complex_uchar, | |
| 2084 | else => return b.cannotCombine(p, source_tok), | |
| 2085 | }, | |
| 2086 | .short => b.specifier = switch (b.specifier) { | |
| 2087 | .none => .short, | |
| 2088 | .unsigned => .ushort, | |
| 2089 | .signed => .sshort, | |
| 2090 | .int => .short_int, | |
| 2091 | .sint => .sshort_int, | |
| 2092 | .uint => .ushort_int, | |
| 2093 | .complex => .complex_short, | |
| 2094 | .complex_signed => .complex_sshort, | |
| 2095 | .complex_unsigned => .complex_ushort, | |
| 2096 | else => return b.cannotCombine(p, source_tok), | |
| 2097 | }, | |
| 2098 | .int => b.specifier = switch (b.specifier) { | |
| 2099 | .none => .int, | |
| 2100 | .signed => .sint, | |
| 2101 | .unsigned => .uint, | |
| 2102 | .short => .short_int, | |
| 2103 | .sshort => .sshort_int, | |
| 2104 | .ushort => .ushort_int, | |
| 2105 | .long => .long_int, | |
| 2106 | .slong => .slong_int, | |
| 2107 | .ulong => .ulong_int, | |
| 2108 | .long_long => .long_long_int, | |
| 2109 | .slong_long => .slong_long_int, | |
| 2110 | .ulong_long => .ulong_long_int, | |
| 2111 | .complex => .complex_int, | |
| 2112 | .complex_signed => .complex_sint, | |
| 2113 | .complex_unsigned => .complex_uint, | |
| 2114 | .complex_short => .complex_short_int, | |
| 2115 | .complex_sshort => .complex_sshort_int, | |
| 2116 | .complex_ushort => .complex_ushort_int, | |
| 2117 | .complex_long => .complex_long_int, | |
| 2118 | .complex_slong => .complex_slong_int, | |
| 2119 | .complex_ulong => .complex_ulong_int, | |
| 2120 | .complex_long_long => .complex_long_long_int, | |
| 2121 | .complex_slong_long => .complex_slong_long_int, | |
| 2122 | .complex_ulong_long => .complex_ulong_long_int, | |
| 2123 | else => return b.cannotCombine(p, source_tok), | |
| 2124 | }, | |
| 2125 | .long => b.specifier = switch (b.specifier) { | |
| 2126 | .none => .long, | |
| 2127 | .long => .long_long, | |
| 2128 | .unsigned => .ulong, | |
| 2129 | .signed => .long, | |
| 2130 | .int => .long_int, | |
| 2131 | .sint => .slong_int, | |
| 2132 | .ulong => .ulong_long, | |
| 2133 | .complex => .complex_long, | |
| 2134 | .complex_signed => .complex_slong, | |
| 2135 | .complex_unsigned => .complex_ulong, | |
| 2136 | .complex_long => .complex_long_long, | |
| 2137 | .complex_slong => .complex_slong_long, | |
| 2138 | .complex_ulong => .complex_ulong_long, | |
| 2139 | else => return b.cannotCombine(p, source_tok), | |
| 2140 | }, | |
| 2141 | .int128 => b.specifier = switch (b.specifier) { | |
| 2142 | .none => .int128, | |
| 2143 | .unsigned => .uint128, | |
| 2144 | .signed => .sint128, | |
| 2145 | .complex => .complex_int128, | |
| 2146 | .complex_signed => .complex_sint128, | |
| 2147 | .complex_unsigned => .complex_uint128, | |
| 2148 | else => return b.cannotCombine(p, source_tok), | |
| 2149 | }, | |
| 2150 | .bit_int => b.specifier = switch (b.specifier) { | |
| 2151 | .none => .{ .bit_int = new.bit_int }, | |
| 2152 | .unsigned => .{ .ubit_int = new.bit_int }, | |
| 2153 | .signed => .{ .sbit_int = new.bit_int }, | |
| 2154 | .complex => .{ .complex_bit_int = new.bit_int }, | |
| 2155 | .complex_signed => .{ .complex_sbit_int = new.bit_int }, | |
| 2156 | .complex_unsigned => .{ .complex_ubit_int = new.bit_int }, | |
| 2157 | else => return b.cannotCombine(p, source_tok), | |
| 2158 | }, | |
| 2159 | .auto_type => b.specifier = switch (b.specifier) { | |
| 2160 | .none => .auto_type, | |
| 2161 | else => return b.cannotCombine(p, source_tok), | |
| 2162 | }, | |
| 2163 | .fp16 => b.specifier = switch (b.specifier) { | |
| 2164 | .none => .fp16, | |
| 2165 | else => return b.cannotCombine(p, source_tok), | |
| 2166 | }, | |
| 2167 | .float16 => b.specifier = switch (b.specifier) { | |
| 2168 | .none => .float16, | |
| 2169 | else => return b.cannotCombine(p, source_tok), | |
| 2170 | }, | |
| 2171 | .float => b.specifier = switch (b.specifier) { | |
| 2172 | .none => .float, | |
| 2173 | .complex => .complex_float, | |
| 2174 | else => return b.cannotCombine(p, source_tok), | |
| 2175 | }, | |
| 2176 | .double => b.specifier = switch (b.specifier) { | |
| 2177 | .none => .double, | |
| 2178 | .long => .long_double, | |
| 2179 | .complex_long => .complex_long_double, | |
| 2180 | .complex => .complex_double, | |
| 2181 | else => return b.cannotCombine(p, source_tok), | |
| 2182 | }, | |
| 2183 | .float80 => b.specifier = switch (b.specifier) { | |
| 2184 | .none => .float80, | |
| 2185 | .complex => .complex_float80, | |
| 2186 | else => return b.cannotCombine(p, source_tok), | |
| 2187 | }, | |
| 2188 | .float128 => b.specifier = switch (b.specifier) { | |
| 2189 | .none => .float128, | |
| 2190 | .complex => .complex_float128, | |
| 2191 | else => return b.cannotCombine(p, source_tok), | |
| 2192 | }, | |
| 2193 | .complex => b.specifier = switch (b.specifier) { | |
| 2194 | .none => .complex, | |
| 2195 | .float => .complex_float, | |
| 2196 | .double => .complex_double, | |
| 2197 | .long_double => .complex_long_double, | |
| 2198 | .float80 => .complex_float80, | |
| 2199 | .float128 => .complex_float128, | |
| 2200 | .char => .complex_char, | |
| 2201 | .schar => .complex_schar, | |
| 2202 | .uchar => .complex_uchar, | |
| 2203 | .unsigned => .complex_unsigned, | |
| 2204 | .signed => .complex_signed, | |
| 2205 | .short => .complex_short, | |
| 2206 | .sshort => .complex_sshort, | |
| 2207 | .ushort => .complex_ushort, | |
| 2208 | .short_int => .complex_short_int, | |
| 2209 | .sshort_int => .complex_sshort_int, | |
| 2210 | .ushort_int => .complex_ushort_int, | |
| 2211 | .int => .complex_int, | |
| 2212 | .sint => .complex_sint, | |
| 2213 | .uint => .complex_uint, | |
| 2214 | .long => .complex_long, | |
| 2215 | .slong => .complex_slong, | |
| 2216 | .ulong => .complex_ulong, | |
| 2217 | .long_int => .complex_long_int, | |
| 2218 | .slong_int => .complex_slong_int, | |
| 2219 | .ulong_int => .complex_ulong_int, | |
| 2220 | .long_long => .complex_long_long, | |
| 2221 | .slong_long => .complex_slong_long, | |
| 2222 | .ulong_long => .complex_ulong_long, | |
| 2223 | .long_long_int => .complex_long_long_int, | |
| 2224 | .slong_long_int => .complex_slong_long_int, | |
| 2225 | .ulong_long_int => .complex_ulong_long_int, | |
| 2226 | .int128 => .complex_int128, | |
| 2227 | .sint128 => .complex_sint128, | |
| 2228 | .uint128 => .complex_uint128, | |
| 2229 | .bit_int => |bits| .{ .complex_bit_int = bits }, | |
| 2230 | .sbit_int => |bits| .{ .complex_sbit_int = bits }, | |
| 2231 | .ubit_int => |bits| .{ .complex_ubit_int = bits }, | |
| 2232 | .complex, | |
| 2233 | .complex_float, | |
| 2234 | .complex_double, | |
| 2235 | .complex_long_double, | |
| 2236 | .complex_float80, | |
| 2237 | .complex_float128, | |
| 2238 | .complex_char, | |
| 2239 | .complex_schar, | |
| 2240 | .complex_uchar, | |
| 2241 | .complex_unsigned, | |
| 2242 | .complex_signed, | |
| 2243 | .complex_short, | |
| 2244 | .complex_sshort, | |
| 2245 | .complex_ushort, | |
| 2246 | .complex_short_int, | |
| 2247 | .complex_sshort_int, | |
| 2248 | .complex_ushort_int, | |
| 2249 | .complex_int, | |
| 2250 | .complex_sint, | |
| 2251 | .complex_uint, | |
| 2252 | .complex_long, | |
| 2253 | .complex_slong, | |
| 2254 | .complex_ulong, | |
| 2255 | .complex_long_int, | |
| 2256 | .complex_slong_int, | |
| 2257 | .complex_ulong_int, | |
| 2258 | .complex_long_long, | |
| 2259 | .complex_slong_long, | |
| 2260 | .complex_ulong_long, | |
| 2261 | .complex_long_long_int, | |
| 2262 | .complex_slong_long_int, | |
| 2263 | .complex_ulong_long_int, | |
| 2264 | .complex_int128, | |
| 2265 | .complex_sint128, | |
| 2266 | .complex_uint128, | |
| 2267 | .complex_bit_int, | |
| 2268 | .complex_sbit_int, | |
| 2269 | .complex_ubit_int, | |
| 2270 | => return b.duplicateSpec(p, source_tok, "_Complex"), | |
| 2271 | else => return b.cannotCombine(p, source_tok), | |
| 2272 | }, | |
| 2273 | } | |
| 2274 | } | |
| 2275 | ||
| 2276 | pub fn fromType(ty: Type) Builder.Specifier { | |
| 2277 | return switch (ty.specifier) { | |
| 2278 | .void => .void, | |
| 2279 | .auto_type => .auto_type, | |
| 2280 | .nullptr_t => .nullptr_t, | |
| 2281 | .bool => .bool, | |
| 2282 | .char => .char, | |
| 2283 | .schar => .schar, | |
| 2284 | .uchar => .uchar, | |
| 2285 | .short => .short, | |
| 2286 | .ushort => .ushort, | |
| 2287 | .int => .int, | |
| 2288 | .uint => .uint, | |
| 2289 | .long => .long, | |
| 2290 | .ulong => .ulong, | |
| 2291 | .long_long => .long_long, | |
| 2292 | .ulong_long => .ulong_long, | |
| 2293 | .int128 => .int128, | |
| 2294 | .uint128 => .uint128, | |
| 2295 | .bit_int => if (ty.data.int.signedness == .unsigned) { | |
| 2296 | return .{ .ubit_int = ty.data.int.bits }; | |
| 2297 | } else { | |
| 2298 | return .{ .bit_int = ty.data.int.bits }; | |
| 2299 | }, | |
| 2300 | .complex_char => .complex_char, | |
| 2301 | .complex_schar => .complex_schar, | |
| 2302 | .complex_uchar => .complex_uchar, | |
| 2303 | .complex_short => .complex_short, | |
| 2304 | .complex_ushort => .complex_ushort, | |
| 2305 | .complex_int => .complex_int, | |
| 2306 | .complex_uint => .complex_uint, | |
| 2307 | .complex_long => .complex_long, | |
| 2308 | .complex_ulong => .complex_ulong, | |
| 2309 | .complex_long_long => .complex_long_long, | |
| 2310 | .complex_ulong_long => .complex_ulong_long, | |
| 2311 | .complex_int128 => .complex_int128, | |
| 2312 | .complex_uint128 => .complex_uint128, | |
| 2313 | .complex_bit_int => if (ty.data.int.signedness == .unsigned) { | |
| 2314 | return .{ .complex_ubit_int = ty.data.int.bits }; | |
| 2315 | } else { | |
| 2316 | return .{ .complex_bit_int = ty.data.int.bits }; | |
| 2317 | }, | |
| 2318 | .fp16 => .fp16, | |
| 2319 | .float16 => .float16, | |
| 2320 | .float => .float, | |
| 2321 | .double => .double, | |
| 2322 | .float80 => .float80, | |
| 2323 | .float128 => .float128, | |
| 2324 | .long_double => .long_double, | |
| 2325 | .complex_float => .complex_float, | |
| 2326 | .complex_double => .complex_double, | |
| 2327 | .complex_long_double => .complex_long_double, | |
| 2328 | .complex_float80 => .complex_float80, | |
| 2329 | .complex_float128 => .complex_float128, | |
| 2330 | ||
| 2331 | .pointer => .{ .pointer = ty.data.sub_type }, | |
| 2332 | .unspecified_variable_len_array => .{ .unspecified_variable_len_array = ty.data.sub_type }, | |
| 2333 | .decayed_unspecified_variable_len_array => .{ .decayed_unspecified_variable_len_array = ty.data.sub_type }, | |
| 2334 | .func => .{ .func = ty.data.func }, | |
| 2335 | .var_args_func => .{ .var_args_func = ty.data.func }, | |
| 2336 | .old_style_func => .{ .old_style_func = ty.data.func }, | |
| 2337 | .array => .{ .array = ty.data.array }, | |
| 2338 | .decayed_array => .{ .decayed_array = ty.data.array }, | |
| 2339 | .static_array => .{ .static_array = ty.data.array }, | |
| 2340 | .decayed_static_array => .{ .decayed_static_array = ty.data.array }, | |
| 2341 | .incomplete_array => .{ .incomplete_array = ty.data.array }, | |
| 2342 | .decayed_incomplete_array => .{ .decayed_incomplete_array = ty.data.array }, | |
| 2343 | .vector => .{ .vector = ty.data.array }, | |
| 2344 | .variable_len_array => .{ .variable_len_array = ty.data.expr }, | |
| 2345 | .decayed_variable_len_array => .{ .decayed_variable_len_array = ty.data.expr }, | |
| 2346 | .@"struct" => .{ .@"struct" = ty.data.record }, | |
| 2347 | .@"union" => .{ .@"union" = ty.data.record }, | |
| 2348 | .@"enum" => .{ .@"enum" = ty.data.@"enum" }, | |
| 2349 | ||
| 2350 | .typeof_type => .{ .typeof_type = ty.data.sub_type }, | |
| 2351 | .decayed_typeof_type => .{ .decayed_typeof_type = ty.data.sub_type }, | |
| 2352 | .typeof_expr => .{ .typeof_expr = ty.data.expr }, | |
| 2353 | .decayed_typeof_expr => .{ .decayed_typeof_expr = ty.data.expr }, | |
| 2354 | ||
| 2355 | .attributed => .{ .attributed = ty.data.attributed }, | |
| 2356 | else => unreachable, | |
| 2357 | }; | |
| 2358 | } | |
| 2359 | }; | |
| 2360 | ||
| 2361 | pub fn getAttribute(ty: Type, comptime tag: Attribute.Tag) ?Attribute.ArgumentsForTag(tag) { | |
| 2362 | switch (ty.specifier) { | |
| 2363 | .typeof_type => return ty.data.sub_type.getAttribute(tag), | |
| 2364 | .typeof_expr => return ty.data.expr.ty.getAttribute(tag), | |
| 2365 | .attributed => { | |
| 2366 | for (ty.data.attributed.attributes) |attribute| { | |
| 2367 | if (attribute.tag == tag) return @field(attribute.args, @tagName(tag)); | |
| 2368 | } | |
| 2369 | return null; | |
| 2370 | }, | |
| 2371 | else => return null, | |
| 2372 | } | |
| 2373 | } | |
| 2374 | ||
| 2375 | pub fn hasAttribute(ty: Type, tag: Attribute.Tag) bool { | |
| 2376 | for (ty.getAttributes()) |attr| { | |
| 2377 | if (attr.tag == tag) return true; | |
| 2378 | } | |
| 2379 | return false; | |
| 2380 | } | |
| 2381 | ||
| 2382 | /// printf format modifier | |
| 2383 | pub fn formatModifier(ty: Type) []const u8 { | |
| 2384 | return switch (ty.specifier) { | |
| 2385 | .schar, .uchar => "hh", | |
| 2386 | .short, .ushort => "h", | |
| 2387 | .int, .uint => "", | |
| 2388 | .long, .ulong => "l", | |
| 2389 | .long_long, .ulong_long => "ll", | |
| 2390 | else => unreachable, | |
| 2391 | }; | |
| 2392 | } | |
| 2393 | ||
| 2394 | /// Suffix for integer values of this type | |
| 2395 | pub fn intValueSuffix(ty: Type, comp: *const Compilation) []const u8 { | |
| 2396 | return switch (ty.specifier) { | |
| 2397 | .schar, .short, .int => "", | |
| 2398 | .long => "L", | |
| 2399 | .long_long => "LL", | |
| 2400 | .uchar, .char => { | |
| 2401 | if (ty.specifier == .char and comp.getCharSignedness() == .signed) return ""; | |
| 2402 | // Only 8-bit char supported currently; | |
| 2403 | // TODO: handle platforms with 16-bit int + 16-bit char | |
| 2404 | std.debug.assert(ty.sizeof(comp).? == 1); | |
| 2405 | return ""; | |
| 2406 | }, | |
| 2407 | .ushort => { | |
| 2408 | if (ty.sizeof(comp).? < int.sizeof(comp).?) { | |
| 2409 | return ""; | |
| 2410 | } | |
| 2411 | return "U"; | |
| 2412 | }, | |
| 2413 | .uint => "U", | |
| 2414 | .ulong => "UL", | |
| 2415 | .ulong_long => "ULL", | |
| 2416 | else => unreachable, // not integer | |
| 2417 | }; | |
| 2418 | } | |
| 2419 | ||
| 2420 | /// Print type in C style | |
| 2421 | pub fn print(ty: Type, mapper: StringInterner.TypeMapper, langopts: LangOpts, w: anytype) @TypeOf(w).Error!void { | |
| 2422 | _ = try ty.printPrologue(mapper, langopts, w); | |
| 2423 | try ty.printEpilogue(mapper, langopts, w); | |
| 2424 | } | |
| 2425 | ||
| 2426 | pub fn printNamed(ty: Type, name: []const u8, mapper: StringInterner.TypeMapper, langopts: LangOpts, w: anytype) @TypeOf(w).Error!void { | |
| 2427 | const simple = try ty.printPrologue(mapper, langopts, w); | |
| 2428 | if (simple) try w.writeByte(' '); | |
| 2429 | try w.writeAll(name); | |
| 2430 | try ty.printEpilogue(mapper, langopts, w); | |
| 2431 | } | |
| 2432 | ||
| 2433 | const StringGetter = fn (TokenIndex) []const u8; | |
| 2434 | ||
| 2435 | /// return true if `ty` is simple | |
| 2436 | fn printPrologue(ty: Type, mapper: StringInterner.TypeMapper, langopts: LangOpts, w: anytype) @TypeOf(w).Error!bool { | |
| 2437 | if (ty.qual.atomic) { | |
| 2438 | var non_atomic_ty = ty; | |
| 2439 | non_atomic_ty.qual.atomic = false; | |
| 2440 | try w.writeAll("_Atomic("); | |
| 2441 | try non_atomic_ty.print(mapper, langopts, w); | |
| 2442 | try w.writeAll(")"); | |
| 2443 | return true; | |
| 2444 | } | |
| 2445 | switch (ty.specifier) { | |
| 2446 | .pointer, | |
| 2447 | .decayed_array, | |
| 2448 | .decayed_static_array, | |
| 2449 | .decayed_incomplete_array, | |
| 2450 | .decayed_variable_len_array, | |
| 2451 | .decayed_unspecified_variable_len_array, | |
| 2452 | .decayed_typeof_type, | |
| 2453 | .decayed_typeof_expr, | |
| 2454 | => { | |
| 2455 | const elem_ty = ty.elemType(); | |
| 2456 | const simple = try elem_ty.printPrologue(mapper, langopts, w); | |
| 2457 | if (simple) try w.writeByte(' '); | |
| 2458 | if (elem_ty.isFunc() or elem_ty.isArray()) try w.writeByte('('); | |
| 2459 | try w.writeByte('*'); | |
| 2460 | try ty.qual.dump(w); | |
| 2461 | return false; | |
| 2462 | }, | |
| 2463 | .func, .var_args_func, .old_style_func => { | |
| 2464 | const ret_ty = ty.data.func.return_type; | |
| 2465 | const simple = try ret_ty.printPrologue(mapper, langopts, w); | |
| 2466 | if (simple) try w.writeByte(' '); | |
| 2467 | return false; | |
| 2468 | }, | |
| 2469 | .array, .static_array, .incomplete_array, .unspecified_variable_len_array, .variable_len_array => { | |
| 2470 | const elem_ty = ty.elemType(); | |
| 2471 | const simple = try elem_ty.printPrologue(mapper, langopts, w); | |
| 2472 | if (simple) try w.writeByte(' '); | |
| 2473 | return false; | |
| 2474 | }, | |
| 2475 | .typeof_type, .typeof_expr => { | |
| 2476 | const actual = ty.canonicalize(.standard); | |
| 2477 | return actual.printPrologue(mapper, langopts, w); | |
| 2478 | }, | |
| 2479 | .attributed => { | |
| 2480 | const actual = ty.canonicalize(.standard); | |
| 2481 | return actual.printPrologue(mapper, langopts, w); | |
| 2482 | }, | |
| 2483 | else => {}, | |
| 2484 | } | |
| 2485 | try ty.qual.dump(w); | |
| 2486 | ||
| 2487 | switch (ty.specifier) { | |
| 2488 | .@"enum" => if (ty.data.@"enum".fixed) { | |
| 2489 | try w.print("enum {s}: ", .{mapper.lookup(ty.data.@"enum".name)}); | |
| 2490 | try ty.data.@"enum".tag_ty.dump(mapper, langopts, w); | |
| 2491 | } else { | |
| 2492 | try w.print("enum {s}", .{mapper.lookup(ty.data.@"enum".name)}); | |
| 2493 | }, | |
| 2494 | .@"struct" => try w.print("struct {s}", .{mapper.lookup(ty.data.record.name)}), | |
| 2495 | .@"union" => try w.print("union {s}", .{mapper.lookup(ty.data.record.name)}), | |
| 2496 | .vector => { | |
| 2497 | const len = ty.data.array.len; | |
| 2498 | const elem_ty = ty.data.array.elem; | |
| 2499 | try w.print("__attribute__((__vector_size__({d} * sizeof(", .{len}); | |
| 2500 | _ = try elem_ty.printPrologue(mapper, langopts, w); | |
| 2501 | try w.writeAll(")))) "); | |
| 2502 | _ = try elem_ty.printPrologue(mapper, langopts, w); | |
| 2503 | try w.print(" (vector of {d} '", .{len}); | |
| 2504 | _ = try elem_ty.printPrologue(mapper, langopts, w); | |
| 2505 | try w.writeAll("' values)"); | |
| 2506 | }, | |
| 2507 | else => try w.writeAll(Builder.fromType(ty).str(langopts).?), | |
| 2508 | } | |
| 2509 | return true; | |
| 2510 | } | |
| 2511 | ||
| 2512 | fn printEpilogue(ty: Type, mapper: StringInterner.TypeMapper, langopts: LangOpts, w: anytype) @TypeOf(w).Error!void { | |
| 2513 | if (ty.qual.atomic) return; | |
| 2514 | switch (ty.specifier) { | |
| 2515 | .pointer, | |
| 2516 | .decayed_array, | |
| 2517 | .decayed_static_array, | |
| 2518 | .decayed_incomplete_array, | |
| 2519 | .decayed_variable_len_array, | |
| 2520 | .decayed_unspecified_variable_len_array, | |
| 2521 | .decayed_typeof_type, | |
| 2522 | .decayed_typeof_expr, | |
| 2523 | => { | |
| 2524 | const elem_ty = ty.elemType(); | |
| 2525 | if (elem_ty.isFunc() or elem_ty.isArray()) try w.writeByte(')'); | |
| 2526 | try elem_ty.printEpilogue(mapper, langopts, w); | |
| 2527 | }, | |
| 2528 | .func, .var_args_func, .old_style_func => { | |
| 2529 | try w.writeByte('('); | |
| 2530 | for (ty.data.func.params, 0..) |param, i| { | |
| 2531 | if (i != 0) try w.writeAll(", "); | |
| 2532 | _ = try param.ty.printPrologue(mapper, langopts, w); | |
| 2533 | try param.ty.printEpilogue(mapper, langopts, w); | |
| 2534 | } | |
| 2535 | if (ty.specifier != .func) { | |
| 2536 | if (ty.data.func.params.len != 0) try w.writeAll(", "); | |
| 2537 | try w.writeAll("..."); | |
| 2538 | } else if (ty.data.func.params.len == 0) { | |
| 2539 | try w.writeAll("void"); | |
| 2540 | } | |
| 2541 | try w.writeByte(')'); | |
| 2542 | try ty.data.func.return_type.printEpilogue(mapper, langopts, w); | |
| 2543 | }, | |
| 2544 | .array, .static_array => { | |
| 2545 | try w.writeByte('['); | |
| 2546 | if (ty.specifier == .static_array) try w.writeAll("static "); | |
| 2547 | try ty.qual.dump(w); | |
| 2548 | try w.print("{d}]", .{ty.data.array.len}); | |
| 2549 | try ty.data.array.elem.printEpilogue(mapper, langopts, w); | |
| 2550 | }, | |
| 2551 | .incomplete_array => { | |
| 2552 | try w.writeByte('['); | |
| 2553 | try ty.qual.dump(w); | |
| 2554 | try w.writeByte(']'); | |
| 2555 | try ty.data.array.elem.printEpilogue(mapper, langopts, w); | |
| 2556 | }, | |
| 2557 | .unspecified_variable_len_array => { | |
| 2558 | try w.writeByte('['); | |
| 2559 | try ty.qual.dump(w); | |
| 2560 | try w.writeAll("*]"); | |
| 2561 | try ty.data.sub_type.printEpilogue(mapper, langopts, w); | |
| 2562 | }, | |
| 2563 | .variable_len_array => { | |
| 2564 | try w.writeByte('['); | |
| 2565 | try ty.qual.dump(w); | |
| 2566 | try w.writeAll("<expr>]"); | |
| 2567 | try ty.data.expr.ty.printEpilogue(mapper, langopts, w); | |
| 2568 | }, | |
| 2569 | .typeof_type, .typeof_expr => { | |
| 2570 | const actual = ty.canonicalize(.standard); | |
| 2571 | try actual.printEpilogue(mapper, langopts, w); | |
| 2572 | }, | |
| 2573 | .attributed => { | |
| 2574 | const actual = ty.canonicalize(.standard); | |
| 2575 | try actual.printEpilogue(mapper, langopts, w); | |
| 2576 | }, | |
| 2577 | else => {}, | |
| 2578 | } | |
| 2579 | } | |
| 2580 | ||
| 2581 | /// Useful for debugging, too noisy to be enabled by default. | |
| 2582 | const dump_detailed_containers = false; | |
| 2583 | ||
| 2584 | // Print as Zig types since those are actually readable | |
| 2585 | pub fn dump(ty: Type, mapper: StringInterner.TypeMapper, langopts: LangOpts, w: anytype) @TypeOf(w).Error!void { | |
| 2586 | try ty.qual.dump(w); | |
| 2587 | switch (ty.specifier) { | |
| 2588 | .invalid => try w.writeAll("invalid"), | |
| 2589 | .pointer => { | |
| 2590 | try w.writeAll("*"); | |
| 2591 | try ty.data.sub_type.dump(mapper, langopts, w); | |
| 2592 | }, | |
| 2593 | .func, .var_args_func, .old_style_func => { | |
| 2594 | try w.writeAll("fn ("); | |
| 2595 | for (ty.data.func.params, 0..) |param, i| { | |
| 2596 | if (i != 0) try w.writeAll(", "); | |
| 2597 | if (param.name != .empty) try w.print("{s}: ", .{mapper.lookup(param.name)}); | |
| 2598 | try param.ty.dump(mapper, langopts, w); | |
| 2599 | } | |
| 2600 | if (ty.specifier != .func) { | |
| 2601 | if (ty.data.func.params.len != 0) try w.writeAll(", "); | |
| 2602 | try w.writeAll("..."); | |
| 2603 | } | |
| 2604 | try w.writeAll(") "); | |
| 2605 | try ty.data.func.return_type.dump(mapper, langopts, w); | |
| 2606 | }, | |
| 2607 | .array, .static_array, .decayed_array, .decayed_static_array => { | |
| 2608 | if (ty.specifier == .decayed_array or ty.specifier == .decayed_static_array) try w.writeByte('d'); | |
| 2609 | try w.writeByte('['); | |
| 2610 | if (ty.specifier == .static_array or ty.specifier == .decayed_static_array) try w.writeAll("static "); | |
| 2611 | try w.print("{d}]", .{ty.data.array.len}); | |
| 2612 | try ty.data.array.elem.dump(mapper, langopts, w); | |
| 2613 | }, | |
| 2614 | .vector => { | |
| 2615 | try w.print("vector({d}, ", .{ty.data.array.len}); | |
| 2616 | try ty.data.array.elem.dump(mapper, langopts, w); | |
| 2617 | try w.writeAll(")"); | |
| 2618 | }, | |
| 2619 | .incomplete_array, .decayed_incomplete_array => { | |
| 2620 | if (ty.specifier == .decayed_incomplete_array) try w.writeByte('d'); | |
| 2621 | try w.writeAll("[]"); | |
| 2622 | try ty.data.array.elem.dump(mapper, langopts, w); | |
| 2623 | }, | |
| 2624 | .@"enum" => { | |
| 2625 | const enum_ty = ty.data.@"enum"; | |
| 2626 | if (enum_ty.isIncomplete() and !enum_ty.fixed) { | |
| 2627 | try w.print("enum {s}", .{mapper.lookup(enum_ty.name)}); | |
| 2628 | } else { | |
| 2629 | try w.print("enum {s}: ", .{mapper.lookup(enum_ty.name)}); | |
| 2630 | try enum_ty.tag_ty.dump(mapper, langopts, w); | |
| 2631 | } | |
| 2632 | if (dump_detailed_containers) try dumpEnum(enum_ty, mapper, w); | |
| 2633 | }, | |
| 2634 | .@"struct" => { | |
| 2635 | try w.print("struct {s}", .{mapper.lookup(ty.data.record.name)}); | |
| 2636 | if (dump_detailed_containers) try dumpRecord(ty.data.record, mapper, langopts, w); | |
| 2637 | }, | |
| 2638 | .@"union" => { | |
| 2639 | try w.print("union {s}", .{mapper.lookup(ty.data.record.name)}); | |
| 2640 | if (dump_detailed_containers) try dumpRecord(ty.data.record, mapper, langopts, w); | |
| 2641 | }, | |
| 2642 | .unspecified_variable_len_array, .decayed_unspecified_variable_len_array => { | |
| 2643 | if (ty.specifier == .decayed_unspecified_variable_len_array) try w.writeByte('d'); | |
| 2644 | try w.writeAll("[*]"); | |
| 2645 | try ty.data.sub_type.dump(mapper, langopts, w); | |
| 2646 | }, | |
| 2647 | .variable_len_array, .decayed_variable_len_array => { | |
| 2648 | if (ty.specifier == .decayed_variable_len_array) try w.writeByte('d'); | |
| 2649 | try w.writeAll("[<expr>]"); | |
| 2650 | try ty.data.expr.ty.dump(mapper, langopts, w); | |
| 2651 | }, | |
| 2652 | .typeof_type, .decayed_typeof_type => { | |
| 2653 | try w.writeAll("typeof("); | |
| 2654 | try ty.data.sub_type.dump(mapper, langopts, w); | |
| 2655 | try w.writeAll(")"); | |
| 2656 | }, | |
| 2657 | .typeof_expr, .decayed_typeof_expr => { | |
| 2658 | try w.writeAll("typeof(<expr>: "); | |
| 2659 | try ty.data.expr.ty.dump(mapper, langopts, w); | |
| 2660 | try w.writeAll(")"); | |
| 2661 | }, | |
| 2662 | .attributed => { | |
| 2663 | try w.writeAll("attributed("); | |
| 2664 | try ty.data.attributed.base.dump(mapper, langopts, w); | |
| 2665 | try w.writeAll(")"); | |
| 2666 | }, | |
| 2667 | else => { | |
| 2668 | try w.writeAll(Builder.fromType(ty).str(langopts).?); | |
| 2669 | if (ty.specifier == .bit_int or ty.specifier == .complex_bit_int) { | |
| 2670 | try w.print("({d})", .{ty.data.int.bits}); | |
| 2671 | } | |
| 2672 | }, | |
| 2673 | } | |
| 2674 | } | |
| 2675 | ||
| 2676 | fn dumpEnum(@"enum": *Enum, mapper: StringInterner.TypeMapper, w: anytype) @TypeOf(w).Error!void { | |
| 2677 | try w.writeAll(" {"); | |
| 2678 | for (@"enum".fields) |field| { | |
| 2679 | try w.print(" {s} = {d},", .{ mapper.lookup(field.name), field.value }); | |
| 2680 | } | |
| 2681 | try w.writeAll(" }"); | |
| 2682 | } | |
| 2683 | ||
| 2684 | fn dumpRecord(record: *Record, mapper: StringInterner.TypeMapper, langopts: LangOpts, w: anytype) @TypeOf(w).Error!void { | |
| 2685 | try w.writeAll(" {"); | |
| 2686 | for (record.fields) |field| { | |
| 2687 | try w.writeByte(' '); | |
| 2688 | try field.ty.dump(mapper, langopts, w); | |
| 2689 | try w.print(" {s}: {d};", .{ mapper.lookup(field.name), field.bit_width }); | |
| 2690 | } | |
| 2691 | try w.writeAll(" }"); | |
| 2692 | } |
deps/aro/Value.zig created+601| ... | ... | @@ -0,0 +1,601 @@ |
| 1 | const std = @import("std"); | |
| 2 | const assert = std.debug.assert; | |
| 3 | const Compilation = @import("Compilation.zig"); | |
| 4 | const Type = @import("Type.zig"); | |
| 5 | ||
| 6 | const Value = @This(); | |
| 7 | ||
| 8 | pub const ByteRange = struct { | |
| 9 | start: u32, | |
| 10 | end: u32, | |
| 11 | ||
| 12 | pub fn len(self: ByteRange) u32 { | |
| 13 | return self.end - self.start; | |
| 14 | } | |
| 15 | ||
| 16 | pub fn trim(self: ByteRange, amount: u32) ByteRange { | |
| 17 | std.debug.assert(self.start <= self.end - amount); | |
| 18 | return .{ .start = self.start, .end = self.end - amount }; | |
| 19 | } | |
| 20 | ||
| 21 | pub fn slice(self: ByteRange, all_bytes: []const u8) []const u8 { | |
| 22 | return all_bytes[self.start..self.end]; | |
| 23 | } | |
| 24 | }; | |
| 25 | ||
| 26 | tag: Tag = .unavailable, | |
| 27 | data: union { | |
| 28 | none: void, | |
| 29 | int: u64, | |
| 30 | float: f64, | |
| 31 | bytes: ByteRange, | |
| 32 | } = .{ .none = {} }, | |
| 33 | ||
| 34 | const Tag = enum { | |
| 35 | unavailable, | |
| 36 | nullptr_t, | |
| 37 | /// int is used to store integer, boolean and pointer values | |
| 38 | int, | |
| 39 | float, | |
| 40 | bytes, | |
| 41 | }; | |
| 42 | ||
| 43 | pub fn zero(v: Value) Value { | |
| 44 | return switch (v.tag) { | |
| 45 | .int => int(0), | |
| 46 | .float => float(0), | |
| 47 | else => unreachable, | |
| 48 | }; | |
| 49 | } | |
| 50 | ||
| 51 | pub fn one(v: Value) Value { | |
| 52 | return switch (v.tag) { | |
| 53 | .int => int(1), | |
| 54 | .float => float(1), | |
| 55 | else => unreachable, | |
| 56 | }; | |
| 57 | } | |
| 58 | ||
| 59 | pub fn int(v: anytype) Value { | |
| 60 | if (@TypeOf(v) == comptime_int or @typeInfo(@TypeOf(v)).Int.signedness == .unsigned) | |
| 61 | return .{ .tag = .int, .data = .{ .int = v } } | |
| 62 | else | |
| 63 | return .{ .tag = .int, .data = .{ .int = @bitCast(@as(i64, v)) } }; | |
| 64 | } | |
| 65 | ||
| 66 | pub fn float(v: anytype) Value { | |
| 67 | return .{ .tag = .float, .data = .{ .float = v } }; | |
| 68 | } | |
| 69 | ||
| 70 | pub fn bytes(start: u32, end: u32) Value { | |
| 71 | return .{ .tag = .bytes, .data = .{ .bytes = .{ .start = start, .end = end } } }; | |
| 72 | } | |
| 73 | ||
| 74 | pub fn signExtend(v: Value, old_ty: Type, comp: *Compilation) i64 { | |
| 75 | const size = old_ty.sizeof(comp).?; | |
| 76 | return switch (size) { | |
| 77 | 1 => v.getInt(i8), | |
| 78 | 2 => v.getInt(i16), | |
| 79 | 4 => v.getInt(i32), | |
| 80 | 8 => v.getInt(i64), | |
| 81 | else => unreachable, | |
| 82 | }; | |
| 83 | } | |
| 84 | ||
| 85 | /// Number of bits needed to hold `v` which is of type `ty`. | |
| 86 | /// Asserts that `v` is not negative | |
| 87 | pub fn minUnsignedBits(v: Value, ty: Type, comp: *const Compilation) usize { | |
| 88 | assert(v.compare(.gte, Value.int(0), ty, comp)); | |
| 89 | return switch (ty.sizeof(comp).?) { | |
| 90 | 1 => 8 - @clz(v.getInt(u8)), | |
| 91 | 2 => 16 - @clz(v.getInt(u16)), | |
| 92 | 4 => 32 - @clz(v.getInt(u32)), | |
| 93 | 8 => 64 - @clz(v.getInt(u64)), | |
| 94 | else => unreachable, | |
| 95 | }; | |
| 96 | } | |
| 97 | ||
| 98 | test "minUnsignedBits" { | |
| 99 | const Test = struct { | |
| 100 | fn checkIntBits(comp: *const Compilation, specifier: Type.Specifier, v: u64, expected: usize) !void { | |
| 101 | const val = Value.int(v); | |
| 102 | try std.testing.expectEqual(expected, val.minUnsignedBits(.{ .specifier = specifier }, comp)); | |
| 103 | } | |
| 104 | }; | |
| 105 | ||
| 106 | var comp = Compilation.init(std.testing.allocator); | |
| 107 | defer comp.deinit(); | |
| 108 | comp.target = (try std.zig.CrossTarget.parse(.{ .arch_os_abi = "x86_64-linux-gnu" })).toTarget(); | |
| 109 | ||
| 110 | try Test.checkIntBits(&comp, .int, 0, 0); | |
| 111 | try Test.checkIntBits(&comp, .int, 1, 1); | |
| 112 | try Test.checkIntBits(&comp, .int, 2, 2); | |
| 113 | try Test.checkIntBits(&comp, .int, std.math.maxInt(i8), 7); | |
| 114 | try Test.checkIntBits(&comp, .int, std.math.maxInt(u8), 8); | |
| 115 | try Test.checkIntBits(&comp, .int, std.math.maxInt(i16), 15); | |
| 116 | try Test.checkIntBits(&comp, .int, std.math.maxInt(u16), 16); | |
| 117 | try Test.checkIntBits(&comp, .int, std.math.maxInt(i32), 31); | |
| 118 | try Test.checkIntBits(&comp, .uint, std.math.maxInt(u32), 32); | |
| 119 | try Test.checkIntBits(&comp, .long, std.math.maxInt(i64), 63); | |
| 120 | try Test.checkIntBits(&comp, .ulong, std.math.maxInt(u64), 64); | |
| 121 | try Test.checkIntBits(&comp, .long_long, std.math.maxInt(i64), 63); | |
| 122 | try Test.checkIntBits(&comp, .ulong_long, std.math.maxInt(u64), 64); | |
| 123 | } | |
| 124 | ||
| 125 | /// Minimum number of bits needed to represent `v` in 2's complement notation | |
| 126 | /// Asserts that `v` is negative. | |
| 127 | pub fn minSignedBits(v: Value, ty: Type, comp: *const Compilation) usize { | |
| 128 | assert(v.compare(.lt, Value.int(0), ty, comp)); | |
| 129 | return switch (ty.sizeof(comp).?) { | |
| 130 | 1 => 8 - @clz(~v.getInt(u8)) + 1, | |
| 131 | 2 => 16 - @clz(~v.getInt(u16)) + 1, | |
| 132 | 4 => 32 - @clz(~v.getInt(u32)) + 1, | |
| 133 | 8 => 64 - @clz(~v.getInt(u64)) + 1, | |
| 134 | else => unreachable, | |
| 135 | }; | |
| 136 | } | |
| 137 | ||
| 138 | test "minSignedBits" { | |
| 139 | const Test = struct { | |
| 140 | fn checkIntBits(comp: *const Compilation, specifier: Type.Specifier, v: i64, expected: usize) !void { | |
| 141 | const val = Value.int(v); | |
| 142 | try std.testing.expectEqual(expected, val.minSignedBits(.{ .specifier = specifier }, comp)); | |
| 143 | } | |
| 144 | }; | |
| 145 | ||
| 146 | var comp = Compilation.init(std.testing.allocator); | |
| 147 | defer comp.deinit(); | |
| 148 | comp.target = (try std.zig.CrossTarget.parse(.{ .arch_os_abi = "x86_64-linux-gnu" })).toTarget(); | |
| 149 | ||
| 150 | for ([_]Type.Specifier{ .int, .long, .long_long }) |specifier| { | |
| 151 | try Test.checkIntBits(&comp, specifier, -1, 1); | |
| 152 | try Test.checkIntBits(&comp, specifier, -2, 2); | |
| 153 | try Test.checkIntBits(&comp, specifier, -10, 5); | |
| 154 | try Test.checkIntBits(&comp, specifier, -101, 8); | |
| 155 | ||
| 156 | try Test.checkIntBits(&comp, specifier, std.math.minInt(i8), 8); | |
| 157 | try Test.checkIntBits(&comp, specifier, std.math.minInt(i16), 16); | |
| 158 | try Test.checkIntBits(&comp, specifier, std.math.minInt(i32), 32); | |
| 159 | } | |
| 160 | ||
| 161 | try Test.checkIntBits(&comp, .long, std.math.minInt(i64), 64); | |
| 162 | try Test.checkIntBits(&comp, .long_long, std.math.minInt(i64), 64); | |
| 163 | } | |
| 164 | ||
| 165 | pub const FloatToIntChangeKind = enum { | |
| 166 | /// value did not change | |
| 167 | none, | |
| 168 | /// floating point number too small or large for destination integer type | |
| 169 | out_of_range, | |
| 170 | /// tried to convert a NaN or Infinity | |
| 171 | overflow, | |
| 172 | /// fractional value was converted to zero | |
| 173 | nonzero_to_zero, | |
| 174 | /// fractional part truncated | |
| 175 | value_changed, | |
| 176 | }; | |
| 177 | ||
| 178 | fn floatToIntExtra(comptime FloatTy: type, int_ty_signedness: std.builtin.Signedness, int_ty_size: u16, v: *Value) FloatToIntChangeKind { | |
| 179 | const float_val = v.getFloat(FloatTy); | |
| 180 | const was_zero = float_val == 0; | |
| 181 | const had_fraction = std.math.modf(float_val).fpart != 0; | |
| 182 | ||
| 183 | switch (int_ty_signedness) { | |
| 184 | inline else => |signedness| switch (int_ty_size) { | |
| 185 | inline 1, 2, 4, 8 => |bytecount| { | |
| 186 | const IntTy = std.meta.Int(signedness, bytecount * 8); | |
| 187 | ||
| 188 | const intVal = std.math.lossyCast(IntTy, float_val); | |
| 189 | v.* = int(intVal); | |
| 190 | if (!was_zero and v.isZero()) return .nonzero_to_zero; | |
| 191 | if (float_val <= std.math.minInt(IntTy) or float_val >= std.math.maxInt(IntTy)) return .out_of_range; | |
| 192 | if (had_fraction) return .value_changed; | |
| 193 | return .none; | |
| 194 | }, | |
| 195 | else => unreachable, | |
| 196 | }, | |
| 197 | } | |
| 198 | } | |
| 199 | ||
| 200 | /// Converts the stored value from a float to an integer. | |
| 201 | /// `.unavailable` value remains unchanged. | |
| 202 | pub fn floatToInt(v: *Value, old_ty: Type, new_ty: Type, comp: *Compilation) FloatToIntChangeKind { | |
| 203 | assert(old_ty.isFloat()); | |
| 204 | if (v.tag == .unavailable) return .none; | |
| 205 | if (new_ty.is(.bool)) { | |
| 206 | const was_zero = v.isZero(); | |
| 207 | const was_one = v.getFloat(f64) == 1.0; | |
| 208 | v.toBool(); | |
| 209 | if (was_zero or was_one) return .none; | |
| 210 | return .value_changed; | |
| 211 | } else if (new_ty.isUnsignedInt(comp) and v.data.float < 0) { | |
| 212 | v.* = int(0); | |
| 213 | return .out_of_range; | |
| 214 | } else if (!std.math.isFinite(v.data.float)) { | |
| 215 | v.tag = .unavailable; | |
| 216 | return .overflow; | |
| 217 | } | |
| 218 | const old_size = old_ty.sizeof(comp).?; | |
| 219 | const new_size: u16 = @intCast(new_ty.sizeof(comp).?); | |
| 220 | if (new_ty.isUnsignedInt(comp)) switch (old_size) { | |
| 221 | 1 => unreachable, // promoted to int | |
| 222 | 2 => unreachable, // promoted to int | |
| 223 | 4 => return floatToIntExtra(f32, .unsigned, new_size, v), | |
| 224 | 8 => return floatToIntExtra(f64, .unsigned, new_size, v), | |
| 225 | else => unreachable, | |
| 226 | } else switch (old_size) { | |
| 227 | 1 => unreachable, // promoted to int | |
| 228 | 2 => unreachable, // promoted to int | |
| 229 | 4 => return floatToIntExtra(f32, .signed, new_size, v), | |
| 230 | 8 => return floatToIntExtra(f64, .signed, new_size, v), | |
| 231 | else => unreachable, | |
| 232 | } | |
| 233 | } | |
| 234 | ||
| 235 | /// Converts the stored value from an integer to a float. | |
| 236 | /// `.unavailable` value remains unchanged. | |
| 237 | pub fn intToFloat(v: *Value, old_ty: Type, new_ty: Type, comp: *Compilation) void { | |
| 238 | assert(old_ty.isInt()); | |
| 239 | if (v.tag == .unavailable) return; | |
| 240 | if (!new_ty.isReal() or new_ty.sizeof(comp).? > 8) { | |
| 241 | v.tag = .unavailable; | |
| 242 | } else if (old_ty.isUnsignedInt(comp)) { | |
| 243 | v.* = float(@as(f64, @floatFromInt(v.data.int))); | |
| 244 | } else { | |
| 245 | v.* = float(@as(f64, @floatFromInt(@as(i64, @bitCast(v.data.int))))); | |
| 246 | } | |
| 247 | } | |
| 248 | ||
| 249 | /// Truncates or extends bits based on type. | |
| 250 | /// old_ty is only used for size. | |
| 251 | pub fn intCast(v: *Value, old_ty: Type, new_ty: Type, comp: *Compilation) void { | |
| 252 | // assert(old_ty.isInt() and new_ty.isInt()); | |
| 253 | if (v.tag == .unavailable) return; | |
| 254 | if (new_ty.is(.bool)) return v.toBool(); | |
| 255 | if (!old_ty.isUnsignedInt(comp)) { | |
| 256 | const size = new_ty.sizeof(comp).?; | |
| 257 | switch (size) { | |
| 258 | 1 => v.* = int(@as(u8, @truncate(@as(u64, @bitCast(v.signExtend(old_ty, comp)))))), | |
| 259 | 2 => v.* = int(@as(u16, @truncate(@as(u64, @bitCast(v.signExtend(old_ty, comp)))))), | |
| 260 | 4 => v.* = int(@as(u32, @truncate(@as(u64, @bitCast(v.signExtend(old_ty, comp)))))), | |
| 261 | 8 => return, | |
| 262 | else => unreachable, | |
| 263 | } | |
| 264 | } | |
| 265 | } | |
| 266 | ||
| 267 | /// Converts the stored value from an integer to a float. | |
| 268 | /// `.unavailable` value remains unchanged. | |
| 269 | pub fn floatCast(v: *Value, old_ty: Type, new_ty: Type, comp: *Compilation) void { | |
| 270 | assert(old_ty.isFloat() and new_ty.isFloat()); | |
| 271 | if (v.tag == .unavailable) return; | |
| 272 | const size = new_ty.sizeof(comp).?; | |
| 273 | if (!new_ty.isReal() or size > 8) { | |
| 274 | v.tag = .unavailable; | |
| 275 | } else if (size == 32) { | |
| 276 | v.* = float(@as(f32, @floatCast(v.data.float))); | |
| 277 | } | |
| 278 | } | |
| 279 | ||
| 280 | /// Truncates data.int to one bit | |
| 281 | pub fn toBool(v: *Value) void { | |
| 282 | if (v.tag == .unavailable) return; | |
| 283 | const res = v.getBool(); | |
| 284 | v.* = int(@intFromBool(res)); | |
| 285 | } | |
| 286 | ||
| 287 | pub fn isZero(v: Value) bool { | |
| 288 | return switch (v.tag) { | |
| 289 | .unavailable => false, | |
| 290 | .nullptr_t => false, | |
| 291 | .int => v.data.int == 0, | |
| 292 | .float => v.data.float == 0, | |
| 293 | .bytes => false, | |
| 294 | }; | |
| 295 | } | |
| 296 | ||
| 297 | pub fn getBool(v: Value) bool { | |
| 298 | return switch (v.tag) { | |
| 299 | .unavailable => unreachable, | |
| 300 | .nullptr_t => false, | |
| 301 | .int => v.data.int != 0, | |
| 302 | .float => v.data.float != 0, | |
| 303 | .bytes => true, | |
| 304 | }; | |
| 305 | } | |
| 306 | ||
| 307 | pub fn getInt(v: Value, comptime T: type) T { | |
| 308 | if (T == u64) return v.data.int; | |
| 309 | return if (@typeInfo(T).Int.signedness == .unsigned) | |
| 310 | @truncate(v.data.int) | |
| 311 | else | |
| 312 | @truncate(@as(i64, @bitCast(v.data.int))); | |
| 313 | } | |
| 314 | ||
| 315 | pub fn getFloat(v: Value, comptime T: type) T { | |
| 316 | if (T == f64) return v.data.float; | |
| 317 | return @floatCast(v.data.float); | |
| 318 | } | |
| 319 | ||
| 320 | const bin_overflow = struct { | |
| 321 | inline fn addInt(comptime T: type, out: *Value, a: Value, b: Value) bool { | |
| 322 | const a_val = a.getInt(T); | |
| 323 | const b_val = b.getInt(T); | |
| 324 | const sum, const overflowed = @addWithOverflow(a_val, b_val); | |
| 325 | out.* = int(sum); | |
| 326 | return overflowed != 0; | |
| 327 | } | |
| 328 | inline fn addFloat(comptime T: type, aa: Value, bb: Value) Value { | |
| 329 | const a_val = aa.getFloat(T); | |
| 330 | const b_val = bb.getFloat(T); | |
| 331 | return float(a_val + b_val); | |
| 332 | } | |
| 333 | ||
| 334 | inline fn subInt(comptime T: type, out: *Value, a: Value, b: Value) bool { | |
| 335 | const a_val = a.getInt(T); | |
| 336 | const b_val = b.getInt(T); | |
| 337 | const difference, const overflowed = @subWithOverflow(a_val, b_val); | |
| 338 | out.* = int(difference); | |
| 339 | return overflowed != 0; | |
| 340 | } | |
| 341 | inline fn subFloat(comptime T: type, aa: Value, bb: Value) Value { | |
| 342 | const a_val = aa.getFloat(T); | |
| 343 | const b_val = bb.getFloat(T); | |
| 344 | return float(a_val - b_val); | |
| 345 | } | |
| 346 | ||
| 347 | inline fn mulInt(comptime T: type, out: *Value, a: Value, b: Value) bool { | |
| 348 | const a_val = a.getInt(T); | |
| 349 | const b_val = b.getInt(T); | |
| 350 | const product, const overflowed = @mulWithOverflow(a_val, b_val); | |
| 351 | out.* = int(product); | |
| 352 | return overflowed != 0; | |
| 353 | } | |
| 354 | inline fn mulFloat(comptime T: type, aa: Value, bb: Value) Value { | |
| 355 | const a_val = aa.getFloat(T); | |
| 356 | const b_val = bb.getFloat(T); | |
| 357 | return float(a_val * b_val); | |
| 358 | } | |
| 359 | ||
| 360 | const FT = fn (*Value, Value, Value, Type, *Compilation) bool; | |
| 361 | fn getOp(comptime intFunc: anytype, comptime floatFunc: anytype) FT { | |
| 362 | return struct { | |
| 363 | fn op(res: *Value, a: Value, b: Value, ty: Type, comp: *Compilation) bool { | |
| 364 | const size = ty.sizeof(comp).?; | |
| 365 | if (@TypeOf(floatFunc) != @TypeOf(null) and ty.isFloat()) { | |
| 366 | res.* = switch (size) { | |
| 367 | 4 => floatFunc(f32, a, b), | |
| 368 | 8 => floatFunc(f64, a, b), | |
| 369 | else => unreachable, | |
| 370 | }; | |
| 371 | return false; | |
| 372 | } | |
| 373 | ||
| 374 | if (ty.isUnsignedInt(comp)) switch (size) { | |
| 375 | 1 => return intFunc(u8, res, a, b), | |
| 376 | 2 => return intFunc(u16, res, a, b), | |
| 377 | 4 => return intFunc(u32, res, a, b), | |
| 378 | 8 => return intFunc(u64, res, a, b), | |
| 379 | else => unreachable, | |
| 380 | } else switch (size) { | |
| 381 | 1 => return intFunc(u8, res, a, b), | |
| 382 | 2 => return intFunc(u16, res, a, b), | |
| 383 | 4 => return intFunc(i32, res, a, b), | |
| 384 | 8 => return intFunc(i64, res, a, b), | |
| 385 | else => unreachable, | |
| 386 | } | |
| 387 | } | |
| 388 | }.op; | |
| 389 | } | |
| 390 | }; | |
| 391 | ||
| 392 | pub const add = bin_overflow.getOp(bin_overflow.addInt, bin_overflow.addFloat); | |
| 393 | pub const sub = bin_overflow.getOp(bin_overflow.subInt, bin_overflow.subFloat); | |
| 394 | pub const mul = bin_overflow.getOp(bin_overflow.mulInt, bin_overflow.mulFloat); | |
| 395 | ||
| 396 | const bin_ops = struct { | |
| 397 | inline fn divInt(comptime T: type, aa: Value, bb: Value) Value { | |
| 398 | const a_val = aa.getInt(T); | |
| 399 | const b_val = bb.getInt(T); | |
| 400 | return int(@divTrunc(a_val, b_val)); | |
| 401 | } | |
| 402 | inline fn divFloat(comptime T: type, aa: Value, bb: Value) Value { | |
| 403 | const a_val = aa.getFloat(T); | |
| 404 | const b_val = bb.getFloat(T); | |
| 405 | return float(a_val / b_val); | |
| 406 | } | |
| 407 | ||
| 408 | inline fn remInt(comptime T: type, a: Value, b: Value) Value { | |
| 409 | const a_val = a.getInt(T); | |
| 410 | const b_val = b.getInt(T); | |
| 411 | ||
| 412 | if (@typeInfo(T).Int.signedness == .signed) { | |
| 413 | if (a_val == std.math.minInt(T) and b_val == -1) { | |
| 414 | return Value{ .tag = .unavailable, .data = .{ .none = {} } }; | |
| 415 | } else { | |
| 416 | if (b_val > 0) return int(@rem(a_val, b_val)); | |
| 417 | return int(a_val - @divTrunc(a_val, b_val) * b_val); | |
| 418 | } | |
| 419 | } else { | |
| 420 | return int(a_val % b_val); | |
| 421 | } | |
| 422 | } | |
| 423 | ||
| 424 | inline fn orInt(comptime T: type, a: Value, b: Value) Value { | |
| 425 | const a_val = a.getInt(T); | |
| 426 | const b_val = b.getInt(T); | |
| 427 | return int(a_val | b_val); | |
| 428 | } | |
| 429 | inline fn xorInt(comptime T: type, a: Value, b: Value) Value { | |
| 430 | const a_val = a.getInt(T); | |
| 431 | const b_val = b.getInt(T); | |
| 432 | return int(a_val ^ b_val); | |
| 433 | } | |
| 434 | inline fn andInt(comptime T: type, a: Value, b: Value) Value { | |
| 435 | const a_val = a.getInt(T); | |
| 436 | const b_val = b.getInt(T); | |
| 437 | return int(a_val & b_val); | |
| 438 | } | |
| 439 | ||
| 440 | inline fn shl(comptime T: type, a: Value, b: Value) Value { | |
| 441 | const ShiftT = std.math.Log2Int(T); | |
| 442 | const info = @typeInfo(T).Int; | |
| 443 | const UT = std.meta.Int(.unsigned, info.bits); | |
| 444 | const b_val = b.getInt(T); | |
| 445 | ||
| 446 | if (b_val > std.math.maxInt(ShiftT)) { | |
| 447 | return if (info.signedness == .unsigned) | |
| 448 | int(@as(UT, std.math.maxInt(UT))) | |
| 449 | else | |
| 450 | int(@as(T, std.math.minInt(T))); | |
| 451 | } | |
| 452 | const amt: ShiftT = @truncate(@as(UT, @bitCast(b_val))); | |
| 453 | const a_val = a.getInt(T); | |
| 454 | return int(a_val << amt); | |
| 455 | } | |
| 456 | inline fn shr(comptime T: type, a: Value, b: Value) Value { | |
| 457 | const ShiftT = std.math.Log2Int(T); | |
| 458 | const UT = std.meta.Int(.unsigned, @typeInfo(T).Int.bits); | |
| 459 | ||
| 460 | const b_val = b.getInt(T); | |
| 461 | if (b_val > std.math.maxInt(ShiftT)) return Value.int(0); | |
| 462 | ||
| 463 | const amt: ShiftT = @truncate(@as(UT, @intCast(b_val))); | |
| 464 | const a_val = a.getInt(T); | |
| 465 | return int(a_val >> amt); | |
| 466 | } | |
| 467 | ||
| 468 | const FT = fn (Value, Value, Type, *Compilation) Value; | |
| 469 | fn getOp(comptime intFunc: anytype, comptime floatFunc: anytype) FT { | |
| 470 | return struct { | |
| 471 | fn op(a: Value, b: Value, ty: Type, comp: *Compilation) Value { | |
| 472 | const size = ty.sizeof(comp).?; | |
| 473 | if (@TypeOf(floatFunc) != @TypeOf(null) and ty.isFloat()) { | |
| 474 | switch (size) { | |
| 475 | 4 => return floatFunc(f32, a, b), | |
| 476 | 8 => return floatFunc(f64, a, b), | |
| 477 | else => unreachable, | |
| 478 | } | |
| 479 | } | |
| 480 | ||
| 481 | if (ty.isUnsignedInt(comp)) switch (size) { | |
| 482 | 1 => unreachable, // promoted to int | |
| 483 | 2 => unreachable, // promoted to int | |
| 484 | 4 => return intFunc(u32, a, b), | |
| 485 | 8 => return intFunc(u64, a, b), | |
| 486 | else => unreachable, | |
| 487 | } else switch (size) { | |
| 488 | 1 => unreachable, // promoted to int | |
| 489 | 2 => unreachable, // promoted to int | |
| 490 | 4 => return intFunc(i32, a, b), | |
| 491 | 8 => return intFunc(i64, a, b), | |
| 492 | else => unreachable, | |
| 493 | } | |
| 494 | } | |
| 495 | }.op; | |
| 496 | } | |
| 497 | }; | |
| 498 | ||
| 499 | /// caller guarantees rhs != 0 | |
| 500 | pub const div = bin_ops.getOp(bin_ops.divInt, bin_ops.divFloat); | |
| 501 | /// caller guarantees rhs != 0 | |
| 502 | /// caller guarantees lhs != std.math.minInt(T) OR rhs != -1 | |
| 503 | pub const rem = bin_ops.getOp(bin_ops.remInt, null); | |
| 504 | ||
| 505 | pub const bitOr = bin_ops.getOp(bin_ops.orInt, null); | |
| 506 | pub const bitXor = bin_ops.getOp(bin_ops.xorInt, null); | |
| 507 | pub const bitAnd = bin_ops.getOp(bin_ops.andInt, null); | |
| 508 | ||
| 509 | pub const shl = bin_ops.getOp(bin_ops.shl, null); | |
| 510 | pub const shr = bin_ops.getOp(bin_ops.shr, null); | |
| 511 | ||
| 512 | pub fn bitNot(v: Value, ty: Type, comp: *Compilation) Value { | |
| 513 | const size = ty.sizeof(comp).?; | |
| 514 | var out: Value = undefined; | |
| 515 | if (ty.isUnsignedInt(comp)) switch (size) { | |
| 516 | 1 => unreachable, // promoted to int | |
| 517 | 2 => unreachable, // promoted to int | |
| 518 | 4 => out = int(~v.getInt(u32)), | |
| 519 | 8 => out = int(~v.getInt(u64)), | |
| 520 | else => unreachable, | |
| 521 | } else switch (size) { | |
| 522 | 1 => unreachable, // promoted to int | |
| 523 | 2 => unreachable, // promoted to int | |
| 524 | 4 => out = int(~v.getInt(i32)), | |
| 525 | 8 => out = int(~v.getInt(i64)), | |
| 526 | else => unreachable, | |
| 527 | } | |
| 528 | return out; | |
| 529 | } | |
| 530 | ||
| 531 | pub fn compare(a: Value, op: std.math.CompareOperator, b: Value, ty: Type, comp: *const Compilation) bool { | |
| 532 | assert(a.tag == b.tag); | |
| 533 | if (a.tag == .nullptr_t) { | |
| 534 | return switch (op) { | |
| 535 | .eq => true, | |
| 536 | .neq => false, | |
| 537 | else => unreachable, | |
| 538 | }; | |
| 539 | } | |
| 540 | const S = struct { | |
| 541 | inline fn doICompare(comptime T: type, aa: Value, opp: std.math.CompareOperator, bb: Value) bool { | |
| 542 | const a_val = aa.getInt(T); | |
| 543 | const b_val = bb.getInt(T); | |
| 544 | return std.math.compare(a_val, opp, b_val); | |
| 545 | } | |
| 546 | inline fn doFCompare(comptime T: type, aa: Value, opp: std.math.CompareOperator, bb: Value) bool { | |
| 547 | const a_val = aa.getFloat(T); | |
| 548 | const b_val = bb.getFloat(T); | |
| 549 | return std.math.compare(a_val, opp, b_val); | |
| 550 | } | |
| 551 | }; | |
| 552 | const size = ty.sizeof(comp).?; | |
| 553 | switch (a.tag) { | |
| 554 | .unavailable => return true, | |
| 555 | .int => if (ty.isUnsignedInt(comp)) switch (size) { | |
| 556 | 1 => return S.doICompare(u8, a, op, b), | |
| 557 | 2 => return S.doICompare(u16, a, op, b), | |
| 558 | 4 => return S.doICompare(u32, a, op, b), | |
| 559 | 8 => return S.doICompare(u64, a, op, b), | |
| 560 | else => unreachable, | |
| 561 | } else switch (size) { | |
| 562 | 1 => return S.doICompare(i8, a, op, b), | |
| 563 | 2 => return S.doICompare(i16, a, op, b), | |
| 564 | 4 => return S.doICompare(i32, a, op, b), | |
| 565 | 8 => return S.doICompare(i64, a, op, b), | |
| 566 | else => unreachable, | |
| 567 | }, | |
| 568 | .float => switch (size) { | |
| 569 | 4 => return S.doFCompare(f32, a, op, b), | |
| 570 | 8 => return S.doFCompare(f64, a, op, b), | |
| 571 | else => unreachable, | |
| 572 | }, | |
| 573 | else => @panic("TODO"), | |
| 574 | } | |
| 575 | return false; | |
| 576 | } | |
| 577 | ||
| 578 | pub fn hash(v: Value) u64 { | |
| 579 | switch (v.tag) { | |
| 580 | .unavailable => unreachable, | |
| 581 | .int => return std.hash.Wyhash.hash(0, std.mem.asBytes(&v.data.int)), | |
| 582 | else => @panic("TODO"), | |
| 583 | } | |
| 584 | } | |
| 585 | ||
| 586 | pub fn dump(v: Value, ty: Type, comp: *Compilation, strings: []const u8, w: anytype) !void { | |
| 587 | switch (v.tag) { | |
| 588 | .unavailable => try w.writeAll("unavailable"), | |
| 589 | .int => if (ty.is(.bool) and comp.langopts.standard.atLeast(.c2x)) { | |
| 590 | try w.print("{s}", .{if (v.isZero()) "false" else "true"}); | |
| 591 | } else if (ty.isUnsignedInt(comp)) { | |
| 592 | try w.print("{d}", .{v.data.int}); | |
| 593 | } else { | |
| 594 | try w.print("{d}", .{v.signExtend(ty, comp)}); | |
| 595 | }, | |
| 596 | .bytes => try w.print("\"{s}\"", .{v.data.bytes.slice(strings)}), | |
| 597 | // std.fmt does @as instead of @floatCast | |
| 598 | .float => try w.print("{d}", .{@as(f64, @floatCast(v.data.float))}), | |
| 599 | else => try w.print("({s})", .{@tagName(v.tag)}), | |
| 600 | } | |
| 601 | } |
deps/aro/builtins/BuiltinFunction.zig created+35783| ... | ... | @@ -0,0 +1,35783 @@ |
| 1 | //! Autogenerated by process_builtins.py, do not edit | |
| 2 | ||
| 3 | const std = @import("std"); | |
| 4 | const Properties = @import("Properties.zig"); | |
| 5 | const TypeDescription = @import("TypeDescription.zig"); | |
| 6 | const Attributes = Properties.Attributes; | |
| 7 | const TargetSet = Properties.TargetSet; | |
| 8 | ||
| 9 | pub const Tag = blk: { | |
| 10 | @setEvalBranchQuota(10000); | |
| 11 | break :blk std.meta.DeclEnum(functions); | |
| 12 | }; | |
| 13 | ||
| 14 | tag: Tag, | |
| 15 | param_str: []const u8, | |
| 16 | properties: Properties, | |
| 17 | ||
| 18 | pub fn fromTag(builtin: Tag) @This() { | |
| 19 | @setEvalBranchQuota(10000); | |
| 20 | switch (builtin) { | |
| 21 | inline else => |tag| { | |
| 22 | const desc = @field(functions, @tagName(tag)); | |
| 23 | return .{ | |
| 24 | .tag = tag, | |
| 25 | .param_str = desc.param_str, | |
| 26 | .properties = .{ | |
| 27 | .language = if (@hasDecl(desc, "language")) @field(desc, "language") else .all_languages, | |
| 28 | .header = if (@hasDecl(desc, "header")) @field(desc, "header") else .none, | |
| 29 | .attributes = if (@hasDecl(desc, "attributes")) @field(desc, "attributes") else Attributes{}, | |
| 30 | .target_set = if (@hasDecl(desc, "target_set")) @field(desc, "target_set") else TargetSet.init(.{ .basic = true }), | |
| 31 | }, | |
| 32 | }; | |
| 33 | }, | |
| 34 | } | |
| 35 | } | |
| 36 | ||
| 37 | pub fn isVarArgs(self: @This()) bool { | |
| 38 | return self.param_str[self.param_str.len - 1] == '.'; | |
| 39 | } | |
| 40 | ||
| 41 | const functions = struct { | |
| 42 | pub const _Block_object_assign = struct { | |
| 43 | const param_str = "vv*vC*iC"; | |
| 44 | const header = .blocks; | |
| 45 | const attributes = Attributes{ | |
| 46 | .lib_function_without_prefix = true, | |
| 47 | }; | |
| 48 | }; | |
| 49 | ||
| 50 | pub const _Block_object_dispose = struct { | |
| 51 | const param_str = "vvC*iC"; | |
| 52 | const header = .blocks; | |
| 53 | const attributes = Attributes{ | |
| 54 | .lib_function_without_prefix = true, | |
| 55 | }; | |
| 56 | }; | |
| 57 | ||
| 58 | pub const _Exit = struct { | |
| 59 | const param_str = "vi"; | |
| 60 | const header = .stdlib; | |
| 61 | const attributes = Attributes{ | |
| 62 | .noreturn = true, | |
| 63 | .lib_function_without_prefix = true, | |
| 64 | }; | |
| 65 | }; | |
| 66 | ||
| 67 | pub const _InterlockedAnd = struct { | |
| 68 | const param_str = "NiNiD*Ni"; | |
| 69 | const language = .all_ms_languages; | |
| 70 | const attributes = Attributes{}; | |
| 71 | }; | |
| 72 | ||
| 73 | pub const _InterlockedAnd16 = struct { | |
| 74 | const param_str = "ssD*s"; | |
| 75 | const language = .all_ms_languages; | |
| 76 | const attributes = Attributes{}; | |
| 77 | }; | |
| 78 | ||
| 79 | pub const _InterlockedAnd8 = struct { | |
| 80 | const param_str = "ccD*c"; | |
| 81 | const language = .all_ms_languages; | |
| 82 | const attributes = Attributes{}; | |
| 83 | }; | |
| 84 | ||
| 85 | pub const _InterlockedCompareExchange = struct { | |
| 86 | const param_str = "NiNiD*NiNi"; | |
| 87 | const language = .all_ms_languages; | |
| 88 | const attributes = Attributes{}; | |
| 89 | }; | |
| 90 | ||
| 91 | pub const _InterlockedCompareExchange16 = struct { | |
| 92 | const param_str = "ssD*ss"; | |
| 93 | const language = .all_ms_languages; | |
| 94 | const attributes = Attributes{}; | |
| 95 | }; | |
| 96 | ||
| 97 | pub const _InterlockedCompareExchange64 = struct { | |
| 98 | const param_str = "LLiLLiD*LLiLLi"; | |
| 99 | const language = .all_ms_languages; | |
| 100 | const attributes = Attributes{}; | |
| 101 | }; | |
| 102 | ||
| 103 | pub const _InterlockedCompareExchange8 = struct { | |
| 104 | const param_str = "ccD*cc"; | |
| 105 | const language = .all_ms_languages; | |
| 106 | const attributes = Attributes{}; | |
| 107 | }; | |
| 108 | ||
| 109 | pub const _InterlockedCompareExchangePointer = struct { | |
| 110 | const param_str = "v*v*D*v*v*"; | |
| 111 | const language = .all_ms_languages; | |
| 112 | const attributes = Attributes{}; | |
| 113 | }; | |
| 114 | ||
| 115 | pub const _InterlockedCompareExchangePointer_nf = struct { | |
| 116 | const param_str = "v*v*D*v*v*"; | |
| 117 | const language = .all_ms_languages; | |
| 118 | const attributes = Attributes{}; | |
| 119 | }; | |
| 120 | ||
| 121 | pub const _InterlockedDecrement = struct { | |
| 122 | const param_str = "NiNiD*"; | |
| 123 | const language = .all_ms_languages; | |
| 124 | const attributes = Attributes{}; | |
| 125 | }; | |
| 126 | ||
| 127 | pub const _InterlockedDecrement16 = struct { | |
| 128 | const param_str = "ssD*"; | |
| 129 | const language = .all_ms_languages; | |
| 130 | const attributes = Attributes{}; | |
| 131 | }; | |
| 132 | ||
| 133 | pub const _InterlockedExchange = struct { | |
| 134 | const param_str = "NiNiD*Ni"; | |
| 135 | const language = .all_ms_languages; | |
| 136 | const attributes = Attributes{}; | |
| 137 | }; | |
| 138 | ||
| 139 | pub const _InterlockedExchange16 = struct { | |
| 140 | const param_str = "ssD*s"; | |
| 141 | const language = .all_ms_languages; | |
| 142 | const attributes = Attributes{}; | |
| 143 | }; | |
| 144 | ||
| 145 | pub const _InterlockedExchange8 = struct { | |
| 146 | const param_str = "ccD*c"; | |
| 147 | const language = .all_ms_languages; | |
| 148 | const attributes = Attributes{}; | |
| 149 | }; | |
| 150 | ||
| 151 | pub const _InterlockedExchangeAdd = struct { | |
| 152 | const param_str = "NiNiD*Ni"; | |
| 153 | const language = .all_ms_languages; | |
| 154 | const attributes = Attributes{}; | |
| 155 | }; | |
| 156 | ||
| 157 | pub const _InterlockedExchangeAdd16 = struct { | |
| 158 | const param_str = "ssD*s"; | |
| 159 | const language = .all_ms_languages; | |
| 160 | const attributes = Attributes{}; | |
| 161 | }; | |
| 162 | ||
| 163 | pub const _InterlockedExchangeAdd8 = struct { | |
| 164 | const param_str = "ccD*c"; | |
| 165 | const language = .all_ms_languages; | |
| 166 | const attributes = Attributes{}; | |
| 167 | }; | |
| 168 | ||
| 169 | pub const _InterlockedExchangePointer = struct { | |
| 170 | const param_str = "v*v*D*v*"; | |
| 171 | const language = .all_ms_languages; | |
| 172 | const attributes = Attributes{}; | |
| 173 | }; | |
| 174 | ||
| 175 | pub const _InterlockedExchangeSub = struct { | |
| 176 | const param_str = "NiNiD*Ni"; | |
| 177 | const language = .all_ms_languages; | |
| 178 | const attributes = Attributes{}; | |
| 179 | }; | |
| 180 | ||
| 181 | pub const _InterlockedExchangeSub16 = struct { | |
| 182 | const param_str = "ssD*s"; | |
| 183 | const language = .all_ms_languages; | |
| 184 | const attributes = Attributes{}; | |
| 185 | }; | |
| 186 | ||
| 187 | pub const _InterlockedExchangeSub8 = struct { | |
| 188 | const param_str = "ccD*c"; | |
| 189 | const language = .all_ms_languages; | |
| 190 | const attributes = Attributes{}; | |
| 191 | }; | |
| 192 | ||
| 193 | pub const _InterlockedIncrement = struct { | |
| 194 | const param_str = "NiNiD*"; | |
| 195 | const language = .all_ms_languages; | |
| 196 | const attributes = Attributes{}; | |
| 197 | }; | |
| 198 | ||
| 199 | pub const _InterlockedIncrement16 = struct { | |
| 200 | const param_str = "ssD*"; | |
| 201 | const language = .all_ms_languages; | |
| 202 | const attributes = Attributes{}; | |
| 203 | }; | |
| 204 | ||
| 205 | pub const _InterlockedOr = struct { | |
| 206 | const param_str = "NiNiD*Ni"; | |
| 207 | const language = .all_ms_languages; | |
| 208 | const attributes = Attributes{}; | |
| 209 | }; | |
| 210 | ||
| 211 | pub const _InterlockedOr16 = struct { | |
| 212 | const param_str = "ssD*s"; | |
| 213 | const language = .all_ms_languages; | |
| 214 | const attributes = Attributes{}; | |
| 215 | }; | |
| 216 | ||
| 217 | pub const _InterlockedOr8 = struct { | |
| 218 | const param_str = "ccD*c"; | |
| 219 | const language = .all_ms_languages; | |
| 220 | const attributes = Attributes{}; | |
| 221 | }; | |
| 222 | ||
| 223 | pub const _InterlockedXor = struct { | |
| 224 | const param_str = "NiNiD*Ni"; | |
| 225 | const language = .all_ms_languages; | |
| 226 | const attributes = Attributes{}; | |
| 227 | }; | |
| 228 | ||
| 229 | pub const _InterlockedXor16 = struct { | |
| 230 | const param_str = "ssD*s"; | |
| 231 | const language = .all_ms_languages; | |
| 232 | const attributes = Attributes{}; | |
| 233 | }; | |
| 234 | ||
| 235 | pub const _InterlockedXor8 = struct { | |
| 236 | const param_str = "ccD*c"; | |
| 237 | const language = .all_ms_languages; | |
| 238 | const attributes = Attributes{}; | |
| 239 | }; | |
| 240 | ||
| 241 | pub const _MoveFromCoprocessor = struct { | |
| 242 | const param_str = "UiIUiIUiIUiIUiIUi"; | |
| 243 | const language = .all_ms_languages; | |
| 244 | const target_set = TargetSet.init(.{ | |
| 245 | .arm = true, | |
| 246 | }); | |
| 247 | }; | |
| 248 | ||
| 249 | pub const _MoveFromCoprocessor2 = struct { | |
| 250 | const param_str = "UiIUiIUiIUiIUiIUi"; | |
| 251 | const language = .all_ms_languages; | |
| 252 | const target_set = TargetSet.init(.{ | |
| 253 | .arm = true, | |
| 254 | }); | |
| 255 | }; | |
| 256 | ||
| 257 | pub const _MoveToCoprocessor = struct { | |
| 258 | const param_str = "vUiIUiIUiIUiIUiIUi"; | |
| 259 | const language = .all_ms_languages; | |
| 260 | const target_set = TargetSet.init(.{ | |
| 261 | .arm = true, | |
| 262 | }); | |
| 263 | }; | |
| 264 | ||
| 265 | pub const _MoveToCoprocessor2 = struct { | |
| 266 | const param_str = "vUiIUiIUiIUiIUiIUi"; | |
| 267 | const language = .all_ms_languages; | |
| 268 | const target_set = TargetSet.init(.{ | |
| 269 | .arm = true, | |
| 270 | }); | |
| 271 | }; | |
| 272 | ||
| 273 | pub const _ReturnAddress = struct { | |
| 274 | const param_str = "v*"; | |
| 275 | const language = .all_ms_languages; | |
| 276 | const attributes = Attributes{}; | |
| 277 | }; | |
| 278 | ||
| 279 | pub const __GetExceptionInfo = struct { | |
| 280 | const param_str = "v*."; | |
| 281 | const language = .all_ms_languages; | |
| 282 | const attributes = Attributes{ | |
| 283 | .custom_typecheck = true, | |
| 284 | .eval_args = false, | |
| 285 | }; | |
| 286 | }; | |
| 287 | ||
| 288 | pub const __abnormal_termination = struct { | |
| 289 | const param_str = "i"; | |
| 290 | const language = .all_ms_languages; | |
| 291 | const attributes = Attributes{}; | |
| 292 | }; | |
| 293 | ||
| 294 | pub const __annotation = struct { | |
| 295 | const param_str = "wC*."; | |
| 296 | const language = .all_ms_languages; | |
| 297 | const attributes = Attributes{}; | |
| 298 | }; | |
| 299 | ||
| 300 | pub const __arithmetic_fence = struct { | |
| 301 | const param_str = "v."; | |
| 302 | const attributes = Attributes{ | |
| 303 | .custom_typecheck = true, | |
| 304 | .const_evaluable = true, | |
| 305 | }; | |
| 306 | }; | |
| 307 | ||
| 308 | pub const __assume = struct { | |
| 309 | const param_str = "vb"; | |
| 310 | const language = .all_ms_languages; | |
| 311 | const attributes = Attributes{ | |
| 312 | .const_evaluable = true, | |
| 313 | }; | |
| 314 | }; | |
| 315 | ||
| 316 | pub const __atomic_always_lock_free = struct { | |
| 317 | const param_str = "bzvCD*"; | |
| 318 | const attributes = Attributes{ | |
| 319 | .const_evaluable = true, | |
| 320 | }; | |
| 321 | }; | |
| 322 | ||
| 323 | pub const __atomic_clear = struct { | |
| 324 | const param_str = "vvD*i"; | |
| 325 | const attributes = Attributes{}; | |
| 326 | }; | |
| 327 | ||
| 328 | pub const __atomic_is_lock_free = struct { | |
| 329 | const param_str = "bzvCD*"; | |
| 330 | const attributes = Attributes{ | |
| 331 | .const_evaluable = true, | |
| 332 | }; | |
| 333 | }; | |
| 334 | ||
| 335 | pub const __atomic_signal_fence = struct { | |
| 336 | const param_str = "vi"; | |
| 337 | const attributes = Attributes{}; | |
| 338 | }; | |
| 339 | ||
| 340 | pub const __atomic_test_and_set = struct { | |
| 341 | const param_str = "bvD*i"; | |
| 342 | const attributes = Attributes{}; | |
| 343 | }; | |
| 344 | ||
| 345 | pub const __atomic_thread_fence = struct { | |
| 346 | const param_str = "vi"; | |
| 347 | const attributes = Attributes{}; | |
| 348 | }; | |
| 349 | ||
| 350 | pub const __builtin___CFStringMakeConstantString = struct { | |
| 351 | const param_str = "FC*cC*"; | |
| 352 | const attributes = Attributes{ | |
| 353 | .@"const" = true, | |
| 354 | .const_evaluable = true, | |
| 355 | }; | |
| 356 | }; | |
| 357 | ||
| 358 | pub const __builtin___NSStringMakeConstantString = struct { | |
| 359 | const param_str = "FC*cC*"; | |
| 360 | const attributes = Attributes{ | |
| 361 | .@"const" = true, | |
| 362 | .const_evaluable = true, | |
| 363 | }; | |
| 364 | }; | |
| 365 | ||
| 366 | pub const __builtin___clear_cache = struct { | |
| 367 | const param_str = "vc*c*"; | |
| 368 | const attributes = Attributes{}; | |
| 369 | }; | |
| 370 | ||
| 371 | pub const __builtin___fprintf_chk = struct { | |
| 372 | const param_str = "iP*icC*."; | |
| 373 | const attributes = Attributes{ | |
| 374 | .lib_function_with_builtin_prefix = true, | |
| 375 | .format_kind = .printf, | |
| 376 | .format_string_position = 2, | |
| 377 | }; | |
| 378 | }; | |
| 379 | ||
| 380 | pub const __builtin___get_unsafe_stack_bottom = struct { | |
| 381 | const param_str = "v*"; | |
| 382 | const attributes = Attributes{ | |
| 383 | .lib_function_with_builtin_prefix = true, | |
| 384 | }; | |
| 385 | }; | |
| 386 | ||
| 387 | pub const __builtin___get_unsafe_stack_ptr = struct { | |
| 388 | const param_str = "v*"; | |
| 389 | const attributes = Attributes{ | |
| 390 | .lib_function_with_builtin_prefix = true, | |
| 391 | }; | |
| 392 | }; | |
| 393 | ||
| 394 | pub const __builtin___get_unsafe_stack_start = struct { | |
| 395 | const param_str = "v*"; | |
| 396 | const attributes = Attributes{ | |
| 397 | .lib_function_with_builtin_prefix = true, | |
| 398 | }; | |
| 399 | }; | |
| 400 | ||
| 401 | pub const __builtin___get_unsafe_stack_top = struct { | |
| 402 | const param_str = "v*"; | |
| 403 | const attributes = Attributes{ | |
| 404 | .lib_function_with_builtin_prefix = true, | |
| 405 | }; | |
| 406 | }; | |
| 407 | ||
| 408 | pub const __builtin___memccpy_chk = struct { | |
| 409 | const param_str = "v*v*vC*izz"; | |
| 410 | const attributes = Attributes{ | |
| 411 | .lib_function_with_builtin_prefix = true, | |
| 412 | }; | |
| 413 | }; | |
| 414 | ||
| 415 | pub const __builtin___memcpy_chk = struct { | |
| 416 | const param_str = "v*v*vC*zz"; | |
| 417 | const attributes = Attributes{ | |
| 418 | .lib_function_with_builtin_prefix = true, | |
| 419 | }; | |
| 420 | }; | |
| 421 | ||
| 422 | pub const __builtin___memmove_chk = struct { | |
| 423 | const param_str = "v*v*vC*zz"; | |
| 424 | const attributes = Attributes{ | |
| 425 | .lib_function_with_builtin_prefix = true, | |
| 426 | }; | |
| 427 | }; | |
| 428 | ||
| 429 | pub const __builtin___mempcpy_chk = struct { | |
| 430 | const param_str = "v*v*vC*zz"; | |
| 431 | const attributes = Attributes{ | |
| 432 | .lib_function_with_builtin_prefix = true, | |
| 433 | }; | |
| 434 | }; | |
| 435 | ||
| 436 | pub const __builtin___memset_chk = struct { | |
| 437 | const param_str = "v*v*izz"; | |
| 438 | const attributes = Attributes{ | |
| 439 | .lib_function_with_builtin_prefix = true, | |
| 440 | }; | |
| 441 | }; | |
| 442 | ||
| 443 | pub const __builtin___printf_chk = struct { | |
| 444 | const param_str = "iicC*."; | |
| 445 | const attributes = Attributes{ | |
| 446 | .lib_function_with_builtin_prefix = true, | |
| 447 | .format_kind = .printf, | |
| 448 | .format_string_position = 1, | |
| 449 | }; | |
| 450 | }; | |
| 451 | ||
| 452 | pub const __builtin___snprintf_chk = struct { | |
| 453 | const param_str = "ic*zizcC*."; | |
| 454 | const attributes = Attributes{ | |
| 455 | .lib_function_with_builtin_prefix = true, | |
| 456 | .format_kind = .printf, | |
| 457 | .format_string_position = 4, | |
| 458 | }; | |
| 459 | }; | |
| 460 | ||
| 461 | pub const __builtin___sprintf_chk = struct { | |
| 462 | const param_str = "ic*izcC*."; | |
| 463 | const attributes = Attributes{ | |
| 464 | .lib_function_with_builtin_prefix = true, | |
| 465 | .format_kind = .printf, | |
| 466 | .format_string_position = 3, | |
| 467 | }; | |
| 468 | }; | |
| 469 | ||
| 470 | pub const __builtin___stpcpy_chk = struct { | |
| 471 | const param_str = "c*c*cC*z"; | |
| 472 | const attributes = Attributes{ | |
| 473 | .lib_function_with_builtin_prefix = true, | |
| 474 | }; | |
| 475 | }; | |
| 476 | ||
| 477 | pub const __builtin___stpncpy_chk = struct { | |
| 478 | const param_str = "c*c*cC*zz"; | |
| 479 | const attributes = Attributes{ | |
| 480 | .lib_function_with_builtin_prefix = true, | |
| 481 | }; | |
| 482 | }; | |
| 483 | ||
| 484 | pub const __builtin___strcat_chk = struct { | |
| 485 | const param_str = "c*c*cC*z"; | |
| 486 | const attributes = Attributes{ | |
| 487 | .lib_function_with_builtin_prefix = true, | |
| 488 | }; | |
| 489 | }; | |
| 490 | ||
| 491 | pub const __builtin___strcpy_chk = struct { | |
| 492 | const param_str = "c*c*cC*z"; | |
| 493 | const attributes = Attributes{ | |
| 494 | .lib_function_with_builtin_prefix = true, | |
| 495 | }; | |
| 496 | }; | |
| 497 | ||
| 498 | pub const __builtin___strlcat_chk = struct { | |
| 499 | const param_str = "zc*cC*zz"; | |
| 500 | const attributes = Attributes{ | |
| 501 | .lib_function_with_builtin_prefix = true, | |
| 502 | }; | |
| 503 | }; | |
| 504 | ||
| 505 | pub const __builtin___strlcpy_chk = struct { | |
| 506 | const param_str = "zc*cC*zz"; | |
| 507 | const attributes = Attributes{ | |
| 508 | .lib_function_with_builtin_prefix = true, | |
| 509 | }; | |
| 510 | }; | |
| 511 | ||
| 512 | pub const __builtin___strncat_chk = struct { | |
| 513 | const param_str = "c*c*cC*zz"; | |
| 514 | const attributes = Attributes{ | |
| 515 | .lib_function_with_builtin_prefix = true, | |
| 516 | }; | |
| 517 | }; | |
| 518 | ||
| 519 | pub const __builtin___strncpy_chk = struct { | |
| 520 | const param_str = "c*c*cC*zz"; | |
| 521 | const attributes = Attributes{ | |
| 522 | .lib_function_with_builtin_prefix = true, | |
| 523 | }; | |
| 524 | }; | |
| 525 | ||
| 526 | pub const __builtin___vfprintf_chk = struct { | |
| 527 | const param_str = "iP*icC*a"; | |
| 528 | const attributes = Attributes{ | |
| 529 | .lib_function_with_builtin_prefix = true, | |
| 530 | .format_kind = .vprintf, | |
| 531 | .format_string_position = 2, | |
| 532 | }; | |
| 533 | }; | |
| 534 | ||
| 535 | pub const __builtin___vprintf_chk = struct { | |
| 536 | const param_str = "iicC*a"; | |
| 537 | const attributes = Attributes{ | |
| 538 | .lib_function_with_builtin_prefix = true, | |
| 539 | .format_kind = .vprintf, | |
| 540 | .format_string_position = 1, | |
| 541 | }; | |
| 542 | }; | |
| 543 | ||
| 544 | pub const __builtin___vsnprintf_chk = struct { | |
| 545 | const param_str = "ic*zizcC*a"; | |
| 546 | const attributes = Attributes{ | |
| 547 | .lib_function_with_builtin_prefix = true, | |
| 548 | .format_kind = .vprintf, | |
| 549 | .format_string_position = 4, | |
| 550 | }; | |
| 551 | }; | |
| 552 | ||
| 553 | pub const __builtin___vsprintf_chk = struct { | |
| 554 | const param_str = "ic*izcC*a"; | |
| 555 | const attributes = Attributes{ | |
| 556 | .lib_function_with_builtin_prefix = true, | |
| 557 | .format_kind = .vprintf, | |
| 558 | .format_string_position = 3, | |
| 559 | }; | |
| 560 | }; | |
| 561 | ||
| 562 | pub const __builtin_abort = struct { | |
| 563 | const param_str = "v"; | |
| 564 | const attributes = Attributes{ | |
| 565 | .noreturn = true, | |
| 566 | .lib_function_with_builtin_prefix = true, | |
| 567 | }; | |
| 568 | }; | |
| 569 | ||
| 570 | pub const __builtin_abs = struct { | |
| 571 | const param_str = "ii"; | |
| 572 | const attributes = Attributes{ | |
| 573 | .@"const" = true, | |
| 574 | .lib_function_with_builtin_prefix = true, | |
| 575 | }; | |
| 576 | }; | |
| 577 | ||
| 578 | pub const __builtin_acos = struct { | |
| 579 | const param_str = "dd"; | |
| 580 | const attributes = Attributes{ | |
| 581 | .lib_function_with_builtin_prefix = true, | |
| 582 | .const_without_errno_and_fp_exceptions = true, | |
| 583 | }; | |
| 584 | }; | |
| 585 | ||
| 586 | pub const __builtin_acosf = struct { | |
| 587 | const param_str = "ff"; | |
| 588 | const attributes = Attributes{ | |
| 589 | .lib_function_with_builtin_prefix = true, | |
| 590 | .const_without_errno_and_fp_exceptions = true, | |
| 591 | }; | |
| 592 | }; | |
| 593 | ||
| 594 | pub const __builtin_acosf128 = struct { | |
| 595 | const param_str = "LLdLLd"; | |
| 596 | const attributes = Attributes{ | |
| 597 | .lib_function_with_builtin_prefix = true, | |
| 598 | .const_without_errno_and_fp_exceptions = true, | |
| 599 | }; | |
| 600 | }; | |
| 601 | ||
| 602 | pub const __builtin_acosh = struct { | |
| 603 | const param_str = "dd"; | |
| 604 | const attributes = Attributes{ | |
| 605 | .lib_function_with_builtin_prefix = true, | |
| 606 | .const_without_errno_and_fp_exceptions = true, | |
| 607 | }; | |
| 608 | }; | |
| 609 | ||
| 610 | pub const __builtin_acoshf = struct { | |
| 611 | const param_str = "ff"; | |
| 612 | const attributes = Attributes{ | |
| 613 | .lib_function_with_builtin_prefix = true, | |
| 614 | .const_without_errno_and_fp_exceptions = true, | |
| 615 | }; | |
| 616 | }; | |
| 617 | ||
| 618 | pub const __builtin_acoshf128 = struct { | |
| 619 | const param_str = "LLdLLd"; | |
| 620 | const attributes = Attributes{ | |
| 621 | .lib_function_with_builtin_prefix = true, | |
| 622 | .const_without_errno_and_fp_exceptions = true, | |
| 623 | }; | |
| 624 | }; | |
| 625 | ||
| 626 | pub const __builtin_acoshl = struct { | |
| 627 | const param_str = "LdLd"; | |
| 628 | const attributes = Attributes{ | |
| 629 | .lib_function_with_builtin_prefix = true, | |
| 630 | .const_without_errno_and_fp_exceptions = true, | |
| 631 | }; | |
| 632 | }; | |
| 633 | ||
| 634 | pub const __builtin_acosl = struct { | |
| 635 | const param_str = "LdLd"; | |
| 636 | const attributes = Attributes{ | |
| 637 | .lib_function_with_builtin_prefix = true, | |
| 638 | .const_without_errno_and_fp_exceptions = true, | |
| 639 | }; | |
| 640 | }; | |
| 641 | ||
| 642 | pub const __builtin_add_overflow = struct { | |
| 643 | const param_str = "b."; | |
| 644 | const attributes = Attributes{ | |
| 645 | .custom_typecheck = true, | |
| 646 | .const_evaluable = true, | |
| 647 | }; | |
| 648 | }; | |
| 649 | ||
| 650 | pub const __builtin_addc = struct { | |
| 651 | const param_str = "UiUiCUiCUiCUi*"; | |
| 652 | const attributes = Attributes{}; | |
| 653 | }; | |
| 654 | ||
| 655 | pub const __builtin_addcb = struct { | |
| 656 | const param_str = "UcUcCUcCUcCUc*"; | |
| 657 | const attributes = Attributes{}; | |
| 658 | }; | |
| 659 | ||
| 660 | pub const __builtin_addcl = struct { | |
| 661 | const param_str = "ULiULiCULiCULiCULi*"; | |
| 662 | const attributes = Attributes{}; | |
| 663 | }; | |
| 664 | ||
| 665 | pub const __builtin_addcll = struct { | |
| 666 | const param_str = "ULLiULLiCULLiCULLiCULLi*"; | |
| 667 | const attributes = Attributes{}; | |
| 668 | }; | |
| 669 | ||
| 670 | pub const __builtin_addcs = struct { | |
| 671 | const param_str = "UsUsCUsCUsCUs*"; | |
| 672 | const attributes = Attributes{}; | |
| 673 | }; | |
| 674 | ||
| 675 | pub const __builtin_addf128_round_to_odd = struct { | |
| 676 | const param_str = "LLdLLdLLd"; | |
| 677 | const target_set = TargetSet.init(.{ | |
| 678 | .ppc = true, | |
| 679 | }); | |
| 680 | }; | |
| 681 | ||
| 682 | pub const __builtin_align_down = struct { | |
| 683 | const param_str = "v*vC*z"; | |
| 684 | const attributes = Attributes{ | |
| 685 | .@"const" = true, | |
| 686 | .custom_typecheck = true, | |
| 687 | .const_evaluable = true, | |
| 688 | }; | |
| 689 | }; | |
| 690 | ||
| 691 | pub const __builtin_align_up = struct { | |
| 692 | const param_str = "v*vC*z"; | |
| 693 | const attributes = Attributes{ | |
| 694 | .@"const" = true, | |
| 695 | .custom_typecheck = true, | |
| 696 | .const_evaluable = true, | |
| 697 | }; | |
| 698 | }; | |
| 699 | ||
| 700 | pub const __builtin_alloca = struct { | |
| 701 | const param_str = "v*z"; | |
| 702 | const attributes = Attributes{ | |
| 703 | .lib_function_with_builtin_prefix = true, | |
| 704 | }; | |
| 705 | }; | |
| 706 | ||
| 707 | pub const __builtin_alloca_uninitialized = struct { | |
| 708 | const param_str = "v*z"; | |
| 709 | const attributes = Attributes{ | |
| 710 | .lib_function_with_builtin_prefix = true, | |
| 711 | }; | |
| 712 | }; | |
| 713 | ||
| 714 | pub const __builtin_alloca_with_align = struct { | |
| 715 | const param_str = "v*zIz"; | |
| 716 | const attributes = Attributes{ | |
| 717 | .lib_function_with_builtin_prefix = true, | |
| 718 | }; | |
| 719 | }; | |
| 720 | ||
| 721 | pub const __builtin_alloca_with_align_uninitialized = struct { | |
| 722 | const param_str = "v*zIz"; | |
| 723 | const attributes = Attributes{ | |
| 724 | .lib_function_with_builtin_prefix = true, | |
| 725 | }; | |
| 726 | }; | |
| 727 | ||
| 728 | pub const __builtin_altivec_crypto_vcipher = struct { | |
| 729 | const param_str = "V16UcV16UcV16Uc"; | |
| 730 | const target_set = TargetSet.init(.{ | |
| 731 | .ppc = true, | |
| 732 | }); | |
| 733 | }; | |
| 734 | ||
| 735 | pub const __builtin_altivec_crypto_vcipherlast = struct { | |
| 736 | const param_str = "V16UcV16UcV16Uc"; | |
| 737 | const target_set = TargetSet.init(.{ | |
| 738 | .ppc = true, | |
| 739 | }); | |
| 740 | }; | |
| 741 | ||
| 742 | pub const __builtin_altivec_crypto_vncipher = struct { | |
| 743 | const param_str = "V16UcV16UcV16Uc"; | |
| 744 | const target_set = TargetSet.init(.{ | |
| 745 | .ppc = true, | |
| 746 | }); | |
| 747 | }; | |
| 748 | ||
| 749 | pub const __builtin_altivec_crypto_vncipherlast = struct { | |
| 750 | const param_str = "V16UcV16UcV16Uc"; | |
| 751 | const target_set = TargetSet.init(.{ | |
| 752 | .ppc = true, | |
| 753 | }); | |
| 754 | }; | |
| 755 | ||
| 756 | pub const __builtin_altivec_crypto_vpermxor = struct { | |
| 757 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 758 | const target_set = TargetSet.init(.{ | |
| 759 | .ppc = true, | |
| 760 | }); | |
| 761 | }; | |
| 762 | ||
| 763 | pub const __builtin_altivec_crypto_vpermxor_be = struct { | |
| 764 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 765 | const target_set = TargetSet.init(.{ | |
| 766 | .ppc = true, | |
| 767 | }); | |
| 768 | }; | |
| 769 | ||
| 770 | pub const __builtin_altivec_crypto_vpmsumb = struct { | |
| 771 | const param_str = "V16UcV16UcV16Uc"; | |
| 772 | const target_set = TargetSet.init(.{ | |
| 773 | .ppc = true, | |
| 774 | }); | |
| 775 | }; | |
| 776 | ||
| 777 | pub const __builtin_altivec_crypto_vpmsumd = struct { | |
| 778 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 779 | const target_set = TargetSet.init(.{ | |
| 780 | .ppc = true, | |
| 781 | }); | |
| 782 | }; | |
| 783 | ||
| 784 | pub const __builtin_altivec_crypto_vpmsumh = struct { | |
| 785 | const param_str = "V8UsV8UsV8Us"; | |
| 786 | const target_set = TargetSet.init(.{ | |
| 787 | .ppc = true, | |
| 788 | }); | |
| 789 | }; | |
| 790 | ||
| 791 | pub const __builtin_altivec_crypto_vpmsumw = struct { | |
| 792 | const param_str = "V4UiV4UiV4Ui"; | |
| 793 | const target_set = TargetSet.init(.{ | |
| 794 | .ppc = true, | |
| 795 | }); | |
| 796 | }; | |
| 797 | ||
| 798 | pub const __builtin_altivec_crypto_vsbox = struct { | |
| 799 | const param_str = "V16UcV16Uc"; | |
| 800 | const target_set = TargetSet.init(.{ | |
| 801 | .ppc = true, | |
| 802 | }); | |
| 803 | }; | |
| 804 | ||
| 805 | pub const __builtin_altivec_crypto_vshasigmad = struct { | |
| 806 | const param_str = "V2ULLiV2ULLiIiIi"; | |
| 807 | const target_set = TargetSet.init(.{ | |
| 808 | .ppc = true, | |
| 809 | }); | |
| 810 | }; | |
| 811 | ||
| 812 | pub const __builtin_altivec_crypto_vshasigmaw = struct { | |
| 813 | const param_str = "V4UiV4UiIiIi"; | |
| 814 | const target_set = TargetSet.init(.{ | |
| 815 | .ppc = true, | |
| 816 | }); | |
| 817 | }; | |
| 818 | ||
| 819 | pub const __builtin_altivec_dss = struct { | |
| 820 | const param_str = "vUIi"; | |
| 821 | const target_set = TargetSet.init(.{ | |
| 822 | .ppc = true, | |
| 823 | }); | |
| 824 | }; | |
| 825 | ||
| 826 | pub const __builtin_altivec_dssall = struct { | |
| 827 | const param_str = "v"; | |
| 828 | const target_set = TargetSet.init(.{ | |
| 829 | .ppc = true, | |
| 830 | }); | |
| 831 | }; | |
| 832 | ||
| 833 | pub const __builtin_altivec_dst = struct { | |
| 834 | const param_str = "vvC*iUIi"; | |
| 835 | const target_set = TargetSet.init(.{ | |
| 836 | .ppc = true, | |
| 837 | }); | |
| 838 | }; | |
| 839 | ||
| 840 | pub const __builtin_altivec_dstst = struct { | |
| 841 | const param_str = "vvC*iUIi"; | |
| 842 | const target_set = TargetSet.init(.{ | |
| 843 | .ppc = true, | |
| 844 | }); | |
| 845 | }; | |
| 846 | ||
| 847 | pub const __builtin_altivec_dststt = struct { | |
| 848 | const param_str = "vvC*iUIi"; | |
| 849 | const target_set = TargetSet.init(.{ | |
| 850 | .ppc = true, | |
| 851 | }); | |
| 852 | }; | |
| 853 | ||
| 854 | pub const __builtin_altivec_dstt = struct { | |
| 855 | const param_str = "vvC*iUIi"; | |
| 856 | const target_set = TargetSet.init(.{ | |
| 857 | .ppc = true, | |
| 858 | }); | |
| 859 | }; | |
| 860 | ||
| 861 | pub const __builtin_altivec_lvebx = struct { | |
| 862 | const param_str = "V16cLivC*"; | |
| 863 | const target_set = TargetSet.init(.{ | |
| 864 | .ppc = true, | |
| 865 | }); | |
| 866 | }; | |
| 867 | ||
| 868 | pub const __builtin_altivec_lvehx = struct { | |
| 869 | const param_str = "V8sLivC*"; | |
| 870 | const target_set = TargetSet.init(.{ | |
| 871 | .ppc = true, | |
| 872 | }); | |
| 873 | }; | |
| 874 | ||
| 875 | pub const __builtin_altivec_lvewx = struct { | |
| 876 | const param_str = "V4iLivC*"; | |
| 877 | const target_set = TargetSet.init(.{ | |
| 878 | .ppc = true, | |
| 879 | }); | |
| 880 | }; | |
| 881 | ||
| 882 | pub const __builtin_altivec_lvsl = struct { | |
| 883 | const param_str = "V16cUcvC*"; | |
| 884 | const target_set = TargetSet.init(.{ | |
| 885 | .ppc = true, | |
| 886 | }); | |
| 887 | }; | |
| 888 | ||
| 889 | pub const __builtin_altivec_lvsr = struct { | |
| 890 | const param_str = "V16cUcvC*"; | |
| 891 | const target_set = TargetSet.init(.{ | |
| 892 | .ppc = true, | |
| 893 | }); | |
| 894 | }; | |
| 895 | ||
| 896 | pub const __builtin_altivec_lvx = struct { | |
| 897 | const param_str = "V4iLivC*"; | |
| 898 | const target_set = TargetSet.init(.{ | |
| 899 | .ppc = true, | |
| 900 | }); | |
| 901 | }; | |
| 902 | ||
| 903 | pub const __builtin_altivec_lvxl = struct { | |
| 904 | const param_str = "V4iLivC*"; | |
| 905 | const target_set = TargetSet.init(.{ | |
| 906 | .ppc = true, | |
| 907 | }); | |
| 908 | }; | |
| 909 | ||
| 910 | pub const __builtin_altivec_mfvscr = struct { | |
| 911 | const param_str = "V8Us"; | |
| 912 | const target_set = TargetSet.init(.{ | |
| 913 | .ppc = true, | |
| 914 | }); | |
| 915 | }; | |
| 916 | ||
| 917 | pub const __builtin_altivec_mtvscr = struct { | |
| 918 | const param_str = "vV4i"; | |
| 919 | const target_set = TargetSet.init(.{ | |
| 920 | .ppc = true, | |
| 921 | }); | |
| 922 | }; | |
| 923 | ||
| 924 | pub const __builtin_altivec_mtvsrbm = struct { | |
| 925 | const param_str = "V16UcULLi"; | |
| 926 | const target_set = TargetSet.init(.{ | |
| 927 | .ppc = true, | |
| 928 | }); | |
| 929 | }; | |
| 930 | ||
| 931 | pub const __builtin_altivec_mtvsrdm = struct { | |
| 932 | const param_str = "V2ULLiULLi"; | |
| 933 | const target_set = TargetSet.init(.{ | |
| 934 | .ppc = true, | |
| 935 | }); | |
| 936 | }; | |
| 937 | ||
| 938 | pub const __builtin_altivec_mtvsrhm = struct { | |
| 939 | const param_str = "V8UsULLi"; | |
| 940 | const target_set = TargetSet.init(.{ | |
| 941 | .ppc = true, | |
| 942 | }); | |
| 943 | }; | |
| 944 | ||
| 945 | pub const __builtin_altivec_mtvsrqm = struct { | |
| 946 | const param_str = "V1ULLLiULLi"; | |
| 947 | const target_set = TargetSet.init(.{ | |
| 948 | .ppc = true, | |
| 949 | }); | |
| 950 | }; | |
| 951 | ||
| 952 | pub const __builtin_altivec_mtvsrwm = struct { | |
| 953 | const param_str = "V4UiULLi"; | |
| 954 | const target_set = TargetSet.init(.{ | |
| 955 | .ppc = true, | |
| 956 | }); | |
| 957 | }; | |
| 958 | ||
| 959 | pub const __builtin_altivec_stvebx = struct { | |
| 960 | const param_str = "vV16cLiv*"; | |
| 961 | const target_set = TargetSet.init(.{ | |
| 962 | .ppc = true, | |
| 963 | }); | |
| 964 | }; | |
| 965 | ||
| 966 | pub const __builtin_altivec_stvehx = struct { | |
| 967 | const param_str = "vV8sLiv*"; | |
| 968 | const target_set = TargetSet.init(.{ | |
| 969 | .ppc = true, | |
| 970 | }); | |
| 971 | }; | |
| 972 | ||
| 973 | pub const __builtin_altivec_stvewx = struct { | |
| 974 | const param_str = "vV4iLiv*"; | |
| 975 | const target_set = TargetSet.init(.{ | |
| 976 | .ppc = true, | |
| 977 | }); | |
| 978 | }; | |
| 979 | ||
| 980 | pub const __builtin_altivec_stvx = struct { | |
| 981 | const param_str = "vV4iLiv*"; | |
| 982 | const target_set = TargetSet.init(.{ | |
| 983 | .ppc = true, | |
| 984 | }); | |
| 985 | }; | |
| 986 | ||
| 987 | pub const __builtin_altivec_stvxl = struct { | |
| 988 | const param_str = "vV4iLiv*"; | |
| 989 | const target_set = TargetSet.init(.{ | |
| 990 | .ppc = true, | |
| 991 | }); | |
| 992 | }; | |
| 993 | ||
| 994 | pub const __builtin_altivec_vabsdub = struct { | |
| 995 | const param_str = "V16UcV16UcV16Uc"; | |
| 996 | const target_set = TargetSet.init(.{ | |
| 997 | .ppc = true, | |
| 998 | }); | |
| 999 | }; | |
| 1000 | ||
| 1001 | pub const __builtin_altivec_vabsduh = struct { | |
| 1002 | const param_str = "V8UsV8UsV8Us"; | |
| 1003 | const target_set = TargetSet.init(.{ | |
| 1004 | .ppc = true, | |
| 1005 | }); | |
| 1006 | }; | |
| 1007 | ||
| 1008 | pub const __builtin_altivec_vabsduw = struct { | |
| 1009 | const param_str = "V4UiV4UiV4Ui"; | |
| 1010 | const target_set = TargetSet.init(.{ | |
| 1011 | .ppc = true, | |
| 1012 | }); | |
| 1013 | }; | |
| 1014 | ||
| 1015 | pub const __builtin_altivec_vaddcuq = struct { | |
| 1016 | const param_str = "V1ULLLiV1ULLLiV1ULLLi"; | |
| 1017 | const target_set = TargetSet.init(.{ | |
| 1018 | .ppc = true, | |
| 1019 | }); | |
| 1020 | }; | |
| 1021 | ||
| 1022 | pub const __builtin_altivec_vaddcuq_c = struct { | |
| 1023 | const param_str = "V16UcV16UcV16Uc"; | |
| 1024 | const target_set = TargetSet.init(.{ | |
| 1025 | .ppc = true, | |
| 1026 | }); | |
| 1027 | }; | |
| 1028 | ||
| 1029 | pub const __builtin_altivec_vaddcuw = struct { | |
| 1030 | const param_str = "V4UiV4UiV4Ui"; | |
| 1031 | const target_set = TargetSet.init(.{ | |
| 1032 | .ppc = true, | |
| 1033 | }); | |
| 1034 | }; | |
| 1035 | ||
| 1036 | pub const __builtin_altivec_vaddecuq = struct { | |
| 1037 | const param_str = "V1ULLLiV1ULLLiV1ULLLiV1ULLLi"; | |
| 1038 | const target_set = TargetSet.init(.{ | |
| 1039 | .ppc = true, | |
| 1040 | }); | |
| 1041 | }; | |
| 1042 | ||
| 1043 | pub const __builtin_altivec_vaddecuq_c = struct { | |
| 1044 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 1045 | const target_set = TargetSet.init(.{ | |
| 1046 | .ppc = true, | |
| 1047 | }); | |
| 1048 | }; | |
| 1049 | ||
| 1050 | pub const __builtin_altivec_vaddeuqm = struct { | |
| 1051 | const param_str = "V1ULLLiV1ULLLiV1ULLLiV1ULLLi"; | |
| 1052 | const target_set = TargetSet.init(.{ | |
| 1053 | .ppc = true, | |
| 1054 | }); | |
| 1055 | }; | |
| 1056 | ||
| 1057 | pub const __builtin_altivec_vaddeuqm_c = struct { | |
| 1058 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 1059 | const target_set = TargetSet.init(.{ | |
| 1060 | .ppc = true, | |
| 1061 | }); | |
| 1062 | }; | |
| 1063 | ||
| 1064 | pub const __builtin_altivec_vaddsbs = struct { | |
| 1065 | const param_str = "V16ScV16ScV16Sc"; | |
| 1066 | const target_set = TargetSet.init(.{ | |
| 1067 | .ppc = true, | |
| 1068 | }); | |
| 1069 | }; | |
| 1070 | ||
| 1071 | pub const __builtin_altivec_vaddshs = struct { | |
| 1072 | const param_str = "V8SsV8SsV8Ss"; | |
| 1073 | const target_set = TargetSet.init(.{ | |
| 1074 | .ppc = true, | |
| 1075 | }); | |
| 1076 | }; | |
| 1077 | ||
| 1078 | pub const __builtin_altivec_vaddsws = struct { | |
| 1079 | const param_str = "V4SiV4SiV4Si"; | |
| 1080 | const target_set = TargetSet.init(.{ | |
| 1081 | .ppc = true, | |
| 1082 | }); | |
| 1083 | }; | |
| 1084 | ||
| 1085 | pub const __builtin_altivec_vaddubs = struct { | |
| 1086 | const param_str = "V16UcV16UcV16Uc"; | |
| 1087 | const target_set = TargetSet.init(.{ | |
| 1088 | .ppc = true, | |
| 1089 | }); | |
| 1090 | }; | |
| 1091 | ||
| 1092 | pub const __builtin_altivec_vadduhs = struct { | |
| 1093 | const param_str = "V8UsV8UsV8Us"; | |
| 1094 | const target_set = TargetSet.init(.{ | |
| 1095 | .ppc = true, | |
| 1096 | }); | |
| 1097 | }; | |
| 1098 | ||
| 1099 | pub const __builtin_altivec_vadduqm = struct { | |
| 1100 | const param_str = "V1ULLLiV16UcV16Uc"; | |
| 1101 | const target_set = TargetSet.init(.{ | |
| 1102 | .ppc = true, | |
| 1103 | }); | |
| 1104 | }; | |
| 1105 | ||
| 1106 | pub const __builtin_altivec_vadduws = struct { | |
| 1107 | const param_str = "V4UiV4UiV4Ui"; | |
| 1108 | const target_set = TargetSet.init(.{ | |
| 1109 | .ppc = true, | |
| 1110 | }); | |
| 1111 | }; | |
| 1112 | ||
| 1113 | pub const __builtin_altivec_vavgsb = struct { | |
| 1114 | const param_str = "V16ScV16ScV16Sc"; | |
| 1115 | const target_set = TargetSet.init(.{ | |
| 1116 | .ppc = true, | |
| 1117 | }); | |
| 1118 | }; | |
| 1119 | ||
| 1120 | pub const __builtin_altivec_vavgsh = struct { | |
| 1121 | const param_str = "V8SsV8SsV8Ss"; | |
| 1122 | const target_set = TargetSet.init(.{ | |
| 1123 | .ppc = true, | |
| 1124 | }); | |
| 1125 | }; | |
| 1126 | ||
| 1127 | pub const __builtin_altivec_vavgsw = struct { | |
| 1128 | const param_str = "V4SiV4SiV4Si"; | |
| 1129 | const target_set = TargetSet.init(.{ | |
| 1130 | .ppc = true, | |
| 1131 | }); | |
| 1132 | }; | |
| 1133 | ||
| 1134 | pub const __builtin_altivec_vavgub = struct { | |
| 1135 | const param_str = "V16UcV16UcV16Uc"; | |
| 1136 | const target_set = TargetSet.init(.{ | |
| 1137 | .ppc = true, | |
| 1138 | }); | |
| 1139 | }; | |
| 1140 | ||
| 1141 | pub const __builtin_altivec_vavguh = struct { | |
| 1142 | const param_str = "V8UsV8UsV8Us"; | |
| 1143 | const target_set = TargetSet.init(.{ | |
| 1144 | .ppc = true, | |
| 1145 | }); | |
| 1146 | }; | |
| 1147 | ||
| 1148 | pub const __builtin_altivec_vavguw = struct { | |
| 1149 | const param_str = "V4UiV4UiV4Ui"; | |
| 1150 | const target_set = TargetSet.init(.{ | |
| 1151 | .ppc = true, | |
| 1152 | }); | |
| 1153 | }; | |
| 1154 | ||
| 1155 | pub const __builtin_altivec_vbpermd = struct { | |
| 1156 | const param_str = "V2ULLiV2ULLiV16Uc"; | |
| 1157 | const target_set = TargetSet.init(.{ | |
| 1158 | .ppc = true, | |
| 1159 | }); | |
| 1160 | }; | |
| 1161 | ||
| 1162 | pub const __builtin_altivec_vbpermq = struct { | |
| 1163 | const param_str = "V2ULLiV16UcV16Uc"; | |
| 1164 | const target_set = TargetSet.init(.{ | |
| 1165 | .ppc = true, | |
| 1166 | }); | |
| 1167 | }; | |
| 1168 | ||
| 1169 | pub const __builtin_altivec_vcfsx = struct { | |
| 1170 | const param_str = "V4fV4SiIi"; | |
| 1171 | const target_set = TargetSet.init(.{ | |
| 1172 | .ppc = true, | |
| 1173 | }); | |
| 1174 | }; | |
| 1175 | ||
| 1176 | pub const __builtin_altivec_vcfuged = struct { | |
| 1177 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 1178 | const target_set = TargetSet.init(.{ | |
| 1179 | .ppc = true, | |
| 1180 | }); | |
| 1181 | }; | |
| 1182 | ||
| 1183 | pub const __builtin_altivec_vcfux = struct { | |
| 1184 | const param_str = "V4fV4UiIi"; | |
| 1185 | const target_set = TargetSet.init(.{ | |
| 1186 | .ppc = true, | |
| 1187 | }); | |
| 1188 | }; | |
| 1189 | ||
| 1190 | pub const __builtin_altivec_vclrlb = struct { | |
| 1191 | const param_str = "V16UcV16UcUi"; | |
| 1192 | const target_set = TargetSet.init(.{ | |
| 1193 | .ppc = true, | |
| 1194 | }); | |
| 1195 | }; | |
| 1196 | ||
| 1197 | pub const __builtin_altivec_vclrrb = struct { | |
| 1198 | const param_str = "V16UcV16UcUi"; | |
| 1199 | const target_set = TargetSet.init(.{ | |
| 1200 | .ppc = true, | |
| 1201 | }); | |
| 1202 | }; | |
| 1203 | ||
| 1204 | pub const __builtin_altivec_vclzb = struct { | |
| 1205 | const param_str = "V16UcV16Uc"; | |
| 1206 | const target_set = TargetSet.init(.{ | |
| 1207 | .ppc = true, | |
| 1208 | }); | |
| 1209 | }; | |
| 1210 | ||
| 1211 | pub const __builtin_altivec_vclzd = struct { | |
| 1212 | const param_str = "V2ULLiV2ULLi"; | |
| 1213 | const target_set = TargetSet.init(.{ | |
| 1214 | .ppc = true, | |
| 1215 | }); | |
| 1216 | }; | |
| 1217 | ||
| 1218 | pub const __builtin_altivec_vclzdm = struct { | |
| 1219 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 1220 | const target_set = TargetSet.init(.{ | |
| 1221 | .ppc = true, | |
| 1222 | }); | |
| 1223 | }; | |
| 1224 | ||
| 1225 | pub const __builtin_altivec_vclzh = struct { | |
| 1226 | const param_str = "V8UsV8Us"; | |
| 1227 | const target_set = TargetSet.init(.{ | |
| 1228 | .ppc = true, | |
| 1229 | }); | |
| 1230 | }; | |
| 1231 | ||
| 1232 | pub const __builtin_altivec_vclzlsbb = struct { | |
| 1233 | const param_str = "SiV16Uc"; | |
| 1234 | const target_set = TargetSet.init(.{ | |
| 1235 | .ppc = true, | |
| 1236 | }); | |
| 1237 | }; | |
| 1238 | ||
| 1239 | pub const __builtin_altivec_vclzw = struct { | |
| 1240 | const param_str = "V4UiV4Ui"; | |
| 1241 | const target_set = TargetSet.init(.{ | |
| 1242 | .ppc = true, | |
| 1243 | }); | |
| 1244 | }; | |
| 1245 | ||
| 1246 | pub const __builtin_altivec_vcmpbfp = struct { | |
| 1247 | const param_str = "V4iV4fV4f"; | |
| 1248 | const target_set = TargetSet.init(.{ | |
| 1249 | .ppc = true, | |
| 1250 | }); | |
| 1251 | }; | |
| 1252 | ||
| 1253 | pub const __builtin_altivec_vcmpbfp_p = struct { | |
| 1254 | const param_str = "iiV4fV4f"; | |
| 1255 | const target_set = TargetSet.init(.{ | |
| 1256 | .ppc = true, | |
| 1257 | }); | |
| 1258 | }; | |
| 1259 | ||
| 1260 | pub const __builtin_altivec_vcmpeqfp = struct { | |
| 1261 | const param_str = "V4iV4fV4f"; | |
| 1262 | const target_set = TargetSet.init(.{ | |
| 1263 | .ppc = true, | |
| 1264 | }); | |
| 1265 | }; | |
| 1266 | ||
| 1267 | pub const __builtin_altivec_vcmpeqfp_p = struct { | |
| 1268 | const param_str = "iiV4fV4f"; | |
| 1269 | const target_set = TargetSet.init(.{ | |
| 1270 | .ppc = true, | |
| 1271 | }); | |
| 1272 | }; | |
| 1273 | ||
| 1274 | pub const __builtin_altivec_vcmpequb = struct { | |
| 1275 | const param_str = "V16cV16cV16c"; | |
| 1276 | const target_set = TargetSet.init(.{ | |
| 1277 | .ppc = true, | |
| 1278 | }); | |
| 1279 | }; | |
| 1280 | ||
| 1281 | pub const __builtin_altivec_vcmpequb_p = struct { | |
| 1282 | const param_str = "iiV16cV16c"; | |
| 1283 | const target_set = TargetSet.init(.{ | |
| 1284 | .ppc = true, | |
| 1285 | }); | |
| 1286 | }; | |
| 1287 | ||
| 1288 | pub const __builtin_altivec_vcmpequd = struct { | |
| 1289 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 1290 | const target_set = TargetSet.init(.{ | |
| 1291 | .ppc = true, | |
| 1292 | }); | |
| 1293 | }; | |
| 1294 | ||
| 1295 | pub const __builtin_altivec_vcmpequd_p = struct { | |
| 1296 | const param_str = "iiV2LLiV2LLi"; | |
| 1297 | const target_set = TargetSet.init(.{ | |
| 1298 | .ppc = true, | |
| 1299 | }); | |
| 1300 | }; | |
| 1301 | ||
| 1302 | pub const __builtin_altivec_vcmpequh = struct { | |
| 1303 | const param_str = "V8sV8sV8s"; | |
| 1304 | const target_set = TargetSet.init(.{ | |
| 1305 | .ppc = true, | |
| 1306 | }); | |
| 1307 | }; | |
| 1308 | ||
| 1309 | pub const __builtin_altivec_vcmpequh_p = struct { | |
| 1310 | const param_str = "iiV8sV8s"; | |
| 1311 | const target_set = TargetSet.init(.{ | |
| 1312 | .ppc = true, | |
| 1313 | }); | |
| 1314 | }; | |
| 1315 | ||
| 1316 | pub const __builtin_altivec_vcmpequq = struct { | |
| 1317 | const param_str = "V1LLLiV1ULLLiV1ULLLi"; | |
| 1318 | const target_set = TargetSet.init(.{ | |
| 1319 | .ppc = true, | |
| 1320 | }); | |
| 1321 | }; | |
| 1322 | ||
| 1323 | pub const __builtin_altivec_vcmpequq_p = struct { | |
| 1324 | const param_str = "iiV1ULLLiV1LLLi"; | |
| 1325 | const target_set = TargetSet.init(.{ | |
| 1326 | .ppc = true, | |
| 1327 | }); | |
| 1328 | }; | |
| 1329 | ||
| 1330 | pub const __builtin_altivec_vcmpequw = struct { | |
| 1331 | const param_str = "V4iV4iV4i"; | |
| 1332 | const target_set = TargetSet.init(.{ | |
| 1333 | .ppc = true, | |
| 1334 | }); | |
| 1335 | }; | |
| 1336 | ||
| 1337 | pub const __builtin_altivec_vcmpequw_p = struct { | |
| 1338 | const param_str = "iiV4iV4i"; | |
| 1339 | const target_set = TargetSet.init(.{ | |
| 1340 | .ppc = true, | |
| 1341 | }); | |
| 1342 | }; | |
| 1343 | ||
| 1344 | pub const __builtin_altivec_vcmpgefp = struct { | |
| 1345 | const param_str = "V4iV4fV4f"; | |
| 1346 | const target_set = TargetSet.init(.{ | |
| 1347 | .ppc = true, | |
| 1348 | }); | |
| 1349 | }; | |
| 1350 | ||
| 1351 | pub const __builtin_altivec_vcmpgefp_p = struct { | |
| 1352 | const param_str = "iiV4fV4f"; | |
| 1353 | const target_set = TargetSet.init(.{ | |
| 1354 | .ppc = true, | |
| 1355 | }); | |
| 1356 | }; | |
| 1357 | ||
| 1358 | pub const __builtin_altivec_vcmpgtfp = struct { | |
| 1359 | const param_str = "V4iV4fV4f"; | |
| 1360 | const target_set = TargetSet.init(.{ | |
| 1361 | .ppc = true, | |
| 1362 | }); | |
| 1363 | }; | |
| 1364 | ||
| 1365 | pub const __builtin_altivec_vcmpgtfp_p = struct { | |
| 1366 | const param_str = "iiV4fV4f"; | |
| 1367 | const target_set = TargetSet.init(.{ | |
| 1368 | .ppc = true, | |
| 1369 | }); | |
| 1370 | }; | |
| 1371 | ||
| 1372 | pub const __builtin_altivec_vcmpgtsb = struct { | |
| 1373 | const param_str = "V16cV16ScV16Sc"; | |
| 1374 | const target_set = TargetSet.init(.{ | |
| 1375 | .ppc = true, | |
| 1376 | }); | |
| 1377 | }; | |
| 1378 | ||
| 1379 | pub const __builtin_altivec_vcmpgtsb_p = struct { | |
| 1380 | const param_str = "iiV16ScV16Sc"; | |
| 1381 | const target_set = TargetSet.init(.{ | |
| 1382 | .ppc = true, | |
| 1383 | }); | |
| 1384 | }; | |
| 1385 | ||
| 1386 | pub const __builtin_altivec_vcmpgtsd = struct { | |
| 1387 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 1388 | const target_set = TargetSet.init(.{ | |
| 1389 | .ppc = true, | |
| 1390 | }); | |
| 1391 | }; | |
| 1392 | ||
| 1393 | pub const __builtin_altivec_vcmpgtsd_p = struct { | |
| 1394 | const param_str = "iiV2LLiV2LLi"; | |
| 1395 | const target_set = TargetSet.init(.{ | |
| 1396 | .ppc = true, | |
| 1397 | }); | |
| 1398 | }; | |
| 1399 | ||
| 1400 | pub const __builtin_altivec_vcmpgtsh = struct { | |
| 1401 | const param_str = "V8sV8SsV8Ss"; | |
| 1402 | const target_set = TargetSet.init(.{ | |
| 1403 | .ppc = true, | |
| 1404 | }); | |
| 1405 | }; | |
| 1406 | ||
| 1407 | pub const __builtin_altivec_vcmpgtsh_p = struct { | |
| 1408 | const param_str = "iiV8SsV8Ss"; | |
| 1409 | const target_set = TargetSet.init(.{ | |
| 1410 | .ppc = true, | |
| 1411 | }); | |
| 1412 | }; | |
| 1413 | ||
| 1414 | pub const __builtin_altivec_vcmpgtsq = struct { | |
| 1415 | const param_str = "V1LLLiV1SLLLiV1SLLLi"; | |
| 1416 | const target_set = TargetSet.init(.{ | |
| 1417 | .ppc = true, | |
| 1418 | }); | |
| 1419 | }; | |
| 1420 | ||
| 1421 | pub const __builtin_altivec_vcmpgtsq_p = struct { | |
| 1422 | const param_str = "iiV1SLLLiV1SLLLi"; | |
| 1423 | const target_set = TargetSet.init(.{ | |
| 1424 | .ppc = true, | |
| 1425 | }); | |
| 1426 | }; | |
| 1427 | ||
| 1428 | pub const __builtin_altivec_vcmpgtsw = struct { | |
| 1429 | const param_str = "V4iV4SiV4Si"; | |
| 1430 | const target_set = TargetSet.init(.{ | |
| 1431 | .ppc = true, | |
| 1432 | }); | |
| 1433 | }; | |
| 1434 | ||
| 1435 | pub const __builtin_altivec_vcmpgtsw_p = struct { | |
| 1436 | const param_str = "iiV4SiV4Si"; | |
| 1437 | const target_set = TargetSet.init(.{ | |
| 1438 | .ppc = true, | |
| 1439 | }); | |
| 1440 | }; | |
| 1441 | ||
| 1442 | pub const __builtin_altivec_vcmpgtub = struct { | |
| 1443 | const param_str = "V16cV16UcV16Uc"; | |
| 1444 | const target_set = TargetSet.init(.{ | |
| 1445 | .ppc = true, | |
| 1446 | }); | |
| 1447 | }; | |
| 1448 | ||
| 1449 | pub const __builtin_altivec_vcmpgtub_p = struct { | |
| 1450 | const param_str = "iiV16UcV16Uc"; | |
| 1451 | const target_set = TargetSet.init(.{ | |
| 1452 | .ppc = true, | |
| 1453 | }); | |
| 1454 | }; | |
| 1455 | ||
| 1456 | pub const __builtin_altivec_vcmpgtud = struct { | |
| 1457 | const param_str = "V2LLiV2ULLiV2ULLi"; | |
| 1458 | const target_set = TargetSet.init(.{ | |
| 1459 | .ppc = true, | |
| 1460 | }); | |
| 1461 | }; | |
| 1462 | ||
| 1463 | pub const __builtin_altivec_vcmpgtud_p = struct { | |
| 1464 | const param_str = "iiV2ULLiV2ULLi"; | |
| 1465 | const target_set = TargetSet.init(.{ | |
| 1466 | .ppc = true, | |
| 1467 | }); | |
| 1468 | }; | |
| 1469 | ||
| 1470 | pub const __builtin_altivec_vcmpgtuh = struct { | |
| 1471 | const param_str = "V8sV8UsV8Us"; | |
| 1472 | const target_set = TargetSet.init(.{ | |
| 1473 | .ppc = true, | |
| 1474 | }); | |
| 1475 | }; | |
| 1476 | ||
| 1477 | pub const __builtin_altivec_vcmpgtuh_p = struct { | |
| 1478 | const param_str = "iiV8UsV8Us"; | |
| 1479 | const target_set = TargetSet.init(.{ | |
| 1480 | .ppc = true, | |
| 1481 | }); | |
| 1482 | }; | |
| 1483 | ||
| 1484 | pub const __builtin_altivec_vcmpgtuq = struct { | |
| 1485 | const param_str = "V1LLLiV1ULLLiV1ULLLi"; | |
| 1486 | const target_set = TargetSet.init(.{ | |
| 1487 | .ppc = true, | |
| 1488 | }); | |
| 1489 | }; | |
| 1490 | ||
| 1491 | pub const __builtin_altivec_vcmpgtuq_p = struct { | |
| 1492 | const param_str = "iiV1ULLLiV1ULLLi"; | |
| 1493 | const target_set = TargetSet.init(.{ | |
| 1494 | .ppc = true, | |
| 1495 | }); | |
| 1496 | }; | |
| 1497 | ||
| 1498 | pub const __builtin_altivec_vcmpgtuw = struct { | |
| 1499 | const param_str = "V4iV4UiV4Ui"; | |
| 1500 | const target_set = TargetSet.init(.{ | |
| 1501 | .ppc = true, | |
| 1502 | }); | |
| 1503 | }; | |
| 1504 | ||
| 1505 | pub const __builtin_altivec_vcmpgtuw_p = struct { | |
| 1506 | const param_str = "iiV4UiV4Ui"; | |
| 1507 | const target_set = TargetSet.init(.{ | |
| 1508 | .ppc = true, | |
| 1509 | }); | |
| 1510 | }; | |
| 1511 | ||
| 1512 | pub const __builtin_altivec_vcmpneb = struct { | |
| 1513 | const param_str = "V16cV16cV16c"; | |
| 1514 | const target_set = TargetSet.init(.{ | |
| 1515 | .ppc = true, | |
| 1516 | }); | |
| 1517 | }; | |
| 1518 | ||
| 1519 | pub const __builtin_altivec_vcmpneb_p = struct { | |
| 1520 | const param_str = "iiV16cV16c"; | |
| 1521 | const target_set = TargetSet.init(.{ | |
| 1522 | .ppc = true, | |
| 1523 | }); | |
| 1524 | }; | |
| 1525 | ||
| 1526 | pub const __builtin_altivec_vcmpned_p = struct { | |
| 1527 | const param_str = "iiV2LLiV2LLi"; | |
| 1528 | const target_set = TargetSet.init(.{ | |
| 1529 | .ppc = true, | |
| 1530 | }); | |
| 1531 | }; | |
| 1532 | ||
| 1533 | pub const __builtin_altivec_vcmpneh = struct { | |
| 1534 | const param_str = "V8sV8sV8s"; | |
| 1535 | const target_set = TargetSet.init(.{ | |
| 1536 | .ppc = true, | |
| 1537 | }); | |
| 1538 | }; | |
| 1539 | ||
| 1540 | pub const __builtin_altivec_vcmpneh_p = struct { | |
| 1541 | const param_str = "iiV8sV8s"; | |
| 1542 | const target_set = TargetSet.init(.{ | |
| 1543 | .ppc = true, | |
| 1544 | }); | |
| 1545 | }; | |
| 1546 | ||
| 1547 | pub const __builtin_altivec_vcmpnew = struct { | |
| 1548 | const param_str = "V4iV4iV4i"; | |
| 1549 | const target_set = TargetSet.init(.{ | |
| 1550 | .ppc = true, | |
| 1551 | }); | |
| 1552 | }; | |
| 1553 | ||
| 1554 | pub const __builtin_altivec_vcmpnew_p = struct { | |
| 1555 | const param_str = "iiV4iV4i"; | |
| 1556 | const target_set = TargetSet.init(.{ | |
| 1557 | .ppc = true, | |
| 1558 | }); | |
| 1559 | }; | |
| 1560 | ||
| 1561 | pub const __builtin_altivec_vcmpnezb = struct { | |
| 1562 | const param_str = "V16cV16cV16c"; | |
| 1563 | const target_set = TargetSet.init(.{ | |
| 1564 | .ppc = true, | |
| 1565 | }); | |
| 1566 | }; | |
| 1567 | ||
| 1568 | pub const __builtin_altivec_vcmpnezh = struct { | |
| 1569 | const param_str = "V8sV8sV8s"; | |
| 1570 | const target_set = TargetSet.init(.{ | |
| 1571 | .ppc = true, | |
| 1572 | }); | |
| 1573 | }; | |
| 1574 | ||
| 1575 | pub const __builtin_altivec_vcmpnezw = struct { | |
| 1576 | const param_str = "V4iV4iV4i"; | |
| 1577 | const target_set = TargetSet.init(.{ | |
| 1578 | .ppc = true, | |
| 1579 | }); | |
| 1580 | }; | |
| 1581 | ||
| 1582 | pub const __builtin_altivec_vcntmbb = struct { | |
| 1583 | const param_str = "ULLiV16UcUi"; | |
| 1584 | const target_set = TargetSet.init(.{ | |
| 1585 | .ppc = true, | |
| 1586 | }); | |
| 1587 | }; | |
| 1588 | ||
| 1589 | pub const __builtin_altivec_vcntmbd = struct { | |
| 1590 | const param_str = "ULLiV2ULLiUi"; | |
| 1591 | const target_set = TargetSet.init(.{ | |
| 1592 | .ppc = true, | |
| 1593 | }); | |
| 1594 | }; | |
| 1595 | ||
| 1596 | pub const __builtin_altivec_vcntmbh = struct { | |
| 1597 | const param_str = "ULLiV8UsUi"; | |
| 1598 | const target_set = TargetSet.init(.{ | |
| 1599 | .ppc = true, | |
| 1600 | }); | |
| 1601 | }; | |
| 1602 | ||
| 1603 | pub const __builtin_altivec_vcntmbw = struct { | |
| 1604 | const param_str = "ULLiV4UiUi"; | |
| 1605 | const target_set = TargetSet.init(.{ | |
| 1606 | .ppc = true, | |
| 1607 | }); | |
| 1608 | }; | |
| 1609 | ||
| 1610 | pub const __builtin_altivec_vctsxs = struct { | |
| 1611 | const param_str = "V4SiV4fIi"; | |
| 1612 | const target_set = TargetSet.init(.{ | |
| 1613 | .ppc = true, | |
| 1614 | }); | |
| 1615 | }; | |
| 1616 | ||
| 1617 | pub const __builtin_altivec_vctuxs = struct { | |
| 1618 | const param_str = "V4UiV4fIi"; | |
| 1619 | const target_set = TargetSet.init(.{ | |
| 1620 | .ppc = true, | |
| 1621 | }); | |
| 1622 | }; | |
| 1623 | ||
| 1624 | pub const __builtin_altivec_vctzb = struct { | |
| 1625 | const param_str = "V16UcV16Uc"; | |
| 1626 | const target_set = TargetSet.init(.{ | |
| 1627 | .ppc = true, | |
| 1628 | }); | |
| 1629 | }; | |
| 1630 | ||
| 1631 | pub const __builtin_altivec_vctzd = struct { | |
| 1632 | const param_str = "V2ULLiV2ULLi"; | |
| 1633 | const target_set = TargetSet.init(.{ | |
| 1634 | .ppc = true, | |
| 1635 | }); | |
| 1636 | }; | |
| 1637 | ||
| 1638 | pub const __builtin_altivec_vctzdm = struct { | |
| 1639 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 1640 | const target_set = TargetSet.init(.{ | |
| 1641 | .ppc = true, | |
| 1642 | }); | |
| 1643 | }; | |
| 1644 | ||
| 1645 | pub const __builtin_altivec_vctzh = struct { | |
| 1646 | const param_str = "V8UsV8Us"; | |
| 1647 | const target_set = TargetSet.init(.{ | |
| 1648 | .ppc = true, | |
| 1649 | }); | |
| 1650 | }; | |
| 1651 | ||
| 1652 | pub const __builtin_altivec_vctzlsbb = struct { | |
| 1653 | const param_str = "SiV16Uc"; | |
| 1654 | const target_set = TargetSet.init(.{ | |
| 1655 | .ppc = true, | |
| 1656 | }); | |
| 1657 | }; | |
| 1658 | ||
| 1659 | pub const __builtin_altivec_vctzw = struct { | |
| 1660 | const param_str = "V4UiV4Ui"; | |
| 1661 | const target_set = TargetSet.init(.{ | |
| 1662 | .ppc = true, | |
| 1663 | }); | |
| 1664 | }; | |
| 1665 | ||
| 1666 | pub const __builtin_altivec_vdivesd = struct { | |
| 1667 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 1668 | const target_set = TargetSet.init(.{ | |
| 1669 | .ppc = true, | |
| 1670 | }); | |
| 1671 | }; | |
| 1672 | ||
| 1673 | pub const __builtin_altivec_vdivesq = struct { | |
| 1674 | const param_str = "V1SLLLiV1SLLLiV1SLLLi"; | |
| 1675 | const target_set = TargetSet.init(.{ | |
| 1676 | .ppc = true, | |
| 1677 | }); | |
| 1678 | }; | |
| 1679 | ||
| 1680 | pub const __builtin_altivec_vdivesw = struct { | |
| 1681 | const param_str = "V4SiV4SiV4Si"; | |
| 1682 | const target_set = TargetSet.init(.{ | |
| 1683 | .ppc = true, | |
| 1684 | }); | |
| 1685 | }; | |
| 1686 | ||
| 1687 | pub const __builtin_altivec_vdiveud = struct { | |
| 1688 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 1689 | const target_set = TargetSet.init(.{ | |
| 1690 | .ppc = true, | |
| 1691 | }); | |
| 1692 | }; | |
| 1693 | ||
| 1694 | pub const __builtin_altivec_vdiveuq = struct { | |
| 1695 | const param_str = "V1ULLLiV1ULLLiV1ULLLi"; | |
| 1696 | const target_set = TargetSet.init(.{ | |
| 1697 | .ppc = true, | |
| 1698 | }); | |
| 1699 | }; | |
| 1700 | ||
| 1701 | pub const __builtin_altivec_vdiveuw = struct { | |
| 1702 | const param_str = "V4UiV4UiV4Ui"; | |
| 1703 | const target_set = TargetSet.init(.{ | |
| 1704 | .ppc = true, | |
| 1705 | }); | |
| 1706 | }; | |
| 1707 | ||
| 1708 | pub const __builtin_altivec_vexpandbm = struct { | |
| 1709 | const param_str = "V16UcV16Uc"; | |
| 1710 | const target_set = TargetSet.init(.{ | |
| 1711 | .ppc = true, | |
| 1712 | }); | |
| 1713 | }; | |
| 1714 | ||
| 1715 | pub const __builtin_altivec_vexpanddm = struct { | |
| 1716 | const param_str = "V2ULLiV2ULLi"; | |
| 1717 | const target_set = TargetSet.init(.{ | |
| 1718 | .ppc = true, | |
| 1719 | }); | |
| 1720 | }; | |
| 1721 | ||
| 1722 | pub const __builtin_altivec_vexpandhm = struct { | |
| 1723 | const param_str = "V8UsV8Us"; | |
| 1724 | const target_set = TargetSet.init(.{ | |
| 1725 | .ppc = true, | |
| 1726 | }); | |
| 1727 | }; | |
| 1728 | ||
| 1729 | pub const __builtin_altivec_vexpandqm = struct { | |
| 1730 | const param_str = "V1ULLLiV1ULLLi"; | |
| 1731 | const target_set = TargetSet.init(.{ | |
| 1732 | .ppc = true, | |
| 1733 | }); | |
| 1734 | }; | |
| 1735 | ||
| 1736 | pub const __builtin_altivec_vexpandwm = struct { | |
| 1737 | const param_str = "V4UiV4Ui"; | |
| 1738 | const target_set = TargetSet.init(.{ | |
| 1739 | .ppc = true, | |
| 1740 | }); | |
| 1741 | }; | |
| 1742 | ||
| 1743 | pub const __builtin_altivec_vexptefp = struct { | |
| 1744 | const param_str = "V4fV4f"; | |
| 1745 | const target_set = TargetSet.init(.{ | |
| 1746 | .ppc = true, | |
| 1747 | }); | |
| 1748 | }; | |
| 1749 | ||
| 1750 | pub const __builtin_altivec_vextddvlx = struct { | |
| 1751 | const param_str = "V2ULLiV2ULLiV2ULLiUi"; | |
| 1752 | const target_set = TargetSet.init(.{ | |
| 1753 | .ppc = true, | |
| 1754 | }); | |
| 1755 | }; | |
| 1756 | ||
| 1757 | pub const __builtin_altivec_vextddvrx = struct { | |
| 1758 | const param_str = "V2ULLiV2ULLiV2ULLiUi"; | |
| 1759 | const target_set = TargetSet.init(.{ | |
| 1760 | .ppc = true, | |
| 1761 | }); | |
| 1762 | }; | |
| 1763 | ||
| 1764 | pub const __builtin_altivec_vextdubvlx = struct { | |
| 1765 | const param_str = "V2ULLiV16UcV16UcUi"; | |
| 1766 | const target_set = TargetSet.init(.{ | |
| 1767 | .ppc = true, | |
| 1768 | }); | |
| 1769 | }; | |
| 1770 | ||
| 1771 | pub const __builtin_altivec_vextdubvrx = struct { | |
| 1772 | const param_str = "V2ULLiV16UcV16UcUi"; | |
| 1773 | const target_set = TargetSet.init(.{ | |
| 1774 | .ppc = true, | |
| 1775 | }); | |
| 1776 | }; | |
| 1777 | ||
| 1778 | pub const __builtin_altivec_vextduhvlx = struct { | |
| 1779 | const param_str = "V2ULLiV8UsV8UsUi"; | |
| 1780 | const target_set = TargetSet.init(.{ | |
| 1781 | .ppc = true, | |
| 1782 | }); | |
| 1783 | }; | |
| 1784 | ||
| 1785 | pub const __builtin_altivec_vextduhvrx = struct { | |
| 1786 | const param_str = "V2ULLiV8UsV8UsUi"; | |
| 1787 | const target_set = TargetSet.init(.{ | |
| 1788 | .ppc = true, | |
| 1789 | }); | |
| 1790 | }; | |
| 1791 | ||
| 1792 | pub const __builtin_altivec_vextduwvlx = struct { | |
| 1793 | const param_str = "V2ULLiV4UiV4UiUi"; | |
| 1794 | const target_set = TargetSet.init(.{ | |
| 1795 | .ppc = true, | |
| 1796 | }); | |
| 1797 | }; | |
| 1798 | ||
| 1799 | pub const __builtin_altivec_vextduwvrx = struct { | |
| 1800 | const param_str = "V2ULLiV4UiV4UiUi"; | |
| 1801 | const target_set = TargetSet.init(.{ | |
| 1802 | .ppc = true, | |
| 1803 | }); | |
| 1804 | }; | |
| 1805 | ||
| 1806 | pub const __builtin_altivec_vextractbm = struct { | |
| 1807 | const param_str = "UiV16Uc"; | |
| 1808 | const target_set = TargetSet.init(.{ | |
| 1809 | .ppc = true, | |
| 1810 | }); | |
| 1811 | }; | |
| 1812 | ||
| 1813 | pub const __builtin_altivec_vextractdm = struct { | |
| 1814 | const param_str = "UiV2ULLi"; | |
| 1815 | const target_set = TargetSet.init(.{ | |
| 1816 | .ppc = true, | |
| 1817 | }); | |
| 1818 | }; | |
| 1819 | ||
| 1820 | pub const __builtin_altivec_vextracthm = struct { | |
| 1821 | const param_str = "UiV8Us"; | |
| 1822 | const target_set = TargetSet.init(.{ | |
| 1823 | .ppc = true, | |
| 1824 | }); | |
| 1825 | }; | |
| 1826 | ||
| 1827 | pub const __builtin_altivec_vextractqm = struct { | |
| 1828 | const param_str = "UiV1ULLLi"; | |
| 1829 | const target_set = TargetSet.init(.{ | |
| 1830 | .ppc = true, | |
| 1831 | }); | |
| 1832 | }; | |
| 1833 | ||
| 1834 | pub const __builtin_altivec_vextractwm = struct { | |
| 1835 | const param_str = "UiV4Ui"; | |
| 1836 | const target_set = TargetSet.init(.{ | |
| 1837 | .ppc = true, | |
| 1838 | }); | |
| 1839 | }; | |
| 1840 | ||
| 1841 | pub const __builtin_altivec_vextsb2d = struct { | |
| 1842 | const param_str = "V2SLLiV16Sc"; | |
| 1843 | const target_set = TargetSet.init(.{ | |
| 1844 | .ppc = true, | |
| 1845 | }); | |
| 1846 | }; | |
| 1847 | ||
| 1848 | pub const __builtin_altivec_vextsb2w = struct { | |
| 1849 | const param_str = "V4SiV16Sc"; | |
| 1850 | const target_set = TargetSet.init(.{ | |
| 1851 | .ppc = true, | |
| 1852 | }); | |
| 1853 | }; | |
| 1854 | ||
| 1855 | pub const __builtin_altivec_vextsd2q = struct { | |
| 1856 | const param_str = "V1SLLLiV2SLLi"; | |
| 1857 | const target_set = TargetSet.init(.{ | |
| 1858 | .ppc = true, | |
| 1859 | }); | |
| 1860 | }; | |
| 1861 | ||
| 1862 | pub const __builtin_altivec_vextsh2d = struct { | |
| 1863 | const param_str = "V2SLLiV8Ss"; | |
| 1864 | const target_set = TargetSet.init(.{ | |
| 1865 | .ppc = true, | |
| 1866 | }); | |
| 1867 | }; | |
| 1868 | ||
| 1869 | pub const __builtin_altivec_vextsh2w = struct { | |
| 1870 | const param_str = "V4SiV8Ss"; | |
| 1871 | const target_set = TargetSet.init(.{ | |
| 1872 | .ppc = true, | |
| 1873 | }); | |
| 1874 | }; | |
| 1875 | ||
| 1876 | pub const __builtin_altivec_vextsw2d = struct { | |
| 1877 | const param_str = "V2SLLiV4Si"; | |
| 1878 | const target_set = TargetSet.init(.{ | |
| 1879 | .ppc = true, | |
| 1880 | }); | |
| 1881 | }; | |
| 1882 | ||
| 1883 | pub const __builtin_altivec_vgbbd = struct { | |
| 1884 | const param_str = "V16UcV16Uc"; | |
| 1885 | const target_set = TargetSet.init(.{ | |
| 1886 | .ppc = true, | |
| 1887 | }); | |
| 1888 | }; | |
| 1889 | ||
| 1890 | pub const __builtin_altivec_vgnb = struct { | |
| 1891 | const param_str = "ULLiV1ULLLiIi"; | |
| 1892 | const target_set = TargetSet.init(.{ | |
| 1893 | .ppc = true, | |
| 1894 | }); | |
| 1895 | }; | |
| 1896 | ||
| 1897 | pub const __builtin_altivec_vinsblx = struct { | |
| 1898 | const param_str = "V16UcV16UcUiUi"; | |
| 1899 | const target_set = TargetSet.init(.{ | |
| 1900 | .ppc = true, | |
| 1901 | }); | |
| 1902 | }; | |
| 1903 | ||
| 1904 | pub const __builtin_altivec_vinsbrx = struct { | |
| 1905 | const param_str = "V16UcV16UcUiUi"; | |
| 1906 | const target_set = TargetSet.init(.{ | |
| 1907 | .ppc = true, | |
| 1908 | }); | |
| 1909 | }; | |
| 1910 | ||
| 1911 | pub const __builtin_altivec_vinsbvlx = struct { | |
| 1912 | const param_str = "V16UcV16UcUiV16Uc"; | |
| 1913 | const target_set = TargetSet.init(.{ | |
| 1914 | .ppc = true, | |
| 1915 | }); | |
| 1916 | }; | |
| 1917 | ||
| 1918 | pub const __builtin_altivec_vinsbvrx = struct { | |
| 1919 | const param_str = "V16UcV16UcUiV16Uc"; | |
| 1920 | const target_set = TargetSet.init(.{ | |
| 1921 | .ppc = true, | |
| 1922 | }); | |
| 1923 | }; | |
| 1924 | ||
| 1925 | pub const __builtin_altivec_vinsd = struct { | |
| 1926 | const param_str = "V16UcV16UcULLiIi"; | |
| 1927 | const target_set = TargetSet.init(.{ | |
| 1928 | .ppc = true, | |
| 1929 | }); | |
| 1930 | }; | |
| 1931 | ||
| 1932 | pub const __builtin_altivec_vinsd_elt = struct { | |
| 1933 | const param_str = "V16UcV16UcULLiiC"; | |
| 1934 | const target_set = TargetSet.init(.{ | |
| 1935 | .ppc = true, | |
| 1936 | }); | |
| 1937 | }; | |
| 1938 | ||
| 1939 | pub const __builtin_altivec_vinsdlx = struct { | |
| 1940 | const param_str = "V2ULLiV2ULLiULLiULLi"; | |
| 1941 | const target_set = TargetSet.init(.{ | |
| 1942 | .ppc = true, | |
| 1943 | }); | |
| 1944 | }; | |
| 1945 | ||
| 1946 | pub const __builtin_altivec_vinsdrx = struct { | |
| 1947 | const param_str = "V2ULLiV2ULLiULLiULLi"; | |
| 1948 | const target_set = TargetSet.init(.{ | |
| 1949 | .ppc = true, | |
| 1950 | }); | |
| 1951 | }; | |
| 1952 | ||
| 1953 | pub const __builtin_altivec_vinshlx = struct { | |
| 1954 | const param_str = "V8UsV8UsUiUi"; | |
| 1955 | const target_set = TargetSet.init(.{ | |
| 1956 | .ppc = true, | |
| 1957 | }); | |
| 1958 | }; | |
| 1959 | ||
| 1960 | pub const __builtin_altivec_vinshrx = struct { | |
| 1961 | const param_str = "V8UsV8UsUiUi"; | |
| 1962 | const target_set = TargetSet.init(.{ | |
| 1963 | .ppc = true, | |
| 1964 | }); | |
| 1965 | }; | |
| 1966 | ||
| 1967 | pub const __builtin_altivec_vinshvlx = struct { | |
| 1968 | const param_str = "V8UsV8UsUiV8Us"; | |
| 1969 | const target_set = TargetSet.init(.{ | |
| 1970 | .ppc = true, | |
| 1971 | }); | |
| 1972 | }; | |
| 1973 | ||
| 1974 | pub const __builtin_altivec_vinshvrx = struct { | |
| 1975 | const param_str = "V8UsV8UsUiV8Us"; | |
| 1976 | const target_set = TargetSet.init(.{ | |
| 1977 | .ppc = true, | |
| 1978 | }); | |
| 1979 | }; | |
| 1980 | ||
| 1981 | pub const __builtin_altivec_vinsw = struct { | |
| 1982 | const param_str = "V16UcV16UcUiIi"; | |
| 1983 | const target_set = TargetSet.init(.{ | |
| 1984 | .ppc = true, | |
| 1985 | }); | |
| 1986 | }; | |
| 1987 | ||
| 1988 | pub const __builtin_altivec_vinsw_elt = struct { | |
| 1989 | const param_str = "V16UcV16UcUiiC"; | |
| 1990 | const target_set = TargetSet.init(.{ | |
| 1991 | .ppc = true, | |
| 1992 | }); | |
| 1993 | }; | |
| 1994 | ||
| 1995 | pub const __builtin_altivec_vinswlx = struct { | |
| 1996 | const param_str = "V4UiV4UiUiUi"; | |
| 1997 | const target_set = TargetSet.init(.{ | |
| 1998 | .ppc = true, | |
| 1999 | }); | |
| 2000 | }; | |
| 2001 | ||
| 2002 | pub const __builtin_altivec_vinswrx = struct { | |
| 2003 | const param_str = "V4UiV4UiUiUi"; | |
| 2004 | const target_set = TargetSet.init(.{ | |
| 2005 | .ppc = true, | |
| 2006 | }); | |
| 2007 | }; | |
| 2008 | ||
| 2009 | pub const __builtin_altivec_vinswvlx = struct { | |
| 2010 | const param_str = "V4UiV4UiUiV4Ui"; | |
| 2011 | const target_set = TargetSet.init(.{ | |
| 2012 | .ppc = true, | |
| 2013 | }); | |
| 2014 | }; | |
| 2015 | ||
| 2016 | pub const __builtin_altivec_vinswvrx = struct { | |
| 2017 | const param_str = "V4UiV4UiUiV4Ui"; | |
| 2018 | const target_set = TargetSet.init(.{ | |
| 2019 | .ppc = true, | |
| 2020 | }); | |
| 2021 | }; | |
| 2022 | ||
| 2023 | pub const __builtin_altivec_vlogefp = struct { | |
| 2024 | const param_str = "V4fV4f"; | |
| 2025 | const target_set = TargetSet.init(.{ | |
| 2026 | .ppc = true, | |
| 2027 | }); | |
| 2028 | }; | |
| 2029 | ||
| 2030 | pub const __builtin_altivec_vmaddfp = struct { | |
| 2031 | const param_str = "V4fV4fV4fV4f"; | |
| 2032 | const target_set = TargetSet.init(.{ | |
| 2033 | .ppc = true, | |
| 2034 | }); | |
| 2035 | }; | |
| 2036 | ||
| 2037 | pub const __builtin_altivec_vmaxfp = struct { | |
| 2038 | const param_str = "V4fV4fV4f"; | |
| 2039 | const target_set = TargetSet.init(.{ | |
| 2040 | .ppc = true, | |
| 2041 | }); | |
| 2042 | }; | |
| 2043 | ||
| 2044 | pub const __builtin_altivec_vmaxsb = struct { | |
| 2045 | const param_str = "V16ScV16ScV16Sc"; | |
| 2046 | const target_set = TargetSet.init(.{ | |
| 2047 | .ppc = true, | |
| 2048 | }); | |
| 2049 | }; | |
| 2050 | ||
| 2051 | pub const __builtin_altivec_vmaxsd = struct { | |
| 2052 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 2053 | const target_set = TargetSet.init(.{ | |
| 2054 | .ppc = true, | |
| 2055 | }); | |
| 2056 | }; | |
| 2057 | ||
| 2058 | pub const __builtin_altivec_vmaxsh = struct { | |
| 2059 | const param_str = "V8SsV8SsV8Ss"; | |
| 2060 | const target_set = TargetSet.init(.{ | |
| 2061 | .ppc = true, | |
| 2062 | }); | |
| 2063 | }; | |
| 2064 | ||
| 2065 | pub const __builtin_altivec_vmaxsw = struct { | |
| 2066 | const param_str = "V4SiV4SiV4Si"; | |
| 2067 | const target_set = TargetSet.init(.{ | |
| 2068 | .ppc = true, | |
| 2069 | }); | |
| 2070 | }; | |
| 2071 | ||
| 2072 | pub const __builtin_altivec_vmaxub = struct { | |
| 2073 | const param_str = "V16UcV16UcV16Uc"; | |
| 2074 | const target_set = TargetSet.init(.{ | |
| 2075 | .ppc = true, | |
| 2076 | }); | |
| 2077 | }; | |
| 2078 | ||
| 2079 | pub const __builtin_altivec_vmaxud = struct { | |
| 2080 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 2081 | const target_set = TargetSet.init(.{ | |
| 2082 | .ppc = true, | |
| 2083 | }); | |
| 2084 | }; | |
| 2085 | ||
| 2086 | pub const __builtin_altivec_vmaxuh = struct { | |
| 2087 | const param_str = "V8UsV8UsV8Us"; | |
| 2088 | const target_set = TargetSet.init(.{ | |
| 2089 | .ppc = true, | |
| 2090 | }); | |
| 2091 | }; | |
| 2092 | ||
| 2093 | pub const __builtin_altivec_vmaxuw = struct { | |
| 2094 | const param_str = "V4UiV4UiV4Ui"; | |
| 2095 | const target_set = TargetSet.init(.{ | |
| 2096 | .ppc = true, | |
| 2097 | }); | |
| 2098 | }; | |
| 2099 | ||
| 2100 | pub const __builtin_altivec_vmhaddshs = struct { | |
| 2101 | const param_str = "V8sV8sV8sV8s"; | |
| 2102 | const target_set = TargetSet.init(.{ | |
| 2103 | .ppc = true, | |
| 2104 | }); | |
| 2105 | }; | |
| 2106 | ||
| 2107 | pub const __builtin_altivec_vmhraddshs = struct { | |
| 2108 | const param_str = "V8sV8sV8sV8s"; | |
| 2109 | const target_set = TargetSet.init(.{ | |
| 2110 | .ppc = true, | |
| 2111 | }); | |
| 2112 | }; | |
| 2113 | ||
| 2114 | pub const __builtin_altivec_vminfp = struct { | |
| 2115 | const param_str = "V4fV4fV4f"; | |
| 2116 | const target_set = TargetSet.init(.{ | |
| 2117 | .ppc = true, | |
| 2118 | }); | |
| 2119 | }; | |
| 2120 | ||
| 2121 | pub const __builtin_altivec_vminsb = struct { | |
| 2122 | const param_str = "V16ScV16ScV16Sc"; | |
| 2123 | const target_set = TargetSet.init(.{ | |
| 2124 | .ppc = true, | |
| 2125 | }); | |
| 2126 | }; | |
| 2127 | ||
| 2128 | pub const __builtin_altivec_vminsd = struct { | |
| 2129 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 2130 | const target_set = TargetSet.init(.{ | |
| 2131 | .ppc = true, | |
| 2132 | }); | |
| 2133 | }; | |
| 2134 | ||
| 2135 | pub const __builtin_altivec_vminsh = struct { | |
| 2136 | const param_str = "V8SsV8SsV8Ss"; | |
| 2137 | const target_set = TargetSet.init(.{ | |
| 2138 | .ppc = true, | |
| 2139 | }); | |
| 2140 | }; | |
| 2141 | ||
| 2142 | pub const __builtin_altivec_vminsw = struct { | |
| 2143 | const param_str = "V4SiV4SiV4Si"; | |
| 2144 | const target_set = TargetSet.init(.{ | |
| 2145 | .ppc = true, | |
| 2146 | }); | |
| 2147 | }; | |
| 2148 | ||
| 2149 | pub const __builtin_altivec_vminub = struct { | |
| 2150 | const param_str = "V16UcV16UcV16Uc"; | |
| 2151 | const target_set = TargetSet.init(.{ | |
| 2152 | .ppc = true, | |
| 2153 | }); | |
| 2154 | }; | |
| 2155 | ||
| 2156 | pub const __builtin_altivec_vminud = struct { | |
| 2157 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 2158 | const target_set = TargetSet.init(.{ | |
| 2159 | .ppc = true, | |
| 2160 | }); | |
| 2161 | }; | |
| 2162 | ||
| 2163 | pub const __builtin_altivec_vminuh = struct { | |
| 2164 | const param_str = "V8UsV8UsV8Us"; | |
| 2165 | const target_set = TargetSet.init(.{ | |
| 2166 | .ppc = true, | |
| 2167 | }); | |
| 2168 | }; | |
| 2169 | ||
| 2170 | pub const __builtin_altivec_vminuw = struct { | |
| 2171 | const param_str = "V4UiV4UiV4Ui"; | |
| 2172 | const target_set = TargetSet.init(.{ | |
| 2173 | .ppc = true, | |
| 2174 | }); | |
| 2175 | }; | |
| 2176 | ||
| 2177 | pub const __builtin_altivec_vmsumcud = struct { | |
| 2178 | const param_str = "V1ULLLiV2ULLiV2ULLiV1ULLLi"; | |
| 2179 | const target_set = TargetSet.init(.{ | |
| 2180 | .ppc = true, | |
| 2181 | }); | |
| 2182 | }; | |
| 2183 | ||
| 2184 | pub const __builtin_altivec_vmsummbm = struct { | |
| 2185 | const param_str = "V4SiV16ScV16UcV4Si"; | |
| 2186 | const target_set = TargetSet.init(.{ | |
| 2187 | .ppc = true, | |
| 2188 | }); | |
| 2189 | }; | |
| 2190 | ||
| 2191 | pub const __builtin_altivec_vmsumshm = struct { | |
| 2192 | const param_str = "V4SiV8SsV8SsV4Si"; | |
| 2193 | const target_set = TargetSet.init(.{ | |
| 2194 | .ppc = true, | |
| 2195 | }); | |
| 2196 | }; | |
| 2197 | ||
| 2198 | pub const __builtin_altivec_vmsumshs = struct { | |
| 2199 | const param_str = "V4SiV8SsV8SsV4Si"; | |
| 2200 | const target_set = TargetSet.init(.{ | |
| 2201 | .ppc = true, | |
| 2202 | }); | |
| 2203 | }; | |
| 2204 | ||
| 2205 | pub const __builtin_altivec_vmsumubm = struct { | |
| 2206 | const param_str = "V4UiV16UcV16UcV4Ui"; | |
| 2207 | const target_set = TargetSet.init(.{ | |
| 2208 | .ppc = true, | |
| 2209 | }); | |
| 2210 | }; | |
| 2211 | ||
| 2212 | pub const __builtin_altivec_vmsumuhm = struct { | |
| 2213 | const param_str = "V4UiV8UsV8UsV4Ui"; | |
| 2214 | const target_set = TargetSet.init(.{ | |
| 2215 | .ppc = true, | |
| 2216 | }); | |
| 2217 | }; | |
| 2218 | ||
| 2219 | pub const __builtin_altivec_vmsumuhs = struct { | |
| 2220 | const param_str = "V4UiV8UsV8UsV4Ui"; | |
| 2221 | const target_set = TargetSet.init(.{ | |
| 2222 | .ppc = true, | |
| 2223 | }); | |
| 2224 | }; | |
| 2225 | ||
| 2226 | pub const __builtin_altivec_vmulesb = struct { | |
| 2227 | const param_str = "V8SsV16ScV16Sc"; | |
| 2228 | const target_set = TargetSet.init(.{ | |
| 2229 | .ppc = true, | |
| 2230 | }); | |
| 2231 | }; | |
| 2232 | ||
| 2233 | pub const __builtin_altivec_vmulesd = struct { | |
| 2234 | const param_str = "V1SLLLiV2SLLiV2SLLi"; | |
| 2235 | const target_set = TargetSet.init(.{ | |
| 2236 | .ppc = true, | |
| 2237 | }); | |
| 2238 | }; | |
| 2239 | ||
| 2240 | pub const __builtin_altivec_vmulesh = struct { | |
| 2241 | const param_str = "V4SiV8SsV8Ss"; | |
| 2242 | const target_set = TargetSet.init(.{ | |
| 2243 | .ppc = true, | |
| 2244 | }); | |
| 2245 | }; | |
| 2246 | ||
| 2247 | pub const __builtin_altivec_vmulesw = struct { | |
| 2248 | const param_str = "V2SLLiV4SiV4Si"; | |
| 2249 | const target_set = TargetSet.init(.{ | |
| 2250 | .ppc = true, | |
| 2251 | }); | |
| 2252 | }; | |
| 2253 | ||
| 2254 | pub const __builtin_altivec_vmuleub = struct { | |
| 2255 | const param_str = "V8UsV16UcV16Uc"; | |
| 2256 | const target_set = TargetSet.init(.{ | |
| 2257 | .ppc = true, | |
| 2258 | }); | |
| 2259 | }; | |
| 2260 | ||
| 2261 | pub const __builtin_altivec_vmuleud = struct { | |
| 2262 | const param_str = "V1ULLLiV2ULLiV2ULLi"; | |
| 2263 | const target_set = TargetSet.init(.{ | |
| 2264 | .ppc = true, | |
| 2265 | }); | |
| 2266 | }; | |
| 2267 | ||
| 2268 | pub const __builtin_altivec_vmuleuh = struct { | |
| 2269 | const param_str = "V4UiV8UsV8Us"; | |
| 2270 | const target_set = TargetSet.init(.{ | |
| 2271 | .ppc = true, | |
| 2272 | }); | |
| 2273 | }; | |
| 2274 | ||
| 2275 | pub const __builtin_altivec_vmuleuw = struct { | |
| 2276 | const param_str = "V2ULLiV4UiV4Ui"; | |
| 2277 | const target_set = TargetSet.init(.{ | |
| 2278 | .ppc = true, | |
| 2279 | }); | |
| 2280 | }; | |
| 2281 | ||
| 2282 | pub const __builtin_altivec_vmulhsd = struct { | |
| 2283 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 2284 | const target_set = TargetSet.init(.{ | |
| 2285 | .ppc = true, | |
| 2286 | }); | |
| 2287 | }; | |
| 2288 | ||
| 2289 | pub const __builtin_altivec_vmulhsw = struct { | |
| 2290 | const param_str = "V4SiV4SiV4Si"; | |
| 2291 | const target_set = TargetSet.init(.{ | |
| 2292 | .ppc = true, | |
| 2293 | }); | |
| 2294 | }; | |
| 2295 | ||
| 2296 | pub const __builtin_altivec_vmulhud = struct { | |
| 2297 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 2298 | const target_set = TargetSet.init(.{ | |
| 2299 | .ppc = true, | |
| 2300 | }); | |
| 2301 | }; | |
| 2302 | ||
| 2303 | pub const __builtin_altivec_vmulhuw = struct { | |
| 2304 | const param_str = "V4UiV4UiV4Ui"; | |
| 2305 | const target_set = TargetSet.init(.{ | |
| 2306 | .ppc = true, | |
| 2307 | }); | |
| 2308 | }; | |
| 2309 | ||
| 2310 | pub const __builtin_altivec_vmulosb = struct { | |
| 2311 | const param_str = "V8SsV16ScV16Sc"; | |
| 2312 | const target_set = TargetSet.init(.{ | |
| 2313 | .ppc = true, | |
| 2314 | }); | |
| 2315 | }; | |
| 2316 | ||
| 2317 | pub const __builtin_altivec_vmulosd = struct { | |
| 2318 | const param_str = "V1SLLLiV2SLLiV2SLLi"; | |
| 2319 | const target_set = TargetSet.init(.{ | |
| 2320 | .ppc = true, | |
| 2321 | }); | |
| 2322 | }; | |
| 2323 | ||
| 2324 | pub const __builtin_altivec_vmulosh = struct { | |
| 2325 | const param_str = "V4SiV8SsV8Ss"; | |
| 2326 | const target_set = TargetSet.init(.{ | |
| 2327 | .ppc = true, | |
| 2328 | }); | |
| 2329 | }; | |
| 2330 | ||
| 2331 | pub const __builtin_altivec_vmulosw = struct { | |
| 2332 | const param_str = "V2SLLiV4SiV4Si"; | |
| 2333 | const target_set = TargetSet.init(.{ | |
| 2334 | .ppc = true, | |
| 2335 | }); | |
| 2336 | }; | |
| 2337 | ||
| 2338 | pub const __builtin_altivec_vmuloub = struct { | |
| 2339 | const param_str = "V8UsV16UcV16Uc"; | |
| 2340 | const target_set = TargetSet.init(.{ | |
| 2341 | .ppc = true, | |
| 2342 | }); | |
| 2343 | }; | |
| 2344 | ||
| 2345 | pub const __builtin_altivec_vmuloud = struct { | |
| 2346 | const param_str = "V1ULLLiV2ULLiV2ULLi"; | |
| 2347 | const target_set = TargetSet.init(.{ | |
| 2348 | .ppc = true, | |
| 2349 | }); | |
| 2350 | }; | |
| 2351 | ||
| 2352 | pub const __builtin_altivec_vmulouh = struct { | |
| 2353 | const param_str = "V4UiV8UsV8Us"; | |
| 2354 | const target_set = TargetSet.init(.{ | |
| 2355 | .ppc = true, | |
| 2356 | }); | |
| 2357 | }; | |
| 2358 | ||
| 2359 | pub const __builtin_altivec_vmulouw = struct { | |
| 2360 | const param_str = "V2ULLiV4UiV4Ui"; | |
| 2361 | const target_set = TargetSet.init(.{ | |
| 2362 | .ppc = true, | |
| 2363 | }); | |
| 2364 | }; | |
| 2365 | ||
| 2366 | pub const __builtin_altivec_vnmsubfp = struct { | |
| 2367 | const param_str = "V4fV4fV4fV4f"; | |
| 2368 | const target_set = TargetSet.init(.{ | |
| 2369 | .ppc = true, | |
| 2370 | }); | |
| 2371 | }; | |
| 2372 | ||
| 2373 | pub const __builtin_altivec_vpdepd = struct { | |
| 2374 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 2375 | const target_set = TargetSet.init(.{ | |
| 2376 | .ppc = true, | |
| 2377 | }); | |
| 2378 | }; | |
| 2379 | ||
| 2380 | pub const __builtin_altivec_vperm_4si = struct { | |
| 2381 | const param_str = "V4iV4iV4iV16Uc"; | |
| 2382 | const target_set = TargetSet.init(.{ | |
| 2383 | .ppc = true, | |
| 2384 | }); | |
| 2385 | }; | |
| 2386 | ||
| 2387 | pub const __builtin_altivec_vpextd = struct { | |
| 2388 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 2389 | const target_set = TargetSet.init(.{ | |
| 2390 | .ppc = true, | |
| 2391 | }); | |
| 2392 | }; | |
| 2393 | ||
| 2394 | pub const __builtin_altivec_vpkpx = struct { | |
| 2395 | const param_str = "V8sV4UiV4Ui"; | |
| 2396 | const target_set = TargetSet.init(.{ | |
| 2397 | .ppc = true, | |
| 2398 | }); | |
| 2399 | }; | |
| 2400 | ||
| 2401 | pub const __builtin_altivec_vpksdss = struct { | |
| 2402 | const param_str = "V4SiV2SLLiV2SLLi"; | |
| 2403 | const target_set = TargetSet.init(.{ | |
| 2404 | .ppc = true, | |
| 2405 | }); | |
| 2406 | }; | |
| 2407 | ||
| 2408 | pub const __builtin_altivec_vpksdus = struct { | |
| 2409 | const param_str = "V4UiV2SLLiV2SLLi"; | |
| 2410 | const target_set = TargetSet.init(.{ | |
| 2411 | .ppc = true, | |
| 2412 | }); | |
| 2413 | }; | |
| 2414 | ||
| 2415 | pub const __builtin_altivec_vpkshss = struct { | |
| 2416 | const param_str = "V16ScV8SsV8Ss"; | |
| 2417 | const target_set = TargetSet.init(.{ | |
| 2418 | .ppc = true, | |
| 2419 | }); | |
| 2420 | }; | |
| 2421 | ||
| 2422 | pub const __builtin_altivec_vpkshus = struct { | |
| 2423 | const param_str = "V16UcV8SsV8Ss"; | |
| 2424 | const target_set = TargetSet.init(.{ | |
| 2425 | .ppc = true, | |
| 2426 | }); | |
| 2427 | }; | |
| 2428 | ||
| 2429 | pub const __builtin_altivec_vpkswss = struct { | |
| 2430 | const param_str = "V8SsV4SiV4Si"; | |
| 2431 | const target_set = TargetSet.init(.{ | |
| 2432 | .ppc = true, | |
| 2433 | }); | |
| 2434 | }; | |
| 2435 | ||
| 2436 | pub const __builtin_altivec_vpkswus = struct { | |
| 2437 | const param_str = "V8UsV4SiV4Si"; | |
| 2438 | const target_set = TargetSet.init(.{ | |
| 2439 | .ppc = true, | |
| 2440 | }); | |
| 2441 | }; | |
| 2442 | ||
| 2443 | pub const __builtin_altivec_vpkudum = struct { | |
| 2444 | const param_str = "V4UiV2ULLiV2ULLi"; | |
| 2445 | const target_set = TargetSet.init(.{ | |
| 2446 | .ppc = true, | |
| 2447 | }); | |
| 2448 | }; | |
| 2449 | ||
| 2450 | pub const __builtin_altivec_vpkudus = struct { | |
| 2451 | const param_str = "V4UiV2ULLiV2ULLi"; | |
| 2452 | const target_set = TargetSet.init(.{ | |
| 2453 | .ppc = true, | |
| 2454 | }); | |
| 2455 | }; | |
| 2456 | ||
| 2457 | pub const __builtin_altivec_vpkuhus = struct { | |
| 2458 | const param_str = "V16UcV8UsV8Us"; | |
| 2459 | const target_set = TargetSet.init(.{ | |
| 2460 | .ppc = true, | |
| 2461 | }); | |
| 2462 | }; | |
| 2463 | ||
| 2464 | pub const __builtin_altivec_vpkuwus = struct { | |
| 2465 | const param_str = "V8UsV4UiV4Ui"; | |
| 2466 | const target_set = TargetSet.init(.{ | |
| 2467 | .ppc = true, | |
| 2468 | }); | |
| 2469 | }; | |
| 2470 | ||
| 2471 | pub const __builtin_altivec_vpopcntb = struct { | |
| 2472 | const param_str = "V16UcV16Uc"; | |
| 2473 | const target_set = TargetSet.init(.{ | |
| 2474 | .ppc = true, | |
| 2475 | }); | |
| 2476 | }; | |
| 2477 | ||
| 2478 | pub const __builtin_altivec_vpopcntd = struct { | |
| 2479 | const param_str = "V2ULLiV2ULLi"; | |
| 2480 | const target_set = TargetSet.init(.{ | |
| 2481 | .ppc = true, | |
| 2482 | }); | |
| 2483 | }; | |
| 2484 | ||
| 2485 | pub const __builtin_altivec_vpopcnth = struct { | |
| 2486 | const param_str = "V8UsV8Us"; | |
| 2487 | const target_set = TargetSet.init(.{ | |
| 2488 | .ppc = true, | |
| 2489 | }); | |
| 2490 | }; | |
| 2491 | ||
| 2492 | pub const __builtin_altivec_vpopcntw = struct { | |
| 2493 | const param_str = "V4UiV4Ui"; | |
| 2494 | const target_set = TargetSet.init(.{ | |
| 2495 | .ppc = true, | |
| 2496 | }); | |
| 2497 | }; | |
| 2498 | ||
| 2499 | pub const __builtin_altivec_vprtybd = struct { | |
| 2500 | const param_str = "V2ULLiV2ULLi"; | |
| 2501 | const target_set = TargetSet.init(.{ | |
| 2502 | .ppc = true, | |
| 2503 | }); | |
| 2504 | }; | |
| 2505 | ||
| 2506 | pub const __builtin_altivec_vprtybq = struct { | |
| 2507 | const param_str = "V1ULLLiV1ULLLi"; | |
| 2508 | const target_set = TargetSet.init(.{ | |
| 2509 | .ppc = true, | |
| 2510 | }); | |
| 2511 | }; | |
| 2512 | ||
| 2513 | pub const __builtin_altivec_vprtybw = struct { | |
| 2514 | const param_str = "V4UiV4Ui"; | |
| 2515 | const target_set = TargetSet.init(.{ | |
| 2516 | .ppc = true, | |
| 2517 | }); | |
| 2518 | }; | |
| 2519 | ||
| 2520 | pub const __builtin_altivec_vrefp = struct { | |
| 2521 | const param_str = "V4fV4f"; | |
| 2522 | const target_set = TargetSet.init(.{ | |
| 2523 | .ppc = true, | |
| 2524 | }); | |
| 2525 | }; | |
| 2526 | ||
| 2527 | pub const __builtin_altivec_vrfim = struct { | |
| 2528 | const param_str = "V4fV4f"; | |
| 2529 | const target_set = TargetSet.init(.{ | |
| 2530 | .ppc = true, | |
| 2531 | }); | |
| 2532 | }; | |
| 2533 | ||
| 2534 | pub const __builtin_altivec_vrfin = struct { | |
| 2535 | const param_str = "V4fV4f"; | |
| 2536 | const target_set = TargetSet.init(.{ | |
| 2537 | .ppc = true, | |
| 2538 | }); | |
| 2539 | }; | |
| 2540 | ||
| 2541 | pub const __builtin_altivec_vrfip = struct { | |
| 2542 | const param_str = "V4fV4f"; | |
| 2543 | const target_set = TargetSet.init(.{ | |
| 2544 | .ppc = true, | |
| 2545 | }); | |
| 2546 | }; | |
| 2547 | ||
| 2548 | pub const __builtin_altivec_vrfiz = struct { | |
| 2549 | const param_str = "V4fV4f"; | |
| 2550 | const target_set = TargetSet.init(.{ | |
| 2551 | .ppc = true, | |
| 2552 | }); | |
| 2553 | }; | |
| 2554 | ||
| 2555 | pub const __builtin_altivec_vrlb = struct { | |
| 2556 | const param_str = "V16cV16cV16Uc"; | |
| 2557 | const target_set = TargetSet.init(.{ | |
| 2558 | .ppc = true, | |
| 2559 | }); | |
| 2560 | }; | |
| 2561 | ||
| 2562 | pub const __builtin_altivec_vrld = struct { | |
| 2563 | const param_str = "V2LLiV2LLiV2ULLi"; | |
| 2564 | const target_set = TargetSet.init(.{ | |
| 2565 | .ppc = true, | |
| 2566 | }); | |
| 2567 | }; | |
| 2568 | ||
| 2569 | pub const __builtin_altivec_vrldmi = struct { | |
| 2570 | const param_str = "V2ULLiV2ULLiV2ULLiV2ULLi"; | |
| 2571 | const target_set = TargetSet.init(.{ | |
| 2572 | .ppc = true, | |
| 2573 | }); | |
| 2574 | }; | |
| 2575 | ||
| 2576 | pub const __builtin_altivec_vrldnm = struct { | |
| 2577 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 2578 | const target_set = TargetSet.init(.{ | |
| 2579 | .ppc = true, | |
| 2580 | }); | |
| 2581 | }; | |
| 2582 | ||
| 2583 | pub const __builtin_altivec_vrlh = struct { | |
| 2584 | const param_str = "V8sV8sV8Us"; | |
| 2585 | const target_set = TargetSet.init(.{ | |
| 2586 | .ppc = true, | |
| 2587 | }); | |
| 2588 | }; | |
| 2589 | ||
| 2590 | pub const __builtin_altivec_vrlqmi = struct { | |
| 2591 | const param_str = "V1ULLLiV1ULLLiV1ULLLiV1ULLLi"; | |
| 2592 | const target_set = TargetSet.init(.{ | |
| 2593 | .ppc = true, | |
| 2594 | }); | |
| 2595 | }; | |
| 2596 | ||
| 2597 | pub const __builtin_altivec_vrlqnm = struct { | |
| 2598 | const param_str = "V1ULLLiV1ULLLiV1ULLLi"; | |
| 2599 | const target_set = TargetSet.init(.{ | |
| 2600 | .ppc = true, | |
| 2601 | }); | |
| 2602 | }; | |
| 2603 | ||
| 2604 | pub const __builtin_altivec_vrlw = struct { | |
| 2605 | const param_str = "V4iV4iV4Ui"; | |
| 2606 | const target_set = TargetSet.init(.{ | |
| 2607 | .ppc = true, | |
| 2608 | }); | |
| 2609 | }; | |
| 2610 | ||
| 2611 | pub const __builtin_altivec_vrlwmi = struct { | |
| 2612 | const param_str = "V4UiV4UiV4UiV4Ui"; | |
| 2613 | const target_set = TargetSet.init(.{ | |
| 2614 | .ppc = true, | |
| 2615 | }); | |
| 2616 | }; | |
| 2617 | ||
| 2618 | pub const __builtin_altivec_vrlwnm = struct { | |
| 2619 | const param_str = "V4UiV4UiV4Ui"; | |
| 2620 | const target_set = TargetSet.init(.{ | |
| 2621 | .ppc = true, | |
| 2622 | }); | |
| 2623 | }; | |
| 2624 | ||
| 2625 | pub const __builtin_altivec_vrsqrtefp = struct { | |
| 2626 | const param_str = "V4fV4f"; | |
| 2627 | const target_set = TargetSet.init(.{ | |
| 2628 | .ppc = true, | |
| 2629 | }); | |
| 2630 | }; | |
| 2631 | ||
| 2632 | pub const __builtin_altivec_vsel_4si = struct { | |
| 2633 | const param_str = "V4iV4iV4iV4Ui"; | |
| 2634 | const target_set = TargetSet.init(.{ | |
| 2635 | .ppc = true, | |
| 2636 | }); | |
| 2637 | }; | |
| 2638 | ||
| 2639 | pub const __builtin_altivec_vsl = struct { | |
| 2640 | const param_str = "V4iV4iV4i"; | |
| 2641 | const target_set = TargetSet.init(.{ | |
| 2642 | .ppc = true, | |
| 2643 | }); | |
| 2644 | }; | |
| 2645 | ||
| 2646 | pub const __builtin_altivec_vsldbi = struct { | |
| 2647 | const param_str = "V16UcV16UcV16UcIi"; | |
| 2648 | const target_set = TargetSet.init(.{ | |
| 2649 | .ppc = true, | |
| 2650 | }); | |
| 2651 | }; | |
| 2652 | ||
| 2653 | pub const __builtin_altivec_vslo = struct { | |
| 2654 | const param_str = "V4iV4iV4i"; | |
| 2655 | const target_set = TargetSet.init(.{ | |
| 2656 | .ppc = true, | |
| 2657 | }); | |
| 2658 | }; | |
| 2659 | ||
| 2660 | pub const __builtin_altivec_vslv = struct { | |
| 2661 | const param_str = "V16UcV16UcV16Uc"; | |
| 2662 | const target_set = TargetSet.init(.{ | |
| 2663 | .ppc = true, | |
| 2664 | }); | |
| 2665 | }; | |
| 2666 | ||
| 2667 | pub const __builtin_altivec_vsr = struct { | |
| 2668 | const param_str = "V4iV4iV4i"; | |
| 2669 | const target_set = TargetSet.init(.{ | |
| 2670 | .ppc = true, | |
| 2671 | }); | |
| 2672 | }; | |
| 2673 | ||
| 2674 | pub const __builtin_altivec_vsrab = struct { | |
| 2675 | const param_str = "V16cV16cV16Uc"; | |
| 2676 | const target_set = TargetSet.init(.{ | |
| 2677 | .ppc = true, | |
| 2678 | }); | |
| 2679 | }; | |
| 2680 | ||
| 2681 | pub const __builtin_altivec_vsrah = struct { | |
| 2682 | const param_str = "V8sV8sV8Us"; | |
| 2683 | const target_set = TargetSet.init(.{ | |
| 2684 | .ppc = true, | |
| 2685 | }); | |
| 2686 | }; | |
| 2687 | ||
| 2688 | pub const __builtin_altivec_vsraw = struct { | |
| 2689 | const param_str = "V4iV4iV4Ui"; | |
| 2690 | const target_set = TargetSet.init(.{ | |
| 2691 | .ppc = true, | |
| 2692 | }); | |
| 2693 | }; | |
| 2694 | ||
| 2695 | pub const __builtin_altivec_vsrdbi = struct { | |
| 2696 | const param_str = "V16UcV16UcV16UcIi"; | |
| 2697 | const target_set = TargetSet.init(.{ | |
| 2698 | .ppc = true, | |
| 2699 | }); | |
| 2700 | }; | |
| 2701 | ||
| 2702 | pub const __builtin_altivec_vsro = struct { | |
| 2703 | const param_str = "V4iV4iV4i"; | |
| 2704 | const target_set = TargetSet.init(.{ | |
| 2705 | .ppc = true, | |
| 2706 | }); | |
| 2707 | }; | |
| 2708 | ||
| 2709 | pub const __builtin_altivec_vsrv = struct { | |
| 2710 | const param_str = "V16UcV16UcV16Uc"; | |
| 2711 | const target_set = TargetSet.init(.{ | |
| 2712 | .ppc = true, | |
| 2713 | }); | |
| 2714 | }; | |
| 2715 | ||
| 2716 | pub const __builtin_altivec_vstribl = struct { | |
| 2717 | const param_str = "V16UcV16Uc"; | |
| 2718 | const target_set = TargetSet.init(.{ | |
| 2719 | .ppc = true, | |
| 2720 | }); | |
| 2721 | }; | |
| 2722 | ||
| 2723 | pub const __builtin_altivec_vstribl_p = struct { | |
| 2724 | const param_str = "iiV16Uc"; | |
| 2725 | const target_set = TargetSet.init(.{ | |
| 2726 | .ppc = true, | |
| 2727 | }); | |
| 2728 | }; | |
| 2729 | ||
| 2730 | pub const __builtin_altivec_vstribr = struct { | |
| 2731 | const param_str = "V16UcV16Uc"; | |
| 2732 | const target_set = TargetSet.init(.{ | |
| 2733 | .ppc = true, | |
| 2734 | }); | |
| 2735 | }; | |
| 2736 | ||
| 2737 | pub const __builtin_altivec_vstribr_p = struct { | |
| 2738 | const param_str = "iiV16Uc"; | |
| 2739 | const target_set = TargetSet.init(.{ | |
| 2740 | .ppc = true, | |
| 2741 | }); | |
| 2742 | }; | |
| 2743 | ||
| 2744 | pub const __builtin_altivec_vstrihl = struct { | |
| 2745 | const param_str = "V8sV8s"; | |
| 2746 | const target_set = TargetSet.init(.{ | |
| 2747 | .ppc = true, | |
| 2748 | }); | |
| 2749 | }; | |
| 2750 | ||
| 2751 | pub const __builtin_altivec_vstrihl_p = struct { | |
| 2752 | const param_str = "iiV8s"; | |
| 2753 | const target_set = TargetSet.init(.{ | |
| 2754 | .ppc = true, | |
| 2755 | }); | |
| 2756 | }; | |
| 2757 | ||
| 2758 | pub const __builtin_altivec_vstrihr = struct { | |
| 2759 | const param_str = "V8sV8s"; | |
| 2760 | const target_set = TargetSet.init(.{ | |
| 2761 | .ppc = true, | |
| 2762 | }); | |
| 2763 | }; | |
| 2764 | ||
| 2765 | pub const __builtin_altivec_vstrihr_p = struct { | |
| 2766 | const param_str = "iiV8s"; | |
| 2767 | const target_set = TargetSet.init(.{ | |
| 2768 | .ppc = true, | |
| 2769 | }); | |
| 2770 | }; | |
| 2771 | ||
| 2772 | pub const __builtin_altivec_vsubcuq = struct { | |
| 2773 | const param_str = "V1ULLLiV1ULLLiV1ULLLi"; | |
| 2774 | const target_set = TargetSet.init(.{ | |
| 2775 | .ppc = true, | |
| 2776 | }); | |
| 2777 | }; | |
| 2778 | ||
| 2779 | pub const __builtin_altivec_vsubcuq_c = struct { | |
| 2780 | const param_str = "V16UcV16UcV16Uc"; | |
| 2781 | const target_set = TargetSet.init(.{ | |
| 2782 | .ppc = true, | |
| 2783 | }); | |
| 2784 | }; | |
| 2785 | ||
| 2786 | pub const __builtin_altivec_vsubcuw = struct { | |
| 2787 | const param_str = "V4UiV4UiV4Ui"; | |
| 2788 | const target_set = TargetSet.init(.{ | |
| 2789 | .ppc = true, | |
| 2790 | }); | |
| 2791 | }; | |
| 2792 | ||
| 2793 | pub const __builtin_altivec_vsubecuq = struct { | |
| 2794 | const param_str = "V1ULLLiV1ULLLiV1ULLLiV1ULLLi"; | |
| 2795 | const target_set = TargetSet.init(.{ | |
| 2796 | .ppc = true, | |
| 2797 | }); | |
| 2798 | }; | |
| 2799 | ||
| 2800 | pub const __builtin_altivec_vsubecuq_c = struct { | |
| 2801 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 2802 | const target_set = TargetSet.init(.{ | |
| 2803 | .ppc = true, | |
| 2804 | }); | |
| 2805 | }; | |
| 2806 | ||
| 2807 | pub const __builtin_altivec_vsubeuqm = struct { | |
| 2808 | const param_str = "V1ULLLiV1ULLLiV1ULLLiV1ULLLi"; | |
| 2809 | const target_set = TargetSet.init(.{ | |
| 2810 | .ppc = true, | |
| 2811 | }); | |
| 2812 | }; | |
| 2813 | ||
| 2814 | pub const __builtin_altivec_vsubeuqm_c = struct { | |
| 2815 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 2816 | const target_set = TargetSet.init(.{ | |
| 2817 | .ppc = true, | |
| 2818 | }); | |
| 2819 | }; | |
| 2820 | ||
| 2821 | pub const __builtin_altivec_vsubsbs = struct { | |
| 2822 | const param_str = "V16ScV16ScV16Sc"; | |
| 2823 | const target_set = TargetSet.init(.{ | |
| 2824 | .ppc = true, | |
| 2825 | }); | |
| 2826 | }; | |
| 2827 | ||
| 2828 | pub const __builtin_altivec_vsubshs = struct { | |
| 2829 | const param_str = "V8SsV8SsV8Ss"; | |
| 2830 | const target_set = TargetSet.init(.{ | |
| 2831 | .ppc = true, | |
| 2832 | }); | |
| 2833 | }; | |
| 2834 | ||
| 2835 | pub const __builtin_altivec_vsubsws = struct { | |
| 2836 | const param_str = "V4SiV4SiV4Si"; | |
| 2837 | const target_set = TargetSet.init(.{ | |
| 2838 | .ppc = true, | |
| 2839 | }); | |
| 2840 | }; | |
| 2841 | ||
| 2842 | pub const __builtin_altivec_vsububs = struct { | |
| 2843 | const param_str = "V16UcV16UcV16Uc"; | |
| 2844 | const target_set = TargetSet.init(.{ | |
| 2845 | .ppc = true, | |
| 2846 | }); | |
| 2847 | }; | |
| 2848 | ||
| 2849 | pub const __builtin_altivec_vsubuhs = struct { | |
| 2850 | const param_str = "V8UsV8UsV8Us"; | |
| 2851 | const target_set = TargetSet.init(.{ | |
| 2852 | .ppc = true, | |
| 2853 | }); | |
| 2854 | }; | |
| 2855 | ||
| 2856 | pub const __builtin_altivec_vsubuqm = struct { | |
| 2857 | const param_str = "V1ULLLiV16UcV16Uc"; | |
| 2858 | const target_set = TargetSet.init(.{ | |
| 2859 | .ppc = true, | |
| 2860 | }); | |
| 2861 | }; | |
| 2862 | ||
| 2863 | pub const __builtin_altivec_vsubuws = struct { | |
| 2864 | const param_str = "V4UiV4UiV4Ui"; | |
| 2865 | const target_set = TargetSet.init(.{ | |
| 2866 | .ppc = true, | |
| 2867 | }); | |
| 2868 | }; | |
| 2869 | ||
| 2870 | pub const __builtin_altivec_vsum2sws = struct { | |
| 2871 | const param_str = "V4SiV4SiV4Si"; | |
| 2872 | const target_set = TargetSet.init(.{ | |
| 2873 | .ppc = true, | |
| 2874 | }); | |
| 2875 | }; | |
| 2876 | ||
| 2877 | pub const __builtin_altivec_vsum4sbs = struct { | |
| 2878 | const param_str = "V4SiV16ScV4Si"; | |
| 2879 | const target_set = TargetSet.init(.{ | |
| 2880 | .ppc = true, | |
| 2881 | }); | |
| 2882 | }; | |
| 2883 | ||
| 2884 | pub const __builtin_altivec_vsum4shs = struct { | |
| 2885 | const param_str = "V4SiV8SsV4Si"; | |
| 2886 | const target_set = TargetSet.init(.{ | |
| 2887 | .ppc = true, | |
| 2888 | }); | |
| 2889 | }; | |
| 2890 | ||
| 2891 | pub const __builtin_altivec_vsum4ubs = struct { | |
| 2892 | const param_str = "V4UiV16UcV4Ui"; | |
| 2893 | const target_set = TargetSet.init(.{ | |
| 2894 | .ppc = true, | |
| 2895 | }); | |
| 2896 | }; | |
| 2897 | ||
| 2898 | pub const __builtin_altivec_vsumsws = struct { | |
| 2899 | const param_str = "V4SiV4SiV4Si"; | |
| 2900 | const target_set = TargetSet.init(.{ | |
| 2901 | .ppc = true, | |
| 2902 | }); | |
| 2903 | }; | |
| 2904 | ||
| 2905 | pub const __builtin_altivec_vupkhpx = struct { | |
| 2906 | const param_str = "V4UiV8s"; | |
| 2907 | const target_set = TargetSet.init(.{ | |
| 2908 | .ppc = true, | |
| 2909 | }); | |
| 2910 | }; | |
| 2911 | ||
| 2912 | pub const __builtin_altivec_vupkhsb = struct { | |
| 2913 | const param_str = "V8sV16c"; | |
| 2914 | const target_set = TargetSet.init(.{ | |
| 2915 | .ppc = true, | |
| 2916 | }); | |
| 2917 | }; | |
| 2918 | ||
| 2919 | pub const __builtin_altivec_vupkhsh = struct { | |
| 2920 | const param_str = "V4iV8s"; | |
| 2921 | const target_set = TargetSet.init(.{ | |
| 2922 | .ppc = true, | |
| 2923 | }); | |
| 2924 | }; | |
| 2925 | ||
| 2926 | pub const __builtin_altivec_vupkhsw = struct { | |
| 2927 | const param_str = "V2LLiV4i"; | |
| 2928 | const target_set = TargetSet.init(.{ | |
| 2929 | .ppc = true, | |
| 2930 | }); | |
| 2931 | }; | |
| 2932 | ||
| 2933 | pub const __builtin_altivec_vupklpx = struct { | |
| 2934 | const param_str = "V4UiV8s"; | |
| 2935 | const target_set = TargetSet.init(.{ | |
| 2936 | .ppc = true, | |
| 2937 | }); | |
| 2938 | }; | |
| 2939 | ||
| 2940 | pub const __builtin_altivec_vupklsb = struct { | |
| 2941 | const param_str = "V8sV16c"; | |
| 2942 | const target_set = TargetSet.init(.{ | |
| 2943 | .ppc = true, | |
| 2944 | }); | |
| 2945 | }; | |
| 2946 | ||
| 2947 | pub const __builtin_altivec_vupklsh = struct { | |
| 2948 | const param_str = "V4iV8s"; | |
| 2949 | const target_set = TargetSet.init(.{ | |
| 2950 | .ppc = true, | |
| 2951 | }); | |
| 2952 | }; | |
| 2953 | ||
| 2954 | pub const __builtin_altivec_vupklsw = struct { | |
| 2955 | const param_str = "V2LLiV4i"; | |
| 2956 | const target_set = TargetSet.init(.{ | |
| 2957 | .ppc = true, | |
| 2958 | }); | |
| 2959 | }; | |
| 2960 | ||
| 2961 | pub const __builtin_amdgcn_alignbit = struct { | |
| 2962 | const param_str = "UiUiUiUi"; | |
| 2963 | const target_set = TargetSet.init(.{ | |
| 2964 | .amdgpu = true, | |
| 2965 | }); | |
| 2966 | const attributes = Attributes{ | |
| 2967 | .@"const" = true, | |
| 2968 | }; | |
| 2969 | }; | |
| 2970 | ||
| 2971 | pub const __builtin_amdgcn_alignbyte = struct { | |
| 2972 | const param_str = "UiUiUiUi"; | |
| 2973 | const target_set = TargetSet.init(.{ | |
| 2974 | .amdgpu = true, | |
| 2975 | }); | |
| 2976 | const attributes = Attributes{ | |
| 2977 | .@"const" = true, | |
| 2978 | }; | |
| 2979 | }; | |
| 2980 | ||
| 2981 | pub const __builtin_amdgcn_atomic_dec32 = struct { | |
| 2982 | const param_str = "UZiUZiD*UZiUicC*"; | |
| 2983 | const target_set = TargetSet.init(.{ | |
| 2984 | .amdgpu = true, | |
| 2985 | }); | |
| 2986 | const attributes = Attributes{}; | |
| 2987 | }; | |
| 2988 | ||
| 2989 | pub const __builtin_amdgcn_atomic_dec64 = struct { | |
| 2990 | const param_str = "UWiUWiD*UWiUicC*"; | |
| 2991 | const target_set = TargetSet.init(.{ | |
| 2992 | .amdgpu = true, | |
| 2993 | }); | |
| 2994 | const attributes = Attributes{}; | |
| 2995 | }; | |
| 2996 | ||
| 2997 | pub const __builtin_amdgcn_atomic_inc32 = struct { | |
| 2998 | const param_str = "UZiUZiD*UZiUicC*"; | |
| 2999 | const target_set = TargetSet.init(.{ | |
| 3000 | .amdgpu = true, | |
| 3001 | }); | |
| 3002 | const attributes = Attributes{}; | |
| 3003 | }; | |
| 3004 | ||
| 3005 | pub const __builtin_amdgcn_atomic_inc64 = struct { | |
| 3006 | const param_str = "UWiUWiD*UWiUicC*"; | |
| 3007 | const target_set = TargetSet.init(.{ | |
| 3008 | .amdgpu = true, | |
| 3009 | }); | |
| 3010 | const attributes = Attributes{}; | |
| 3011 | }; | |
| 3012 | ||
| 3013 | pub const __builtin_amdgcn_buffer_wbinvl1 = struct { | |
| 3014 | const param_str = "v"; | |
| 3015 | const target_set = TargetSet.init(.{ | |
| 3016 | .amdgpu = true, | |
| 3017 | }); | |
| 3018 | const attributes = Attributes{}; | |
| 3019 | }; | |
| 3020 | ||
| 3021 | pub const __builtin_amdgcn_class = struct { | |
| 3022 | const param_str = "bdi"; | |
| 3023 | const target_set = TargetSet.init(.{ | |
| 3024 | .amdgpu = true, | |
| 3025 | }); | |
| 3026 | const attributes = Attributes{ | |
| 3027 | .@"const" = true, | |
| 3028 | }; | |
| 3029 | }; | |
| 3030 | ||
| 3031 | pub const __builtin_amdgcn_classf = struct { | |
| 3032 | const param_str = "bfi"; | |
| 3033 | const target_set = TargetSet.init(.{ | |
| 3034 | .amdgpu = true, | |
| 3035 | }); | |
| 3036 | const attributes = Attributes{ | |
| 3037 | .@"const" = true, | |
| 3038 | }; | |
| 3039 | }; | |
| 3040 | ||
| 3041 | pub const __builtin_amdgcn_cosf = struct { | |
| 3042 | const param_str = "ff"; | |
| 3043 | const target_set = TargetSet.init(.{ | |
| 3044 | .amdgpu = true, | |
| 3045 | }); | |
| 3046 | const attributes = Attributes{ | |
| 3047 | .@"const" = true, | |
| 3048 | }; | |
| 3049 | }; | |
| 3050 | ||
| 3051 | pub const __builtin_amdgcn_cubeid = struct { | |
| 3052 | const param_str = "ffff"; | |
| 3053 | const target_set = TargetSet.init(.{ | |
| 3054 | .amdgpu = true, | |
| 3055 | }); | |
| 3056 | const attributes = Attributes{ | |
| 3057 | .@"const" = true, | |
| 3058 | }; | |
| 3059 | }; | |
| 3060 | ||
| 3061 | pub const __builtin_amdgcn_cubema = struct { | |
| 3062 | const param_str = "ffff"; | |
| 3063 | const target_set = TargetSet.init(.{ | |
| 3064 | .amdgpu = true, | |
| 3065 | }); | |
| 3066 | const attributes = Attributes{ | |
| 3067 | .@"const" = true, | |
| 3068 | }; | |
| 3069 | }; | |
| 3070 | ||
| 3071 | pub const __builtin_amdgcn_cubesc = struct { | |
| 3072 | const param_str = "ffff"; | |
| 3073 | const target_set = TargetSet.init(.{ | |
| 3074 | .amdgpu = true, | |
| 3075 | }); | |
| 3076 | const attributes = Attributes{ | |
| 3077 | .@"const" = true, | |
| 3078 | }; | |
| 3079 | }; | |
| 3080 | ||
| 3081 | pub const __builtin_amdgcn_cubetc = struct { | |
| 3082 | const param_str = "ffff"; | |
| 3083 | const target_set = TargetSet.init(.{ | |
| 3084 | .amdgpu = true, | |
| 3085 | }); | |
| 3086 | const attributes = Attributes{ | |
| 3087 | .@"const" = true, | |
| 3088 | }; | |
| 3089 | }; | |
| 3090 | ||
| 3091 | pub const __builtin_amdgcn_cvt_pk_i16 = struct { | |
| 3092 | const param_str = "E2sii"; | |
| 3093 | const target_set = TargetSet.init(.{ | |
| 3094 | .amdgpu = true, | |
| 3095 | }); | |
| 3096 | const attributes = Attributes{ | |
| 3097 | .@"const" = true, | |
| 3098 | }; | |
| 3099 | }; | |
| 3100 | ||
| 3101 | pub const __builtin_amdgcn_cvt_pk_u16 = struct { | |
| 3102 | const param_str = "E2UsUiUi"; | |
| 3103 | const target_set = TargetSet.init(.{ | |
| 3104 | .amdgpu = true, | |
| 3105 | }); | |
| 3106 | const attributes = Attributes{ | |
| 3107 | .@"const" = true, | |
| 3108 | }; | |
| 3109 | }; | |
| 3110 | ||
| 3111 | pub const __builtin_amdgcn_cvt_pk_u8_f32 = struct { | |
| 3112 | const param_str = "UifUiUi"; | |
| 3113 | const target_set = TargetSet.init(.{ | |
| 3114 | .amdgpu = true, | |
| 3115 | }); | |
| 3116 | const attributes = Attributes{ | |
| 3117 | .@"const" = true, | |
| 3118 | }; | |
| 3119 | }; | |
| 3120 | ||
| 3121 | pub const __builtin_amdgcn_cvt_pknorm_i16 = struct { | |
| 3122 | const param_str = "E2sff"; | |
| 3123 | const target_set = TargetSet.init(.{ | |
| 3124 | .amdgpu = true, | |
| 3125 | }); | |
| 3126 | const attributes = Attributes{ | |
| 3127 | .@"const" = true, | |
| 3128 | }; | |
| 3129 | }; | |
| 3130 | ||
| 3131 | pub const __builtin_amdgcn_cvt_pknorm_u16 = struct { | |
| 3132 | const param_str = "E2Usff"; | |
| 3133 | const target_set = TargetSet.init(.{ | |
| 3134 | .amdgpu = true, | |
| 3135 | }); | |
| 3136 | const attributes = Attributes{ | |
| 3137 | .@"const" = true, | |
| 3138 | }; | |
| 3139 | }; | |
| 3140 | ||
| 3141 | pub const __builtin_amdgcn_cvt_pkrtz = struct { | |
| 3142 | const param_str = "E2hff"; | |
| 3143 | const target_set = TargetSet.init(.{ | |
| 3144 | .amdgpu = true, | |
| 3145 | }); | |
| 3146 | const attributes = Attributes{ | |
| 3147 | .@"const" = true, | |
| 3148 | }; | |
| 3149 | }; | |
| 3150 | ||
| 3151 | pub const __builtin_amdgcn_dispatch_ptr = struct { | |
| 3152 | const param_str = "v*4"; | |
| 3153 | const target_set = TargetSet.init(.{ | |
| 3154 | .amdgpu = true, | |
| 3155 | }); | |
| 3156 | const attributes = Attributes{ | |
| 3157 | .@"const" = true, | |
| 3158 | }; | |
| 3159 | }; | |
| 3160 | ||
| 3161 | pub const __builtin_amdgcn_div_fixup = struct { | |
| 3162 | const param_str = "dddd"; | |
| 3163 | const target_set = TargetSet.init(.{ | |
| 3164 | .amdgpu = true, | |
| 3165 | }); | |
| 3166 | const attributes = Attributes{ | |
| 3167 | .@"const" = true, | |
| 3168 | }; | |
| 3169 | }; | |
| 3170 | ||
| 3171 | pub const __builtin_amdgcn_div_fixupf = struct { | |
| 3172 | const param_str = "ffff"; | |
| 3173 | const target_set = TargetSet.init(.{ | |
| 3174 | .amdgpu = true, | |
| 3175 | }); | |
| 3176 | const attributes = Attributes{ | |
| 3177 | .@"const" = true, | |
| 3178 | }; | |
| 3179 | }; | |
| 3180 | ||
| 3181 | pub const __builtin_amdgcn_div_fmas = struct { | |
| 3182 | const param_str = "ddddb"; | |
| 3183 | const target_set = TargetSet.init(.{ | |
| 3184 | .amdgpu = true, | |
| 3185 | }); | |
| 3186 | const attributes = Attributes{ | |
| 3187 | .@"const" = true, | |
| 3188 | }; | |
| 3189 | }; | |
| 3190 | ||
| 3191 | pub const __builtin_amdgcn_div_fmasf = struct { | |
| 3192 | const param_str = "ffffb"; | |
| 3193 | const target_set = TargetSet.init(.{ | |
| 3194 | .amdgpu = true, | |
| 3195 | }); | |
| 3196 | const attributes = Attributes{ | |
| 3197 | .@"const" = true, | |
| 3198 | }; | |
| 3199 | }; | |
| 3200 | ||
| 3201 | pub const __builtin_amdgcn_div_scale = struct { | |
| 3202 | const param_str = "dddbb*"; | |
| 3203 | const target_set = TargetSet.init(.{ | |
| 3204 | .amdgpu = true, | |
| 3205 | }); | |
| 3206 | const attributes = Attributes{}; | |
| 3207 | }; | |
| 3208 | ||
| 3209 | pub const __builtin_amdgcn_div_scalef = struct { | |
| 3210 | const param_str = "fffbb*"; | |
| 3211 | const target_set = TargetSet.init(.{ | |
| 3212 | .amdgpu = true, | |
| 3213 | }); | |
| 3214 | const attributes = Attributes{}; | |
| 3215 | }; | |
| 3216 | ||
| 3217 | pub const __builtin_amdgcn_ds_append = struct { | |
| 3218 | const param_str = "ii*3"; | |
| 3219 | const target_set = TargetSet.init(.{ | |
| 3220 | .amdgpu = true, | |
| 3221 | }); | |
| 3222 | const attributes = Attributes{}; | |
| 3223 | }; | |
| 3224 | ||
| 3225 | pub const __builtin_amdgcn_ds_bpermute = struct { | |
| 3226 | const param_str = "iii"; | |
| 3227 | const target_set = TargetSet.init(.{ | |
| 3228 | .amdgpu = true, | |
| 3229 | }); | |
| 3230 | const attributes = Attributes{ | |
| 3231 | .@"const" = true, | |
| 3232 | }; | |
| 3233 | }; | |
| 3234 | ||
| 3235 | pub const __builtin_amdgcn_ds_consume = struct { | |
| 3236 | const param_str = "ii*3"; | |
| 3237 | const target_set = TargetSet.init(.{ | |
| 3238 | .amdgpu = true, | |
| 3239 | }); | |
| 3240 | const attributes = Attributes{}; | |
| 3241 | }; | |
| 3242 | ||
| 3243 | pub const __builtin_amdgcn_ds_faddf = struct { | |
| 3244 | const param_str = "ff*3fIiIiIb"; | |
| 3245 | const target_set = TargetSet.init(.{ | |
| 3246 | .amdgpu = true, | |
| 3247 | }); | |
| 3248 | const attributes = Attributes{}; | |
| 3249 | }; | |
| 3250 | ||
| 3251 | pub const __builtin_amdgcn_ds_fmaxf = struct { | |
| 3252 | const param_str = "ff*3fIiIiIb"; | |
| 3253 | const target_set = TargetSet.init(.{ | |
| 3254 | .amdgpu = true, | |
| 3255 | }); | |
| 3256 | const attributes = Attributes{}; | |
| 3257 | }; | |
| 3258 | ||
| 3259 | pub const __builtin_amdgcn_ds_fminf = struct { | |
| 3260 | const param_str = "ff*3fIiIiIb"; | |
| 3261 | const target_set = TargetSet.init(.{ | |
| 3262 | .amdgpu = true, | |
| 3263 | }); | |
| 3264 | const attributes = Attributes{}; | |
| 3265 | }; | |
| 3266 | ||
| 3267 | pub const __builtin_amdgcn_ds_gws_barrier = struct { | |
| 3268 | const param_str = "vUiUi"; | |
| 3269 | const target_set = TargetSet.init(.{ | |
| 3270 | .amdgpu = true, | |
| 3271 | }); | |
| 3272 | const attributes = Attributes{}; | |
| 3273 | }; | |
| 3274 | ||
| 3275 | pub const __builtin_amdgcn_ds_gws_init = struct { | |
| 3276 | const param_str = "vUiUi"; | |
| 3277 | const target_set = TargetSet.init(.{ | |
| 3278 | .amdgpu = true, | |
| 3279 | }); | |
| 3280 | const attributes = Attributes{}; | |
| 3281 | }; | |
| 3282 | ||
| 3283 | pub const __builtin_amdgcn_ds_gws_sema_br = struct { | |
| 3284 | const param_str = "vUiUi"; | |
| 3285 | const target_set = TargetSet.init(.{ | |
| 3286 | .amdgpu = true, | |
| 3287 | }); | |
| 3288 | const attributes = Attributes{}; | |
| 3289 | }; | |
| 3290 | ||
| 3291 | pub const __builtin_amdgcn_ds_gws_sema_p = struct { | |
| 3292 | const param_str = "vUi"; | |
| 3293 | const target_set = TargetSet.init(.{ | |
| 3294 | .amdgpu = true, | |
| 3295 | }); | |
| 3296 | const attributes = Attributes{}; | |
| 3297 | }; | |
| 3298 | ||
| 3299 | pub const __builtin_amdgcn_ds_gws_sema_v = struct { | |
| 3300 | const param_str = "vUi"; | |
| 3301 | const target_set = TargetSet.init(.{ | |
| 3302 | .amdgpu = true, | |
| 3303 | }); | |
| 3304 | const attributes = Attributes{}; | |
| 3305 | }; | |
| 3306 | ||
| 3307 | pub const __builtin_amdgcn_ds_permute = struct { | |
| 3308 | const param_str = "iii"; | |
| 3309 | const target_set = TargetSet.init(.{ | |
| 3310 | .amdgpu = true, | |
| 3311 | }); | |
| 3312 | const attributes = Attributes{ | |
| 3313 | .@"const" = true, | |
| 3314 | }; | |
| 3315 | }; | |
| 3316 | ||
| 3317 | pub const __builtin_amdgcn_ds_swizzle = struct { | |
| 3318 | const param_str = "iiIi"; | |
| 3319 | const target_set = TargetSet.init(.{ | |
| 3320 | .amdgpu = true, | |
| 3321 | }); | |
| 3322 | const attributes = Attributes{ | |
| 3323 | .@"const" = true, | |
| 3324 | }; | |
| 3325 | }; | |
| 3326 | ||
| 3327 | pub const __builtin_amdgcn_endpgm = struct { | |
| 3328 | const param_str = "v"; | |
| 3329 | const target_set = TargetSet.init(.{ | |
| 3330 | .amdgpu = true, | |
| 3331 | }); | |
| 3332 | const attributes = Attributes{ | |
| 3333 | .noreturn = true, | |
| 3334 | }; | |
| 3335 | }; | |
| 3336 | ||
| 3337 | pub const __builtin_amdgcn_fcmp = struct { | |
| 3338 | const param_str = "WUiddIi"; | |
| 3339 | const target_set = TargetSet.init(.{ | |
| 3340 | .amdgpu = true, | |
| 3341 | }); | |
| 3342 | const attributes = Attributes{ | |
| 3343 | .@"const" = true, | |
| 3344 | }; | |
| 3345 | }; | |
| 3346 | ||
| 3347 | pub const __builtin_amdgcn_fcmpf = struct { | |
| 3348 | const param_str = "WUiffIi"; | |
| 3349 | const target_set = TargetSet.init(.{ | |
| 3350 | .amdgpu = true, | |
| 3351 | }); | |
| 3352 | const attributes = Attributes{ | |
| 3353 | .@"const" = true, | |
| 3354 | }; | |
| 3355 | }; | |
| 3356 | ||
| 3357 | pub const __builtin_amdgcn_fence = struct { | |
| 3358 | const param_str = "vUicC*"; | |
| 3359 | const target_set = TargetSet.init(.{ | |
| 3360 | .amdgpu = true, | |
| 3361 | }); | |
| 3362 | const attributes = Attributes{}; | |
| 3363 | }; | |
| 3364 | ||
| 3365 | pub const __builtin_amdgcn_fmed3f = struct { | |
| 3366 | const param_str = "ffff"; | |
| 3367 | const target_set = TargetSet.init(.{ | |
| 3368 | .amdgpu = true, | |
| 3369 | }); | |
| 3370 | const attributes = Attributes{ | |
| 3371 | .@"const" = true, | |
| 3372 | }; | |
| 3373 | }; | |
| 3374 | ||
| 3375 | pub const __builtin_amdgcn_fract = struct { | |
| 3376 | const param_str = "dd"; | |
| 3377 | const target_set = TargetSet.init(.{ | |
| 3378 | .amdgpu = true, | |
| 3379 | }); | |
| 3380 | const attributes = Attributes{ | |
| 3381 | .@"const" = true, | |
| 3382 | }; | |
| 3383 | }; | |
| 3384 | ||
| 3385 | pub const __builtin_amdgcn_fractf = struct { | |
| 3386 | const param_str = "ff"; | |
| 3387 | const target_set = TargetSet.init(.{ | |
| 3388 | .amdgpu = true, | |
| 3389 | }); | |
| 3390 | const attributes = Attributes{ | |
| 3391 | .@"const" = true, | |
| 3392 | }; | |
| 3393 | }; | |
| 3394 | ||
| 3395 | pub const __builtin_amdgcn_frexp_exp = struct { | |
| 3396 | const param_str = "id"; | |
| 3397 | const target_set = TargetSet.init(.{ | |
| 3398 | .amdgpu = true, | |
| 3399 | }); | |
| 3400 | const attributes = Attributes{ | |
| 3401 | .@"const" = true, | |
| 3402 | }; | |
| 3403 | }; | |
| 3404 | ||
| 3405 | pub const __builtin_amdgcn_frexp_expf = struct { | |
| 3406 | const param_str = "if"; | |
| 3407 | const target_set = TargetSet.init(.{ | |
| 3408 | .amdgpu = true, | |
| 3409 | }); | |
| 3410 | const attributes = Attributes{ | |
| 3411 | .@"const" = true, | |
| 3412 | }; | |
| 3413 | }; | |
| 3414 | ||
| 3415 | pub const __builtin_amdgcn_frexp_mant = struct { | |
| 3416 | const param_str = "dd"; | |
| 3417 | const target_set = TargetSet.init(.{ | |
| 3418 | .amdgpu = true, | |
| 3419 | }); | |
| 3420 | const attributes = Attributes{ | |
| 3421 | .@"const" = true, | |
| 3422 | }; | |
| 3423 | }; | |
| 3424 | ||
| 3425 | pub const __builtin_amdgcn_frexp_mantf = struct { | |
| 3426 | const param_str = "ff"; | |
| 3427 | const target_set = TargetSet.init(.{ | |
| 3428 | .amdgpu = true, | |
| 3429 | }); | |
| 3430 | const attributes = Attributes{ | |
| 3431 | .@"const" = true, | |
| 3432 | }; | |
| 3433 | }; | |
| 3434 | ||
| 3435 | pub const __builtin_amdgcn_grid_size_x = struct { | |
| 3436 | const param_str = "Ui"; | |
| 3437 | const target_set = TargetSet.init(.{ | |
| 3438 | .amdgpu = true, | |
| 3439 | }); | |
| 3440 | const attributes = Attributes{ | |
| 3441 | .@"const" = true, | |
| 3442 | }; | |
| 3443 | }; | |
| 3444 | ||
| 3445 | pub const __builtin_amdgcn_grid_size_y = struct { | |
| 3446 | const param_str = "Ui"; | |
| 3447 | const target_set = TargetSet.init(.{ | |
| 3448 | .amdgpu = true, | |
| 3449 | }); | |
| 3450 | const attributes = Attributes{ | |
| 3451 | .@"const" = true, | |
| 3452 | }; | |
| 3453 | }; | |
| 3454 | ||
| 3455 | pub const __builtin_amdgcn_grid_size_z = struct { | |
| 3456 | const param_str = "Ui"; | |
| 3457 | const target_set = TargetSet.init(.{ | |
| 3458 | .amdgpu = true, | |
| 3459 | }); | |
| 3460 | const attributes = Attributes{ | |
| 3461 | .@"const" = true, | |
| 3462 | }; | |
| 3463 | }; | |
| 3464 | ||
| 3465 | pub const __builtin_amdgcn_groupstaticsize = struct { | |
| 3466 | const param_str = "Ui"; | |
| 3467 | const target_set = TargetSet.init(.{ | |
| 3468 | .amdgpu = true, | |
| 3469 | }); | |
| 3470 | const attributes = Attributes{}; | |
| 3471 | }; | |
| 3472 | ||
| 3473 | pub const __builtin_amdgcn_iglp_opt = struct { | |
| 3474 | const param_str = "vIi"; | |
| 3475 | const target_set = TargetSet.init(.{ | |
| 3476 | .amdgpu = true, | |
| 3477 | }); | |
| 3478 | const attributes = Attributes{}; | |
| 3479 | }; | |
| 3480 | ||
| 3481 | pub const __builtin_amdgcn_implicitarg_ptr = struct { | |
| 3482 | const param_str = "v*4"; | |
| 3483 | const target_set = TargetSet.init(.{ | |
| 3484 | .amdgpu = true, | |
| 3485 | }); | |
| 3486 | const attributes = Attributes{ | |
| 3487 | .@"const" = true, | |
| 3488 | }; | |
| 3489 | }; | |
| 3490 | ||
| 3491 | pub const __builtin_amdgcn_interp_mov = struct { | |
| 3492 | const param_str = "fUiUiUiUi"; | |
| 3493 | const target_set = TargetSet.init(.{ | |
| 3494 | .amdgpu = true, | |
| 3495 | }); | |
| 3496 | const attributes = Attributes{ | |
| 3497 | .@"const" = true, | |
| 3498 | }; | |
| 3499 | }; | |
| 3500 | ||
| 3501 | pub const __builtin_amdgcn_interp_p1 = struct { | |
| 3502 | const param_str = "ffUiUiUi"; | |
| 3503 | const target_set = TargetSet.init(.{ | |
| 3504 | .amdgpu = true, | |
| 3505 | }); | |
| 3506 | const attributes = Attributes{ | |
| 3507 | .@"const" = true, | |
| 3508 | }; | |
| 3509 | }; | |
| 3510 | ||
| 3511 | pub const __builtin_amdgcn_interp_p1_f16 = struct { | |
| 3512 | const param_str = "ffUiUibUi"; | |
| 3513 | const target_set = TargetSet.init(.{ | |
| 3514 | .amdgpu = true, | |
| 3515 | }); | |
| 3516 | const attributes = Attributes{ | |
| 3517 | .@"const" = true, | |
| 3518 | }; | |
| 3519 | }; | |
| 3520 | ||
| 3521 | pub const __builtin_amdgcn_interp_p2 = struct { | |
| 3522 | const param_str = "fffUiUiUi"; | |
| 3523 | const target_set = TargetSet.init(.{ | |
| 3524 | .amdgpu = true, | |
| 3525 | }); | |
| 3526 | const attributes = Attributes{ | |
| 3527 | .@"const" = true, | |
| 3528 | }; | |
| 3529 | }; | |
| 3530 | ||
| 3531 | pub const __builtin_amdgcn_interp_p2_f16 = struct { | |
| 3532 | const param_str = "hffUiUibUi"; | |
| 3533 | const target_set = TargetSet.init(.{ | |
| 3534 | .amdgpu = true, | |
| 3535 | }); | |
| 3536 | const attributes = Attributes{ | |
| 3537 | .@"const" = true, | |
| 3538 | }; | |
| 3539 | }; | |
| 3540 | ||
| 3541 | pub const __builtin_amdgcn_is_private = struct { | |
| 3542 | const param_str = "bvC*0"; | |
| 3543 | const target_set = TargetSet.init(.{ | |
| 3544 | .amdgpu = true, | |
| 3545 | }); | |
| 3546 | const attributes = Attributes{ | |
| 3547 | .@"const" = true, | |
| 3548 | }; | |
| 3549 | }; | |
| 3550 | ||
| 3551 | pub const __builtin_amdgcn_is_shared = struct { | |
| 3552 | const param_str = "bvC*0"; | |
| 3553 | const target_set = TargetSet.init(.{ | |
| 3554 | .amdgpu = true, | |
| 3555 | }); | |
| 3556 | const attributes = Attributes{ | |
| 3557 | .@"const" = true, | |
| 3558 | }; | |
| 3559 | }; | |
| 3560 | ||
| 3561 | pub const __builtin_amdgcn_kernarg_segment_ptr = struct { | |
| 3562 | const param_str = "v*4"; | |
| 3563 | const target_set = TargetSet.init(.{ | |
| 3564 | .amdgpu = true, | |
| 3565 | }); | |
| 3566 | const attributes = Attributes{ | |
| 3567 | .@"const" = true, | |
| 3568 | }; | |
| 3569 | }; | |
| 3570 | ||
| 3571 | pub const __builtin_amdgcn_ldexp = struct { | |
| 3572 | const param_str = "ddi"; | |
| 3573 | const target_set = TargetSet.init(.{ | |
| 3574 | .amdgpu = true, | |
| 3575 | }); | |
| 3576 | const attributes = Attributes{ | |
| 3577 | .@"const" = true, | |
| 3578 | }; | |
| 3579 | }; | |
| 3580 | ||
| 3581 | pub const __builtin_amdgcn_ldexpf = struct { | |
| 3582 | const param_str = "ffi"; | |
| 3583 | const target_set = TargetSet.init(.{ | |
| 3584 | .amdgpu = true, | |
| 3585 | }); | |
| 3586 | const attributes = Attributes{ | |
| 3587 | .@"const" = true, | |
| 3588 | }; | |
| 3589 | }; | |
| 3590 | ||
| 3591 | pub const __builtin_amdgcn_lerp = struct { | |
| 3592 | const param_str = "UiUiUiUi"; | |
| 3593 | const target_set = TargetSet.init(.{ | |
| 3594 | .amdgpu = true, | |
| 3595 | }); | |
| 3596 | const attributes = Attributes{ | |
| 3597 | .@"const" = true, | |
| 3598 | }; | |
| 3599 | }; | |
| 3600 | ||
| 3601 | pub const __builtin_amdgcn_log_clampf = struct { | |
| 3602 | const param_str = "ff"; | |
| 3603 | const target_set = TargetSet.init(.{ | |
| 3604 | .amdgpu = true, | |
| 3605 | }); | |
| 3606 | const attributes = Attributes{ | |
| 3607 | .@"const" = true, | |
| 3608 | }; | |
| 3609 | }; | |
| 3610 | ||
| 3611 | pub const __builtin_amdgcn_mbcnt_hi = struct { | |
| 3612 | const param_str = "UiUiUi"; | |
| 3613 | const target_set = TargetSet.init(.{ | |
| 3614 | .amdgpu = true, | |
| 3615 | }); | |
| 3616 | const attributes = Attributes{ | |
| 3617 | .@"const" = true, | |
| 3618 | }; | |
| 3619 | }; | |
| 3620 | ||
| 3621 | pub const __builtin_amdgcn_mbcnt_lo = struct { | |
| 3622 | const param_str = "UiUiUi"; | |
| 3623 | const target_set = TargetSet.init(.{ | |
| 3624 | .amdgpu = true, | |
| 3625 | }); | |
| 3626 | const attributes = Attributes{ | |
| 3627 | .@"const" = true, | |
| 3628 | }; | |
| 3629 | }; | |
| 3630 | ||
| 3631 | pub const __builtin_amdgcn_mqsad_pk_u16_u8 = struct { | |
| 3632 | const param_str = "WUiWUiUiWUi"; | |
| 3633 | const target_set = TargetSet.init(.{ | |
| 3634 | .amdgpu = true, | |
| 3635 | }); | |
| 3636 | const attributes = Attributes{ | |
| 3637 | .@"const" = true, | |
| 3638 | }; | |
| 3639 | }; | |
| 3640 | ||
| 3641 | pub const __builtin_amdgcn_mqsad_u32_u8 = struct { | |
| 3642 | const param_str = "V4UiWUiUiV4Ui"; | |
| 3643 | const target_set = TargetSet.init(.{ | |
| 3644 | .amdgpu = true, | |
| 3645 | }); | |
| 3646 | const attributes = Attributes{ | |
| 3647 | .@"const" = true, | |
| 3648 | }; | |
| 3649 | }; | |
| 3650 | ||
| 3651 | pub const __builtin_amdgcn_msad_u8 = struct { | |
| 3652 | const param_str = "UiUiUiUi"; | |
| 3653 | const target_set = TargetSet.init(.{ | |
| 3654 | .amdgpu = true, | |
| 3655 | }); | |
| 3656 | const attributes = Attributes{ | |
| 3657 | .@"const" = true, | |
| 3658 | }; | |
| 3659 | }; | |
| 3660 | ||
| 3661 | pub const __builtin_amdgcn_qsad_pk_u16_u8 = struct { | |
| 3662 | const param_str = "WUiWUiUiWUi"; | |
| 3663 | const target_set = TargetSet.init(.{ | |
| 3664 | .amdgpu = true, | |
| 3665 | }); | |
| 3666 | const attributes = Attributes{ | |
| 3667 | .@"const" = true, | |
| 3668 | }; | |
| 3669 | }; | |
| 3670 | ||
| 3671 | pub const __builtin_amdgcn_queue_ptr = struct { | |
| 3672 | const param_str = "v*4"; | |
| 3673 | const target_set = TargetSet.init(.{ | |
| 3674 | .amdgpu = true, | |
| 3675 | }); | |
| 3676 | const attributes = Attributes{ | |
| 3677 | .@"const" = true, | |
| 3678 | }; | |
| 3679 | }; | |
| 3680 | ||
| 3681 | pub const __builtin_amdgcn_rcp = struct { | |
| 3682 | const param_str = "dd"; | |
| 3683 | const target_set = TargetSet.init(.{ | |
| 3684 | .amdgpu = true, | |
| 3685 | }); | |
| 3686 | const attributes = Attributes{ | |
| 3687 | .@"const" = true, | |
| 3688 | }; | |
| 3689 | }; | |
| 3690 | ||
| 3691 | pub const __builtin_amdgcn_rcpf = struct { | |
| 3692 | const param_str = "ff"; | |
| 3693 | const target_set = TargetSet.init(.{ | |
| 3694 | .amdgpu = true, | |
| 3695 | }); | |
| 3696 | const attributes = Attributes{ | |
| 3697 | .@"const" = true, | |
| 3698 | }; | |
| 3699 | }; | |
| 3700 | ||
| 3701 | pub const __builtin_amdgcn_read_exec = struct { | |
| 3702 | const param_str = "WUi"; | |
| 3703 | const target_set = TargetSet.init(.{ | |
| 3704 | .amdgpu = true, | |
| 3705 | }); | |
| 3706 | const attributes = Attributes{ | |
| 3707 | .@"const" = true, | |
| 3708 | }; | |
| 3709 | }; | |
| 3710 | ||
| 3711 | pub const __builtin_amdgcn_read_exec_hi = struct { | |
| 3712 | const param_str = "Ui"; | |
| 3713 | const target_set = TargetSet.init(.{ | |
| 3714 | .amdgpu = true, | |
| 3715 | }); | |
| 3716 | const attributes = Attributes{ | |
| 3717 | .@"const" = true, | |
| 3718 | }; | |
| 3719 | }; | |
| 3720 | ||
| 3721 | pub const __builtin_amdgcn_read_exec_lo = struct { | |
| 3722 | const param_str = "Ui"; | |
| 3723 | const target_set = TargetSet.init(.{ | |
| 3724 | .amdgpu = true, | |
| 3725 | }); | |
| 3726 | const attributes = Attributes{ | |
| 3727 | .@"const" = true, | |
| 3728 | }; | |
| 3729 | }; | |
| 3730 | ||
| 3731 | pub const __builtin_amdgcn_readfirstlane = struct { | |
| 3732 | const param_str = "ii"; | |
| 3733 | const target_set = TargetSet.init(.{ | |
| 3734 | .amdgpu = true, | |
| 3735 | }); | |
| 3736 | const attributes = Attributes{ | |
| 3737 | .@"const" = true, | |
| 3738 | }; | |
| 3739 | }; | |
| 3740 | ||
| 3741 | pub const __builtin_amdgcn_readlane = struct { | |
| 3742 | const param_str = "iii"; | |
| 3743 | const target_set = TargetSet.init(.{ | |
| 3744 | .amdgpu = true, | |
| 3745 | }); | |
| 3746 | const attributes = Attributes{ | |
| 3747 | .@"const" = true, | |
| 3748 | }; | |
| 3749 | }; | |
| 3750 | ||
| 3751 | pub const __builtin_amdgcn_rsq = struct { | |
| 3752 | const param_str = "dd"; | |
| 3753 | const target_set = TargetSet.init(.{ | |
| 3754 | .amdgpu = true, | |
| 3755 | }); | |
| 3756 | const attributes = Attributes{ | |
| 3757 | .@"const" = true, | |
| 3758 | }; | |
| 3759 | }; | |
| 3760 | ||
| 3761 | pub const __builtin_amdgcn_rsq_clamp = struct { | |
| 3762 | const param_str = "dd"; | |
| 3763 | const target_set = TargetSet.init(.{ | |
| 3764 | .amdgpu = true, | |
| 3765 | }); | |
| 3766 | const attributes = Attributes{ | |
| 3767 | .@"const" = true, | |
| 3768 | }; | |
| 3769 | }; | |
| 3770 | ||
| 3771 | pub const __builtin_amdgcn_rsq_clampf = struct { | |
| 3772 | const param_str = "ff"; | |
| 3773 | const target_set = TargetSet.init(.{ | |
| 3774 | .amdgpu = true, | |
| 3775 | }); | |
| 3776 | const attributes = Attributes{ | |
| 3777 | .@"const" = true, | |
| 3778 | }; | |
| 3779 | }; | |
| 3780 | ||
| 3781 | pub const __builtin_amdgcn_rsqf = struct { | |
| 3782 | const param_str = "ff"; | |
| 3783 | const target_set = TargetSet.init(.{ | |
| 3784 | .amdgpu = true, | |
| 3785 | }); | |
| 3786 | const attributes = Attributes{ | |
| 3787 | .@"const" = true, | |
| 3788 | }; | |
| 3789 | }; | |
| 3790 | ||
| 3791 | pub const __builtin_amdgcn_s_barrier = struct { | |
| 3792 | const param_str = "v"; | |
| 3793 | const target_set = TargetSet.init(.{ | |
| 3794 | .amdgpu = true, | |
| 3795 | }); | |
| 3796 | const attributes = Attributes{}; | |
| 3797 | }; | |
| 3798 | ||
| 3799 | pub const __builtin_amdgcn_s_dcache_inv = struct { | |
| 3800 | const param_str = "v"; | |
| 3801 | const target_set = TargetSet.init(.{ | |
| 3802 | .amdgpu = true, | |
| 3803 | }); | |
| 3804 | const attributes = Attributes{}; | |
| 3805 | }; | |
| 3806 | ||
| 3807 | pub const __builtin_amdgcn_s_decperflevel = struct { | |
| 3808 | const param_str = "vIi"; | |
| 3809 | const target_set = TargetSet.init(.{ | |
| 3810 | .amdgpu = true, | |
| 3811 | }); | |
| 3812 | const attributes = Attributes{}; | |
| 3813 | }; | |
| 3814 | ||
| 3815 | pub const __builtin_amdgcn_s_getpc = struct { | |
| 3816 | const param_str = "WUi"; | |
| 3817 | const target_set = TargetSet.init(.{ | |
| 3818 | .amdgpu = true, | |
| 3819 | }); | |
| 3820 | const attributes = Attributes{}; | |
| 3821 | }; | |
| 3822 | ||
| 3823 | pub const __builtin_amdgcn_s_getreg = struct { | |
| 3824 | const param_str = "UiIi"; | |
| 3825 | const target_set = TargetSet.init(.{ | |
| 3826 | .amdgpu = true, | |
| 3827 | }); | |
| 3828 | const attributes = Attributes{}; | |
| 3829 | }; | |
| 3830 | ||
| 3831 | pub const __builtin_amdgcn_s_incperflevel = struct { | |
| 3832 | const param_str = "vIi"; | |
| 3833 | const target_set = TargetSet.init(.{ | |
| 3834 | .amdgpu = true, | |
| 3835 | }); | |
| 3836 | const attributes = Attributes{}; | |
| 3837 | }; | |
| 3838 | ||
| 3839 | pub const __builtin_amdgcn_s_sendmsg = struct { | |
| 3840 | const param_str = "vIiUi"; | |
| 3841 | const target_set = TargetSet.init(.{ | |
| 3842 | .amdgpu = true, | |
| 3843 | }); | |
| 3844 | const attributes = Attributes{}; | |
| 3845 | }; | |
| 3846 | ||
| 3847 | pub const __builtin_amdgcn_s_sendmsghalt = struct { | |
| 3848 | const param_str = "vIiUi"; | |
| 3849 | const target_set = TargetSet.init(.{ | |
| 3850 | .amdgpu = true, | |
| 3851 | }); | |
| 3852 | const attributes = Attributes{}; | |
| 3853 | }; | |
| 3854 | ||
| 3855 | pub const __builtin_amdgcn_s_setprio = struct { | |
| 3856 | const param_str = "vIs"; | |
| 3857 | const target_set = TargetSet.init(.{ | |
| 3858 | .amdgpu = true, | |
| 3859 | }); | |
| 3860 | const attributes = Attributes{}; | |
| 3861 | }; | |
| 3862 | ||
| 3863 | pub const __builtin_amdgcn_s_setreg = struct { | |
| 3864 | const param_str = "vIiUi"; | |
| 3865 | const target_set = TargetSet.init(.{ | |
| 3866 | .amdgpu = true, | |
| 3867 | }); | |
| 3868 | const attributes = Attributes{}; | |
| 3869 | }; | |
| 3870 | ||
| 3871 | pub const __builtin_amdgcn_s_sleep = struct { | |
| 3872 | const param_str = "vIi"; | |
| 3873 | const target_set = TargetSet.init(.{ | |
| 3874 | .amdgpu = true, | |
| 3875 | }); | |
| 3876 | const attributes = Attributes{}; | |
| 3877 | }; | |
| 3878 | ||
| 3879 | pub const __builtin_amdgcn_s_waitcnt = struct { | |
| 3880 | const param_str = "vIi"; | |
| 3881 | const target_set = TargetSet.init(.{ | |
| 3882 | .amdgpu = true, | |
| 3883 | }); | |
| 3884 | const attributes = Attributes{}; | |
| 3885 | }; | |
| 3886 | ||
| 3887 | pub const __builtin_amdgcn_sad_hi_u8 = struct { | |
| 3888 | const param_str = "UiUiUiUi"; | |
| 3889 | const target_set = TargetSet.init(.{ | |
| 3890 | .amdgpu = true, | |
| 3891 | }); | |
| 3892 | const attributes = Attributes{ | |
| 3893 | .@"const" = true, | |
| 3894 | }; | |
| 3895 | }; | |
| 3896 | ||
| 3897 | pub const __builtin_amdgcn_sad_u16 = struct { | |
| 3898 | const param_str = "UiUiUiUi"; | |
| 3899 | const target_set = TargetSet.init(.{ | |
| 3900 | .amdgpu = true, | |
| 3901 | }); | |
| 3902 | const attributes = Attributes{ | |
| 3903 | .@"const" = true, | |
| 3904 | }; | |
| 3905 | }; | |
| 3906 | ||
| 3907 | pub const __builtin_amdgcn_sad_u8 = struct { | |
| 3908 | const param_str = "UiUiUiUi"; | |
| 3909 | const target_set = TargetSet.init(.{ | |
| 3910 | .amdgpu = true, | |
| 3911 | }); | |
| 3912 | const attributes = Attributes{ | |
| 3913 | .@"const" = true, | |
| 3914 | }; | |
| 3915 | }; | |
| 3916 | ||
| 3917 | pub const __builtin_amdgcn_sbfe = struct { | |
| 3918 | const param_str = "UiUiUiUi"; | |
| 3919 | const target_set = TargetSet.init(.{ | |
| 3920 | .amdgpu = true, | |
| 3921 | }); | |
| 3922 | const attributes = Attributes{ | |
| 3923 | .@"const" = true, | |
| 3924 | }; | |
| 3925 | }; | |
| 3926 | ||
| 3927 | pub const __builtin_amdgcn_sched_barrier = struct { | |
| 3928 | const param_str = "vIi"; | |
| 3929 | const target_set = TargetSet.init(.{ | |
| 3930 | .amdgpu = true, | |
| 3931 | }); | |
| 3932 | const attributes = Attributes{}; | |
| 3933 | }; | |
| 3934 | ||
| 3935 | pub const __builtin_amdgcn_sched_group_barrier = struct { | |
| 3936 | const param_str = "vIiIiIi"; | |
| 3937 | const target_set = TargetSet.init(.{ | |
| 3938 | .amdgpu = true, | |
| 3939 | }); | |
| 3940 | const attributes = Attributes{}; | |
| 3941 | }; | |
| 3942 | ||
| 3943 | pub const __builtin_amdgcn_sicmp = struct { | |
| 3944 | const param_str = "WUiiiIi"; | |
| 3945 | const target_set = TargetSet.init(.{ | |
| 3946 | .amdgpu = true, | |
| 3947 | }); | |
| 3948 | const attributes = Attributes{ | |
| 3949 | .@"const" = true, | |
| 3950 | }; | |
| 3951 | }; | |
| 3952 | ||
| 3953 | pub const __builtin_amdgcn_sicmpl = struct { | |
| 3954 | const param_str = "WUiWiWiIi"; | |
| 3955 | const target_set = TargetSet.init(.{ | |
| 3956 | .amdgpu = true, | |
| 3957 | }); | |
| 3958 | const attributes = Attributes{ | |
| 3959 | .@"const" = true, | |
| 3960 | }; | |
| 3961 | }; | |
| 3962 | ||
| 3963 | pub const __builtin_amdgcn_sinf = struct { | |
| 3964 | const param_str = "ff"; | |
| 3965 | const target_set = TargetSet.init(.{ | |
| 3966 | .amdgpu = true, | |
| 3967 | }); | |
| 3968 | const attributes = Attributes{ | |
| 3969 | .@"const" = true, | |
| 3970 | }; | |
| 3971 | }; | |
| 3972 | ||
| 3973 | pub const __builtin_amdgcn_sqrt = struct { | |
| 3974 | const param_str = "dd"; | |
| 3975 | const target_set = TargetSet.init(.{ | |
| 3976 | .amdgpu = true, | |
| 3977 | }); | |
| 3978 | const attributes = Attributes{ | |
| 3979 | .@"const" = true, | |
| 3980 | }; | |
| 3981 | }; | |
| 3982 | ||
| 3983 | pub const __builtin_amdgcn_sqrtf = struct { | |
| 3984 | const param_str = "ff"; | |
| 3985 | const target_set = TargetSet.init(.{ | |
| 3986 | .amdgpu = true, | |
| 3987 | }); | |
| 3988 | const attributes = Attributes{ | |
| 3989 | .@"const" = true, | |
| 3990 | }; | |
| 3991 | }; | |
| 3992 | ||
| 3993 | pub const __builtin_amdgcn_trig_preop = struct { | |
| 3994 | const param_str = "ddi"; | |
| 3995 | const target_set = TargetSet.init(.{ | |
| 3996 | .amdgpu = true, | |
| 3997 | }); | |
| 3998 | const attributes = Attributes{ | |
| 3999 | .@"const" = true, | |
| 4000 | }; | |
| 4001 | }; | |
| 4002 | ||
| 4003 | pub const __builtin_amdgcn_trig_preopf = struct { | |
| 4004 | const param_str = "ffi"; | |
| 4005 | const target_set = TargetSet.init(.{ | |
| 4006 | .amdgpu = true, | |
| 4007 | }); | |
| 4008 | const attributes = Attributes{ | |
| 4009 | .@"const" = true, | |
| 4010 | }; | |
| 4011 | }; | |
| 4012 | ||
| 4013 | pub const __builtin_amdgcn_ubfe = struct { | |
| 4014 | const param_str = "UiUiUiUi"; | |
| 4015 | const target_set = TargetSet.init(.{ | |
| 4016 | .amdgpu = true, | |
| 4017 | }); | |
| 4018 | const attributes = Attributes{ | |
| 4019 | .@"const" = true, | |
| 4020 | }; | |
| 4021 | }; | |
| 4022 | ||
| 4023 | pub const __builtin_amdgcn_uicmp = struct { | |
| 4024 | const param_str = "WUiUiUiIi"; | |
| 4025 | const target_set = TargetSet.init(.{ | |
| 4026 | .amdgpu = true, | |
| 4027 | }); | |
| 4028 | const attributes = Attributes{ | |
| 4029 | .@"const" = true, | |
| 4030 | }; | |
| 4031 | }; | |
| 4032 | ||
| 4033 | pub const __builtin_amdgcn_uicmpl = struct { | |
| 4034 | const param_str = "WUiWUiWUiIi"; | |
| 4035 | const target_set = TargetSet.init(.{ | |
| 4036 | .amdgpu = true, | |
| 4037 | }); | |
| 4038 | const attributes = Attributes{ | |
| 4039 | .@"const" = true, | |
| 4040 | }; | |
| 4041 | }; | |
| 4042 | ||
| 4043 | pub const __builtin_amdgcn_wave_barrier = struct { | |
| 4044 | const param_str = "v"; | |
| 4045 | const target_set = TargetSet.init(.{ | |
| 4046 | .amdgpu = true, | |
| 4047 | }); | |
| 4048 | const attributes = Attributes{}; | |
| 4049 | }; | |
| 4050 | ||
| 4051 | pub const __builtin_amdgcn_workgroup_id_x = struct { | |
| 4052 | const param_str = "Ui"; | |
| 4053 | const target_set = TargetSet.init(.{ | |
| 4054 | .amdgpu = true, | |
| 4055 | }); | |
| 4056 | const attributes = Attributes{ | |
| 4057 | .@"const" = true, | |
| 4058 | }; | |
| 4059 | }; | |
| 4060 | ||
| 4061 | pub const __builtin_amdgcn_workgroup_id_y = struct { | |
| 4062 | const param_str = "Ui"; | |
| 4063 | const target_set = TargetSet.init(.{ | |
| 4064 | .amdgpu = true, | |
| 4065 | }); | |
| 4066 | const attributes = Attributes{ | |
| 4067 | .@"const" = true, | |
| 4068 | }; | |
| 4069 | }; | |
| 4070 | ||
| 4071 | pub const __builtin_amdgcn_workgroup_id_z = struct { | |
| 4072 | const param_str = "Ui"; | |
| 4073 | const target_set = TargetSet.init(.{ | |
| 4074 | .amdgpu = true, | |
| 4075 | }); | |
| 4076 | const attributes = Attributes{ | |
| 4077 | .@"const" = true, | |
| 4078 | }; | |
| 4079 | }; | |
| 4080 | ||
| 4081 | pub const __builtin_amdgcn_workgroup_size_x = struct { | |
| 4082 | const param_str = "Us"; | |
| 4083 | const target_set = TargetSet.init(.{ | |
| 4084 | .amdgpu = true, | |
| 4085 | }); | |
| 4086 | const attributes = Attributes{ | |
| 4087 | .@"const" = true, | |
| 4088 | }; | |
| 4089 | }; | |
| 4090 | ||
| 4091 | pub const __builtin_amdgcn_workgroup_size_y = struct { | |
| 4092 | const param_str = "Us"; | |
| 4093 | const target_set = TargetSet.init(.{ | |
| 4094 | .amdgpu = true, | |
| 4095 | }); | |
| 4096 | const attributes = Attributes{ | |
| 4097 | .@"const" = true, | |
| 4098 | }; | |
| 4099 | }; | |
| 4100 | ||
| 4101 | pub const __builtin_amdgcn_workgroup_size_z = struct { | |
| 4102 | const param_str = "Us"; | |
| 4103 | const target_set = TargetSet.init(.{ | |
| 4104 | .amdgpu = true, | |
| 4105 | }); | |
| 4106 | const attributes = Attributes{ | |
| 4107 | .@"const" = true, | |
| 4108 | }; | |
| 4109 | }; | |
| 4110 | ||
| 4111 | pub const __builtin_amdgcn_workitem_id_x = struct { | |
| 4112 | const param_str = "Ui"; | |
| 4113 | const target_set = TargetSet.init(.{ | |
| 4114 | .amdgpu = true, | |
| 4115 | }); | |
| 4116 | const attributes = Attributes{ | |
| 4117 | .@"const" = true, | |
| 4118 | }; | |
| 4119 | }; | |
| 4120 | ||
| 4121 | pub const __builtin_amdgcn_workitem_id_y = struct { | |
| 4122 | const param_str = "Ui"; | |
| 4123 | const target_set = TargetSet.init(.{ | |
| 4124 | .amdgpu = true, | |
| 4125 | }); | |
| 4126 | const attributes = Attributes{ | |
| 4127 | .@"const" = true, | |
| 4128 | }; | |
| 4129 | }; | |
| 4130 | ||
| 4131 | pub const __builtin_amdgcn_workitem_id_z = struct { | |
| 4132 | const param_str = "Ui"; | |
| 4133 | const target_set = TargetSet.init(.{ | |
| 4134 | .amdgpu = true, | |
| 4135 | }); | |
| 4136 | const attributes = Attributes{ | |
| 4137 | .@"const" = true, | |
| 4138 | }; | |
| 4139 | }; | |
| 4140 | ||
| 4141 | pub const __builtin_annotation = struct { | |
| 4142 | const param_str = "v."; | |
| 4143 | const attributes = Attributes{ | |
| 4144 | .custom_typecheck = true, | |
| 4145 | }; | |
| 4146 | }; | |
| 4147 | ||
| 4148 | pub const __builtin_arm_cdp = struct { | |
| 4149 | const param_str = "vUIiUIiUIiUIiUIiUIi"; | |
| 4150 | const target_set = TargetSet.init(.{ | |
| 4151 | .arm = true, | |
| 4152 | }); | |
| 4153 | }; | |
| 4154 | ||
| 4155 | pub const __builtin_arm_cdp2 = struct { | |
| 4156 | const param_str = "vUIiUIiUIiUIiUIiUIi"; | |
| 4157 | const target_set = TargetSet.init(.{ | |
| 4158 | .arm = true, | |
| 4159 | }); | |
| 4160 | }; | |
| 4161 | ||
| 4162 | pub const __builtin_arm_clrex = struct { | |
| 4163 | const param_str = "v"; | |
| 4164 | const target_set = TargetSet.init(.{ | |
| 4165 | .aarch64 = true, | |
| 4166 | .arm = true, | |
| 4167 | }); | |
| 4168 | }; | |
| 4169 | ||
| 4170 | pub const __builtin_arm_cls = struct { | |
| 4171 | const param_str = "UiZUi"; | |
| 4172 | const target_set = TargetSet.init(.{ | |
| 4173 | .aarch64 = true, | |
| 4174 | .arm = true, | |
| 4175 | }); | |
| 4176 | const attributes = Attributes{ | |
| 4177 | .@"const" = true, | |
| 4178 | }; | |
| 4179 | }; | |
| 4180 | ||
| 4181 | pub const __builtin_arm_cls64 = struct { | |
| 4182 | const param_str = "UiWUi"; | |
| 4183 | const target_set = TargetSet.init(.{ | |
| 4184 | .aarch64 = true, | |
| 4185 | .arm = true, | |
| 4186 | }); | |
| 4187 | const attributes = Attributes{ | |
| 4188 | .@"const" = true, | |
| 4189 | }; | |
| 4190 | }; | |
| 4191 | ||
| 4192 | pub const __builtin_arm_cmse_TT = struct { | |
| 4193 | const param_str = "Uiv*"; | |
| 4194 | const target_set = TargetSet.init(.{ | |
| 4195 | .arm = true, | |
| 4196 | }); | |
| 4197 | const attributes = Attributes{}; | |
| 4198 | }; | |
| 4199 | ||
| 4200 | pub const __builtin_arm_cmse_TTA = struct { | |
| 4201 | const param_str = "Uiv*"; | |
| 4202 | const target_set = TargetSet.init(.{ | |
| 4203 | .arm = true, | |
| 4204 | }); | |
| 4205 | const attributes = Attributes{}; | |
| 4206 | }; | |
| 4207 | ||
| 4208 | pub const __builtin_arm_cmse_TTAT = struct { | |
| 4209 | const param_str = "Uiv*"; | |
| 4210 | const target_set = TargetSet.init(.{ | |
| 4211 | .arm = true, | |
| 4212 | }); | |
| 4213 | const attributes = Attributes{}; | |
| 4214 | }; | |
| 4215 | ||
| 4216 | pub const __builtin_arm_cmse_TTT = struct { | |
| 4217 | const param_str = "Uiv*"; | |
| 4218 | const target_set = TargetSet.init(.{ | |
| 4219 | .arm = true, | |
| 4220 | }); | |
| 4221 | const attributes = Attributes{}; | |
| 4222 | }; | |
| 4223 | ||
| 4224 | pub const __builtin_arm_dbg = struct { | |
| 4225 | const param_str = "vUi"; | |
| 4226 | const target_set = TargetSet.init(.{ | |
| 4227 | .arm = true, | |
| 4228 | }); | |
| 4229 | }; | |
| 4230 | ||
| 4231 | pub const __builtin_arm_dmb = struct { | |
| 4232 | const param_str = "vUi"; | |
| 4233 | const target_set = TargetSet.init(.{ | |
| 4234 | .aarch64 = true, | |
| 4235 | .arm = true, | |
| 4236 | }); | |
| 4237 | const attributes = Attributes{ | |
| 4238 | .@"const" = true, | |
| 4239 | }; | |
| 4240 | }; | |
| 4241 | ||
| 4242 | pub const __builtin_arm_dsb = struct { | |
| 4243 | const param_str = "vUi"; | |
| 4244 | const target_set = TargetSet.init(.{ | |
| 4245 | .aarch64 = true, | |
| 4246 | .arm = true, | |
| 4247 | }); | |
| 4248 | const attributes = Attributes{ | |
| 4249 | .@"const" = true, | |
| 4250 | }; | |
| 4251 | }; | |
| 4252 | ||
| 4253 | pub const __builtin_arm_get_fpscr = struct { | |
| 4254 | const param_str = "Ui"; | |
| 4255 | const target_set = TargetSet.init(.{ | |
| 4256 | .arm = true, | |
| 4257 | }); | |
| 4258 | const attributes = Attributes{ | |
| 4259 | .@"const" = true, | |
| 4260 | }; | |
| 4261 | }; | |
| 4262 | ||
| 4263 | pub const __builtin_arm_isb = struct { | |
| 4264 | const param_str = "vUi"; | |
| 4265 | const target_set = TargetSet.init(.{ | |
| 4266 | .aarch64 = true, | |
| 4267 | .arm = true, | |
| 4268 | }); | |
| 4269 | const attributes = Attributes{ | |
| 4270 | .@"const" = true, | |
| 4271 | }; | |
| 4272 | }; | |
| 4273 | ||
| 4274 | pub const __builtin_arm_ldaex = struct { | |
| 4275 | const param_str = "v."; | |
| 4276 | const target_set = TargetSet.init(.{ | |
| 4277 | .aarch64 = true, | |
| 4278 | .arm = true, | |
| 4279 | }); | |
| 4280 | const attributes = Attributes{ | |
| 4281 | .custom_typecheck = true, | |
| 4282 | }; | |
| 4283 | }; | |
| 4284 | ||
| 4285 | pub const __builtin_arm_ldc = struct { | |
| 4286 | const param_str = "vUIiUIivC*"; | |
| 4287 | const target_set = TargetSet.init(.{ | |
| 4288 | .arm = true, | |
| 4289 | }); | |
| 4290 | }; | |
| 4291 | ||
| 4292 | pub const __builtin_arm_ldc2 = struct { | |
| 4293 | const param_str = "vUIiUIivC*"; | |
| 4294 | const target_set = TargetSet.init(.{ | |
| 4295 | .arm = true, | |
| 4296 | }); | |
| 4297 | }; | |
| 4298 | ||
| 4299 | pub const __builtin_arm_ldc2l = struct { | |
| 4300 | const param_str = "vUIiUIivC*"; | |
| 4301 | const target_set = TargetSet.init(.{ | |
| 4302 | .arm = true, | |
| 4303 | }); | |
| 4304 | }; | |
| 4305 | ||
| 4306 | pub const __builtin_arm_ldcl = struct { | |
| 4307 | const param_str = "vUIiUIivC*"; | |
| 4308 | const target_set = TargetSet.init(.{ | |
| 4309 | .arm = true, | |
| 4310 | }); | |
| 4311 | }; | |
| 4312 | ||
| 4313 | pub const __builtin_arm_ldrex = struct { | |
| 4314 | const param_str = "v."; | |
| 4315 | const target_set = TargetSet.init(.{ | |
| 4316 | .aarch64 = true, | |
| 4317 | .arm = true, | |
| 4318 | }); | |
| 4319 | const attributes = Attributes{ | |
| 4320 | .custom_typecheck = true, | |
| 4321 | }; | |
| 4322 | }; | |
| 4323 | ||
| 4324 | pub const __builtin_arm_ldrexd = struct { | |
| 4325 | const param_str = "LLUiv*"; | |
| 4326 | const target_set = TargetSet.init(.{ | |
| 4327 | .arm = true, | |
| 4328 | }); | |
| 4329 | }; | |
| 4330 | ||
| 4331 | pub const __builtin_arm_mcr = struct { | |
| 4332 | const param_str = "vUIiUIiUiUIiUIiUIi"; | |
| 4333 | const target_set = TargetSet.init(.{ | |
| 4334 | .arm = true, | |
| 4335 | }); | |
| 4336 | }; | |
| 4337 | ||
| 4338 | pub const __builtin_arm_mcr2 = struct { | |
| 4339 | const param_str = "vUIiUIiUiUIiUIiUIi"; | |
| 4340 | const target_set = TargetSet.init(.{ | |
| 4341 | .arm = true, | |
| 4342 | }); | |
| 4343 | }; | |
| 4344 | ||
| 4345 | pub const __builtin_arm_mcrr = struct { | |
| 4346 | const param_str = "vUIiUIiLLUiUIi"; | |
| 4347 | const target_set = TargetSet.init(.{ | |
| 4348 | .arm = true, | |
| 4349 | }); | |
| 4350 | }; | |
| 4351 | ||
| 4352 | pub const __builtin_arm_mcrr2 = struct { | |
| 4353 | const param_str = "vUIiUIiLLUiUIi"; | |
| 4354 | const target_set = TargetSet.init(.{ | |
| 4355 | .arm = true, | |
| 4356 | }); | |
| 4357 | }; | |
| 4358 | ||
| 4359 | pub const __builtin_arm_mrc = struct { | |
| 4360 | const param_str = "UiUIiUIiUIiUIiUIi"; | |
| 4361 | const target_set = TargetSet.init(.{ | |
| 4362 | .arm = true, | |
| 4363 | }); | |
| 4364 | }; | |
| 4365 | ||
| 4366 | pub const __builtin_arm_mrc2 = struct { | |
| 4367 | const param_str = "UiUIiUIiUIiUIiUIi"; | |
| 4368 | const target_set = TargetSet.init(.{ | |
| 4369 | .arm = true, | |
| 4370 | }); | |
| 4371 | }; | |
| 4372 | ||
| 4373 | pub const __builtin_arm_mrrc = struct { | |
| 4374 | const param_str = "LLUiUIiUIiUIi"; | |
| 4375 | const target_set = TargetSet.init(.{ | |
| 4376 | .arm = true, | |
| 4377 | }); | |
| 4378 | }; | |
| 4379 | ||
| 4380 | pub const __builtin_arm_mrrc2 = struct { | |
| 4381 | const param_str = "LLUiUIiUIiUIi"; | |
| 4382 | const target_set = TargetSet.init(.{ | |
| 4383 | .arm = true, | |
| 4384 | }); | |
| 4385 | }; | |
| 4386 | ||
| 4387 | pub const __builtin_arm_nop = struct { | |
| 4388 | const param_str = "v"; | |
| 4389 | const target_set = TargetSet.init(.{ | |
| 4390 | .aarch64 = true, | |
| 4391 | .arm = true, | |
| 4392 | }); | |
| 4393 | }; | |
| 4394 | ||
| 4395 | pub const __builtin_arm_prefetch = struct { | |
| 4396 | const param_str = "!"; | |
| 4397 | const target_set = TargetSet.init(.{ | |
| 4398 | .aarch64 = true, | |
| 4399 | .arm = true, | |
| 4400 | }); | |
| 4401 | const attributes = Attributes{ | |
| 4402 | .@"const" = true, | |
| 4403 | }; | |
| 4404 | }; | |
| 4405 | ||
| 4406 | pub const __builtin_arm_qadd = struct { | |
| 4407 | const param_str = "iii"; | |
| 4408 | const target_set = TargetSet.init(.{ | |
| 4409 | .arm = true, | |
| 4410 | }); | |
| 4411 | const attributes = Attributes{ | |
| 4412 | .@"const" = true, | |
| 4413 | }; | |
| 4414 | }; | |
| 4415 | ||
| 4416 | pub const __builtin_arm_qadd16 = struct { | |
| 4417 | const param_str = "iii"; | |
| 4418 | const target_set = TargetSet.init(.{ | |
| 4419 | .arm = true, | |
| 4420 | }); | |
| 4421 | const attributes = Attributes{ | |
| 4422 | .@"const" = true, | |
| 4423 | }; | |
| 4424 | }; | |
| 4425 | ||
| 4426 | pub const __builtin_arm_qadd8 = struct { | |
| 4427 | const param_str = "iii"; | |
| 4428 | const target_set = TargetSet.init(.{ | |
| 4429 | .arm = true, | |
| 4430 | }); | |
| 4431 | const attributes = Attributes{ | |
| 4432 | .@"const" = true, | |
| 4433 | }; | |
| 4434 | }; | |
| 4435 | ||
| 4436 | pub const __builtin_arm_qasx = struct { | |
| 4437 | const param_str = "iii"; | |
| 4438 | const target_set = TargetSet.init(.{ | |
| 4439 | .arm = true, | |
| 4440 | }); | |
| 4441 | const attributes = Attributes{ | |
| 4442 | .@"const" = true, | |
| 4443 | }; | |
| 4444 | }; | |
| 4445 | ||
| 4446 | pub const __builtin_arm_qdbl = struct { | |
| 4447 | const param_str = "ii"; | |
| 4448 | const target_set = TargetSet.init(.{ | |
| 4449 | .arm = true, | |
| 4450 | }); | |
| 4451 | const attributes = Attributes{ | |
| 4452 | .@"const" = true, | |
| 4453 | }; | |
| 4454 | }; | |
| 4455 | ||
| 4456 | pub const __builtin_arm_qsax = struct { | |
| 4457 | const param_str = "iii"; | |
| 4458 | const target_set = TargetSet.init(.{ | |
| 4459 | .arm = true, | |
| 4460 | }); | |
| 4461 | const attributes = Attributes{ | |
| 4462 | .@"const" = true, | |
| 4463 | }; | |
| 4464 | }; | |
| 4465 | ||
| 4466 | pub const __builtin_arm_qsub = struct { | |
| 4467 | const param_str = "iii"; | |
| 4468 | const target_set = TargetSet.init(.{ | |
| 4469 | .arm = true, | |
| 4470 | }); | |
| 4471 | const attributes = Attributes{ | |
| 4472 | .@"const" = true, | |
| 4473 | }; | |
| 4474 | }; | |
| 4475 | ||
| 4476 | pub const __builtin_arm_qsub16 = struct { | |
| 4477 | const param_str = "iii"; | |
| 4478 | const target_set = TargetSet.init(.{ | |
| 4479 | .arm = true, | |
| 4480 | }); | |
| 4481 | const attributes = Attributes{ | |
| 4482 | .@"const" = true, | |
| 4483 | }; | |
| 4484 | }; | |
| 4485 | ||
| 4486 | pub const __builtin_arm_qsub8 = struct { | |
| 4487 | const param_str = "iii"; | |
| 4488 | const target_set = TargetSet.init(.{ | |
| 4489 | .arm = true, | |
| 4490 | }); | |
| 4491 | const attributes = Attributes{ | |
| 4492 | .@"const" = true, | |
| 4493 | }; | |
| 4494 | }; | |
| 4495 | ||
| 4496 | pub const __builtin_arm_rbit = struct { | |
| 4497 | const param_str = "UiUi"; | |
| 4498 | const target_set = TargetSet.init(.{ | |
| 4499 | .aarch64 = true, | |
| 4500 | .arm = true, | |
| 4501 | }); | |
| 4502 | const attributes = Attributes{ | |
| 4503 | .@"const" = true, | |
| 4504 | }; | |
| 4505 | }; | |
| 4506 | ||
| 4507 | pub const __builtin_arm_rbit64 = struct { | |
| 4508 | const param_str = "WUiWUi"; | |
| 4509 | const target_set = TargetSet.init(.{ | |
| 4510 | .aarch64 = true, | |
| 4511 | }); | |
| 4512 | const attributes = Attributes{ | |
| 4513 | .@"const" = true, | |
| 4514 | }; | |
| 4515 | }; | |
| 4516 | ||
| 4517 | pub const __builtin_arm_rsr = struct { | |
| 4518 | const param_str = "UicC*"; | |
| 4519 | const target_set = TargetSet.init(.{ | |
| 4520 | .aarch64 = true, | |
| 4521 | .arm = true, | |
| 4522 | }); | |
| 4523 | const attributes = Attributes{ | |
| 4524 | .@"const" = true, | |
| 4525 | }; | |
| 4526 | }; | |
| 4527 | ||
| 4528 | pub const __builtin_arm_rsr128 = struct { | |
| 4529 | const param_str = "LLLUicC*"; | |
| 4530 | const target_set = TargetSet.init(.{ | |
| 4531 | .aarch64 = true, | |
| 4532 | }); | |
| 4533 | const attributes = Attributes{ | |
| 4534 | .@"const" = true, | |
| 4535 | }; | |
| 4536 | }; | |
| 4537 | ||
| 4538 | pub const __builtin_arm_rsr64 = struct { | |
| 4539 | const param_str = "!"; | |
| 4540 | const target_set = TargetSet.init(.{ | |
| 4541 | .aarch64 = true, | |
| 4542 | .arm = true, | |
| 4543 | }); | |
| 4544 | const attributes = Attributes{ | |
| 4545 | .@"const" = true, | |
| 4546 | }; | |
| 4547 | }; | |
| 4548 | ||
| 4549 | pub const __builtin_arm_rsrp = struct { | |
| 4550 | const param_str = "v*cC*"; | |
| 4551 | const target_set = TargetSet.init(.{ | |
| 4552 | .aarch64 = true, | |
| 4553 | .arm = true, | |
| 4554 | }); | |
| 4555 | const attributes = Attributes{ | |
| 4556 | .@"const" = true, | |
| 4557 | }; | |
| 4558 | }; | |
| 4559 | ||
| 4560 | pub const __builtin_arm_sadd16 = struct { | |
| 4561 | const param_str = "iii"; | |
| 4562 | const target_set = TargetSet.init(.{ | |
| 4563 | .arm = true, | |
| 4564 | }); | |
| 4565 | const attributes = Attributes{ | |
| 4566 | .@"const" = true, | |
| 4567 | }; | |
| 4568 | }; | |
| 4569 | ||
| 4570 | pub const __builtin_arm_sadd8 = struct { | |
| 4571 | const param_str = "iii"; | |
| 4572 | const target_set = TargetSet.init(.{ | |
| 4573 | .arm = true, | |
| 4574 | }); | |
| 4575 | const attributes = Attributes{ | |
| 4576 | .@"const" = true, | |
| 4577 | }; | |
| 4578 | }; | |
| 4579 | ||
| 4580 | pub const __builtin_arm_sasx = struct { | |
| 4581 | const param_str = "iii"; | |
| 4582 | const target_set = TargetSet.init(.{ | |
| 4583 | .arm = true, | |
| 4584 | }); | |
| 4585 | const attributes = Attributes{ | |
| 4586 | .@"const" = true, | |
| 4587 | }; | |
| 4588 | }; | |
| 4589 | ||
| 4590 | pub const __builtin_arm_sel = struct { | |
| 4591 | const param_str = "iii"; | |
| 4592 | const target_set = TargetSet.init(.{ | |
| 4593 | .arm = true, | |
| 4594 | }); | |
| 4595 | const attributes = Attributes{ | |
| 4596 | .@"const" = true, | |
| 4597 | }; | |
| 4598 | }; | |
| 4599 | ||
| 4600 | pub const __builtin_arm_set_fpscr = struct { | |
| 4601 | const param_str = "vUi"; | |
| 4602 | const target_set = TargetSet.init(.{ | |
| 4603 | .arm = true, | |
| 4604 | }); | |
| 4605 | const attributes = Attributes{ | |
| 4606 | .@"const" = true, | |
| 4607 | }; | |
| 4608 | }; | |
| 4609 | ||
| 4610 | pub const __builtin_arm_sev = struct { | |
| 4611 | const param_str = "v"; | |
| 4612 | const target_set = TargetSet.init(.{ | |
| 4613 | .aarch64 = true, | |
| 4614 | .arm = true, | |
| 4615 | }); | |
| 4616 | }; | |
| 4617 | ||
| 4618 | pub const __builtin_arm_sevl = struct { | |
| 4619 | const param_str = "v"; | |
| 4620 | const target_set = TargetSet.init(.{ | |
| 4621 | .aarch64 = true, | |
| 4622 | .arm = true, | |
| 4623 | }); | |
| 4624 | }; | |
| 4625 | ||
| 4626 | pub const __builtin_arm_shadd16 = struct { | |
| 4627 | const param_str = "iii"; | |
| 4628 | const target_set = TargetSet.init(.{ | |
| 4629 | .arm = true, | |
| 4630 | }); | |
| 4631 | const attributes = Attributes{ | |
| 4632 | .@"const" = true, | |
| 4633 | }; | |
| 4634 | }; | |
| 4635 | ||
| 4636 | pub const __builtin_arm_shadd8 = struct { | |
| 4637 | const param_str = "iii"; | |
| 4638 | const target_set = TargetSet.init(.{ | |
| 4639 | .arm = true, | |
| 4640 | }); | |
| 4641 | const attributes = Attributes{ | |
| 4642 | .@"const" = true, | |
| 4643 | }; | |
| 4644 | }; | |
| 4645 | ||
| 4646 | pub const __builtin_arm_shasx = struct { | |
| 4647 | const param_str = "iii"; | |
| 4648 | const target_set = TargetSet.init(.{ | |
| 4649 | .arm = true, | |
| 4650 | }); | |
| 4651 | const attributes = Attributes{ | |
| 4652 | .@"const" = true, | |
| 4653 | }; | |
| 4654 | }; | |
| 4655 | ||
| 4656 | pub const __builtin_arm_shsax = struct { | |
| 4657 | const param_str = "iii"; | |
| 4658 | const target_set = TargetSet.init(.{ | |
| 4659 | .arm = true, | |
| 4660 | }); | |
| 4661 | const attributes = Attributes{ | |
| 4662 | .@"const" = true, | |
| 4663 | }; | |
| 4664 | }; | |
| 4665 | ||
| 4666 | pub const __builtin_arm_shsub16 = struct { | |
| 4667 | const param_str = "iii"; | |
| 4668 | const target_set = TargetSet.init(.{ | |
| 4669 | .arm = true, | |
| 4670 | }); | |
| 4671 | const attributes = Attributes{ | |
| 4672 | .@"const" = true, | |
| 4673 | }; | |
| 4674 | }; | |
| 4675 | ||
| 4676 | pub const __builtin_arm_shsub8 = struct { | |
| 4677 | const param_str = "iii"; | |
| 4678 | const target_set = TargetSet.init(.{ | |
| 4679 | .arm = true, | |
| 4680 | }); | |
| 4681 | const attributes = Attributes{ | |
| 4682 | .@"const" = true, | |
| 4683 | }; | |
| 4684 | }; | |
| 4685 | ||
| 4686 | pub const __builtin_arm_smlabb = struct { | |
| 4687 | const param_str = "iiii"; | |
| 4688 | const target_set = TargetSet.init(.{ | |
| 4689 | .arm = true, | |
| 4690 | }); | |
| 4691 | const attributes = Attributes{ | |
| 4692 | .@"const" = true, | |
| 4693 | }; | |
| 4694 | }; | |
| 4695 | ||
| 4696 | pub const __builtin_arm_smlabt = struct { | |
| 4697 | const param_str = "iiii"; | |
| 4698 | const target_set = TargetSet.init(.{ | |
| 4699 | .arm = true, | |
| 4700 | }); | |
| 4701 | const attributes = Attributes{ | |
| 4702 | .@"const" = true, | |
| 4703 | }; | |
| 4704 | }; | |
| 4705 | ||
| 4706 | pub const __builtin_arm_smlad = struct { | |
| 4707 | const param_str = "iiii"; | |
| 4708 | const target_set = TargetSet.init(.{ | |
| 4709 | .arm = true, | |
| 4710 | }); | |
| 4711 | const attributes = Attributes{ | |
| 4712 | .@"const" = true, | |
| 4713 | }; | |
| 4714 | }; | |
| 4715 | ||
| 4716 | pub const __builtin_arm_smladx = struct { | |
| 4717 | const param_str = "iiii"; | |
| 4718 | const target_set = TargetSet.init(.{ | |
| 4719 | .arm = true, | |
| 4720 | }); | |
| 4721 | const attributes = Attributes{ | |
| 4722 | .@"const" = true, | |
| 4723 | }; | |
| 4724 | }; | |
| 4725 | ||
| 4726 | pub const __builtin_arm_smlald = struct { | |
| 4727 | const param_str = "LLiiiLLi"; | |
| 4728 | const target_set = TargetSet.init(.{ | |
| 4729 | .arm = true, | |
| 4730 | }); | |
| 4731 | const attributes = Attributes{ | |
| 4732 | .@"const" = true, | |
| 4733 | }; | |
| 4734 | }; | |
| 4735 | ||
| 4736 | pub const __builtin_arm_smlaldx = struct { | |
| 4737 | const param_str = "LLiiiLLi"; | |
| 4738 | const target_set = TargetSet.init(.{ | |
| 4739 | .arm = true, | |
| 4740 | }); | |
| 4741 | const attributes = Attributes{ | |
| 4742 | .@"const" = true, | |
| 4743 | }; | |
| 4744 | }; | |
| 4745 | ||
| 4746 | pub const __builtin_arm_smlatb = struct { | |
| 4747 | const param_str = "iiii"; | |
| 4748 | const target_set = TargetSet.init(.{ | |
| 4749 | .arm = true, | |
| 4750 | }); | |
| 4751 | const attributes = Attributes{ | |
| 4752 | .@"const" = true, | |
| 4753 | }; | |
| 4754 | }; | |
| 4755 | ||
| 4756 | pub const __builtin_arm_smlatt = struct { | |
| 4757 | const param_str = "iiii"; | |
| 4758 | const target_set = TargetSet.init(.{ | |
| 4759 | .arm = true, | |
| 4760 | }); | |
| 4761 | const attributes = Attributes{ | |
| 4762 | .@"const" = true, | |
| 4763 | }; | |
| 4764 | }; | |
| 4765 | ||
| 4766 | pub const __builtin_arm_smlawb = struct { | |
| 4767 | const param_str = "iiii"; | |
| 4768 | const target_set = TargetSet.init(.{ | |
| 4769 | .arm = true, | |
| 4770 | }); | |
| 4771 | const attributes = Attributes{ | |
| 4772 | .@"const" = true, | |
| 4773 | }; | |
| 4774 | }; | |
| 4775 | ||
| 4776 | pub const __builtin_arm_smlawt = struct { | |
| 4777 | const param_str = "iiii"; | |
| 4778 | const target_set = TargetSet.init(.{ | |
| 4779 | .arm = true, | |
| 4780 | }); | |
| 4781 | const attributes = Attributes{ | |
| 4782 | .@"const" = true, | |
| 4783 | }; | |
| 4784 | }; | |
| 4785 | ||
| 4786 | pub const __builtin_arm_smlsd = struct { | |
| 4787 | const param_str = "iiii"; | |
| 4788 | const target_set = TargetSet.init(.{ | |
| 4789 | .arm = true, | |
| 4790 | }); | |
| 4791 | const attributes = Attributes{ | |
| 4792 | .@"const" = true, | |
| 4793 | }; | |
| 4794 | }; | |
| 4795 | ||
| 4796 | pub const __builtin_arm_smlsdx = struct { | |
| 4797 | const param_str = "iiii"; | |
| 4798 | const target_set = TargetSet.init(.{ | |
| 4799 | .arm = true, | |
| 4800 | }); | |
| 4801 | const attributes = Attributes{ | |
| 4802 | .@"const" = true, | |
| 4803 | }; | |
| 4804 | }; | |
| 4805 | ||
| 4806 | pub const __builtin_arm_smlsld = struct { | |
| 4807 | const param_str = "LLiiiLLi"; | |
| 4808 | const target_set = TargetSet.init(.{ | |
| 4809 | .arm = true, | |
| 4810 | }); | |
| 4811 | const attributes = Attributes{ | |
| 4812 | .@"const" = true, | |
| 4813 | }; | |
| 4814 | }; | |
| 4815 | ||
| 4816 | pub const __builtin_arm_smlsldx = struct { | |
| 4817 | const param_str = "LLiiiLLi"; | |
| 4818 | const target_set = TargetSet.init(.{ | |
| 4819 | .arm = true, | |
| 4820 | }); | |
| 4821 | const attributes = Attributes{ | |
| 4822 | .@"const" = true, | |
| 4823 | }; | |
| 4824 | }; | |
| 4825 | ||
| 4826 | pub const __builtin_arm_smuad = struct { | |
| 4827 | const param_str = "iii"; | |
| 4828 | const target_set = TargetSet.init(.{ | |
| 4829 | .arm = true, | |
| 4830 | }); | |
| 4831 | const attributes = Attributes{ | |
| 4832 | .@"const" = true, | |
| 4833 | }; | |
| 4834 | }; | |
| 4835 | ||
| 4836 | pub const __builtin_arm_smuadx = struct { | |
| 4837 | const param_str = "iii"; | |
| 4838 | const target_set = TargetSet.init(.{ | |
| 4839 | .arm = true, | |
| 4840 | }); | |
| 4841 | const attributes = Attributes{ | |
| 4842 | .@"const" = true, | |
| 4843 | }; | |
| 4844 | }; | |
| 4845 | ||
| 4846 | pub const __builtin_arm_smulbb = struct { | |
| 4847 | const param_str = "iii"; | |
| 4848 | const target_set = TargetSet.init(.{ | |
| 4849 | .arm = true, | |
| 4850 | }); | |
| 4851 | const attributes = Attributes{ | |
| 4852 | .@"const" = true, | |
| 4853 | }; | |
| 4854 | }; | |
| 4855 | ||
| 4856 | pub const __builtin_arm_smulbt = struct { | |
| 4857 | const param_str = "iii"; | |
| 4858 | const target_set = TargetSet.init(.{ | |
| 4859 | .arm = true, | |
| 4860 | }); | |
| 4861 | const attributes = Attributes{ | |
| 4862 | .@"const" = true, | |
| 4863 | }; | |
| 4864 | }; | |
| 4865 | ||
| 4866 | pub const __builtin_arm_smultb = struct { | |
| 4867 | const param_str = "iii"; | |
| 4868 | const target_set = TargetSet.init(.{ | |
| 4869 | .arm = true, | |
| 4870 | }); | |
| 4871 | const attributes = Attributes{ | |
| 4872 | .@"const" = true, | |
| 4873 | }; | |
| 4874 | }; | |
| 4875 | ||
| 4876 | pub const __builtin_arm_smultt = struct { | |
| 4877 | const param_str = "iii"; | |
| 4878 | const target_set = TargetSet.init(.{ | |
| 4879 | .arm = true, | |
| 4880 | }); | |
| 4881 | const attributes = Attributes{ | |
| 4882 | .@"const" = true, | |
| 4883 | }; | |
| 4884 | }; | |
| 4885 | ||
| 4886 | pub const __builtin_arm_smulwb = struct { | |
| 4887 | const param_str = "iii"; | |
| 4888 | const target_set = TargetSet.init(.{ | |
| 4889 | .arm = true, | |
| 4890 | }); | |
| 4891 | const attributes = Attributes{ | |
| 4892 | .@"const" = true, | |
| 4893 | }; | |
| 4894 | }; | |
| 4895 | ||
| 4896 | pub const __builtin_arm_smulwt = struct { | |
| 4897 | const param_str = "iii"; | |
| 4898 | const target_set = TargetSet.init(.{ | |
| 4899 | .arm = true, | |
| 4900 | }); | |
| 4901 | const attributes = Attributes{ | |
| 4902 | .@"const" = true, | |
| 4903 | }; | |
| 4904 | }; | |
| 4905 | ||
| 4906 | pub const __builtin_arm_smusd = struct { | |
| 4907 | const param_str = "iii"; | |
| 4908 | const target_set = TargetSet.init(.{ | |
| 4909 | .arm = true, | |
| 4910 | }); | |
| 4911 | const attributes = Attributes{ | |
| 4912 | .@"const" = true, | |
| 4913 | }; | |
| 4914 | }; | |
| 4915 | ||
| 4916 | pub const __builtin_arm_smusdx = struct { | |
| 4917 | const param_str = "iii"; | |
| 4918 | const target_set = TargetSet.init(.{ | |
| 4919 | .arm = true, | |
| 4920 | }); | |
| 4921 | const attributes = Attributes{ | |
| 4922 | .@"const" = true, | |
| 4923 | }; | |
| 4924 | }; | |
| 4925 | ||
| 4926 | pub const __builtin_arm_ssat = struct { | |
| 4927 | const param_str = "iiUi"; | |
| 4928 | const target_set = TargetSet.init(.{ | |
| 4929 | .arm = true, | |
| 4930 | }); | |
| 4931 | const attributes = Attributes{ | |
| 4932 | .@"const" = true, | |
| 4933 | }; | |
| 4934 | }; | |
| 4935 | ||
| 4936 | pub const __builtin_arm_ssat16 = struct { | |
| 4937 | const param_str = "iii"; | |
| 4938 | const target_set = TargetSet.init(.{ | |
| 4939 | .arm = true, | |
| 4940 | }); | |
| 4941 | const attributes = Attributes{ | |
| 4942 | .@"const" = true, | |
| 4943 | }; | |
| 4944 | }; | |
| 4945 | ||
| 4946 | pub const __builtin_arm_ssax = struct { | |
| 4947 | const param_str = "iii"; | |
| 4948 | const target_set = TargetSet.init(.{ | |
| 4949 | .arm = true, | |
| 4950 | }); | |
| 4951 | const attributes = Attributes{ | |
| 4952 | .@"const" = true, | |
| 4953 | }; | |
| 4954 | }; | |
| 4955 | ||
| 4956 | pub const __builtin_arm_ssub16 = struct { | |
| 4957 | const param_str = "iii"; | |
| 4958 | const target_set = TargetSet.init(.{ | |
| 4959 | .arm = true, | |
| 4960 | }); | |
| 4961 | const attributes = Attributes{ | |
| 4962 | .@"const" = true, | |
| 4963 | }; | |
| 4964 | }; | |
| 4965 | ||
| 4966 | pub const __builtin_arm_ssub8 = struct { | |
| 4967 | const param_str = "iii"; | |
| 4968 | const target_set = TargetSet.init(.{ | |
| 4969 | .arm = true, | |
| 4970 | }); | |
| 4971 | const attributes = Attributes{ | |
| 4972 | .@"const" = true, | |
| 4973 | }; | |
| 4974 | }; | |
| 4975 | ||
| 4976 | pub const __builtin_arm_stc = struct { | |
| 4977 | const param_str = "vUIiUIiv*"; | |
| 4978 | const target_set = TargetSet.init(.{ | |
| 4979 | .arm = true, | |
| 4980 | }); | |
| 4981 | }; | |
| 4982 | ||
| 4983 | pub const __builtin_arm_stc2 = struct { | |
| 4984 | const param_str = "vUIiUIiv*"; | |
| 4985 | const target_set = TargetSet.init(.{ | |
| 4986 | .arm = true, | |
| 4987 | }); | |
| 4988 | }; | |
| 4989 | ||
| 4990 | pub const __builtin_arm_stc2l = struct { | |
| 4991 | const param_str = "vUIiUIiv*"; | |
| 4992 | const target_set = TargetSet.init(.{ | |
| 4993 | .arm = true, | |
| 4994 | }); | |
| 4995 | }; | |
| 4996 | ||
| 4997 | pub const __builtin_arm_stcl = struct { | |
| 4998 | const param_str = "vUIiUIiv*"; | |
| 4999 | const target_set = TargetSet.init(.{ | |
| 5000 | .arm = true, | |
| 5001 | }); | |
| 5002 | }; | |
| 5003 | ||
| 5004 | pub const __builtin_arm_stlex = struct { | |
| 5005 | const param_str = "i."; | |
| 5006 | const target_set = TargetSet.init(.{ | |
| 5007 | .aarch64 = true, | |
| 5008 | .arm = true, | |
| 5009 | }); | |
| 5010 | const attributes = Attributes{ | |
| 5011 | .custom_typecheck = true, | |
| 5012 | }; | |
| 5013 | }; | |
| 5014 | ||
| 5015 | pub const __builtin_arm_strex = struct { | |
| 5016 | const param_str = "i."; | |
| 5017 | const target_set = TargetSet.init(.{ | |
| 5018 | .aarch64 = true, | |
| 5019 | .arm = true, | |
| 5020 | }); | |
| 5021 | const attributes = Attributes{ | |
| 5022 | .custom_typecheck = true, | |
| 5023 | }; | |
| 5024 | }; | |
| 5025 | ||
| 5026 | pub const __builtin_arm_strexd = struct { | |
| 5027 | const param_str = "iLLUiv*"; | |
| 5028 | const target_set = TargetSet.init(.{ | |
| 5029 | .arm = true, | |
| 5030 | }); | |
| 5031 | }; | |
| 5032 | ||
| 5033 | pub const __builtin_arm_sxtab16 = struct { | |
| 5034 | const param_str = "iii"; | |
| 5035 | const target_set = TargetSet.init(.{ | |
| 5036 | .arm = true, | |
| 5037 | }); | |
| 5038 | const attributes = Attributes{ | |
| 5039 | .@"const" = true, | |
| 5040 | }; | |
| 5041 | }; | |
| 5042 | ||
| 5043 | pub const __builtin_arm_sxtb16 = struct { | |
| 5044 | const param_str = "ii"; | |
| 5045 | const target_set = TargetSet.init(.{ | |
| 5046 | .arm = true, | |
| 5047 | }); | |
| 5048 | const attributes = Attributes{ | |
| 5049 | .@"const" = true, | |
| 5050 | }; | |
| 5051 | }; | |
| 5052 | ||
| 5053 | pub const __builtin_arm_tcancel = struct { | |
| 5054 | const param_str = "vWUIi"; | |
| 5055 | const target_set = TargetSet.init(.{ | |
| 5056 | .aarch64 = true, | |
| 5057 | }); | |
| 5058 | const attributes = Attributes{}; | |
| 5059 | }; | |
| 5060 | ||
| 5061 | pub const __builtin_arm_tcommit = struct { | |
| 5062 | const param_str = "v"; | |
| 5063 | const target_set = TargetSet.init(.{ | |
| 5064 | .aarch64 = true, | |
| 5065 | }); | |
| 5066 | const attributes = Attributes{}; | |
| 5067 | }; | |
| 5068 | ||
| 5069 | pub const __builtin_arm_tstart = struct { | |
| 5070 | const param_str = "WUi"; | |
| 5071 | const target_set = TargetSet.init(.{ | |
| 5072 | .aarch64 = true, | |
| 5073 | }); | |
| 5074 | const attributes = Attributes{ | |
| 5075 | .returns_twice = true, | |
| 5076 | }; | |
| 5077 | }; | |
| 5078 | ||
| 5079 | pub const __builtin_arm_ttest = struct { | |
| 5080 | const param_str = "WUi"; | |
| 5081 | const target_set = TargetSet.init(.{ | |
| 5082 | .aarch64 = true, | |
| 5083 | }); | |
| 5084 | const attributes = Attributes{ | |
| 5085 | .@"const" = true, | |
| 5086 | }; | |
| 5087 | }; | |
| 5088 | ||
| 5089 | pub const __builtin_arm_uadd16 = struct { | |
| 5090 | const param_str = "UiUiUi"; | |
| 5091 | const target_set = TargetSet.init(.{ | |
| 5092 | .arm = true, | |
| 5093 | }); | |
| 5094 | const attributes = Attributes{ | |
| 5095 | .@"const" = true, | |
| 5096 | }; | |
| 5097 | }; | |
| 5098 | ||
| 5099 | pub const __builtin_arm_uadd8 = struct { | |
| 5100 | const param_str = "UiUiUi"; | |
| 5101 | const target_set = TargetSet.init(.{ | |
| 5102 | .arm = true, | |
| 5103 | }); | |
| 5104 | const attributes = Attributes{ | |
| 5105 | .@"const" = true, | |
| 5106 | }; | |
| 5107 | }; | |
| 5108 | ||
| 5109 | pub const __builtin_arm_uasx = struct { | |
| 5110 | const param_str = "UiUiUi"; | |
| 5111 | const target_set = TargetSet.init(.{ | |
| 5112 | .arm = true, | |
| 5113 | }); | |
| 5114 | const attributes = Attributes{ | |
| 5115 | .@"const" = true, | |
| 5116 | }; | |
| 5117 | }; | |
| 5118 | ||
| 5119 | pub const __builtin_arm_uhadd16 = struct { | |
| 5120 | const param_str = "UiUiUi"; | |
| 5121 | const target_set = TargetSet.init(.{ | |
| 5122 | .arm = true, | |
| 5123 | }); | |
| 5124 | const attributes = Attributes{ | |
| 5125 | .@"const" = true, | |
| 5126 | }; | |
| 5127 | }; | |
| 5128 | ||
| 5129 | pub const __builtin_arm_uhadd8 = struct { | |
| 5130 | const param_str = "UiUiUi"; | |
| 5131 | const target_set = TargetSet.init(.{ | |
| 5132 | .arm = true, | |
| 5133 | }); | |
| 5134 | const attributes = Attributes{ | |
| 5135 | .@"const" = true, | |
| 5136 | }; | |
| 5137 | }; | |
| 5138 | ||
| 5139 | pub const __builtin_arm_uhasx = struct { | |
| 5140 | const param_str = "UiUiUi"; | |
| 5141 | const target_set = TargetSet.init(.{ | |
| 5142 | .arm = true, | |
| 5143 | }); | |
| 5144 | const attributes = Attributes{ | |
| 5145 | .@"const" = true, | |
| 5146 | }; | |
| 5147 | }; | |
| 5148 | ||
| 5149 | pub const __builtin_arm_uhsax = struct { | |
| 5150 | const param_str = "UiUiUi"; | |
| 5151 | const target_set = TargetSet.init(.{ | |
| 5152 | .arm = true, | |
| 5153 | }); | |
| 5154 | const attributes = Attributes{ | |
| 5155 | .@"const" = true, | |
| 5156 | }; | |
| 5157 | }; | |
| 5158 | ||
| 5159 | pub const __builtin_arm_uhsub16 = struct { | |
| 5160 | const param_str = "UiUiUi"; | |
| 5161 | const target_set = TargetSet.init(.{ | |
| 5162 | .arm = true, | |
| 5163 | }); | |
| 5164 | const attributes = Attributes{ | |
| 5165 | .@"const" = true, | |
| 5166 | }; | |
| 5167 | }; | |
| 5168 | ||
| 5169 | pub const __builtin_arm_uhsub8 = struct { | |
| 5170 | const param_str = "UiUiUi"; | |
| 5171 | const target_set = TargetSet.init(.{ | |
| 5172 | .arm = true, | |
| 5173 | }); | |
| 5174 | const attributes = Attributes{ | |
| 5175 | .@"const" = true, | |
| 5176 | }; | |
| 5177 | }; | |
| 5178 | ||
| 5179 | pub const __builtin_arm_uqadd16 = struct { | |
| 5180 | const param_str = "UiUiUi"; | |
| 5181 | const target_set = TargetSet.init(.{ | |
| 5182 | .arm = true, | |
| 5183 | }); | |
| 5184 | const attributes = Attributes{ | |
| 5185 | .@"const" = true, | |
| 5186 | }; | |
| 5187 | }; | |
| 5188 | ||
| 5189 | pub const __builtin_arm_uqadd8 = struct { | |
| 5190 | const param_str = "UiUiUi"; | |
| 5191 | const target_set = TargetSet.init(.{ | |
| 5192 | .arm = true, | |
| 5193 | }); | |
| 5194 | const attributes = Attributes{ | |
| 5195 | .@"const" = true, | |
| 5196 | }; | |
| 5197 | }; | |
| 5198 | ||
| 5199 | pub const __builtin_arm_uqasx = struct { | |
| 5200 | const param_str = "UiUiUi"; | |
| 5201 | const target_set = TargetSet.init(.{ | |
| 5202 | .arm = true, | |
| 5203 | }); | |
| 5204 | const attributes = Attributes{ | |
| 5205 | .@"const" = true, | |
| 5206 | }; | |
| 5207 | }; | |
| 5208 | ||
| 5209 | pub const __builtin_arm_uqsax = struct { | |
| 5210 | const param_str = "UiUiUi"; | |
| 5211 | const target_set = TargetSet.init(.{ | |
| 5212 | .arm = true, | |
| 5213 | }); | |
| 5214 | const attributes = Attributes{ | |
| 5215 | .@"const" = true, | |
| 5216 | }; | |
| 5217 | }; | |
| 5218 | ||
| 5219 | pub const __builtin_arm_uqsub16 = struct { | |
| 5220 | const param_str = "UiUiUi"; | |
| 5221 | const target_set = TargetSet.init(.{ | |
| 5222 | .arm = true, | |
| 5223 | }); | |
| 5224 | const attributes = Attributes{ | |
| 5225 | .@"const" = true, | |
| 5226 | }; | |
| 5227 | }; | |
| 5228 | ||
| 5229 | pub const __builtin_arm_uqsub8 = struct { | |
| 5230 | const param_str = "UiUiUi"; | |
| 5231 | const target_set = TargetSet.init(.{ | |
| 5232 | .arm = true, | |
| 5233 | }); | |
| 5234 | const attributes = Attributes{ | |
| 5235 | .@"const" = true, | |
| 5236 | }; | |
| 5237 | }; | |
| 5238 | ||
| 5239 | pub const __builtin_arm_usad8 = struct { | |
| 5240 | const param_str = "UiUiUi"; | |
| 5241 | const target_set = TargetSet.init(.{ | |
| 5242 | .arm = true, | |
| 5243 | }); | |
| 5244 | const attributes = Attributes{ | |
| 5245 | .@"const" = true, | |
| 5246 | }; | |
| 5247 | }; | |
| 5248 | ||
| 5249 | pub const __builtin_arm_usada8 = struct { | |
| 5250 | const param_str = "UiUiUiUi"; | |
| 5251 | const target_set = TargetSet.init(.{ | |
| 5252 | .arm = true, | |
| 5253 | }); | |
| 5254 | const attributes = Attributes{ | |
| 5255 | .@"const" = true, | |
| 5256 | }; | |
| 5257 | }; | |
| 5258 | ||
| 5259 | pub const __builtin_arm_usat = struct { | |
| 5260 | const param_str = "UiiUi"; | |
| 5261 | const target_set = TargetSet.init(.{ | |
| 5262 | .arm = true, | |
| 5263 | }); | |
| 5264 | const attributes = Attributes{ | |
| 5265 | .@"const" = true, | |
| 5266 | }; | |
| 5267 | }; | |
| 5268 | ||
| 5269 | pub const __builtin_arm_usat16 = struct { | |
| 5270 | const param_str = "iii"; | |
| 5271 | const target_set = TargetSet.init(.{ | |
| 5272 | .arm = true, | |
| 5273 | }); | |
| 5274 | const attributes = Attributes{ | |
| 5275 | .@"const" = true, | |
| 5276 | }; | |
| 5277 | }; | |
| 5278 | ||
| 5279 | pub const __builtin_arm_usax = struct { | |
| 5280 | const param_str = "UiUiUi"; | |
| 5281 | const target_set = TargetSet.init(.{ | |
| 5282 | .arm = true, | |
| 5283 | }); | |
| 5284 | const attributes = Attributes{ | |
| 5285 | .@"const" = true, | |
| 5286 | }; | |
| 5287 | }; | |
| 5288 | ||
| 5289 | pub const __builtin_arm_usub16 = struct { | |
| 5290 | const param_str = "UiUiUi"; | |
| 5291 | const target_set = TargetSet.init(.{ | |
| 5292 | .arm = true, | |
| 5293 | }); | |
| 5294 | const attributes = Attributes{ | |
| 5295 | .@"const" = true, | |
| 5296 | }; | |
| 5297 | }; | |
| 5298 | ||
| 5299 | pub const __builtin_arm_usub8 = struct { | |
| 5300 | const param_str = "UiUiUi"; | |
| 5301 | const target_set = TargetSet.init(.{ | |
| 5302 | .arm = true, | |
| 5303 | }); | |
| 5304 | const attributes = Attributes{ | |
| 5305 | .@"const" = true, | |
| 5306 | }; | |
| 5307 | }; | |
| 5308 | ||
| 5309 | pub const __builtin_arm_uxtab16 = struct { | |
| 5310 | const param_str = "iii"; | |
| 5311 | const target_set = TargetSet.init(.{ | |
| 5312 | .arm = true, | |
| 5313 | }); | |
| 5314 | const attributes = Attributes{ | |
| 5315 | .@"const" = true, | |
| 5316 | }; | |
| 5317 | }; | |
| 5318 | ||
| 5319 | pub const __builtin_arm_uxtb16 = struct { | |
| 5320 | const param_str = "ii"; | |
| 5321 | const target_set = TargetSet.init(.{ | |
| 5322 | .arm = true, | |
| 5323 | }); | |
| 5324 | const attributes = Attributes{ | |
| 5325 | .@"const" = true, | |
| 5326 | }; | |
| 5327 | }; | |
| 5328 | ||
| 5329 | pub const __builtin_arm_vcvtr_d = struct { | |
| 5330 | const param_str = "fdi"; | |
| 5331 | const target_set = TargetSet.init(.{ | |
| 5332 | .arm = true, | |
| 5333 | }); | |
| 5334 | const attributes = Attributes{ | |
| 5335 | .@"const" = true, | |
| 5336 | }; | |
| 5337 | }; | |
| 5338 | ||
| 5339 | pub const __builtin_arm_vcvtr_f = struct { | |
| 5340 | const param_str = "ffi"; | |
| 5341 | const target_set = TargetSet.init(.{ | |
| 5342 | .arm = true, | |
| 5343 | }); | |
| 5344 | const attributes = Attributes{ | |
| 5345 | .@"const" = true, | |
| 5346 | }; | |
| 5347 | }; | |
| 5348 | ||
| 5349 | pub const __builtin_arm_wfe = struct { | |
| 5350 | const param_str = "v"; | |
| 5351 | const target_set = TargetSet.init(.{ | |
| 5352 | .aarch64 = true, | |
| 5353 | .arm = true, | |
| 5354 | }); | |
| 5355 | }; | |
| 5356 | ||
| 5357 | pub const __builtin_arm_wfi = struct { | |
| 5358 | const param_str = "v"; | |
| 5359 | const target_set = TargetSet.init(.{ | |
| 5360 | .aarch64 = true, | |
| 5361 | .arm = true, | |
| 5362 | }); | |
| 5363 | }; | |
| 5364 | ||
| 5365 | pub const __builtin_arm_wsr = struct { | |
| 5366 | const param_str = "vcC*Ui"; | |
| 5367 | const target_set = TargetSet.init(.{ | |
| 5368 | .aarch64 = true, | |
| 5369 | .arm = true, | |
| 5370 | }); | |
| 5371 | const attributes = Attributes{ | |
| 5372 | .@"const" = true, | |
| 5373 | }; | |
| 5374 | }; | |
| 5375 | ||
| 5376 | pub const __builtin_arm_wsr128 = struct { | |
| 5377 | const param_str = "vcC*LLLUi"; | |
| 5378 | const target_set = TargetSet.init(.{ | |
| 5379 | .aarch64 = true, | |
| 5380 | }); | |
| 5381 | const attributes = Attributes{ | |
| 5382 | .@"const" = true, | |
| 5383 | }; | |
| 5384 | }; | |
| 5385 | ||
| 5386 | pub const __builtin_arm_wsr64 = struct { | |
| 5387 | const param_str = "!"; | |
| 5388 | const target_set = TargetSet.init(.{ | |
| 5389 | .aarch64 = true, | |
| 5390 | .arm = true, | |
| 5391 | }); | |
| 5392 | const attributes = Attributes{ | |
| 5393 | .@"const" = true, | |
| 5394 | }; | |
| 5395 | }; | |
| 5396 | ||
| 5397 | pub const __builtin_arm_wsrp = struct { | |
| 5398 | const param_str = "vcC*vC*"; | |
| 5399 | const target_set = TargetSet.init(.{ | |
| 5400 | .aarch64 = true, | |
| 5401 | .arm = true, | |
| 5402 | }); | |
| 5403 | const attributes = Attributes{ | |
| 5404 | .@"const" = true, | |
| 5405 | }; | |
| 5406 | }; | |
| 5407 | ||
| 5408 | pub const __builtin_arm_yield = struct { | |
| 5409 | const param_str = "v"; | |
| 5410 | const target_set = TargetSet.init(.{ | |
| 5411 | .aarch64 = true, | |
| 5412 | .arm = true, | |
| 5413 | }); | |
| 5414 | }; | |
| 5415 | ||
| 5416 | pub const __builtin_asin = struct { | |
| 5417 | const param_str = "dd"; | |
| 5418 | const attributes = Attributes{ | |
| 5419 | .lib_function_with_builtin_prefix = true, | |
| 5420 | .const_without_errno_and_fp_exceptions = true, | |
| 5421 | }; | |
| 5422 | }; | |
| 5423 | ||
| 5424 | pub const __builtin_asinf = struct { | |
| 5425 | const param_str = "ff"; | |
| 5426 | const attributes = Attributes{ | |
| 5427 | .lib_function_with_builtin_prefix = true, | |
| 5428 | .const_without_errno_and_fp_exceptions = true, | |
| 5429 | }; | |
| 5430 | }; | |
| 5431 | ||
| 5432 | pub const __builtin_asinf128 = struct { | |
| 5433 | const param_str = "LLdLLd"; | |
| 5434 | const attributes = Attributes{ | |
| 5435 | .lib_function_with_builtin_prefix = true, | |
| 5436 | .const_without_errno_and_fp_exceptions = true, | |
| 5437 | }; | |
| 5438 | }; | |
| 5439 | ||
| 5440 | pub const __builtin_asinh = struct { | |
| 5441 | const param_str = "dd"; | |
| 5442 | const attributes = Attributes{ | |
| 5443 | .lib_function_with_builtin_prefix = true, | |
| 5444 | .const_without_errno_and_fp_exceptions = true, | |
| 5445 | }; | |
| 5446 | }; | |
| 5447 | ||
| 5448 | pub const __builtin_asinhf = struct { | |
| 5449 | const param_str = "ff"; | |
| 5450 | const attributes = Attributes{ | |
| 5451 | .lib_function_with_builtin_prefix = true, | |
| 5452 | .const_without_errno_and_fp_exceptions = true, | |
| 5453 | }; | |
| 5454 | }; | |
| 5455 | ||
| 5456 | pub const __builtin_asinhf128 = struct { | |
| 5457 | const param_str = "LLdLLd"; | |
| 5458 | const attributes = Attributes{ | |
| 5459 | .lib_function_with_builtin_prefix = true, | |
| 5460 | .const_without_errno_and_fp_exceptions = true, | |
| 5461 | }; | |
| 5462 | }; | |
| 5463 | ||
| 5464 | pub const __builtin_asinhl = struct { | |
| 5465 | const param_str = "LdLd"; | |
| 5466 | const attributes = Attributes{ | |
| 5467 | .lib_function_with_builtin_prefix = true, | |
| 5468 | .const_without_errno_and_fp_exceptions = true, | |
| 5469 | }; | |
| 5470 | }; | |
| 5471 | ||
| 5472 | pub const __builtin_asinl = struct { | |
| 5473 | const param_str = "LdLd"; | |
| 5474 | const attributes = Attributes{ | |
| 5475 | .lib_function_with_builtin_prefix = true, | |
| 5476 | .const_without_errno_and_fp_exceptions = true, | |
| 5477 | }; | |
| 5478 | }; | |
| 5479 | ||
| 5480 | pub const __builtin_assume = struct { | |
| 5481 | const param_str = "vb"; | |
| 5482 | const attributes = Attributes{ | |
| 5483 | .const_evaluable = true, | |
| 5484 | }; | |
| 5485 | }; | |
| 5486 | ||
| 5487 | pub const __builtin_assume_aligned = struct { | |
| 5488 | const param_str = "v*vC*z."; | |
| 5489 | const attributes = Attributes{ | |
| 5490 | .@"const" = true, | |
| 5491 | .custom_typecheck = true, | |
| 5492 | .const_evaluable = true, | |
| 5493 | }; | |
| 5494 | }; | |
| 5495 | ||
| 5496 | pub const __builtin_atan = struct { | |
| 5497 | const param_str = "dd"; | |
| 5498 | const attributes = Attributes{ | |
| 5499 | .lib_function_with_builtin_prefix = true, | |
| 5500 | .const_without_errno_and_fp_exceptions = true, | |
| 5501 | }; | |
| 5502 | }; | |
| 5503 | ||
| 5504 | pub const __builtin_atan2 = struct { | |
| 5505 | const param_str = "ddd"; | |
| 5506 | const attributes = Attributes{ | |
| 5507 | .lib_function_with_builtin_prefix = true, | |
| 5508 | .const_without_errno_and_fp_exceptions = true, | |
| 5509 | }; | |
| 5510 | }; | |
| 5511 | ||
| 5512 | pub const __builtin_atan2f = struct { | |
| 5513 | const param_str = "fff"; | |
| 5514 | const attributes = Attributes{ | |
| 5515 | .lib_function_with_builtin_prefix = true, | |
| 5516 | .const_without_errno_and_fp_exceptions = true, | |
| 5517 | }; | |
| 5518 | }; | |
| 5519 | ||
| 5520 | pub const __builtin_atan2f128 = struct { | |
| 5521 | const param_str = "LLdLLdLLd"; | |
| 5522 | const attributes = Attributes{ | |
| 5523 | .lib_function_with_builtin_prefix = true, | |
| 5524 | .const_without_errno_and_fp_exceptions = true, | |
| 5525 | }; | |
| 5526 | }; | |
| 5527 | ||
| 5528 | pub const __builtin_atan2l = struct { | |
| 5529 | const param_str = "LdLdLd"; | |
| 5530 | const attributes = Attributes{ | |
| 5531 | .lib_function_with_builtin_prefix = true, | |
| 5532 | .const_without_errno_and_fp_exceptions = true, | |
| 5533 | }; | |
| 5534 | }; | |
| 5535 | ||
| 5536 | pub const __builtin_atanf = struct { | |
| 5537 | const param_str = "ff"; | |
| 5538 | const attributes = Attributes{ | |
| 5539 | .lib_function_with_builtin_prefix = true, | |
| 5540 | .const_without_errno_and_fp_exceptions = true, | |
| 5541 | }; | |
| 5542 | }; | |
| 5543 | ||
| 5544 | pub const __builtin_atanf128 = struct { | |
| 5545 | const param_str = "LLdLLd"; | |
| 5546 | const attributes = Attributes{ | |
| 5547 | .lib_function_with_builtin_prefix = true, | |
| 5548 | .const_without_errno_and_fp_exceptions = true, | |
| 5549 | }; | |
| 5550 | }; | |
| 5551 | ||
| 5552 | pub const __builtin_atanh = struct { | |
| 5553 | const param_str = "dd"; | |
| 5554 | const attributes = Attributes{ | |
| 5555 | .lib_function_with_builtin_prefix = true, | |
| 5556 | .const_without_errno_and_fp_exceptions = true, | |
| 5557 | }; | |
| 5558 | }; | |
| 5559 | ||
| 5560 | pub const __builtin_atanhf = struct { | |
| 5561 | const param_str = "ff"; | |
| 5562 | const attributes = Attributes{ | |
| 5563 | .lib_function_with_builtin_prefix = true, | |
| 5564 | .const_without_errno_and_fp_exceptions = true, | |
| 5565 | }; | |
| 5566 | }; | |
| 5567 | ||
| 5568 | pub const __builtin_atanhf128 = struct { | |
| 5569 | const param_str = "LLdLLd"; | |
| 5570 | const attributes = Attributes{ | |
| 5571 | .lib_function_with_builtin_prefix = true, | |
| 5572 | .const_without_errno_and_fp_exceptions = true, | |
| 5573 | }; | |
| 5574 | }; | |
| 5575 | ||
| 5576 | pub const __builtin_atanhl = struct { | |
| 5577 | const param_str = "LdLd"; | |
| 5578 | const attributes = Attributes{ | |
| 5579 | .lib_function_with_builtin_prefix = true, | |
| 5580 | .const_without_errno_and_fp_exceptions = true, | |
| 5581 | }; | |
| 5582 | }; | |
| 5583 | ||
| 5584 | pub const __builtin_atanl = struct { | |
| 5585 | const param_str = "LdLd"; | |
| 5586 | const attributes = Attributes{ | |
| 5587 | .lib_function_with_builtin_prefix = true, | |
| 5588 | .const_without_errno_and_fp_exceptions = true, | |
| 5589 | }; | |
| 5590 | }; | |
| 5591 | ||
| 5592 | pub const __builtin_bcmp = struct { | |
| 5593 | const param_str = "ivC*vC*z"; | |
| 5594 | const attributes = Attributes{ | |
| 5595 | .lib_function_with_builtin_prefix = true, | |
| 5596 | .const_evaluable = true, | |
| 5597 | }; | |
| 5598 | }; | |
| 5599 | ||
| 5600 | pub const __builtin_bcopy = struct { | |
| 5601 | const param_str = "vv*v*z"; | |
| 5602 | const attributes = Attributes{}; | |
| 5603 | }; | |
| 5604 | ||
| 5605 | pub const __builtin_bitrev = struct { | |
| 5606 | const param_str = "UiUi"; | |
| 5607 | const target_set = TargetSet.init(.{ | |
| 5608 | .xcore = true, | |
| 5609 | }); | |
| 5610 | const attributes = Attributes{ | |
| 5611 | .@"const" = true, | |
| 5612 | }; | |
| 5613 | }; | |
| 5614 | ||
| 5615 | pub const __builtin_bitreverse16 = struct { | |
| 5616 | const param_str = "UsUs"; | |
| 5617 | const attributes = Attributes{ | |
| 5618 | .@"const" = true, | |
| 5619 | .const_evaluable = true, | |
| 5620 | }; | |
| 5621 | }; | |
| 5622 | ||
| 5623 | pub const __builtin_bitreverse32 = struct { | |
| 5624 | const param_str = "UZiUZi"; | |
| 5625 | const attributes = Attributes{ | |
| 5626 | .@"const" = true, | |
| 5627 | .const_evaluable = true, | |
| 5628 | }; | |
| 5629 | }; | |
| 5630 | ||
| 5631 | pub const __builtin_bitreverse64 = struct { | |
| 5632 | const param_str = "UWiUWi"; | |
| 5633 | const attributes = Attributes{ | |
| 5634 | .@"const" = true, | |
| 5635 | .const_evaluable = true, | |
| 5636 | }; | |
| 5637 | }; | |
| 5638 | ||
| 5639 | pub const __builtin_bitreverse8 = struct { | |
| 5640 | const param_str = "UcUc"; | |
| 5641 | const attributes = Attributes{ | |
| 5642 | .@"const" = true, | |
| 5643 | .const_evaluable = true, | |
| 5644 | }; | |
| 5645 | }; | |
| 5646 | ||
| 5647 | pub const __builtin_bpermd = struct { | |
| 5648 | const param_str = "SLLiSLLiSLLi"; | |
| 5649 | const target_set = TargetSet.init(.{ | |
| 5650 | .ppc = true, | |
| 5651 | }); | |
| 5652 | }; | |
| 5653 | ||
| 5654 | pub const __builtin_bswap16 = struct { | |
| 5655 | const param_str = "UsUs"; | |
| 5656 | const attributes = Attributes{ | |
| 5657 | .@"const" = true, | |
| 5658 | .const_evaluable = true, | |
| 5659 | }; | |
| 5660 | }; | |
| 5661 | ||
| 5662 | pub const __builtin_bswap32 = struct { | |
| 5663 | const param_str = "UZiUZi"; | |
| 5664 | const attributes = Attributes{ | |
| 5665 | .@"const" = true, | |
| 5666 | .const_evaluable = true, | |
| 5667 | }; | |
| 5668 | }; | |
| 5669 | ||
| 5670 | pub const __builtin_bswap64 = struct { | |
| 5671 | const param_str = "UWiUWi"; | |
| 5672 | const attributes = Attributes{ | |
| 5673 | .@"const" = true, | |
| 5674 | .const_evaluable = true, | |
| 5675 | }; | |
| 5676 | }; | |
| 5677 | ||
| 5678 | pub const __builtin_bzero = struct { | |
| 5679 | const param_str = "vv*z"; | |
| 5680 | const attributes = Attributes{ | |
| 5681 | .lib_function_with_builtin_prefix = true, | |
| 5682 | }; | |
| 5683 | }; | |
| 5684 | ||
| 5685 | pub const __builtin_cabs = struct { | |
| 5686 | const param_str = "dXd"; | |
| 5687 | const attributes = Attributes{ | |
| 5688 | .lib_function_with_builtin_prefix = true, | |
| 5689 | .const_without_errno_and_fp_exceptions = true, | |
| 5690 | }; | |
| 5691 | }; | |
| 5692 | ||
| 5693 | pub const __builtin_cabsf = struct { | |
| 5694 | const param_str = "fXf"; | |
| 5695 | const attributes = Attributes{ | |
| 5696 | .lib_function_with_builtin_prefix = true, | |
| 5697 | .const_without_errno_and_fp_exceptions = true, | |
| 5698 | }; | |
| 5699 | }; | |
| 5700 | ||
| 5701 | pub const __builtin_cabsl = struct { | |
| 5702 | const param_str = "LdXLd"; | |
| 5703 | const attributes = Attributes{ | |
| 5704 | .lib_function_with_builtin_prefix = true, | |
| 5705 | .const_without_errno_and_fp_exceptions = true, | |
| 5706 | }; | |
| 5707 | }; | |
| 5708 | ||
| 5709 | pub const __builtin_cacos = struct { | |
| 5710 | const param_str = "XdXd"; | |
| 5711 | const attributes = Attributes{ | |
| 5712 | .lib_function_with_builtin_prefix = true, | |
| 5713 | .const_without_errno_and_fp_exceptions = true, | |
| 5714 | }; | |
| 5715 | }; | |
| 5716 | ||
| 5717 | pub const __builtin_cacosf = struct { | |
| 5718 | const param_str = "XfXf"; | |
| 5719 | const attributes = Attributes{ | |
| 5720 | .lib_function_with_builtin_prefix = true, | |
| 5721 | .const_without_errno_and_fp_exceptions = true, | |
| 5722 | }; | |
| 5723 | }; | |
| 5724 | ||
| 5725 | pub const __builtin_cacosh = struct { | |
| 5726 | const param_str = "XdXd"; | |
| 5727 | const attributes = Attributes{ | |
| 5728 | .lib_function_with_builtin_prefix = true, | |
| 5729 | .const_without_errno_and_fp_exceptions = true, | |
| 5730 | }; | |
| 5731 | }; | |
| 5732 | ||
| 5733 | pub const __builtin_cacoshf = struct { | |
| 5734 | const param_str = "XfXf"; | |
| 5735 | const attributes = Attributes{ | |
| 5736 | .lib_function_with_builtin_prefix = true, | |
| 5737 | .const_without_errno_and_fp_exceptions = true, | |
| 5738 | }; | |
| 5739 | }; | |
| 5740 | ||
| 5741 | pub const __builtin_cacoshl = struct { | |
| 5742 | const param_str = "XLdXLd"; | |
| 5743 | const attributes = Attributes{ | |
| 5744 | .lib_function_with_builtin_prefix = true, | |
| 5745 | .const_without_errno_and_fp_exceptions = true, | |
| 5746 | }; | |
| 5747 | }; | |
| 5748 | ||
| 5749 | pub const __builtin_cacosl = struct { | |
| 5750 | const param_str = "XLdXLd"; | |
| 5751 | const attributes = Attributes{ | |
| 5752 | .lib_function_with_builtin_prefix = true, | |
| 5753 | .const_without_errno_and_fp_exceptions = true, | |
| 5754 | }; | |
| 5755 | }; | |
| 5756 | ||
| 5757 | pub const __builtin_call_with_static_chain = struct { | |
| 5758 | const param_str = "v."; | |
| 5759 | const attributes = Attributes{ | |
| 5760 | .custom_typecheck = true, | |
| 5761 | }; | |
| 5762 | }; | |
| 5763 | ||
| 5764 | pub const __builtin_calloc = struct { | |
| 5765 | const param_str = "v*zz"; | |
| 5766 | const attributes = Attributes{ | |
| 5767 | .lib_function_with_builtin_prefix = true, | |
| 5768 | }; | |
| 5769 | }; | |
| 5770 | ||
| 5771 | pub const __builtin_canonicalize = struct { | |
| 5772 | const param_str = "dd"; | |
| 5773 | const attributes = Attributes{ | |
| 5774 | .@"const" = true, | |
| 5775 | }; | |
| 5776 | }; | |
| 5777 | ||
| 5778 | pub const __builtin_canonicalizef = struct { | |
| 5779 | const param_str = "ff"; | |
| 5780 | const attributes = Attributes{ | |
| 5781 | .@"const" = true, | |
| 5782 | }; | |
| 5783 | }; | |
| 5784 | ||
| 5785 | pub const __builtin_canonicalizef16 = struct { | |
| 5786 | const param_str = "hh"; | |
| 5787 | const attributes = Attributes{ | |
| 5788 | .@"const" = true, | |
| 5789 | }; | |
| 5790 | }; | |
| 5791 | ||
| 5792 | pub const __builtin_canonicalizel = struct { | |
| 5793 | const param_str = "LdLd"; | |
| 5794 | const attributes = Attributes{ | |
| 5795 | .@"const" = true, | |
| 5796 | }; | |
| 5797 | }; | |
| 5798 | ||
| 5799 | pub const __builtin_carg = struct { | |
| 5800 | const param_str = "dXd"; | |
| 5801 | const attributes = Attributes{ | |
| 5802 | .lib_function_with_builtin_prefix = true, | |
| 5803 | .const_without_errno_and_fp_exceptions = true, | |
| 5804 | }; | |
| 5805 | }; | |
| 5806 | ||
| 5807 | pub const __builtin_cargf = struct { | |
| 5808 | const param_str = "fXf"; | |
| 5809 | const attributes = Attributes{ | |
| 5810 | .lib_function_with_builtin_prefix = true, | |
| 5811 | .const_without_errno_and_fp_exceptions = true, | |
| 5812 | }; | |
| 5813 | }; | |
| 5814 | ||
| 5815 | pub const __builtin_cargl = struct { | |
| 5816 | const param_str = "LdXLd"; | |
| 5817 | const attributes = Attributes{ | |
| 5818 | .lib_function_with_builtin_prefix = true, | |
| 5819 | .const_without_errno_and_fp_exceptions = true, | |
| 5820 | }; | |
| 5821 | }; | |
| 5822 | ||
| 5823 | pub const __builtin_casin = struct { | |
| 5824 | const param_str = "XdXd"; | |
| 5825 | const attributes = Attributes{ | |
| 5826 | .lib_function_with_builtin_prefix = true, | |
| 5827 | .const_without_errno_and_fp_exceptions = true, | |
| 5828 | }; | |
| 5829 | }; | |
| 5830 | ||
| 5831 | pub const __builtin_casinf = struct { | |
| 5832 | const param_str = "XfXf"; | |
| 5833 | const attributes = Attributes{ | |
| 5834 | .lib_function_with_builtin_prefix = true, | |
| 5835 | .const_without_errno_and_fp_exceptions = true, | |
| 5836 | }; | |
| 5837 | }; | |
| 5838 | ||
| 5839 | pub const __builtin_casinh = struct { | |
| 5840 | const param_str = "XdXd"; | |
| 5841 | const attributes = Attributes{ | |
| 5842 | .lib_function_with_builtin_prefix = true, | |
| 5843 | .const_without_errno_and_fp_exceptions = true, | |
| 5844 | }; | |
| 5845 | }; | |
| 5846 | ||
| 5847 | pub const __builtin_casinhf = struct { | |
| 5848 | const param_str = "XfXf"; | |
| 5849 | const attributes = Attributes{ | |
| 5850 | .lib_function_with_builtin_prefix = true, | |
| 5851 | .const_without_errno_and_fp_exceptions = true, | |
| 5852 | }; | |
| 5853 | }; | |
| 5854 | ||
| 5855 | pub const __builtin_casinhl = struct { | |
| 5856 | const param_str = "XLdXLd"; | |
| 5857 | const attributes = Attributes{ | |
| 5858 | .lib_function_with_builtin_prefix = true, | |
| 5859 | .const_without_errno_and_fp_exceptions = true, | |
| 5860 | }; | |
| 5861 | }; | |
| 5862 | ||
| 5863 | pub const __builtin_casinl = struct { | |
| 5864 | const param_str = "XLdXLd"; | |
| 5865 | const attributes = Attributes{ | |
| 5866 | .lib_function_with_builtin_prefix = true, | |
| 5867 | .const_without_errno_and_fp_exceptions = true, | |
| 5868 | }; | |
| 5869 | }; | |
| 5870 | ||
| 5871 | pub const __builtin_catan = struct { | |
| 5872 | const param_str = "XdXd"; | |
| 5873 | const attributes = Attributes{ | |
| 5874 | .lib_function_with_builtin_prefix = true, | |
| 5875 | .const_without_errno_and_fp_exceptions = true, | |
| 5876 | }; | |
| 5877 | }; | |
| 5878 | ||
| 5879 | pub const __builtin_catanf = struct { | |
| 5880 | const param_str = "XfXf"; | |
| 5881 | const attributes = Attributes{ | |
| 5882 | .lib_function_with_builtin_prefix = true, | |
| 5883 | .const_without_errno_and_fp_exceptions = true, | |
| 5884 | }; | |
| 5885 | }; | |
| 5886 | ||
| 5887 | pub const __builtin_catanh = struct { | |
| 5888 | const param_str = "XdXd"; | |
| 5889 | const attributes = Attributes{ | |
| 5890 | .lib_function_with_builtin_prefix = true, | |
| 5891 | .const_without_errno_and_fp_exceptions = true, | |
| 5892 | }; | |
| 5893 | }; | |
| 5894 | ||
| 5895 | pub const __builtin_catanhf = struct { | |
| 5896 | const param_str = "XfXf"; | |
| 5897 | const attributes = Attributes{ | |
| 5898 | .lib_function_with_builtin_prefix = true, | |
| 5899 | .const_without_errno_and_fp_exceptions = true, | |
| 5900 | }; | |
| 5901 | }; | |
| 5902 | ||
| 5903 | pub const __builtin_catanhl = struct { | |
| 5904 | const param_str = "XLdXLd"; | |
| 5905 | const attributes = Attributes{ | |
| 5906 | .lib_function_with_builtin_prefix = true, | |
| 5907 | .const_without_errno_and_fp_exceptions = true, | |
| 5908 | }; | |
| 5909 | }; | |
| 5910 | ||
| 5911 | pub const __builtin_catanl = struct { | |
| 5912 | const param_str = "XLdXLd"; | |
| 5913 | const attributes = Attributes{ | |
| 5914 | .lib_function_with_builtin_prefix = true, | |
| 5915 | .const_without_errno_and_fp_exceptions = true, | |
| 5916 | }; | |
| 5917 | }; | |
| 5918 | ||
| 5919 | pub const __builtin_cbrt = struct { | |
| 5920 | const param_str = "dd"; | |
| 5921 | const attributes = Attributes{ | |
| 5922 | .@"const" = true, | |
| 5923 | .lib_function_with_builtin_prefix = true, | |
| 5924 | }; | |
| 5925 | }; | |
| 5926 | ||
| 5927 | pub const __builtin_cbrtf = struct { | |
| 5928 | const param_str = "ff"; | |
| 5929 | const attributes = Attributes{ | |
| 5930 | .@"const" = true, | |
| 5931 | .lib_function_with_builtin_prefix = true, | |
| 5932 | }; | |
| 5933 | }; | |
| 5934 | ||
| 5935 | pub const __builtin_cbrtf128 = struct { | |
| 5936 | const param_str = "LLdLLd"; | |
| 5937 | const attributes = Attributes{ | |
| 5938 | .@"const" = true, | |
| 5939 | .lib_function_with_builtin_prefix = true, | |
| 5940 | }; | |
| 5941 | }; | |
| 5942 | ||
| 5943 | pub const __builtin_cbrtl = struct { | |
| 5944 | const param_str = "LdLd"; | |
| 5945 | const attributes = Attributes{ | |
| 5946 | .@"const" = true, | |
| 5947 | .lib_function_with_builtin_prefix = true, | |
| 5948 | }; | |
| 5949 | }; | |
| 5950 | ||
| 5951 | pub const __builtin_ccos = struct { | |
| 5952 | const param_str = "XdXd"; | |
| 5953 | const attributes = Attributes{ | |
| 5954 | .lib_function_with_builtin_prefix = true, | |
| 5955 | .const_without_errno_and_fp_exceptions = true, | |
| 5956 | }; | |
| 5957 | }; | |
| 5958 | ||
| 5959 | pub const __builtin_ccosf = struct { | |
| 5960 | const param_str = "XfXf"; | |
| 5961 | const attributes = Attributes{ | |
| 5962 | .lib_function_with_builtin_prefix = true, | |
| 5963 | .const_without_errno_and_fp_exceptions = true, | |
| 5964 | }; | |
| 5965 | }; | |
| 5966 | ||
| 5967 | pub const __builtin_ccosh = struct { | |
| 5968 | const param_str = "XdXd"; | |
| 5969 | const attributes = Attributes{ | |
| 5970 | .lib_function_with_builtin_prefix = true, | |
| 5971 | .const_without_errno_and_fp_exceptions = true, | |
| 5972 | }; | |
| 5973 | }; | |
| 5974 | ||
| 5975 | pub const __builtin_ccoshf = struct { | |
| 5976 | const param_str = "XfXf"; | |
| 5977 | const attributes = Attributes{ | |
| 5978 | .lib_function_with_builtin_prefix = true, | |
| 5979 | .const_without_errno_and_fp_exceptions = true, | |
| 5980 | }; | |
| 5981 | }; | |
| 5982 | ||
| 5983 | pub const __builtin_ccoshl = struct { | |
| 5984 | const param_str = "XLdXLd"; | |
| 5985 | const attributes = Attributes{ | |
| 5986 | .lib_function_with_builtin_prefix = true, | |
| 5987 | .const_without_errno_and_fp_exceptions = true, | |
| 5988 | }; | |
| 5989 | }; | |
| 5990 | ||
| 5991 | pub const __builtin_ccosl = struct { | |
| 5992 | const param_str = "XLdXLd"; | |
| 5993 | const attributes = Attributes{ | |
| 5994 | .lib_function_with_builtin_prefix = true, | |
| 5995 | .const_without_errno_and_fp_exceptions = true, | |
| 5996 | }; | |
| 5997 | }; | |
| 5998 | ||
| 5999 | pub const __builtin_ceil = struct { | |
| 6000 | const param_str = "dd"; | |
| 6001 | const attributes = Attributes{ | |
| 6002 | .@"const" = true, | |
| 6003 | .lib_function_with_builtin_prefix = true, | |
| 6004 | }; | |
| 6005 | }; | |
| 6006 | ||
| 6007 | pub const __builtin_ceilf = struct { | |
| 6008 | const param_str = "ff"; | |
| 6009 | const attributes = Attributes{ | |
| 6010 | .@"const" = true, | |
| 6011 | .lib_function_with_builtin_prefix = true, | |
| 6012 | }; | |
| 6013 | }; | |
| 6014 | ||
| 6015 | pub const __builtin_ceilf128 = struct { | |
| 6016 | const param_str = "LLdLLd"; | |
| 6017 | const attributes = Attributes{ | |
| 6018 | .@"const" = true, | |
| 6019 | .lib_function_with_builtin_prefix = true, | |
| 6020 | }; | |
| 6021 | }; | |
| 6022 | ||
| 6023 | pub const __builtin_ceilf16 = struct { | |
| 6024 | const param_str = "hh"; | |
| 6025 | const attributes = Attributes{ | |
| 6026 | .@"const" = true, | |
| 6027 | .lib_function_with_builtin_prefix = true, | |
| 6028 | }; | |
| 6029 | }; | |
| 6030 | ||
| 6031 | pub const __builtin_ceill = struct { | |
| 6032 | const param_str = "LdLd"; | |
| 6033 | const attributes = Attributes{ | |
| 6034 | .@"const" = true, | |
| 6035 | .lib_function_with_builtin_prefix = true, | |
| 6036 | }; | |
| 6037 | }; | |
| 6038 | ||
| 6039 | pub const __builtin_cexp = struct { | |
| 6040 | const param_str = "XdXd"; | |
| 6041 | const attributes = Attributes{ | |
| 6042 | .lib_function_with_builtin_prefix = true, | |
| 6043 | .const_without_errno_and_fp_exceptions = true, | |
| 6044 | }; | |
| 6045 | }; | |
| 6046 | ||
| 6047 | pub const __builtin_cexpf = struct { | |
| 6048 | const param_str = "XfXf"; | |
| 6049 | const attributes = Attributes{ | |
| 6050 | .lib_function_with_builtin_prefix = true, | |
| 6051 | .const_without_errno_and_fp_exceptions = true, | |
| 6052 | }; | |
| 6053 | }; | |
| 6054 | ||
| 6055 | pub const __builtin_cexpl = struct { | |
| 6056 | const param_str = "XLdXLd"; | |
| 6057 | const attributes = Attributes{ | |
| 6058 | .lib_function_with_builtin_prefix = true, | |
| 6059 | .const_without_errno_and_fp_exceptions = true, | |
| 6060 | }; | |
| 6061 | }; | |
| 6062 | ||
| 6063 | pub const __builtin_cfuged = struct { | |
| 6064 | const param_str = "ULLiULLiULLi"; | |
| 6065 | const target_set = TargetSet.init(.{ | |
| 6066 | .ppc = true, | |
| 6067 | }); | |
| 6068 | }; | |
| 6069 | ||
| 6070 | pub const __builtin_char_memchr = struct { | |
| 6071 | const param_str = "c*cC*iz"; | |
| 6072 | const attributes = Attributes{ | |
| 6073 | .const_evaluable = true, | |
| 6074 | }; | |
| 6075 | }; | |
| 6076 | ||
| 6077 | pub const __builtin_cimag = struct { | |
| 6078 | const param_str = "dXd"; | |
| 6079 | const attributes = Attributes{ | |
| 6080 | .@"const" = true, | |
| 6081 | .lib_function_with_builtin_prefix = true, | |
| 6082 | }; | |
| 6083 | }; | |
| 6084 | ||
| 6085 | pub const __builtin_cimagf = struct { | |
| 6086 | const param_str = "fXf"; | |
| 6087 | const attributes = Attributes{ | |
| 6088 | .@"const" = true, | |
| 6089 | .lib_function_with_builtin_prefix = true, | |
| 6090 | }; | |
| 6091 | }; | |
| 6092 | ||
| 6093 | pub const __builtin_cimagl = struct { | |
| 6094 | const param_str = "LdXLd"; | |
| 6095 | const attributes = Attributes{ | |
| 6096 | .@"const" = true, | |
| 6097 | .lib_function_with_builtin_prefix = true, | |
| 6098 | }; | |
| 6099 | }; | |
| 6100 | ||
| 6101 | pub const __builtin_classify_type = struct { | |
| 6102 | const param_str = "i."; | |
| 6103 | const attributes = Attributes{ | |
| 6104 | .@"const" = true, | |
| 6105 | .custom_typecheck = true, | |
| 6106 | .eval_args = false, | |
| 6107 | .const_evaluable = true, | |
| 6108 | }; | |
| 6109 | }; | |
| 6110 | ||
| 6111 | pub const __builtin_clog = struct { | |
| 6112 | const param_str = "XdXd"; | |
| 6113 | const attributes = Attributes{ | |
| 6114 | .lib_function_with_builtin_prefix = true, | |
| 6115 | .const_without_errno_and_fp_exceptions = true, | |
| 6116 | }; | |
| 6117 | }; | |
| 6118 | ||
| 6119 | pub const __builtin_clogf = struct { | |
| 6120 | const param_str = "XfXf"; | |
| 6121 | const attributes = Attributes{ | |
| 6122 | .lib_function_with_builtin_prefix = true, | |
| 6123 | .const_without_errno_and_fp_exceptions = true, | |
| 6124 | }; | |
| 6125 | }; | |
| 6126 | ||
| 6127 | pub const __builtin_clogl = struct { | |
| 6128 | const param_str = "XLdXLd"; | |
| 6129 | const attributes = Attributes{ | |
| 6130 | .lib_function_with_builtin_prefix = true, | |
| 6131 | .const_without_errno_and_fp_exceptions = true, | |
| 6132 | }; | |
| 6133 | }; | |
| 6134 | ||
| 6135 | pub const __builtin_clrsb = struct { | |
| 6136 | const param_str = "ii"; | |
| 6137 | const attributes = Attributes{ | |
| 6138 | .@"const" = true, | |
| 6139 | .const_evaluable = true, | |
| 6140 | }; | |
| 6141 | }; | |
| 6142 | ||
| 6143 | pub const __builtin_clrsbl = struct { | |
| 6144 | const param_str = "iLi"; | |
| 6145 | const attributes = Attributes{ | |
| 6146 | .@"const" = true, | |
| 6147 | .const_evaluable = true, | |
| 6148 | }; | |
| 6149 | }; | |
| 6150 | ||
| 6151 | pub const __builtin_clrsbll = struct { | |
| 6152 | const param_str = "iLLi"; | |
| 6153 | const attributes = Attributes{ | |
| 6154 | .@"const" = true, | |
| 6155 | .const_evaluable = true, | |
| 6156 | }; | |
| 6157 | }; | |
| 6158 | ||
| 6159 | pub const __builtin_clz = struct { | |
| 6160 | const param_str = "iUi"; | |
| 6161 | const attributes = Attributes{ | |
| 6162 | .@"const" = true, | |
| 6163 | .const_evaluable = true, | |
| 6164 | }; | |
| 6165 | }; | |
| 6166 | ||
| 6167 | pub const __builtin_clzl = struct { | |
| 6168 | const param_str = "iULi"; | |
| 6169 | const attributes = Attributes{ | |
| 6170 | .@"const" = true, | |
| 6171 | .const_evaluable = true, | |
| 6172 | }; | |
| 6173 | }; | |
| 6174 | ||
| 6175 | pub const __builtin_clzll = struct { | |
| 6176 | const param_str = "iULLi"; | |
| 6177 | const attributes = Attributes{ | |
| 6178 | .@"const" = true, | |
| 6179 | .const_evaluable = true, | |
| 6180 | }; | |
| 6181 | }; | |
| 6182 | ||
| 6183 | pub const __builtin_clzs = struct { | |
| 6184 | const param_str = "iUs"; | |
| 6185 | const attributes = Attributes{ | |
| 6186 | .@"const" = true, | |
| 6187 | .const_evaluable = true, | |
| 6188 | }; | |
| 6189 | }; | |
| 6190 | ||
| 6191 | pub const __builtin_cntlzdm = struct { | |
| 6192 | const param_str = "ULLiULLiULLi"; | |
| 6193 | const target_set = TargetSet.init(.{ | |
| 6194 | .ppc = true, | |
| 6195 | }); | |
| 6196 | }; | |
| 6197 | ||
| 6198 | pub const __builtin_cnttzdm = struct { | |
| 6199 | const param_str = "ULLiULLiULLi"; | |
| 6200 | const target_set = TargetSet.init(.{ | |
| 6201 | .ppc = true, | |
| 6202 | }); | |
| 6203 | }; | |
| 6204 | ||
| 6205 | pub const __builtin_complex = struct { | |
| 6206 | const param_str = "v."; | |
| 6207 | const attributes = Attributes{ | |
| 6208 | .@"const" = true, | |
| 6209 | .custom_typecheck = true, | |
| 6210 | .const_evaluable = true, | |
| 6211 | }; | |
| 6212 | }; | |
| 6213 | ||
| 6214 | pub const __builtin_conj = struct { | |
| 6215 | const param_str = "XdXd"; | |
| 6216 | const attributes = Attributes{ | |
| 6217 | .@"const" = true, | |
| 6218 | .lib_function_with_builtin_prefix = true, | |
| 6219 | }; | |
| 6220 | }; | |
| 6221 | ||
| 6222 | pub const __builtin_conjf = struct { | |
| 6223 | const param_str = "XfXf"; | |
| 6224 | const attributes = Attributes{ | |
| 6225 | .@"const" = true, | |
| 6226 | .lib_function_with_builtin_prefix = true, | |
| 6227 | }; | |
| 6228 | }; | |
| 6229 | ||
| 6230 | pub const __builtin_conjl = struct { | |
| 6231 | const param_str = "XLdXLd"; | |
| 6232 | const attributes = Attributes{ | |
| 6233 | .@"const" = true, | |
| 6234 | .lib_function_with_builtin_prefix = true, | |
| 6235 | }; | |
| 6236 | }; | |
| 6237 | ||
| 6238 | pub const __builtin_constant_p = struct { | |
| 6239 | const param_str = "i."; | |
| 6240 | const attributes = Attributes{ | |
| 6241 | .@"const" = true, | |
| 6242 | .custom_typecheck = true, | |
| 6243 | .eval_args = false, | |
| 6244 | .const_evaluable = true, | |
| 6245 | }; | |
| 6246 | }; | |
| 6247 | ||
| 6248 | pub const __builtin_convertvector = struct { | |
| 6249 | const param_str = "v."; | |
| 6250 | const attributes = Attributes{ | |
| 6251 | .@"const" = true, | |
| 6252 | .custom_typecheck = true, | |
| 6253 | }; | |
| 6254 | }; | |
| 6255 | ||
| 6256 | pub const __builtin_copysign = struct { | |
| 6257 | const param_str = "ddd"; | |
| 6258 | const attributes = Attributes{ | |
| 6259 | .@"const" = true, | |
| 6260 | .lib_function_with_builtin_prefix = true, | |
| 6261 | .const_evaluable = true, | |
| 6262 | }; | |
| 6263 | }; | |
| 6264 | ||
| 6265 | pub const __builtin_copysignf = struct { | |
| 6266 | const param_str = "fff"; | |
| 6267 | const attributes = Attributes{ | |
| 6268 | .@"const" = true, | |
| 6269 | .lib_function_with_builtin_prefix = true, | |
| 6270 | .const_evaluable = true, | |
| 6271 | }; | |
| 6272 | }; | |
| 6273 | ||
| 6274 | pub const __builtin_copysignf128 = struct { | |
| 6275 | const param_str = "LLdLLdLLd"; | |
| 6276 | const attributes = Attributes{ | |
| 6277 | .@"const" = true, | |
| 6278 | .lib_function_with_builtin_prefix = true, | |
| 6279 | .const_evaluable = true, | |
| 6280 | }; | |
| 6281 | }; | |
| 6282 | ||
| 6283 | pub const __builtin_copysignf16 = struct { | |
| 6284 | const param_str = "hhh"; | |
| 6285 | const attributes = Attributes{ | |
| 6286 | .@"const" = true, | |
| 6287 | .lib_function_with_builtin_prefix = true, | |
| 6288 | }; | |
| 6289 | }; | |
| 6290 | ||
| 6291 | pub const __builtin_copysignl = struct { | |
| 6292 | const param_str = "LdLdLd"; | |
| 6293 | const attributes = Attributes{ | |
| 6294 | .@"const" = true, | |
| 6295 | .lib_function_with_builtin_prefix = true, | |
| 6296 | .const_evaluable = true, | |
| 6297 | }; | |
| 6298 | }; | |
| 6299 | ||
| 6300 | pub const __builtin_cos = struct { | |
| 6301 | const param_str = "dd"; | |
| 6302 | const attributes = Attributes{ | |
| 6303 | .lib_function_with_builtin_prefix = true, | |
| 6304 | .const_without_errno_and_fp_exceptions = true, | |
| 6305 | }; | |
| 6306 | }; | |
| 6307 | ||
| 6308 | pub const __builtin_cosf = struct { | |
| 6309 | const param_str = "ff"; | |
| 6310 | const attributes = Attributes{ | |
| 6311 | .lib_function_with_builtin_prefix = true, | |
| 6312 | .const_without_errno_and_fp_exceptions = true, | |
| 6313 | }; | |
| 6314 | }; | |
| 6315 | ||
| 6316 | pub const __builtin_cosf128 = struct { | |
| 6317 | const param_str = "LLdLLd"; | |
| 6318 | const attributes = Attributes{ | |
| 6319 | .lib_function_with_builtin_prefix = true, | |
| 6320 | .const_without_errno_and_fp_exceptions = true, | |
| 6321 | }; | |
| 6322 | }; | |
| 6323 | ||
| 6324 | pub const __builtin_cosf16 = struct { | |
| 6325 | const param_str = "hh"; | |
| 6326 | const attributes = Attributes{ | |
| 6327 | .lib_function_with_builtin_prefix = true, | |
| 6328 | .const_without_errno_and_fp_exceptions = true, | |
| 6329 | }; | |
| 6330 | }; | |
| 6331 | ||
| 6332 | pub const __builtin_cosh = struct { | |
| 6333 | const param_str = "dd"; | |
| 6334 | const attributes = Attributes{ | |
| 6335 | .lib_function_with_builtin_prefix = true, | |
| 6336 | .const_without_errno_and_fp_exceptions = true, | |
| 6337 | }; | |
| 6338 | }; | |
| 6339 | ||
| 6340 | pub const __builtin_coshf = struct { | |
| 6341 | const param_str = "ff"; | |
| 6342 | const attributes = Attributes{ | |
| 6343 | .lib_function_with_builtin_prefix = true, | |
| 6344 | .const_without_errno_and_fp_exceptions = true, | |
| 6345 | }; | |
| 6346 | }; | |
| 6347 | ||
| 6348 | pub const __builtin_coshf128 = struct { | |
| 6349 | const param_str = "LLdLLd"; | |
| 6350 | const attributes = Attributes{ | |
| 6351 | .lib_function_with_builtin_prefix = true, | |
| 6352 | .const_without_errno_and_fp_exceptions = true, | |
| 6353 | }; | |
| 6354 | }; | |
| 6355 | ||
| 6356 | pub const __builtin_coshl = struct { | |
| 6357 | const param_str = "LdLd"; | |
| 6358 | const attributes = Attributes{ | |
| 6359 | .lib_function_with_builtin_prefix = true, | |
| 6360 | .const_without_errno_and_fp_exceptions = true, | |
| 6361 | }; | |
| 6362 | }; | |
| 6363 | ||
| 6364 | pub const __builtin_cosl = struct { | |
| 6365 | const param_str = "LdLd"; | |
| 6366 | const attributes = Attributes{ | |
| 6367 | .lib_function_with_builtin_prefix = true, | |
| 6368 | .const_without_errno_and_fp_exceptions = true, | |
| 6369 | }; | |
| 6370 | }; | |
| 6371 | ||
| 6372 | pub const __builtin_cpow = struct { | |
| 6373 | const param_str = "XdXdXd"; | |
| 6374 | const attributes = Attributes{ | |
| 6375 | .lib_function_with_builtin_prefix = true, | |
| 6376 | .const_without_errno_and_fp_exceptions = true, | |
| 6377 | }; | |
| 6378 | }; | |
| 6379 | ||
| 6380 | pub const __builtin_cpowf = struct { | |
| 6381 | const param_str = "XfXfXf"; | |
| 6382 | const attributes = Attributes{ | |
| 6383 | .lib_function_with_builtin_prefix = true, | |
| 6384 | .const_without_errno_and_fp_exceptions = true, | |
| 6385 | }; | |
| 6386 | }; | |
| 6387 | ||
| 6388 | pub const __builtin_cpowl = struct { | |
| 6389 | const param_str = "XLdXLdXLd"; | |
| 6390 | const attributes = Attributes{ | |
| 6391 | .lib_function_with_builtin_prefix = true, | |
| 6392 | .const_without_errno_and_fp_exceptions = true, | |
| 6393 | }; | |
| 6394 | }; | |
| 6395 | ||
| 6396 | pub const __builtin_cproj = struct { | |
| 6397 | const param_str = "XdXd"; | |
| 6398 | const attributes = Attributes{ | |
| 6399 | .@"const" = true, | |
| 6400 | .lib_function_with_builtin_prefix = true, | |
| 6401 | }; | |
| 6402 | }; | |
| 6403 | ||
| 6404 | pub const __builtin_cprojf = struct { | |
| 6405 | const param_str = "XfXf"; | |
| 6406 | const attributes = Attributes{ | |
| 6407 | .@"const" = true, | |
| 6408 | .lib_function_with_builtin_prefix = true, | |
| 6409 | }; | |
| 6410 | }; | |
| 6411 | ||
| 6412 | pub const __builtin_cprojl = struct { | |
| 6413 | const param_str = "XLdXLd"; | |
| 6414 | const attributes = Attributes{ | |
| 6415 | .@"const" = true, | |
| 6416 | .lib_function_with_builtin_prefix = true, | |
| 6417 | }; | |
| 6418 | }; | |
| 6419 | ||
| 6420 | pub const __builtin_cpu_init = struct { | |
| 6421 | const param_str = "v"; | |
| 6422 | const target_set = TargetSet.init(.{ | |
| 6423 | .x86 = true, | |
| 6424 | }); | |
| 6425 | const attributes = Attributes{}; | |
| 6426 | }; | |
| 6427 | ||
| 6428 | pub const __builtin_cpu_is = struct { | |
| 6429 | const param_str = "bcC*"; | |
| 6430 | const target_set = TargetSet.init(.{ | |
| 6431 | .x86 = true, | |
| 6432 | }); | |
| 6433 | const attributes = Attributes{ | |
| 6434 | .@"const" = true, | |
| 6435 | }; | |
| 6436 | }; | |
| 6437 | ||
| 6438 | pub const __builtin_cpu_supports = struct { | |
| 6439 | const param_str = "bcC*"; | |
| 6440 | const target_set = TargetSet.init(.{ | |
| 6441 | .x86 = true, | |
| 6442 | }); | |
| 6443 | const attributes = Attributes{ | |
| 6444 | .@"const" = true, | |
| 6445 | }; | |
| 6446 | }; | |
| 6447 | ||
| 6448 | pub const __builtin_creal = struct { | |
| 6449 | const param_str = "dXd"; | |
| 6450 | const attributes = Attributes{ | |
| 6451 | .@"const" = true, | |
| 6452 | .lib_function_with_builtin_prefix = true, | |
| 6453 | }; | |
| 6454 | }; | |
| 6455 | ||
| 6456 | pub const __builtin_crealf = struct { | |
| 6457 | const param_str = "fXf"; | |
| 6458 | const attributes = Attributes{ | |
| 6459 | .@"const" = true, | |
| 6460 | .lib_function_with_builtin_prefix = true, | |
| 6461 | }; | |
| 6462 | }; | |
| 6463 | ||
| 6464 | pub const __builtin_creall = struct { | |
| 6465 | const param_str = "LdXLd"; | |
| 6466 | const attributes = Attributes{ | |
| 6467 | .@"const" = true, | |
| 6468 | .lib_function_with_builtin_prefix = true, | |
| 6469 | }; | |
| 6470 | }; | |
| 6471 | ||
| 6472 | pub const __builtin_csin = struct { | |
| 6473 | const param_str = "XdXd"; | |
| 6474 | const attributes = Attributes{ | |
| 6475 | .lib_function_with_builtin_prefix = true, | |
| 6476 | .const_without_errno_and_fp_exceptions = true, | |
| 6477 | }; | |
| 6478 | }; | |
| 6479 | ||
| 6480 | pub const __builtin_csinf = struct { | |
| 6481 | const param_str = "XfXf"; | |
| 6482 | const attributes = Attributes{ | |
| 6483 | .lib_function_with_builtin_prefix = true, | |
| 6484 | .const_without_errno_and_fp_exceptions = true, | |
| 6485 | }; | |
| 6486 | }; | |
| 6487 | ||
| 6488 | pub const __builtin_csinh = struct { | |
| 6489 | const param_str = "XdXd"; | |
| 6490 | const attributes = Attributes{ | |
| 6491 | .lib_function_with_builtin_prefix = true, | |
| 6492 | .const_without_errno_and_fp_exceptions = true, | |
| 6493 | }; | |
| 6494 | }; | |
| 6495 | ||
| 6496 | pub const __builtin_csinhf = struct { | |
| 6497 | const param_str = "XfXf"; | |
| 6498 | const attributes = Attributes{ | |
| 6499 | .lib_function_with_builtin_prefix = true, | |
| 6500 | .const_without_errno_and_fp_exceptions = true, | |
| 6501 | }; | |
| 6502 | }; | |
| 6503 | ||
| 6504 | pub const __builtin_csinhl = struct { | |
| 6505 | const param_str = "XLdXLd"; | |
| 6506 | const attributes = Attributes{ | |
| 6507 | .lib_function_with_builtin_prefix = true, | |
| 6508 | .const_without_errno_and_fp_exceptions = true, | |
| 6509 | }; | |
| 6510 | }; | |
| 6511 | ||
| 6512 | pub const __builtin_csinl = struct { | |
| 6513 | const param_str = "XLdXLd"; | |
| 6514 | const attributes = Attributes{ | |
| 6515 | .lib_function_with_builtin_prefix = true, | |
| 6516 | .const_without_errno_and_fp_exceptions = true, | |
| 6517 | }; | |
| 6518 | }; | |
| 6519 | ||
| 6520 | pub const __builtin_csqrt = struct { | |
| 6521 | const param_str = "XdXd"; | |
| 6522 | const attributes = Attributes{ | |
| 6523 | .lib_function_with_builtin_prefix = true, | |
| 6524 | .const_without_errno_and_fp_exceptions = true, | |
| 6525 | }; | |
| 6526 | }; | |
| 6527 | ||
| 6528 | pub const __builtin_csqrtf = struct { | |
| 6529 | const param_str = "XfXf"; | |
| 6530 | const attributes = Attributes{ | |
| 6531 | .lib_function_with_builtin_prefix = true, | |
| 6532 | .const_without_errno_and_fp_exceptions = true, | |
| 6533 | }; | |
| 6534 | }; | |
| 6535 | ||
| 6536 | pub const __builtin_csqrtl = struct { | |
| 6537 | const param_str = "XLdXLd"; | |
| 6538 | const attributes = Attributes{ | |
| 6539 | .lib_function_with_builtin_prefix = true, | |
| 6540 | .const_without_errno_and_fp_exceptions = true, | |
| 6541 | }; | |
| 6542 | }; | |
| 6543 | ||
| 6544 | pub const __builtin_ctan = struct { | |
| 6545 | const param_str = "XdXd"; | |
| 6546 | const attributes = Attributes{ | |
| 6547 | .lib_function_with_builtin_prefix = true, | |
| 6548 | .const_without_errno_and_fp_exceptions = true, | |
| 6549 | }; | |
| 6550 | }; | |
| 6551 | ||
| 6552 | pub const __builtin_ctanf = struct { | |
| 6553 | const param_str = "XfXf"; | |
| 6554 | const attributes = Attributes{ | |
| 6555 | .lib_function_with_builtin_prefix = true, | |
| 6556 | .const_without_errno_and_fp_exceptions = true, | |
| 6557 | }; | |
| 6558 | }; | |
| 6559 | ||
| 6560 | pub const __builtin_ctanh = struct { | |
| 6561 | const param_str = "XdXd"; | |
| 6562 | const attributes = Attributes{ | |
| 6563 | .lib_function_with_builtin_prefix = true, | |
| 6564 | .const_without_errno_and_fp_exceptions = true, | |
| 6565 | }; | |
| 6566 | }; | |
| 6567 | ||
| 6568 | pub const __builtin_ctanhf = struct { | |
| 6569 | const param_str = "XfXf"; | |
| 6570 | const attributes = Attributes{ | |
| 6571 | .lib_function_with_builtin_prefix = true, | |
| 6572 | .const_without_errno_and_fp_exceptions = true, | |
| 6573 | }; | |
| 6574 | }; | |
| 6575 | ||
| 6576 | pub const __builtin_ctanhl = struct { | |
| 6577 | const param_str = "XLdXLd"; | |
| 6578 | const attributes = Attributes{ | |
| 6579 | .lib_function_with_builtin_prefix = true, | |
| 6580 | .const_without_errno_and_fp_exceptions = true, | |
| 6581 | }; | |
| 6582 | }; | |
| 6583 | ||
| 6584 | pub const __builtin_ctanl = struct { | |
| 6585 | const param_str = "XLdXLd"; | |
| 6586 | const attributes = Attributes{ | |
| 6587 | .lib_function_with_builtin_prefix = true, | |
| 6588 | .const_without_errno_and_fp_exceptions = true, | |
| 6589 | }; | |
| 6590 | }; | |
| 6591 | ||
| 6592 | pub const __builtin_ctz = struct { | |
| 6593 | const param_str = "iUi"; | |
| 6594 | const attributes = Attributes{ | |
| 6595 | .@"const" = true, | |
| 6596 | .const_evaluable = true, | |
| 6597 | }; | |
| 6598 | }; | |
| 6599 | ||
| 6600 | pub const __builtin_ctzl = struct { | |
| 6601 | const param_str = "iULi"; | |
| 6602 | const attributes = Attributes{ | |
| 6603 | .@"const" = true, | |
| 6604 | .const_evaluable = true, | |
| 6605 | }; | |
| 6606 | }; | |
| 6607 | ||
| 6608 | pub const __builtin_ctzll = struct { | |
| 6609 | const param_str = "iULLi"; | |
| 6610 | const attributes = Attributes{ | |
| 6611 | .@"const" = true, | |
| 6612 | .const_evaluable = true, | |
| 6613 | }; | |
| 6614 | }; | |
| 6615 | ||
| 6616 | pub const __builtin_ctzs = struct { | |
| 6617 | const param_str = "iUs"; | |
| 6618 | const attributes = Attributes{ | |
| 6619 | .@"const" = true, | |
| 6620 | .const_evaluable = true, | |
| 6621 | }; | |
| 6622 | }; | |
| 6623 | ||
| 6624 | pub const __builtin_darn = struct { | |
| 6625 | const param_str = "LLi"; | |
| 6626 | const target_set = TargetSet.init(.{ | |
| 6627 | .ppc = true, | |
| 6628 | }); | |
| 6629 | }; | |
| 6630 | ||
| 6631 | pub const __builtin_darn_32 = struct { | |
| 6632 | const param_str = "i"; | |
| 6633 | const target_set = TargetSet.init(.{ | |
| 6634 | .ppc = true, | |
| 6635 | }); | |
| 6636 | }; | |
| 6637 | ||
| 6638 | pub const __builtin_darn_raw = struct { | |
| 6639 | const param_str = "LLi"; | |
| 6640 | const target_set = TargetSet.init(.{ | |
| 6641 | .ppc = true, | |
| 6642 | }); | |
| 6643 | }; | |
| 6644 | ||
| 6645 | pub const __builtin_dcbf = struct { | |
| 6646 | const param_str = "vvC*"; | |
| 6647 | const target_set = TargetSet.init(.{ | |
| 6648 | .ppc = true, | |
| 6649 | }); | |
| 6650 | }; | |
| 6651 | ||
| 6652 | pub const __builtin_debugtrap = struct { | |
| 6653 | const param_str = "v"; | |
| 6654 | const attributes = Attributes{}; | |
| 6655 | }; | |
| 6656 | ||
| 6657 | pub const __builtin_divde = struct { | |
| 6658 | const param_str = "SLLiSLLiSLLi"; | |
| 6659 | const target_set = TargetSet.init(.{ | |
| 6660 | .ppc = true, | |
| 6661 | }); | |
| 6662 | }; | |
| 6663 | ||
| 6664 | pub const __builtin_divdeu = struct { | |
| 6665 | const param_str = "ULLiULLiULLi"; | |
| 6666 | const target_set = TargetSet.init(.{ | |
| 6667 | .ppc = true, | |
| 6668 | }); | |
| 6669 | }; | |
| 6670 | ||
| 6671 | pub const __builtin_divf128_round_to_odd = struct { | |
| 6672 | const param_str = "LLdLLdLLd"; | |
| 6673 | const target_set = TargetSet.init(.{ | |
| 6674 | .ppc = true, | |
| 6675 | }); | |
| 6676 | }; | |
| 6677 | ||
| 6678 | pub const __builtin_divwe = struct { | |
| 6679 | const param_str = "SiSiSi"; | |
| 6680 | const target_set = TargetSet.init(.{ | |
| 6681 | .ppc = true, | |
| 6682 | }); | |
| 6683 | }; | |
| 6684 | ||
| 6685 | pub const __builtin_divweu = struct { | |
| 6686 | const param_str = "UiUiUi"; | |
| 6687 | const target_set = TargetSet.init(.{ | |
| 6688 | .ppc = true, | |
| 6689 | }); | |
| 6690 | }; | |
| 6691 | ||
| 6692 | pub const __builtin_dump_struct = struct { | |
| 6693 | const param_str = "v."; | |
| 6694 | const attributes = Attributes{ | |
| 6695 | .custom_typecheck = true, | |
| 6696 | }; | |
| 6697 | }; | |
| 6698 | ||
| 6699 | pub const __builtin_dwarf_cfa = struct { | |
| 6700 | const param_str = "v*"; | |
| 6701 | const attributes = Attributes{}; | |
| 6702 | }; | |
| 6703 | ||
| 6704 | pub const __builtin_dwarf_sp_column = struct { | |
| 6705 | const param_str = "Ui"; | |
| 6706 | const attributes = Attributes{}; | |
| 6707 | }; | |
| 6708 | ||
| 6709 | pub const __builtin_dynamic_object_size = struct { | |
| 6710 | const param_str = "zvC*i"; | |
| 6711 | const attributes = Attributes{ | |
| 6712 | .eval_args = false, | |
| 6713 | .const_evaluable = true, | |
| 6714 | }; | |
| 6715 | }; | |
| 6716 | ||
| 6717 | pub const __builtin_eh_return = struct { | |
| 6718 | const param_str = "vzv*"; | |
| 6719 | const attributes = Attributes{ | |
| 6720 | .noreturn = true, | |
| 6721 | }; | |
| 6722 | }; | |
| 6723 | ||
| 6724 | pub const __builtin_eh_return_data_regno = struct { | |
| 6725 | const param_str = "iIi"; | |
| 6726 | const attributes = Attributes{ | |
| 6727 | .@"const" = true, | |
| 6728 | .const_evaluable = true, | |
| 6729 | }; | |
| 6730 | }; | |
| 6731 | ||
| 6732 | pub const __builtin_elementwise_abs = struct { | |
| 6733 | const param_str = "v."; | |
| 6734 | const attributes = Attributes{ | |
| 6735 | .@"const" = true, | |
| 6736 | .custom_typecheck = true, | |
| 6737 | }; | |
| 6738 | }; | |
| 6739 | ||
| 6740 | pub const __builtin_elementwise_add_sat = struct { | |
| 6741 | const param_str = "v."; | |
| 6742 | const attributes = Attributes{ | |
| 6743 | .@"const" = true, | |
| 6744 | .custom_typecheck = true, | |
| 6745 | }; | |
| 6746 | }; | |
| 6747 | ||
| 6748 | pub const __builtin_elementwise_canonicalize = struct { | |
| 6749 | const param_str = "v."; | |
| 6750 | const attributes = Attributes{ | |
| 6751 | .@"const" = true, | |
| 6752 | .custom_typecheck = true, | |
| 6753 | }; | |
| 6754 | }; | |
| 6755 | ||
| 6756 | pub const __builtin_elementwise_ceil = struct { | |
| 6757 | const param_str = "v."; | |
| 6758 | const attributes = Attributes{ | |
| 6759 | .@"const" = true, | |
| 6760 | .custom_typecheck = true, | |
| 6761 | }; | |
| 6762 | }; | |
| 6763 | ||
| 6764 | pub const __builtin_elementwise_copysign = struct { | |
| 6765 | const param_str = "v."; | |
| 6766 | const attributes = Attributes{ | |
| 6767 | .@"const" = true, | |
| 6768 | .custom_typecheck = true, | |
| 6769 | }; | |
| 6770 | }; | |
| 6771 | ||
| 6772 | pub const __builtin_elementwise_cos = struct { | |
| 6773 | const param_str = "v."; | |
| 6774 | const attributes = Attributes{ | |
| 6775 | .@"const" = true, | |
| 6776 | .custom_typecheck = true, | |
| 6777 | }; | |
| 6778 | }; | |
| 6779 | ||
| 6780 | pub const __builtin_elementwise_floor = struct { | |
| 6781 | const param_str = "v."; | |
| 6782 | const attributes = Attributes{ | |
| 6783 | .@"const" = true, | |
| 6784 | .custom_typecheck = true, | |
| 6785 | }; | |
| 6786 | }; | |
| 6787 | ||
| 6788 | pub const __builtin_elementwise_max = struct { | |
| 6789 | const param_str = "v."; | |
| 6790 | const attributes = Attributes{ | |
| 6791 | .@"const" = true, | |
| 6792 | .custom_typecheck = true, | |
| 6793 | }; | |
| 6794 | }; | |
| 6795 | ||
| 6796 | pub const __builtin_elementwise_min = struct { | |
| 6797 | const param_str = "v."; | |
| 6798 | const attributes = Attributes{ | |
| 6799 | .@"const" = true, | |
| 6800 | .custom_typecheck = true, | |
| 6801 | }; | |
| 6802 | }; | |
| 6803 | ||
| 6804 | pub const __builtin_elementwise_roundeven = struct { | |
| 6805 | const param_str = "v."; | |
| 6806 | const attributes = Attributes{ | |
| 6807 | .@"const" = true, | |
| 6808 | .custom_typecheck = true, | |
| 6809 | }; | |
| 6810 | }; | |
| 6811 | ||
| 6812 | pub const __builtin_elementwise_sin = struct { | |
| 6813 | const param_str = "v."; | |
| 6814 | const attributes = Attributes{ | |
| 6815 | .@"const" = true, | |
| 6816 | .custom_typecheck = true, | |
| 6817 | }; | |
| 6818 | }; | |
| 6819 | ||
| 6820 | pub const __builtin_elementwise_sub_sat = struct { | |
| 6821 | const param_str = "v."; | |
| 6822 | const attributes = Attributes{ | |
| 6823 | .@"const" = true, | |
| 6824 | .custom_typecheck = true, | |
| 6825 | }; | |
| 6826 | }; | |
| 6827 | ||
| 6828 | pub const __builtin_elementwise_trunc = struct { | |
| 6829 | const param_str = "v."; | |
| 6830 | const attributes = Attributes{ | |
| 6831 | .@"const" = true, | |
| 6832 | .custom_typecheck = true, | |
| 6833 | }; | |
| 6834 | }; | |
| 6835 | ||
| 6836 | pub const __builtin_erf = struct { | |
| 6837 | const param_str = "dd"; | |
| 6838 | const attributes = Attributes{ | |
| 6839 | .lib_function_with_builtin_prefix = true, | |
| 6840 | .const_without_errno_and_fp_exceptions = true, | |
| 6841 | }; | |
| 6842 | }; | |
| 6843 | ||
| 6844 | pub const __builtin_erfc = struct { | |
| 6845 | const param_str = "dd"; | |
| 6846 | const attributes = Attributes{ | |
| 6847 | .lib_function_with_builtin_prefix = true, | |
| 6848 | .const_without_errno_and_fp_exceptions = true, | |
| 6849 | }; | |
| 6850 | }; | |
| 6851 | ||
| 6852 | pub const __builtin_erfcf = struct { | |
| 6853 | const param_str = "ff"; | |
| 6854 | const attributes = Attributes{ | |
| 6855 | .lib_function_with_builtin_prefix = true, | |
| 6856 | .const_without_errno_and_fp_exceptions = true, | |
| 6857 | }; | |
| 6858 | }; | |
| 6859 | ||
| 6860 | pub const __builtin_erfcf128 = struct { | |
| 6861 | const param_str = "LLdLLd"; | |
| 6862 | const attributes = Attributes{ | |
| 6863 | .lib_function_with_builtin_prefix = true, | |
| 6864 | .const_without_errno_and_fp_exceptions = true, | |
| 6865 | }; | |
| 6866 | }; | |
| 6867 | ||
| 6868 | pub const __builtin_erfcl = struct { | |
| 6869 | const param_str = "LdLd"; | |
| 6870 | const attributes = Attributes{ | |
| 6871 | .lib_function_with_builtin_prefix = true, | |
| 6872 | .const_without_errno_and_fp_exceptions = true, | |
| 6873 | }; | |
| 6874 | }; | |
| 6875 | ||
| 6876 | pub const __builtin_erff = struct { | |
| 6877 | const param_str = "ff"; | |
| 6878 | const attributes = Attributes{ | |
| 6879 | .lib_function_with_builtin_prefix = true, | |
| 6880 | .const_without_errno_and_fp_exceptions = true, | |
| 6881 | }; | |
| 6882 | }; | |
| 6883 | ||
| 6884 | pub const __builtin_erff128 = struct { | |
| 6885 | const param_str = "LLdLLd"; | |
| 6886 | const attributes = Attributes{ | |
| 6887 | .lib_function_with_builtin_prefix = true, | |
| 6888 | .const_without_errno_and_fp_exceptions = true, | |
| 6889 | }; | |
| 6890 | }; | |
| 6891 | ||
| 6892 | pub const __builtin_erfl = struct { | |
| 6893 | const param_str = "LdLd"; | |
| 6894 | const attributes = Attributes{ | |
| 6895 | .lib_function_with_builtin_prefix = true, | |
| 6896 | .const_without_errno_and_fp_exceptions = true, | |
| 6897 | }; | |
| 6898 | }; | |
| 6899 | ||
| 6900 | pub const __builtin_exp = struct { | |
| 6901 | const param_str = "dd"; | |
| 6902 | const attributes = Attributes{ | |
| 6903 | .lib_function_with_builtin_prefix = true, | |
| 6904 | .const_without_errno_and_fp_exceptions = true, | |
| 6905 | }; | |
| 6906 | }; | |
| 6907 | ||
| 6908 | pub const __builtin_exp2 = struct { | |
| 6909 | const param_str = "dd"; | |
| 6910 | const attributes = Attributes{ | |
| 6911 | .lib_function_with_builtin_prefix = true, | |
| 6912 | .const_without_errno_and_fp_exceptions = true, | |
| 6913 | }; | |
| 6914 | }; | |
| 6915 | ||
| 6916 | pub const __builtin_exp2f = struct { | |
| 6917 | const param_str = "ff"; | |
| 6918 | const attributes = Attributes{ | |
| 6919 | .lib_function_with_builtin_prefix = true, | |
| 6920 | .const_without_errno_and_fp_exceptions = true, | |
| 6921 | }; | |
| 6922 | }; | |
| 6923 | ||
| 6924 | pub const __builtin_exp2f128 = struct { | |
| 6925 | const param_str = "LLdLLd"; | |
| 6926 | const attributes = Attributes{ | |
| 6927 | .lib_function_with_builtin_prefix = true, | |
| 6928 | .const_without_errno_and_fp_exceptions = true, | |
| 6929 | }; | |
| 6930 | }; | |
| 6931 | ||
| 6932 | pub const __builtin_exp2f16 = struct { | |
| 6933 | const param_str = "hh"; | |
| 6934 | const attributes = Attributes{ | |
| 6935 | .lib_function_with_builtin_prefix = true, | |
| 6936 | .const_without_errno_and_fp_exceptions = true, | |
| 6937 | }; | |
| 6938 | }; | |
| 6939 | ||
| 6940 | pub const __builtin_exp2l = struct { | |
| 6941 | const param_str = "LdLd"; | |
| 6942 | const attributes = Attributes{ | |
| 6943 | .lib_function_with_builtin_prefix = true, | |
| 6944 | .const_without_errno_and_fp_exceptions = true, | |
| 6945 | }; | |
| 6946 | }; | |
| 6947 | ||
| 6948 | pub const __builtin_expect = struct { | |
| 6949 | const param_str = "LiLiLi"; | |
| 6950 | const attributes = Attributes{ | |
| 6951 | .@"const" = true, | |
| 6952 | .const_evaluable = true, | |
| 6953 | }; | |
| 6954 | }; | |
| 6955 | ||
| 6956 | pub const __builtin_expect_with_probability = struct { | |
| 6957 | const param_str = "LiLiLid"; | |
| 6958 | const attributes = Attributes{ | |
| 6959 | .@"const" = true, | |
| 6960 | .const_evaluable = true, | |
| 6961 | }; | |
| 6962 | }; | |
| 6963 | ||
| 6964 | pub const __builtin_expf = struct { | |
| 6965 | const param_str = "ff"; | |
| 6966 | const attributes = Attributes{ | |
| 6967 | .lib_function_with_builtin_prefix = true, | |
| 6968 | .const_without_errno_and_fp_exceptions = true, | |
| 6969 | }; | |
| 6970 | }; | |
| 6971 | ||
| 6972 | pub const __builtin_expf128 = struct { | |
| 6973 | const param_str = "LLdLLd"; | |
| 6974 | const attributes = Attributes{ | |
| 6975 | .lib_function_with_builtin_prefix = true, | |
| 6976 | .const_without_errno_and_fp_exceptions = true, | |
| 6977 | }; | |
| 6978 | }; | |
| 6979 | ||
| 6980 | pub const __builtin_expf16 = struct { | |
| 6981 | const param_str = "hh"; | |
| 6982 | const attributes = Attributes{ | |
| 6983 | .lib_function_with_builtin_prefix = true, | |
| 6984 | .const_without_errno_and_fp_exceptions = true, | |
| 6985 | }; | |
| 6986 | }; | |
| 6987 | ||
| 6988 | pub const __builtin_expl = struct { | |
| 6989 | const param_str = "LdLd"; | |
| 6990 | const attributes = Attributes{ | |
| 6991 | .lib_function_with_builtin_prefix = true, | |
| 6992 | .const_without_errno_and_fp_exceptions = true, | |
| 6993 | }; | |
| 6994 | }; | |
| 6995 | ||
| 6996 | pub const __builtin_expm1 = struct { | |
| 6997 | const param_str = "dd"; | |
| 6998 | const attributes = Attributes{ | |
| 6999 | .lib_function_with_builtin_prefix = true, | |
| 7000 | .const_without_errno_and_fp_exceptions = true, | |
| 7001 | }; | |
| 7002 | }; | |
| 7003 | ||
| 7004 | pub const __builtin_expm1f = struct { | |
| 7005 | const param_str = "ff"; | |
| 7006 | const attributes = Attributes{ | |
| 7007 | .lib_function_with_builtin_prefix = true, | |
| 7008 | .const_without_errno_and_fp_exceptions = true, | |
| 7009 | }; | |
| 7010 | }; | |
| 7011 | ||
| 7012 | pub const __builtin_expm1f128 = struct { | |
| 7013 | const param_str = "LLdLLd"; | |
| 7014 | const attributes = Attributes{ | |
| 7015 | .lib_function_with_builtin_prefix = true, | |
| 7016 | .const_without_errno_and_fp_exceptions = true, | |
| 7017 | }; | |
| 7018 | }; | |
| 7019 | ||
| 7020 | pub const __builtin_expm1l = struct { | |
| 7021 | const param_str = "LdLd"; | |
| 7022 | const attributes = Attributes{ | |
| 7023 | .lib_function_with_builtin_prefix = true, | |
| 7024 | .const_without_errno_and_fp_exceptions = true, | |
| 7025 | }; | |
| 7026 | }; | |
| 7027 | ||
| 7028 | pub const __builtin_extend_pointer = struct { | |
| 7029 | const param_str = "ULLiv*"; | |
| 7030 | const attributes = Attributes{}; | |
| 7031 | }; | |
| 7032 | ||
| 7033 | pub const __builtin_extract_return_addr = struct { | |
| 7034 | const param_str = "v*v*"; | |
| 7035 | const attributes = Attributes{}; | |
| 7036 | }; | |
| 7037 | ||
| 7038 | pub const __builtin_fabs = struct { | |
| 7039 | const param_str = "dd"; | |
| 7040 | const attributes = Attributes{ | |
| 7041 | .@"const" = true, | |
| 7042 | .lib_function_with_builtin_prefix = true, | |
| 7043 | .const_evaluable = true, | |
| 7044 | }; | |
| 7045 | }; | |
| 7046 | ||
| 7047 | pub const __builtin_fabsf = struct { | |
| 7048 | const param_str = "ff"; | |
| 7049 | const attributes = Attributes{ | |
| 7050 | .@"const" = true, | |
| 7051 | .lib_function_with_builtin_prefix = true, | |
| 7052 | .const_evaluable = true, | |
| 7053 | }; | |
| 7054 | }; | |
| 7055 | ||
| 7056 | pub const __builtin_fabsf128 = struct { | |
| 7057 | const param_str = "LLdLLd"; | |
| 7058 | const attributes = Attributes{ | |
| 7059 | .@"const" = true, | |
| 7060 | .lib_function_with_builtin_prefix = true, | |
| 7061 | .const_evaluable = true, | |
| 7062 | }; | |
| 7063 | }; | |
| 7064 | ||
| 7065 | pub const __builtin_fabsf16 = struct { | |
| 7066 | const param_str = "hh"; | |
| 7067 | const attributes = Attributes{ | |
| 7068 | .@"const" = true, | |
| 7069 | .lib_function_with_builtin_prefix = true, | |
| 7070 | }; | |
| 7071 | }; | |
| 7072 | ||
| 7073 | pub const __builtin_fabsl = struct { | |
| 7074 | const param_str = "LdLd"; | |
| 7075 | const attributes = Attributes{ | |
| 7076 | .@"const" = true, | |
| 7077 | .lib_function_with_builtin_prefix = true, | |
| 7078 | .const_evaluable = true, | |
| 7079 | }; | |
| 7080 | }; | |
| 7081 | ||
| 7082 | pub const __builtin_fdim = struct { | |
| 7083 | const param_str = "ddd"; | |
| 7084 | const attributes = Attributes{ | |
| 7085 | .lib_function_with_builtin_prefix = true, | |
| 7086 | .const_without_errno_and_fp_exceptions = true, | |
| 7087 | }; | |
| 7088 | }; | |
| 7089 | ||
| 7090 | pub const __builtin_fdimf = struct { | |
| 7091 | const param_str = "fff"; | |
| 7092 | const attributes = Attributes{ | |
| 7093 | .lib_function_with_builtin_prefix = true, | |
| 7094 | .const_without_errno_and_fp_exceptions = true, | |
| 7095 | }; | |
| 7096 | }; | |
| 7097 | ||
| 7098 | pub const __builtin_fdimf128 = struct { | |
| 7099 | const param_str = "LLdLLdLLd"; | |
| 7100 | const attributes = Attributes{ | |
| 7101 | .lib_function_with_builtin_prefix = true, | |
| 7102 | .const_without_errno_and_fp_exceptions = true, | |
| 7103 | }; | |
| 7104 | }; | |
| 7105 | ||
| 7106 | pub const __builtin_fdiml = struct { | |
| 7107 | const param_str = "LdLdLd"; | |
| 7108 | const attributes = Attributes{ | |
| 7109 | .lib_function_with_builtin_prefix = true, | |
| 7110 | .const_without_errno_and_fp_exceptions = true, | |
| 7111 | }; | |
| 7112 | }; | |
| 7113 | ||
| 7114 | pub const __builtin_ffs = struct { | |
| 7115 | const param_str = "ii"; | |
| 7116 | const attributes = Attributes{ | |
| 7117 | .@"const" = true, | |
| 7118 | .lib_function_with_builtin_prefix = true, | |
| 7119 | .const_evaluable = true, | |
| 7120 | }; | |
| 7121 | }; | |
| 7122 | ||
| 7123 | pub const __builtin_ffsl = struct { | |
| 7124 | const param_str = "iLi"; | |
| 7125 | const attributes = Attributes{ | |
| 7126 | .@"const" = true, | |
| 7127 | .lib_function_with_builtin_prefix = true, | |
| 7128 | .const_evaluable = true, | |
| 7129 | }; | |
| 7130 | }; | |
| 7131 | ||
| 7132 | pub const __builtin_ffsll = struct { | |
| 7133 | const param_str = "iLLi"; | |
| 7134 | const attributes = Attributes{ | |
| 7135 | .@"const" = true, | |
| 7136 | .lib_function_with_builtin_prefix = true, | |
| 7137 | .const_evaluable = true, | |
| 7138 | }; | |
| 7139 | }; | |
| 7140 | ||
| 7141 | pub const __builtin_floor = struct { | |
| 7142 | const param_str = "dd"; | |
| 7143 | const attributes = Attributes{ | |
| 7144 | .@"const" = true, | |
| 7145 | .lib_function_with_builtin_prefix = true, | |
| 7146 | }; | |
| 7147 | }; | |
| 7148 | ||
| 7149 | pub const __builtin_floorf = struct { | |
| 7150 | const param_str = "ff"; | |
| 7151 | const attributes = Attributes{ | |
| 7152 | .@"const" = true, | |
| 7153 | .lib_function_with_builtin_prefix = true, | |
| 7154 | }; | |
| 7155 | }; | |
| 7156 | ||
| 7157 | pub const __builtin_floorf128 = struct { | |
| 7158 | const param_str = "LLdLLd"; | |
| 7159 | const attributes = Attributes{ | |
| 7160 | .@"const" = true, | |
| 7161 | .lib_function_with_builtin_prefix = true, | |
| 7162 | }; | |
| 7163 | }; | |
| 7164 | ||
| 7165 | pub const __builtin_floorf16 = struct { | |
| 7166 | const param_str = "hh"; | |
| 7167 | const attributes = Attributes{ | |
| 7168 | .@"const" = true, | |
| 7169 | .lib_function_with_builtin_prefix = true, | |
| 7170 | }; | |
| 7171 | }; | |
| 7172 | ||
| 7173 | pub const __builtin_floorl = struct { | |
| 7174 | const param_str = "LdLd"; | |
| 7175 | const attributes = Attributes{ | |
| 7176 | .@"const" = true, | |
| 7177 | .lib_function_with_builtin_prefix = true, | |
| 7178 | }; | |
| 7179 | }; | |
| 7180 | ||
| 7181 | pub const __builtin_flt_rounds = struct { | |
| 7182 | const param_str = "i"; | |
| 7183 | const attributes = Attributes{}; | |
| 7184 | }; | |
| 7185 | ||
| 7186 | pub const __builtin_fma = struct { | |
| 7187 | const param_str = "dddd"; | |
| 7188 | const attributes = Attributes{ | |
| 7189 | .lib_function_with_builtin_prefix = true, | |
| 7190 | .const_without_errno_and_fp_exceptions = true, | |
| 7191 | }; | |
| 7192 | }; | |
| 7193 | ||
| 7194 | pub const __builtin_fmaf = struct { | |
| 7195 | const param_str = "ffff"; | |
| 7196 | const attributes = Attributes{ | |
| 7197 | .lib_function_with_builtin_prefix = true, | |
| 7198 | .const_without_errno_and_fp_exceptions = true, | |
| 7199 | }; | |
| 7200 | }; | |
| 7201 | ||
| 7202 | pub const __builtin_fmaf128 = struct { | |
| 7203 | const param_str = "LLdLLdLLdLLd"; | |
| 7204 | const attributes = Attributes{ | |
| 7205 | .lib_function_with_builtin_prefix = true, | |
| 7206 | .const_without_errno_and_fp_exceptions = true, | |
| 7207 | }; | |
| 7208 | }; | |
| 7209 | ||
| 7210 | pub const __builtin_fmaf128_round_to_odd = struct { | |
| 7211 | const param_str = "LLdLLdLLdLLd"; | |
| 7212 | const target_set = TargetSet.init(.{ | |
| 7213 | .ppc = true, | |
| 7214 | }); | |
| 7215 | }; | |
| 7216 | ||
| 7217 | pub const __builtin_fmaf16 = struct { | |
| 7218 | const param_str = "hhhh"; | |
| 7219 | const attributes = Attributes{ | |
| 7220 | .lib_function_with_builtin_prefix = true, | |
| 7221 | .const_without_errno_and_fp_exceptions = true, | |
| 7222 | }; | |
| 7223 | }; | |
| 7224 | ||
| 7225 | pub const __builtin_fmal = struct { | |
| 7226 | const param_str = "LdLdLdLd"; | |
| 7227 | const attributes = Attributes{ | |
| 7228 | .lib_function_with_builtin_prefix = true, | |
| 7229 | .const_without_errno_and_fp_exceptions = true, | |
| 7230 | }; | |
| 7231 | }; | |
| 7232 | ||
| 7233 | pub const __builtin_fmax = struct { | |
| 7234 | const param_str = "ddd"; | |
| 7235 | const attributes = Attributes{ | |
| 7236 | .@"const" = true, | |
| 7237 | .lib_function_with_builtin_prefix = true, | |
| 7238 | .const_evaluable = true, | |
| 7239 | }; | |
| 7240 | }; | |
| 7241 | ||
| 7242 | pub const __builtin_fmaxf = struct { | |
| 7243 | const param_str = "fff"; | |
| 7244 | const attributes = Attributes{ | |
| 7245 | .@"const" = true, | |
| 7246 | .lib_function_with_builtin_prefix = true, | |
| 7247 | .const_evaluable = true, | |
| 7248 | }; | |
| 7249 | }; | |
| 7250 | ||
| 7251 | pub const __builtin_fmaxf128 = struct { | |
| 7252 | const param_str = "LLdLLdLLd"; | |
| 7253 | const attributes = Attributes{ | |
| 7254 | .@"const" = true, | |
| 7255 | .lib_function_with_builtin_prefix = true, | |
| 7256 | .const_evaluable = true, | |
| 7257 | }; | |
| 7258 | }; | |
| 7259 | ||
| 7260 | pub const __builtin_fmaxf16 = struct { | |
| 7261 | const param_str = "hhh"; | |
| 7262 | const attributes = Attributes{ | |
| 7263 | .@"const" = true, | |
| 7264 | .lib_function_with_builtin_prefix = true, | |
| 7265 | .const_evaluable = true, | |
| 7266 | }; | |
| 7267 | }; | |
| 7268 | ||
| 7269 | pub const __builtin_fmaxl = struct { | |
| 7270 | const param_str = "LdLdLd"; | |
| 7271 | const attributes = Attributes{ | |
| 7272 | .@"const" = true, | |
| 7273 | .lib_function_with_builtin_prefix = true, | |
| 7274 | .const_evaluable = true, | |
| 7275 | }; | |
| 7276 | }; | |
| 7277 | ||
| 7278 | pub const __builtin_fmin = struct { | |
| 7279 | const param_str = "ddd"; | |
| 7280 | const attributes = Attributes{ | |
| 7281 | .@"const" = true, | |
| 7282 | .lib_function_with_builtin_prefix = true, | |
| 7283 | .const_evaluable = true, | |
| 7284 | }; | |
| 7285 | }; | |
| 7286 | ||
| 7287 | pub const __builtin_fminf = struct { | |
| 7288 | const param_str = "fff"; | |
| 7289 | const attributes = Attributes{ | |
| 7290 | .@"const" = true, | |
| 7291 | .lib_function_with_builtin_prefix = true, | |
| 7292 | .const_evaluable = true, | |
| 7293 | }; | |
| 7294 | }; | |
| 7295 | ||
| 7296 | pub const __builtin_fminf128 = struct { | |
| 7297 | const param_str = "LLdLLdLLd"; | |
| 7298 | const attributes = Attributes{ | |
| 7299 | .@"const" = true, | |
| 7300 | .lib_function_with_builtin_prefix = true, | |
| 7301 | .const_evaluable = true, | |
| 7302 | }; | |
| 7303 | }; | |
| 7304 | ||
| 7305 | pub const __builtin_fminf16 = struct { | |
| 7306 | const param_str = "hhh"; | |
| 7307 | const attributes = Attributes{ | |
| 7308 | .@"const" = true, | |
| 7309 | .lib_function_with_builtin_prefix = true, | |
| 7310 | .const_evaluable = true, | |
| 7311 | }; | |
| 7312 | }; | |
| 7313 | ||
| 7314 | pub const __builtin_fminl = struct { | |
| 7315 | const param_str = "LdLdLd"; | |
| 7316 | const attributes = Attributes{ | |
| 7317 | .@"const" = true, | |
| 7318 | .lib_function_with_builtin_prefix = true, | |
| 7319 | .const_evaluable = true, | |
| 7320 | }; | |
| 7321 | }; | |
| 7322 | ||
| 7323 | pub const __builtin_fmod = struct { | |
| 7324 | const param_str = "ddd"; | |
| 7325 | const attributes = Attributes{ | |
| 7326 | .lib_function_with_builtin_prefix = true, | |
| 7327 | .const_without_errno_and_fp_exceptions = true, | |
| 7328 | }; | |
| 7329 | }; | |
| 7330 | ||
| 7331 | pub const __builtin_fmodf = struct { | |
| 7332 | const param_str = "fff"; | |
| 7333 | const attributes = Attributes{ | |
| 7334 | .lib_function_with_builtin_prefix = true, | |
| 7335 | .const_without_errno_and_fp_exceptions = true, | |
| 7336 | }; | |
| 7337 | }; | |
| 7338 | ||
| 7339 | pub const __builtin_fmodf128 = struct { | |
| 7340 | const param_str = "LLdLLdLLd"; | |
| 7341 | const attributes = Attributes{ | |
| 7342 | .lib_function_with_builtin_prefix = true, | |
| 7343 | .const_without_errno_and_fp_exceptions = true, | |
| 7344 | }; | |
| 7345 | }; | |
| 7346 | ||
| 7347 | pub const __builtin_fmodf16 = struct { | |
| 7348 | const param_str = "hhh"; | |
| 7349 | const attributes = Attributes{ | |
| 7350 | .lib_function_with_builtin_prefix = true, | |
| 7351 | .const_without_errno_and_fp_exceptions = true, | |
| 7352 | }; | |
| 7353 | }; | |
| 7354 | ||
| 7355 | pub const __builtin_fmodl = struct { | |
| 7356 | const param_str = "LdLdLd"; | |
| 7357 | const attributes = Attributes{ | |
| 7358 | .lib_function_with_builtin_prefix = true, | |
| 7359 | .const_without_errno_and_fp_exceptions = true, | |
| 7360 | }; | |
| 7361 | }; | |
| 7362 | ||
| 7363 | pub const __builtin_fpclassify = struct { | |
| 7364 | const param_str = "iiiiii."; | |
| 7365 | const attributes = Attributes{ | |
| 7366 | .@"const" = true, | |
| 7367 | .custom_typecheck = true, | |
| 7368 | .lib_function_with_builtin_prefix = true, | |
| 7369 | .const_evaluable = true, | |
| 7370 | }; | |
| 7371 | }; | |
| 7372 | ||
| 7373 | pub const __builtin_fprintf = struct { | |
| 7374 | const param_str = "iP*cC*."; | |
| 7375 | const attributes = Attributes{ | |
| 7376 | .lib_function_with_builtin_prefix = true, | |
| 7377 | .format_kind = .printf, | |
| 7378 | .format_string_position = 1, | |
| 7379 | }; | |
| 7380 | }; | |
| 7381 | ||
| 7382 | pub const __builtin_frame_address = struct { | |
| 7383 | const param_str = "v*IUi"; | |
| 7384 | const attributes = Attributes{}; | |
| 7385 | }; | |
| 7386 | ||
| 7387 | pub const __builtin_free = struct { | |
| 7388 | const param_str = "vv*"; | |
| 7389 | const attributes = Attributes{ | |
| 7390 | .lib_function_with_builtin_prefix = true, | |
| 7391 | }; | |
| 7392 | }; | |
| 7393 | ||
| 7394 | pub const __builtin_frexp = struct { | |
| 7395 | const param_str = "ddi*"; | |
| 7396 | const attributes = Attributes{ | |
| 7397 | .lib_function_with_builtin_prefix = true, | |
| 7398 | }; | |
| 7399 | }; | |
| 7400 | ||
| 7401 | pub const __builtin_frexpf = struct { | |
| 7402 | const param_str = "ffi*"; | |
| 7403 | const attributes = Attributes{ | |
| 7404 | .lib_function_with_builtin_prefix = true, | |
| 7405 | }; | |
| 7406 | }; | |
| 7407 | ||
| 7408 | pub const __builtin_frexpf128 = struct { | |
| 7409 | const param_str = "LLdLLdi*"; | |
| 7410 | const attributes = Attributes{ | |
| 7411 | .lib_function_with_builtin_prefix = true, | |
| 7412 | }; | |
| 7413 | }; | |
| 7414 | ||
| 7415 | pub const __builtin_frexpl = struct { | |
| 7416 | const param_str = "LdLdi*"; | |
| 7417 | const attributes = Attributes{ | |
| 7418 | .lib_function_with_builtin_prefix = true, | |
| 7419 | }; | |
| 7420 | }; | |
| 7421 | ||
| 7422 | pub const __builtin_frob_return_addr = struct { | |
| 7423 | const param_str = "v*v*"; | |
| 7424 | const attributes = Attributes{}; | |
| 7425 | }; | |
| 7426 | ||
| 7427 | pub const __builtin_get_texasr = struct { | |
| 7428 | const param_str = "LUi"; | |
| 7429 | const target_set = TargetSet.init(.{ | |
| 7430 | .ppc = true, | |
| 7431 | }); | |
| 7432 | const attributes = Attributes{ | |
| 7433 | .@"const" = true, | |
| 7434 | }; | |
| 7435 | }; | |
| 7436 | ||
| 7437 | pub const __builtin_get_texasru = struct { | |
| 7438 | const param_str = "LUi"; | |
| 7439 | const target_set = TargetSet.init(.{ | |
| 7440 | .ppc = true, | |
| 7441 | }); | |
| 7442 | const attributes = Attributes{ | |
| 7443 | .@"const" = true, | |
| 7444 | }; | |
| 7445 | }; | |
| 7446 | ||
| 7447 | pub const __builtin_get_tfhar = struct { | |
| 7448 | const param_str = "LUi"; | |
| 7449 | const target_set = TargetSet.init(.{ | |
| 7450 | .ppc = true, | |
| 7451 | }); | |
| 7452 | const attributes = Attributes{ | |
| 7453 | .@"const" = true, | |
| 7454 | }; | |
| 7455 | }; | |
| 7456 | ||
| 7457 | pub const __builtin_get_tfiar = struct { | |
| 7458 | const param_str = "LUi"; | |
| 7459 | const target_set = TargetSet.init(.{ | |
| 7460 | .ppc = true, | |
| 7461 | }); | |
| 7462 | const attributes = Attributes{ | |
| 7463 | .@"const" = true, | |
| 7464 | }; | |
| 7465 | }; | |
| 7466 | ||
| 7467 | pub const __builtin_getid = struct { | |
| 7468 | const param_str = "Si"; | |
| 7469 | const target_set = TargetSet.init(.{ | |
| 7470 | .xcore = true, | |
| 7471 | }); | |
| 7472 | const attributes = Attributes{ | |
| 7473 | .@"const" = true, | |
| 7474 | }; | |
| 7475 | }; | |
| 7476 | ||
| 7477 | pub const __builtin_getps = struct { | |
| 7478 | const param_str = "UiUi"; | |
| 7479 | const target_set = TargetSet.init(.{ | |
| 7480 | .xcore = true, | |
| 7481 | }); | |
| 7482 | const attributes = Attributes{}; | |
| 7483 | }; | |
| 7484 | ||
| 7485 | pub const __builtin_huge_val = struct { | |
| 7486 | const param_str = "d"; | |
| 7487 | const attributes = Attributes{ | |
| 7488 | .@"const" = true, | |
| 7489 | .const_evaluable = true, | |
| 7490 | }; | |
| 7491 | }; | |
| 7492 | ||
| 7493 | pub const __builtin_huge_valf = struct { | |
| 7494 | const param_str = "f"; | |
| 7495 | const attributes = Attributes{ | |
| 7496 | .@"const" = true, | |
| 7497 | .const_evaluable = true, | |
| 7498 | }; | |
| 7499 | }; | |
| 7500 | ||
| 7501 | pub const __builtin_huge_valf128 = struct { | |
| 7502 | const param_str = "LLd"; | |
| 7503 | const attributes = Attributes{ | |
| 7504 | .@"const" = true, | |
| 7505 | .const_evaluable = true, | |
| 7506 | }; | |
| 7507 | }; | |
| 7508 | ||
| 7509 | pub const __builtin_huge_valf16 = struct { | |
| 7510 | const param_str = "x"; | |
| 7511 | const attributes = Attributes{ | |
| 7512 | .@"const" = true, | |
| 7513 | .const_evaluable = true, | |
| 7514 | }; | |
| 7515 | }; | |
| 7516 | ||
| 7517 | pub const __builtin_huge_vall = struct { | |
| 7518 | const param_str = "Ld"; | |
| 7519 | const attributes = Attributes{ | |
| 7520 | .@"const" = true, | |
| 7521 | .const_evaluable = true, | |
| 7522 | }; | |
| 7523 | }; | |
| 7524 | ||
| 7525 | pub const __builtin_hypot = struct { | |
| 7526 | const param_str = "ddd"; | |
| 7527 | const attributes = Attributes{ | |
| 7528 | .lib_function_with_builtin_prefix = true, | |
| 7529 | .const_without_errno_and_fp_exceptions = true, | |
| 7530 | }; | |
| 7531 | }; | |
| 7532 | ||
| 7533 | pub const __builtin_hypotf = struct { | |
| 7534 | const param_str = "fff"; | |
| 7535 | const attributes = Attributes{ | |
| 7536 | .lib_function_with_builtin_prefix = true, | |
| 7537 | .const_without_errno_and_fp_exceptions = true, | |
| 7538 | }; | |
| 7539 | }; | |
| 7540 | ||
| 7541 | pub const __builtin_hypotf128 = struct { | |
| 7542 | const param_str = "LLdLLdLLd"; | |
| 7543 | const attributes = Attributes{ | |
| 7544 | .lib_function_with_builtin_prefix = true, | |
| 7545 | .const_without_errno_and_fp_exceptions = true, | |
| 7546 | }; | |
| 7547 | }; | |
| 7548 | ||
| 7549 | pub const __builtin_hypotl = struct { | |
| 7550 | const param_str = "LdLdLd"; | |
| 7551 | const attributes = Attributes{ | |
| 7552 | .lib_function_with_builtin_prefix = true, | |
| 7553 | .const_without_errno_and_fp_exceptions = true, | |
| 7554 | }; | |
| 7555 | }; | |
| 7556 | ||
| 7557 | pub const __builtin_ia32_rdpmc = struct { | |
| 7558 | const param_str = "UOii"; | |
| 7559 | const target_set = TargetSet.init(.{ | |
| 7560 | .x86 = true, | |
| 7561 | }); | |
| 7562 | }; | |
| 7563 | ||
| 7564 | pub const __builtin_ia32_rdtsc = struct { | |
| 7565 | const param_str = "UOi"; | |
| 7566 | const target_set = TargetSet.init(.{ | |
| 7567 | .x86 = true, | |
| 7568 | }); | |
| 7569 | }; | |
| 7570 | ||
| 7571 | pub const __builtin_ia32_rdtscp = struct { | |
| 7572 | const param_str = "UOiUi*"; | |
| 7573 | const target_set = TargetSet.init(.{ | |
| 7574 | .x86 = true, | |
| 7575 | }); | |
| 7576 | }; | |
| 7577 | ||
| 7578 | pub const __builtin_ilogb = struct { | |
| 7579 | const param_str = "id"; | |
| 7580 | const attributes = Attributes{ | |
| 7581 | .lib_function_with_builtin_prefix = true, | |
| 7582 | .const_without_errno_and_fp_exceptions = true, | |
| 7583 | }; | |
| 7584 | }; | |
| 7585 | ||
| 7586 | pub const __builtin_ilogbf = struct { | |
| 7587 | const param_str = "if"; | |
| 7588 | const attributes = Attributes{ | |
| 7589 | .lib_function_with_builtin_prefix = true, | |
| 7590 | .const_without_errno_and_fp_exceptions = true, | |
| 7591 | }; | |
| 7592 | }; | |
| 7593 | ||
| 7594 | pub const __builtin_ilogbf128 = struct { | |
| 7595 | const param_str = "iLLd"; | |
| 7596 | const attributes = Attributes{ | |
| 7597 | .lib_function_with_builtin_prefix = true, | |
| 7598 | .const_without_errno_and_fp_exceptions = true, | |
| 7599 | }; | |
| 7600 | }; | |
| 7601 | ||
| 7602 | pub const __builtin_ilogbl = struct { | |
| 7603 | const param_str = "iLd"; | |
| 7604 | const attributes = Attributes{ | |
| 7605 | .lib_function_with_builtin_prefix = true, | |
| 7606 | .const_without_errno_and_fp_exceptions = true, | |
| 7607 | }; | |
| 7608 | }; | |
| 7609 | ||
| 7610 | pub const __builtin_index = struct { | |
| 7611 | const param_str = "c*cC*i"; | |
| 7612 | const attributes = Attributes{ | |
| 7613 | .lib_function_with_builtin_prefix = true, | |
| 7614 | }; | |
| 7615 | }; | |
| 7616 | ||
| 7617 | pub const __builtin_inf = struct { | |
| 7618 | const param_str = "d"; | |
| 7619 | const attributes = Attributes{ | |
| 7620 | .@"const" = true, | |
| 7621 | .const_evaluable = true, | |
| 7622 | }; | |
| 7623 | }; | |
| 7624 | ||
| 7625 | pub const __builtin_inff = struct { | |
| 7626 | const param_str = "f"; | |
| 7627 | const attributes = Attributes{ | |
| 7628 | .@"const" = true, | |
| 7629 | .const_evaluable = true, | |
| 7630 | }; | |
| 7631 | }; | |
| 7632 | ||
| 7633 | pub const __builtin_inff128 = struct { | |
| 7634 | const param_str = "LLd"; | |
| 7635 | const attributes = Attributes{ | |
| 7636 | .@"const" = true, | |
| 7637 | .const_evaluable = true, | |
| 7638 | }; | |
| 7639 | }; | |
| 7640 | ||
| 7641 | pub const __builtin_inff16 = struct { | |
| 7642 | const param_str = "x"; | |
| 7643 | const attributes = Attributes{ | |
| 7644 | .@"const" = true, | |
| 7645 | .const_evaluable = true, | |
| 7646 | }; | |
| 7647 | }; | |
| 7648 | ||
| 7649 | pub const __builtin_infl = struct { | |
| 7650 | const param_str = "Ld"; | |
| 7651 | const attributes = Attributes{ | |
| 7652 | .@"const" = true, | |
| 7653 | .const_evaluable = true, | |
| 7654 | }; | |
| 7655 | }; | |
| 7656 | ||
| 7657 | pub const __builtin_init_dwarf_reg_size_table = struct { | |
| 7658 | const param_str = "vv*"; | |
| 7659 | const attributes = Attributes{}; | |
| 7660 | }; | |
| 7661 | ||
| 7662 | pub const __builtin_is_aligned = struct { | |
| 7663 | const param_str = "bvC*z"; | |
| 7664 | const attributes = Attributes{ | |
| 7665 | .@"const" = true, | |
| 7666 | .custom_typecheck = true, | |
| 7667 | .const_evaluable = true, | |
| 7668 | }; | |
| 7669 | }; | |
| 7670 | ||
| 7671 | pub const __builtin_isfinite = struct { | |
| 7672 | const param_str = "i."; | |
| 7673 | const attributes = Attributes{ | |
| 7674 | .@"const" = true, | |
| 7675 | .custom_typecheck = true, | |
| 7676 | .lib_function_with_builtin_prefix = true, | |
| 7677 | .const_evaluable = true, | |
| 7678 | }; | |
| 7679 | }; | |
| 7680 | ||
| 7681 | pub const __builtin_isgreater = struct { | |
| 7682 | const param_str = "i."; | |
| 7683 | const attributes = Attributes{ | |
| 7684 | .@"const" = true, | |
| 7685 | .custom_typecheck = true, | |
| 7686 | .lib_function_with_builtin_prefix = true, | |
| 7687 | }; | |
| 7688 | }; | |
| 7689 | ||
| 7690 | pub const __builtin_isgreaterequal = struct { | |
| 7691 | const param_str = "i."; | |
| 7692 | const attributes = Attributes{ | |
| 7693 | .@"const" = true, | |
| 7694 | .custom_typecheck = true, | |
| 7695 | .lib_function_with_builtin_prefix = true, | |
| 7696 | }; | |
| 7697 | }; | |
| 7698 | ||
| 7699 | pub const __builtin_isinf = struct { | |
| 7700 | const param_str = "i."; | |
| 7701 | const attributes = Attributes{ | |
| 7702 | .@"const" = true, | |
| 7703 | .custom_typecheck = true, | |
| 7704 | .lib_function_with_builtin_prefix = true, | |
| 7705 | .const_evaluable = true, | |
| 7706 | }; | |
| 7707 | }; | |
| 7708 | ||
| 7709 | pub const __builtin_isinf_sign = struct { | |
| 7710 | const param_str = "i."; | |
| 7711 | const attributes = Attributes{ | |
| 7712 | .@"const" = true, | |
| 7713 | .custom_typecheck = true, | |
| 7714 | .lib_function_with_builtin_prefix = true, | |
| 7715 | .const_evaluable = true, | |
| 7716 | }; | |
| 7717 | }; | |
| 7718 | ||
| 7719 | pub const __builtin_isless = struct { | |
| 7720 | const param_str = "i."; | |
| 7721 | const attributes = Attributes{ | |
| 7722 | .@"const" = true, | |
| 7723 | .custom_typecheck = true, | |
| 7724 | .lib_function_with_builtin_prefix = true, | |
| 7725 | }; | |
| 7726 | }; | |
| 7727 | ||
| 7728 | pub const __builtin_islessequal = struct { | |
| 7729 | const param_str = "i."; | |
| 7730 | const attributes = Attributes{ | |
| 7731 | .@"const" = true, | |
| 7732 | .custom_typecheck = true, | |
| 7733 | .lib_function_with_builtin_prefix = true, | |
| 7734 | }; | |
| 7735 | }; | |
| 7736 | ||
| 7737 | pub const __builtin_islessgreater = struct { | |
| 7738 | const param_str = "i."; | |
| 7739 | const attributes = Attributes{ | |
| 7740 | .@"const" = true, | |
| 7741 | .custom_typecheck = true, | |
| 7742 | .lib_function_with_builtin_prefix = true, | |
| 7743 | }; | |
| 7744 | }; | |
| 7745 | ||
| 7746 | pub const __builtin_isnan = struct { | |
| 7747 | const param_str = "i."; | |
| 7748 | const attributes = Attributes{ | |
| 7749 | .@"const" = true, | |
| 7750 | .custom_typecheck = true, | |
| 7751 | .lib_function_with_builtin_prefix = true, | |
| 7752 | .const_evaluable = true, | |
| 7753 | }; | |
| 7754 | }; | |
| 7755 | ||
| 7756 | pub const __builtin_isnormal = struct { | |
| 7757 | const param_str = "i."; | |
| 7758 | const attributes = Attributes{ | |
| 7759 | .@"const" = true, | |
| 7760 | .custom_typecheck = true, | |
| 7761 | .lib_function_with_builtin_prefix = true, | |
| 7762 | .const_evaluable = true, | |
| 7763 | }; | |
| 7764 | }; | |
| 7765 | ||
| 7766 | pub const __builtin_isunordered = struct { | |
| 7767 | const param_str = "i."; | |
| 7768 | const attributes = Attributes{ | |
| 7769 | .@"const" = true, | |
| 7770 | .custom_typecheck = true, | |
| 7771 | .lib_function_with_builtin_prefix = true, | |
| 7772 | }; | |
| 7773 | }; | |
| 7774 | ||
| 7775 | pub const __builtin_labs = struct { | |
| 7776 | const param_str = "LiLi"; | |
| 7777 | const attributes = Attributes{ | |
| 7778 | .@"const" = true, | |
| 7779 | .lib_function_with_builtin_prefix = true, | |
| 7780 | }; | |
| 7781 | }; | |
| 7782 | ||
| 7783 | pub const __builtin_launder = struct { | |
| 7784 | const param_str = "v*v*"; | |
| 7785 | const attributes = Attributes{ | |
| 7786 | .custom_typecheck = true, | |
| 7787 | .const_evaluable = true, | |
| 7788 | }; | |
| 7789 | }; | |
| 7790 | ||
| 7791 | pub const __builtin_ldexp = struct { | |
| 7792 | const param_str = "ddi"; | |
| 7793 | const attributes = Attributes{ | |
| 7794 | .lib_function_with_builtin_prefix = true, | |
| 7795 | .const_without_errno_and_fp_exceptions = true, | |
| 7796 | }; | |
| 7797 | }; | |
| 7798 | ||
| 7799 | pub const __builtin_ldexpf = struct { | |
| 7800 | const param_str = "ffi"; | |
| 7801 | const attributes = Attributes{ | |
| 7802 | .lib_function_with_builtin_prefix = true, | |
| 7803 | .const_without_errno_and_fp_exceptions = true, | |
| 7804 | }; | |
| 7805 | }; | |
| 7806 | ||
| 7807 | pub const __builtin_ldexpf128 = struct { | |
| 7808 | const param_str = "LLdLLdi"; | |
| 7809 | const attributes = Attributes{ | |
| 7810 | .lib_function_with_builtin_prefix = true, | |
| 7811 | .const_without_errno_and_fp_exceptions = true, | |
| 7812 | }; | |
| 7813 | }; | |
| 7814 | ||
| 7815 | pub const __builtin_ldexpl = struct { | |
| 7816 | const param_str = "LdLdi"; | |
| 7817 | const attributes = Attributes{ | |
| 7818 | .lib_function_with_builtin_prefix = true, | |
| 7819 | .const_without_errno_and_fp_exceptions = true, | |
| 7820 | }; | |
| 7821 | }; | |
| 7822 | ||
| 7823 | pub const __builtin_lgamma = struct { | |
| 7824 | const param_str = "dd"; | |
| 7825 | const attributes = Attributes{ | |
| 7826 | .lib_function_with_builtin_prefix = true, | |
| 7827 | }; | |
| 7828 | }; | |
| 7829 | ||
| 7830 | pub const __builtin_lgammaf = struct { | |
| 7831 | const param_str = "ff"; | |
| 7832 | const attributes = Attributes{ | |
| 7833 | .lib_function_with_builtin_prefix = true, | |
| 7834 | }; | |
| 7835 | }; | |
| 7836 | ||
| 7837 | pub const __builtin_lgammaf128 = struct { | |
| 7838 | const param_str = "LLdLLd"; | |
| 7839 | const attributes = Attributes{ | |
| 7840 | .lib_function_with_builtin_prefix = true, | |
| 7841 | }; | |
| 7842 | }; | |
| 7843 | ||
| 7844 | pub const __builtin_lgammal = struct { | |
| 7845 | const param_str = "LdLd"; | |
| 7846 | const attributes = Attributes{ | |
| 7847 | .lib_function_with_builtin_prefix = true, | |
| 7848 | }; | |
| 7849 | }; | |
| 7850 | ||
| 7851 | pub const __builtin_llabs = struct { | |
| 7852 | const param_str = "LLiLLi"; | |
| 7853 | const attributes = Attributes{ | |
| 7854 | .@"const" = true, | |
| 7855 | .lib_function_with_builtin_prefix = true, | |
| 7856 | }; | |
| 7857 | }; | |
| 7858 | ||
| 7859 | pub const __builtin_llrint = struct { | |
| 7860 | const param_str = "LLid"; | |
| 7861 | const attributes = Attributes{ | |
| 7862 | .lib_function_with_builtin_prefix = true, | |
| 7863 | .const_without_errno_and_fp_exceptions = true, | |
| 7864 | }; | |
| 7865 | }; | |
| 7866 | ||
| 7867 | pub const __builtin_llrintf = struct { | |
| 7868 | const param_str = "LLif"; | |
| 7869 | const attributes = Attributes{ | |
| 7870 | .lib_function_with_builtin_prefix = true, | |
| 7871 | .const_without_errno_and_fp_exceptions = true, | |
| 7872 | }; | |
| 7873 | }; | |
| 7874 | ||
| 7875 | pub const __builtin_llrintf128 = struct { | |
| 7876 | const param_str = "LLiLLd"; | |
| 7877 | const attributes = Attributes{ | |
| 7878 | .lib_function_with_builtin_prefix = true, | |
| 7879 | .const_without_errno_and_fp_exceptions = true, | |
| 7880 | }; | |
| 7881 | }; | |
| 7882 | ||
| 7883 | pub const __builtin_llrintl = struct { | |
| 7884 | const param_str = "LLiLd"; | |
| 7885 | const attributes = Attributes{ | |
| 7886 | .lib_function_with_builtin_prefix = true, | |
| 7887 | .const_without_errno_and_fp_exceptions = true, | |
| 7888 | }; | |
| 7889 | }; | |
| 7890 | ||
| 7891 | pub const __builtin_llround = struct { | |
| 7892 | const param_str = "LLid"; | |
| 7893 | const attributes = Attributes{ | |
| 7894 | .lib_function_with_builtin_prefix = true, | |
| 7895 | .const_without_errno_and_fp_exceptions = true, | |
| 7896 | }; | |
| 7897 | }; | |
| 7898 | ||
| 7899 | pub const __builtin_llroundf = struct { | |
| 7900 | const param_str = "LLif"; | |
| 7901 | const attributes = Attributes{ | |
| 7902 | .lib_function_with_builtin_prefix = true, | |
| 7903 | .const_without_errno_and_fp_exceptions = true, | |
| 7904 | }; | |
| 7905 | }; | |
| 7906 | ||
| 7907 | pub const __builtin_llroundf128 = struct { | |
| 7908 | const param_str = "LLiLLd"; | |
| 7909 | const attributes = Attributes{ | |
| 7910 | .lib_function_with_builtin_prefix = true, | |
| 7911 | .const_without_errno_and_fp_exceptions = true, | |
| 7912 | }; | |
| 7913 | }; | |
| 7914 | ||
| 7915 | pub const __builtin_llroundl = struct { | |
| 7916 | const param_str = "LLiLd"; | |
| 7917 | const attributes = Attributes{ | |
| 7918 | .lib_function_with_builtin_prefix = true, | |
| 7919 | .const_without_errno_and_fp_exceptions = true, | |
| 7920 | }; | |
| 7921 | }; | |
| 7922 | ||
| 7923 | pub const __builtin_log = struct { | |
| 7924 | const param_str = "dd"; | |
| 7925 | const attributes = Attributes{ | |
| 7926 | .lib_function_with_builtin_prefix = true, | |
| 7927 | .const_without_errno_and_fp_exceptions = true, | |
| 7928 | }; | |
| 7929 | }; | |
| 7930 | ||
| 7931 | pub const __builtin_log10 = struct { | |
| 7932 | const param_str = "dd"; | |
| 7933 | const attributes = Attributes{ | |
| 7934 | .lib_function_with_builtin_prefix = true, | |
| 7935 | .const_without_errno_and_fp_exceptions = true, | |
| 7936 | }; | |
| 7937 | }; | |
| 7938 | ||
| 7939 | pub const __builtin_log10f = struct { | |
| 7940 | const param_str = "ff"; | |
| 7941 | const attributes = Attributes{ | |
| 7942 | .lib_function_with_builtin_prefix = true, | |
| 7943 | .const_without_errno_and_fp_exceptions = true, | |
| 7944 | }; | |
| 7945 | }; | |
| 7946 | ||
| 7947 | pub const __builtin_log10f128 = struct { | |
| 7948 | const param_str = "LLdLLd"; | |
| 7949 | const attributes = Attributes{ | |
| 7950 | .lib_function_with_builtin_prefix = true, | |
| 7951 | .const_without_errno_and_fp_exceptions = true, | |
| 7952 | }; | |
| 7953 | }; | |
| 7954 | ||
| 7955 | pub const __builtin_log10f16 = struct { | |
| 7956 | const param_str = "hh"; | |
| 7957 | const attributes = Attributes{ | |
| 7958 | .lib_function_with_builtin_prefix = true, | |
| 7959 | .const_without_errno_and_fp_exceptions = true, | |
| 7960 | }; | |
| 7961 | }; | |
| 7962 | ||
| 7963 | pub const __builtin_log10l = struct { | |
| 7964 | const param_str = "LdLd"; | |
| 7965 | const attributes = Attributes{ | |
| 7966 | .lib_function_with_builtin_prefix = true, | |
| 7967 | .const_without_errno_and_fp_exceptions = true, | |
| 7968 | }; | |
| 7969 | }; | |
| 7970 | ||
| 7971 | pub const __builtin_log1p = struct { | |
| 7972 | const param_str = "dd"; | |
| 7973 | const attributes = Attributes{ | |
| 7974 | .lib_function_with_builtin_prefix = true, | |
| 7975 | .const_without_errno_and_fp_exceptions = true, | |
| 7976 | }; | |
| 7977 | }; | |
| 7978 | ||
| 7979 | pub const __builtin_log1pf = struct { | |
| 7980 | const param_str = "ff"; | |
| 7981 | const attributes = Attributes{ | |
| 7982 | .lib_function_with_builtin_prefix = true, | |
| 7983 | .const_without_errno_and_fp_exceptions = true, | |
| 7984 | }; | |
| 7985 | }; | |
| 7986 | ||
| 7987 | pub const __builtin_log1pf128 = struct { | |
| 7988 | const param_str = "LLdLLd"; | |
| 7989 | const attributes = Attributes{ | |
| 7990 | .lib_function_with_builtin_prefix = true, | |
| 7991 | .const_without_errno_and_fp_exceptions = true, | |
| 7992 | }; | |
| 7993 | }; | |
| 7994 | ||
| 7995 | pub const __builtin_log1pl = struct { | |
| 7996 | const param_str = "LdLd"; | |
| 7997 | const attributes = Attributes{ | |
| 7998 | .lib_function_with_builtin_prefix = true, | |
| 7999 | .const_without_errno_and_fp_exceptions = true, | |
| 8000 | }; | |
| 8001 | }; | |
| 8002 | ||
| 8003 | pub const __builtin_log2 = struct { | |
| 8004 | const param_str = "dd"; | |
| 8005 | const attributes = Attributes{ | |
| 8006 | .lib_function_with_builtin_prefix = true, | |
| 8007 | .const_without_errno_and_fp_exceptions = true, | |
| 8008 | }; | |
| 8009 | }; | |
| 8010 | ||
| 8011 | pub const __builtin_log2f = struct { | |
| 8012 | const param_str = "ff"; | |
| 8013 | const attributes = Attributes{ | |
| 8014 | .lib_function_with_builtin_prefix = true, | |
| 8015 | .const_without_errno_and_fp_exceptions = true, | |
| 8016 | }; | |
| 8017 | }; | |
| 8018 | ||
| 8019 | pub const __builtin_log2f128 = struct { | |
| 8020 | const param_str = "LLdLLd"; | |
| 8021 | const attributes = Attributes{ | |
| 8022 | .lib_function_with_builtin_prefix = true, | |
| 8023 | .const_without_errno_and_fp_exceptions = true, | |
| 8024 | }; | |
| 8025 | }; | |
| 8026 | ||
| 8027 | pub const __builtin_log2f16 = struct { | |
| 8028 | const param_str = "hh"; | |
| 8029 | const attributes = Attributes{ | |
| 8030 | .lib_function_with_builtin_prefix = true, | |
| 8031 | .const_without_errno_and_fp_exceptions = true, | |
| 8032 | }; | |
| 8033 | }; | |
| 8034 | ||
| 8035 | pub const __builtin_log2l = struct { | |
| 8036 | const param_str = "LdLd"; | |
| 8037 | const attributes = Attributes{ | |
| 8038 | .lib_function_with_builtin_prefix = true, | |
| 8039 | .const_without_errno_and_fp_exceptions = true, | |
| 8040 | }; | |
| 8041 | }; | |
| 8042 | ||
| 8043 | pub const __builtin_logb = struct { | |
| 8044 | const param_str = "dd"; | |
| 8045 | const attributes = Attributes{ | |
| 8046 | .lib_function_with_builtin_prefix = true, | |
| 8047 | .const_without_errno_and_fp_exceptions = true, | |
| 8048 | }; | |
| 8049 | }; | |
| 8050 | ||
| 8051 | pub const __builtin_logbf = struct { | |
| 8052 | const param_str = "ff"; | |
| 8053 | const attributes = Attributes{ | |
| 8054 | .lib_function_with_builtin_prefix = true, | |
| 8055 | .const_without_errno_and_fp_exceptions = true, | |
| 8056 | }; | |
| 8057 | }; | |
| 8058 | ||
| 8059 | pub const __builtin_logbf128 = struct { | |
| 8060 | const param_str = "LLdLLd"; | |
| 8061 | const attributes = Attributes{ | |
| 8062 | .lib_function_with_builtin_prefix = true, | |
| 8063 | .const_without_errno_and_fp_exceptions = true, | |
| 8064 | }; | |
| 8065 | }; | |
| 8066 | ||
| 8067 | pub const __builtin_logbl = struct { | |
| 8068 | const param_str = "LdLd"; | |
| 8069 | const attributes = Attributes{ | |
| 8070 | .lib_function_with_builtin_prefix = true, | |
| 8071 | .const_without_errno_and_fp_exceptions = true, | |
| 8072 | }; | |
| 8073 | }; | |
| 8074 | ||
| 8075 | pub const __builtin_logf = struct { | |
| 8076 | const param_str = "ff"; | |
| 8077 | const attributes = Attributes{ | |
| 8078 | .lib_function_with_builtin_prefix = true, | |
| 8079 | .const_without_errno_and_fp_exceptions = true, | |
| 8080 | }; | |
| 8081 | }; | |
| 8082 | ||
| 8083 | pub const __builtin_logf128 = struct { | |
| 8084 | const param_str = "LLdLLd"; | |
| 8085 | const attributes = Attributes{ | |
| 8086 | .lib_function_with_builtin_prefix = true, | |
| 8087 | .const_without_errno_and_fp_exceptions = true, | |
| 8088 | }; | |
| 8089 | }; | |
| 8090 | ||
| 8091 | pub const __builtin_logf16 = struct { | |
| 8092 | const param_str = "hh"; | |
| 8093 | const attributes = Attributes{ | |
| 8094 | .lib_function_with_builtin_prefix = true, | |
| 8095 | .const_without_errno_and_fp_exceptions = true, | |
| 8096 | }; | |
| 8097 | }; | |
| 8098 | ||
| 8099 | pub const __builtin_logl = struct { | |
| 8100 | const param_str = "LdLd"; | |
| 8101 | const attributes = Attributes{ | |
| 8102 | .lib_function_with_builtin_prefix = true, | |
| 8103 | .const_without_errno_and_fp_exceptions = true, | |
| 8104 | }; | |
| 8105 | }; | |
| 8106 | ||
| 8107 | pub const __builtin_longjmp = struct { | |
| 8108 | const param_str = "vv**i"; | |
| 8109 | const attributes = Attributes{ | |
| 8110 | .noreturn = true, | |
| 8111 | }; | |
| 8112 | }; | |
| 8113 | ||
| 8114 | pub const __builtin_lrint = struct { | |
| 8115 | const param_str = "Lid"; | |
| 8116 | const attributes = Attributes{ | |
| 8117 | .lib_function_with_builtin_prefix = true, | |
| 8118 | .const_without_errno_and_fp_exceptions = true, | |
| 8119 | }; | |
| 8120 | }; | |
| 8121 | ||
| 8122 | pub const __builtin_lrintf = struct { | |
| 8123 | const param_str = "Lif"; | |
| 8124 | const attributes = Attributes{ | |
| 8125 | .lib_function_with_builtin_prefix = true, | |
| 8126 | .const_without_errno_and_fp_exceptions = true, | |
| 8127 | }; | |
| 8128 | }; | |
| 8129 | ||
| 8130 | pub const __builtin_lrintf128 = struct { | |
| 8131 | const param_str = "LiLLd"; | |
| 8132 | const attributes = Attributes{ | |
| 8133 | .lib_function_with_builtin_prefix = true, | |
| 8134 | .const_without_errno_and_fp_exceptions = true, | |
| 8135 | }; | |
| 8136 | }; | |
| 8137 | ||
| 8138 | pub const __builtin_lrintl = struct { | |
| 8139 | const param_str = "LiLd"; | |
| 8140 | const attributes = Attributes{ | |
| 8141 | .lib_function_with_builtin_prefix = true, | |
| 8142 | .const_without_errno_and_fp_exceptions = true, | |
| 8143 | }; | |
| 8144 | }; | |
| 8145 | ||
| 8146 | pub const __builtin_lround = struct { | |
| 8147 | const param_str = "Lid"; | |
| 8148 | const attributes = Attributes{ | |
| 8149 | .lib_function_with_builtin_prefix = true, | |
| 8150 | .const_without_errno_and_fp_exceptions = true, | |
| 8151 | }; | |
| 8152 | }; | |
| 8153 | ||
| 8154 | pub const __builtin_lroundf = struct { | |
| 8155 | const param_str = "Lif"; | |
| 8156 | const attributes = Attributes{ | |
| 8157 | .lib_function_with_builtin_prefix = true, | |
| 8158 | .const_without_errno_and_fp_exceptions = true, | |
| 8159 | }; | |
| 8160 | }; | |
| 8161 | ||
| 8162 | pub const __builtin_lroundf128 = struct { | |
| 8163 | const param_str = "LiLLd"; | |
| 8164 | const attributes = Attributes{ | |
| 8165 | .lib_function_with_builtin_prefix = true, | |
| 8166 | .const_without_errno_and_fp_exceptions = true, | |
| 8167 | }; | |
| 8168 | }; | |
| 8169 | ||
| 8170 | pub const __builtin_lroundl = struct { | |
| 8171 | const param_str = "LiLd"; | |
| 8172 | const attributes = Attributes{ | |
| 8173 | .lib_function_with_builtin_prefix = true, | |
| 8174 | .const_without_errno_and_fp_exceptions = true, | |
| 8175 | }; | |
| 8176 | }; | |
| 8177 | ||
| 8178 | pub const __builtin_malloc = struct { | |
| 8179 | const param_str = "v*z"; | |
| 8180 | const attributes = Attributes{ | |
| 8181 | .lib_function_with_builtin_prefix = true, | |
| 8182 | }; | |
| 8183 | }; | |
| 8184 | ||
| 8185 | pub const __builtin_matrix_column_major_load = struct { | |
| 8186 | const param_str = "v."; | |
| 8187 | const attributes = Attributes{ | |
| 8188 | .custom_typecheck = true, | |
| 8189 | .lib_function_with_builtin_prefix = true, | |
| 8190 | }; | |
| 8191 | }; | |
| 8192 | ||
| 8193 | pub const __builtin_matrix_column_major_store = struct { | |
| 8194 | const param_str = "v."; | |
| 8195 | const attributes = Attributes{ | |
| 8196 | .custom_typecheck = true, | |
| 8197 | .lib_function_with_builtin_prefix = true, | |
| 8198 | }; | |
| 8199 | }; | |
| 8200 | ||
| 8201 | pub const __builtin_matrix_transpose = struct { | |
| 8202 | const param_str = "v."; | |
| 8203 | const attributes = Attributes{ | |
| 8204 | .custom_typecheck = true, | |
| 8205 | .lib_function_with_builtin_prefix = true, | |
| 8206 | }; | |
| 8207 | }; | |
| 8208 | ||
| 8209 | pub const __builtin_memchr = struct { | |
| 8210 | const param_str = "v*vC*iz"; | |
| 8211 | const attributes = Attributes{ | |
| 8212 | .lib_function_with_builtin_prefix = true, | |
| 8213 | .const_evaluable = true, | |
| 8214 | }; | |
| 8215 | }; | |
| 8216 | ||
| 8217 | pub const __builtin_memcmp = struct { | |
| 8218 | const param_str = "ivC*vC*z"; | |
| 8219 | const attributes = Attributes{ | |
| 8220 | .lib_function_with_builtin_prefix = true, | |
| 8221 | .const_evaluable = true, | |
| 8222 | }; | |
| 8223 | }; | |
| 8224 | ||
| 8225 | pub const __builtin_memcpy = struct { | |
| 8226 | const param_str = "v*v*vC*z"; | |
| 8227 | const attributes = Attributes{ | |
| 8228 | .lib_function_with_builtin_prefix = true, | |
| 8229 | .const_evaluable = true, | |
| 8230 | }; | |
| 8231 | }; | |
| 8232 | ||
| 8233 | pub const __builtin_memcpy_inline = struct { | |
| 8234 | const param_str = "vv*vC*Iz"; | |
| 8235 | const attributes = Attributes{}; | |
| 8236 | }; | |
| 8237 | ||
| 8238 | pub const __builtin_memmove = struct { | |
| 8239 | const param_str = "v*v*vC*z"; | |
| 8240 | const attributes = Attributes{ | |
| 8241 | .lib_function_with_builtin_prefix = true, | |
| 8242 | .const_evaluable = true, | |
| 8243 | }; | |
| 8244 | }; | |
| 8245 | ||
| 8246 | pub const __builtin_mempcpy = struct { | |
| 8247 | const param_str = "v*v*vC*z"; | |
| 8248 | const attributes = Attributes{ | |
| 8249 | .lib_function_with_builtin_prefix = true, | |
| 8250 | }; | |
| 8251 | }; | |
| 8252 | ||
| 8253 | pub const __builtin_memset = struct { | |
| 8254 | const param_str = "v*v*iz"; | |
| 8255 | const attributes = Attributes{ | |
| 8256 | .lib_function_with_builtin_prefix = true, | |
| 8257 | }; | |
| 8258 | }; | |
| 8259 | ||
| 8260 | pub const __builtin_memset_inline = struct { | |
| 8261 | const param_str = "vv*iIz"; | |
| 8262 | const attributes = Attributes{}; | |
| 8263 | }; | |
| 8264 | ||
| 8265 | pub const __builtin_mips_absq_s_ph = struct { | |
| 8266 | const param_str = "V2sV2s"; | |
| 8267 | const target_set = TargetSet.init(.{ | |
| 8268 | .mips = true, | |
| 8269 | }); | |
| 8270 | const attributes = Attributes{}; | |
| 8271 | }; | |
| 8272 | ||
| 8273 | pub const __builtin_mips_absq_s_qb = struct { | |
| 8274 | const param_str = "V4ScV4Sc"; | |
| 8275 | const target_set = TargetSet.init(.{ | |
| 8276 | .mips = true, | |
| 8277 | }); | |
| 8278 | const attributes = Attributes{}; | |
| 8279 | }; | |
| 8280 | ||
| 8281 | pub const __builtin_mips_absq_s_w = struct { | |
| 8282 | const param_str = "ii"; | |
| 8283 | const target_set = TargetSet.init(.{ | |
| 8284 | .mips = true, | |
| 8285 | }); | |
| 8286 | const attributes = Attributes{}; | |
| 8287 | }; | |
| 8288 | ||
| 8289 | pub const __builtin_mips_addq_ph = struct { | |
| 8290 | const param_str = "V2sV2sV2s"; | |
| 8291 | const target_set = TargetSet.init(.{ | |
| 8292 | .mips = true, | |
| 8293 | }); | |
| 8294 | const attributes = Attributes{}; | |
| 8295 | }; | |
| 8296 | ||
| 8297 | pub const __builtin_mips_addq_s_ph = struct { | |
| 8298 | const param_str = "V2sV2sV2s"; | |
| 8299 | const target_set = TargetSet.init(.{ | |
| 8300 | .mips = true, | |
| 8301 | }); | |
| 8302 | const attributes = Attributes{}; | |
| 8303 | }; | |
| 8304 | ||
| 8305 | pub const __builtin_mips_addq_s_w = struct { | |
| 8306 | const param_str = "iii"; | |
| 8307 | const target_set = TargetSet.init(.{ | |
| 8308 | .mips = true, | |
| 8309 | }); | |
| 8310 | const attributes = Attributes{}; | |
| 8311 | }; | |
| 8312 | ||
| 8313 | pub const __builtin_mips_addqh_ph = struct { | |
| 8314 | const param_str = "V2sV2sV2s"; | |
| 8315 | const target_set = TargetSet.init(.{ | |
| 8316 | .mips = true, | |
| 8317 | }); | |
| 8318 | const attributes = Attributes{ | |
| 8319 | .@"const" = true, | |
| 8320 | }; | |
| 8321 | }; | |
| 8322 | ||
| 8323 | pub const __builtin_mips_addqh_r_ph = struct { | |
| 8324 | const param_str = "V2sV2sV2s"; | |
| 8325 | const target_set = TargetSet.init(.{ | |
| 8326 | .mips = true, | |
| 8327 | }); | |
| 8328 | const attributes = Attributes{ | |
| 8329 | .@"const" = true, | |
| 8330 | }; | |
| 8331 | }; | |
| 8332 | ||
| 8333 | pub const __builtin_mips_addqh_r_w = struct { | |
| 8334 | const param_str = "iii"; | |
| 8335 | const target_set = TargetSet.init(.{ | |
| 8336 | .mips = true, | |
| 8337 | }); | |
| 8338 | const attributes = Attributes{ | |
| 8339 | .@"const" = true, | |
| 8340 | }; | |
| 8341 | }; | |
| 8342 | ||
| 8343 | pub const __builtin_mips_addqh_w = struct { | |
| 8344 | const param_str = "iii"; | |
| 8345 | const target_set = TargetSet.init(.{ | |
| 8346 | .mips = true, | |
| 8347 | }); | |
| 8348 | const attributes = Attributes{ | |
| 8349 | .@"const" = true, | |
| 8350 | }; | |
| 8351 | }; | |
| 8352 | ||
| 8353 | pub const __builtin_mips_addsc = struct { | |
| 8354 | const param_str = "iii"; | |
| 8355 | const target_set = TargetSet.init(.{ | |
| 8356 | .mips = true, | |
| 8357 | }); | |
| 8358 | const attributes = Attributes{}; | |
| 8359 | }; | |
| 8360 | ||
| 8361 | pub const __builtin_mips_addu_ph = struct { | |
| 8362 | const param_str = "V2sV2sV2s"; | |
| 8363 | const target_set = TargetSet.init(.{ | |
| 8364 | .mips = true, | |
| 8365 | }); | |
| 8366 | const attributes = Attributes{}; | |
| 8367 | }; | |
| 8368 | ||
| 8369 | pub const __builtin_mips_addu_qb = struct { | |
| 8370 | const param_str = "V4ScV4ScV4Sc"; | |
| 8371 | const target_set = TargetSet.init(.{ | |
| 8372 | .mips = true, | |
| 8373 | }); | |
| 8374 | const attributes = Attributes{}; | |
| 8375 | }; | |
| 8376 | ||
| 8377 | pub const __builtin_mips_addu_s_ph = struct { | |
| 8378 | const param_str = "V2sV2sV2s"; | |
| 8379 | const target_set = TargetSet.init(.{ | |
| 8380 | .mips = true, | |
| 8381 | }); | |
| 8382 | const attributes = Attributes{}; | |
| 8383 | }; | |
| 8384 | ||
| 8385 | pub const __builtin_mips_addu_s_qb = struct { | |
| 8386 | const param_str = "V4ScV4ScV4Sc"; | |
| 8387 | const target_set = TargetSet.init(.{ | |
| 8388 | .mips = true, | |
| 8389 | }); | |
| 8390 | const attributes = Attributes{}; | |
| 8391 | }; | |
| 8392 | ||
| 8393 | pub const __builtin_mips_adduh_qb = struct { | |
| 8394 | const param_str = "V4ScV4ScV4Sc"; | |
| 8395 | const target_set = TargetSet.init(.{ | |
| 8396 | .mips = true, | |
| 8397 | }); | |
| 8398 | const attributes = Attributes{ | |
| 8399 | .@"const" = true, | |
| 8400 | }; | |
| 8401 | }; | |
| 8402 | ||
| 8403 | pub const __builtin_mips_adduh_r_qb = struct { | |
| 8404 | const param_str = "V4ScV4ScV4Sc"; | |
| 8405 | const target_set = TargetSet.init(.{ | |
| 8406 | .mips = true, | |
| 8407 | }); | |
| 8408 | const attributes = Attributes{ | |
| 8409 | .@"const" = true, | |
| 8410 | }; | |
| 8411 | }; | |
| 8412 | ||
| 8413 | pub const __builtin_mips_addwc = struct { | |
| 8414 | const param_str = "iii"; | |
| 8415 | const target_set = TargetSet.init(.{ | |
| 8416 | .mips = true, | |
| 8417 | }); | |
| 8418 | const attributes = Attributes{}; | |
| 8419 | }; | |
| 8420 | ||
| 8421 | pub const __builtin_mips_append = struct { | |
| 8422 | const param_str = "iiiIi"; | |
| 8423 | const target_set = TargetSet.init(.{ | |
| 8424 | .mips = true, | |
| 8425 | }); | |
| 8426 | const attributes = Attributes{ | |
| 8427 | .@"const" = true, | |
| 8428 | }; | |
| 8429 | }; | |
| 8430 | ||
| 8431 | pub const __builtin_mips_balign = struct { | |
| 8432 | const param_str = "iiiIi"; | |
| 8433 | const target_set = TargetSet.init(.{ | |
| 8434 | .mips = true, | |
| 8435 | }); | |
| 8436 | const attributes = Attributes{ | |
| 8437 | .@"const" = true, | |
| 8438 | }; | |
| 8439 | }; | |
| 8440 | ||
| 8441 | pub const __builtin_mips_bitrev = struct { | |
| 8442 | const param_str = "ii"; | |
| 8443 | const target_set = TargetSet.init(.{ | |
| 8444 | .mips = true, | |
| 8445 | }); | |
| 8446 | const attributes = Attributes{ | |
| 8447 | .@"const" = true, | |
| 8448 | }; | |
| 8449 | }; | |
| 8450 | ||
| 8451 | pub const __builtin_mips_bposge32 = struct { | |
| 8452 | const param_str = "i"; | |
| 8453 | const target_set = TargetSet.init(.{ | |
| 8454 | .mips = true, | |
| 8455 | }); | |
| 8456 | const attributes = Attributes{}; | |
| 8457 | }; | |
| 8458 | ||
| 8459 | pub const __builtin_mips_cmp_eq_ph = struct { | |
| 8460 | const param_str = "vV2sV2s"; | |
| 8461 | const target_set = TargetSet.init(.{ | |
| 8462 | .mips = true, | |
| 8463 | }); | |
| 8464 | const attributes = Attributes{}; | |
| 8465 | }; | |
| 8466 | ||
| 8467 | pub const __builtin_mips_cmp_le_ph = struct { | |
| 8468 | const param_str = "vV2sV2s"; | |
| 8469 | const target_set = TargetSet.init(.{ | |
| 8470 | .mips = true, | |
| 8471 | }); | |
| 8472 | const attributes = Attributes{}; | |
| 8473 | }; | |
| 8474 | ||
| 8475 | pub const __builtin_mips_cmp_lt_ph = struct { | |
| 8476 | const param_str = "vV2sV2s"; | |
| 8477 | const target_set = TargetSet.init(.{ | |
| 8478 | .mips = true, | |
| 8479 | }); | |
| 8480 | const attributes = Attributes{}; | |
| 8481 | }; | |
| 8482 | ||
| 8483 | pub const __builtin_mips_cmpgdu_eq_qb = struct { | |
| 8484 | const param_str = "iV4ScV4Sc"; | |
| 8485 | const target_set = TargetSet.init(.{ | |
| 8486 | .mips = true, | |
| 8487 | }); | |
| 8488 | const attributes = Attributes{}; | |
| 8489 | }; | |
| 8490 | ||
| 8491 | pub const __builtin_mips_cmpgdu_le_qb = struct { | |
| 8492 | const param_str = "iV4ScV4Sc"; | |
| 8493 | const target_set = TargetSet.init(.{ | |
| 8494 | .mips = true, | |
| 8495 | }); | |
| 8496 | const attributes = Attributes{}; | |
| 8497 | }; | |
| 8498 | ||
| 8499 | pub const __builtin_mips_cmpgdu_lt_qb = struct { | |
| 8500 | const param_str = "iV4ScV4Sc"; | |
| 8501 | const target_set = TargetSet.init(.{ | |
| 8502 | .mips = true, | |
| 8503 | }); | |
| 8504 | const attributes = Attributes{}; | |
| 8505 | }; | |
| 8506 | ||
| 8507 | pub const __builtin_mips_cmpgu_eq_qb = struct { | |
| 8508 | const param_str = "iV4ScV4Sc"; | |
| 8509 | const target_set = TargetSet.init(.{ | |
| 8510 | .mips = true, | |
| 8511 | }); | |
| 8512 | const attributes = Attributes{}; | |
| 8513 | }; | |
| 8514 | ||
| 8515 | pub const __builtin_mips_cmpgu_le_qb = struct { | |
| 8516 | const param_str = "iV4ScV4Sc"; | |
| 8517 | const target_set = TargetSet.init(.{ | |
| 8518 | .mips = true, | |
| 8519 | }); | |
| 8520 | const attributes = Attributes{}; | |
| 8521 | }; | |
| 8522 | ||
| 8523 | pub const __builtin_mips_cmpgu_lt_qb = struct { | |
| 8524 | const param_str = "iV4ScV4Sc"; | |
| 8525 | const target_set = TargetSet.init(.{ | |
| 8526 | .mips = true, | |
| 8527 | }); | |
| 8528 | const attributes = Attributes{}; | |
| 8529 | }; | |
| 8530 | ||
| 8531 | pub const __builtin_mips_cmpu_eq_qb = struct { | |
| 8532 | const param_str = "vV4ScV4Sc"; | |
| 8533 | const target_set = TargetSet.init(.{ | |
| 8534 | .mips = true, | |
| 8535 | }); | |
| 8536 | const attributes = Attributes{}; | |
| 8537 | }; | |
| 8538 | ||
| 8539 | pub const __builtin_mips_cmpu_le_qb = struct { | |
| 8540 | const param_str = "vV4ScV4Sc"; | |
| 8541 | const target_set = TargetSet.init(.{ | |
| 8542 | .mips = true, | |
| 8543 | }); | |
| 8544 | const attributes = Attributes{}; | |
| 8545 | }; | |
| 8546 | ||
| 8547 | pub const __builtin_mips_cmpu_lt_qb = struct { | |
| 8548 | const param_str = "vV4ScV4Sc"; | |
| 8549 | const target_set = TargetSet.init(.{ | |
| 8550 | .mips = true, | |
| 8551 | }); | |
| 8552 | const attributes = Attributes{}; | |
| 8553 | }; | |
| 8554 | ||
| 8555 | pub const __builtin_mips_dpa_w_ph = struct { | |
| 8556 | const param_str = "LLiLLiV2sV2s"; | |
| 8557 | const target_set = TargetSet.init(.{ | |
| 8558 | .mips = true, | |
| 8559 | }); | |
| 8560 | const attributes = Attributes{ | |
| 8561 | .@"const" = true, | |
| 8562 | }; | |
| 8563 | }; | |
| 8564 | ||
| 8565 | pub const __builtin_mips_dpaq_s_w_ph = struct { | |
| 8566 | const param_str = "LLiLLiV2sV2s"; | |
| 8567 | const target_set = TargetSet.init(.{ | |
| 8568 | .mips = true, | |
| 8569 | }); | |
| 8570 | const attributes = Attributes{}; | |
| 8571 | }; | |
| 8572 | ||
| 8573 | pub const __builtin_mips_dpaq_sa_l_w = struct { | |
| 8574 | const param_str = "LLiLLiii"; | |
| 8575 | const target_set = TargetSet.init(.{ | |
| 8576 | .mips = true, | |
| 8577 | }); | |
| 8578 | const attributes = Attributes{}; | |
| 8579 | }; | |
| 8580 | ||
| 8581 | pub const __builtin_mips_dpaqx_s_w_ph = struct { | |
| 8582 | const param_str = "LLiLLiV2sV2s"; | |
| 8583 | const target_set = TargetSet.init(.{ | |
| 8584 | .mips = true, | |
| 8585 | }); | |
| 8586 | const attributes = Attributes{}; | |
| 8587 | }; | |
| 8588 | ||
| 8589 | pub const __builtin_mips_dpaqx_sa_w_ph = struct { | |
| 8590 | const param_str = "LLiLLiV2sV2s"; | |
| 8591 | const target_set = TargetSet.init(.{ | |
| 8592 | .mips = true, | |
| 8593 | }); | |
| 8594 | const attributes = Attributes{}; | |
| 8595 | }; | |
| 8596 | ||
| 8597 | pub const __builtin_mips_dpau_h_qbl = struct { | |
| 8598 | const param_str = "LLiLLiV4ScV4Sc"; | |
| 8599 | const target_set = TargetSet.init(.{ | |
| 8600 | .mips = true, | |
| 8601 | }); | |
| 8602 | const attributes = Attributes{ | |
| 8603 | .@"const" = true, | |
| 8604 | }; | |
| 8605 | }; | |
| 8606 | ||
| 8607 | pub const __builtin_mips_dpau_h_qbr = struct { | |
| 8608 | const param_str = "LLiLLiV4ScV4Sc"; | |
| 8609 | const target_set = TargetSet.init(.{ | |
| 8610 | .mips = true, | |
| 8611 | }); | |
| 8612 | const attributes = Attributes{ | |
| 8613 | .@"const" = true, | |
| 8614 | }; | |
| 8615 | }; | |
| 8616 | ||
| 8617 | pub const __builtin_mips_dpax_w_ph = struct { | |
| 8618 | const param_str = "LLiLLiV2sV2s"; | |
| 8619 | const target_set = TargetSet.init(.{ | |
| 8620 | .mips = true, | |
| 8621 | }); | |
| 8622 | const attributes = Attributes{ | |
| 8623 | .@"const" = true, | |
| 8624 | }; | |
| 8625 | }; | |
| 8626 | ||
| 8627 | pub const __builtin_mips_dps_w_ph = struct { | |
| 8628 | const param_str = "LLiLLiV2sV2s"; | |
| 8629 | const target_set = TargetSet.init(.{ | |
| 8630 | .mips = true, | |
| 8631 | }); | |
| 8632 | const attributes = Attributes{ | |
| 8633 | .@"const" = true, | |
| 8634 | }; | |
| 8635 | }; | |
| 8636 | ||
| 8637 | pub const __builtin_mips_dpsq_s_w_ph = struct { | |
| 8638 | const param_str = "LLiLLiV2sV2s"; | |
| 8639 | const target_set = TargetSet.init(.{ | |
| 8640 | .mips = true, | |
| 8641 | }); | |
| 8642 | const attributes = Attributes{}; | |
| 8643 | }; | |
| 8644 | ||
| 8645 | pub const __builtin_mips_dpsq_sa_l_w = struct { | |
| 8646 | const param_str = "LLiLLiii"; | |
| 8647 | const target_set = TargetSet.init(.{ | |
| 8648 | .mips = true, | |
| 8649 | }); | |
| 8650 | const attributes = Attributes{}; | |
| 8651 | }; | |
| 8652 | ||
| 8653 | pub const __builtin_mips_dpsqx_s_w_ph = struct { | |
| 8654 | const param_str = "LLiLLiV2sV2s"; | |
| 8655 | const target_set = TargetSet.init(.{ | |
| 8656 | .mips = true, | |
| 8657 | }); | |
| 8658 | const attributes = Attributes{}; | |
| 8659 | }; | |
| 8660 | ||
| 8661 | pub const __builtin_mips_dpsqx_sa_w_ph = struct { | |
| 8662 | const param_str = "LLiLLiV2sV2s"; | |
| 8663 | const target_set = TargetSet.init(.{ | |
| 8664 | .mips = true, | |
| 8665 | }); | |
| 8666 | const attributes = Attributes{}; | |
| 8667 | }; | |
| 8668 | ||
| 8669 | pub const __builtin_mips_dpsu_h_qbl = struct { | |
| 8670 | const param_str = "LLiLLiV4ScV4Sc"; | |
| 8671 | const target_set = TargetSet.init(.{ | |
| 8672 | .mips = true, | |
| 8673 | }); | |
| 8674 | const attributes = Attributes{ | |
| 8675 | .@"const" = true, | |
| 8676 | }; | |
| 8677 | }; | |
| 8678 | ||
| 8679 | pub const __builtin_mips_dpsu_h_qbr = struct { | |
| 8680 | const param_str = "LLiLLiV4ScV4Sc"; | |
| 8681 | const target_set = TargetSet.init(.{ | |
| 8682 | .mips = true, | |
| 8683 | }); | |
| 8684 | const attributes = Attributes{ | |
| 8685 | .@"const" = true, | |
| 8686 | }; | |
| 8687 | }; | |
| 8688 | ||
| 8689 | pub const __builtin_mips_dpsx_w_ph = struct { | |
| 8690 | const param_str = "LLiLLiV2sV2s"; | |
| 8691 | const target_set = TargetSet.init(.{ | |
| 8692 | .mips = true, | |
| 8693 | }); | |
| 8694 | const attributes = Attributes{ | |
| 8695 | .@"const" = true, | |
| 8696 | }; | |
| 8697 | }; | |
| 8698 | ||
| 8699 | pub const __builtin_mips_extp = struct { | |
| 8700 | const param_str = "iLLii"; | |
| 8701 | const target_set = TargetSet.init(.{ | |
| 8702 | .mips = true, | |
| 8703 | }); | |
| 8704 | const attributes = Attributes{}; | |
| 8705 | }; | |
| 8706 | ||
| 8707 | pub const __builtin_mips_extpdp = struct { | |
| 8708 | const param_str = "iLLii"; | |
| 8709 | const target_set = TargetSet.init(.{ | |
| 8710 | .mips = true, | |
| 8711 | }); | |
| 8712 | const attributes = Attributes{}; | |
| 8713 | }; | |
| 8714 | ||
| 8715 | pub const __builtin_mips_extr_r_w = struct { | |
| 8716 | const param_str = "iLLii"; | |
| 8717 | const target_set = TargetSet.init(.{ | |
| 8718 | .mips = true, | |
| 8719 | }); | |
| 8720 | const attributes = Attributes{}; | |
| 8721 | }; | |
| 8722 | ||
| 8723 | pub const __builtin_mips_extr_rs_w = struct { | |
| 8724 | const param_str = "iLLii"; | |
| 8725 | const target_set = TargetSet.init(.{ | |
| 8726 | .mips = true, | |
| 8727 | }); | |
| 8728 | const attributes = Attributes{}; | |
| 8729 | }; | |
| 8730 | ||
| 8731 | pub const __builtin_mips_extr_s_h = struct { | |
| 8732 | const param_str = "iLLii"; | |
| 8733 | const target_set = TargetSet.init(.{ | |
| 8734 | .mips = true, | |
| 8735 | }); | |
| 8736 | const attributes = Attributes{}; | |
| 8737 | }; | |
| 8738 | ||
| 8739 | pub const __builtin_mips_extr_w = struct { | |
| 8740 | const param_str = "iLLii"; | |
| 8741 | const target_set = TargetSet.init(.{ | |
| 8742 | .mips = true, | |
| 8743 | }); | |
| 8744 | const attributes = Attributes{}; | |
| 8745 | }; | |
| 8746 | ||
| 8747 | pub const __builtin_mips_insv = struct { | |
| 8748 | const param_str = "iii"; | |
| 8749 | const target_set = TargetSet.init(.{ | |
| 8750 | .mips = true, | |
| 8751 | }); | |
| 8752 | const attributes = Attributes{}; | |
| 8753 | }; | |
| 8754 | ||
| 8755 | pub const __builtin_mips_lbux = struct { | |
| 8756 | const param_str = "iv*i"; | |
| 8757 | const target_set = TargetSet.init(.{ | |
| 8758 | .mips = true, | |
| 8759 | }); | |
| 8760 | const attributes = Attributes{}; | |
| 8761 | }; | |
| 8762 | ||
| 8763 | pub const __builtin_mips_lhx = struct { | |
| 8764 | const param_str = "iv*i"; | |
| 8765 | const target_set = TargetSet.init(.{ | |
| 8766 | .mips = true, | |
| 8767 | }); | |
| 8768 | const attributes = Attributes{}; | |
| 8769 | }; | |
| 8770 | ||
| 8771 | pub const __builtin_mips_lwx = struct { | |
| 8772 | const param_str = "iv*i"; | |
| 8773 | const target_set = TargetSet.init(.{ | |
| 8774 | .mips = true, | |
| 8775 | }); | |
| 8776 | const attributes = Attributes{}; | |
| 8777 | }; | |
| 8778 | ||
| 8779 | pub const __builtin_mips_madd = struct { | |
| 8780 | const param_str = "LLiLLiii"; | |
| 8781 | const target_set = TargetSet.init(.{ | |
| 8782 | .mips = true, | |
| 8783 | }); | |
| 8784 | const attributes = Attributes{ | |
| 8785 | .@"const" = true, | |
| 8786 | }; | |
| 8787 | }; | |
| 8788 | ||
| 8789 | pub const __builtin_mips_maddu = struct { | |
| 8790 | const param_str = "LLiLLiUiUi"; | |
| 8791 | const target_set = TargetSet.init(.{ | |
| 8792 | .mips = true, | |
| 8793 | }); | |
| 8794 | const attributes = Attributes{ | |
| 8795 | .@"const" = true, | |
| 8796 | }; | |
| 8797 | }; | |
| 8798 | ||
| 8799 | pub const __builtin_mips_maq_s_w_phl = struct { | |
| 8800 | const param_str = "LLiLLiV2sV2s"; | |
| 8801 | const target_set = TargetSet.init(.{ | |
| 8802 | .mips = true, | |
| 8803 | }); | |
| 8804 | const attributes = Attributes{}; | |
| 8805 | }; | |
| 8806 | ||
| 8807 | pub const __builtin_mips_maq_s_w_phr = struct { | |
| 8808 | const param_str = "LLiLLiV2sV2s"; | |
| 8809 | const target_set = TargetSet.init(.{ | |
| 8810 | .mips = true, | |
| 8811 | }); | |
| 8812 | const attributes = Attributes{}; | |
| 8813 | }; | |
| 8814 | ||
| 8815 | pub const __builtin_mips_maq_sa_w_phl = struct { | |
| 8816 | const param_str = "LLiLLiV2sV2s"; | |
| 8817 | const target_set = TargetSet.init(.{ | |
| 8818 | .mips = true, | |
| 8819 | }); | |
| 8820 | const attributes = Attributes{}; | |
| 8821 | }; | |
| 8822 | ||
| 8823 | pub const __builtin_mips_maq_sa_w_phr = struct { | |
| 8824 | const param_str = "LLiLLiV2sV2s"; | |
| 8825 | const target_set = TargetSet.init(.{ | |
| 8826 | .mips = true, | |
| 8827 | }); | |
| 8828 | const attributes = Attributes{}; | |
| 8829 | }; | |
| 8830 | ||
| 8831 | pub const __builtin_mips_modsub = struct { | |
| 8832 | const param_str = "iii"; | |
| 8833 | const target_set = TargetSet.init(.{ | |
| 8834 | .mips = true, | |
| 8835 | }); | |
| 8836 | const attributes = Attributes{ | |
| 8837 | .@"const" = true, | |
| 8838 | }; | |
| 8839 | }; | |
| 8840 | ||
| 8841 | pub const __builtin_mips_msub = struct { | |
| 8842 | const param_str = "LLiLLiii"; | |
| 8843 | const target_set = TargetSet.init(.{ | |
| 8844 | .mips = true, | |
| 8845 | }); | |
| 8846 | const attributes = Attributes{ | |
| 8847 | .@"const" = true, | |
| 8848 | }; | |
| 8849 | }; | |
| 8850 | ||
| 8851 | pub const __builtin_mips_msubu = struct { | |
| 8852 | const param_str = "LLiLLiUiUi"; | |
| 8853 | const target_set = TargetSet.init(.{ | |
| 8854 | .mips = true, | |
| 8855 | }); | |
| 8856 | const attributes = Attributes{ | |
| 8857 | .@"const" = true, | |
| 8858 | }; | |
| 8859 | }; | |
| 8860 | ||
| 8861 | pub const __builtin_mips_mthlip = struct { | |
| 8862 | const param_str = "LLiLLii"; | |
| 8863 | const target_set = TargetSet.init(.{ | |
| 8864 | .mips = true, | |
| 8865 | }); | |
| 8866 | const attributes = Attributes{}; | |
| 8867 | }; | |
| 8868 | ||
| 8869 | pub const __builtin_mips_mul_ph = struct { | |
| 8870 | const param_str = "V2sV2sV2s"; | |
| 8871 | const target_set = TargetSet.init(.{ | |
| 8872 | .mips = true, | |
| 8873 | }); | |
| 8874 | const attributes = Attributes{}; | |
| 8875 | }; | |
| 8876 | ||
| 8877 | pub const __builtin_mips_mul_s_ph = struct { | |
| 8878 | const param_str = "V2sV2sV2s"; | |
| 8879 | const target_set = TargetSet.init(.{ | |
| 8880 | .mips = true, | |
| 8881 | }); | |
| 8882 | const attributes = Attributes{}; | |
| 8883 | }; | |
| 8884 | ||
| 8885 | pub const __builtin_mips_muleq_s_w_phl = struct { | |
| 8886 | const param_str = "iV2sV2s"; | |
| 8887 | const target_set = TargetSet.init(.{ | |
| 8888 | .mips = true, | |
| 8889 | }); | |
| 8890 | const attributes = Attributes{}; | |
| 8891 | }; | |
| 8892 | ||
| 8893 | pub const __builtin_mips_muleq_s_w_phr = struct { | |
| 8894 | const param_str = "iV2sV2s"; | |
| 8895 | const target_set = TargetSet.init(.{ | |
| 8896 | .mips = true, | |
| 8897 | }); | |
| 8898 | const attributes = Attributes{}; | |
| 8899 | }; | |
| 8900 | ||
| 8901 | pub const __builtin_mips_muleu_s_ph_qbl = struct { | |
| 8902 | const param_str = "V2sV4ScV2s"; | |
| 8903 | const target_set = TargetSet.init(.{ | |
| 8904 | .mips = true, | |
| 8905 | }); | |
| 8906 | const attributes = Attributes{}; | |
| 8907 | }; | |
| 8908 | ||
| 8909 | pub const __builtin_mips_muleu_s_ph_qbr = struct { | |
| 8910 | const param_str = "V2sV4ScV2s"; | |
| 8911 | const target_set = TargetSet.init(.{ | |
| 8912 | .mips = true, | |
| 8913 | }); | |
| 8914 | const attributes = Attributes{}; | |
| 8915 | }; | |
| 8916 | ||
| 8917 | pub const __builtin_mips_mulq_rs_ph = struct { | |
| 8918 | const param_str = "V2sV2sV2s"; | |
| 8919 | const target_set = TargetSet.init(.{ | |
| 8920 | .mips = true, | |
| 8921 | }); | |
| 8922 | const attributes = Attributes{}; | |
| 8923 | }; | |
| 8924 | ||
| 8925 | pub const __builtin_mips_mulq_rs_w = struct { | |
| 8926 | const param_str = "iii"; | |
| 8927 | const target_set = TargetSet.init(.{ | |
| 8928 | .mips = true, | |
| 8929 | }); | |
| 8930 | const attributes = Attributes{}; | |
| 8931 | }; | |
| 8932 | ||
| 8933 | pub const __builtin_mips_mulq_s_ph = struct { | |
| 8934 | const param_str = "V2sV2sV2s"; | |
| 8935 | const target_set = TargetSet.init(.{ | |
| 8936 | .mips = true, | |
| 8937 | }); | |
| 8938 | const attributes = Attributes{}; | |
| 8939 | }; | |
| 8940 | ||
| 8941 | pub const __builtin_mips_mulq_s_w = struct { | |
| 8942 | const param_str = "iii"; | |
| 8943 | const target_set = TargetSet.init(.{ | |
| 8944 | .mips = true, | |
| 8945 | }); | |
| 8946 | const attributes = Attributes{}; | |
| 8947 | }; | |
| 8948 | ||
| 8949 | pub const __builtin_mips_mulsa_w_ph = struct { | |
| 8950 | const param_str = "LLiLLiV2sV2s"; | |
| 8951 | const target_set = TargetSet.init(.{ | |
| 8952 | .mips = true, | |
| 8953 | }); | |
| 8954 | const attributes = Attributes{ | |
| 8955 | .@"const" = true, | |
| 8956 | }; | |
| 8957 | }; | |
| 8958 | ||
| 8959 | pub const __builtin_mips_mulsaq_s_w_ph = struct { | |
| 8960 | const param_str = "LLiLLiV2sV2s"; | |
| 8961 | const target_set = TargetSet.init(.{ | |
| 8962 | .mips = true, | |
| 8963 | }); | |
| 8964 | const attributes = Attributes{}; | |
| 8965 | }; | |
| 8966 | ||
| 8967 | pub const __builtin_mips_mult = struct { | |
| 8968 | const param_str = "LLiii"; | |
| 8969 | const target_set = TargetSet.init(.{ | |
| 8970 | .mips = true, | |
| 8971 | }); | |
| 8972 | const attributes = Attributes{ | |
| 8973 | .@"const" = true, | |
| 8974 | }; | |
| 8975 | }; | |
| 8976 | ||
| 8977 | pub const __builtin_mips_multu = struct { | |
| 8978 | const param_str = "LLiUiUi"; | |
| 8979 | const target_set = TargetSet.init(.{ | |
| 8980 | .mips = true, | |
| 8981 | }); | |
| 8982 | const attributes = Attributes{ | |
| 8983 | .@"const" = true, | |
| 8984 | }; | |
| 8985 | }; | |
| 8986 | ||
| 8987 | pub const __builtin_mips_packrl_ph = struct { | |
| 8988 | const param_str = "V2sV2sV2s"; | |
| 8989 | const target_set = TargetSet.init(.{ | |
| 8990 | .mips = true, | |
| 8991 | }); | |
| 8992 | const attributes = Attributes{ | |
| 8993 | .@"const" = true, | |
| 8994 | }; | |
| 8995 | }; | |
| 8996 | ||
| 8997 | pub const __builtin_mips_pick_ph = struct { | |
| 8998 | const param_str = "V2sV2sV2s"; | |
| 8999 | const target_set = TargetSet.init(.{ | |
| 9000 | .mips = true, | |
| 9001 | }); | |
| 9002 | const attributes = Attributes{}; | |
| 9003 | }; | |
| 9004 | ||
| 9005 | pub const __builtin_mips_pick_qb = struct { | |
| 9006 | const param_str = "V4ScV4ScV4Sc"; | |
| 9007 | const target_set = TargetSet.init(.{ | |
| 9008 | .mips = true, | |
| 9009 | }); | |
| 9010 | const attributes = Attributes{}; | |
| 9011 | }; | |
| 9012 | ||
| 9013 | pub const __builtin_mips_preceq_w_phl = struct { | |
| 9014 | const param_str = "iV2s"; | |
| 9015 | const target_set = TargetSet.init(.{ | |
| 9016 | .mips = true, | |
| 9017 | }); | |
| 9018 | const attributes = Attributes{ | |
| 9019 | .@"const" = true, | |
| 9020 | }; | |
| 9021 | }; | |
| 9022 | ||
| 9023 | pub const __builtin_mips_preceq_w_phr = struct { | |
| 9024 | const param_str = "iV2s"; | |
| 9025 | const target_set = TargetSet.init(.{ | |
| 9026 | .mips = true, | |
| 9027 | }); | |
| 9028 | const attributes = Attributes{ | |
| 9029 | .@"const" = true, | |
| 9030 | }; | |
| 9031 | }; | |
| 9032 | ||
| 9033 | pub const __builtin_mips_precequ_ph_qbl = struct { | |
| 9034 | const param_str = "V2sV4Sc"; | |
| 9035 | const target_set = TargetSet.init(.{ | |
| 9036 | .mips = true, | |
| 9037 | }); | |
| 9038 | const attributes = Attributes{ | |
| 9039 | .@"const" = true, | |
| 9040 | }; | |
| 9041 | }; | |
| 9042 | ||
| 9043 | pub const __builtin_mips_precequ_ph_qbla = struct { | |
| 9044 | const param_str = "V2sV4Sc"; | |
| 9045 | const target_set = TargetSet.init(.{ | |
| 9046 | .mips = true, | |
| 9047 | }); | |
| 9048 | const attributes = Attributes{ | |
| 9049 | .@"const" = true, | |
| 9050 | }; | |
| 9051 | }; | |
| 9052 | ||
| 9053 | pub const __builtin_mips_precequ_ph_qbr = struct { | |
| 9054 | const param_str = "V2sV4Sc"; | |
| 9055 | const target_set = TargetSet.init(.{ | |
| 9056 | .mips = true, | |
| 9057 | }); | |
| 9058 | const attributes = Attributes{ | |
| 9059 | .@"const" = true, | |
| 9060 | }; | |
| 9061 | }; | |
| 9062 | ||
| 9063 | pub const __builtin_mips_precequ_ph_qbra = struct { | |
| 9064 | const param_str = "V2sV4Sc"; | |
| 9065 | const target_set = TargetSet.init(.{ | |
| 9066 | .mips = true, | |
| 9067 | }); | |
| 9068 | const attributes = Attributes{ | |
| 9069 | .@"const" = true, | |
| 9070 | }; | |
| 9071 | }; | |
| 9072 | ||
| 9073 | pub const __builtin_mips_preceu_ph_qbl = struct { | |
| 9074 | const param_str = "V2sV4Sc"; | |
| 9075 | const target_set = TargetSet.init(.{ | |
| 9076 | .mips = true, | |
| 9077 | }); | |
| 9078 | const attributes = Attributes{ | |
| 9079 | .@"const" = true, | |
| 9080 | }; | |
| 9081 | }; | |
| 9082 | ||
| 9083 | pub const __builtin_mips_preceu_ph_qbla = struct { | |
| 9084 | const param_str = "V2sV4Sc"; | |
| 9085 | const target_set = TargetSet.init(.{ | |
| 9086 | .mips = true, | |
| 9087 | }); | |
| 9088 | const attributes = Attributes{ | |
| 9089 | .@"const" = true, | |
| 9090 | }; | |
| 9091 | }; | |
| 9092 | ||
| 9093 | pub const __builtin_mips_preceu_ph_qbr = struct { | |
| 9094 | const param_str = "V2sV4Sc"; | |
| 9095 | const target_set = TargetSet.init(.{ | |
| 9096 | .mips = true, | |
| 9097 | }); | |
| 9098 | const attributes = Attributes{ | |
| 9099 | .@"const" = true, | |
| 9100 | }; | |
| 9101 | }; | |
| 9102 | ||
| 9103 | pub const __builtin_mips_preceu_ph_qbra = struct { | |
| 9104 | const param_str = "V2sV4Sc"; | |
| 9105 | const target_set = TargetSet.init(.{ | |
| 9106 | .mips = true, | |
| 9107 | }); | |
| 9108 | const attributes = Attributes{ | |
| 9109 | .@"const" = true, | |
| 9110 | }; | |
| 9111 | }; | |
| 9112 | ||
| 9113 | pub const __builtin_mips_precr_qb_ph = struct { | |
| 9114 | const param_str = "V4ScV2sV2s"; | |
| 9115 | const target_set = TargetSet.init(.{ | |
| 9116 | .mips = true, | |
| 9117 | }); | |
| 9118 | const attributes = Attributes{}; | |
| 9119 | }; | |
| 9120 | ||
| 9121 | pub const __builtin_mips_precr_sra_ph_w = struct { | |
| 9122 | const param_str = "V2siiIi"; | |
| 9123 | const target_set = TargetSet.init(.{ | |
| 9124 | .mips = true, | |
| 9125 | }); | |
| 9126 | const attributes = Attributes{ | |
| 9127 | .@"const" = true, | |
| 9128 | }; | |
| 9129 | }; | |
| 9130 | ||
| 9131 | pub const __builtin_mips_precr_sra_r_ph_w = struct { | |
| 9132 | const param_str = "V2siiIi"; | |
| 9133 | const target_set = TargetSet.init(.{ | |
| 9134 | .mips = true, | |
| 9135 | }); | |
| 9136 | const attributes = Attributes{ | |
| 9137 | .@"const" = true, | |
| 9138 | }; | |
| 9139 | }; | |
| 9140 | ||
| 9141 | pub const __builtin_mips_precrq_ph_w = struct { | |
| 9142 | const param_str = "V2sii"; | |
| 9143 | const target_set = TargetSet.init(.{ | |
| 9144 | .mips = true, | |
| 9145 | }); | |
| 9146 | const attributes = Attributes{ | |
| 9147 | .@"const" = true, | |
| 9148 | }; | |
| 9149 | }; | |
| 9150 | ||
| 9151 | pub const __builtin_mips_precrq_qb_ph = struct { | |
| 9152 | const param_str = "V4ScV2sV2s"; | |
| 9153 | const target_set = TargetSet.init(.{ | |
| 9154 | .mips = true, | |
| 9155 | }); | |
| 9156 | const attributes = Attributes{ | |
| 9157 | .@"const" = true, | |
| 9158 | }; | |
| 9159 | }; | |
| 9160 | ||
| 9161 | pub const __builtin_mips_precrq_rs_ph_w = struct { | |
| 9162 | const param_str = "V2sii"; | |
| 9163 | const target_set = TargetSet.init(.{ | |
| 9164 | .mips = true, | |
| 9165 | }); | |
| 9166 | const attributes = Attributes{}; | |
| 9167 | }; | |
| 9168 | ||
| 9169 | pub const __builtin_mips_precrqu_s_qb_ph = struct { | |
| 9170 | const param_str = "V4ScV2sV2s"; | |
| 9171 | const target_set = TargetSet.init(.{ | |
| 9172 | .mips = true, | |
| 9173 | }); | |
| 9174 | const attributes = Attributes{}; | |
| 9175 | }; | |
| 9176 | ||
| 9177 | pub const __builtin_mips_prepend = struct { | |
| 9178 | const param_str = "iiiIi"; | |
| 9179 | const target_set = TargetSet.init(.{ | |
| 9180 | .mips = true, | |
| 9181 | }); | |
| 9182 | const attributes = Attributes{ | |
| 9183 | .@"const" = true, | |
| 9184 | }; | |
| 9185 | }; | |
| 9186 | ||
| 9187 | pub const __builtin_mips_raddu_w_qb = struct { | |
| 9188 | const param_str = "iV4Sc"; | |
| 9189 | const target_set = TargetSet.init(.{ | |
| 9190 | .mips = true, | |
| 9191 | }); | |
| 9192 | const attributes = Attributes{ | |
| 9193 | .@"const" = true, | |
| 9194 | }; | |
| 9195 | }; | |
| 9196 | ||
| 9197 | pub const __builtin_mips_rddsp = struct { | |
| 9198 | const param_str = "iIi"; | |
| 9199 | const target_set = TargetSet.init(.{ | |
| 9200 | .mips = true, | |
| 9201 | }); | |
| 9202 | const attributes = Attributes{}; | |
| 9203 | }; | |
| 9204 | ||
| 9205 | pub const __builtin_mips_repl_ph = struct { | |
| 9206 | const param_str = "V2si"; | |
| 9207 | const target_set = TargetSet.init(.{ | |
| 9208 | .mips = true, | |
| 9209 | }); | |
| 9210 | const attributes = Attributes{ | |
| 9211 | .@"const" = true, | |
| 9212 | }; | |
| 9213 | }; | |
| 9214 | ||
| 9215 | pub const __builtin_mips_repl_qb = struct { | |
| 9216 | const param_str = "V4Sci"; | |
| 9217 | const target_set = TargetSet.init(.{ | |
| 9218 | .mips = true, | |
| 9219 | }); | |
| 9220 | const attributes = Attributes{ | |
| 9221 | .@"const" = true, | |
| 9222 | }; | |
| 9223 | }; | |
| 9224 | ||
| 9225 | pub const __builtin_mips_shilo = struct { | |
| 9226 | const param_str = "LLiLLii"; | |
| 9227 | const target_set = TargetSet.init(.{ | |
| 9228 | .mips = true, | |
| 9229 | }); | |
| 9230 | const attributes = Attributes{ | |
| 9231 | .@"const" = true, | |
| 9232 | }; | |
| 9233 | }; | |
| 9234 | ||
| 9235 | pub const __builtin_mips_shll_ph = struct { | |
| 9236 | const param_str = "V2sV2si"; | |
| 9237 | const target_set = TargetSet.init(.{ | |
| 9238 | .mips = true, | |
| 9239 | }); | |
| 9240 | const attributes = Attributes{}; | |
| 9241 | }; | |
| 9242 | ||
| 9243 | pub const __builtin_mips_shll_qb = struct { | |
| 9244 | const param_str = "V4ScV4Sci"; | |
| 9245 | const target_set = TargetSet.init(.{ | |
| 9246 | .mips = true, | |
| 9247 | }); | |
| 9248 | const attributes = Attributes{}; | |
| 9249 | }; | |
| 9250 | ||
| 9251 | pub const __builtin_mips_shll_s_ph = struct { | |
| 9252 | const param_str = "V2sV2si"; | |
| 9253 | const target_set = TargetSet.init(.{ | |
| 9254 | .mips = true, | |
| 9255 | }); | |
| 9256 | const attributes = Attributes{}; | |
| 9257 | }; | |
| 9258 | ||
| 9259 | pub const __builtin_mips_shll_s_w = struct { | |
| 9260 | const param_str = "iii"; | |
| 9261 | const target_set = TargetSet.init(.{ | |
| 9262 | .mips = true, | |
| 9263 | }); | |
| 9264 | const attributes = Attributes{}; | |
| 9265 | }; | |
| 9266 | ||
| 9267 | pub const __builtin_mips_shra_ph = struct { | |
| 9268 | const param_str = "V2sV2si"; | |
| 9269 | const target_set = TargetSet.init(.{ | |
| 9270 | .mips = true, | |
| 9271 | }); | |
| 9272 | const attributes = Attributes{ | |
| 9273 | .@"const" = true, | |
| 9274 | }; | |
| 9275 | }; | |
| 9276 | ||
| 9277 | pub const __builtin_mips_shra_qb = struct { | |
| 9278 | const param_str = "V4ScV4Sci"; | |
| 9279 | const target_set = TargetSet.init(.{ | |
| 9280 | .mips = true, | |
| 9281 | }); | |
| 9282 | const attributes = Attributes{ | |
| 9283 | .@"const" = true, | |
| 9284 | }; | |
| 9285 | }; | |
| 9286 | ||
| 9287 | pub const __builtin_mips_shra_r_ph = struct { | |
| 9288 | const param_str = "V2sV2si"; | |
| 9289 | const target_set = TargetSet.init(.{ | |
| 9290 | .mips = true, | |
| 9291 | }); | |
| 9292 | const attributes = Attributes{ | |
| 9293 | .@"const" = true, | |
| 9294 | }; | |
| 9295 | }; | |
| 9296 | ||
| 9297 | pub const __builtin_mips_shra_r_qb = struct { | |
| 9298 | const param_str = "V4ScV4Sci"; | |
| 9299 | const target_set = TargetSet.init(.{ | |
| 9300 | .mips = true, | |
| 9301 | }); | |
| 9302 | const attributes = Attributes{ | |
| 9303 | .@"const" = true, | |
| 9304 | }; | |
| 9305 | }; | |
| 9306 | ||
| 9307 | pub const __builtin_mips_shra_r_w = struct { | |
| 9308 | const param_str = "iii"; | |
| 9309 | const target_set = TargetSet.init(.{ | |
| 9310 | .mips = true, | |
| 9311 | }); | |
| 9312 | const attributes = Attributes{ | |
| 9313 | .@"const" = true, | |
| 9314 | }; | |
| 9315 | }; | |
| 9316 | ||
| 9317 | pub const __builtin_mips_shrl_ph = struct { | |
| 9318 | const param_str = "V2sV2si"; | |
| 9319 | const target_set = TargetSet.init(.{ | |
| 9320 | .mips = true, | |
| 9321 | }); | |
| 9322 | const attributes = Attributes{ | |
| 9323 | .@"const" = true, | |
| 9324 | }; | |
| 9325 | }; | |
| 9326 | ||
| 9327 | pub const __builtin_mips_shrl_qb = struct { | |
| 9328 | const param_str = "V4ScV4Sci"; | |
| 9329 | const target_set = TargetSet.init(.{ | |
| 9330 | .mips = true, | |
| 9331 | }); | |
| 9332 | const attributes = Attributes{ | |
| 9333 | .@"const" = true, | |
| 9334 | }; | |
| 9335 | }; | |
| 9336 | ||
| 9337 | pub const __builtin_mips_subq_ph = struct { | |
| 9338 | const param_str = "V2sV2sV2s"; | |
| 9339 | const target_set = TargetSet.init(.{ | |
| 9340 | .mips = true, | |
| 9341 | }); | |
| 9342 | const attributes = Attributes{}; | |
| 9343 | }; | |
| 9344 | ||
| 9345 | pub const __builtin_mips_subq_s_ph = struct { | |
| 9346 | const param_str = "V2sV2sV2s"; | |
| 9347 | const target_set = TargetSet.init(.{ | |
| 9348 | .mips = true, | |
| 9349 | }); | |
| 9350 | const attributes = Attributes{}; | |
| 9351 | }; | |
| 9352 | ||
| 9353 | pub const __builtin_mips_subq_s_w = struct { | |
| 9354 | const param_str = "iii"; | |
| 9355 | const target_set = TargetSet.init(.{ | |
| 9356 | .mips = true, | |
| 9357 | }); | |
| 9358 | const attributes = Attributes{}; | |
| 9359 | }; | |
| 9360 | ||
| 9361 | pub const __builtin_mips_subqh_ph = struct { | |
| 9362 | const param_str = "V2sV2sV2s"; | |
| 9363 | const target_set = TargetSet.init(.{ | |
| 9364 | .mips = true, | |
| 9365 | }); | |
| 9366 | const attributes = Attributes{ | |
| 9367 | .@"const" = true, | |
| 9368 | }; | |
| 9369 | }; | |
| 9370 | ||
| 9371 | pub const __builtin_mips_subqh_r_ph = struct { | |
| 9372 | const param_str = "V2sV2sV2s"; | |
| 9373 | const target_set = TargetSet.init(.{ | |
| 9374 | .mips = true, | |
| 9375 | }); | |
| 9376 | const attributes = Attributes{ | |
| 9377 | .@"const" = true, | |
| 9378 | }; | |
| 9379 | }; | |
| 9380 | ||
| 9381 | pub const __builtin_mips_subqh_r_w = struct { | |
| 9382 | const param_str = "iii"; | |
| 9383 | const target_set = TargetSet.init(.{ | |
| 9384 | .mips = true, | |
| 9385 | }); | |
| 9386 | const attributes = Attributes{ | |
| 9387 | .@"const" = true, | |
| 9388 | }; | |
| 9389 | }; | |
| 9390 | ||
| 9391 | pub const __builtin_mips_subqh_w = struct { | |
| 9392 | const param_str = "iii"; | |
| 9393 | const target_set = TargetSet.init(.{ | |
| 9394 | .mips = true, | |
| 9395 | }); | |
| 9396 | const attributes = Attributes{ | |
| 9397 | .@"const" = true, | |
| 9398 | }; | |
| 9399 | }; | |
| 9400 | ||
| 9401 | pub const __builtin_mips_subu_ph = struct { | |
| 9402 | const param_str = "V2sV2sV2s"; | |
| 9403 | const target_set = TargetSet.init(.{ | |
| 9404 | .mips = true, | |
| 9405 | }); | |
| 9406 | const attributes = Attributes{}; | |
| 9407 | }; | |
| 9408 | ||
| 9409 | pub const __builtin_mips_subu_qb = struct { | |
| 9410 | const param_str = "V4ScV4ScV4Sc"; | |
| 9411 | const target_set = TargetSet.init(.{ | |
| 9412 | .mips = true, | |
| 9413 | }); | |
| 9414 | const attributes = Attributes{}; | |
| 9415 | }; | |
| 9416 | ||
| 9417 | pub const __builtin_mips_subu_s_ph = struct { | |
| 9418 | const param_str = "V2sV2sV2s"; | |
| 9419 | const target_set = TargetSet.init(.{ | |
| 9420 | .mips = true, | |
| 9421 | }); | |
| 9422 | const attributes = Attributes{}; | |
| 9423 | }; | |
| 9424 | ||
| 9425 | pub const __builtin_mips_subu_s_qb = struct { | |
| 9426 | const param_str = "V4ScV4ScV4Sc"; | |
| 9427 | const target_set = TargetSet.init(.{ | |
| 9428 | .mips = true, | |
| 9429 | }); | |
| 9430 | const attributes = Attributes{}; | |
| 9431 | }; | |
| 9432 | ||
| 9433 | pub const __builtin_mips_subuh_qb = struct { | |
| 9434 | const param_str = "V4ScV4ScV4Sc"; | |
| 9435 | const target_set = TargetSet.init(.{ | |
| 9436 | .mips = true, | |
| 9437 | }); | |
| 9438 | const attributes = Attributes{ | |
| 9439 | .@"const" = true, | |
| 9440 | }; | |
| 9441 | }; | |
| 9442 | ||
| 9443 | pub const __builtin_mips_subuh_r_qb = struct { | |
| 9444 | const param_str = "V4ScV4ScV4Sc"; | |
| 9445 | const target_set = TargetSet.init(.{ | |
| 9446 | .mips = true, | |
| 9447 | }); | |
| 9448 | const attributes = Attributes{ | |
| 9449 | .@"const" = true, | |
| 9450 | }; | |
| 9451 | }; | |
| 9452 | ||
| 9453 | pub const __builtin_mips_wrdsp = struct { | |
| 9454 | const param_str = "viIi"; | |
| 9455 | const target_set = TargetSet.init(.{ | |
| 9456 | .mips = true, | |
| 9457 | }); | |
| 9458 | const attributes = Attributes{}; | |
| 9459 | }; | |
| 9460 | ||
| 9461 | pub const __builtin_modf = struct { | |
| 9462 | const param_str = "ddd*"; | |
| 9463 | const attributes = Attributes{ | |
| 9464 | .lib_function_with_builtin_prefix = true, | |
| 9465 | }; | |
| 9466 | }; | |
| 9467 | ||
| 9468 | pub const __builtin_modff = struct { | |
| 9469 | const param_str = "fff*"; | |
| 9470 | const attributes = Attributes{ | |
| 9471 | .lib_function_with_builtin_prefix = true, | |
| 9472 | }; | |
| 9473 | }; | |
| 9474 | ||
| 9475 | pub const __builtin_modff128 = struct { | |
| 9476 | const param_str = "LLdLLdLLd*"; | |
| 9477 | const attributes = Attributes{ | |
| 9478 | .lib_function_with_builtin_prefix = true, | |
| 9479 | }; | |
| 9480 | }; | |
| 9481 | ||
| 9482 | pub const __builtin_modfl = struct { | |
| 9483 | const param_str = "LdLdLd*"; | |
| 9484 | const attributes = Attributes{ | |
| 9485 | .lib_function_with_builtin_prefix = true, | |
| 9486 | }; | |
| 9487 | }; | |
| 9488 | ||
| 9489 | pub const __builtin_msa_add_a_b = struct { | |
| 9490 | const param_str = "V16ScV16ScV16Sc"; | |
| 9491 | const target_set = TargetSet.init(.{ | |
| 9492 | .mips = true, | |
| 9493 | }); | |
| 9494 | const attributes = Attributes{ | |
| 9495 | .@"const" = true, | |
| 9496 | }; | |
| 9497 | }; | |
| 9498 | ||
| 9499 | pub const __builtin_msa_add_a_d = struct { | |
| 9500 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 9501 | const target_set = TargetSet.init(.{ | |
| 9502 | .mips = true, | |
| 9503 | }); | |
| 9504 | const attributes = Attributes{ | |
| 9505 | .@"const" = true, | |
| 9506 | }; | |
| 9507 | }; | |
| 9508 | ||
| 9509 | pub const __builtin_msa_add_a_h = struct { | |
| 9510 | const param_str = "V8SsV8SsV8Ss"; | |
| 9511 | const target_set = TargetSet.init(.{ | |
| 9512 | .mips = true, | |
| 9513 | }); | |
| 9514 | const attributes = Attributes{ | |
| 9515 | .@"const" = true, | |
| 9516 | }; | |
| 9517 | }; | |
| 9518 | ||
| 9519 | pub const __builtin_msa_add_a_w = struct { | |
| 9520 | const param_str = "V4SiV4SiV4Si"; | |
| 9521 | const target_set = TargetSet.init(.{ | |
| 9522 | .mips = true, | |
| 9523 | }); | |
| 9524 | const attributes = Attributes{ | |
| 9525 | .@"const" = true, | |
| 9526 | }; | |
| 9527 | }; | |
| 9528 | ||
| 9529 | pub const __builtin_msa_adds_a_b = struct { | |
| 9530 | const param_str = "V16ScV16ScV16Sc"; | |
| 9531 | const target_set = TargetSet.init(.{ | |
| 9532 | .mips = true, | |
| 9533 | }); | |
| 9534 | const attributes = Attributes{ | |
| 9535 | .@"const" = true, | |
| 9536 | }; | |
| 9537 | }; | |
| 9538 | ||
| 9539 | pub const __builtin_msa_adds_a_d = struct { | |
| 9540 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 9541 | const target_set = TargetSet.init(.{ | |
| 9542 | .mips = true, | |
| 9543 | }); | |
| 9544 | const attributes = Attributes{ | |
| 9545 | .@"const" = true, | |
| 9546 | }; | |
| 9547 | }; | |
| 9548 | ||
| 9549 | pub const __builtin_msa_adds_a_h = struct { | |
| 9550 | const param_str = "V8SsV8SsV8Ss"; | |
| 9551 | const target_set = TargetSet.init(.{ | |
| 9552 | .mips = true, | |
| 9553 | }); | |
| 9554 | const attributes = Attributes{ | |
| 9555 | .@"const" = true, | |
| 9556 | }; | |
| 9557 | }; | |
| 9558 | ||
| 9559 | pub const __builtin_msa_adds_a_w = struct { | |
| 9560 | const param_str = "V4SiV4SiV4Si"; | |
| 9561 | const target_set = TargetSet.init(.{ | |
| 9562 | .mips = true, | |
| 9563 | }); | |
| 9564 | const attributes = Attributes{ | |
| 9565 | .@"const" = true, | |
| 9566 | }; | |
| 9567 | }; | |
| 9568 | ||
| 9569 | pub const __builtin_msa_adds_s_b = struct { | |
| 9570 | const param_str = "V16ScV16ScV16Sc"; | |
| 9571 | const target_set = TargetSet.init(.{ | |
| 9572 | .mips = true, | |
| 9573 | }); | |
| 9574 | const attributes = Attributes{ | |
| 9575 | .@"const" = true, | |
| 9576 | }; | |
| 9577 | }; | |
| 9578 | ||
| 9579 | pub const __builtin_msa_adds_s_d = struct { | |
| 9580 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 9581 | const target_set = TargetSet.init(.{ | |
| 9582 | .mips = true, | |
| 9583 | }); | |
| 9584 | const attributes = Attributes{ | |
| 9585 | .@"const" = true, | |
| 9586 | }; | |
| 9587 | }; | |
| 9588 | ||
| 9589 | pub const __builtin_msa_adds_s_h = struct { | |
| 9590 | const param_str = "V8SsV8SsV8Ss"; | |
| 9591 | const target_set = TargetSet.init(.{ | |
| 9592 | .mips = true, | |
| 9593 | }); | |
| 9594 | const attributes = Attributes{ | |
| 9595 | .@"const" = true, | |
| 9596 | }; | |
| 9597 | }; | |
| 9598 | ||
| 9599 | pub const __builtin_msa_adds_s_w = struct { | |
| 9600 | const param_str = "V4SiV4SiV4Si"; | |
| 9601 | const target_set = TargetSet.init(.{ | |
| 9602 | .mips = true, | |
| 9603 | }); | |
| 9604 | const attributes = Attributes{ | |
| 9605 | .@"const" = true, | |
| 9606 | }; | |
| 9607 | }; | |
| 9608 | ||
| 9609 | pub const __builtin_msa_adds_u_b = struct { | |
| 9610 | const param_str = "V16UcV16UcV16Uc"; | |
| 9611 | const target_set = TargetSet.init(.{ | |
| 9612 | .mips = true, | |
| 9613 | }); | |
| 9614 | const attributes = Attributes{ | |
| 9615 | .@"const" = true, | |
| 9616 | }; | |
| 9617 | }; | |
| 9618 | ||
| 9619 | pub const __builtin_msa_adds_u_d = struct { | |
| 9620 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 9621 | const target_set = TargetSet.init(.{ | |
| 9622 | .mips = true, | |
| 9623 | }); | |
| 9624 | const attributes = Attributes{ | |
| 9625 | .@"const" = true, | |
| 9626 | }; | |
| 9627 | }; | |
| 9628 | ||
| 9629 | pub const __builtin_msa_adds_u_h = struct { | |
| 9630 | const param_str = "V8UsV8UsV8Us"; | |
| 9631 | const target_set = TargetSet.init(.{ | |
| 9632 | .mips = true, | |
| 9633 | }); | |
| 9634 | const attributes = Attributes{ | |
| 9635 | .@"const" = true, | |
| 9636 | }; | |
| 9637 | }; | |
| 9638 | ||
| 9639 | pub const __builtin_msa_adds_u_w = struct { | |
| 9640 | const param_str = "V4UiV4UiV4Ui"; | |
| 9641 | const target_set = TargetSet.init(.{ | |
| 9642 | .mips = true, | |
| 9643 | }); | |
| 9644 | const attributes = Attributes{ | |
| 9645 | .@"const" = true, | |
| 9646 | }; | |
| 9647 | }; | |
| 9648 | ||
| 9649 | pub const __builtin_msa_addv_b = struct { | |
| 9650 | const param_str = "V16cV16cV16c"; | |
| 9651 | const target_set = TargetSet.init(.{ | |
| 9652 | .mips = true, | |
| 9653 | }); | |
| 9654 | const attributes = Attributes{ | |
| 9655 | .@"const" = true, | |
| 9656 | }; | |
| 9657 | }; | |
| 9658 | ||
| 9659 | pub const __builtin_msa_addv_d = struct { | |
| 9660 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 9661 | const target_set = TargetSet.init(.{ | |
| 9662 | .mips = true, | |
| 9663 | }); | |
| 9664 | const attributes = Attributes{ | |
| 9665 | .@"const" = true, | |
| 9666 | }; | |
| 9667 | }; | |
| 9668 | ||
| 9669 | pub const __builtin_msa_addv_h = struct { | |
| 9670 | const param_str = "V8sV8sV8s"; | |
| 9671 | const target_set = TargetSet.init(.{ | |
| 9672 | .mips = true, | |
| 9673 | }); | |
| 9674 | const attributes = Attributes{ | |
| 9675 | .@"const" = true, | |
| 9676 | }; | |
| 9677 | }; | |
| 9678 | ||
| 9679 | pub const __builtin_msa_addv_w = struct { | |
| 9680 | const param_str = "V4iV4iV4i"; | |
| 9681 | const target_set = TargetSet.init(.{ | |
| 9682 | .mips = true, | |
| 9683 | }); | |
| 9684 | const attributes = Attributes{ | |
| 9685 | .@"const" = true, | |
| 9686 | }; | |
| 9687 | }; | |
| 9688 | ||
| 9689 | pub const __builtin_msa_addvi_b = struct { | |
| 9690 | const param_str = "V16cV16cIUi"; | |
| 9691 | const target_set = TargetSet.init(.{ | |
| 9692 | .mips = true, | |
| 9693 | }); | |
| 9694 | const attributes = Attributes{ | |
| 9695 | .@"const" = true, | |
| 9696 | }; | |
| 9697 | }; | |
| 9698 | ||
| 9699 | pub const __builtin_msa_addvi_d = struct { | |
| 9700 | const param_str = "V2LLiV2LLiIUi"; | |
| 9701 | const target_set = TargetSet.init(.{ | |
| 9702 | .mips = true, | |
| 9703 | }); | |
| 9704 | const attributes = Attributes{ | |
| 9705 | .@"const" = true, | |
| 9706 | }; | |
| 9707 | }; | |
| 9708 | ||
| 9709 | pub const __builtin_msa_addvi_h = struct { | |
| 9710 | const param_str = "V8sV8sIUi"; | |
| 9711 | const target_set = TargetSet.init(.{ | |
| 9712 | .mips = true, | |
| 9713 | }); | |
| 9714 | const attributes = Attributes{ | |
| 9715 | .@"const" = true, | |
| 9716 | }; | |
| 9717 | }; | |
| 9718 | ||
| 9719 | pub const __builtin_msa_addvi_w = struct { | |
| 9720 | const param_str = "V4iV4iIUi"; | |
| 9721 | const target_set = TargetSet.init(.{ | |
| 9722 | .mips = true, | |
| 9723 | }); | |
| 9724 | const attributes = Attributes{ | |
| 9725 | .@"const" = true, | |
| 9726 | }; | |
| 9727 | }; | |
| 9728 | ||
| 9729 | pub const __builtin_msa_and_v = struct { | |
| 9730 | const param_str = "V16UcV16UcV16Uc"; | |
| 9731 | const target_set = TargetSet.init(.{ | |
| 9732 | .mips = true, | |
| 9733 | }); | |
| 9734 | const attributes = Attributes{ | |
| 9735 | .@"const" = true, | |
| 9736 | }; | |
| 9737 | }; | |
| 9738 | ||
| 9739 | pub const __builtin_msa_andi_b = struct { | |
| 9740 | const param_str = "V16UcV16UcIUi"; | |
| 9741 | const target_set = TargetSet.init(.{ | |
| 9742 | .mips = true, | |
| 9743 | }); | |
| 9744 | const attributes = Attributes{ | |
| 9745 | .@"const" = true, | |
| 9746 | }; | |
| 9747 | }; | |
| 9748 | ||
| 9749 | pub const __builtin_msa_asub_s_b = struct { | |
| 9750 | const param_str = "V16ScV16ScV16Sc"; | |
| 9751 | const target_set = TargetSet.init(.{ | |
| 9752 | .mips = true, | |
| 9753 | }); | |
| 9754 | const attributes = Attributes{ | |
| 9755 | .@"const" = true, | |
| 9756 | }; | |
| 9757 | }; | |
| 9758 | ||
| 9759 | pub const __builtin_msa_asub_s_d = struct { | |
| 9760 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 9761 | const target_set = TargetSet.init(.{ | |
| 9762 | .mips = true, | |
| 9763 | }); | |
| 9764 | const attributes = Attributes{ | |
| 9765 | .@"const" = true, | |
| 9766 | }; | |
| 9767 | }; | |
| 9768 | ||
| 9769 | pub const __builtin_msa_asub_s_h = struct { | |
| 9770 | const param_str = "V8SsV8SsV8Ss"; | |
| 9771 | const target_set = TargetSet.init(.{ | |
| 9772 | .mips = true, | |
| 9773 | }); | |
| 9774 | const attributes = Attributes{ | |
| 9775 | .@"const" = true, | |
| 9776 | }; | |
| 9777 | }; | |
| 9778 | ||
| 9779 | pub const __builtin_msa_asub_s_w = struct { | |
| 9780 | const param_str = "V4SiV4SiV4Si"; | |
| 9781 | const target_set = TargetSet.init(.{ | |
| 9782 | .mips = true, | |
| 9783 | }); | |
| 9784 | const attributes = Attributes{ | |
| 9785 | .@"const" = true, | |
| 9786 | }; | |
| 9787 | }; | |
| 9788 | ||
| 9789 | pub const __builtin_msa_asub_u_b = struct { | |
| 9790 | const param_str = "V16UcV16UcV16Uc"; | |
| 9791 | const target_set = TargetSet.init(.{ | |
| 9792 | .mips = true, | |
| 9793 | }); | |
| 9794 | const attributes = Attributes{ | |
| 9795 | .@"const" = true, | |
| 9796 | }; | |
| 9797 | }; | |
| 9798 | ||
| 9799 | pub const __builtin_msa_asub_u_d = struct { | |
| 9800 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 9801 | const target_set = TargetSet.init(.{ | |
| 9802 | .mips = true, | |
| 9803 | }); | |
| 9804 | const attributes = Attributes{ | |
| 9805 | .@"const" = true, | |
| 9806 | }; | |
| 9807 | }; | |
| 9808 | ||
| 9809 | pub const __builtin_msa_asub_u_h = struct { | |
| 9810 | const param_str = "V8UsV8UsV8Us"; | |
| 9811 | const target_set = TargetSet.init(.{ | |
| 9812 | .mips = true, | |
| 9813 | }); | |
| 9814 | const attributes = Attributes{ | |
| 9815 | .@"const" = true, | |
| 9816 | }; | |
| 9817 | }; | |
| 9818 | ||
| 9819 | pub const __builtin_msa_asub_u_w = struct { | |
| 9820 | const param_str = "V4UiV4UiV4Ui"; | |
| 9821 | const target_set = TargetSet.init(.{ | |
| 9822 | .mips = true, | |
| 9823 | }); | |
| 9824 | const attributes = Attributes{ | |
| 9825 | .@"const" = true, | |
| 9826 | }; | |
| 9827 | }; | |
| 9828 | ||
| 9829 | pub const __builtin_msa_ave_s_b = struct { | |
| 9830 | const param_str = "V16ScV16ScV16Sc"; | |
| 9831 | const target_set = TargetSet.init(.{ | |
| 9832 | .mips = true, | |
| 9833 | }); | |
| 9834 | const attributes = Attributes{ | |
| 9835 | .@"const" = true, | |
| 9836 | }; | |
| 9837 | }; | |
| 9838 | ||
| 9839 | pub const __builtin_msa_ave_s_d = struct { | |
| 9840 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 9841 | const target_set = TargetSet.init(.{ | |
| 9842 | .mips = true, | |
| 9843 | }); | |
| 9844 | const attributes = Attributes{ | |
| 9845 | .@"const" = true, | |
| 9846 | }; | |
| 9847 | }; | |
| 9848 | ||
| 9849 | pub const __builtin_msa_ave_s_h = struct { | |
| 9850 | const param_str = "V8SsV8SsV8Ss"; | |
| 9851 | const target_set = TargetSet.init(.{ | |
| 9852 | .mips = true, | |
| 9853 | }); | |
| 9854 | const attributes = Attributes{ | |
| 9855 | .@"const" = true, | |
| 9856 | }; | |
| 9857 | }; | |
| 9858 | ||
| 9859 | pub const __builtin_msa_ave_s_w = struct { | |
| 9860 | const param_str = "V4SiV4SiV4Si"; | |
| 9861 | const target_set = TargetSet.init(.{ | |
| 9862 | .mips = true, | |
| 9863 | }); | |
| 9864 | const attributes = Attributes{ | |
| 9865 | .@"const" = true, | |
| 9866 | }; | |
| 9867 | }; | |
| 9868 | ||
| 9869 | pub const __builtin_msa_ave_u_b = struct { | |
| 9870 | const param_str = "V16UcV16UcV16Uc"; | |
| 9871 | const target_set = TargetSet.init(.{ | |
| 9872 | .mips = true, | |
| 9873 | }); | |
| 9874 | const attributes = Attributes{ | |
| 9875 | .@"const" = true, | |
| 9876 | }; | |
| 9877 | }; | |
| 9878 | ||
| 9879 | pub const __builtin_msa_ave_u_d = struct { | |
| 9880 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 9881 | const target_set = TargetSet.init(.{ | |
| 9882 | .mips = true, | |
| 9883 | }); | |
| 9884 | const attributes = Attributes{ | |
| 9885 | .@"const" = true, | |
| 9886 | }; | |
| 9887 | }; | |
| 9888 | ||
| 9889 | pub const __builtin_msa_ave_u_h = struct { | |
| 9890 | const param_str = "V8UsV8UsV8Us"; | |
| 9891 | const target_set = TargetSet.init(.{ | |
| 9892 | .mips = true, | |
| 9893 | }); | |
| 9894 | const attributes = Attributes{ | |
| 9895 | .@"const" = true, | |
| 9896 | }; | |
| 9897 | }; | |
| 9898 | ||
| 9899 | pub const __builtin_msa_ave_u_w = struct { | |
| 9900 | const param_str = "V4UiV4UiV4Ui"; | |
| 9901 | const target_set = TargetSet.init(.{ | |
| 9902 | .mips = true, | |
| 9903 | }); | |
| 9904 | const attributes = Attributes{ | |
| 9905 | .@"const" = true, | |
| 9906 | }; | |
| 9907 | }; | |
| 9908 | ||
| 9909 | pub const __builtin_msa_aver_s_b = struct { | |
| 9910 | const param_str = "V16ScV16ScV16Sc"; | |
| 9911 | const target_set = TargetSet.init(.{ | |
| 9912 | .mips = true, | |
| 9913 | }); | |
| 9914 | const attributes = Attributes{ | |
| 9915 | .@"const" = true, | |
| 9916 | }; | |
| 9917 | }; | |
| 9918 | ||
| 9919 | pub const __builtin_msa_aver_s_d = struct { | |
| 9920 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 9921 | const target_set = TargetSet.init(.{ | |
| 9922 | .mips = true, | |
| 9923 | }); | |
| 9924 | const attributes = Attributes{ | |
| 9925 | .@"const" = true, | |
| 9926 | }; | |
| 9927 | }; | |
| 9928 | ||
| 9929 | pub const __builtin_msa_aver_s_h = struct { | |
| 9930 | const param_str = "V8SsV8SsV8Ss"; | |
| 9931 | const target_set = TargetSet.init(.{ | |
| 9932 | .mips = true, | |
| 9933 | }); | |
| 9934 | const attributes = Attributes{ | |
| 9935 | .@"const" = true, | |
| 9936 | }; | |
| 9937 | }; | |
| 9938 | ||
| 9939 | pub const __builtin_msa_aver_s_w = struct { | |
| 9940 | const param_str = "V4SiV4SiV4Si"; | |
| 9941 | const target_set = TargetSet.init(.{ | |
| 9942 | .mips = true, | |
| 9943 | }); | |
| 9944 | const attributes = Attributes{ | |
| 9945 | .@"const" = true, | |
| 9946 | }; | |
| 9947 | }; | |
| 9948 | ||
| 9949 | pub const __builtin_msa_aver_u_b = struct { | |
| 9950 | const param_str = "V16UcV16UcV16Uc"; | |
| 9951 | const target_set = TargetSet.init(.{ | |
| 9952 | .mips = true, | |
| 9953 | }); | |
| 9954 | const attributes = Attributes{ | |
| 9955 | .@"const" = true, | |
| 9956 | }; | |
| 9957 | }; | |
| 9958 | ||
| 9959 | pub const __builtin_msa_aver_u_d = struct { | |
| 9960 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 9961 | const target_set = TargetSet.init(.{ | |
| 9962 | .mips = true, | |
| 9963 | }); | |
| 9964 | const attributes = Attributes{ | |
| 9965 | .@"const" = true, | |
| 9966 | }; | |
| 9967 | }; | |
| 9968 | ||
| 9969 | pub const __builtin_msa_aver_u_h = struct { | |
| 9970 | const param_str = "V8UsV8UsV8Us"; | |
| 9971 | const target_set = TargetSet.init(.{ | |
| 9972 | .mips = true, | |
| 9973 | }); | |
| 9974 | const attributes = Attributes{ | |
| 9975 | .@"const" = true, | |
| 9976 | }; | |
| 9977 | }; | |
| 9978 | ||
| 9979 | pub const __builtin_msa_aver_u_w = struct { | |
| 9980 | const param_str = "V4UiV4UiV4Ui"; | |
| 9981 | const target_set = TargetSet.init(.{ | |
| 9982 | .mips = true, | |
| 9983 | }); | |
| 9984 | const attributes = Attributes{ | |
| 9985 | .@"const" = true, | |
| 9986 | }; | |
| 9987 | }; | |
| 9988 | ||
| 9989 | pub const __builtin_msa_bclr_b = struct { | |
| 9990 | const param_str = "V16UcV16UcV16Uc"; | |
| 9991 | const target_set = TargetSet.init(.{ | |
| 9992 | .mips = true, | |
| 9993 | }); | |
| 9994 | const attributes = Attributes{ | |
| 9995 | .@"const" = true, | |
| 9996 | }; | |
| 9997 | }; | |
| 9998 | ||
| 9999 | pub const __builtin_msa_bclr_d = struct { | |
| 10000 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 10001 | const target_set = TargetSet.init(.{ | |
| 10002 | .mips = true, | |
| 10003 | }); | |
| 10004 | const attributes = Attributes{ | |
| 10005 | .@"const" = true, | |
| 10006 | }; | |
| 10007 | }; | |
| 10008 | ||
| 10009 | pub const __builtin_msa_bclr_h = struct { | |
| 10010 | const param_str = "V8UsV8UsV8Us"; | |
| 10011 | const target_set = TargetSet.init(.{ | |
| 10012 | .mips = true, | |
| 10013 | }); | |
| 10014 | const attributes = Attributes{ | |
| 10015 | .@"const" = true, | |
| 10016 | }; | |
| 10017 | }; | |
| 10018 | ||
| 10019 | pub const __builtin_msa_bclr_w = struct { | |
| 10020 | const param_str = "V4UiV4UiV4Ui"; | |
| 10021 | const target_set = TargetSet.init(.{ | |
| 10022 | .mips = true, | |
| 10023 | }); | |
| 10024 | const attributes = Attributes{ | |
| 10025 | .@"const" = true, | |
| 10026 | }; | |
| 10027 | }; | |
| 10028 | ||
| 10029 | pub const __builtin_msa_bclri_b = struct { | |
| 10030 | const param_str = "V16UcV16UcIUi"; | |
| 10031 | const target_set = TargetSet.init(.{ | |
| 10032 | .mips = true, | |
| 10033 | }); | |
| 10034 | const attributes = Attributes{ | |
| 10035 | .@"const" = true, | |
| 10036 | }; | |
| 10037 | }; | |
| 10038 | ||
| 10039 | pub const __builtin_msa_bclri_d = struct { | |
| 10040 | const param_str = "V2ULLiV2ULLiIUi"; | |
| 10041 | const target_set = TargetSet.init(.{ | |
| 10042 | .mips = true, | |
| 10043 | }); | |
| 10044 | const attributes = Attributes{ | |
| 10045 | .@"const" = true, | |
| 10046 | }; | |
| 10047 | }; | |
| 10048 | ||
| 10049 | pub const __builtin_msa_bclri_h = struct { | |
| 10050 | const param_str = "V8UsV8UsIUi"; | |
| 10051 | const target_set = TargetSet.init(.{ | |
| 10052 | .mips = true, | |
| 10053 | }); | |
| 10054 | const attributes = Attributes{ | |
| 10055 | .@"const" = true, | |
| 10056 | }; | |
| 10057 | }; | |
| 10058 | ||
| 10059 | pub const __builtin_msa_bclri_w = struct { | |
| 10060 | const param_str = "V4UiV4UiIUi"; | |
| 10061 | const target_set = TargetSet.init(.{ | |
| 10062 | .mips = true, | |
| 10063 | }); | |
| 10064 | const attributes = Attributes{ | |
| 10065 | .@"const" = true, | |
| 10066 | }; | |
| 10067 | }; | |
| 10068 | ||
| 10069 | pub const __builtin_msa_binsl_b = struct { | |
| 10070 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 10071 | const target_set = TargetSet.init(.{ | |
| 10072 | .mips = true, | |
| 10073 | }); | |
| 10074 | const attributes = Attributes{ | |
| 10075 | .@"const" = true, | |
| 10076 | }; | |
| 10077 | }; | |
| 10078 | ||
| 10079 | pub const __builtin_msa_binsl_d = struct { | |
| 10080 | const param_str = "V2ULLiV2ULLiV2ULLiV2ULLi"; | |
| 10081 | const target_set = TargetSet.init(.{ | |
| 10082 | .mips = true, | |
| 10083 | }); | |
| 10084 | const attributes = Attributes{ | |
| 10085 | .@"const" = true, | |
| 10086 | }; | |
| 10087 | }; | |
| 10088 | ||
| 10089 | pub const __builtin_msa_binsl_h = struct { | |
| 10090 | const param_str = "V8UsV8UsV8UsV8Us"; | |
| 10091 | const target_set = TargetSet.init(.{ | |
| 10092 | .mips = true, | |
| 10093 | }); | |
| 10094 | const attributes = Attributes{ | |
| 10095 | .@"const" = true, | |
| 10096 | }; | |
| 10097 | }; | |
| 10098 | ||
| 10099 | pub const __builtin_msa_binsl_w = struct { | |
| 10100 | const param_str = "V4UiV4UiV4UiV4Ui"; | |
| 10101 | const target_set = TargetSet.init(.{ | |
| 10102 | .mips = true, | |
| 10103 | }); | |
| 10104 | const attributes = Attributes{ | |
| 10105 | .@"const" = true, | |
| 10106 | }; | |
| 10107 | }; | |
| 10108 | ||
| 10109 | pub const __builtin_msa_binsli_b = struct { | |
| 10110 | const param_str = "V16UcV16UcV16UcIUi"; | |
| 10111 | const target_set = TargetSet.init(.{ | |
| 10112 | .mips = true, | |
| 10113 | }); | |
| 10114 | const attributes = Attributes{ | |
| 10115 | .@"const" = true, | |
| 10116 | }; | |
| 10117 | }; | |
| 10118 | ||
| 10119 | pub const __builtin_msa_binsli_d = struct { | |
| 10120 | const param_str = "V2ULLiV2ULLiV2ULLiIUi"; | |
| 10121 | const target_set = TargetSet.init(.{ | |
| 10122 | .mips = true, | |
| 10123 | }); | |
| 10124 | const attributes = Attributes{ | |
| 10125 | .@"const" = true, | |
| 10126 | }; | |
| 10127 | }; | |
| 10128 | ||
| 10129 | pub const __builtin_msa_binsli_h = struct { | |
| 10130 | const param_str = "V8UsV8UsV8UsIUi"; | |
| 10131 | const target_set = TargetSet.init(.{ | |
| 10132 | .mips = true, | |
| 10133 | }); | |
| 10134 | const attributes = Attributes{ | |
| 10135 | .@"const" = true, | |
| 10136 | }; | |
| 10137 | }; | |
| 10138 | ||
| 10139 | pub const __builtin_msa_binsli_w = struct { | |
| 10140 | const param_str = "V4UiV4UiV4UiIUi"; | |
| 10141 | const target_set = TargetSet.init(.{ | |
| 10142 | .mips = true, | |
| 10143 | }); | |
| 10144 | const attributes = Attributes{ | |
| 10145 | .@"const" = true, | |
| 10146 | }; | |
| 10147 | }; | |
| 10148 | ||
| 10149 | pub const __builtin_msa_binsr_b = struct { | |
| 10150 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 10151 | const target_set = TargetSet.init(.{ | |
| 10152 | .mips = true, | |
| 10153 | }); | |
| 10154 | const attributes = Attributes{ | |
| 10155 | .@"const" = true, | |
| 10156 | }; | |
| 10157 | }; | |
| 10158 | ||
| 10159 | pub const __builtin_msa_binsr_d = struct { | |
| 10160 | const param_str = "V2ULLiV2ULLiV2ULLiV2ULLi"; | |
| 10161 | const target_set = TargetSet.init(.{ | |
| 10162 | .mips = true, | |
| 10163 | }); | |
| 10164 | const attributes = Attributes{ | |
| 10165 | .@"const" = true, | |
| 10166 | }; | |
| 10167 | }; | |
| 10168 | ||
| 10169 | pub const __builtin_msa_binsr_h = struct { | |
| 10170 | const param_str = "V8UsV8UsV8UsV8Us"; | |
| 10171 | const target_set = TargetSet.init(.{ | |
| 10172 | .mips = true, | |
| 10173 | }); | |
| 10174 | const attributes = Attributes{ | |
| 10175 | .@"const" = true, | |
| 10176 | }; | |
| 10177 | }; | |
| 10178 | ||
| 10179 | pub const __builtin_msa_binsr_w = struct { | |
| 10180 | const param_str = "V4UiV4UiV4UiV4Ui"; | |
| 10181 | const target_set = TargetSet.init(.{ | |
| 10182 | .mips = true, | |
| 10183 | }); | |
| 10184 | const attributes = Attributes{ | |
| 10185 | .@"const" = true, | |
| 10186 | }; | |
| 10187 | }; | |
| 10188 | ||
| 10189 | pub const __builtin_msa_binsri_b = struct { | |
| 10190 | const param_str = "V16UcV16UcV16UcIUi"; | |
| 10191 | const target_set = TargetSet.init(.{ | |
| 10192 | .mips = true, | |
| 10193 | }); | |
| 10194 | const attributes = Attributes{ | |
| 10195 | .@"const" = true, | |
| 10196 | }; | |
| 10197 | }; | |
| 10198 | ||
| 10199 | pub const __builtin_msa_binsri_d = struct { | |
| 10200 | const param_str = "V2ULLiV2ULLiV2ULLiIUi"; | |
| 10201 | const target_set = TargetSet.init(.{ | |
| 10202 | .mips = true, | |
| 10203 | }); | |
| 10204 | const attributes = Attributes{ | |
| 10205 | .@"const" = true, | |
| 10206 | }; | |
| 10207 | }; | |
| 10208 | ||
| 10209 | pub const __builtin_msa_binsri_h = struct { | |
| 10210 | const param_str = "V8UsV8UsV8UsIUi"; | |
| 10211 | const target_set = TargetSet.init(.{ | |
| 10212 | .mips = true, | |
| 10213 | }); | |
| 10214 | const attributes = Attributes{ | |
| 10215 | .@"const" = true, | |
| 10216 | }; | |
| 10217 | }; | |
| 10218 | ||
| 10219 | pub const __builtin_msa_binsri_w = struct { | |
| 10220 | const param_str = "V4UiV4UiV4UiIUi"; | |
| 10221 | const target_set = TargetSet.init(.{ | |
| 10222 | .mips = true, | |
| 10223 | }); | |
| 10224 | const attributes = Attributes{ | |
| 10225 | .@"const" = true, | |
| 10226 | }; | |
| 10227 | }; | |
| 10228 | ||
| 10229 | pub const __builtin_msa_bmnz_v = struct { | |
| 10230 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 10231 | const target_set = TargetSet.init(.{ | |
| 10232 | .mips = true, | |
| 10233 | }); | |
| 10234 | const attributes = Attributes{ | |
| 10235 | .@"const" = true, | |
| 10236 | }; | |
| 10237 | }; | |
| 10238 | ||
| 10239 | pub const __builtin_msa_bmnzi_b = struct { | |
| 10240 | const param_str = "V16UcV16UcV16UcIUi"; | |
| 10241 | const target_set = TargetSet.init(.{ | |
| 10242 | .mips = true, | |
| 10243 | }); | |
| 10244 | const attributes = Attributes{ | |
| 10245 | .@"const" = true, | |
| 10246 | }; | |
| 10247 | }; | |
| 10248 | ||
| 10249 | pub const __builtin_msa_bmz_v = struct { | |
| 10250 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 10251 | const target_set = TargetSet.init(.{ | |
| 10252 | .mips = true, | |
| 10253 | }); | |
| 10254 | const attributes = Attributes{ | |
| 10255 | .@"const" = true, | |
| 10256 | }; | |
| 10257 | }; | |
| 10258 | ||
| 10259 | pub const __builtin_msa_bmzi_b = struct { | |
| 10260 | const param_str = "V16UcV16UcV16UcIUi"; | |
| 10261 | const target_set = TargetSet.init(.{ | |
| 10262 | .mips = true, | |
| 10263 | }); | |
| 10264 | const attributes = Attributes{ | |
| 10265 | .@"const" = true, | |
| 10266 | }; | |
| 10267 | }; | |
| 10268 | ||
| 10269 | pub const __builtin_msa_bneg_b = struct { | |
| 10270 | const param_str = "V16UcV16UcV16Uc"; | |
| 10271 | const target_set = TargetSet.init(.{ | |
| 10272 | .mips = true, | |
| 10273 | }); | |
| 10274 | const attributes = Attributes{ | |
| 10275 | .@"const" = true, | |
| 10276 | }; | |
| 10277 | }; | |
| 10278 | ||
| 10279 | pub const __builtin_msa_bneg_d = struct { | |
| 10280 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 10281 | const target_set = TargetSet.init(.{ | |
| 10282 | .mips = true, | |
| 10283 | }); | |
| 10284 | const attributes = Attributes{ | |
| 10285 | .@"const" = true, | |
| 10286 | }; | |
| 10287 | }; | |
| 10288 | ||
| 10289 | pub const __builtin_msa_bneg_h = struct { | |
| 10290 | const param_str = "V8UsV8UsV8Us"; | |
| 10291 | const target_set = TargetSet.init(.{ | |
| 10292 | .mips = true, | |
| 10293 | }); | |
| 10294 | const attributes = Attributes{ | |
| 10295 | .@"const" = true, | |
| 10296 | }; | |
| 10297 | }; | |
| 10298 | ||
| 10299 | pub const __builtin_msa_bneg_w = struct { | |
| 10300 | const param_str = "V4UiV4UiV4Ui"; | |
| 10301 | const target_set = TargetSet.init(.{ | |
| 10302 | .mips = true, | |
| 10303 | }); | |
| 10304 | const attributes = Attributes{ | |
| 10305 | .@"const" = true, | |
| 10306 | }; | |
| 10307 | }; | |
| 10308 | ||
| 10309 | pub const __builtin_msa_bnegi_b = struct { | |
| 10310 | const param_str = "V16UcV16UcIUi"; | |
| 10311 | const target_set = TargetSet.init(.{ | |
| 10312 | .mips = true, | |
| 10313 | }); | |
| 10314 | const attributes = Attributes{ | |
| 10315 | .@"const" = true, | |
| 10316 | }; | |
| 10317 | }; | |
| 10318 | ||
| 10319 | pub const __builtin_msa_bnegi_d = struct { | |
| 10320 | const param_str = "V2ULLiV2ULLiIUi"; | |
| 10321 | const target_set = TargetSet.init(.{ | |
| 10322 | .mips = true, | |
| 10323 | }); | |
| 10324 | const attributes = Attributes{ | |
| 10325 | .@"const" = true, | |
| 10326 | }; | |
| 10327 | }; | |
| 10328 | ||
| 10329 | pub const __builtin_msa_bnegi_h = struct { | |
| 10330 | const param_str = "V8UsV8UsIUi"; | |
| 10331 | const target_set = TargetSet.init(.{ | |
| 10332 | .mips = true, | |
| 10333 | }); | |
| 10334 | const attributes = Attributes{ | |
| 10335 | .@"const" = true, | |
| 10336 | }; | |
| 10337 | }; | |
| 10338 | ||
| 10339 | pub const __builtin_msa_bnegi_w = struct { | |
| 10340 | const param_str = "V4UiV4UiIUi"; | |
| 10341 | const target_set = TargetSet.init(.{ | |
| 10342 | .mips = true, | |
| 10343 | }); | |
| 10344 | const attributes = Attributes{ | |
| 10345 | .@"const" = true, | |
| 10346 | }; | |
| 10347 | }; | |
| 10348 | ||
| 10349 | pub const __builtin_msa_bnz_b = struct { | |
| 10350 | const param_str = "iV16Uc"; | |
| 10351 | const target_set = TargetSet.init(.{ | |
| 10352 | .mips = true, | |
| 10353 | }); | |
| 10354 | const attributes = Attributes{ | |
| 10355 | .@"const" = true, | |
| 10356 | }; | |
| 10357 | }; | |
| 10358 | ||
| 10359 | pub const __builtin_msa_bnz_d = struct { | |
| 10360 | const param_str = "iV2ULLi"; | |
| 10361 | const target_set = TargetSet.init(.{ | |
| 10362 | .mips = true, | |
| 10363 | }); | |
| 10364 | const attributes = Attributes{ | |
| 10365 | .@"const" = true, | |
| 10366 | }; | |
| 10367 | }; | |
| 10368 | ||
| 10369 | pub const __builtin_msa_bnz_h = struct { | |
| 10370 | const param_str = "iV8Us"; | |
| 10371 | const target_set = TargetSet.init(.{ | |
| 10372 | .mips = true, | |
| 10373 | }); | |
| 10374 | const attributes = Attributes{ | |
| 10375 | .@"const" = true, | |
| 10376 | }; | |
| 10377 | }; | |
| 10378 | ||
| 10379 | pub const __builtin_msa_bnz_v = struct { | |
| 10380 | const param_str = "iV16Uc"; | |
| 10381 | const target_set = TargetSet.init(.{ | |
| 10382 | .mips = true, | |
| 10383 | }); | |
| 10384 | const attributes = Attributes{ | |
| 10385 | .@"const" = true, | |
| 10386 | }; | |
| 10387 | }; | |
| 10388 | ||
| 10389 | pub const __builtin_msa_bnz_w = struct { | |
| 10390 | const param_str = "iV4Ui"; | |
| 10391 | const target_set = TargetSet.init(.{ | |
| 10392 | .mips = true, | |
| 10393 | }); | |
| 10394 | const attributes = Attributes{ | |
| 10395 | .@"const" = true, | |
| 10396 | }; | |
| 10397 | }; | |
| 10398 | ||
| 10399 | pub const __builtin_msa_bsel_v = struct { | |
| 10400 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 10401 | const target_set = TargetSet.init(.{ | |
| 10402 | .mips = true, | |
| 10403 | }); | |
| 10404 | const attributes = Attributes{ | |
| 10405 | .@"const" = true, | |
| 10406 | }; | |
| 10407 | }; | |
| 10408 | ||
| 10409 | pub const __builtin_msa_bseli_b = struct { | |
| 10410 | const param_str = "V16UcV16UcV16UcIUi"; | |
| 10411 | const target_set = TargetSet.init(.{ | |
| 10412 | .mips = true, | |
| 10413 | }); | |
| 10414 | const attributes = Attributes{ | |
| 10415 | .@"const" = true, | |
| 10416 | }; | |
| 10417 | }; | |
| 10418 | ||
| 10419 | pub const __builtin_msa_bset_b = struct { | |
| 10420 | const param_str = "V16UcV16UcV16Uc"; | |
| 10421 | const target_set = TargetSet.init(.{ | |
| 10422 | .mips = true, | |
| 10423 | }); | |
| 10424 | const attributes = Attributes{ | |
| 10425 | .@"const" = true, | |
| 10426 | }; | |
| 10427 | }; | |
| 10428 | ||
| 10429 | pub const __builtin_msa_bset_d = struct { | |
| 10430 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 10431 | const target_set = TargetSet.init(.{ | |
| 10432 | .mips = true, | |
| 10433 | }); | |
| 10434 | const attributes = Attributes{ | |
| 10435 | .@"const" = true, | |
| 10436 | }; | |
| 10437 | }; | |
| 10438 | ||
| 10439 | pub const __builtin_msa_bset_h = struct { | |
| 10440 | const param_str = "V8UsV8UsV8Us"; | |
| 10441 | const target_set = TargetSet.init(.{ | |
| 10442 | .mips = true, | |
| 10443 | }); | |
| 10444 | const attributes = Attributes{ | |
| 10445 | .@"const" = true, | |
| 10446 | }; | |
| 10447 | }; | |
| 10448 | ||
| 10449 | pub const __builtin_msa_bset_w = struct { | |
| 10450 | const param_str = "V4UiV4UiV4Ui"; | |
| 10451 | const target_set = TargetSet.init(.{ | |
| 10452 | .mips = true, | |
| 10453 | }); | |
| 10454 | const attributes = Attributes{ | |
| 10455 | .@"const" = true, | |
| 10456 | }; | |
| 10457 | }; | |
| 10458 | ||
| 10459 | pub const __builtin_msa_bseti_b = struct { | |
| 10460 | const param_str = "V16UcV16UcIUi"; | |
| 10461 | const target_set = TargetSet.init(.{ | |
| 10462 | .mips = true, | |
| 10463 | }); | |
| 10464 | const attributes = Attributes{ | |
| 10465 | .@"const" = true, | |
| 10466 | }; | |
| 10467 | }; | |
| 10468 | ||
| 10469 | pub const __builtin_msa_bseti_d = struct { | |
| 10470 | const param_str = "V2ULLiV2ULLiIUi"; | |
| 10471 | const target_set = TargetSet.init(.{ | |
| 10472 | .mips = true, | |
| 10473 | }); | |
| 10474 | const attributes = Attributes{ | |
| 10475 | .@"const" = true, | |
| 10476 | }; | |
| 10477 | }; | |
| 10478 | ||
| 10479 | pub const __builtin_msa_bseti_h = struct { | |
| 10480 | const param_str = "V8UsV8UsIUi"; | |
| 10481 | const target_set = TargetSet.init(.{ | |
| 10482 | .mips = true, | |
| 10483 | }); | |
| 10484 | const attributes = Attributes{ | |
| 10485 | .@"const" = true, | |
| 10486 | }; | |
| 10487 | }; | |
| 10488 | ||
| 10489 | pub const __builtin_msa_bseti_w = struct { | |
| 10490 | const param_str = "V4UiV4UiIUi"; | |
| 10491 | const target_set = TargetSet.init(.{ | |
| 10492 | .mips = true, | |
| 10493 | }); | |
| 10494 | const attributes = Attributes{ | |
| 10495 | .@"const" = true, | |
| 10496 | }; | |
| 10497 | }; | |
| 10498 | ||
| 10499 | pub const __builtin_msa_bz_b = struct { | |
| 10500 | const param_str = "iV16Uc"; | |
| 10501 | const target_set = TargetSet.init(.{ | |
| 10502 | .mips = true, | |
| 10503 | }); | |
| 10504 | const attributes = Attributes{ | |
| 10505 | .@"const" = true, | |
| 10506 | }; | |
| 10507 | }; | |
| 10508 | ||
| 10509 | pub const __builtin_msa_bz_d = struct { | |
| 10510 | const param_str = "iV2ULLi"; | |
| 10511 | const target_set = TargetSet.init(.{ | |
| 10512 | .mips = true, | |
| 10513 | }); | |
| 10514 | const attributes = Attributes{ | |
| 10515 | .@"const" = true, | |
| 10516 | }; | |
| 10517 | }; | |
| 10518 | ||
| 10519 | pub const __builtin_msa_bz_h = struct { | |
| 10520 | const param_str = "iV8Us"; | |
| 10521 | const target_set = TargetSet.init(.{ | |
| 10522 | .mips = true, | |
| 10523 | }); | |
| 10524 | const attributes = Attributes{ | |
| 10525 | .@"const" = true, | |
| 10526 | }; | |
| 10527 | }; | |
| 10528 | ||
| 10529 | pub const __builtin_msa_bz_v = struct { | |
| 10530 | const param_str = "iV16Uc"; | |
| 10531 | const target_set = TargetSet.init(.{ | |
| 10532 | .mips = true, | |
| 10533 | }); | |
| 10534 | const attributes = Attributes{ | |
| 10535 | .@"const" = true, | |
| 10536 | }; | |
| 10537 | }; | |
| 10538 | ||
| 10539 | pub const __builtin_msa_bz_w = struct { | |
| 10540 | const param_str = "iV4Ui"; | |
| 10541 | const target_set = TargetSet.init(.{ | |
| 10542 | .mips = true, | |
| 10543 | }); | |
| 10544 | const attributes = Attributes{ | |
| 10545 | .@"const" = true, | |
| 10546 | }; | |
| 10547 | }; | |
| 10548 | ||
| 10549 | pub const __builtin_msa_ceq_b = struct { | |
| 10550 | const param_str = "V16ScV16ScV16Sc"; | |
| 10551 | const target_set = TargetSet.init(.{ | |
| 10552 | .mips = true, | |
| 10553 | }); | |
| 10554 | const attributes = Attributes{ | |
| 10555 | .@"const" = true, | |
| 10556 | }; | |
| 10557 | }; | |
| 10558 | ||
| 10559 | pub const __builtin_msa_ceq_d = struct { | |
| 10560 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 10561 | const target_set = TargetSet.init(.{ | |
| 10562 | .mips = true, | |
| 10563 | }); | |
| 10564 | const attributes = Attributes{ | |
| 10565 | .@"const" = true, | |
| 10566 | }; | |
| 10567 | }; | |
| 10568 | ||
| 10569 | pub const __builtin_msa_ceq_h = struct { | |
| 10570 | const param_str = "V8SsV8SsV8Ss"; | |
| 10571 | const target_set = TargetSet.init(.{ | |
| 10572 | .mips = true, | |
| 10573 | }); | |
| 10574 | const attributes = Attributes{ | |
| 10575 | .@"const" = true, | |
| 10576 | }; | |
| 10577 | }; | |
| 10578 | ||
| 10579 | pub const __builtin_msa_ceq_w = struct { | |
| 10580 | const param_str = "V4SiV4SiV4Si"; | |
| 10581 | const target_set = TargetSet.init(.{ | |
| 10582 | .mips = true, | |
| 10583 | }); | |
| 10584 | const attributes = Attributes{ | |
| 10585 | .@"const" = true, | |
| 10586 | }; | |
| 10587 | }; | |
| 10588 | ||
| 10589 | pub const __builtin_msa_ceqi_b = struct { | |
| 10590 | const param_str = "V16ScV16ScISi"; | |
| 10591 | const target_set = TargetSet.init(.{ | |
| 10592 | .mips = true, | |
| 10593 | }); | |
| 10594 | const attributes = Attributes{ | |
| 10595 | .@"const" = true, | |
| 10596 | }; | |
| 10597 | }; | |
| 10598 | ||
| 10599 | pub const __builtin_msa_ceqi_d = struct { | |
| 10600 | const param_str = "V2SLLiV2SLLiISi"; | |
| 10601 | const target_set = TargetSet.init(.{ | |
| 10602 | .mips = true, | |
| 10603 | }); | |
| 10604 | const attributes = Attributes{ | |
| 10605 | .@"const" = true, | |
| 10606 | }; | |
| 10607 | }; | |
| 10608 | ||
| 10609 | pub const __builtin_msa_ceqi_h = struct { | |
| 10610 | const param_str = "V8SsV8SsISi"; | |
| 10611 | const target_set = TargetSet.init(.{ | |
| 10612 | .mips = true, | |
| 10613 | }); | |
| 10614 | const attributes = Attributes{ | |
| 10615 | .@"const" = true, | |
| 10616 | }; | |
| 10617 | }; | |
| 10618 | ||
| 10619 | pub const __builtin_msa_ceqi_w = struct { | |
| 10620 | const param_str = "V4SiV4SiISi"; | |
| 10621 | const target_set = TargetSet.init(.{ | |
| 10622 | .mips = true, | |
| 10623 | }); | |
| 10624 | const attributes = Attributes{ | |
| 10625 | .@"const" = true, | |
| 10626 | }; | |
| 10627 | }; | |
| 10628 | ||
| 10629 | pub const __builtin_msa_cfcmsa = struct { | |
| 10630 | const param_str = "iIi"; | |
| 10631 | const target_set = TargetSet.init(.{ | |
| 10632 | .mips = true, | |
| 10633 | }); | |
| 10634 | const attributes = Attributes{}; | |
| 10635 | }; | |
| 10636 | ||
| 10637 | pub const __builtin_msa_cle_s_b = struct { | |
| 10638 | const param_str = "V16ScV16ScV16Sc"; | |
| 10639 | const target_set = TargetSet.init(.{ | |
| 10640 | .mips = true, | |
| 10641 | }); | |
| 10642 | const attributes = Attributes{ | |
| 10643 | .@"const" = true, | |
| 10644 | }; | |
| 10645 | }; | |
| 10646 | ||
| 10647 | pub const __builtin_msa_cle_s_d = struct { | |
| 10648 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 10649 | const target_set = TargetSet.init(.{ | |
| 10650 | .mips = true, | |
| 10651 | }); | |
| 10652 | const attributes = Attributes{ | |
| 10653 | .@"const" = true, | |
| 10654 | }; | |
| 10655 | }; | |
| 10656 | ||
| 10657 | pub const __builtin_msa_cle_s_h = struct { | |
| 10658 | const param_str = "V8SsV8SsV8Ss"; | |
| 10659 | const target_set = TargetSet.init(.{ | |
| 10660 | .mips = true, | |
| 10661 | }); | |
| 10662 | const attributes = Attributes{ | |
| 10663 | .@"const" = true, | |
| 10664 | }; | |
| 10665 | }; | |
| 10666 | ||
| 10667 | pub const __builtin_msa_cle_s_w = struct { | |
| 10668 | const param_str = "V4SiV4SiV4Si"; | |
| 10669 | const target_set = TargetSet.init(.{ | |
| 10670 | .mips = true, | |
| 10671 | }); | |
| 10672 | const attributes = Attributes{ | |
| 10673 | .@"const" = true, | |
| 10674 | }; | |
| 10675 | }; | |
| 10676 | ||
| 10677 | pub const __builtin_msa_cle_u_b = struct { | |
| 10678 | const param_str = "V16ScV16UcV16Uc"; | |
| 10679 | const target_set = TargetSet.init(.{ | |
| 10680 | .mips = true, | |
| 10681 | }); | |
| 10682 | const attributes = Attributes{ | |
| 10683 | .@"const" = true, | |
| 10684 | }; | |
| 10685 | }; | |
| 10686 | ||
| 10687 | pub const __builtin_msa_cle_u_d = struct { | |
| 10688 | const param_str = "V2SLLiV2ULLiV2ULLi"; | |
| 10689 | const target_set = TargetSet.init(.{ | |
| 10690 | .mips = true, | |
| 10691 | }); | |
| 10692 | const attributes = Attributes{ | |
| 10693 | .@"const" = true, | |
| 10694 | }; | |
| 10695 | }; | |
| 10696 | ||
| 10697 | pub const __builtin_msa_cle_u_h = struct { | |
| 10698 | const param_str = "V8SsV8UsV8Us"; | |
| 10699 | const target_set = TargetSet.init(.{ | |
| 10700 | .mips = true, | |
| 10701 | }); | |
| 10702 | const attributes = Attributes{ | |
| 10703 | .@"const" = true, | |
| 10704 | }; | |
| 10705 | }; | |
| 10706 | ||
| 10707 | pub const __builtin_msa_cle_u_w = struct { | |
| 10708 | const param_str = "V4SiV4UiV4Ui"; | |
| 10709 | const target_set = TargetSet.init(.{ | |
| 10710 | .mips = true, | |
| 10711 | }); | |
| 10712 | const attributes = Attributes{ | |
| 10713 | .@"const" = true, | |
| 10714 | }; | |
| 10715 | }; | |
| 10716 | ||
| 10717 | pub const __builtin_msa_clei_s_b = struct { | |
| 10718 | const param_str = "V16ScV16ScISi"; | |
| 10719 | const target_set = TargetSet.init(.{ | |
| 10720 | .mips = true, | |
| 10721 | }); | |
| 10722 | const attributes = Attributes{ | |
| 10723 | .@"const" = true, | |
| 10724 | }; | |
| 10725 | }; | |
| 10726 | ||
| 10727 | pub const __builtin_msa_clei_s_d = struct { | |
| 10728 | const param_str = "V2SLLiV2SLLiISi"; | |
| 10729 | const target_set = TargetSet.init(.{ | |
| 10730 | .mips = true, | |
| 10731 | }); | |
| 10732 | const attributes = Attributes{ | |
| 10733 | .@"const" = true, | |
| 10734 | }; | |
| 10735 | }; | |
| 10736 | ||
| 10737 | pub const __builtin_msa_clei_s_h = struct { | |
| 10738 | const param_str = "V8SsV8SsISi"; | |
| 10739 | const target_set = TargetSet.init(.{ | |
| 10740 | .mips = true, | |
| 10741 | }); | |
| 10742 | const attributes = Attributes{ | |
| 10743 | .@"const" = true, | |
| 10744 | }; | |
| 10745 | }; | |
| 10746 | ||
| 10747 | pub const __builtin_msa_clei_s_w = struct { | |
| 10748 | const param_str = "V4SiV4SiISi"; | |
| 10749 | const target_set = TargetSet.init(.{ | |
| 10750 | .mips = true, | |
| 10751 | }); | |
| 10752 | const attributes = Attributes{ | |
| 10753 | .@"const" = true, | |
| 10754 | }; | |
| 10755 | }; | |
| 10756 | ||
| 10757 | pub const __builtin_msa_clei_u_b = struct { | |
| 10758 | const param_str = "V16ScV16UcIUi"; | |
| 10759 | const target_set = TargetSet.init(.{ | |
| 10760 | .mips = true, | |
| 10761 | }); | |
| 10762 | const attributes = Attributes{ | |
| 10763 | .@"const" = true, | |
| 10764 | }; | |
| 10765 | }; | |
| 10766 | ||
| 10767 | pub const __builtin_msa_clei_u_d = struct { | |
| 10768 | const param_str = "V2SLLiV2ULLiIUi"; | |
| 10769 | const target_set = TargetSet.init(.{ | |
| 10770 | .mips = true, | |
| 10771 | }); | |
| 10772 | const attributes = Attributes{ | |
| 10773 | .@"const" = true, | |
| 10774 | }; | |
| 10775 | }; | |
| 10776 | ||
| 10777 | pub const __builtin_msa_clei_u_h = struct { | |
| 10778 | const param_str = "V8SsV8UsIUi"; | |
| 10779 | const target_set = TargetSet.init(.{ | |
| 10780 | .mips = true, | |
| 10781 | }); | |
| 10782 | const attributes = Attributes{ | |
| 10783 | .@"const" = true, | |
| 10784 | }; | |
| 10785 | }; | |
| 10786 | ||
| 10787 | pub const __builtin_msa_clei_u_w = struct { | |
| 10788 | const param_str = "V4SiV4UiIUi"; | |
| 10789 | const target_set = TargetSet.init(.{ | |
| 10790 | .mips = true, | |
| 10791 | }); | |
| 10792 | const attributes = Attributes{ | |
| 10793 | .@"const" = true, | |
| 10794 | }; | |
| 10795 | }; | |
| 10796 | ||
| 10797 | pub const __builtin_msa_clt_s_b = struct { | |
| 10798 | const param_str = "V16ScV16ScV16Sc"; | |
| 10799 | const target_set = TargetSet.init(.{ | |
| 10800 | .mips = true, | |
| 10801 | }); | |
| 10802 | const attributes = Attributes{ | |
| 10803 | .@"const" = true, | |
| 10804 | }; | |
| 10805 | }; | |
| 10806 | ||
| 10807 | pub const __builtin_msa_clt_s_d = struct { | |
| 10808 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 10809 | const target_set = TargetSet.init(.{ | |
| 10810 | .mips = true, | |
| 10811 | }); | |
| 10812 | const attributes = Attributes{ | |
| 10813 | .@"const" = true, | |
| 10814 | }; | |
| 10815 | }; | |
| 10816 | ||
| 10817 | pub const __builtin_msa_clt_s_h = struct { | |
| 10818 | const param_str = "V8SsV8SsV8Ss"; | |
| 10819 | const target_set = TargetSet.init(.{ | |
| 10820 | .mips = true, | |
| 10821 | }); | |
| 10822 | const attributes = Attributes{ | |
| 10823 | .@"const" = true, | |
| 10824 | }; | |
| 10825 | }; | |
| 10826 | ||
| 10827 | pub const __builtin_msa_clt_s_w = struct { | |
| 10828 | const param_str = "V4SiV4SiV4Si"; | |
| 10829 | const target_set = TargetSet.init(.{ | |
| 10830 | .mips = true, | |
| 10831 | }); | |
| 10832 | const attributes = Attributes{ | |
| 10833 | .@"const" = true, | |
| 10834 | }; | |
| 10835 | }; | |
| 10836 | ||
| 10837 | pub const __builtin_msa_clt_u_b = struct { | |
| 10838 | const param_str = "V16ScV16UcV16Uc"; | |
| 10839 | const target_set = TargetSet.init(.{ | |
| 10840 | .mips = true, | |
| 10841 | }); | |
| 10842 | const attributes = Attributes{ | |
| 10843 | .@"const" = true, | |
| 10844 | }; | |
| 10845 | }; | |
| 10846 | ||
| 10847 | pub const __builtin_msa_clt_u_d = struct { | |
| 10848 | const param_str = "V2SLLiV2ULLiV2ULLi"; | |
| 10849 | const target_set = TargetSet.init(.{ | |
| 10850 | .mips = true, | |
| 10851 | }); | |
| 10852 | const attributes = Attributes{ | |
| 10853 | .@"const" = true, | |
| 10854 | }; | |
| 10855 | }; | |
| 10856 | ||
| 10857 | pub const __builtin_msa_clt_u_h = struct { | |
| 10858 | const param_str = "V8SsV8UsV8Us"; | |
| 10859 | const target_set = TargetSet.init(.{ | |
| 10860 | .mips = true, | |
| 10861 | }); | |
| 10862 | const attributes = Attributes{ | |
| 10863 | .@"const" = true, | |
| 10864 | }; | |
| 10865 | }; | |
| 10866 | ||
| 10867 | pub const __builtin_msa_clt_u_w = struct { | |
| 10868 | const param_str = "V4SiV4UiV4Ui"; | |
| 10869 | const target_set = TargetSet.init(.{ | |
| 10870 | .mips = true, | |
| 10871 | }); | |
| 10872 | const attributes = Attributes{ | |
| 10873 | .@"const" = true, | |
| 10874 | }; | |
| 10875 | }; | |
| 10876 | ||
| 10877 | pub const __builtin_msa_clti_s_b = struct { | |
| 10878 | const param_str = "V16ScV16ScISi"; | |
| 10879 | const target_set = TargetSet.init(.{ | |
| 10880 | .mips = true, | |
| 10881 | }); | |
| 10882 | const attributes = Attributes{ | |
| 10883 | .@"const" = true, | |
| 10884 | }; | |
| 10885 | }; | |
| 10886 | ||
| 10887 | pub const __builtin_msa_clti_s_d = struct { | |
| 10888 | const param_str = "V2SLLiV2SLLiISi"; | |
| 10889 | const target_set = TargetSet.init(.{ | |
| 10890 | .mips = true, | |
| 10891 | }); | |
| 10892 | const attributes = Attributes{ | |
| 10893 | .@"const" = true, | |
| 10894 | }; | |
| 10895 | }; | |
| 10896 | ||
| 10897 | pub const __builtin_msa_clti_s_h = struct { | |
| 10898 | const param_str = "V8SsV8SsISi"; | |
| 10899 | const target_set = TargetSet.init(.{ | |
| 10900 | .mips = true, | |
| 10901 | }); | |
| 10902 | const attributes = Attributes{ | |
| 10903 | .@"const" = true, | |
| 10904 | }; | |
| 10905 | }; | |
| 10906 | ||
| 10907 | pub const __builtin_msa_clti_s_w = struct { | |
| 10908 | const param_str = "V4SiV4SiISi"; | |
| 10909 | const target_set = TargetSet.init(.{ | |
| 10910 | .mips = true, | |
| 10911 | }); | |
| 10912 | const attributes = Attributes{ | |
| 10913 | .@"const" = true, | |
| 10914 | }; | |
| 10915 | }; | |
| 10916 | ||
| 10917 | pub const __builtin_msa_clti_u_b = struct { | |
| 10918 | const param_str = "V16ScV16UcIUi"; | |
| 10919 | const target_set = TargetSet.init(.{ | |
| 10920 | .mips = true, | |
| 10921 | }); | |
| 10922 | const attributes = Attributes{ | |
| 10923 | .@"const" = true, | |
| 10924 | }; | |
| 10925 | }; | |
| 10926 | ||
| 10927 | pub const __builtin_msa_clti_u_d = struct { | |
| 10928 | const param_str = "V2SLLiV2ULLiIUi"; | |
| 10929 | const target_set = TargetSet.init(.{ | |
| 10930 | .mips = true, | |
| 10931 | }); | |
| 10932 | const attributes = Attributes{ | |
| 10933 | .@"const" = true, | |
| 10934 | }; | |
| 10935 | }; | |
| 10936 | ||
| 10937 | pub const __builtin_msa_clti_u_h = struct { | |
| 10938 | const param_str = "V8SsV8UsIUi"; | |
| 10939 | const target_set = TargetSet.init(.{ | |
| 10940 | .mips = true, | |
| 10941 | }); | |
| 10942 | const attributes = Attributes{ | |
| 10943 | .@"const" = true, | |
| 10944 | }; | |
| 10945 | }; | |
| 10946 | ||
| 10947 | pub const __builtin_msa_clti_u_w = struct { | |
| 10948 | const param_str = "V4SiV4UiIUi"; | |
| 10949 | const target_set = TargetSet.init(.{ | |
| 10950 | .mips = true, | |
| 10951 | }); | |
| 10952 | const attributes = Attributes{ | |
| 10953 | .@"const" = true, | |
| 10954 | }; | |
| 10955 | }; | |
| 10956 | ||
| 10957 | pub const __builtin_msa_copy_s_b = struct { | |
| 10958 | const param_str = "iV16ScIUi"; | |
| 10959 | const target_set = TargetSet.init(.{ | |
| 10960 | .mips = true, | |
| 10961 | }); | |
| 10962 | const attributes = Attributes{ | |
| 10963 | .@"const" = true, | |
| 10964 | }; | |
| 10965 | }; | |
| 10966 | ||
| 10967 | pub const __builtin_msa_copy_s_d = struct { | |
| 10968 | const param_str = "LLiV2SLLiIUi"; | |
| 10969 | const target_set = TargetSet.init(.{ | |
| 10970 | .mips = true, | |
| 10971 | }); | |
| 10972 | const attributes = Attributes{ | |
| 10973 | .@"const" = true, | |
| 10974 | }; | |
| 10975 | }; | |
| 10976 | ||
| 10977 | pub const __builtin_msa_copy_s_h = struct { | |
| 10978 | const param_str = "iV8SsIUi"; | |
| 10979 | const target_set = TargetSet.init(.{ | |
| 10980 | .mips = true, | |
| 10981 | }); | |
| 10982 | const attributes = Attributes{ | |
| 10983 | .@"const" = true, | |
| 10984 | }; | |
| 10985 | }; | |
| 10986 | ||
| 10987 | pub const __builtin_msa_copy_s_w = struct { | |
| 10988 | const param_str = "iV4SiIUi"; | |
| 10989 | const target_set = TargetSet.init(.{ | |
| 10990 | .mips = true, | |
| 10991 | }); | |
| 10992 | const attributes = Attributes{ | |
| 10993 | .@"const" = true, | |
| 10994 | }; | |
| 10995 | }; | |
| 10996 | ||
| 10997 | pub const __builtin_msa_copy_u_b = struct { | |
| 10998 | const param_str = "iV16UcIUi"; | |
| 10999 | const target_set = TargetSet.init(.{ | |
| 11000 | .mips = true, | |
| 11001 | }); | |
| 11002 | const attributes = Attributes{ | |
| 11003 | .@"const" = true, | |
| 11004 | }; | |
| 11005 | }; | |
| 11006 | ||
| 11007 | pub const __builtin_msa_copy_u_d = struct { | |
| 11008 | const param_str = "LLiV2ULLiIUi"; | |
| 11009 | const target_set = TargetSet.init(.{ | |
| 11010 | .mips = true, | |
| 11011 | }); | |
| 11012 | const attributes = Attributes{ | |
| 11013 | .@"const" = true, | |
| 11014 | }; | |
| 11015 | }; | |
| 11016 | ||
| 11017 | pub const __builtin_msa_copy_u_h = struct { | |
| 11018 | const param_str = "iV8UsIUi"; | |
| 11019 | const target_set = TargetSet.init(.{ | |
| 11020 | .mips = true, | |
| 11021 | }); | |
| 11022 | const attributes = Attributes{ | |
| 11023 | .@"const" = true, | |
| 11024 | }; | |
| 11025 | }; | |
| 11026 | ||
| 11027 | pub const __builtin_msa_copy_u_w = struct { | |
| 11028 | const param_str = "iV4UiIUi"; | |
| 11029 | const target_set = TargetSet.init(.{ | |
| 11030 | .mips = true, | |
| 11031 | }); | |
| 11032 | const attributes = Attributes{ | |
| 11033 | .@"const" = true, | |
| 11034 | }; | |
| 11035 | }; | |
| 11036 | ||
| 11037 | pub const __builtin_msa_ctcmsa = struct { | |
| 11038 | const param_str = "vIii"; | |
| 11039 | const target_set = TargetSet.init(.{ | |
| 11040 | .mips = true, | |
| 11041 | }); | |
| 11042 | const attributes = Attributes{}; | |
| 11043 | }; | |
| 11044 | ||
| 11045 | pub const __builtin_msa_div_s_b = struct { | |
| 11046 | const param_str = "V16ScV16ScV16Sc"; | |
| 11047 | const target_set = TargetSet.init(.{ | |
| 11048 | .mips = true, | |
| 11049 | }); | |
| 11050 | const attributes = Attributes{ | |
| 11051 | .@"const" = true, | |
| 11052 | }; | |
| 11053 | }; | |
| 11054 | ||
| 11055 | pub const __builtin_msa_div_s_d = struct { | |
| 11056 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 11057 | const target_set = TargetSet.init(.{ | |
| 11058 | .mips = true, | |
| 11059 | }); | |
| 11060 | const attributes = Attributes{ | |
| 11061 | .@"const" = true, | |
| 11062 | }; | |
| 11063 | }; | |
| 11064 | ||
| 11065 | pub const __builtin_msa_div_s_h = struct { | |
| 11066 | const param_str = "V8SsV8SsV8Ss"; | |
| 11067 | const target_set = TargetSet.init(.{ | |
| 11068 | .mips = true, | |
| 11069 | }); | |
| 11070 | const attributes = Attributes{ | |
| 11071 | .@"const" = true, | |
| 11072 | }; | |
| 11073 | }; | |
| 11074 | ||
| 11075 | pub const __builtin_msa_div_s_w = struct { | |
| 11076 | const param_str = "V4SiV4SiV4Si"; | |
| 11077 | const target_set = TargetSet.init(.{ | |
| 11078 | .mips = true, | |
| 11079 | }); | |
| 11080 | const attributes = Attributes{ | |
| 11081 | .@"const" = true, | |
| 11082 | }; | |
| 11083 | }; | |
| 11084 | ||
| 11085 | pub const __builtin_msa_div_u_b = struct { | |
| 11086 | const param_str = "V16UcV16UcV16Uc"; | |
| 11087 | const target_set = TargetSet.init(.{ | |
| 11088 | .mips = true, | |
| 11089 | }); | |
| 11090 | const attributes = Attributes{ | |
| 11091 | .@"const" = true, | |
| 11092 | }; | |
| 11093 | }; | |
| 11094 | ||
| 11095 | pub const __builtin_msa_div_u_d = struct { | |
| 11096 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 11097 | const target_set = TargetSet.init(.{ | |
| 11098 | .mips = true, | |
| 11099 | }); | |
| 11100 | const attributes = Attributes{ | |
| 11101 | .@"const" = true, | |
| 11102 | }; | |
| 11103 | }; | |
| 11104 | ||
| 11105 | pub const __builtin_msa_div_u_h = struct { | |
| 11106 | const param_str = "V8UsV8UsV8Us"; | |
| 11107 | const target_set = TargetSet.init(.{ | |
| 11108 | .mips = true, | |
| 11109 | }); | |
| 11110 | const attributes = Attributes{ | |
| 11111 | .@"const" = true, | |
| 11112 | }; | |
| 11113 | }; | |
| 11114 | ||
| 11115 | pub const __builtin_msa_div_u_w = struct { | |
| 11116 | const param_str = "V4UiV4UiV4Ui"; | |
| 11117 | const target_set = TargetSet.init(.{ | |
| 11118 | .mips = true, | |
| 11119 | }); | |
| 11120 | const attributes = Attributes{ | |
| 11121 | .@"const" = true, | |
| 11122 | }; | |
| 11123 | }; | |
| 11124 | ||
| 11125 | pub const __builtin_msa_dotp_s_d = struct { | |
| 11126 | const param_str = "V2SLLiV4SiV4Si"; | |
| 11127 | const target_set = TargetSet.init(.{ | |
| 11128 | .mips = true, | |
| 11129 | }); | |
| 11130 | const attributes = Attributes{ | |
| 11131 | .@"const" = true, | |
| 11132 | }; | |
| 11133 | }; | |
| 11134 | ||
| 11135 | pub const __builtin_msa_dotp_s_h = struct { | |
| 11136 | const param_str = "V8SsV16ScV16Sc"; | |
| 11137 | const target_set = TargetSet.init(.{ | |
| 11138 | .mips = true, | |
| 11139 | }); | |
| 11140 | const attributes = Attributes{ | |
| 11141 | .@"const" = true, | |
| 11142 | }; | |
| 11143 | }; | |
| 11144 | ||
| 11145 | pub const __builtin_msa_dotp_s_w = struct { | |
| 11146 | const param_str = "V4SiV8SsV8Ss"; | |
| 11147 | const target_set = TargetSet.init(.{ | |
| 11148 | .mips = true, | |
| 11149 | }); | |
| 11150 | const attributes = Attributes{ | |
| 11151 | .@"const" = true, | |
| 11152 | }; | |
| 11153 | }; | |
| 11154 | ||
| 11155 | pub const __builtin_msa_dotp_u_d = struct { | |
| 11156 | const param_str = "V2ULLiV4UiV4Ui"; | |
| 11157 | const target_set = TargetSet.init(.{ | |
| 11158 | .mips = true, | |
| 11159 | }); | |
| 11160 | const attributes = Attributes{ | |
| 11161 | .@"const" = true, | |
| 11162 | }; | |
| 11163 | }; | |
| 11164 | ||
| 11165 | pub const __builtin_msa_dotp_u_h = struct { | |
| 11166 | const param_str = "V8UsV16UcV16Uc"; | |
| 11167 | const target_set = TargetSet.init(.{ | |
| 11168 | .mips = true, | |
| 11169 | }); | |
| 11170 | const attributes = Attributes{ | |
| 11171 | .@"const" = true, | |
| 11172 | }; | |
| 11173 | }; | |
| 11174 | ||
| 11175 | pub const __builtin_msa_dotp_u_w = struct { | |
| 11176 | const param_str = "V4UiV8UsV8Us"; | |
| 11177 | const target_set = TargetSet.init(.{ | |
| 11178 | .mips = true, | |
| 11179 | }); | |
| 11180 | const attributes = Attributes{ | |
| 11181 | .@"const" = true, | |
| 11182 | }; | |
| 11183 | }; | |
| 11184 | ||
| 11185 | pub const __builtin_msa_dpadd_s_d = struct { | |
| 11186 | const param_str = "V2SLLiV2SLLiV4SiV4Si"; | |
| 11187 | const target_set = TargetSet.init(.{ | |
| 11188 | .mips = true, | |
| 11189 | }); | |
| 11190 | const attributes = Attributes{ | |
| 11191 | .@"const" = true, | |
| 11192 | }; | |
| 11193 | }; | |
| 11194 | ||
| 11195 | pub const __builtin_msa_dpadd_s_h = struct { | |
| 11196 | const param_str = "V8SsV8SsV16ScV16Sc"; | |
| 11197 | const target_set = TargetSet.init(.{ | |
| 11198 | .mips = true, | |
| 11199 | }); | |
| 11200 | const attributes = Attributes{ | |
| 11201 | .@"const" = true, | |
| 11202 | }; | |
| 11203 | }; | |
| 11204 | ||
| 11205 | pub const __builtin_msa_dpadd_s_w = struct { | |
| 11206 | const param_str = "V4SiV4SiV8SsV8Ss"; | |
| 11207 | const target_set = TargetSet.init(.{ | |
| 11208 | .mips = true, | |
| 11209 | }); | |
| 11210 | const attributes = Attributes{ | |
| 11211 | .@"const" = true, | |
| 11212 | }; | |
| 11213 | }; | |
| 11214 | ||
| 11215 | pub const __builtin_msa_dpadd_u_d = struct { | |
| 11216 | const param_str = "V2ULLiV2ULLiV4UiV4Ui"; | |
| 11217 | const target_set = TargetSet.init(.{ | |
| 11218 | .mips = true, | |
| 11219 | }); | |
| 11220 | const attributes = Attributes{ | |
| 11221 | .@"const" = true, | |
| 11222 | }; | |
| 11223 | }; | |
| 11224 | ||
| 11225 | pub const __builtin_msa_dpadd_u_h = struct { | |
| 11226 | const param_str = "V8UsV8UsV16UcV16Uc"; | |
| 11227 | const target_set = TargetSet.init(.{ | |
| 11228 | .mips = true, | |
| 11229 | }); | |
| 11230 | const attributes = Attributes{ | |
| 11231 | .@"const" = true, | |
| 11232 | }; | |
| 11233 | }; | |
| 11234 | ||
| 11235 | pub const __builtin_msa_dpadd_u_w = struct { | |
| 11236 | const param_str = "V4UiV4UiV8UsV8Us"; | |
| 11237 | const target_set = TargetSet.init(.{ | |
| 11238 | .mips = true, | |
| 11239 | }); | |
| 11240 | const attributes = Attributes{ | |
| 11241 | .@"const" = true, | |
| 11242 | }; | |
| 11243 | }; | |
| 11244 | ||
| 11245 | pub const __builtin_msa_dpsub_s_d = struct { | |
| 11246 | const param_str = "V2SLLiV2SLLiV4SiV4Si"; | |
| 11247 | const target_set = TargetSet.init(.{ | |
| 11248 | .mips = true, | |
| 11249 | }); | |
| 11250 | const attributes = Attributes{ | |
| 11251 | .@"const" = true, | |
| 11252 | }; | |
| 11253 | }; | |
| 11254 | ||
| 11255 | pub const __builtin_msa_dpsub_s_h = struct { | |
| 11256 | const param_str = "V8SsV8SsV16ScV16Sc"; | |
| 11257 | const target_set = TargetSet.init(.{ | |
| 11258 | .mips = true, | |
| 11259 | }); | |
| 11260 | const attributes = Attributes{ | |
| 11261 | .@"const" = true, | |
| 11262 | }; | |
| 11263 | }; | |
| 11264 | ||
| 11265 | pub const __builtin_msa_dpsub_s_w = struct { | |
| 11266 | const param_str = "V4SiV4SiV8SsV8Ss"; | |
| 11267 | const target_set = TargetSet.init(.{ | |
| 11268 | .mips = true, | |
| 11269 | }); | |
| 11270 | const attributes = Attributes{ | |
| 11271 | .@"const" = true, | |
| 11272 | }; | |
| 11273 | }; | |
| 11274 | ||
| 11275 | pub const __builtin_msa_dpsub_u_d = struct { | |
| 11276 | const param_str = "V2ULLiV2ULLiV4UiV4Ui"; | |
| 11277 | const target_set = TargetSet.init(.{ | |
| 11278 | .mips = true, | |
| 11279 | }); | |
| 11280 | const attributes = Attributes{ | |
| 11281 | .@"const" = true, | |
| 11282 | }; | |
| 11283 | }; | |
| 11284 | ||
| 11285 | pub const __builtin_msa_dpsub_u_h = struct { | |
| 11286 | const param_str = "V8UsV8UsV16UcV16Uc"; | |
| 11287 | const target_set = TargetSet.init(.{ | |
| 11288 | .mips = true, | |
| 11289 | }); | |
| 11290 | const attributes = Attributes{ | |
| 11291 | .@"const" = true, | |
| 11292 | }; | |
| 11293 | }; | |
| 11294 | ||
| 11295 | pub const __builtin_msa_dpsub_u_w = struct { | |
| 11296 | const param_str = "V4UiV4UiV8UsV8Us"; | |
| 11297 | const target_set = TargetSet.init(.{ | |
| 11298 | .mips = true, | |
| 11299 | }); | |
| 11300 | const attributes = Attributes{ | |
| 11301 | .@"const" = true, | |
| 11302 | }; | |
| 11303 | }; | |
| 11304 | ||
| 11305 | pub const __builtin_msa_fadd_d = struct { | |
| 11306 | const param_str = "V2dV2dV2d"; | |
| 11307 | const target_set = TargetSet.init(.{ | |
| 11308 | .mips = true, | |
| 11309 | }); | |
| 11310 | const attributes = Attributes{ | |
| 11311 | .@"const" = true, | |
| 11312 | }; | |
| 11313 | }; | |
| 11314 | ||
| 11315 | pub const __builtin_msa_fadd_w = struct { | |
| 11316 | const param_str = "V4fV4fV4f"; | |
| 11317 | const target_set = TargetSet.init(.{ | |
| 11318 | .mips = true, | |
| 11319 | }); | |
| 11320 | const attributes = Attributes{ | |
| 11321 | .@"const" = true, | |
| 11322 | }; | |
| 11323 | }; | |
| 11324 | ||
| 11325 | pub const __builtin_msa_fcaf_d = struct { | |
| 11326 | const param_str = "V2LLiV2dV2d"; | |
| 11327 | const target_set = TargetSet.init(.{ | |
| 11328 | .mips = true, | |
| 11329 | }); | |
| 11330 | const attributes = Attributes{ | |
| 11331 | .@"const" = true, | |
| 11332 | }; | |
| 11333 | }; | |
| 11334 | ||
| 11335 | pub const __builtin_msa_fcaf_w = struct { | |
| 11336 | const param_str = "V4iV4fV4f"; | |
| 11337 | const target_set = TargetSet.init(.{ | |
| 11338 | .mips = true, | |
| 11339 | }); | |
| 11340 | const attributes = Attributes{ | |
| 11341 | .@"const" = true, | |
| 11342 | }; | |
| 11343 | }; | |
| 11344 | ||
| 11345 | pub const __builtin_msa_fceq_d = struct { | |
| 11346 | const param_str = "V2LLiV2dV2d"; | |
| 11347 | const target_set = TargetSet.init(.{ | |
| 11348 | .mips = true, | |
| 11349 | }); | |
| 11350 | const attributes = Attributes{ | |
| 11351 | .@"const" = true, | |
| 11352 | }; | |
| 11353 | }; | |
| 11354 | ||
| 11355 | pub const __builtin_msa_fceq_w = struct { | |
| 11356 | const param_str = "V4iV4fV4f"; | |
| 11357 | const target_set = TargetSet.init(.{ | |
| 11358 | .mips = true, | |
| 11359 | }); | |
| 11360 | const attributes = Attributes{ | |
| 11361 | .@"const" = true, | |
| 11362 | }; | |
| 11363 | }; | |
| 11364 | ||
| 11365 | pub const __builtin_msa_fclass_d = struct { | |
| 11366 | const param_str = "V2LLiV2d"; | |
| 11367 | const target_set = TargetSet.init(.{ | |
| 11368 | .mips = true, | |
| 11369 | }); | |
| 11370 | const attributes = Attributes{ | |
| 11371 | .@"const" = true, | |
| 11372 | }; | |
| 11373 | }; | |
| 11374 | ||
| 11375 | pub const __builtin_msa_fclass_w = struct { | |
| 11376 | const param_str = "V4iV4f"; | |
| 11377 | const target_set = TargetSet.init(.{ | |
| 11378 | .mips = true, | |
| 11379 | }); | |
| 11380 | const attributes = Attributes{ | |
| 11381 | .@"const" = true, | |
| 11382 | }; | |
| 11383 | }; | |
| 11384 | ||
| 11385 | pub const __builtin_msa_fcle_d = struct { | |
| 11386 | const param_str = "V2LLiV2dV2d"; | |
| 11387 | const target_set = TargetSet.init(.{ | |
| 11388 | .mips = true, | |
| 11389 | }); | |
| 11390 | const attributes = Attributes{ | |
| 11391 | .@"const" = true, | |
| 11392 | }; | |
| 11393 | }; | |
| 11394 | ||
| 11395 | pub const __builtin_msa_fcle_w = struct { | |
| 11396 | const param_str = "V4iV4fV4f"; | |
| 11397 | const target_set = TargetSet.init(.{ | |
| 11398 | .mips = true, | |
| 11399 | }); | |
| 11400 | const attributes = Attributes{ | |
| 11401 | .@"const" = true, | |
| 11402 | }; | |
| 11403 | }; | |
| 11404 | ||
| 11405 | pub const __builtin_msa_fclt_d = struct { | |
| 11406 | const param_str = "V2LLiV2dV2d"; | |
| 11407 | const target_set = TargetSet.init(.{ | |
| 11408 | .mips = true, | |
| 11409 | }); | |
| 11410 | const attributes = Attributes{ | |
| 11411 | .@"const" = true, | |
| 11412 | }; | |
| 11413 | }; | |
| 11414 | ||
| 11415 | pub const __builtin_msa_fclt_w = struct { | |
| 11416 | const param_str = "V4iV4fV4f"; | |
| 11417 | const target_set = TargetSet.init(.{ | |
| 11418 | .mips = true, | |
| 11419 | }); | |
| 11420 | const attributes = Attributes{ | |
| 11421 | .@"const" = true, | |
| 11422 | }; | |
| 11423 | }; | |
| 11424 | ||
| 11425 | pub const __builtin_msa_fcne_d = struct { | |
| 11426 | const param_str = "V2LLiV2dV2d"; | |
| 11427 | const target_set = TargetSet.init(.{ | |
| 11428 | .mips = true, | |
| 11429 | }); | |
| 11430 | const attributes = Attributes{ | |
| 11431 | .@"const" = true, | |
| 11432 | }; | |
| 11433 | }; | |
| 11434 | ||
| 11435 | pub const __builtin_msa_fcne_w = struct { | |
| 11436 | const param_str = "V4iV4fV4f"; | |
| 11437 | const target_set = TargetSet.init(.{ | |
| 11438 | .mips = true, | |
| 11439 | }); | |
| 11440 | const attributes = Attributes{ | |
| 11441 | .@"const" = true, | |
| 11442 | }; | |
| 11443 | }; | |
| 11444 | ||
| 11445 | pub const __builtin_msa_fcor_d = struct { | |
| 11446 | const param_str = "V2LLiV2dV2d"; | |
| 11447 | const target_set = TargetSet.init(.{ | |
| 11448 | .mips = true, | |
| 11449 | }); | |
| 11450 | const attributes = Attributes{ | |
| 11451 | .@"const" = true, | |
| 11452 | }; | |
| 11453 | }; | |
| 11454 | ||
| 11455 | pub const __builtin_msa_fcor_w = struct { | |
| 11456 | const param_str = "V4iV4fV4f"; | |
| 11457 | const target_set = TargetSet.init(.{ | |
| 11458 | .mips = true, | |
| 11459 | }); | |
| 11460 | const attributes = Attributes{ | |
| 11461 | .@"const" = true, | |
| 11462 | }; | |
| 11463 | }; | |
| 11464 | ||
| 11465 | pub const __builtin_msa_fcueq_d = struct { | |
| 11466 | const param_str = "V2LLiV2dV2d"; | |
| 11467 | const target_set = TargetSet.init(.{ | |
| 11468 | .mips = true, | |
| 11469 | }); | |
| 11470 | const attributes = Attributes{ | |
| 11471 | .@"const" = true, | |
| 11472 | }; | |
| 11473 | }; | |
| 11474 | ||
| 11475 | pub const __builtin_msa_fcueq_w = struct { | |
| 11476 | const param_str = "V4iV4fV4f"; | |
| 11477 | const target_set = TargetSet.init(.{ | |
| 11478 | .mips = true, | |
| 11479 | }); | |
| 11480 | const attributes = Attributes{ | |
| 11481 | .@"const" = true, | |
| 11482 | }; | |
| 11483 | }; | |
| 11484 | ||
| 11485 | pub const __builtin_msa_fcule_d = struct { | |
| 11486 | const param_str = "V2LLiV2dV2d"; | |
| 11487 | const target_set = TargetSet.init(.{ | |
| 11488 | .mips = true, | |
| 11489 | }); | |
| 11490 | const attributes = Attributes{ | |
| 11491 | .@"const" = true, | |
| 11492 | }; | |
| 11493 | }; | |
| 11494 | ||
| 11495 | pub const __builtin_msa_fcule_w = struct { | |
| 11496 | const param_str = "V4iV4fV4f"; | |
| 11497 | const target_set = TargetSet.init(.{ | |
| 11498 | .mips = true, | |
| 11499 | }); | |
| 11500 | const attributes = Attributes{ | |
| 11501 | .@"const" = true, | |
| 11502 | }; | |
| 11503 | }; | |
| 11504 | ||
| 11505 | pub const __builtin_msa_fcult_d = struct { | |
| 11506 | const param_str = "V2LLiV2dV2d"; | |
| 11507 | const target_set = TargetSet.init(.{ | |
| 11508 | .mips = true, | |
| 11509 | }); | |
| 11510 | const attributes = Attributes{ | |
| 11511 | .@"const" = true, | |
| 11512 | }; | |
| 11513 | }; | |
| 11514 | ||
| 11515 | pub const __builtin_msa_fcult_w = struct { | |
| 11516 | const param_str = "V4iV4fV4f"; | |
| 11517 | const target_set = TargetSet.init(.{ | |
| 11518 | .mips = true, | |
| 11519 | }); | |
| 11520 | const attributes = Attributes{ | |
| 11521 | .@"const" = true, | |
| 11522 | }; | |
| 11523 | }; | |
| 11524 | ||
| 11525 | pub const __builtin_msa_fcun_d = struct { | |
| 11526 | const param_str = "V2LLiV2dV2d"; | |
| 11527 | const target_set = TargetSet.init(.{ | |
| 11528 | .mips = true, | |
| 11529 | }); | |
| 11530 | const attributes = Attributes{ | |
| 11531 | .@"const" = true, | |
| 11532 | }; | |
| 11533 | }; | |
| 11534 | ||
| 11535 | pub const __builtin_msa_fcun_w = struct { | |
| 11536 | const param_str = "V4iV4fV4f"; | |
| 11537 | const target_set = TargetSet.init(.{ | |
| 11538 | .mips = true, | |
| 11539 | }); | |
| 11540 | const attributes = Attributes{ | |
| 11541 | .@"const" = true, | |
| 11542 | }; | |
| 11543 | }; | |
| 11544 | ||
| 11545 | pub const __builtin_msa_fcune_d = struct { | |
| 11546 | const param_str = "V2LLiV2dV2d"; | |
| 11547 | const target_set = TargetSet.init(.{ | |
| 11548 | .mips = true, | |
| 11549 | }); | |
| 11550 | const attributes = Attributes{ | |
| 11551 | .@"const" = true, | |
| 11552 | }; | |
| 11553 | }; | |
| 11554 | ||
| 11555 | pub const __builtin_msa_fcune_w = struct { | |
| 11556 | const param_str = "V4iV4fV4f"; | |
| 11557 | const target_set = TargetSet.init(.{ | |
| 11558 | .mips = true, | |
| 11559 | }); | |
| 11560 | const attributes = Attributes{ | |
| 11561 | .@"const" = true, | |
| 11562 | }; | |
| 11563 | }; | |
| 11564 | ||
| 11565 | pub const __builtin_msa_fdiv_d = struct { | |
| 11566 | const param_str = "V2dV2dV2d"; | |
| 11567 | const target_set = TargetSet.init(.{ | |
| 11568 | .mips = true, | |
| 11569 | }); | |
| 11570 | const attributes = Attributes{ | |
| 11571 | .@"const" = true, | |
| 11572 | }; | |
| 11573 | }; | |
| 11574 | ||
| 11575 | pub const __builtin_msa_fdiv_w = struct { | |
| 11576 | const param_str = "V4fV4fV4f"; | |
| 11577 | const target_set = TargetSet.init(.{ | |
| 11578 | .mips = true, | |
| 11579 | }); | |
| 11580 | const attributes = Attributes{ | |
| 11581 | .@"const" = true, | |
| 11582 | }; | |
| 11583 | }; | |
| 11584 | ||
| 11585 | pub const __builtin_msa_fexdo_h = struct { | |
| 11586 | const param_str = "V8hV4fV4f"; | |
| 11587 | const target_set = TargetSet.init(.{ | |
| 11588 | .mips = true, | |
| 11589 | }); | |
| 11590 | const attributes = Attributes{ | |
| 11591 | .@"const" = true, | |
| 11592 | }; | |
| 11593 | }; | |
| 11594 | ||
| 11595 | pub const __builtin_msa_fexdo_w = struct { | |
| 11596 | const param_str = "V4fV2dV2d"; | |
| 11597 | const target_set = TargetSet.init(.{ | |
| 11598 | .mips = true, | |
| 11599 | }); | |
| 11600 | const attributes = Attributes{ | |
| 11601 | .@"const" = true, | |
| 11602 | }; | |
| 11603 | }; | |
| 11604 | ||
| 11605 | pub const __builtin_msa_fexp2_d = struct { | |
| 11606 | const param_str = "V2dV2dV2LLi"; | |
| 11607 | const target_set = TargetSet.init(.{ | |
| 11608 | .mips = true, | |
| 11609 | }); | |
| 11610 | const attributes = Attributes{ | |
| 11611 | .@"const" = true, | |
| 11612 | }; | |
| 11613 | }; | |
| 11614 | ||
| 11615 | pub const __builtin_msa_fexp2_w = struct { | |
| 11616 | const param_str = "V4fV4fV4i"; | |
| 11617 | const target_set = TargetSet.init(.{ | |
| 11618 | .mips = true, | |
| 11619 | }); | |
| 11620 | const attributes = Attributes{ | |
| 11621 | .@"const" = true, | |
| 11622 | }; | |
| 11623 | }; | |
| 11624 | ||
| 11625 | pub const __builtin_msa_fexupl_d = struct { | |
| 11626 | const param_str = "V2dV4f"; | |
| 11627 | const target_set = TargetSet.init(.{ | |
| 11628 | .mips = true, | |
| 11629 | }); | |
| 11630 | const attributes = Attributes{ | |
| 11631 | .@"const" = true, | |
| 11632 | }; | |
| 11633 | }; | |
| 11634 | ||
| 11635 | pub const __builtin_msa_fexupl_w = struct { | |
| 11636 | const param_str = "V4fV8h"; | |
| 11637 | const target_set = TargetSet.init(.{ | |
| 11638 | .mips = true, | |
| 11639 | }); | |
| 11640 | const attributes = Attributes{ | |
| 11641 | .@"const" = true, | |
| 11642 | }; | |
| 11643 | }; | |
| 11644 | ||
| 11645 | pub const __builtin_msa_fexupr_d = struct { | |
| 11646 | const param_str = "V2dV4f"; | |
| 11647 | const target_set = TargetSet.init(.{ | |
| 11648 | .mips = true, | |
| 11649 | }); | |
| 11650 | const attributes = Attributes{ | |
| 11651 | .@"const" = true, | |
| 11652 | }; | |
| 11653 | }; | |
| 11654 | ||
| 11655 | pub const __builtin_msa_fexupr_w = struct { | |
| 11656 | const param_str = "V4fV8h"; | |
| 11657 | const target_set = TargetSet.init(.{ | |
| 11658 | .mips = true, | |
| 11659 | }); | |
| 11660 | const attributes = Attributes{ | |
| 11661 | .@"const" = true, | |
| 11662 | }; | |
| 11663 | }; | |
| 11664 | ||
| 11665 | pub const __builtin_msa_ffint_s_d = struct { | |
| 11666 | const param_str = "V2dV2SLLi"; | |
| 11667 | const target_set = TargetSet.init(.{ | |
| 11668 | .mips = true, | |
| 11669 | }); | |
| 11670 | const attributes = Attributes{ | |
| 11671 | .@"const" = true, | |
| 11672 | }; | |
| 11673 | }; | |
| 11674 | ||
| 11675 | pub const __builtin_msa_ffint_s_w = struct { | |
| 11676 | const param_str = "V4fV4Si"; | |
| 11677 | const target_set = TargetSet.init(.{ | |
| 11678 | .mips = true, | |
| 11679 | }); | |
| 11680 | const attributes = Attributes{ | |
| 11681 | .@"const" = true, | |
| 11682 | }; | |
| 11683 | }; | |
| 11684 | ||
| 11685 | pub const __builtin_msa_ffint_u_d = struct { | |
| 11686 | const param_str = "V2dV2ULLi"; | |
| 11687 | const target_set = TargetSet.init(.{ | |
| 11688 | .mips = true, | |
| 11689 | }); | |
| 11690 | const attributes = Attributes{ | |
| 11691 | .@"const" = true, | |
| 11692 | }; | |
| 11693 | }; | |
| 11694 | ||
| 11695 | pub const __builtin_msa_ffint_u_w = struct { | |
| 11696 | const param_str = "V4fV4Ui"; | |
| 11697 | const target_set = TargetSet.init(.{ | |
| 11698 | .mips = true, | |
| 11699 | }); | |
| 11700 | const attributes = Attributes{ | |
| 11701 | .@"const" = true, | |
| 11702 | }; | |
| 11703 | }; | |
| 11704 | ||
| 11705 | pub const __builtin_msa_ffql_d = struct { | |
| 11706 | const param_str = "V2dV4Si"; | |
| 11707 | const target_set = TargetSet.init(.{ | |
| 11708 | .mips = true, | |
| 11709 | }); | |
| 11710 | const attributes = Attributes{ | |
| 11711 | .@"const" = true, | |
| 11712 | }; | |
| 11713 | }; | |
| 11714 | ||
| 11715 | pub const __builtin_msa_ffql_w = struct { | |
| 11716 | const param_str = "V4fV8Ss"; | |
| 11717 | const target_set = TargetSet.init(.{ | |
| 11718 | .mips = true, | |
| 11719 | }); | |
| 11720 | const attributes = Attributes{ | |
| 11721 | .@"const" = true, | |
| 11722 | }; | |
| 11723 | }; | |
| 11724 | ||
| 11725 | pub const __builtin_msa_ffqr_d = struct { | |
| 11726 | const param_str = "V2dV4Si"; | |
| 11727 | const target_set = TargetSet.init(.{ | |
| 11728 | .mips = true, | |
| 11729 | }); | |
| 11730 | const attributes = Attributes{ | |
| 11731 | .@"const" = true, | |
| 11732 | }; | |
| 11733 | }; | |
| 11734 | ||
| 11735 | pub const __builtin_msa_ffqr_w = struct { | |
| 11736 | const param_str = "V4fV8Ss"; | |
| 11737 | const target_set = TargetSet.init(.{ | |
| 11738 | .mips = true, | |
| 11739 | }); | |
| 11740 | const attributes = Attributes{ | |
| 11741 | .@"const" = true, | |
| 11742 | }; | |
| 11743 | }; | |
| 11744 | ||
| 11745 | pub const __builtin_msa_fill_b = struct { | |
| 11746 | const param_str = "V16Sci"; | |
| 11747 | const target_set = TargetSet.init(.{ | |
| 11748 | .mips = true, | |
| 11749 | }); | |
| 11750 | const attributes = Attributes{ | |
| 11751 | .@"const" = true, | |
| 11752 | }; | |
| 11753 | }; | |
| 11754 | ||
| 11755 | pub const __builtin_msa_fill_d = struct { | |
| 11756 | const param_str = "V2SLLiLLi"; | |
| 11757 | const target_set = TargetSet.init(.{ | |
| 11758 | .mips = true, | |
| 11759 | }); | |
| 11760 | const attributes = Attributes{ | |
| 11761 | .@"const" = true, | |
| 11762 | }; | |
| 11763 | }; | |
| 11764 | ||
| 11765 | pub const __builtin_msa_fill_h = struct { | |
| 11766 | const param_str = "V8Ssi"; | |
| 11767 | const target_set = TargetSet.init(.{ | |
| 11768 | .mips = true, | |
| 11769 | }); | |
| 11770 | const attributes = Attributes{ | |
| 11771 | .@"const" = true, | |
| 11772 | }; | |
| 11773 | }; | |
| 11774 | ||
| 11775 | pub const __builtin_msa_fill_w = struct { | |
| 11776 | const param_str = "V4Sii"; | |
| 11777 | const target_set = TargetSet.init(.{ | |
| 11778 | .mips = true, | |
| 11779 | }); | |
| 11780 | const attributes = Attributes{ | |
| 11781 | .@"const" = true, | |
| 11782 | }; | |
| 11783 | }; | |
| 11784 | ||
| 11785 | pub const __builtin_msa_flog2_d = struct { | |
| 11786 | const param_str = "V2dV2d"; | |
| 11787 | const target_set = TargetSet.init(.{ | |
| 11788 | .mips = true, | |
| 11789 | }); | |
| 11790 | const attributes = Attributes{ | |
| 11791 | .@"const" = true, | |
| 11792 | }; | |
| 11793 | }; | |
| 11794 | ||
| 11795 | pub const __builtin_msa_flog2_w = struct { | |
| 11796 | const param_str = "V4fV4f"; | |
| 11797 | const target_set = TargetSet.init(.{ | |
| 11798 | .mips = true, | |
| 11799 | }); | |
| 11800 | const attributes = Attributes{ | |
| 11801 | .@"const" = true, | |
| 11802 | }; | |
| 11803 | }; | |
| 11804 | ||
| 11805 | pub const __builtin_msa_fmadd_d = struct { | |
| 11806 | const param_str = "V2dV2dV2dV2d"; | |
| 11807 | const target_set = TargetSet.init(.{ | |
| 11808 | .mips = true, | |
| 11809 | }); | |
| 11810 | const attributes = Attributes{ | |
| 11811 | .@"const" = true, | |
| 11812 | }; | |
| 11813 | }; | |
| 11814 | ||
| 11815 | pub const __builtin_msa_fmadd_w = struct { | |
| 11816 | const param_str = "V4fV4fV4fV4f"; | |
| 11817 | const target_set = TargetSet.init(.{ | |
| 11818 | .mips = true, | |
| 11819 | }); | |
| 11820 | const attributes = Attributes{ | |
| 11821 | .@"const" = true, | |
| 11822 | }; | |
| 11823 | }; | |
| 11824 | ||
| 11825 | pub const __builtin_msa_fmax_a_d = struct { | |
| 11826 | const param_str = "V2dV2dV2d"; | |
| 11827 | const target_set = TargetSet.init(.{ | |
| 11828 | .mips = true, | |
| 11829 | }); | |
| 11830 | const attributes = Attributes{ | |
| 11831 | .@"const" = true, | |
| 11832 | }; | |
| 11833 | }; | |
| 11834 | ||
| 11835 | pub const __builtin_msa_fmax_a_w = struct { | |
| 11836 | const param_str = "V4fV4fV4f"; | |
| 11837 | const target_set = TargetSet.init(.{ | |
| 11838 | .mips = true, | |
| 11839 | }); | |
| 11840 | const attributes = Attributes{ | |
| 11841 | .@"const" = true, | |
| 11842 | }; | |
| 11843 | }; | |
| 11844 | ||
| 11845 | pub const __builtin_msa_fmax_d = struct { | |
| 11846 | const param_str = "V2dV2dV2d"; | |
| 11847 | const target_set = TargetSet.init(.{ | |
| 11848 | .mips = true, | |
| 11849 | }); | |
| 11850 | const attributes = Attributes{ | |
| 11851 | .@"const" = true, | |
| 11852 | }; | |
| 11853 | }; | |
| 11854 | ||
| 11855 | pub const __builtin_msa_fmax_w = struct { | |
| 11856 | const param_str = "V4fV4fV4f"; | |
| 11857 | const target_set = TargetSet.init(.{ | |
| 11858 | .mips = true, | |
| 11859 | }); | |
| 11860 | const attributes = Attributes{ | |
| 11861 | .@"const" = true, | |
| 11862 | }; | |
| 11863 | }; | |
| 11864 | ||
| 11865 | pub const __builtin_msa_fmin_a_d = struct { | |
| 11866 | const param_str = "V2dV2dV2d"; | |
| 11867 | const target_set = TargetSet.init(.{ | |
| 11868 | .mips = true, | |
| 11869 | }); | |
| 11870 | const attributes = Attributes{ | |
| 11871 | .@"const" = true, | |
| 11872 | }; | |
| 11873 | }; | |
| 11874 | ||
| 11875 | pub const __builtin_msa_fmin_a_w = struct { | |
| 11876 | const param_str = "V4fV4fV4f"; | |
| 11877 | const target_set = TargetSet.init(.{ | |
| 11878 | .mips = true, | |
| 11879 | }); | |
| 11880 | const attributes = Attributes{ | |
| 11881 | .@"const" = true, | |
| 11882 | }; | |
| 11883 | }; | |
| 11884 | ||
| 11885 | pub const __builtin_msa_fmin_d = struct { | |
| 11886 | const param_str = "V2dV2dV2d"; | |
| 11887 | const target_set = TargetSet.init(.{ | |
| 11888 | .mips = true, | |
| 11889 | }); | |
| 11890 | const attributes = Attributes{ | |
| 11891 | .@"const" = true, | |
| 11892 | }; | |
| 11893 | }; | |
| 11894 | ||
| 11895 | pub const __builtin_msa_fmin_w = struct { | |
| 11896 | const param_str = "V4fV4fV4f"; | |
| 11897 | const target_set = TargetSet.init(.{ | |
| 11898 | .mips = true, | |
| 11899 | }); | |
| 11900 | const attributes = Attributes{ | |
| 11901 | .@"const" = true, | |
| 11902 | }; | |
| 11903 | }; | |
| 11904 | ||
| 11905 | pub const __builtin_msa_fmsub_d = struct { | |
| 11906 | const param_str = "V2dV2dV2dV2d"; | |
| 11907 | const target_set = TargetSet.init(.{ | |
| 11908 | .mips = true, | |
| 11909 | }); | |
| 11910 | const attributes = Attributes{ | |
| 11911 | .@"const" = true, | |
| 11912 | }; | |
| 11913 | }; | |
| 11914 | ||
| 11915 | pub const __builtin_msa_fmsub_w = struct { | |
| 11916 | const param_str = "V4fV4fV4fV4f"; | |
| 11917 | const target_set = TargetSet.init(.{ | |
| 11918 | .mips = true, | |
| 11919 | }); | |
| 11920 | const attributes = Attributes{ | |
| 11921 | .@"const" = true, | |
| 11922 | }; | |
| 11923 | }; | |
| 11924 | ||
| 11925 | pub const __builtin_msa_fmul_d = struct { | |
| 11926 | const param_str = "V2dV2dV2d"; | |
| 11927 | const target_set = TargetSet.init(.{ | |
| 11928 | .mips = true, | |
| 11929 | }); | |
| 11930 | const attributes = Attributes{ | |
| 11931 | .@"const" = true, | |
| 11932 | }; | |
| 11933 | }; | |
| 11934 | ||
| 11935 | pub const __builtin_msa_fmul_w = struct { | |
| 11936 | const param_str = "V4fV4fV4f"; | |
| 11937 | const target_set = TargetSet.init(.{ | |
| 11938 | .mips = true, | |
| 11939 | }); | |
| 11940 | const attributes = Attributes{ | |
| 11941 | .@"const" = true, | |
| 11942 | }; | |
| 11943 | }; | |
| 11944 | ||
| 11945 | pub const __builtin_msa_frcp_d = struct { | |
| 11946 | const param_str = "V2dV2d"; | |
| 11947 | const target_set = TargetSet.init(.{ | |
| 11948 | .mips = true, | |
| 11949 | }); | |
| 11950 | const attributes = Attributes{ | |
| 11951 | .@"const" = true, | |
| 11952 | }; | |
| 11953 | }; | |
| 11954 | ||
| 11955 | pub const __builtin_msa_frcp_w = struct { | |
| 11956 | const param_str = "V4fV4f"; | |
| 11957 | const target_set = TargetSet.init(.{ | |
| 11958 | .mips = true, | |
| 11959 | }); | |
| 11960 | const attributes = Attributes{ | |
| 11961 | .@"const" = true, | |
| 11962 | }; | |
| 11963 | }; | |
| 11964 | ||
| 11965 | pub const __builtin_msa_frint_d = struct { | |
| 11966 | const param_str = "V2dV2d"; | |
| 11967 | const target_set = TargetSet.init(.{ | |
| 11968 | .mips = true, | |
| 11969 | }); | |
| 11970 | const attributes = Attributes{ | |
| 11971 | .@"const" = true, | |
| 11972 | }; | |
| 11973 | }; | |
| 11974 | ||
| 11975 | pub const __builtin_msa_frint_w = struct { | |
| 11976 | const param_str = "V4fV4f"; | |
| 11977 | const target_set = TargetSet.init(.{ | |
| 11978 | .mips = true, | |
| 11979 | }); | |
| 11980 | const attributes = Attributes{ | |
| 11981 | .@"const" = true, | |
| 11982 | }; | |
| 11983 | }; | |
| 11984 | ||
| 11985 | pub const __builtin_msa_frsqrt_d = struct { | |
| 11986 | const param_str = "V2dV2d"; | |
| 11987 | const target_set = TargetSet.init(.{ | |
| 11988 | .mips = true, | |
| 11989 | }); | |
| 11990 | const attributes = Attributes{ | |
| 11991 | .@"const" = true, | |
| 11992 | }; | |
| 11993 | }; | |
| 11994 | ||
| 11995 | pub const __builtin_msa_frsqrt_w = struct { | |
| 11996 | const param_str = "V4fV4f"; | |
| 11997 | const target_set = TargetSet.init(.{ | |
| 11998 | .mips = true, | |
| 11999 | }); | |
| 12000 | const attributes = Attributes{ | |
| 12001 | .@"const" = true, | |
| 12002 | }; | |
| 12003 | }; | |
| 12004 | ||
| 12005 | pub const __builtin_msa_fsaf_d = struct { | |
| 12006 | const param_str = "V2LLiV2dV2d"; | |
| 12007 | const target_set = TargetSet.init(.{ | |
| 12008 | .mips = true, | |
| 12009 | }); | |
| 12010 | const attributes = Attributes{ | |
| 12011 | .@"const" = true, | |
| 12012 | }; | |
| 12013 | }; | |
| 12014 | ||
| 12015 | pub const __builtin_msa_fsaf_w = struct { | |
| 12016 | const param_str = "V4iV4fV4f"; | |
| 12017 | const target_set = TargetSet.init(.{ | |
| 12018 | .mips = true, | |
| 12019 | }); | |
| 12020 | const attributes = Attributes{ | |
| 12021 | .@"const" = true, | |
| 12022 | }; | |
| 12023 | }; | |
| 12024 | ||
| 12025 | pub const __builtin_msa_fseq_d = struct { | |
| 12026 | const param_str = "V2LLiV2dV2d"; | |
| 12027 | const target_set = TargetSet.init(.{ | |
| 12028 | .mips = true, | |
| 12029 | }); | |
| 12030 | const attributes = Attributes{ | |
| 12031 | .@"const" = true, | |
| 12032 | }; | |
| 12033 | }; | |
| 12034 | ||
| 12035 | pub const __builtin_msa_fseq_w = struct { | |
| 12036 | const param_str = "V4iV4fV4f"; | |
| 12037 | const target_set = TargetSet.init(.{ | |
| 12038 | .mips = true, | |
| 12039 | }); | |
| 12040 | const attributes = Attributes{ | |
| 12041 | .@"const" = true, | |
| 12042 | }; | |
| 12043 | }; | |
| 12044 | ||
| 12045 | pub const __builtin_msa_fsle_d = struct { | |
| 12046 | const param_str = "V2LLiV2dV2d"; | |
| 12047 | const target_set = TargetSet.init(.{ | |
| 12048 | .mips = true, | |
| 12049 | }); | |
| 12050 | const attributes = Attributes{ | |
| 12051 | .@"const" = true, | |
| 12052 | }; | |
| 12053 | }; | |
| 12054 | ||
| 12055 | pub const __builtin_msa_fsle_w = struct { | |
| 12056 | const param_str = "V4iV4fV4f"; | |
| 12057 | const target_set = TargetSet.init(.{ | |
| 12058 | .mips = true, | |
| 12059 | }); | |
| 12060 | const attributes = Attributes{ | |
| 12061 | .@"const" = true, | |
| 12062 | }; | |
| 12063 | }; | |
| 12064 | ||
| 12065 | pub const __builtin_msa_fslt_d = struct { | |
| 12066 | const param_str = "V2LLiV2dV2d"; | |
| 12067 | const target_set = TargetSet.init(.{ | |
| 12068 | .mips = true, | |
| 12069 | }); | |
| 12070 | const attributes = Attributes{ | |
| 12071 | .@"const" = true, | |
| 12072 | }; | |
| 12073 | }; | |
| 12074 | ||
| 12075 | pub const __builtin_msa_fslt_w = struct { | |
| 12076 | const param_str = "V4iV4fV4f"; | |
| 12077 | const target_set = TargetSet.init(.{ | |
| 12078 | .mips = true, | |
| 12079 | }); | |
| 12080 | const attributes = Attributes{ | |
| 12081 | .@"const" = true, | |
| 12082 | }; | |
| 12083 | }; | |
| 12084 | ||
| 12085 | pub const __builtin_msa_fsne_d = struct { | |
| 12086 | const param_str = "V2LLiV2dV2d"; | |
| 12087 | const target_set = TargetSet.init(.{ | |
| 12088 | .mips = true, | |
| 12089 | }); | |
| 12090 | const attributes = Attributes{ | |
| 12091 | .@"const" = true, | |
| 12092 | }; | |
| 12093 | }; | |
| 12094 | ||
| 12095 | pub const __builtin_msa_fsne_w = struct { | |
| 12096 | const param_str = "V4iV4fV4f"; | |
| 12097 | const target_set = TargetSet.init(.{ | |
| 12098 | .mips = true, | |
| 12099 | }); | |
| 12100 | const attributes = Attributes{ | |
| 12101 | .@"const" = true, | |
| 12102 | }; | |
| 12103 | }; | |
| 12104 | ||
| 12105 | pub const __builtin_msa_fsor_d = struct { | |
| 12106 | const param_str = "V2LLiV2dV2d"; | |
| 12107 | const target_set = TargetSet.init(.{ | |
| 12108 | .mips = true, | |
| 12109 | }); | |
| 12110 | const attributes = Attributes{ | |
| 12111 | .@"const" = true, | |
| 12112 | }; | |
| 12113 | }; | |
| 12114 | ||
| 12115 | pub const __builtin_msa_fsor_w = struct { | |
| 12116 | const param_str = "V4iV4fV4f"; | |
| 12117 | const target_set = TargetSet.init(.{ | |
| 12118 | .mips = true, | |
| 12119 | }); | |
| 12120 | const attributes = Attributes{ | |
| 12121 | .@"const" = true, | |
| 12122 | }; | |
| 12123 | }; | |
| 12124 | ||
| 12125 | pub const __builtin_msa_fsqrt_d = struct { | |
| 12126 | const param_str = "V2dV2d"; | |
| 12127 | const target_set = TargetSet.init(.{ | |
| 12128 | .mips = true, | |
| 12129 | }); | |
| 12130 | const attributes = Attributes{ | |
| 12131 | .@"const" = true, | |
| 12132 | }; | |
| 12133 | }; | |
| 12134 | ||
| 12135 | pub const __builtin_msa_fsqrt_w = struct { | |
| 12136 | const param_str = "V4fV4f"; | |
| 12137 | const target_set = TargetSet.init(.{ | |
| 12138 | .mips = true, | |
| 12139 | }); | |
| 12140 | const attributes = Attributes{ | |
| 12141 | .@"const" = true, | |
| 12142 | }; | |
| 12143 | }; | |
| 12144 | ||
| 12145 | pub const __builtin_msa_fsub_d = struct { | |
| 12146 | const param_str = "V2dV2dV2d"; | |
| 12147 | const target_set = TargetSet.init(.{ | |
| 12148 | .mips = true, | |
| 12149 | }); | |
| 12150 | const attributes = Attributes{ | |
| 12151 | .@"const" = true, | |
| 12152 | }; | |
| 12153 | }; | |
| 12154 | ||
| 12155 | pub const __builtin_msa_fsub_w = struct { | |
| 12156 | const param_str = "V4fV4fV4f"; | |
| 12157 | const target_set = TargetSet.init(.{ | |
| 12158 | .mips = true, | |
| 12159 | }); | |
| 12160 | const attributes = Attributes{ | |
| 12161 | .@"const" = true, | |
| 12162 | }; | |
| 12163 | }; | |
| 12164 | ||
| 12165 | pub const __builtin_msa_fsueq_d = struct { | |
| 12166 | const param_str = "V2LLiV2dV2d"; | |
| 12167 | const target_set = TargetSet.init(.{ | |
| 12168 | .mips = true, | |
| 12169 | }); | |
| 12170 | const attributes = Attributes{ | |
| 12171 | .@"const" = true, | |
| 12172 | }; | |
| 12173 | }; | |
| 12174 | ||
| 12175 | pub const __builtin_msa_fsueq_w = struct { | |
| 12176 | const param_str = "V4iV4fV4f"; | |
| 12177 | const target_set = TargetSet.init(.{ | |
| 12178 | .mips = true, | |
| 12179 | }); | |
| 12180 | const attributes = Attributes{ | |
| 12181 | .@"const" = true, | |
| 12182 | }; | |
| 12183 | }; | |
| 12184 | ||
| 12185 | pub const __builtin_msa_fsule_d = struct { | |
| 12186 | const param_str = "V2LLiV2dV2d"; | |
| 12187 | const target_set = TargetSet.init(.{ | |
| 12188 | .mips = true, | |
| 12189 | }); | |
| 12190 | const attributes = Attributes{ | |
| 12191 | .@"const" = true, | |
| 12192 | }; | |
| 12193 | }; | |
| 12194 | ||
| 12195 | pub const __builtin_msa_fsule_w = struct { | |
| 12196 | const param_str = "V4iV4fV4f"; | |
| 12197 | const target_set = TargetSet.init(.{ | |
| 12198 | .mips = true, | |
| 12199 | }); | |
| 12200 | const attributes = Attributes{ | |
| 12201 | .@"const" = true, | |
| 12202 | }; | |
| 12203 | }; | |
| 12204 | ||
| 12205 | pub const __builtin_msa_fsult_d = struct { | |
| 12206 | const param_str = "V2LLiV2dV2d"; | |
| 12207 | const target_set = TargetSet.init(.{ | |
| 12208 | .mips = true, | |
| 12209 | }); | |
| 12210 | const attributes = Attributes{ | |
| 12211 | .@"const" = true, | |
| 12212 | }; | |
| 12213 | }; | |
| 12214 | ||
| 12215 | pub const __builtin_msa_fsult_w = struct { | |
| 12216 | const param_str = "V4iV4fV4f"; | |
| 12217 | const target_set = TargetSet.init(.{ | |
| 12218 | .mips = true, | |
| 12219 | }); | |
| 12220 | const attributes = Attributes{ | |
| 12221 | .@"const" = true, | |
| 12222 | }; | |
| 12223 | }; | |
| 12224 | ||
| 12225 | pub const __builtin_msa_fsun_d = struct { | |
| 12226 | const param_str = "V2LLiV2dV2d"; | |
| 12227 | const target_set = TargetSet.init(.{ | |
| 12228 | .mips = true, | |
| 12229 | }); | |
| 12230 | const attributes = Attributes{ | |
| 12231 | .@"const" = true, | |
| 12232 | }; | |
| 12233 | }; | |
| 12234 | ||
| 12235 | pub const __builtin_msa_fsun_w = struct { | |
| 12236 | const param_str = "V4iV4fV4f"; | |
| 12237 | const target_set = TargetSet.init(.{ | |
| 12238 | .mips = true, | |
| 12239 | }); | |
| 12240 | const attributes = Attributes{ | |
| 12241 | .@"const" = true, | |
| 12242 | }; | |
| 12243 | }; | |
| 12244 | ||
| 12245 | pub const __builtin_msa_fsune_d = struct { | |
| 12246 | const param_str = "V2LLiV2dV2d"; | |
| 12247 | const target_set = TargetSet.init(.{ | |
| 12248 | .mips = true, | |
| 12249 | }); | |
| 12250 | const attributes = Attributes{ | |
| 12251 | .@"const" = true, | |
| 12252 | }; | |
| 12253 | }; | |
| 12254 | ||
| 12255 | pub const __builtin_msa_fsune_w = struct { | |
| 12256 | const param_str = "V4iV4fV4f"; | |
| 12257 | const target_set = TargetSet.init(.{ | |
| 12258 | .mips = true, | |
| 12259 | }); | |
| 12260 | const attributes = Attributes{ | |
| 12261 | .@"const" = true, | |
| 12262 | }; | |
| 12263 | }; | |
| 12264 | ||
| 12265 | pub const __builtin_msa_ftint_s_d = struct { | |
| 12266 | const param_str = "V2SLLiV2d"; | |
| 12267 | const target_set = TargetSet.init(.{ | |
| 12268 | .mips = true, | |
| 12269 | }); | |
| 12270 | const attributes = Attributes{ | |
| 12271 | .@"const" = true, | |
| 12272 | }; | |
| 12273 | }; | |
| 12274 | ||
| 12275 | pub const __builtin_msa_ftint_s_w = struct { | |
| 12276 | const param_str = "V4SiV4f"; | |
| 12277 | const target_set = TargetSet.init(.{ | |
| 12278 | .mips = true, | |
| 12279 | }); | |
| 12280 | const attributes = Attributes{ | |
| 12281 | .@"const" = true, | |
| 12282 | }; | |
| 12283 | }; | |
| 12284 | ||
| 12285 | pub const __builtin_msa_ftint_u_d = struct { | |
| 12286 | const param_str = "V2ULLiV2d"; | |
| 12287 | const target_set = TargetSet.init(.{ | |
| 12288 | .mips = true, | |
| 12289 | }); | |
| 12290 | const attributes = Attributes{ | |
| 12291 | .@"const" = true, | |
| 12292 | }; | |
| 12293 | }; | |
| 12294 | ||
| 12295 | pub const __builtin_msa_ftint_u_w = struct { | |
| 12296 | const param_str = "V4UiV4f"; | |
| 12297 | const target_set = TargetSet.init(.{ | |
| 12298 | .mips = true, | |
| 12299 | }); | |
| 12300 | const attributes = Attributes{ | |
| 12301 | .@"const" = true, | |
| 12302 | }; | |
| 12303 | }; | |
| 12304 | ||
| 12305 | pub const __builtin_msa_ftq_h = struct { | |
| 12306 | const param_str = "V4UiV4fV4f"; | |
| 12307 | const target_set = TargetSet.init(.{ | |
| 12308 | .mips = true, | |
| 12309 | }); | |
| 12310 | const attributes = Attributes{ | |
| 12311 | .@"const" = true, | |
| 12312 | }; | |
| 12313 | }; | |
| 12314 | ||
| 12315 | pub const __builtin_msa_ftq_w = struct { | |
| 12316 | const param_str = "V2ULLiV2dV2d"; | |
| 12317 | const target_set = TargetSet.init(.{ | |
| 12318 | .mips = true, | |
| 12319 | }); | |
| 12320 | const attributes = Attributes{ | |
| 12321 | .@"const" = true, | |
| 12322 | }; | |
| 12323 | }; | |
| 12324 | ||
| 12325 | pub const __builtin_msa_ftrunc_s_d = struct { | |
| 12326 | const param_str = "V2SLLiV2d"; | |
| 12327 | const target_set = TargetSet.init(.{ | |
| 12328 | .mips = true, | |
| 12329 | }); | |
| 12330 | const attributes = Attributes{ | |
| 12331 | .@"const" = true, | |
| 12332 | }; | |
| 12333 | }; | |
| 12334 | ||
| 12335 | pub const __builtin_msa_ftrunc_s_w = struct { | |
| 12336 | const param_str = "V4SiV4f"; | |
| 12337 | const target_set = TargetSet.init(.{ | |
| 12338 | .mips = true, | |
| 12339 | }); | |
| 12340 | const attributes = Attributes{ | |
| 12341 | .@"const" = true, | |
| 12342 | }; | |
| 12343 | }; | |
| 12344 | ||
| 12345 | pub const __builtin_msa_ftrunc_u_d = struct { | |
| 12346 | const param_str = "V2ULLiV2d"; | |
| 12347 | const target_set = TargetSet.init(.{ | |
| 12348 | .mips = true, | |
| 12349 | }); | |
| 12350 | const attributes = Attributes{ | |
| 12351 | .@"const" = true, | |
| 12352 | }; | |
| 12353 | }; | |
| 12354 | ||
| 12355 | pub const __builtin_msa_ftrunc_u_w = struct { | |
| 12356 | const param_str = "V4UiV4f"; | |
| 12357 | const target_set = TargetSet.init(.{ | |
| 12358 | .mips = true, | |
| 12359 | }); | |
| 12360 | const attributes = Attributes{ | |
| 12361 | .@"const" = true, | |
| 12362 | }; | |
| 12363 | }; | |
| 12364 | ||
| 12365 | pub const __builtin_msa_hadd_s_d = struct { | |
| 12366 | const param_str = "V2SLLiV4SiV4Si"; | |
| 12367 | const target_set = TargetSet.init(.{ | |
| 12368 | .mips = true, | |
| 12369 | }); | |
| 12370 | const attributes = Attributes{ | |
| 12371 | .@"const" = true, | |
| 12372 | }; | |
| 12373 | }; | |
| 12374 | ||
| 12375 | pub const __builtin_msa_hadd_s_h = struct { | |
| 12376 | const param_str = "V8SsV16ScV16Sc"; | |
| 12377 | const target_set = TargetSet.init(.{ | |
| 12378 | .mips = true, | |
| 12379 | }); | |
| 12380 | const attributes = Attributes{ | |
| 12381 | .@"const" = true, | |
| 12382 | }; | |
| 12383 | }; | |
| 12384 | ||
| 12385 | pub const __builtin_msa_hadd_s_w = struct { | |
| 12386 | const param_str = "V4SiV8SsV8Ss"; | |
| 12387 | const target_set = TargetSet.init(.{ | |
| 12388 | .mips = true, | |
| 12389 | }); | |
| 12390 | const attributes = Attributes{ | |
| 12391 | .@"const" = true, | |
| 12392 | }; | |
| 12393 | }; | |
| 12394 | ||
| 12395 | pub const __builtin_msa_hadd_u_d = struct { | |
| 12396 | const param_str = "V2ULLiV4UiV4Ui"; | |
| 12397 | const target_set = TargetSet.init(.{ | |
| 12398 | .mips = true, | |
| 12399 | }); | |
| 12400 | const attributes = Attributes{ | |
| 12401 | .@"const" = true, | |
| 12402 | }; | |
| 12403 | }; | |
| 12404 | ||
| 12405 | pub const __builtin_msa_hadd_u_h = struct { | |
| 12406 | const param_str = "V8UsV16UcV16Uc"; | |
| 12407 | const target_set = TargetSet.init(.{ | |
| 12408 | .mips = true, | |
| 12409 | }); | |
| 12410 | const attributes = Attributes{ | |
| 12411 | .@"const" = true, | |
| 12412 | }; | |
| 12413 | }; | |
| 12414 | ||
| 12415 | pub const __builtin_msa_hadd_u_w = struct { | |
| 12416 | const param_str = "V4UiV8UsV8Us"; | |
| 12417 | const target_set = TargetSet.init(.{ | |
| 12418 | .mips = true, | |
| 12419 | }); | |
| 12420 | const attributes = Attributes{ | |
| 12421 | .@"const" = true, | |
| 12422 | }; | |
| 12423 | }; | |
| 12424 | ||
| 12425 | pub const __builtin_msa_hsub_s_d = struct { | |
| 12426 | const param_str = "V2SLLiV4SiV4Si"; | |
| 12427 | const target_set = TargetSet.init(.{ | |
| 12428 | .mips = true, | |
| 12429 | }); | |
| 12430 | const attributes = Attributes{ | |
| 12431 | .@"const" = true, | |
| 12432 | }; | |
| 12433 | }; | |
| 12434 | ||
| 12435 | pub const __builtin_msa_hsub_s_h = struct { | |
| 12436 | const param_str = "V8SsV16ScV16Sc"; | |
| 12437 | const target_set = TargetSet.init(.{ | |
| 12438 | .mips = true, | |
| 12439 | }); | |
| 12440 | const attributes = Attributes{ | |
| 12441 | .@"const" = true, | |
| 12442 | }; | |
| 12443 | }; | |
| 12444 | ||
| 12445 | pub const __builtin_msa_hsub_s_w = struct { | |
| 12446 | const param_str = "V4SiV8SsV8Ss"; | |
| 12447 | const target_set = TargetSet.init(.{ | |
| 12448 | .mips = true, | |
| 12449 | }); | |
| 12450 | const attributes = Attributes{ | |
| 12451 | .@"const" = true, | |
| 12452 | }; | |
| 12453 | }; | |
| 12454 | ||
| 12455 | pub const __builtin_msa_hsub_u_d = struct { | |
| 12456 | const param_str = "V2ULLiV4UiV4Ui"; | |
| 12457 | const target_set = TargetSet.init(.{ | |
| 12458 | .mips = true, | |
| 12459 | }); | |
| 12460 | const attributes = Attributes{ | |
| 12461 | .@"const" = true, | |
| 12462 | }; | |
| 12463 | }; | |
| 12464 | ||
| 12465 | pub const __builtin_msa_hsub_u_h = struct { | |
| 12466 | const param_str = "V8UsV16UcV16Uc"; | |
| 12467 | const target_set = TargetSet.init(.{ | |
| 12468 | .mips = true, | |
| 12469 | }); | |
| 12470 | const attributes = Attributes{ | |
| 12471 | .@"const" = true, | |
| 12472 | }; | |
| 12473 | }; | |
| 12474 | ||
| 12475 | pub const __builtin_msa_hsub_u_w = struct { | |
| 12476 | const param_str = "V4UiV8UsV8Us"; | |
| 12477 | const target_set = TargetSet.init(.{ | |
| 12478 | .mips = true, | |
| 12479 | }); | |
| 12480 | const attributes = Attributes{ | |
| 12481 | .@"const" = true, | |
| 12482 | }; | |
| 12483 | }; | |
| 12484 | ||
| 12485 | pub const __builtin_msa_ilvev_b = struct { | |
| 12486 | const param_str = "V16cV16cV16c"; | |
| 12487 | const target_set = TargetSet.init(.{ | |
| 12488 | .mips = true, | |
| 12489 | }); | |
| 12490 | const attributes = Attributes{ | |
| 12491 | .@"const" = true, | |
| 12492 | }; | |
| 12493 | }; | |
| 12494 | ||
| 12495 | pub const __builtin_msa_ilvev_d = struct { | |
| 12496 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 12497 | const target_set = TargetSet.init(.{ | |
| 12498 | .mips = true, | |
| 12499 | }); | |
| 12500 | const attributes = Attributes{ | |
| 12501 | .@"const" = true, | |
| 12502 | }; | |
| 12503 | }; | |
| 12504 | ||
| 12505 | pub const __builtin_msa_ilvev_h = struct { | |
| 12506 | const param_str = "V8sV8sV8s"; | |
| 12507 | const target_set = TargetSet.init(.{ | |
| 12508 | .mips = true, | |
| 12509 | }); | |
| 12510 | const attributes = Attributes{ | |
| 12511 | .@"const" = true, | |
| 12512 | }; | |
| 12513 | }; | |
| 12514 | ||
| 12515 | pub const __builtin_msa_ilvev_w = struct { | |
| 12516 | const param_str = "V4iV4iV4i"; | |
| 12517 | const target_set = TargetSet.init(.{ | |
| 12518 | .mips = true, | |
| 12519 | }); | |
| 12520 | const attributes = Attributes{ | |
| 12521 | .@"const" = true, | |
| 12522 | }; | |
| 12523 | }; | |
| 12524 | ||
| 12525 | pub const __builtin_msa_ilvl_b = struct { | |
| 12526 | const param_str = "V16cV16cV16c"; | |
| 12527 | const target_set = TargetSet.init(.{ | |
| 12528 | .mips = true, | |
| 12529 | }); | |
| 12530 | const attributes = Attributes{ | |
| 12531 | .@"const" = true, | |
| 12532 | }; | |
| 12533 | }; | |
| 12534 | ||
| 12535 | pub const __builtin_msa_ilvl_d = struct { | |
| 12536 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 12537 | const target_set = TargetSet.init(.{ | |
| 12538 | .mips = true, | |
| 12539 | }); | |
| 12540 | const attributes = Attributes{ | |
| 12541 | .@"const" = true, | |
| 12542 | }; | |
| 12543 | }; | |
| 12544 | ||
| 12545 | pub const __builtin_msa_ilvl_h = struct { | |
| 12546 | const param_str = "V8sV8sV8s"; | |
| 12547 | const target_set = TargetSet.init(.{ | |
| 12548 | .mips = true, | |
| 12549 | }); | |
| 12550 | const attributes = Attributes{ | |
| 12551 | .@"const" = true, | |
| 12552 | }; | |
| 12553 | }; | |
| 12554 | ||
| 12555 | pub const __builtin_msa_ilvl_w = struct { | |
| 12556 | const param_str = "V4iV4iV4i"; | |
| 12557 | const target_set = TargetSet.init(.{ | |
| 12558 | .mips = true, | |
| 12559 | }); | |
| 12560 | const attributes = Attributes{ | |
| 12561 | .@"const" = true, | |
| 12562 | }; | |
| 12563 | }; | |
| 12564 | ||
| 12565 | pub const __builtin_msa_ilvod_b = struct { | |
| 12566 | const param_str = "V16cV16cV16c"; | |
| 12567 | const target_set = TargetSet.init(.{ | |
| 12568 | .mips = true, | |
| 12569 | }); | |
| 12570 | const attributes = Attributes{ | |
| 12571 | .@"const" = true, | |
| 12572 | }; | |
| 12573 | }; | |
| 12574 | ||
| 12575 | pub const __builtin_msa_ilvod_d = struct { | |
| 12576 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 12577 | const target_set = TargetSet.init(.{ | |
| 12578 | .mips = true, | |
| 12579 | }); | |
| 12580 | const attributes = Attributes{ | |
| 12581 | .@"const" = true, | |
| 12582 | }; | |
| 12583 | }; | |
| 12584 | ||
| 12585 | pub const __builtin_msa_ilvod_h = struct { | |
| 12586 | const param_str = "V8sV8sV8s"; | |
| 12587 | const target_set = TargetSet.init(.{ | |
| 12588 | .mips = true, | |
| 12589 | }); | |
| 12590 | const attributes = Attributes{ | |
| 12591 | .@"const" = true, | |
| 12592 | }; | |
| 12593 | }; | |
| 12594 | ||
| 12595 | pub const __builtin_msa_ilvod_w = struct { | |
| 12596 | const param_str = "V4iV4iV4i"; | |
| 12597 | const target_set = TargetSet.init(.{ | |
| 12598 | .mips = true, | |
| 12599 | }); | |
| 12600 | const attributes = Attributes{ | |
| 12601 | .@"const" = true, | |
| 12602 | }; | |
| 12603 | }; | |
| 12604 | ||
| 12605 | pub const __builtin_msa_ilvr_b = struct { | |
| 12606 | const param_str = "V16cV16cV16c"; | |
| 12607 | const target_set = TargetSet.init(.{ | |
| 12608 | .mips = true, | |
| 12609 | }); | |
| 12610 | const attributes = Attributes{ | |
| 12611 | .@"const" = true, | |
| 12612 | }; | |
| 12613 | }; | |
| 12614 | ||
| 12615 | pub const __builtin_msa_ilvr_d = struct { | |
| 12616 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 12617 | const target_set = TargetSet.init(.{ | |
| 12618 | .mips = true, | |
| 12619 | }); | |
| 12620 | const attributes = Attributes{ | |
| 12621 | .@"const" = true, | |
| 12622 | }; | |
| 12623 | }; | |
| 12624 | ||
| 12625 | pub const __builtin_msa_ilvr_h = struct { | |
| 12626 | const param_str = "V8sV8sV8s"; | |
| 12627 | const target_set = TargetSet.init(.{ | |
| 12628 | .mips = true, | |
| 12629 | }); | |
| 12630 | const attributes = Attributes{ | |
| 12631 | .@"const" = true, | |
| 12632 | }; | |
| 12633 | }; | |
| 12634 | ||
| 12635 | pub const __builtin_msa_ilvr_w = struct { | |
| 12636 | const param_str = "V4iV4iV4i"; | |
| 12637 | const target_set = TargetSet.init(.{ | |
| 12638 | .mips = true, | |
| 12639 | }); | |
| 12640 | const attributes = Attributes{ | |
| 12641 | .@"const" = true, | |
| 12642 | }; | |
| 12643 | }; | |
| 12644 | ||
| 12645 | pub const __builtin_msa_insert_b = struct { | |
| 12646 | const param_str = "V16ScV16ScIUii"; | |
| 12647 | const target_set = TargetSet.init(.{ | |
| 12648 | .mips = true, | |
| 12649 | }); | |
| 12650 | const attributes = Attributes{ | |
| 12651 | .@"const" = true, | |
| 12652 | }; | |
| 12653 | }; | |
| 12654 | ||
| 12655 | pub const __builtin_msa_insert_d = struct { | |
| 12656 | const param_str = "V2SLLiV2SLLiIUiLLi"; | |
| 12657 | const target_set = TargetSet.init(.{ | |
| 12658 | .mips = true, | |
| 12659 | }); | |
| 12660 | const attributes = Attributes{ | |
| 12661 | .@"const" = true, | |
| 12662 | }; | |
| 12663 | }; | |
| 12664 | ||
| 12665 | pub const __builtin_msa_insert_h = struct { | |
| 12666 | const param_str = "V8SsV8SsIUii"; | |
| 12667 | const target_set = TargetSet.init(.{ | |
| 12668 | .mips = true, | |
| 12669 | }); | |
| 12670 | const attributes = Attributes{ | |
| 12671 | .@"const" = true, | |
| 12672 | }; | |
| 12673 | }; | |
| 12674 | ||
| 12675 | pub const __builtin_msa_insert_w = struct { | |
| 12676 | const param_str = "V4SiV4SiIUii"; | |
| 12677 | const target_set = TargetSet.init(.{ | |
| 12678 | .mips = true, | |
| 12679 | }); | |
| 12680 | const attributes = Attributes{ | |
| 12681 | .@"const" = true, | |
| 12682 | }; | |
| 12683 | }; | |
| 12684 | ||
| 12685 | pub const __builtin_msa_insve_b = struct { | |
| 12686 | const param_str = "V16ScV16ScIUiV16Sc"; | |
| 12687 | const target_set = TargetSet.init(.{ | |
| 12688 | .mips = true, | |
| 12689 | }); | |
| 12690 | const attributes = Attributes{ | |
| 12691 | .@"const" = true, | |
| 12692 | }; | |
| 12693 | }; | |
| 12694 | ||
| 12695 | pub const __builtin_msa_insve_d = struct { | |
| 12696 | const param_str = "V2SLLiV2SLLiIUiV2SLLi"; | |
| 12697 | const target_set = TargetSet.init(.{ | |
| 12698 | .mips = true, | |
| 12699 | }); | |
| 12700 | const attributes = Attributes{ | |
| 12701 | .@"const" = true, | |
| 12702 | }; | |
| 12703 | }; | |
| 12704 | ||
| 12705 | pub const __builtin_msa_insve_h = struct { | |
| 12706 | const param_str = "V8SsV8SsIUiV8Ss"; | |
| 12707 | const target_set = TargetSet.init(.{ | |
| 12708 | .mips = true, | |
| 12709 | }); | |
| 12710 | const attributes = Attributes{ | |
| 12711 | .@"const" = true, | |
| 12712 | }; | |
| 12713 | }; | |
| 12714 | ||
| 12715 | pub const __builtin_msa_insve_w = struct { | |
| 12716 | const param_str = "V4SiV4SiIUiV4Si"; | |
| 12717 | const target_set = TargetSet.init(.{ | |
| 12718 | .mips = true, | |
| 12719 | }); | |
| 12720 | const attributes = Attributes{ | |
| 12721 | .@"const" = true, | |
| 12722 | }; | |
| 12723 | }; | |
| 12724 | ||
| 12725 | pub const __builtin_msa_ld_b = struct { | |
| 12726 | const param_str = "V16Scv*Ii"; | |
| 12727 | const target_set = TargetSet.init(.{ | |
| 12728 | .mips = true, | |
| 12729 | }); | |
| 12730 | const attributes = Attributes{ | |
| 12731 | .@"const" = true, | |
| 12732 | }; | |
| 12733 | }; | |
| 12734 | ||
| 12735 | pub const __builtin_msa_ld_d = struct { | |
| 12736 | const param_str = "V2SLLiv*Ii"; | |
| 12737 | const target_set = TargetSet.init(.{ | |
| 12738 | .mips = true, | |
| 12739 | }); | |
| 12740 | const attributes = Attributes{ | |
| 12741 | .@"const" = true, | |
| 12742 | }; | |
| 12743 | }; | |
| 12744 | ||
| 12745 | pub const __builtin_msa_ld_h = struct { | |
| 12746 | const param_str = "V8Ssv*Ii"; | |
| 12747 | const target_set = TargetSet.init(.{ | |
| 12748 | .mips = true, | |
| 12749 | }); | |
| 12750 | const attributes = Attributes{ | |
| 12751 | .@"const" = true, | |
| 12752 | }; | |
| 12753 | }; | |
| 12754 | ||
| 12755 | pub const __builtin_msa_ld_w = struct { | |
| 12756 | const param_str = "V4Siv*Ii"; | |
| 12757 | const target_set = TargetSet.init(.{ | |
| 12758 | .mips = true, | |
| 12759 | }); | |
| 12760 | const attributes = Attributes{ | |
| 12761 | .@"const" = true, | |
| 12762 | }; | |
| 12763 | }; | |
| 12764 | ||
| 12765 | pub const __builtin_msa_ldi_b = struct { | |
| 12766 | const param_str = "V16cIi"; | |
| 12767 | const target_set = TargetSet.init(.{ | |
| 12768 | .mips = true, | |
| 12769 | }); | |
| 12770 | const attributes = Attributes{ | |
| 12771 | .@"const" = true, | |
| 12772 | }; | |
| 12773 | }; | |
| 12774 | ||
| 12775 | pub const __builtin_msa_ldi_d = struct { | |
| 12776 | const param_str = "V2LLiIi"; | |
| 12777 | const target_set = TargetSet.init(.{ | |
| 12778 | .mips = true, | |
| 12779 | }); | |
| 12780 | const attributes = Attributes{ | |
| 12781 | .@"const" = true, | |
| 12782 | }; | |
| 12783 | }; | |
| 12784 | ||
| 12785 | pub const __builtin_msa_ldi_h = struct { | |
| 12786 | const param_str = "V8sIi"; | |
| 12787 | const target_set = TargetSet.init(.{ | |
| 12788 | .mips = true, | |
| 12789 | }); | |
| 12790 | const attributes = Attributes{ | |
| 12791 | .@"const" = true, | |
| 12792 | }; | |
| 12793 | }; | |
| 12794 | ||
| 12795 | pub const __builtin_msa_ldi_w = struct { | |
| 12796 | const param_str = "V4iIi"; | |
| 12797 | const target_set = TargetSet.init(.{ | |
| 12798 | .mips = true, | |
| 12799 | }); | |
| 12800 | const attributes = Attributes{ | |
| 12801 | .@"const" = true, | |
| 12802 | }; | |
| 12803 | }; | |
| 12804 | ||
| 12805 | pub const __builtin_msa_ldr_d = struct { | |
| 12806 | const param_str = "V2SLLiv*Ii"; | |
| 12807 | const target_set = TargetSet.init(.{ | |
| 12808 | .mips = true, | |
| 12809 | }); | |
| 12810 | const attributes = Attributes{ | |
| 12811 | .@"const" = true, | |
| 12812 | }; | |
| 12813 | }; | |
| 12814 | ||
| 12815 | pub const __builtin_msa_ldr_w = struct { | |
| 12816 | const param_str = "V4Siv*Ii"; | |
| 12817 | const target_set = TargetSet.init(.{ | |
| 12818 | .mips = true, | |
| 12819 | }); | |
| 12820 | const attributes = Attributes{ | |
| 12821 | .@"const" = true, | |
| 12822 | }; | |
| 12823 | }; | |
| 12824 | ||
| 12825 | pub const __builtin_msa_madd_q_h = struct { | |
| 12826 | const param_str = "V8SsV8SsV8SsV8Ss"; | |
| 12827 | const target_set = TargetSet.init(.{ | |
| 12828 | .mips = true, | |
| 12829 | }); | |
| 12830 | const attributes = Attributes{ | |
| 12831 | .@"const" = true, | |
| 12832 | }; | |
| 12833 | }; | |
| 12834 | ||
| 12835 | pub const __builtin_msa_madd_q_w = struct { | |
| 12836 | const param_str = "V4SiV4SiV4SiV4Si"; | |
| 12837 | const target_set = TargetSet.init(.{ | |
| 12838 | .mips = true, | |
| 12839 | }); | |
| 12840 | const attributes = Attributes{ | |
| 12841 | .@"const" = true, | |
| 12842 | }; | |
| 12843 | }; | |
| 12844 | ||
| 12845 | pub const __builtin_msa_maddr_q_h = struct { | |
| 12846 | const param_str = "V8SsV8SsV8SsV8Ss"; | |
| 12847 | const target_set = TargetSet.init(.{ | |
| 12848 | .mips = true, | |
| 12849 | }); | |
| 12850 | const attributes = Attributes{ | |
| 12851 | .@"const" = true, | |
| 12852 | }; | |
| 12853 | }; | |
| 12854 | ||
| 12855 | pub const __builtin_msa_maddr_q_w = struct { | |
| 12856 | const param_str = "V4SiV4SiV4SiV4Si"; | |
| 12857 | const target_set = TargetSet.init(.{ | |
| 12858 | .mips = true, | |
| 12859 | }); | |
| 12860 | const attributes = Attributes{ | |
| 12861 | .@"const" = true, | |
| 12862 | }; | |
| 12863 | }; | |
| 12864 | ||
| 12865 | pub const __builtin_msa_maddv_b = struct { | |
| 12866 | const param_str = "V16ScV16ScV16ScV16Sc"; | |
| 12867 | const target_set = TargetSet.init(.{ | |
| 12868 | .mips = true, | |
| 12869 | }); | |
| 12870 | const attributes = Attributes{ | |
| 12871 | .@"const" = true, | |
| 12872 | }; | |
| 12873 | }; | |
| 12874 | ||
| 12875 | pub const __builtin_msa_maddv_d = struct { | |
| 12876 | const param_str = "V2SLLiV2SLLiV2SLLiV2SLLi"; | |
| 12877 | const target_set = TargetSet.init(.{ | |
| 12878 | .mips = true, | |
| 12879 | }); | |
| 12880 | const attributes = Attributes{ | |
| 12881 | .@"const" = true, | |
| 12882 | }; | |
| 12883 | }; | |
| 12884 | ||
| 12885 | pub const __builtin_msa_maddv_h = struct { | |
| 12886 | const param_str = "V8SsV8SsV8SsV8Ss"; | |
| 12887 | const target_set = TargetSet.init(.{ | |
| 12888 | .mips = true, | |
| 12889 | }); | |
| 12890 | const attributes = Attributes{ | |
| 12891 | .@"const" = true, | |
| 12892 | }; | |
| 12893 | }; | |
| 12894 | ||
| 12895 | pub const __builtin_msa_maddv_w = struct { | |
| 12896 | const param_str = "V4SiV4SiV4SiV4Si"; | |
| 12897 | const target_set = TargetSet.init(.{ | |
| 12898 | .mips = true, | |
| 12899 | }); | |
| 12900 | const attributes = Attributes{ | |
| 12901 | .@"const" = true, | |
| 12902 | }; | |
| 12903 | }; | |
| 12904 | ||
| 12905 | pub const __builtin_msa_max_a_b = struct { | |
| 12906 | const param_str = "V16ScV16ScV16Sc"; | |
| 12907 | const target_set = TargetSet.init(.{ | |
| 12908 | .mips = true, | |
| 12909 | }); | |
| 12910 | const attributes = Attributes{ | |
| 12911 | .@"const" = true, | |
| 12912 | }; | |
| 12913 | }; | |
| 12914 | ||
| 12915 | pub const __builtin_msa_max_a_d = struct { | |
| 12916 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 12917 | const target_set = TargetSet.init(.{ | |
| 12918 | .mips = true, | |
| 12919 | }); | |
| 12920 | const attributes = Attributes{ | |
| 12921 | .@"const" = true, | |
| 12922 | }; | |
| 12923 | }; | |
| 12924 | ||
| 12925 | pub const __builtin_msa_max_a_h = struct { | |
| 12926 | const param_str = "V8SsV8SsV8Ss"; | |
| 12927 | const target_set = TargetSet.init(.{ | |
| 12928 | .mips = true, | |
| 12929 | }); | |
| 12930 | const attributes = Attributes{ | |
| 12931 | .@"const" = true, | |
| 12932 | }; | |
| 12933 | }; | |
| 12934 | ||
| 12935 | pub const __builtin_msa_max_a_w = struct { | |
| 12936 | const param_str = "V4SiV4SiV4Si"; | |
| 12937 | const target_set = TargetSet.init(.{ | |
| 12938 | .mips = true, | |
| 12939 | }); | |
| 12940 | const attributes = Attributes{ | |
| 12941 | .@"const" = true, | |
| 12942 | }; | |
| 12943 | }; | |
| 12944 | ||
| 12945 | pub const __builtin_msa_max_s_b = struct { | |
| 12946 | const param_str = "V16ScV16ScV16Sc"; | |
| 12947 | const target_set = TargetSet.init(.{ | |
| 12948 | .mips = true, | |
| 12949 | }); | |
| 12950 | const attributes = Attributes{ | |
| 12951 | .@"const" = true, | |
| 12952 | }; | |
| 12953 | }; | |
| 12954 | ||
| 12955 | pub const __builtin_msa_max_s_d = struct { | |
| 12956 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 12957 | const target_set = TargetSet.init(.{ | |
| 12958 | .mips = true, | |
| 12959 | }); | |
| 12960 | const attributes = Attributes{ | |
| 12961 | .@"const" = true, | |
| 12962 | }; | |
| 12963 | }; | |
| 12964 | ||
| 12965 | pub const __builtin_msa_max_s_h = struct { | |
| 12966 | const param_str = "V8SsV8SsV8Ss"; | |
| 12967 | const target_set = TargetSet.init(.{ | |
| 12968 | .mips = true, | |
| 12969 | }); | |
| 12970 | const attributes = Attributes{ | |
| 12971 | .@"const" = true, | |
| 12972 | }; | |
| 12973 | }; | |
| 12974 | ||
| 12975 | pub const __builtin_msa_max_s_w = struct { | |
| 12976 | const param_str = "V4SiV4SiV4Si"; | |
| 12977 | const target_set = TargetSet.init(.{ | |
| 12978 | .mips = true, | |
| 12979 | }); | |
| 12980 | const attributes = Attributes{ | |
| 12981 | .@"const" = true, | |
| 12982 | }; | |
| 12983 | }; | |
| 12984 | ||
| 12985 | pub const __builtin_msa_max_u_b = struct { | |
| 12986 | const param_str = "V16UcV16UcV16Uc"; | |
| 12987 | const target_set = TargetSet.init(.{ | |
| 12988 | .mips = true, | |
| 12989 | }); | |
| 12990 | const attributes = Attributes{ | |
| 12991 | .@"const" = true, | |
| 12992 | }; | |
| 12993 | }; | |
| 12994 | ||
| 12995 | pub const __builtin_msa_max_u_d = struct { | |
| 12996 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 12997 | const target_set = TargetSet.init(.{ | |
| 12998 | .mips = true, | |
| 12999 | }); | |
| 13000 | const attributes = Attributes{ | |
| 13001 | .@"const" = true, | |
| 13002 | }; | |
| 13003 | }; | |
| 13004 | ||
| 13005 | pub const __builtin_msa_max_u_h = struct { | |
| 13006 | const param_str = "V8UsV8UsV8Us"; | |
| 13007 | const target_set = TargetSet.init(.{ | |
| 13008 | .mips = true, | |
| 13009 | }); | |
| 13010 | const attributes = Attributes{ | |
| 13011 | .@"const" = true, | |
| 13012 | }; | |
| 13013 | }; | |
| 13014 | ||
| 13015 | pub const __builtin_msa_max_u_w = struct { | |
| 13016 | const param_str = "V4UiV4UiV4Ui"; | |
| 13017 | const target_set = TargetSet.init(.{ | |
| 13018 | .mips = true, | |
| 13019 | }); | |
| 13020 | const attributes = Attributes{ | |
| 13021 | .@"const" = true, | |
| 13022 | }; | |
| 13023 | }; | |
| 13024 | ||
| 13025 | pub const __builtin_msa_maxi_s_b = struct { | |
| 13026 | const param_str = "V16ScV16ScIi"; | |
| 13027 | const target_set = TargetSet.init(.{ | |
| 13028 | .mips = true, | |
| 13029 | }); | |
| 13030 | const attributes = Attributes{ | |
| 13031 | .@"const" = true, | |
| 13032 | }; | |
| 13033 | }; | |
| 13034 | ||
| 13035 | pub const __builtin_msa_maxi_s_d = struct { | |
| 13036 | const param_str = "V2SLLiV2SLLiIi"; | |
| 13037 | const target_set = TargetSet.init(.{ | |
| 13038 | .mips = true, | |
| 13039 | }); | |
| 13040 | const attributes = Attributes{ | |
| 13041 | .@"const" = true, | |
| 13042 | }; | |
| 13043 | }; | |
| 13044 | ||
| 13045 | pub const __builtin_msa_maxi_s_h = struct { | |
| 13046 | const param_str = "V8SsV8SsIi"; | |
| 13047 | const target_set = TargetSet.init(.{ | |
| 13048 | .mips = true, | |
| 13049 | }); | |
| 13050 | const attributes = Attributes{ | |
| 13051 | .@"const" = true, | |
| 13052 | }; | |
| 13053 | }; | |
| 13054 | ||
| 13055 | pub const __builtin_msa_maxi_s_w = struct { | |
| 13056 | const param_str = "V4SiV4SiIi"; | |
| 13057 | const target_set = TargetSet.init(.{ | |
| 13058 | .mips = true, | |
| 13059 | }); | |
| 13060 | const attributes = Attributes{ | |
| 13061 | .@"const" = true, | |
| 13062 | }; | |
| 13063 | }; | |
| 13064 | ||
| 13065 | pub const __builtin_msa_maxi_u_b = struct { | |
| 13066 | const param_str = "V16UcV16UcIi"; | |
| 13067 | const target_set = TargetSet.init(.{ | |
| 13068 | .mips = true, | |
| 13069 | }); | |
| 13070 | const attributes = Attributes{ | |
| 13071 | .@"const" = true, | |
| 13072 | }; | |
| 13073 | }; | |
| 13074 | ||
| 13075 | pub const __builtin_msa_maxi_u_d = struct { | |
| 13076 | const param_str = "V2ULLiV2ULLiIi"; | |
| 13077 | const target_set = TargetSet.init(.{ | |
| 13078 | .mips = true, | |
| 13079 | }); | |
| 13080 | const attributes = Attributes{ | |
| 13081 | .@"const" = true, | |
| 13082 | }; | |
| 13083 | }; | |
| 13084 | ||
| 13085 | pub const __builtin_msa_maxi_u_h = struct { | |
| 13086 | const param_str = "V8UsV8UsIi"; | |
| 13087 | const target_set = TargetSet.init(.{ | |
| 13088 | .mips = true, | |
| 13089 | }); | |
| 13090 | const attributes = Attributes{ | |
| 13091 | .@"const" = true, | |
| 13092 | }; | |
| 13093 | }; | |
| 13094 | ||
| 13095 | pub const __builtin_msa_maxi_u_w = struct { | |
| 13096 | const param_str = "V4UiV4UiIi"; | |
| 13097 | const target_set = TargetSet.init(.{ | |
| 13098 | .mips = true, | |
| 13099 | }); | |
| 13100 | const attributes = Attributes{ | |
| 13101 | .@"const" = true, | |
| 13102 | }; | |
| 13103 | }; | |
| 13104 | ||
| 13105 | pub const __builtin_msa_min_a_b = struct { | |
| 13106 | const param_str = "V16ScV16ScV16Sc"; | |
| 13107 | const target_set = TargetSet.init(.{ | |
| 13108 | .mips = true, | |
| 13109 | }); | |
| 13110 | const attributes = Attributes{ | |
| 13111 | .@"const" = true, | |
| 13112 | }; | |
| 13113 | }; | |
| 13114 | ||
| 13115 | pub const __builtin_msa_min_a_d = struct { | |
| 13116 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 13117 | const target_set = TargetSet.init(.{ | |
| 13118 | .mips = true, | |
| 13119 | }); | |
| 13120 | const attributes = Attributes{ | |
| 13121 | .@"const" = true, | |
| 13122 | }; | |
| 13123 | }; | |
| 13124 | ||
| 13125 | pub const __builtin_msa_min_a_h = struct { | |
| 13126 | const param_str = "V8SsV8SsV8Ss"; | |
| 13127 | const target_set = TargetSet.init(.{ | |
| 13128 | .mips = true, | |
| 13129 | }); | |
| 13130 | const attributes = Attributes{ | |
| 13131 | .@"const" = true, | |
| 13132 | }; | |
| 13133 | }; | |
| 13134 | ||
| 13135 | pub const __builtin_msa_min_a_w = struct { | |
| 13136 | const param_str = "V4SiV4SiV4Si"; | |
| 13137 | const target_set = TargetSet.init(.{ | |
| 13138 | .mips = true, | |
| 13139 | }); | |
| 13140 | const attributes = Attributes{ | |
| 13141 | .@"const" = true, | |
| 13142 | }; | |
| 13143 | }; | |
| 13144 | ||
| 13145 | pub const __builtin_msa_min_s_b = struct { | |
| 13146 | const param_str = "V16ScV16ScV16Sc"; | |
| 13147 | const target_set = TargetSet.init(.{ | |
| 13148 | .mips = true, | |
| 13149 | }); | |
| 13150 | const attributes = Attributes{ | |
| 13151 | .@"const" = true, | |
| 13152 | }; | |
| 13153 | }; | |
| 13154 | ||
| 13155 | pub const __builtin_msa_min_s_d = struct { | |
| 13156 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 13157 | const target_set = TargetSet.init(.{ | |
| 13158 | .mips = true, | |
| 13159 | }); | |
| 13160 | const attributes = Attributes{ | |
| 13161 | .@"const" = true, | |
| 13162 | }; | |
| 13163 | }; | |
| 13164 | ||
| 13165 | pub const __builtin_msa_min_s_h = struct { | |
| 13166 | const param_str = "V8SsV8SsV8Ss"; | |
| 13167 | const target_set = TargetSet.init(.{ | |
| 13168 | .mips = true, | |
| 13169 | }); | |
| 13170 | const attributes = Attributes{ | |
| 13171 | .@"const" = true, | |
| 13172 | }; | |
| 13173 | }; | |
| 13174 | ||
| 13175 | pub const __builtin_msa_min_s_w = struct { | |
| 13176 | const param_str = "V4SiV4SiV4Si"; | |
| 13177 | const target_set = TargetSet.init(.{ | |
| 13178 | .mips = true, | |
| 13179 | }); | |
| 13180 | const attributes = Attributes{ | |
| 13181 | .@"const" = true, | |
| 13182 | }; | |
| 13183 | }; | |
| 13184 | ||
| 13185 | pub const __builtin_msa_min_u_b = struct { | |
| 13186 | const param_str = "V16UcV16UcV16Uc"; | |
| 13187 | const target_set = TargetSet.init(.{ | |
| 13188 | .mips = true, | |
| 13189 | }); | |
| 13190 | const attributes = Attributes{ | |
| 13191 | .@"const" = true, | |
| 13192 | }; | |
| 13193 | }; | |
| 13194 | ||
| 13195 | pub const __builtin_msa_min_u_d = struct { | |
| 13196 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 13197 | const target_set = TargetSet.init(.{ | |
| 13198 | .mips = true, | |
| 13199 | }); | |
| 13200 | const attributes = Attributes{ | |
| 13201 | .@"const" = true, | |
| 13202 | }; | |
| 13203 | }; | |
| 13204 | ||
| 13205 | pub const __builtin_msa_min_u_h = struct { | |
| 13206 | const param_str = "V8UsV8UsV8Us"; | |
| 13207 | const target_set = TargetSet.init(.{ | |
| 13208 | .mips = true, | |
| 13209 | }); | |
| 13210 | const attributes = Attributes{ | |
| 13211 | .@"const" = true, | |
| 13212 | }; | |
| 13213 | }; | |
| 13214 | ||
| 13215 | pub const __builtin_msa_min_u_w = struct { | |
| 13216 | const param_str = "V4UiV4UiV4Ui"; | |
| 13217 | const target_set = TargetSet.init(.{ | |
| 13218 | .mips = true, | |
| 13219 | }); | |
| 13220 | const attributes = Attributes{ | |
| 13221 | .@"const" = true, | |
| 13222 | }; | |
| 13223 | }; | |
| 13224 | ||
| 13225 | pub const __builtin_msa_mini_s_b = struct { | |
| 13226 | const param_str = "V16ScV16ScIi"; | |
| 13227 | const target_set = TargetSet.init(.{ | |
| 13228 | .mips = true, | |
| 13229 | }); | |
| 13230 | const attributes = Attributes{ | |
| 13231 | .@"const" = true, | |
| 13232 | }; | |
| 13233 | }; | |
| 13234 | ||
| 13235 | pub const __builtin_msa_mini_s_d = struct { | |
| 13236 | const param_str = "V2SLLiV2SLLiIi"; | |
| 13237 | const target_set = TargetSet.init(.{ | |
| 13238 | .mips = true, | |
| 13239 | }); | |
| 13240 | const attributes = Attributes{ | |
| 13241 | .@"const" = true, | |
| 13242 | }; | |
| 13243 | }; | |
| 13244 | ||
| 13245 | pub const __builtin_msa_mini_s_h = struct { | |
| 13246 | const param_str = "V8SsV8SsIi"; | |
| 13247 | const target_set = TargetSet.init(.{ | |
| 13248 | .mips = true, | |
| 13249 | }); | |
| 13250 | const attributes = Attributes{ | |
| 13251 | .@"const" = true, | |
| 13252 | }; | |
| 13253 | }; | |
| 13254 | ||
| 13255 | pub const __builtin_msa_mini_s_w = struct { | |
| 13256 | const param_str = "V4SiV4SiIi"; | |
| 13257 | const target_set = TargetSet.init(.{ | |
| 13258 | .mips = true, | |
| 13259 | }); | |
| 13260 | const attributes = Attributes{ | |
| 13261 | .@"const" = true, | |
| 13262 | }; | |
| 13263 | }; | |
| 13264 | ||
| 13265 | pub const __builtin_msa_mini_u_b = struct { | |
| 13266 | const param_str = "V16UcV16UcIi"; | |
| 13267 | const target_set = TargetSet.init(.{ | |
| 13268 | .mips = true, | |
| 13269 | }); | |
| 13270 | const attributes = Attributes{ | |
| 13271 | .@"const" = true, | |
| 13272 | }; | |
| 13273 | }; | |
| 13274 | ||
| 13275 | pub const __builtin_msa_mini_u_d = struct { | |
| 13276 | const param_str = "V2ULLiV2ULLiIi"; | |
| 13277 | const target_set = TargetSet.init(.{ | |
| 13278 | .mips = true, | |
| 13279 | }); | |
| 13280 | const attributes = Attributes{ | |
| 13281 | .@"const" = true, | |
| 13282 | }; | |
| 13283 | }; | |
| 13284 | ||
| 13285 | pub const __builtin_msa_mini_u_h = struct { | |
| 13286 | const param_str = "V8UsV8UsIi"; | |
| 13287 | const target_set = TargetSet.init(.{ | |
| 13288 | .mips = true, | |
| 13289 | }); | |
| 13290 | const attributes = Attributes{ | |
| 13291 | .@"const" = true, | |
| 13292 | }; | |
| 13293 | }; | |
| 13294 | ||
| 13295 | pub const __builtin_msa_mini_u_w = struct { | |
| 13296 | const param_str = "V4UiV4UiIi"; | |
| 13297 | const target_set = TargetSet.init(.{ | |
| 13298 | .mips = true, | |
| 13299 | }); | |
| 13300 | const attributes = Attributes{ | |
| 13301 | .@"const" = true, | |
| 13302 | }; | |
| 13303 | }; | |
| 13304 | ||
| 13305 | pub const __builtin_msa_mod_s_b = struct { | |
| 13306 | const param_str = "V16ScV16ScV16Sc"; | |
| 13307 | const target_set = TargetSet.init(.{ | |
| 13308 | .mips = true, | |
| 13309 | }); | |
| 13310 | const attributes = Attributes{ | |
| 13311 | .@"const" = true, | |
| 13312 | }; | |
| 13313 | }; | |
| 13314 | ||
| 13315 | pub const __builtin_msa_mod_s_d = struct { | |
| 13316 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 13317 | const target_set = TargetSet.init(.{ | |
| 13318 | .mips = true, | |
| 13319 | }); | |
| 13320 | const attributes = Attributes{ | |
| 13321 | .@"const" = true, | |
| 13322 | }; | |
| 13323 | }; | |
| 13324 | ||
| 13325 | pub const __builtin_msa_mod_s_h = struct { | |
| 13326 | const param_str = "V8SsV8SsV8Ss"; | |
| 13327 | const target_set = TargetSet.init(.{ | |
| 13328 | .mips = true, | |
| 13329 | }); | |
| 13330 | const attributes = Attributes{ | |
| 13331 | .@"const" = true, | |
| 13332 | }; | |
| 13333 | }; | |
| 13334 | ||
| 13335 | pub const __builtin_msa_mod_s_w = struct { | |
| 13336 | const param_str = "V4SiV4SiV4Si"; | |
| 13337 | const target_set = TargetSet.init(.{ | |
| 13338 | .mips = true, | |
| 13339 | }); | |
| 13340 | const attributes = Attributes{ | |
| 13341 | .@"const" = true, | |
| 13342 | }; | |
| 13343 | }; | |
| 13344 | ||
| 13345 | pub const __builtin_msa_mod_u_b = struct { | |
| 13346 | const param_str = "V16UcV16UcV16Uc"; | |
| 13347 | const target_set = TargetSet.init(.{ | |
| 13348 | .mips = true, | |
| 13349 | }); | |
| 13350 | const attributes = Attributes{ | |
| 13351 | .@"const" = true, | |
| 13352 | }; | |
| 13353 | }; | |
| 13354 | ||
| 13355 | pub const __builtin_msa_mod_u_d = struct { | |
| 13356 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 13357 | const target_set = TargetSet.init(.{ | |
| 13358 | .mips = true, | |
| 13359 | }); | |
| 13360 | const attributes = Attributes{ | |
| 13361 | .@"const" = true, | |
| 13362 | }; | |
| 13363 | }; | |
| 13364 | ||
| 13365 | pub const __builtin_msa_mod_u_h = struct { | |
| 13366 | const param_str = "V8UsV8UsV8Us"; | |
| 13367 | const target_set = TargetSet.init(.{ | |
| 13368 | .mips = true, | |
| 13369 | }); | |
| 13370 | const attributes = Attributes{ | |
| 13371 | .@"const" = true, | |
| 13372 | }; | |
| 13373 | }; | |
| 13374 | ||
| 13375 | pub const __builtin_msa_mod_u_w = struct { | |
| 13376 | const param_str = "V4UiV4UiV4Ui"; | |
| 13377 | const target_set = TargetSet.init(.{ | |
| 13378 | .mips = true, | |
| 13379 | }); | |
| 13380 | const attributes = Attributes{ | |
| 13381 | .@"const" = true, | |
| 13382 | }; | |
| 13383 | }; | |
| 13384 | ||
| 13385 | pub const __builtin_msa_move_v = struct { | |
| 13386 | const param_str = "V16ScV16Sc"; | |
| 13387 | const target_set = TargetSet.init(.{ | |
| 13388 | .mips = true, | |
| 13389 | }); | |
| 13390 | const attributes = Attributes{ | |
| 13391 | .@"const" = true, | |
| 13392 | }; | |
| 13393 | }; | |
| 13394 | ||
| 13395 | pub const __builtin_msa_msub_q_h = struct { | |
| 13396 | const param_str = "V8SsV8SsV8SsV8Ss"; | |
| 13397 | const target_set = TargetSet.init(.{ | |
| 13398 | .mips = true, | |
| 13399 | }); | |
| 13400 | const attributes = Attributes{ | |
| 13401 | .@"const" = true, | |
| 13402 | }; | |
| 13403 | }; | |
| 13404 | ||
| 13405 | pub const __builtin_msa_msub_q_w = struct { | |
| 13406 | const param_str = "V4SiV4SiV4SiV4Si"; | |
| 13407 | const target_set = TargetSet.init(.{ | |
| 13408 | .mips = true, | |
| 13409 | }); | |
| 13410 | const attributes = Attributes{ | |
| 13411 | .@"const" = true, | |
| 13412 | }; | |
| 13413 | }; | |
| 13414 | ||
| 13415 | pub const __builtin_msa_msubr_q_h = struct { | |
| 13416 | const param_str = "V8SsV8SsV8SsV8Ss"; | |
| 13417 | const target_set = TargetSet.init(.{ | |
| 13418 | .mips = true, | |
| 13419 | }); | |
| 13420 | const attributes = Attributes{ | |
| 13421 | .@"const" = true, | |
| 13422 | }; | |
| 13423 | }; | |
| 13424 | ||
| 13425 | pub const __builtin_msa_msubr_q_w = struct { | |
| 13426 | const param_str = "V4SiV4SiV4SiV4Si"; | |
| 13427 | const target_set = TargetSet.init(.{ | |
| 13428 | .mips = true, | |
| 13429 | }); | |
| 13430 | const attributes = Attributes{ | |
| 13431 | .@"const" = true, | |
| 13432 | }; | |
| 13433 | }; | |
| 13434 | ||
| 13435 | pub const __builtin_msa_msubv_b = struct { | |
| 13436 | const param_str = "V16ScV16ScV16ScV16Sc"; | |
| 13437 | const target_set = TargetSet.init(.{ | |
| 13438 | .mips = true, | |
| 13439 | }); | |
| 13440 | const attributes = Attributes{ | |
| 13441 | .@"const" = true, | |
| 13442 | }; | |
| 13443 | }; | |
| 13444 | ||
| 13445 | pub const __builtin_msa_msubv_d = struct { | |
| 13446 | const param_str = "V2SLLiV2SLLiV2SLLiV2SLLi"; | |
| 13447 | const target_set = TargetSet.init(.{ | |
| 13448 | .mips = true, | |
| 13449 | }); | |
| 13450 | const attributes = Attributes{ | |
| 13451 | .@"const" = true, | |
| 13452 | }; | |
| 13453 | }; | |
| 13454 | ||
| 13455 | pub const __builtin_msa_msubv_h = struct { | |
| 13456 | const param_str = "V8SsV8SsV8SsV8Ss"; | |
| 13457 | const target_set = TargetSet.init(.{ | |
| 13458 | .mips = true, | |
| 13459 | }); | |
| 13460 | const attributes = Attributes{ | |
| 13461 | .@"const" = true, | |
| 13462 | }; | |
| 13463 | }; | |
| 13464 | ||
| 13465 | pub const __builtin_msa_msubv_w = struct { | |
| 13466 | const param_str = "V4SiV4SiV4SiV4Si"; | |
| 13467 | const target_set = TargetSet.init(.{ | |
| 13468 | .mips = true, | |
| 13469 | }); | |
| 13470 | const attributes = Attributes{ | |
| 13471 | .@"const" = true, | |
| 13472 | }; | |
| 13473 | }; | |
| 13474 | ||
| 13475 | pub const __builtin_msa_mul_q_h = struct { | |
| 13476 | const param_str = "V8SsV8SsV8Ss"; | |
| 13477 | const target_set = TargetSet.init(.{ | |
| 13478 | .mips = true, | |
| 13479 | }); | |
| 13480 | const attributes = Attributes{ | |
| 13481 | .@"const" = true, | |
| 13482 | }; | |
| 13483 | }; | |
| 13484 | ||
| 13485 | pub const __builtin_msa_mul_q_w = struct { | |
| 13486 | const param_str = "V4SiV4SiV4Si"; | |
| 13487 | const target_set = TargetSet.init(.{ | |
| 13488 | .mips = true, | |
| 13489 | }); | |
| 13490 | const attributes = Attributes{ | |
| 13491 | .@"const" = true, | |
| 13492 | }; | |
| 13493 | }; | |
| 13494 | ||
| 13495 | pub const __builtin_msa_mulr_q_h = struct { | |
| 13496 | const param_str = "V8SsV8SsV8Ss"; | |
| 13497 | const target_set = TargetSet.init(.{ | |
| 13498 | .mips = true, | |
| 13499 | }); | |
| 13500 | const attributes = Attributes{ | |
| 13501 | .@"const" = true, | |
| 13502 | }; | |
| 13503 | }; | |
| 13504 | ||
| 13505 | pub const __builtin_msa_mulr_q_w = struct { | |
| 13506 | const param_str = "V4SiV4SiV4Si"; | |
| 13507 | const target_set = TargetSet.init(.{ | |
| 13508 | .mips = true, | |
| 13509 | }); | |
| 13510 | const attributes = Attributes{ | |
| 13511 | .@"const" = true, | |
| 13512 | }; | |
| 13513 | }; | |
| 13514 | ||
| 13515 | pub const __builtin_msa_mulv_b = struct { | |
| 13516 | const param_str = "V16ScV16ScV16Sc"; | |
| 13517 | const target_set = TargetSet.init(.{ | |
| 13518 | .mips = true, | |
| 13519 | }); | |
| 13520 | const attributes = Attributes{ | |
| 13521 | .@"const" = true, | |
| 13522 | }; | |
| 13523 | }; | |
| 13524 | ||
| 13525 | pub const __builtin_msa_mulv_d = struct { | |
| 13526 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 13527 | const target_set = TargetSet.init(.{ | |
| 13528 | .mips = true, | |
| 13529 | }); | |
| 13530 | const attributes = Attributes{ | |
| 13531 | .@"const" = true, | |
| 13532 | }; | |
| 13533 | }; | |
| 13534 | ||
| 13535 | pub const __builtin_msa_mulv_h = struct { | |
| 13536 | const param_str = "V8SsV8SsV8Ss"; | |
| 13537 | const target_set = TargetSet.init(.{ | |
| 13538 | .mips = true, | |
| 13539 | }); | |
| 13540 | const attributes = Attributes{ | |
| 13541 | .@"const" = true, | |
| 13542 | }; | |
| 13543 | }; | |
| 13544 | ||
| 13545 | pub const __builtin_msa_mulv_w = struct { | |
| 13546 | const param_str = "V4SiV4SiV4Si"; | |
| 13547 | const target_set = TargetSet.init(.{ | |
| 13548 | .mips = true, | |
| 13549 | }); | |
| 13550 | const attributes = Attributes{ | |
| 13551 | .@"const" = true, | |
| 13552 | }; | |
| 13553 | }; | |
| 13554 | ||
| 13555 | pub const __builtin_msa_nloc_b = struct { | |
| 13556 | const param_str = "V16ScV16Sc"; | |
| 13557 | const target_set = TargetSet.init(.{ | |
| 13558 | .mips = true, | |
| 13559 | }); | |
| 13560 | const attributes = Attributes{ | |
| 13561 | .@"const" = true, | |
| 13562 | }; | |
| 13563 | }; | |
| 13564 | ||
| 13565 | pub const __builtin_msa_nloc_d = struct { | |
| 13566 | const param_str = "V2SLLiV2SLLi"; | |
| 13567 | const target_set = TargetSet.init(.{ | |
| 13568 | .mips = true, | |
| 13569 | }); | |
| 13570 | const attributes = Attributes{ | |
| 13571 | .@"const" = true, | |
| 13572 | }; | |
| 13573 | }; | |
| 13574 | ||
| 13575 | pub const __builtin_msa_nloc_h = struct { | |
| 13576 | const param_str = "V8SsV8Ss"; | |
| 13577 | const target_set = TargetSet.init(.{ | |
| 13578 | .mips = true, | |
| 13579 | }); | |
| 13580 | const attributes = Attributes{ | |
| 13581 | .@"const" = true, | |
| 13582 | }; | |
| 13583 | }; | |
| 13584 | ||
| 13585 | pub const __builtin_msa_nloc_w = struct { | |
| 13586 | const param_str = "V4SiV4Si"; | |
| 13587 | const target_set = TargetSet.init(.{ | |
| 13588 | .mips = true, | |
| 13589 | }); | |
| 13590 | const attributes = Attributes{ | |
| 13591 | .@"const" = true, | |
| 13592 | }; | |
| 13593 | }; | |
| 13594 | ||
| 13595 | pub const __builtin_msa_nlzc_b = struct { | |
| 13596 | const param_str = "V16ScV16Sc"; | |
| 13597 | const target_set = TargetSet.init(.{ | |
| 13598 | .mips = true, | |
| 13599 | }); | |
| 13600 | const attributes = Attributes{ | |
| 13601 | .@"const" = true, | |
| 13602 | }; | |
| 13603 | }; | |
| 13604 | ||
| 13605 | pub const __builtin_msa_nlzc_d = struct { | |
| 13606 | const param_str = "V2SLLiV2SLLi"; | |
| 13607 | const target_set = TargetSet.init(.{ | |
| 13608 | .mips = true, | |
| 13609 | }); | |
| 13610 | const attributes = Attributes{ | |
| 13611 | .@"const" = true, | |
| 13612 | }; | |
| 13613 | }; | |
| 13614 | ||
| 13615 | pub const __builtin_msa_nlzc_h = struct { | |
| 13616 | const param_str = "V8SsV8Ss"; | |
| 13617 | const target_set = TargetSet.init(.{ | |
| 13618 | .mips = true, | |
| 13619 | }); | |
| 13620 | const attributes = Attributes{ | |
| 13621 | .@"const" = true, | |
| 13622 | }; | |
| 13623 | }; | |
| 13624 | ||
| 13625 | pub const __builtin_msa_nlzc_w = struct { | |
| 13626 | const param_str = "V4SiV4Si"; | |
| 13627 | const target_set = TargetSet.init(.{ | |
| 13628 | .mips = true, | |
| 13629 | }); | |
| 13630 | const attributes = Attributes{ | |
| 13631 | .@"const" = true, | |
| 13632 | }; | |
| 13633 | }; | |
| 13634 | ||
| 13635 | pub const __builtin_msa_nor_v = struct { | |
| 13636 | const param_str = "V16UcV16UcV16Uc"; | |
| 13637 | const target_set = TargetSet.init(.{ | |
| 13638 | .mips = true, | |
| 13639 | }); | |
| 13640 | const attributes = Attributes{ | |
| 13641 | .@"const" = true, | |
| 13642 | }; | |
| 13643 | }; | |
| 13644 | ||
| 13645 | pub const __builtin_msa_nori_b = struct { | |
| 13646 | const param_str = "V16UcV16cIUi"; | |
| 13647 | const target_set = TargetSet.init(.{ | |
| 13648 | .mips = true, | |
| 13649 | }); | |
| 13650 | const attributes = Attributes{ | |
| 13651 | .@"const" = true, | |
| 13652 | }; | |
| 13653 | }; | |
| 13654 | ||
| 13655 | pub const __builtin_msa_or_v = struct { | |
| 13656 | const param_str = "V16UcV16UcV16Uc"; | |
| 13657 | const target_set = TargetSet.init(.{ | |
| 13658 | .mips = true, | |
| 13659 | }); | |
| 13660 | const attributes = Attributes{ | |
| 13661 | .@"const" = true, | |
| 13662 | }; | |
| 13663 | }; | |
| 13664 | ||
| 13665 | pub const __builtin_msa_ori_b = struct { | |
| 13666 | const param_str = "V16UcV16UcIUi"; | |
| 13667 | const target_set = TargetSet.init(.{ | |
| 13668 | .mips = true, | |
| 13669 | }); | |
| 13670 | const attributes = Attributes{ | |
| 13671 | .@"const" = true, | |
| 13672 | }; | |
| 13673 | }; | |
| 13674 | ||
| 13675 | pub const __builtin_msa_pckev_b = struct { | |
| 13676 | const param_str = "V16cV16cV16c"; | |
| 13677 | const target_set = TargetSet.init(.{ | |
| 13678 | .mips = true, | |
| 13679 | }); | |
| 13680 | const attributes = Attributes{ | |
| 13681 | .@"const" = true, | |
| 13682 | }; | |
| 13683 | }; | |
| 13684 | ||
| 13685 | pub const __builtin_msa_pckev_d = struct { | |
| 13686 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 13687 | const target_set = TargetSet.init(.{ | |
| 13688 | .mips = true, | |
| 13689 | }); | |
| 13690 | const attributes = Attributes{ | |
| 13691 | .@"const" = true, | |
| 13692 | }; | |
| 13693 | }; | |
| 13694 | ||
| 13695 | pub const __builtin_msa_pckev_h = struct { | |
| 13696 | const param_str = "V8sV8sV8s"; | |
| 13697 | const target_set = TargetSet.init(.{ | |
| 13698 | .mips = true, | |
| 13699 | }); | |
| 13700 | const attributes = Attributes{ | |
| 13701 | .@"const" = true, | |
| 13702 | }; | |
| 13703 | }; | |
| 13704 | ||
| 13705 | pub const __builtin_msa_pckev_w = struct { | |
| 13706 | const param_str = "V4iV4iV4i"; | |
| 13707 | const target_set = TargetSet.init(.{ | |
| 13708 | .mips = true, | |
| 13709 | }); | |
| 13710 | const attributes = Attributes{ | |
| 13711 | .@"const" = true, | |
| 13712 | }; | |
| 13713 | }; | |
| 13714 | ||
| 13715 | pub const __builtin_msa_pckod_b = struct { | |
| 13716 | const param_str = "V16cV16cV16c"; | |
| 13717 | const target_set = TargetSet.init(.{ | |
| 13718 | .mips = true, | |
| 13719 | }); | |
| 13720 | const attributes = Attributes{ | |
| 13721 | .@"const" = true, | |
| 13722 | }; | |
| 13723 | }; | |
| 13724 | ||
| 13725 | pub const __builtin_msa_pckod_d = struct { | |
| 13726 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 13727 | const target_set = TargetSet.init(.{ | |
| 13728 | .mips = true, | |
| 13729 | }); | |
| 13730 | const attributes = Attributes{ | |
| 13731 | .@"const" = true, | |
| 13732 | }; | |
| 13733 | }; | |
| 13734 | ||
| 13735 | pub const __builtin_msa_pckod_h = struct { | |
| 13736 | const param_str = "V8sV8sV8s"; | |
| 13737 | const target_set = TargetSet.init(.{ | |
| 13738 | .mips = true, | |
| 13739 | }); | |
| 13740 | const attributes = Attributes{ | |
| 13741 | .@"const" = true, | |
| 13742 | }; | |
| 13743 | }; | |
| 13744 | ||
| 13745 | pub const __builtin_msa_pckod_w = struct { | |
| 13746 | const param_str = "V4iV4iV4i"; | |
| 13747 | const target_set = TargetSet.init(.{ | |
| 13748 | .mips = true, | |
| 13749 | }); | |
| 13750 | const attributes = Attributes{ | |
| 13751 | .@"const" = true, | |
| 13752 | }; | |
| 13753 | }; | |
| 13754 | ||
| 13755 | pub const __builtin_msa_pcnt_b = struct { | |
| 13756 | const param_str = "V16ScV16Sc"; | |
| 13757 | const target_set = TargetSet.init(.{ | |
| 13758 | .mips = true, | |
| 13759 | }); | |
| 13760 | const attributes = Attributes{ | |
| 13761 | .@"const" = true, | |
| 13762 | }; | |
| 13763 | }; | |
| 13764 | ||
| 13765 | pub const __builtin_msa_pcnt_d = struct { | |
| 13766 | const param_str = "V2SLLiV2SLLi"; | |
| 13767 | const target_set = TargetSet.init(.{ | |
| 13768 | .mips = true, | |
| 13769 | }); | |
| 13770 | const attributes = Attributes{ | |
| 13771 | .@"const" = true, | |
| 13772 | }; | |
| 13773 | }; | |
| 13774 | ||
| 13775 | pub const __builtin_msa_pcnt_h = struct { | |
| 13776 | const param_str = "V8SsV8Ss"; | |
| 13777 | const target_set = TargetSet.init(.{ | |
| 13778 | .mips = true, | |
| 13779 | }); | |
| 13780 | const attributes = Attributes{ | |
| 13781 | .@"const" = true, | |
| 13782 | }; | |
| 13783 | }; | |
| 13784 | ||
| 13785 | pub const __builtin_msa_pcnt_w = struct { | |
| 13786 | const param_str = "V4SiV4Si"; | |
| 13787 | const target_set = TargetSet.init(.{ | |
| 13788 | .mips = true, | |
| 13789 | }); | |
| 13790 | const attributes = Attributes{ | |
| 13791 | .@"const" = true, | |
| 13792 | }; | |
| 13793 | }; | |
| 13794 | ||
| 13795 | pub const __builtin_msa_sat_s_b = struct { | |
| 13796 | const param_str = "V16ScV16ScIUi"; | |
| 13797 | const target_set = TargetSet.init(.{ | |
| 13798 | .mips = true, | |
| 13799 | }); | |
| 13800 | const attributes = Attributes{ | |
| 13801 | .@"const" = true, | |
| 13802 | }; | |
| 13803 | }; | |
| 13804 | ||
| 13805 | pub const __builtin_msa_sat_s_d = struct { | |
| 13806 | const param_str = "V2SLLiV2SLLiIUi"; | |
| 13807 | const target_set = TargetSet.init(.{ | |
| 13808 | .mips = true, | |
| 13809 | }); | |
| 13810 | const attributes = Attributes{ | |
| 13811 | .@"const" = true, | |
| 13812 | }; | |
| 13813 | }; | |
| 13814 | ||
| 13815 | pub const __builtin_msa_sat_s_h = struct { | |
| 13816 | const param_str = "V8SsV8SsIUi"; | |
| 13817 | const target_set = TargetSet.init(.{ | |
| 13818 | .mips = true, | |
| 13819 | }); | |
| 13820 | const attributes = Attributes{ | |
| 13821 | .@"const" = true, | |
| 13822 | }; | |
| 13823 | }; | |
| 13824 | ||
| 13825 | pub const __builtin_msa_sat_s_w = struct { | |
| 13826 | const param_str = "V4SiV4SiIUi"; | |
| 13827 | const target_set = TargetSet.init(.{ | |
| 13828 | .mips = true, | |
| 13829 | }); | |
| 13830 | const attributes = Attributes{ | |
| 13831 | .@"const" = true, | |
| 13832 | }; | |
| 13833 | }; | |
| 13834 | ||
| 13835 | pub const __builtin_msa_sat_u_b = struct { | |
| 13836 | const param_str = "V16UcV16UcIUi"; | |
| 13837 | const target_set = TargetSet.init(.{ | |
| 13838 | .mips = true, | |
| 13839 | }); | |
| 13840 | const attributes = Attributes{ | |
| 13841 | .@"const" = true, | |
| 13842 | }; | |
| 13843 | }; | |
| 13844 | ||
| 13845 | pub const __builtin_msa_sat_u_d = struct { | |
| 13846 | const param_str = "V2ULLiV2ULLiIUi"; | |
| 13847 | const target_set = TargetSet.init(.{ | |
| 13848 | .mips = true, | |
| 13849 | }); | |
| 13850 | const attributes = Attributes{ | |
| 13851 | .@"const" = true, | |
| 13852 | }; | |
| 13853 | }; | |
| 13854 | ||
| 13855 | pub const __builtin_msa_sat_u_h = struct { | |
| 13856 | const param_str = "V8UsV8UsIUi"; | |
| 13857 | const target_set = TargetSet.init(.{ | |
| 13858 | .mips = true, | |
| 13859 | }); | |
| 13860 | const attributes = Attributes{ | |
| 13861 | .@"const" = true, | |
| 13862 | }; | |
| 13863 | }; | |
| 13864 | ||
| 13865 | pub const __builtin_msa_sat_u_w = struct { | |
| 13866 | const param_str = "V4UiV4UiIUi"; | |
| 13867 | const target_set = TargetSet.init(.{ | |
| 13868 | .mips = true, | |
| 13869 | }); | |
| 13870 | const attributes = Attributes{ | |
| 13871 | .@"const" = true, | |
| 13872 | }; | |
| 13873 | }; | |
| 13874 | ||
| 13875 | pub const __builtin_msa_shf_b = struct { | |
| 13876 | const param_str = "V16cV16cIUi"; | |
| 13877 | const target_set = TargetSet.init(.{ | |
| 13878 | .mips = true, | |
| 13879 | }); | |
| 13880 | const attributes = Attributes{ | |
| 13881 | .@"const" = true, | |
| 13882 | }; | |
| 13883 | }; | |
| 13884 | ||
| 13885 | pub const __builtin_msa_shf_h = struct { | |
| 13886 | const param_str = "V8sV8sIUi"; | |
| 13887 | const target_set = TargetSet.init(.{ | |
| 13888 | .mips = true, | |
| 13889 | }); | |
| 13890 | const attributes = Attributes{ | |
| 13891 | .@"const" = true, | |
| 13892 | }; | |
| 13893 | }; | |
| 13894 | ||
| 13895 | pub const __builtin_msa_shf_w = struct { | |
| 13896 | const param_str = "V4iV4iIUi"; | |
| 13897 | const target_set = TargetSet.init(.{ | |
| 13898 | .mips = true, | |
| 13899 | }); | |
| 13900 | const attributes = Attributes{ | |
| 13901 | .@"const" = true, | |
| 13902 | }; | |
| 13903 | }; | |
| 13904 | ||
| 13905 | pub const __builtin_msa_sld_b = struct { | |
| 13906 | const param_str = "V16cV16cV16cUi"; | |
| 13907 | const target_set = TargetSet.init(.{ | |
| 13908 | .mips = true, | |
| 13909 | }); | |
| 13910 | const attributes = Attributes{ | |
| 13911 | .@"const" = true, | |
| 13912 | }; | |
| 13913 | }; | |
| 13914 | ||
| 13915 | pub const __builtin_msa_sld_d = struct { | |
| 13916 | const param_str = "V2LLiV2LLiV2LLiUi"; | |
| 13917 | const target_set = TargetSet.init(.{ | |
| 13918 | .mips = true, | |
| 13919 | }); | |
| 13920 | const attributes = Attributes{ | |
| 13921 | .@"const" = true, | |
| 13922 | }; | |
| 13923 | }; | |
| 13924 | ||
| 13925 | pub const __builtin_msa_sld_h = struct { | |
| 13926 | const param_str = "V8sV8sV8sUi"; | |
| 13927 | const target_set = TargetSet.init(.{ | |
| 13928 | .mips = true, | |
| 13929 | }); | |
| 13930 | const attributes = Attributes{ | |
| 13931 | .@"const" = true, | |
| 13932 | }; | |
| 13933 | }; | |
| 13934 | ||
| 13935 | pub const __builtin_msa_sld_w = struct { | |
| 13936 | const param_str = "V4iV4iV4iUi"; | |
| 13937 | const target_set = TargetSet.init(.{ | |
| 13938 | .mips = true, | |
| 13939 | }); | |
| 13940 | const attributes = Attributes{ | |
| 13941 | .@"const" = true, | |
| 13942 | }; | |
| 13943 | }; | |
| 13944 | ||
| 13945 | pub const __builtin_msa_sldi_b = struct { | |
| 13946 | const param_str = "V16cV16cV16cIUi"; | |
| 13947 | const target_set = TargetSet.init(.{ | |
| 13948 | .mips = true, | |
| 13949 | }); | |
| 13950 | const attributes = Attributes{ | |
| 13951 | .@"const" = true, | |
| 13952 | }; | |
| 13953 | }; | |
| 13954 | ||
| 13955 | pub const __builtin_msa_sldi_d = struct { | |
| 13956 | const param_str = "V2LLiV2LLiV2LLiIUi"; | |
| 13957 | const target_set = TargetSet.init(.{ | |
| 13958 | .mips = true, | |
| 13959 | }); | |
| 13960 | const attributes = Attributes{ | |
| 13961 | .@"const" = true, | |
| 13962 | }; | |
| 13963 | }; | |
| 13964 | ||
| 13965 | pub const __builtin_msa_sldi_h = struct { | |
| 13966 | const param_str = "V8sV8sV8sIUi"; | |
| 13967 | const target_set = TargetSet.init(.{ | |
| 13968 | .mips = true, | |
| 13969 | }); | |
| 13970 | const attributes = Attributes{ | |
| 13971 | .@"const" = true, | |
| 13972 | }; | |
| 13973 | }; | |
| 13974 | ||
| 13975 | pub const __builtin_msa_sldi_w = struct { | |
| 13976 | const param_str = "V4iV4iV4iIUi"; | |
| 13977 | const target_set = TargetSet.init(.{ | |
| 13978 | .mips = true, | |
| 13979 | }); | |
| 13980 | const attributes = Attributes{ | |
| 13981 | .@"const" = true, | |
| 13982 | }; | |
| 13983 | }; | |
| 13984 | ||
| 13985 | pub const __builtin_msa_sll_b = struct { | |
| 13986 | const param_str = "V16cV16cV16c"; | |
| 13987 | const target_set = TargetSet.init(.{ | |
| 13988 | .mips = true, | |
| 13989 | }); | |
| 13990 | const attributes = Attributes{ | |
| 13991 | .@"const" = true, | |
| 13992 | }; | |
| 13993 | }; | |
| 13994 | ||
| 13995 | pub const __builtin_msa_sll_d = struct { | |
| 13996 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 13997 | const target_set = TargetSet.init(.{ | |
| 13998 | .mips = true, | |
| 13999 | }); | |
| 14000 | const attributes = Attributes{ | |
| 14001 | .@"const" = true, | |
| 14002 | }; | |
| 14003 | }; | |
| 14004 | ||
| 14005 | pub const __builtin_msa_sll_h = struct { | |
| 14006 | const param_str = "V8sV8sV8s"; | |
| 14007 | const target_set = TargetSet.init(.{ | |
| 14008 | .mips = true, | |
| 14009 | }); | |
| 14010 | const attributes = Attributes{ | |
| 14011 | .@"const" = true, | |
| 14012 | }; | |
| 14013 | }; | |
| 14014 | ||
| 14015 | pub const __builtin_msa_sll_w = struct { | |
| 14016 | const param_str = "V4iV4iV4i"; | |
| 14017 | const target_set = TargetSet.init(.{ | |
| 14018 | .mips = true, | |
| 14019 | }); | |
| 14020 | const attributes = Attributes{ | |
| 14021 | .@"const" = true, | |
| 14022 | }; | |
| 14023 | }; | |
| 14024 | ||
| 14025 | pub const __builtin_msa_slli_b = struct { | |
| 14026 | const param_str = "V16cV16cIUi"; | |
| 14027 | const target_set = TargetSet.init(.{ | |
| 14028 | .mips = true, | |
| 14029 | }); | |
| 14030 | const attributes = Attributes{ | |
| 14031 | .@"const" = true, | |
| 14032 | }; | |
| 14033 | }; | |
| 14034 | ||
| 14035 | pub const __builtin_msa_slli_d = struct { | |
| 14036 | const param_str = "V2LLiV2LLiIUi"; | |
| 14037 | const target_set = TargetSet.init(.{ | |
| 14038 | .mips = true, | |
| 14039 | }); | |
| 14040 | const attributes = Attributes{ | |
| 14041 | .@"const" = true, | |
| 14042 | }; | |
| 14043 | }; | |
| 14044 | ||
| 14045 | pub const __builtin_msa_slli_h = struct { | |
| 14046 | const param_str = "V8sV8sIUi"; | |
| 14047 | const target_set = TargetSet.init(.{ | |
| 14048 | .mips = true, | |
| 14049 | }); | |
| 14050 | const attributes = Attributes{ | |
| 14051 | .@"const" = true, | |
| 14052 | }; | |
| 14053 | }; | |
| 14054 | ||
| 14055 | pub const __builtin_msa_slli_w = struct { | |
| 14056 | const param_str = "V4iV4iIUi"; | |
| 14057 | const target_set = TargetSet.init(.{ | |
| 14058 | .mips = true, | |
| 14059 | }); | |
| 14060 | const attributes = Attributes{ | |
| 14061 | .@"const" = true, | |
| 14062 | }; | |
| 14063 | }; | |
| 14064 | ||
| 14065 | pub const __builtin_msa_splat_b = struct { | |
| 14066 | const param_str = "V16cV16cUi"; | |
| 14067 | const target_set = TargetSet.init(.{ | |
| 14068 | .mips = true, | |
| 14069 | }); | |
| 14070 | const attributes = Attributes{ | |
| 14071 | .@"const" = true, | |
| 14072 | }; | |
| 14073 | }; | |
| 14074 | ||
| 14075 | pub const __builtin_msa_splat_d = struct { | |
| 14076 | const param_str = "V2LLiV2LLiUi"; | |
| 14077 | const target_set = TargetSet.init(.{ | |
| 14078 | .mips = true, | |
| 14079 | }); | |
| 14080 | const attributes = Attributes{ | |
| 14081 | .@"const" = true, | |
| 14082 | }; | |
| 14083 | }; | |
| 14084 | ||
| 14085 | pub const __builtin_msa_splat_h = struct { | |
| 14086 | const param_str = "V8sV8sUi"; | |
| 14087 | const target_set = TargetSet.init(.{ | |
| 14088 | .mips = true, | |
| 14089 | }); | |
| 14090 | const attributes = Attributes{ | |
| 14091 | .@"const" = true, | |
| 14092 | }; | |
| 14093 | }; | |
| 14094 | ||
| 14095 | pub const __builtin_msa_splat_w = struct { | |
| 14096 | const param_str = "V4iV4iUi"; | |
| 14097 | const target_set = TargetSet.init(.{ | |
| 14098 | .mips = true, | |
| 14099 | }); | |
| 14100 | const attributes = Attributes{ | |
| 14101 | .@"const" = true, | |
| 14102 | }; | |
| 14103 | }; | |
| 14104 | ||
| 14105 | pub const __builtin_msa_splati_b = struct { | |
| 14106 | const param_str = "V16cV16cIUi"; | |
| 14107 | const target_set = TargetSet.init(.{ | |
| 14108 | .mips = true, | |
| 14109 | }); | |
| 14110 | const attributes = Attributes{ | |
| 14111 | .@"const" = true, | |
| 14112 | }; | |
| 14113 | }; | |
| 14114 | ||
| 14115 | pub const __builtin_msa_splati_d = struct { | |
| 14116 | const param_str = "V2LLiV2LLiIUi"; | |
| 14117 | const target_set = TargetSet.init(.{ | |
| 14118 | .mips = true, | |
| 14119 | }); | |
| 14120 | const attributes = Attributes{ | |
| 14121 | .@"const" = true, | |
| 14122 | }; | |
| 14123 | }; | |
| 14124 | ||
| 14125 | pub const __builtin_msa_splati_h = struct { | |
| 14126 | const param_str = "V8sV8sIUi"; | |
| 14127 | const target_set = TargetSet.init(.{ | |
| 14128 | .mips = true, | |
| 14129 | }); | |
| 14130 | const attributes = Attributes{ | |
| 14131 | .@"const" = true, | |
| 14132 | }; | |
| 14133 | }; | |
| 14134 | ||
| 14135 | pub const __builtin_msa_splati_w = struct { | |
| 14136 | const param_str = "V4iV4iIUi"; | |
| 14137 | const target_set = TargetSet.init(.{ | |
| 14138 | .mips = true, | |
| 14139 | }); | |
| 14140 | const attributes = Attributes{ | |
| 14141 | .@"const" = true, | |
| 14142 | }; | |
| 14143 | }; | |
| 14144 | ||
| 14145 | pub const __builtin_msa_sra_b = struct { | |
| 14146 | const param_str = "V16cV16cV16c"; | |
| 14147 | const target_set = TargetSet.init(.{ | |
| 14148 | .mips = true, | |
| 14149 | }); | |
| 14150 | const attributes = Attributes{ | |
| 14151 | .@"const" = true, | |
| 14152 | }; | |
| 14153 | }; | |
| 14154 | ||
| 14155 | pub const __builtin_msa_sra_d = struct { | |
| 14156 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 14157 | const target_set = TargetSet.init(.{ | |
| 14158 | .mips = true, | |
| 14159 | }); | |
| 14160 | const attributes = Attributes{ | |
| 14161 | .@"const" = true, | |
| 14162 | }; | |
| 14163 | }; | |
| 14164 | ||
| 14165 | pub const __builtin_msa_sra_h = struct { | |
| 14166 | const param_str = "V8sV8sV8s"; | |
| 14167 | const target_set = TargetSet.init(.{ | |
| 14168 | .mips = true, | |
| 14169 | }); | |
| 14170 | const attributes = Attributes{ | |
| 14171 | .@"const" = true, | |
| 14172 | }; | |
| 14173 | }; | |
| 14174 | ||
| 14175 | pub const __builtin_msa_sra_w = struct { | |
| 14176 | const param_str = "V4iV4iV4i"; | |
| 14177 | const target_set = TargetSet.init(.{ | |
| 14178 | .mips = true, | |
| 14179 | }); | |
| 14180 | const attributes = Attributes{ | |
| 14181 | .@"const" = true, | |
| 14182 | }; | |
| 14183 | }; | |
| 14184 | ||
| 14185 | pub const __builtin_msa_srai_b = struct { | |
| 14186 | const param_str = "V16cV16cIUi"; | |
| 14187 | const target_set = TargetSet.init(.{ | |
| 14188 | .mips = true, | |
| 14189 | }); | |
| 14190 | const attributes = Attributes{ | |
| 14191 | .@"const" = true, | |
| 14192 | }; | |
| 14193 | }; | |
| 14194 | ||
| 14195 | pub const __builtin_msa_srai_d = struct { | |
| 14196 | const param_str = "V2LLiV2LLiIUi"; | |
| 14197 | const target_set = TargetSet.init(.{ | |
| 14198 | .mips = true, | |
| 14199 | }); | |
| 14200 | const attributes = Attributes{ | |
| 14201 | .@"const" = true, | |
| 14202 | }; | |
| 14203 | }; | |
| 14204 | ||
| 14205 | pub const __builtin_msa_srai_h = struct { | |
| 14206 | const param_str = "V8sV8sIUi"; | |
| 14207 | const target_set = TargetSet.init(.{ | |
| 14208 | .mips = true, | |
| 14209 | }); | |
| 14210 | const attributes = Attributes{ | |
| 14211 | .@"const" = true, | |
| 14212 | }; | |
| 14213 | }; | |
| 14214 | ||
| 14215 | pub const __builtin_msa_srai_w = struct { | |
| 14216 | const param_str = "V4iV4iIUi"; | |
| 14217 | const target_set = TargetSet.init(.{ | |
| 14218 | .mips = true, | |
| 14219 | }); | |
| 14220 | const attributes = Attributes{ | |
| 14221 | .@"const" = true, | |
| 14222 | }; | |
| 14223 | }; | |
| 14224 | ||
| 14225 | pub const __builtin_msa_srar_b = struct { | |
| 14226 | const param_str = "V16cV16cV16c"; | |
| 14227 | const target_set = TargetSet.init(.{ | |
| 14228 | .mips = true, | |
| 14229 | }); | |
| 14230 | const attributes = Attributes{ | |
| 14231 | .@"const" = true, | |
| 14232 | }; | |
| 14233 | }; | |
| 14234 | ||
| 14235 | pub const __builtin_msa_srar_d = struct { | |
| 14236 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 14237 | const target_set = TargetSet.init(.{ | |
| 14238 | .mips = true, | |
| 14239 | }); | |
| 14240 | const attributes = Attributes{ | |
| 14241 | .@"const" = true, | |
| 14242 | }; | |
| 14243 | }; | |
| 14244 | ||
| 14245 | pub const __builtin_msa_srar_h = struct { | |
| 14246 | const param_str = "V8sV8sV8s"; | |
| 14247 | const target_set = TargetSet.init(.{ | |
| 14248 | .mips = true, | |
| 14249 | }); | |
| 14250 | const attributes = Attributes{ | |
| 14251 | .@"const" = true, | |
| 14252 | }; | |
| 14253 | }; | |
| 14254 | ||
| 14255 | pub const __builtin_msa_srar_w = struct { | |
| 14256 | const param_str = "V4iV4iV4i"; | |
| 14257 | const target_set = TargetSet.init(.{ | |
| 14258 | .mips = true, | |
| 14259 | }); | |
| 14260 | const attributes = Attributes{ | |
| 14261 | .@"const" = true, | |
| 14262 | }; | |
| 14263 | }; | |
| 14264 | ||
| 14265 | pub const __builtin_msa_srari_b = struct { | |
| 14266 | const param_str = "V16cV16cIUi"; | |
| 14267 | const target_set = TargetSet.init(.{ | |
| 14268 | .mips = true, | |
| 14269 | }); | |
| 14270 | const attributes = Attributes{ | |
| 14271 | .@"const" = true, | |
| 14272 | }; | |
| 14273 | }; | |
| 14274 | ||
| 14275 | pub const __builtin_msa_srari_d = struct { | |
| 14276 | const param_str = "V2LLiV2LLiIUi"; | |
| 14277 | const target_set = TargetSet.init(.{ | |
| 14278 | .mips = true, | |
| 14279 | }); | |
| 14280 | const attributes = Attributes{ | |
| 14281 | .@"const" = true, | |
| 14282 | }; | |
| 14283 | }; | |
| 14284 | ||
| 14285 | pub const __builtin_msa_srari_h = struct { | |
| 14286 | const param_str = "V8sV8sIUi"; | |
| 14287 | const target_set = TargetSet.init(.{ | |
| 14288 | .mips = true, | |
| 14289 | }); | |
| 14290 | const attributes = Attributes{ | |
| 14291 | .@"const" = true, | |
| 14292 | }; | |
| 14293 | }; | |
| 14294 | ||
| 14295 | pub const __builtin_msa_srari_w = struct { | |
| 14296 | const param_str = "V4iV4iIUi"; | |
| 14297 | const target_set = TargetSet.init(.{ | |
| 14298 | .mips = true, | |
| 14299 | }); | |
| 14300 | const attributes = Attributes{ | |
| 14301 | .@"const" = true, | |
| 14302 | }; | |
| 14303 | }; | |
| 14304 | ||
| 14305 | pub const __builtin_msa_srl_b = struct { | |
| 14306 | const param_str = "V16cV16cV16c"; | |
| 14307 | const target_set = TargetSet.init(.{ | |
| 14308 | .mips = true, | |
| 14309 | }); | |
| 14310 | const attributes = Attributes{ | |
| 14311 | .@"const" = true, | |
| 14312 | }; | |
| 14313 | }; | |
| 14314 | ||
| 14315 | pub const __builtin_msa_srl_d = struct { | |
| 14316 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 14317 | const target_set = TargetSet.init(.{ | |
| 14318 | .mips = true, | |
| 14319 | }); | |
| 14320 | const attributes = Attributes{ | |
| 14321 | .@"const" = true, | |
| 14322 | }; | |
| 14323 | }; | |
| 14324 | ||
| 14325 | pub const __builtin_msa_srl_h = struct { | |
| 14326 | const param_str = "V8sV8sV8s"; | |
| 14327 | const target_set = TargetSet.init(.{ | |
| 14328 | .mips = true, | |
| 14329 | }); | |
| 14330 | const attributes = Attributes{ | |
| 14331 | .@"const" = true, | |
| 14332 | }; | |
| 14333 | }; | |
| 14334 | ||
| 14335 | pub const __builtin_msa_srl_w = struct { | |
| 14336 | const param_str = "V4iV4iV4i"; | |
| 14337 | const target_set = TargetSet.init(.{ | |
| 14338 | .mips = true, | |
| 14339 | }); | |
| 14340 | const attributes = Attributes{ | |
| 14341 | .@"const" = true, | |
| 14342 | }; | |
| 14343 | }; | |
| 14344 | ||
| 14345 | pub const __builtin_msa_srli_b = struct { | |
| 14346 | const param_str = "V16cV16cIUi"; | |
| 14347 | const target_set = TargetSet.init(.{ | |
| 14348 | .mips = true, | |
| 14349 | }); | |
| 14350 | const attributes = Attributes{ | |
| 14351 | .@"const" = true, | |
| 14352 | }; | |
| 14353 | }; | |
| 14354 | ||
| 14355 | pub const __builtin_msa_srli_d = struct { | |
| 14356 | const param_str = "V2LLiV2LLiIUi"; | |
| 14357 | const target_set = TargetSet.init(.{ | |
| 14358 | .mips = true, | |
| 14359 | }); | |
| 14360 | const attributes = Attributes{ | |
| 14361 | .@"const" = true, | |
| 14362 | }; | |
| 14363 | }; | |
| 14364 | ||
| 14365 | pub const __builtin_msa_srli_h = struct { | |
| 14366 | const param_str = "V8sV8sIUi"; | |
| 14367 | const target_set = TargetSet.init(.{ | |
| 14368 | .mips = true, | |
| 14369 | }); | |
| 14370 | const attributes = Attributes{ | |
| 14371 | .@"const" = true, | |
| 14372 | }; | |
| 14373 | }; | |
| 14374 | ||
| 14375 | pub const __builtin_msa_srli_w = struct { | |
| 14376 | const param_str = "V4iV4iIUi"; | |
| 14377 | const target_set = TargetSet.init(.{ | |
| 14378 | .mips = true, | |
| 14379 | }); | |
| 14380 | const attributes = Attributes{ | |
| 14381 | .@"const" = true, | |
| 14382 | }; | |
| 14383 | }; | |
| 14384 | ||
| 14385 | pub const __builtin_msa_srlr_b = struct { | |
| 14386 | const param_str = "V16cV16cV16c"; | |
| 14387 | const target_set = TargetSet.init(.{ | |
| 14388 | .mips = true, | |
| 14389 | }); | |
| 14390 | const attributes = Attributes{ | |
| 14391 | .@"const" = true, | |
| 14392 | }; | |
| 14393 | }; | |
| 14394 | ||
| 14395 | pub const __builtin_msa_srlr_d = struct { | |
| 14396 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 14397 | const target_set = TargetSet.init(.{ | |
| 14398 | .mips = true, | |
| 14399 | }); | |
| 14400 | const attributes = Attributes{ | |
| 14401 | .@"const" = true, | |
| 14402 | }; | |
| 14403 | }; | |
| 14404 | ||
| 14405 | pub const __builtin_msa_srlr_h = struct { | |
| 14406 | const param_str = "V8sV8sV8s"; | |
| 14407 | const target_set = TargetSet.init(.{ | |
| 14408 | .mips = true, | |
| 14409 | }); | |
| 14410 | const attributes = Attributes{ | |
| 14411 | .@"const" = true, | |
| 14412 | }; | |
| 14413 | }; | |
| 14414 | ||
| 14415 | pub const __builtin_msa_srlr_w = struct { | |
| 14416 | const param_str = "V4iV4iV4i"; | |
| 14417 | const target_set = TargetSet.init(.{ | |
| 14418 | .mips = true, | |
| 14419 | }); | |
| 14420 | const attributes = Attributes{ | |
| 14421 | .@"const" = true, | |
| 14422 | }; | |
| 14423 | }; | |
| 14424 | ||
| 14425 | pub const __builtin_msa_srlri_b = struct { | |
| 14426 | const param_str = "V16cV16cIUi"; | |
| 14427 | const target_set = TargetSet.init(.{ | |
| 14428 | .mips = true, | |
| 14429 | }); | |
| 14430 | const attributes = Attributes{ | |
| 14431 | .@"const" = true, | |
| 14432 | }; | |
| 14433 | }; | |
| 14434 | ||
| 14435 | pub const __builtin_msa_srlri_d = struct { | |
| 14436 | const param_str = "V2LLiV2LLiIUi"; | |
| 14437 | const target_set = TargetSet.init(.{ | |
| 14438 | .mips = true, | |
| 14439 | }); | |
| 14440 | const attributes = Attributes{ | |
| 14441 | .@"const" = true, | |
| 14442 | }; | |
| 14443 | }; | |
| 14444 | ||
| 14445 | pub const __builtin_msa_srlri_h = struct { | |
| 14446 | const param_str = "V8sV8sIUi"; | |
| 14447 | const target_set = TargetSet.init(.{ | |
| 14448 | .mips = true, | |
| 14449 | }); | |
| 14450 | const attributes = Attributes{ | |
| 14451 | .@"const" = true, | |
| 14452 | }; | |
| 14453 | }; | |
| 14454 | ||
| 14455 | pub const __builtin_msa_srlri_w = struct { | |
| 14456 | const param_str = "V4iV4iIUi"; | |
| 14457 | const target_set = TargetSet.init(.{ | |
| 14458 | .mips = true, | |
| 14459 | }); | |
| 14460 | const attributes = Attributes{ | |
| 14461 | .@"const" = true, | |
| 14462 | }; | |
| 14463 | }; | |
| 14464 | ||
| 14465 | pub const __builtin_msa_st_b = struct { | |
| 14466 | const param_str = "vV16Scv*Ii"; | |
| 14467 | const target_set = TargetSet.init(.{ | |
| 14468 | .mips = true, | |
| 14469 | }); | |
| 14470 | const attributes = Attributes{ | |
| 14471 | .@"const" = true, | |
| 14472 | }; | |
| 14473 | }; | |
| 14474 | ||
| 14475 | pub const __builtin_msa_st_d = struct { | |
| 14476 | const param_str = "vV2SLLiv*Ii"; | |
| 14477 | const target_set = TargetSet.init(.{ | |
| 14478 | .mips = true, | |
| 14479 | }); | |
| 14480 | const attributes = Attributes{ | |
| 14481 | .@"const" = true, | |
| 14482 | }; | |
| 14483 | }; | |
| 14484 | ||
| 14485 | pub const __builtin_msa_st_h = struct { | |
| 14486 | const param_str = "vV8Ssv*Ii"; | |
| 14487 | const target_set = TargetSet.init(.{ | |
| 14488 | .mips = true, | |
| 14489 | }); | |
| 14490 | const attributes = Attributes{ | |
| 14491 | .@"const" = true, | |
| 14492 | }; | |
| 14493 | }; | |
| 14494 | ||
| 14495 | pub const __builtin_msa_st_w = struct { | |
| 14496 | const param_str = "vV4Siv*Ii"; | |
| 14497 | const target_set = TargetSet.init(.{ | |
| 14498 | .mips = true, | |
| 14499 | }); | |
| 14500 | const attributes = Attributes{ | |
| 14501 | .@"const" = true, | |
| 14502 | }; | |
| 14503 | }; | |
| 14504 | ||
| 14505 | pub const __builtin_msa_str_d = struct { | |
| 14506 | const param_str = "vV2SLLiv*Ii"; | |
| 14507 | const target_set = TargetSet.init(.{ | |
| 14508 | .mips = true, | |
| 14509 | }); | |
| 14510 | const attributes = Attributes{ | |
| 14511 | .@"const" = true, | |
| 14512 | }; | |
| 14513 | }; | |
| 14514 | ||
| 14515 | pub const __builtin_msa_str_w = struct { | |
| 14516 | const param_str = "vV4Siv*Ii"; | |
| 14517 | const target_set = TargetSet.init(.{ | |
| 14518 | .mips = true, | |
| 14519 | }); | |
| 14520 | const attributes = Attributes{ | |
| 14521 | .@"const" = true, | |
| 14522 | }; | |
| 14523 | }; | |
| 14524 | ||
| 14525 | pub const __builtin_msa_subs_s_b = struct { | |
| 14526 | const param_str = "V16ScV16ScV16Sc"; | |
| 14527 | const target_set = TargetSet.init(.{ | |
| 14528 | .mips = true, | |
| 14529 | }); | |
| 14530 | const attributes = Attributes{ | |
| 14531 | .@"const" = true, | |
| 14532 | }; | |
| 14533 | }; | |
| 14534 | ||
| 14535 | pub const __builtin_msa_subs_s_d = struct { | |
| 14536 | const param_str = "V2SLLiV2SLLiV2SLLi"; | |
| 14537 | const target_set = TargetSet.init(.{ | |
| 14538 | .mips = true, | |
| 14539 | }); | |
| 14540 | const attributes = Attributes{ | |
| 14541 | .@"const" = true, | |
| 14542 | }; | |
| 14543 | }; | |
| 14544 | ||
| 14545 | pub const __builtin_msa_subs_s_h = struct { | |
| 14546 | const param_str = "V8SsV8SsV8Ss"; | |
| 14547 | const target_set = TargetSet.init(.{ | |
| 14548 | .mips = true, | |
| 14549 | }); | |
| 14550 | const attributes = Attributes{ | |
| 14551 | .@"const" = true, | |
| 14552 | }; | |
| 14553 | }; | |
| 14554 | ||
| 14555 | pub const __builtin_msa_subs_s_w = struct { | |
| 14556 | const param_str = "V4SiV4SiV4Si"; | |
| 14557 | const target_set = TargetSet.init(.{ | |
| 14558 | .mips = true, | |
| 14559 | }); | |
| 14560 | const attributes = Attributes{ | |
| 14561 | .@"const" = true, | |
| 14562 | }; | |
| 14563 | }; | |
| 14564 | ||
| 14565 | pub const __builtin_msa_subs_u_b = struct { | |
| 14566 | const param_str = "V16UcV16UcV16Uc"; | |
| 14567 | const target_set = TargetSet.init(.{ | |
| 14568 | .mips = true, | |
| 14569 | }); | |
| 14570 | const attributes = Attributes{ | |
| 14571 | .@"const" = true, | |
| 14572 | }; | |
| 14573 | }; | |
| 14574 | ||
| 14575 | pub const __builtin_msa_subs_u_d = struct { | |
| 14576 | const param_str = "V2ULLiV2ULLiV2ULLi"; | |
| 14577 | const target_set = TargetSet.init(.{ | |
| 14578 | .mips = true, | |
| 14579 | }); | |
| 14580 | const attributes = Attributes{ | |
| 14581 | .@"const" = true, | |
| 14582 | }; | |
| 14583 | }; | |
| 14584 | ||
| 14585 | pub const __builtin_msa_subs_u_h = struct { | |
| 14586 | const param_str = "V8UsV8UsV8Us"; | |
| 14587 | const target_set = TargetSet.init(.{ | |
| 14588 | .mips = true, | |
| 14589 | }); | |
| 14590 | const attributes = Attributes{ | |
| 14591 | .@"const" = true, | |
| 14592 | }; | |
| 14593 | }; | |
| 14594 | ||
| 14595 | pub const __builtin_msa_subs_u_w = struct { | |
| 14596 | const param_str = "V4UiV4UiV4Ui"; | |
| 14597 | const target_set = TargetSet.init(.{ | |
| 14598 | .mips = true, | |
| 14599 | }); | |
| 14600 | const attributes = Attributes{ | |
| 14601 | .@"const" = true, | |
| 14602 | }; | |
| 14603 | }; | |
| 14604 | ||
| 14605 | pub const __builtin_msa_subsus_u_b = struct { | |
| 14606 | const param_str = "V16UcV16UcV16Sc"; | |
| 14607 | const target_set = TargetSet.init(.{ | |
| 14608 | .mips = true, | |
| 14609 | }); | |
| 14610 | const attributes = Attributes{ | |
| 14611 | .@"const" = true, | |
| 14612 | }; | |
| 14613 | }; | |
| 14614 | ||
| 14615 | pub const __builtin_msa_subsus_u_d = struct { | |
| 14616 | const param_str = "V2ULLiV2ULLiV2SLLi"; | |
| 14617 | const target_set = TargetSet.init(.{ | |
| 14618 | .mips = true, | |
| 14619 | }); | |
| 14620 | const attributes = Attributes{ | |
| 14621 | .@"const" = true, | |
| 14622 | }; | |
| 14623 | }; | |
| 14624 | ||
| 14625 | pub const __builtin_msa_subsus_u_h = struct { | |
| 14626 | const param_str = "V8UsV8UsV8Ss"; | |
| 14627 | const target_set = TargetSet.init(.{ | |
| 14628 | .mips = true, | |
| 14629 | }); | |
| 14630 | const attributes = Attributes{ | |
| 14631 | .@"const" = true, | |
| 14632 | }; | |
| 14633 | }; | |
| 14634 | ||
| 14635 | pub const __builtin_msa_subsus_u_w = struct { | |
| 14636 | const param_str = "V4UiV4UiV4Si"; | |
| 14637 | const target_set = TargetSet.init(.{ | |
| 14638 | .mips = true, | |
| 14639 | }); | |
| 14640 | const attributes = Attributes{ | |
| 14641 | .@"const" = true, | |
| 14642 | }; | |
| 14643 | }; | |
| 14644 | ||
| 14645 | pub const __builtin_msa_subsuu_s_b = struct { | |
| 14646 | const param_str = "V16ScV16UcV16Uc"; | |
| 14647 | const target_set = TargetSet.init(.{ | |
| 14648 | .mips = true, | |
| 14649 | }); | |
| 14650 | const attributes = Attributes{ | |
| 14651 | .@"const" = true, | |
| 14652 | }; | |
| 14653 | }; | |
| 14654 | ||
| 14655 | pub const __builtin_msa_subsuu_s_d = struct { | |
| 14656 | const param_str = "V2SLLiV2ULLiV2ULLi"; | |
| 14657 | const target_set = TargetSet.init(.{ | |
| 14658 | .mips = true, | |
| 14659 | }); | |
| 14660 | const attributes = Attributes{ | |
| 14661 | .@"const" = true, | |
| 14662 | }; | |
| 14663 | }; | |
| 14664 | ||
| 14665 | pub const __builtin_msa_subsuu_s_h = struct { | |
| 14666 | const param_str = "V8SsV8UsV8Us"; | |
| 14667 | const target_set = TargetSet.init(.{ | |
| 14668 | .mips = true, | |
| 14669 | }); | |
| 14670 | const attributes = Attributes{ | |
| 14671 | .@"const" = true, | |
| 14672 | }; | |
| 14673 | }; | |
| 14674 | ||
| 14675 | pub const __builtin_msa_subsuu_s_w = struct { | |
| 14676 | const param_str = "V4SiV4UiV4Ui"; | |
| 14677 | const target_set = TargetSet.init(.{ | |
| 14678 | .mips = true, | |
| 14679 | }); | |
| 14680 | const attributes = Attributes{ | |
| 14681 | .@"const" = true, | |
| 14682 | }; | |
| 14683 | }; | |
| 14684 | ||
| 14685 | pub const __builtin_msa_subv_b = struct { | |
| 14686 | const param_str = "V16cV16cV16c"; | |
| 14687 | const target_set = TargetSet.init(.{ | |
| 14688 | .mips = true, | |
| 14689 | }); | |
| 14690 | const attributes = Attributes{ | |
| 14691 | .@"const" = true, | |
| 14692 | }; | |
| 14693 | }; | |
| 14694 | ||
| 14695 | pub const __builtin_msa_subv_d = struct { | |
| 14696 | const param_str = "V2LLiV2LLiV2LLi"; | |
| 14697 | const target_set = TargetSet.init(.{ | |
| 14698 | .mips = true, | |
| 14699 | }); | |
| 14700 | const attributes = Attributes{ | |
| 14701 | .@"const" = true, | |
| 14702 | }; | |
| 14703 | }; | |
| 14704 | ||
| 14705 | pub const __builtin_msa_subv_h = struct { | |
| 14706 | const param_str = "V8sV8sV8s"; | |
| 14707 | const target_set = TargetSet.init(.{ | |
| 14708 | .mips = true, | |
| 14709 | }); | |
| 14710 | const attributes = Attributes{ | |
| 14711 | .@"const" = true, | |
| 14712 | }; | |
| 14713 | }; | |
| 14714 | ||
| 14715 | pub const __builtin_msa_subv_w = struct { | |
| 14716 | const param_str = "V4iV4iV4i"; | |
| 14717 | const target_set = TargetSet.init(.{ | |
| 14718 | .mips = true, | |
| 14719 | }); | |
| 14720 | const attributes = Attributes{ | |
| 14721 | .@"const" = true, | |
| 14722 | }; | |
| 14723 | }; | |
| 14724 | ||
| 14725 | pub const __builtin_msa_subvi_b = struct { | |
| 14726 | const param_str = "V16cV16cIUi"; | |
| 14727 | const target_set = TargetSet.init(.{ | |
| 14728 | .mips = true, | |
| 14729 | }); | |
| 14730 | const attributes = Attributes{ | |
| 14731 | .@"const" = true, | |
| 14732 | }; | |
| 14733 | }; | |
| 14734 | ||
| 14735 | pub const __builtin_msa_subvi_d = struct { | |
| 14736 | const param_str = "V2LLiV2LLiIUi"; | |
| 14737 | const target_set = TargetSet.init(.{ | |
| 14738 | .mips = true, | |
| 14739 | }); | |
| 14740 | const attributes = Attributes{ | |
| 14741 | .@"const" = true, | |
| 14742 | }; | |
| 14743 | }; | |
| 14744 | ||
| 14745 | pub const __builtin_msa_subvi_h = struct { | |
| 14746 | const param_str = "V8sV8sIUi"; | |
| 14747 | const target_set = TargetSet.init(.{ | |
| 14748 | .mips = true, | |
| 14749 | }); | |
| 14750 | const attributes = Attributes{ | |
| 14751 | .@"const" = true, | |
| 14752 | }; | |
| 14753 | }; | |
| 14754 | ||
| 14755 | pub const __builtin_msa_subvi_w = struct { | |
| 14756 | const param_str = "V4iV4iIUi"; | |
| 14757 | const target_set = TargetSet.init(.{ | |
| 14758 | .mips = true, | |
| 14759 | }); | |
| 14760 | const attributes = Attributes{ | |
| 14761 | .@"const" = true, | |
| 14762 | }; | |
| 14763 | }; | |
| 14764 | ||
| 14765 | pub const __builtin_msa_vshf_b = struct { | |
| 14766 | const param_str = "V16cV16cV16cV16c"; | |
| 14767 | const target_set = TargetSet.init(.{ | |
| 14768 | .mips = true, | |
| 14769 | }); | |
| 14770 | const attributes = Attributes{ | |
| 14771 | .@"const" = true, | |
| 14772 | }; | |
| 14773 | }; | |
| 14774 | ||
| 14775 | pub const __builtin_msa_vshf_d = struct { | |
| 14776 | const param_str = "V2LLiV2LLiV2LLiV2LLi"; | |
| 14777 | const target_set = TargetSet.init(.{ | |
| 14778 | .mips = true, | |
| 14779 | }); | |
| 14780 | const attributes = Attributes{ | |
| 14781 | .@"const" = true, | |
| 14782 | }; | |
| 14783 | }; | |
| 14784 | ||
| 14785 | pub const __builtin_msa_vshf_h = struct { | |
| 14786 | const param_str = "V8sV8sV8sV8s"; | |
| 14787 | const target_set = TargetSet.init(.{ | |
| 14788 | .mips = true, | |
| 14789 | }); | |
| 14790 | const attributes = Attributes{ | |
| 14791 | .@"const" = true, | |
| 14792 | }; | |
| 14793 | }; | |
| 14794 | ||
| 14795 | pub const __builtin_msa_vshf_w = struct { | |
| 14796 | const param_str = "V4iV4iV4iV4i"; | |
| 14797 | const target_set = TargetSet.init(.{ | |
| 14798 | .mips = true, | |
| 14799 | }); | |
| 14800 | const attributes = Attributes{ | |
| 14801 | .@"const" = true, | |
| 14802 | }; | |
| 14803 | }; | |
| 14804 | ||
| 14805 | pub const __builtin_msa_xor_v = struct { | |
| 14806 | const param_str = "V16cV16cV16c"; | |
| 14807 | const target_set = TargetSet.init(.{ | |
| 14808 | .mips = true, | |
| 14809 | }); | |
| 14810 | const attributes = Attributes{ | |
| 14811 | .@"const" = true, | |
| 14812 | }; | |
| 14813 | }; | |
| 14814 | ||
| 14815 | pub const __builtin_msa_xori_b = struct { | |
| 14816 | const param_str = "V16cV16cIUi"; | |
| 14817 | const target_set = TargetSet.init(.{ | |
| 14818 | .mips = true, | |
| 14819 | }); | |
| 14820 | const attributes = Attributes{ | |
| 14821 | .@"const" = true, | |
| 14822 | }; | |
| 14823 | }; | |
| 14824 | ||
| 14825 | pub const __builtin_mul_overflow = struct { | |
| 14826 | const param_str = "b."; | |
| 14827 | const attributes = Attributes{ | |
| 14828 | .custom_typecheck = true, | |
| 14829 | .const_evaluable = true, | |
| 14830 | }; | |
| 14831 | }; | |
| 14832 | ||
| 14833 | pub const __builtin_mulf128_round_to_odd = struct { | |
| 14834 | const param_str = "LLdLLdLLd"; | |
| 14835 | const target_set = TargetSet.init(.{ | |
| 14836 | .ppc = true, | |
| 14837 | }); | |
| 14838 | }; | |
| 14839 | ||
| 14840 | pub const __builtin_nan = struct { | |
| 14841 | const param_str = "dcC*"; | |
| 14842 | const attributes = Attributes{ | |
| 14843 | .pure = true, | |
| 14844 | .lib_function_with_builtin_prefix = true, | |
| 14845 | .const_evaluable = true, | |
| 14846 | }; | |
| 14847 | }; | |
| 14848 | ||
| 14849 | pub const __builtin_nanf = struct { | |
| 14850 | const param_str = "fcC*"; | |
| 14851 | const attributes = Attributes{ | |
| 14852 | .pure = true, | |
| 14853 | .lib_function_with_builtin_prefix = true, | |
| 14854 | .const_evaluable = true, | |
| 14855 | }; | |
| 14856 | }; | |
| 14857 | ||
| 14858 | pub const __builtin_nanf128 = struct { | |
| 14859 | const param_str = "LLdcC*"; | |
| 14860 | const attributes = Attributes{ | |
| 14861 | .pure = true, | |
| 14862 | .lib_function_with_builtin_prefix = true, | |
| 14863 | .const_evaluable = true, | |
| 14864 | }; | |
| 14865 | }; | |
| 14866 | ||
| 14867 | pub const __builtin_nanf16 = struct { | |
| 14868 | const param_str = "xcC*"; | |
| 14869 | const attributes = Attributes{ | |
| 14870 | .pure = true, | |
| 14871 | .lib_function_with_builtin_prefix = true, | |
| 14872 | .const_evaluable = true, | |
| 14873 | }; | |
| 14874 | }; | |
| 14875 | ||
| 14876 | pub const __builtin_nanl = struct { | |
| 14877 | const param_str = "LdcC*"; | |
| 14878 | const attributes = Attributes{ | |
| 14879 | .pure = true, | |
| 14880 | .lib_function_with_builtin_prefix = true, | |
| 14881 | .const_evaluable = true, | |
| 14882 | }; | |
| 14883 | }; | |
| 14884 | ||
| 14885 | pub const __builtin_nans = struct { | |
| 14886 | const param_str = "dcC*"; | |
| 14887 | const attributes = Attributes{ | |
| 14888 | .pure = true, | |
| 14889 | .lib_function_with_builtin_prefix = true, | |
| 14890 | .const_evaluable = true, | |
| 14891 | }; | |
| 14892 | }; | |
| 14893 | ||
| 14894 | pub const __builtin_nansf = struct { | |
| 14895 | const param_str = "fcC*"; | |
| 14896 | const attributes = Attributes{ | |
| 14897 | .pure = true, | |
| 14898 | .lib_function_with_builtin_prefix = true, | |
| 14899 | .const_evaluable = true, | |
| 14900 | }; | |
| 14901 | }; | |
| 14902 | ||
| 14903 | pub const __builtin_nansf128 = struct { | |
| 14904 | const param_str = "LLdcC*"; | |
| 14905 | const attributes = Attributes{ | |
| 14906 | .pure = true, | |
| 14907 | .lib_function_with_builtin_prefix = true, | |
| 14908 | .const_evaluable = true, | |
| 14909 | }; | |
| 14910 | }; | |
| 14911 | ||
| 14912 | pub const __builtin_nansf16 = struct { | |
| 14913 | const param_str = "xcC*"; | |
| 14914 | const attributes = Attributes{ | |
| 14915 | .pure = true, | |
| 14916 | .lib_function_with_builtin_prefix = true, | |
| 14917 | .const_evaluable = true, | |
| 14918 | }; | |
| 14919 | }; | |
| 14920 | ||
| 14921 | pub const __builtin_nansl = struct { | |
| 14922 | const param_str = "LdcC*"; | |
| 14923 | const attributes = Attributes{ | |
| 14924 | .pure = true, | |
| 14925 | .lib_function_with_builtin_prefix = true, | |
| 14926 | .const_evaluable = true, | |
| 14927 | }; | |
| 14928 | }; | |
| 14929 | ||
| 14930 | pub const __builtin_nearbyint = struct { | |
| 14931 | const param_str = "dd"; | |
| 14932 | const attributes = Attributes{ | |
| 14933 | .@"const" = true, | |
| 14934 | .lib_function_with_builtin_prefix = true, | |
| 14935 | }; | |
| 14936 | }; | |
| 14937 | ||
| 14938 | pub const __builtin_nearbyintf = struct { | |
| 14939 | const param_str = "ff"; | |
| 14940 | const attributes = Attributes{ | |
| 14941 | .@"const" = true, | |
| 14942 | .lib_function_with_builtin_prefix = true, | |
| 14943 | }; | |
| 14944 | }; | |
| 14945 | ||
| 14946 | pub const __builtin_nearbyintf128 = struct { | |
| 14947 | const param_str = "LLdLLd"; | |
| 14948 | const attributes = Attributes{ | |
| 14949 | .@"const" = true, | |
| 14950 | .lib_function_with_builtin_prefix = true, | |
| 14951 | }; | |
| 14952 | }; | |
| 14953 | ||
| 14954 | pub const __builtin_nearbyintl = struct { | |
| 14955 | const param_str = "LdLd"; | |
| 14956 | const attributes = Attributes{ | |
| 14957 | .@"const" = true, | |
| 14958 | .lib_function_with_builtin_prefix = true, | |
| 14959 | }; | |
| 14960 | }; | |
| 14961 | ||
| 14962 | pub const __builtin_nextafter = struct { | |
| 14963 | const param_str = "ddd"; | |
| 14964 | const attributes = Attributes{ | |
| 14965 | .lib_function_with_builtin_prefix = true, | |
| 14966 | .const_without_errno_and_fp_exceptions = true, | |
| 14967 | }; | |
| 14968 | }; | |
| 14969 | ||
| 14970 | pub const __builtin_nextafterf = struct { | |
| 14971 | const param_str = "fff"; | |
| 14972 | const attributes = Attributes{ | |
| 14973 | .lib_function_with_builtin_prefix = true, | |
| 14974 | .const_without_errno_and_fp_exceptions = true, | |
| 14975 | }; | |
| 14976 | }; | |
| 14977 | ||
| 14978 | pub const __builtin_nextafterf128 = struct { | |
| 14979 | const param_str = "LLdLLdLLd"; | |
| 14980 | const attributes = Attributes{ | |
| 14981 | .lib_function_with_builtin_prefix = true, | |
| 14982 | .const_without_errno_and_fp_exceptions = true, | |
| 14983 | }; | |
| 14984 | }; | |
| 14985 | ||
| 14986 | pub const __builtin_nextafterl = struct { | |
| 14987 | const param_str = "LdLdLd"; | |
| 14988 | const attributes = Attributes{ | |
| 14989 | .lib_function_with_builtin_prefix = true, | |
| 14990 | .const_without_errno_and_fp_exceptions = true, | |
| 14991 | }; | |
| 14992 | }; | |
| 14993 | ||
| 14994 | pub const __builtin_nexttoward = struct { | |
| 14995 | const param_str = "ddLd"; | |
| 14996 | const attributes = Attributes{ | |
| 14997 | .lib_function_with_builtin_prefix = true, | |
| 14998 | .const_without_errno_and_fp_exceptions = true, | |
| 14999 | }; | |
| 15000 | }; | |
| 15001 | ||
| 15002 | pub const __builtin_nexttowardf = struct { | |
| 15003 | const param_str = "ffLd"; | |
| 15004 | const attributes = Attributes{ | |
| 15005 | .lib_function_with_builtin_prefix = true, | |
| 15006 | .const_without_errno_and_fp_exceptions = true, | |
| 15007 | }; | |
| 15008 | }; | |
| 15009 | ||
| 15010 | pub const __builtin_nexttowardf128 = struct { | |
| 15011 | const param_str = "LLdLLdLLd"; | |
| 15012 | const attributes = Attributes{ | |
| 15013 | .lib_function_with_builtin_prefix = true, | |
| 15014 | .const_without_errno_and_fp_exceptions = true, | |
| 15015 | }; | |
| 15016 | }; | |
| 15017 | ||
| 15018 | pub const __builtin_nexttowardl = struct { | |
| 15019 | const param_str = "LdLdLd"; | |
| 15020 | const attributes = Attributes{ | |
| 15021 | .lib_function_with_builtin_prefix = true, | |
| 15022 | .const_without_errno_and_fp_exceptions = true, | |
| 15023 | }; | |
| 15024 | }; | |
| 15025 | ||
| 15026 | pub const __builtin_nontemporal_load = struct { | |
| 15027 | const param_str = "v."; | |
| 15028 | const attributes = Attributes{ | |
| 15029 | .custom_typecheck = true, | |
| 15030 | }; | |
| 15031 | }; | |
| 15032 | ||
| 15033 | pub const __builtin_nontemporal_store = struct { | |
| 15034 | const param_str = "v."; | |
| 15035 | const attributes = Attributes{ | |
| 15036 | .custom_typecheck = true, | |
| 15037 | }; | |
| 15038 | }; | |
| 15039 | ||
| 15040 | pub const __builtin_objc_memmove_collectable = struct { | |
| 15041 | const param_str = "v*v*vC*z"; | |
| 15042 | const attributes = Attributes{ | |
| 15043 | .lib_function_with_builtin_prefix = true, | |
| 15044 | }; | |
| 15045 | }; | |
| 15046 | ||
| 15047 | pub const __builtin_object_size = struct { | |
| 15048 | const param_str = "zvC*i"; | |
| 15049 | const attributes = Attributes{ | |
| 15050 | .eval_args = false, | |
| 15051 | .const_evaluable = true, | |
| 15052 | }; | |
| 15053 | }; | |
| 15054 | ||
| 15055 | pub const __builtin_operator_delete = struct { | |
| 15056 | const param_str = "vv*"; | |
| 15057 | const attributes = Attributes{ | |
| 15058 | .custom_typecheck = true, | |
| 15059 | .const_evaluable = true, | |
| 15060 | }; | |
| 15061 | }; | |
| 15062 | ||
| 15063 | pub const __builtin_operator_new = struct { | |
| 15064 | const param_str = "v*z"; | |
| 15065 | const attributes = Attributes{ | |
| 15066 | .@"const" = true, | |
| 15067 | .custom_typecheck = true, | |
| 15068 | .const_evaluable = true, | |
| 15069 | }; | |
| 15070 | }; | |
| 15071 | ||
| 15072 | pub const __builtin_os_log_format = struct { | |
| 15073 | const param_str = "v*v*cC*."; | |
| 15074 | const attributes = Attributes{ | |
| 15075 | .custom_typecheck = true, | |
| 15076 | .format_kind = .printf, | |
| 15077 | .format_string_position = 0, | |
| 15078 | }; | |
| 15079 | }; | |
| 15080 | ||
| 15081 | pub const __builtin_os_log_format_buffer_size = struct { | |
| 15082 | const param_str = "zcC*."; | |
| 15083 | const attributes = Attributes{ | |
| 15084 | .custom_typecheck = true, | |
| 15085 | .eval_args = false, | |
| 15086 | .const_evaluable = true, | |
| 15087 | .format_kind = .printf, | |
| 15088 | .format_string_position = 0, | |
| 15089 | }; | |
| 15090 | }; | |
| 15091 | ||
| 15092 | pub const __builtin_pack_longdouble = struct { | |
| 15093 | const param_str = "Lddd"; | |
| 15094 | const target_set = TargetSet.init(.{ | |
| 15095 | .ppc = true, | |
| 15096 | }); | |
| 15097 | }; | |
| 15098 | ||
| 15099 | pub const __builtin_pack_vector_int128 = struct { | |
| 15100 | const param_str = "V1LLLiULLiULLi"; | |
| 15101 | const target_set = TargetSet.init(.{ | |
| 15102 | .ppc = true, | |
| 15103 | }); | |
| 15104 | }; | |
| 15105 | ||
| 15106 | pub const __builtin_parity = struct { | |
| 15107 | const param_str = "iUi"; | |
| 15108 | const attributes = Attributes{ | |
| 15109 | .@"const" = true, | |
| 15110 | .const_evaluable = true, | |
| 15111 | }; | |
| 15112 | }; | |
| 15113 | ||
| 15114 | pub const __builtin_parityl = struct { | |
| 15115 | const param_str = "iULi"; | |
| 15116 | const attributes = Attributes{ | |
| 15117 | .@"const" = true, | |
| 15118 | .const_evaluable = true, | |
| 15119 | }; | |
| 15120 | }; | |
| 15121 | ||
| 15122 | pub const __builtin_parityll = struct { | |
| 15123 | const param_str = "iULLi"; | |
| 15124 | const attributes = Attributes{ | |
| 15125 | .@"const" = true, | |
| 15126 | .const_evaluable = true, | |
| 15127 | }; | |
| 15128 | }; | |
| 15129 | ||
| 15130 | pub const __builtin_pdepd = struct { | |
| 15131 | const param_str = "ULLiULLiULLi"; | |
| 15132 | const target_set = TargetSet.init(.{ | |
| 15133 | .ppc = true, | |
| 15134 | }); | |
| 15135 | }; | |
| 15136 | ||
| 15137 | pub const __builtin_pextd = struct { | |
| 15138 | const param_str = "ULLiULLiULLi"; | |
| 15139 | const target_set = TargetSet.init(.{ | |
| 15140 | .ppc = true, | |
| 15141 | }); | |
| 15142 | }; | |
| 15143 | ||
| 15144 | pub const __builtin_popcount = struct { | |
| 15145 | const param_str = "iUi"; | |
| 15146 | const attributes = Attributes{ | |
| 15147 | .@"const" = true, | |
| 15148 | .const_evaluable = true, | |
| 15149 | }; | |
| 15150 | }; | |
| 15151 | ||
| 15152 | pub const __builtin_popcountl = struct { | |
| 15153 | const param_str = "iULi"; | |
| 15154 | const attributes = Attributes{ | |
| 15155 | .@"const" = true, | |
| 15156 | .const_evaluable = true, | |
| 15157 | }; | |
| 15158 | }; | |
| 15159 | ||
| 15160 | pub const __builtin_popcountll = struct { | |
| 15161 | const param_str = "iULLi"; | |
| 15162 | const attributes = Attributes{ | |
| 15163 | .@"const" = true, | |
| 15164 | .const_evaluable = true, | |
| 15165 | }; | |
| 15166 | }; | |
| 15167 | ||
| 15168 | pub const __builtin_pow = struct { | |
| 15169 | const param_str = "ddd"; | |
| 15170 | const attributes = Attributes{ | |
| 15171 | .lib_function_with_builtin_prefix = true, | |
| 15172 | .const_without_errno_and_fp_exceptions = true, | |
| 15173 | }; | |
| 15174 | }; | |
| 15175 | ||
| 15176 | pub const __builtin_powf = struct { | |
| 15177 | const param_str = "fff"; | |
| 15178 | const attributes = Attributes{ | |
| 15179 | .lib_function_with_builtin_prefix = true, | |
| 15180 | .const_without_errno_and_fp_exceptions = true, | |
| 15181 | }; | |
| 15182 | }; | |
| 15183 | ||
| 15184 | pub const __builtin_powf128 = struct { | |
| 15185 | const param_str = "LLdLLdLLd"; | |
| 15186 | const attributes = Attributes{ | |
| 15187 | .lib_function_with_builtin_prefix = true, | |
| 15188 | .const_without_errno_and_fp_exceptions = true, | |
| 15189 | }; | |
| 15190 | }; | |
| 15191 | ||
| 15192 | pub const __builtin_powf16 = struct { | |
| 15193 | const param_str = "hhh"; | |
| 15194 | const attributes = Attributes{ | |
| 15195 | .lib_function_with_builtin_prefix = true, | |
| 15196 | .const_without_errno_and_fp_exceptions = true, | |
| 15197 | }; | |
| 15198 | }; | |
| 15199 | ||
| 15200 | pub const __builtin_powi = struct { | |
| 15201 | const param_str = "ddi"; | |
| 15202 | const attributes = Attributes{ | |
| 15203 | .@"const" = true, | |
| 15204 | .lib_function_with_builtin_prefix = true, | |
| 15205 | }; | |
| 15206 | }; | |
| 15207 | ||
| 15208 | pub const __builtin_powif = struct { | |
| 15209 | const param_str = "ffi"; | |
| 15210 | const attributes = Attributes{ | |
| 15211 | .@"const" = true, | |
| 15212 | .lib_function_with_builtin_prefix = true, | |
| 15213 | }; | |
| 15214 | }; | |
| 15215 | ||
| 15216 | pub const __builtin_powil = struct { | |
| 15217 | const param_str = "LdLdi"; | |
| 15218 | const attributes = Attributes{ | |
| 15219 | .@"const" = true, | |
| 15220 | .lib_function_with_builtin_prefix = true, | |
| 15221 | }; | |
| 15222 | }; | |
| 15223 | ||
| 15224 | pub const __builtin_powl = struct { | |
| 15225 | const param_str = "LdLdLd"; | |
| 15226 | const attributes = Attributes{ | |
| 15227 | .lib_function_with_builtin_prefix = true, | |
| 15228 | .const_without_errno_and_fp_exceptions = true, | |
| 15229 | }; | |
| 15230 | }; | |
| 15231 | ||
| 15232 | pub const __builtin_ppc_addex = struct { | |
| 15233 | const param_str = "LLiLLiLLiCIi"; | |
| 15234 | const target_set = TargetSet.init(.{ | |
| 15235 | .ppc = true, | |
| 15236 | }); | |
| 15237 | }; | |
| 15238 | ||
| 15239 | pub const __builtin_ppc_alignx = struct { | |
| 15240 | const param_str = "vIivC*"; | |
| 15241 | const target_set = TargetSet.init(.{ | |
| 15242 | .ppc = true, | |
| 15243 | }); | |
| 15244 | const attributes = Attributes{ | |
| 15245 | .@"const" = true, | |
| 15246 | }; | |
| 15247 | }; | |
| 15248 | ||
| 15249 | pub const __builtin_ppc_bcdadd = struct { | |
| 15250 | const param_str = "V16UcV16UcV16UcIi"; | |
| 15251 | const target_set = TargetSet.init(.{ | |
| 15252 | .ppc = true, | |
| 15253 | }); | |
| 15254 | }; | |
| 15255 | ||
| 15256 | pub const __builtin_ppc_bcdadd_p = struct { | |
| 15257 | const param_str = "iiV16UcV16Uc"; | |
| 15258 | const target_set = TargetSet.init(.{ | |
| 15259 | .ppc = true, | |
| 15260 | }); | |
| 15261 | }; | |
| 15262 | ||
| 15263 | pub const __builtin_ppc_bcdsub = struct { | |
| 15264 | const param_str = "V16UcV16UcV16UcIi"; | |
| 15265 | const target_set = TargetSet.init(.{ | |
| 15266 | .ppc = true, | |
| 15267 | }); | |
| 15268 | }; | |
| 15269 | ||
| 15270 | pub const __builtin_ppc_bcdsub_p = struct { | |
| 15271 | const param_str = "iiV16UcV16Uc"; | |
| 15272 | const target_set = TargetSet.init(.{ | |
| 15273 | .ppc = true, | |
| 15274 | }); | |
| 15275 | }; | |
| 15276 | ||
| 15277 | pub const __builtin_ppc_cmpb = struct { | |
| 15278 | const param_str = "LLiLLiLLi"; | |
| 15279 | const target_set = TargetSet.init(.{ | |
| 15280 | .ppc = true, | |
| 15281 | }); | |
| 15282 | }; | |
| 15283 | ||
| 15284 | pub const __builtin_ppc_cmpeqb = struct { | |
| 15285 | const param_str = "LLiLLiLLi"; | |
| 15286 | const target_set = TargetSet.init(.{ | |
| 15287 | .ppc = true, | |
| 15288 | }); | |
| 15289 | }; | |
| 15290 | ||
| 15291 | pub const __builtin_ppc_cmprb = struct { | |
| 15292 | const param_str = "iCIiii"; | |
| 15293 | const target_set = TargetSet.init(.{ | |
| 15294 | .ppc = true, | |
| 15295 | }); | |
| 15296 | }; | |
| 15297 | ||
| 15298 | pub const __builtin_ppc_compare_and_swap = struct { | |
| 15299 | const param_str = "iiD*i*i"; | |
| 15300 | const target_set = TargetSet.init(.{ | |
| 15301 | .ppc = true, | |
| 15302 | }); | |
| 15303 | }; | |
| 15304 | ||
| 15305 | pub const __builtin_ppc_compare_and_swaplp = struct { | |
| 15306 | const param_str = "iLiD*Li*Li"; | |
| 15307 | const target_set = TargetSet.init(.{ | |
| 15308 | .ppc = true, | |
| 15309 | }); | |
| 15310 | }; | |
| 15311 | ||
| 15312 | pub const __builtin_ppc_compare_exp_eq = struct { | |
| 15313 | const param_str = "idd"; | |
| 15314 | const target_set = TargetSet.init(.{ | |
| 15315 | .ppc = true, | |
| 15316 | }); | |
| 15317 | }; | |
| 15318 | ||
| 15319 | pub const __builtin_ppc_compare_exp_gt = struct { | |
| 15320 | const param_str = "idd"; | |
| 15321 | const target_set = TargetSet.init(.{ | |
| 15322 | .ppc = true, | |
| 15323 | }); | |
| 15324 | }; | |
| 15325 | ||
| 15326 | pub const __builtin_ppc_compare_exp_lt = struct { | |
| 15327 | const param_str = "idd"; | |
| 15328 | const target_set = TargetSet.init(.{ | |
| 15329 | .ppc = true, | |
| 15330 | }); | |
| 15331 | }; | |
| 15332 | ||
| 15333 | pub const __builtin_ppc_compare_exp_uo = struct { | |
| 15334 | const param_str = "idd"; | |
| 15335 | const target_set = TargetSet.init(.{ | |
| 15336 | .ppc = true, | |
| 15337 | }); | |
| 15338 | }; | |
| 15339 | ||
| 15340 | pub const __builtin_ppc_dcbfl = struct { | |
| 15341 | const param_str = "vvC*"; | |
| 15342 | const target_set = TargetSet.init(.{ | |
| 15343 | .ppc = true, | |
| 15344 | }); | |
| 15345 | }; | |
| 15346 | ||
| 15347 | pub const __builtin_ppc_dcbflp = struct { | |
| 15348 | const param_str = "vvC*"; | |
| 15349 | const target_set = TargetSet.init(.{ | |
| 15350 | .ppc = true, | |
| 15351 | }); | |
| 15352 | }; | |
| 15353 | ||
| 15354 | pub const __builtin_ppc_dcbst = struct { | |
| 15355 | const param_str = "vvC*"; | |
| 15356 | const target_set = TargetSet.init(.{ | |
| 15357 | .ppc = true, | |
| 15358 | }); | |
| 15359 | }; | |
| 15360 | ||
| 15361 | pub const __builtin_ppc_dcbt = struct { | |
| 15362 | const param_str = "vv*"; | |
| 15363 | const target_set = TargetSet.init(.{ | |
| 15364 | .ppc = true, | |
| 15365 | }); | |
| 15366 | }; | |
| 15367 | ||
| 15368 | pub const __builtin_ppc_dcbtst = struct { | |
| 15369 | const param_str = "vv*"; | |
| 15370 | const target_set = TargetSet.init(.{ | |
| 15371 | .ppc = true, | |
| 15372 | }); | |
| 15373 | }; | |
| 15374 | ||
| 15375 | pub const __builtin_ppc_dcbtstt = struct { | |
| 15376 | const param_str = "vv*"; | |
| 15377 | const target_set = TargetSet.init(.{ | |
| 15378 | .ppc = true, | |
| 15379 | }); | |
| 15380 | }; | |
| 15381 | ||
| 15382 | pub const __builtin_ppc_dcbtt = struct { | |
| 15383 | const param_str = "vv*"; | |
| 15384 | const target_set = TargetSet.init(.{ | |
| 15385 | .ppc = true, | |
| 15386 | }); | |
| 15387 | }; | |
| 15388 | ||
| 15389 | pub const __builtin_ppc_dcbz = struct { | |
| 15390 | const param_str = "vv*"; | |
| 15391 | const target_set = TargetSet.init(.{ | |
| 15392 | .ppc = true, | |
| 15393 | }); | |
| 15394 | }; | |
| 15395 | ||
| 15396 | pub const __builtin_ppc_eieio = struct { | |
| 15397 | const param_str = "v"; | |
| 15398 | const target_set = TargetSet.init(.{ | |
| 15399 | .ppc = true, | |
| 15400 | }); | |
| 15401 | }; | |
| 15402 | ||
| 15403 | pub const __builtin_ppc_extract_exp = struct { | |
| 15404 | const param_str = "Uid"; | |
| 15405 | const target_set = TargetSet.init(.{ | |
| 15406 | .ppc = true, | |
| 15407 | }); | |
| 15408 | }; | |
| 15409 | ||
| 15410 | pub const __builtin_ppc_extract_sig = struct { | |
| 15411 | const param_str = "ULLid"; | |
| 15412 | const target_set = TargetSet.init(.{ | |
| 15413 | .ppc = true, | |
| 15414 | }); | |
| 15415 | }; | |
| 15416 | ||
| 15417 | pub const __builtin_ppc_fcfid = struct { | |
| 15418 | const param_str = "dd"; | |
| 15419 | const target_set = TargetSet.init(.{ | |
| 15420 | .ppc = true, | |
| 15421 | }); | |
| 15422 | }; | |
| 15423 | ||
| 15424 | pub const __builtin_ppc_fcfud = struct { | |
| 15425 | const param_str = "dd"; | |
| 15426 | const target_set = TargetSet.init(.{ | |
| 15427 | .ppc = true, | |
| 15428 | }); | |
| 15429 | }; | |
| 15430 | ||
| 15431 | pub const __builtin_ppc_fctid = struct { | |
| 15432 | const param_str = "dd"; | |
| 15433 | const target_set = TargetSet.init(.{ | |
| 15434 | .ppc = true, | |
| 15435 | }); | |
| 15436 | }; | |
| 15437 | ||
| 15438 | pub const __builtin_ppc_fctidz = struct { | |
| 15439 | const param_str = "dd"; | |
| 15440 | const target_set = TargetSet.init(.{ | |
| 15441 | .ppc = true, | |
| 15442 | }); | |
| 15443 | }; | |
| 15444 | ||
| 15445 | pub const __builtin_ppc_fctiw = struct { | |
| 15446 | const param_str = "dd"; | |
| 15447 | const target_set = TargetSet.init(.{ | |
| 15448 | .ppc = true, | |
| 15449 | }); | |
| 15450 | }; | |
| 15451 | ||
| 15452 | pub const __builtin_ppc_fctiwz = struct { | |
| 15453 | const param_str = "dd"; | |
| 15454 | const target_set = TargetSet.init(.{ | |
| 15455 | .ppc = true, | |
| 15456 | }); | |
| 15457 | }; | |
| 15458 | ||
| 15459 | pub const __builtin_ppc_fctudz = struct { | |
| 15460 | const param_str = "dd"; | |
| 15461 | const target_set = TargetSet.init(.{ | |
| 15462 | .ppc = true, | |
| 15463 | }); | |
| 15464 | }; | |
| 15465 | ||
| 15466 | pub const __builtin_ppc_fctuwz = struct { | |
| 15467 | const param_str = "dd"; | |
| 15468 | const target_set = TargetSet.init(.{ | |
| 15469 | .ppc = true, | |
| 15470 | }); | |
| 15471 | }; | |
| 15472 | ||
| 15473 | pub const __builtin_ppc_fetch_and_add = struct { | |
| 15474 | const param_str = "iiD*i"; | |
| 15475 | const target_set = TargetSet.init(.{ | |
| 15476 | .ppc = true, | |
| 15477 | }); | |
| 15478 | }; | |
| 15479 | ||
| 15480 | pub const __builtin_ppc_fetch_and_addlp = struct { | |
| 15481 | const param_str = "LiLiD*Li"; | |
| 15482 | const target_set = TargetSet.init(.{ | |
| 15483 | .ppc = true, | |
| 15484 | }); | |
| 15485 | }; | |
| 15486 | ||
| 15487 | pub const __builtin_ppc_fetch_and_and = struct { | |
| 15488 | const param_str = "UiUiD*Ui"; | |
| 15489 | const target_set = TargetSet.init(.{ | |
| 15490 | .ppc = true, | |
| 15491 | }); | |
| 15492 | }; | |
| 15493 | ||
| 15494 | pub const __builtin_ppc_fetch_and_andlp = struct { | |
| 15495 | const param_str = "ULiULiD*ULi"; | |
| 15496 | const target_set = TargetSet.init(.{ | |
| 15497 | .ppc = true, | |
| 15498 | }); | |
| 15499 | }; | |
| 15500 | ||
| 15501 | pub const __builtin_ppc_fetch_and_or = struct { | |
| 15502 | const param_str = "UiUiD*Ui"; | |
| 15503 | const target_set = TargetSet.init(.{ | |
| 15504 | .ppc = true, | |
| 15505 | }); | |
| 15506 | }; | |
| 15507 | ||
| 15508 | pub const __builtin_ppc_fetch_and_orlp = struct { | |
| 15509 | const param_str = "ULiULiD*ULi"; | |
| 15510 | const target_set = TargetSet.init(.{ | |
| 15511 | .ppc = true, | |
| 15512 | }); | |
| 15513 | }; | |
| 15514 | ||
| 15515 | pub const __builtin_ppc_fetch_and_swap = struct { | |
| 15516 | const param_str = "UiUiD*Ui"; | |
| 15517 | const target_set = TargetSet.init(.{ | |
| 15518 | .ppc = true, | |
| 15519 | }); | |
| 15520 | }; | |
| 15521 | ||
| 15522 | pub const __builtin_ppc_fetch_and_swaplp = struct { | |
| 15523 | const param_str = "ULiULiD*ULi"; | |
| 15524 | const target_set = TargetSet.init(.{ | |
| 15525 | .ppc = true, | |
| 15526 | }); | |
| 15527 | }; | |
| 15528 | ||
| 15529 | pub const __builtin_ppc_fmsub = struct { | |
| 15530 | const param_str = "dddd"; | |
| 15531 | const target_set = TargetSet.init(.{ | |
| 15532 | .ppc = true, | |
| 15533 | }); | |
| 15534 | }; | |
| 15535 | ||
| 15536 | pub const __builtin_ppc_fmsubs = struct { | |
| 15537 | const param_str = "ffff"; | |
| 15538 | const target_set = TargetSet.init(.{ | |
| 15539 | .ppc = true, | |
| 15540 | }); | |
| 15541 | }; | |
| 15542 | ||
| 15543 | pub const __builtin_ppc_fnabs = struct { | |
| 15544 | const param_str = "dd"; | |
| 15545 | const target_set = TargetSet.init(.{ | |
| 15546 | .ppc = true, | |
| 15547 | }); | |
| 15548 | }; | |
| 15549 | ||
| 15550 | pub const __builtin_ppc_fnabss = struct { | |
| 15551 | const param_str = "ff"; | |
| 15552 | const target_set = TargetSet.init(.{ | |
| 15553 | .ppc = true, | |
| 15554 | }); | |
| 15555 | }; | |
| 15556 | ||
| 15557 | pub const __builtin_ppc_fnmadd = struct { | |
| 15558 | const param_str = "dddd"; | |
| 15559 | const target_set = TargetSet.init(.{ | |
| 15560 | .ppc = true, | |
| 15561 | }); | |
| 15562 | }; | |
| 15563 | ||
| 15564 | pub const __builtin_ppc_fnmadds = struct { | |
| 15565 | const param_str = "ffff"; | |
| 15566 | const target_set = TargetSet.init(.{ | |
| 15567 | .ppc = true, | |
| 15568 | }); | |
| 15569 | }; | |
| 15570 | ||
| 15571 | pub const __builtin_ppc_fnmsub = struct { | |
| 15572 | const param_str = "dddd"; | |
| 15573 | const target_set = TargetSet.init(.{ | |
| 15574 | .ppc = true, | |
| 15575 | }); | |
| 15576 | }; | |
| 15577 | ||
| 15578 | pub const __builtin_ppc_fnmsubs = struct { | |
| 15579 | const param_str = "ffff"; | |
| 15580 | const target_set = TargetSet.init(.{ | |
| 15581 | .ppc = true, | |
| 15582 | }); | |
| 15583 | }; | |
| 15584 | ||
| 15585 | pub const __builtin_ppc_fre = struct { | |
| 15586 | const param_str = "dd"; | |
| 15587 | const target_set = TargetSet.init(.{ | |
| 15588 | .ppc = true, | |
| 15589 | }); | |
| 15590 | }; | |
| 15591 | ||
| 15592 | pub const __builtin_ppc_fres = struct { | |
| 15593 | const param_str = "ff"; | |
| 15594 | const target_set = TargetSet.init(.{ | |
| 15595 | .ppc = true, | |
| 15596 | }); | |
| 15597 | }; | |
| 15598 | ||
| 15599 | pub const __builtin_ppc_fric = struct { | |
| 15600 | const param_str = "dd"; | |
| 15601 | const target_set = TargetSet.init(.{ | |
| 15602 | .ppc = true, | |
| 15603 | }); | |
| 15604 | }; | |
| 15605 | ||
| 15606 | pub const __builtin_ppc_frim = struct { | |
| 15607 | const param_str = "dd"; | |
| 15608 | const target_set = TargetSet.init(.{ | |
| 15609 | .ppc = true, | |
| 15610 | }); | |
| 15611 | }; | |
| 15612 | ||
| 15613 | pub const __builtin_ppc_frims = struct { | |
| 15614 | const param_str = "ff"; | |
| 15615 | const target_set = TargetSet.init(.{ | |
| 15616 | .ppc = true, | |
| 15617 | }); | |
| 15618 | }; | |
| 15619 | ||
| 15620 | pub const __builtin_ppc_frin = struct { | |
| 15621 | const param_str = "dd"; | |
| 15622 | const target_set = TargetSet.init(.{ | |
| 15623 | .ppc = true, | |
| 15624 | }); | |
| 15625 | }; | |
| 15626 | ||
| 15627 | pub const __builtin_ppc_frins = struct { | |
| 15628 | const param_str = "ff"; | |
| 15629 | const target_set = TargetSet.init(.{ | |
| 15630 | .ppc = true, | |
| 15631 | }); | |
| 15632 | }; | |
| 15633 | ||
| 15634 | pub const __builtin_ppc_frip = struct { | |
| 15635 | const param_str = "dd"; | |
| 15636 | const target_set = TargetSet.init(.{ | |
| 15637 | .ppc = true, | |
| 15638 | }); | |
| 15639 | }; | |
| 15640 | ||
| 15641 | pub const __builtin_ppc_frips = struct { | |
| 15642 | const param_str = "ff"; | |
| 15643 | const target_set = TargetSet.init(.{ | |
| 15644 | .ppc = true, | |
| 15645 | }); | |
| 15646 | }; | |
| 15647 | ||
| 15648 | pub const __builtin_ppc_friz = struct { | |
| 15649 | const param_str = "dd"; | |
| 15650 | const target_set = TargetSet.init(.{ | |
| 15651 | .ppc = true, | |
| 15652 | }); | |
| 15653 | }; | |
| 15654 | ||
| 15655 | pub const __builtin_ppc_frizs = struct { | |
| 15656 | const param_str = "ff"; | |
| 15657 | const target_set = TargetSet.init(.{ | |
| 15658 | .ppc = true, | |
| 15659 | }); | |
| 15660 | }; | |
| 15661 | ||
| 15662 | pub const __builtin_ppc_frsqrte = struct { | |
| 15663 | const param_str = "dd"; | |
| 15664 | const target_set = TargetSet.init(.{ | |
| 15665 | .ppc = true, | |
| 15666 | }); | |
| 15667 | }; | |
| 15668 | ||
| 15669 | pub const __builtin_ppc_frsqrtes = struct { | |
| 15670 | const param_str = "ff"; | |
| 15671 | const target_set = TargetSet.init(.{ | |
| 15672 | .ppc = true, | |
| 15673 | }); | |
| 15674 | }; | |
| 15675 | ||
| 15676 | pub const __builtin_ppc_fsel = struct { | |
| 15677 | const param_str = "dddd"; | |
| 15678 | const target_set = TargetSet.init(.{ | |
| 15679 | .ppc = true, | |
| 15680 | }); | |
| 15681 | }; | |
| 15682 | ||
| 15683 | pub const __builtin_ppc_fsels = struct { | |
| 15684 | const param_str = "ffff"; | |
| 15685 | const target_set = TargetSet.init(.{ | |
| 15686 | .ppc = true, | |
| 15687 | }); | |
| 15688 | }; | |
| 15689 | ||
| 15690 | pub const __builtin_ppc_fsqrt = struct { | |
| 15691 | const param_str = "dd"; | |
| 15692 | const target_set = TargetSet.init(.{ | |
| 15693 | .ppc = true, | |
| 15694 | }); | |
| 15695 | }; | |
| 15696 | ||
| 15697 | pub const __builtin_ppc_fsqrts = struct { | |
| 15698 | const param_str = "ff"; | |
| 15699 | const target_set = TargetSet.init(.{ | |
| 15700 | .ppc = true, | |
| 15701 | }); | |
| 15702 | }; | |
| 15703 | ||
| 15704 | pub const __builtin_ppc_get_timebase = struct { | |
| 15705 | const param_str = "ULLi"; | |
| 15706 | const target_set = TargetSet.init(.{ | |
| 15707 | .ppc = true, | |
| 15708 | }); | |
| 15709 | const attributes = Attributes{}; | |
| 15710 | }; | |
| 15711 | ||
| 15712 | pub const __builtin_ppc_icbt = struct { | |
| 15713 | const param_str = "vv*"; | |
| 15714 | const target_set = TargetSet.init(.{ | |
| 15715 | .ppc = true, | |
| 15716 | }); | |
| 15717 | }; | |
| 15718 | ||
| 15719 | pub const __builtin_ppc_insert_exp = struct { | |
| 15720 | const param_str = "ddULLi"; | |
| 15721 | const target_set = TargetSet.init(.{ | |
| 15722 | .ppc = true, | |
| 15723 | }); | |
| 15724 | }; | |
| 15725 | ||
| 15726 | pub const __builtin_ppc_iospace_eieio = struct { | |
| 15727 | const param_str = "v"; | |
| 15728 | const target_set = TargetSet.init(.{ | |
| 15729 | .ppc = true, | |
| 15730 | }); | |
| 15731 | }; | |
| 15732 | ||
| 15733 | pub const __builtin_ppc_iospace_lwsync = struct { | |
| 15734 | const param_str = "v"; | |
| 15735 | const target_set = TargetSet.init(.{ | |
| 15736 | .ppc = true, | |
| 15737 | }); | |
| 15738 | }; | |
| 15739 | ||
| 15740 | pub const __builtin_ppc_iospace_sync = struct { | |
| 15741 | const param_str = "v"; | |
| 15742 | const target_set = TargetSet.init(.{ | |
| 15743 | .ppc = true, | |
| 15744 | }); | |
| 15745 | }; | |
| 15746 | ||
| 15747 | pub const __builtin_ppc_isync = struct { | |
| 15748 | const param_str = "v"; | |
| 15749 | const target_set = TargetSet.init(.{ | |
| 15750 | .ppc = true, | |
| 15751 | }); | |
| 15752 | }; | |
| 15753 | ||
| 15754 | pub const __builtin_ppc_lbarx = struct { | |
| 15755 | const param_str = "ccD*"; | |
| 15756 | const target_set = TargetSet.init(.{ | |
| 15757 | .ppc = true, | |
| 15758 | }); | |
| 15759 | }; | |
| 15760 | ||
| 15761 | pub const __builtin_ppc_ldarx = struct { | |
| 15762 | const param_str = "LiLiD*"; | |
| 15763 | const target_set = TargetSet.init(.{ | |
| 15764 | .ppc = true, | |
| 15765 | }); | |
| 15766 | }; | |
| 15767 | ||
| 15768 | pub const __builtin_ppc_lharx = struct { | |
| 15769 | const param_str = "ssD*"; | |
| 15770 | const target_set = TargetSet.init(.{ | |
| 15771 | .ppc = true, | |
| 15772 | }); | |
| 15773 | }; | |
| 15774 | ||
| 15775 | pub const __builtin_ppc_load2r = struct { | |
| 15776 | const param_str = "UsUs*"; | |
| 15777 | const target_set = TargetSet.init(.{ | |
| 15778 | .ppc = true, | |
| 15779 | }); | |
| 15780 | }; | |
| 15781 | ||
| 15782 | pub const __builtin_ppc_load4r = struct { | |
| 15783 | const param_str = "UiUi*"; | |
| 15784 | const target_set = TargetSet.init(.{ | |
| 15785 | .ppc = true, | |
| 15786 | }); | |
| 15787 | }; | |
| 15788 | ||
| 15789 | pub const __builtin_ppc_load8r = struct { | |
| 15790 | const param_str = "ULLiULLi*"; | |
| 15791 | const target_set = TargetSet.init(.{ | |
| 15792 | .ppc = true, | |
| 15793 | }); | |
| 15794 | }; | |
| 15795 | ||
| 15796 | pub const __builtin_ppc_lwarx = struct { | |
| 15797 | const param_str = "iiD*"; | |
| 15798 | const target_set = TargetSet.init(.{ | |
| 15799 | .ppc = true, | |
| 15800 | }); | |
| 15801 | }; | |
| 15802 | ||
| 15803 | pub const __builtin_ppc_lwsync = struct { | |
| 15804 | const param_str = "v"; | |
| 15805 | const target_set = TargetSet.init(.{ | |
| 15806 | .ppc = true, | |
| 15807 | }); | |
| 15808 | }; | |
| 15809 | ||
| 15810 | pub const __builtin_ppc_maddhd = struct { | |
| 15811 | const param_str = "LLiLLiLLiLLi"; | |
| 15812 | const target_set = TargetSet.init(.{ | |
| 15813 | .ppc = true, | |
| 15814 | }); | |
| 15815 | }; | |
| 15816 | ||
| 15817 | pub const __builtin_ppc_maddhdu = struct { | |
| 15818 | const param_str = "ULLiULLiULLiULLi"; | |
| 15819 | const target_set = TargetSet.init(.{ | |
| 15820 | .ppc = true, | |
| 15821 | }); | |
| 15822 | }; | |
| 15823 | ||
| 15824 | pub const __builtin_ppc_maddld = struct { | |
| 15825 | const param_str = "LLiLLiLLiLLi"; | |
| 15826 | const target_set = TargetSet.init(.{ | |
| 15827 | .ppc = true, | |
| 15828 | }); | |
| 15829 | }; | |
| 15830 | ||
| 15831 | pub const __builtin_ppc_maxfe = struct { | |
| 15832 | const param_str = "LdLdLdLd."; | |
| 15833 | const target_set = TargetSet.init(.{ | |
| 15834 | .ppc = true, | |
| 15835 | }); | |
| 15836 | const attributes = Attributes{ | |
| 15837 | .custom_typecheck = true, | |
| 15838 | }; | |
| 15839 | }; | |
| 15840 | ||
| 15841 | pub const __builtin_ppc_maxfl = struct { | |
| 15842 | const param_str = "dddd."; | |
| 15843 | const target_set = TargetSet.init(.{ | |
| 15844 | .ppc = true, | |
| 15845 | }); | |
| 15846 | const attributes = Attributes{ | |
| 15847 | .custom_typecheck = true, | |
| 15848 | }; | |
| 15849 | }; | |
| 15850 | ||
| 15851 | pub const __builtin_ppc_maxfs = struct { | |
| 15852 | const param_str = "ffff."; | |
| 15853 | const target_set = TargetSet.init(.{ | |
| 15854 | .ppc = true, | |
| 15855 | }); | |
| 15856 | const attributes = Attributes{ | |
| 15857 | .custom_typecheck = true, | |
| 15858 | }; | |
| 15859 | }; | |
| 15860 | ||
| 15861 | pub const __builtin_ppc_mfmsr = struct { | |
| 15862 | const param_str = "Ui"; | |
| 15863 | const target_set = TargetSet.init(.{ | |
| 15864 | .ppc = true, | |
| 15865 | }); | |
| 15866 | }; | |
| 15867 | ||
| 15868 | pub const __builtin_ppc_mfspr = struct { | |
| 15869 | const param_str = "ULiIi"; | |
| 15870 | const target_set = TargetSet.init(.{ | |
| 15871 | .ppc = true, | |
| 15872 | }); | |
| 15873 | }; | |
| 15874 | ||
| 15875 | pub const __builtin_ppc_mftbu = struct { | |
| 15876 | const param_str = "Ui"; | |
| 15877 | const target_set = TargetSet.init(.{ | |
| 15878 | .ppc = true, | |
| 15879 | }); | |
| 15880 | }; | |
| 15881 | ||
| 15882 | pub const __builtin_ppc_minfe = struct { | |
| 15883 | const param_str = "LdLdLdLd."; | |
| 15884 | const target_set = TargetSet.init(.{ | |
| 15885 | .ppc = true, | |
| 15886 | }); | |
| 15887 | const attributes = Attributes{ | |
| 15888 | .custom_typecheck = true, | |
| 15889 | }; | |
| 15890 | }; | |
| 15891 | ||
| 15892 | pub const __builtin_ppc_minfl = struct { | |
| 15893 | const param_str = "dddd."; | |
| 15894 | const target_set = TargetSet.init(.{ | |
| 15895 | .ppc = true, | |
| 15896 | }); | |
| 15897 | const attributes = Attributes{ | |
| 15898 | .custom_typecheck = true, | |
| 15899 | }; | |
| 15900 | }; | |
| 15901 | ||
| 15902 | pub const __builtin_ppc_minfs = struct { | |
| 15903 | const param_str = "ffff."; | |
| 15904 | const target_set = TargetSet.init(.{ | |
| 15905 | .ppc = true, | |
| 15906 | }); | |
| 15907 | const attributes = Attributes{ | |
| 15908 | .custom_typecheck = true, | |
| 15909 | }; | |
| 15910 | }; | |
| 15911 | ||
| 15912 | pub const __builtin_ppc_mtfsb0 = struct { | |
| 15913 | const param_str = "vUIi"; | |
| 15914 | const target_set = TargetSet.init(.{ | |
| 15915 | .ppc = true, | |
| 15916 | }); | |
| 15917 | }; | |
| 15918 | ||
| 15919 | pub const __builtin_ppc_mtfsb1 = struct { | |
| 15920 | const param_str = "vUIi"; | |
| 15921 | const target_set = TargetSet.init(.{ | |
| 15922 | .ppc = true, | |
| 15923 | }); | |
| 15924 | }; | |
| 15925 | ||
| 15926 | pub const __builtin_ppc_mtfsf = struct { | |
| 15927 | const param_str = "vUIiUi"; | |
| 15928 | const target_set = TargetSet.init(.{ | |
| 15929 | .ppc = true, | |
| 15930 | }); | |
| 15931 | }; | |
| 15932 | ||
| 15933 | pub const __builtin_ppc_mtfsfi = struct { | |
| 15934 | const param_str = "vUIiUIi"; | |
| 15935 | const target_set = TargetSet.init(.{ | |
| 15936 | .ppc = true, | |
| 15937 | }); | |
| 15938 | }; | |
| 15939 | ||
| 15940 | pub const __builtin_ppc_mtmsr = struct { | |
| 15941 | const param_str = "vUi"; | |
| 15942 | const target_set = TargetSet.init(.{ | |
| 15943 | .ppc = true, | |
| 15944 | }); | |
| 15945 | }; | |
| 15946 | ||
| 15947 | pub const __builtin_ppc_mtspr = struct { | |
| 15948 | const param_str = "vIiULi"; | |
| 15949 | const target_set = TargetSet.init(.{ | |
| 15950 | .ppc = true, | |
| 15951 | }); | |
| 15952 | }; | |
| 15953 | ||
| 15954 | pub const __builtin_ppc_mulhd = struct { | |
| 15955 | const param_str = "LLiLiLi"; | |
| 15956 | const target_set = TargetSet.init(.{ | |
| 15957 | .ppc = true, | |
| 15958 | }); | |
| 15959 | }; | |
| 15960 | ||
| 15961 | pub const __builtin_ppc_mulhdu = struct { | |
| 15962 | const param_str = "ULLiULiULi"; | |
| 15963 | const target_set = TargetSet.init(.{ | |
| 15964 | .ppc = true, | |
| 15965 | }); | |
| 15966 | }; | |
| 15967 | ||
| 15968 | pub const __builtin_ppc_mulhw = struct { | |
| 15969 | const param_str = "iii"; | |
| 15970 | const target_set = TargetSet.init(.{ | |
| 15971 | .ppc = true, | |
| 15972 | }); | |
| 15973 | }; | |
| 15974 | ||
| 15975 | pub const __builtin_ppc_mulhwu = struct { | |
| 15976 | const param_str = "UiUiUi"; | |
| 15977 | const target_set = TargetSet.init(.{ | |
| 15978 | .ppc = true, | |
| 15979 | }); | |
| 15980 | }; | |
| 15981 | ||
| 15982 | pub const __builtin_ppc_popcntb = struct { | |
| 15983 | const param_str = "ULiULi"; | |
| 15984 | const target_set = TargetSet.init(.{ | |
| 15985 | .ppc = true, | |
| 15986 | }); | |
| 15987 | }; | |
| 15988 | ||
| 15989 | pub const __builtin_ppc_poppar4 = struct { | |
| 15990 | const param_str = "iUi"; | |
| 15991 | const target_set = TargetSet.init(.{ | |
| 15992 | .ppc = true, | |
| 15993 | }); | |
| 15994 | }; | |
| 15995 | ||
| 15996 | pub const __builtin_ppc_poppar8 = struct { | |
| 15997 | const param_str = "iULLi"; | |
| 15998 | const target_set = TargetSet.init(.{ | |
| 15999 | .ppc = true, | |
| 16000 | }); | |
| 16001 | }; | |
| 16002 | ||
| 16003 | pub const __builtin_ppc_rdlam = struct { | |
| 16004 | const param_str = "UWiUWiUWiUWIi"; | |
| 16005 | const target_set = TargetSet.init(.{ | |
| 16006 | .ppc = true, | |
| 16007 | }); | |
| 16008 | const attributes = Attributes{ | |
| 16009 | .@"const" = true, | |
| 16010 | }; | |
| 16011 | }; | |
| 16012 | ||
| 16013 | pub const __builtin_ppc_recipdivd = struct { | |
| 16014 | const param_str = "V2dV2dV2d"; | |
| 16015 | const target_set = TargetSet.init(.{ | |
| 16016 | .ppc = true, | |
| 16017 | }); | |
| 16018 | }; | |
| 16019 | ||
| 16020 | pub const __builtin_ppc_recipdivf = struct { | |
| 16021 | const param_str = "V4fV4fV4f"; | |
| 16022 | const target_set = TargetSet.init(.{ | |
| 16023 | .ppc = true, | |
| 16024 | }); | |
| 16025 | }; | |
| 16026 | ||
| 16027 | pub const __builtin_ppc_rldimi = struct { | |
| 16028 | const param_str = "ULLiULLiULLiIUiIULLi"; | |
| 16029 | const target_set = TargetSet.init(.{ | |
| 16030 | .ppc = true, | |
| 16031 | }); | |
| 16032 | }; | |
| 16033 | ||
| 16034 | pub const __builtin_ppc_rlwimi = struct { | |
| 16035 | const param_str = "UiUiUiIUiIUi"; | |
| 16036 | const target_set = TargetSet.init(.{ | |
| 16037 | .ppc = true, | |
| 16038 | }); | |
| 16039 | }; | |
| 16040 | ||
| 16041 | pub const __builtin_ppc_rlwnm = struct { | |
| 16042 | const param_str = "UiUiUiIUi"; | |
| 16043 | const target_set = TargetSet.init(.{ | |
| 16044 | .ppc = true, | |
| 16045 | }); | |
| 16046 | }; | |
| 16047 | ||
| 16048 | pub const __builtin_ppc_rsqrtd = struct { | |
| 16049 | const param_str = "V2dV2d"; | |
| 16050 | const target_set = TargetSet.init(.{ | |
| 16051 | .ppc = true, | |
| 16052 | }); | |
| 16053 | }; | |
| 16054 | ||
| 16055 | pub const __builtin_ppc_rsqrtf = struct { | |
| 16056 | const param_str = "V4fV4f"; | |
| 16057 | const target_set = TargetSet.init(.{ | |
| 16058 | .ppc = true, | |
| 16059 | }); | |
| 16060 | }; | |
| 16061 | ||
| 16062 | pub const __builtin_ppc_setb = struct { | |
| 16063 | const param_str = "LLiLLiLLi"; | |
| 16064 | const target_set = TargetSet.init(.{ | |
| 16065 | .ppc = true, | |
| 16066 | }); | |
| 16067 | }; | |
| 16068 | ||
| 16069 | pub const __builtin_ppc_stbcx = struct { | |
| 16070 | const param_str = "icD*i"; | |
| 16071 | const target_set = TargetSet.init(.{ | |
| 16072 | .ppc = true, | |
| 16073 | }); | |
| 16074 | }; | |
| 16075 | ||
| 16076 | pub const __builtin_ppc_stdcx = struct { | |
| 16077 | const param_str = "iLiD*Li"; | |
| 16078 | const target_set = TargetSet.init(.{ | |
| 16079 | .ppc = true, | |
| 16080 | }); | |
| 16081 | }; | |
| 16082 | ||
| 16083 | pub const __builtin_ppc_stfiw = struct { | |
| 16084 | const param_str = "viC*d"; | |
| 16085 | const target_set = TargetSet.init(.{ | |
| 16086 | .ppc = true, | |
| 16087 | }); | |
| 16088 | }; | |
| 16089 | ||
| 16090 | pub const __builtin_ppc_sthcx = struct { | |
| 16091 | const param_str = "isD*s"; | |
| 16092 | const target_set = TargetSet.init(.{ | |
| 16093 | .ppc = true, | |
| 16094 | }); | |
| 16095 | }; | |
| 16096 | ||
| 16097 | pub const __builtin_ppc_store2r = struct { | |
| 16098 | const param_str = "vUiUs*"; | |
| 16099 | const target_set = TargetSet.init(.{ | |
| 16100 | .ppc = true, | |
| 16101 | }); | |
| 16102 | }; | |
| 16103 | ||
| 16104 | pub const __builtin_ppc_store4r = struct { | |
| 16105 | const param_str = "vUiUi*"; | |
| 16106 | const target_set = TargetSet.init(.{ | |
| 16107 | .ppc = true, | |
| 16108 | }); | |
| 16109 | }; | |
| 16110 | ||
| 16111 | pub const __builtin_ppc_store8r = struct { | |
| 16112 | const param_str = "vULLiULLi*"; | |
| 16113 | const target_set = TargetSet.init(.{ | |
| 16114 | .ppc = true, | |
| 16115 | }); | |
| 16116 | }; | |
| 16117 | ||
| 16118 | pub const __builtin_ppc_stwcx = struct { | |
| 16119 | const param_str = "iiD*i"; | |
| 16120 | const target_set = TargetSet.init(.{ | |
| 16121 | .ppc = true, | |
| 16122 | }); | |
| 16123 | }; | |
| 16124 | ||
| 16125 | pub const __builtin_ppc_swdiv = struct { | |
| 16126 | const param_str = "ddd"; | |
| 16127 | const target_set = TargetSet.init(.{ | |
| 16128 | .ppc = true, | |
| 16129 | }); | |
| 16130 | }; | |
| 16131 | ||
| 16132 | pub const __builtin_ppc_swdiv_nochk = struct { | |
| 16133 | const param_str = "ddd"; | |
| 16134 | const target_set = TargetSet.init(.{ | |
| 16135 | .ppc = true, | |
| 16136 | }); | |
| 16137 | }; | |
| 16138 | ||
| 16139 | pub const __builtin_ppc_swdivs = struct { | |
| 16140 | const param_str = "fff"; | |
| 16141 | const target_set = TargetSet.init(.{ | |
| 16142 | .ppc = true, | |
| 16143 | }); | |
| 16144 | }; | |
| 16145 | ||
| 16146 | pub const __builtin_ppc_swdivs_nochk = struct { | |
| 16147 | const param_str = "fff"; | |
| 16148 | const target_set = TargetSet.init(.{ | |
| 16149 | .ppc = true, | |
| 16150 | }); | |
| 16151 | }; | |
| 16152 | ||
| 16153 | pub const __builtin_ppc_sync = struct { | |
| 16154 | const param_str = "v"; | |
| 16155 | const target_set = TargetSet.init(.{ | |
| 16156 | .ppc = true, | |
| 16157 | }); | |
| 16158 | }; | |
| 16159 | ||
| 16160 | pub const __builtin_ppc_tdw = struct { | |
| 16161 | const param_str = "vLLiLLiIUi"; | |
| 16162 | const target_set = TargetSet.init(.{ | |
| 16163 | .ppc = true, | |
| 16164 | }); | |
| 16165 | }; | |
| 16166 | ||
| 16167 | pub const __builtin_ppc_test_data_class = struct { | |
| 16168 | const param_str = "idIi"; | |
| 16169 | const target_set = TargetSet.init(.{ | |
| 16170 | .ppc = true, | |
| 16171 | }); | |
| 16172 | const attributes = Attributes{ | |
| 16173 | .custom_typecheck = true, | |
| 16174 | }; | |
| 16175 | }; | |
| 16176 | ||
| 16177 | pub const __builtin_ppc_trap = struct { | |
| 16178 | const param_str = "vi"; | |
| 16179 | const target_set = TargetSet.init(.{ | |
| 16180 | .ppc = true, | |
| 16181 | }); | |
| 16182 | }; | |
| 16183 | ||
| 16184 | pub const __builtin_ppc_trapd = struct { | |
| 16185 | const param_str = "vLi"; | |
| 16186 | const target_set = TargetSet.init(.{ | |
| 16187 | .ppc = true, | |
| 16188 | }); | |
| 16189 | }; | |
| 16190 | ||
| 16191 | pub const __builtin_ppc_tw = struct { | |
| 16192 | const param_str = "viiIUi"; | |
| 16193 | const target_set = TargetSet.init(.{ | |
| 16194 | .ppc = true, | |
| 16195 | }); | |
| 16196 | }; | |
| 16197 | ||
| 16198 | pub const __builtin_prefetch = struct { | |
| 16199 | const param_str = "vvC*."; | |
| 16200 | const attributes = Attributes{ | |
| 16201 | .@"const" = true, | |
| 16202 | }; | |
| 16203 | }; | |
| 16204 | ||
| 16205 | pub const __builtin_preserve_access_index = struct { | |
| 16206 | const param_str = "v."; | |
| 16207 | const attributes = Attributes{ | |
| 16208 | .custom_typecheck = true, | |
| 16209 | }; | |
| 16210 | }; | |
| 16211 | ||
| 16212 | pub const __builtin_printf = struct { | |
| 16213 | const param_str = "icC*."; | |
| 16214 | const attributes = Attributes{ | |
| 16215 | .lib_function_with_builtin_prefix = true, | |
| 16216 | .format_kind = .printf, | |
| 16217 | .format_string_position = 0, | |
| 16218 | }; | |
| 16219 | }; | |
| 16220 | ||
| 16221 | pub const __builtin_ptx_get_image_channel_data_typei_ = struct { | |
| 16222 | const param_str = "ii"; | |
| 16223 | const target_set = TargetSet.init(.{ | |
| 16224 | .nvptx = true, | |
| 16225 | }); | |
| 16226 | }; | |
| 16227 | ||
| 16228 | pub const __builtin_ptx_get_image_channel_orderi_ = struct { | |
| 16229 | const param_str = "ii"; | |
| 16230 | const target_set = TargetSet.init(.{ | |
| 16231 | .nvptx = true, | |
| 16232 | }); | |
| 16233 | }; | |
| 16234 | ||
| 16235 | pub const __builtin_ptx_get_image_depthi_ = struct { | |
| 16236 | const param_str = "ii"; | |
| 16237 | const target_set = TargetSet.init(.{ | |
| 16238 | .nvptx = true, | |
| 16239 | }); | |
| 16240 | }; | |
| 16241 | ||
| 16242 | pub const __builtin_ptx_get_image_heighti_ = struct { | |
| 16243 | const param_str = "ii"; | |
| 16244 | const target_set = TargetSet.init(.{ | |
| 16245 | .nvptx = true, | |
| 16246 | }); | |
| 16247 | }; | |
| 16248 | ||
| 16249 | pub const __builtin_ptx_get_image_widthi_ = struct { | |
| 16250 | const param_str = "ii"; | |
| 16251 | const target_set = TargetSet.init(.{ | |
| 16252 | .nvptx = true, | |
| 16253 | }); | |
| 16254 | }; | |
| 16255 | ||
| 16256 | pub const __builtin_ptx_read_image2Dff_ = struct { | |
| 16257 | const param_str = "V4fiiff"; | |
| 16258 | const target_set = TargetSet.init(.{ | |
| 16259 | .nvptx = true, | |
| 16260 | }); | |
| 16261 | }; | |
| 16262 | ||
| 16263 | pub const __builtin_ptx_read_image2Dfi_ = struct { | |
| 16264 | const param_str = "V4fiiii"; | |
| 16265 | const target_set = TargetSet.init(.{ | |
| 16266 | .nvptx = true, | |
| 16267 | }); | |
| 16268 | }; | |
| 16269 | ||
| 16270 | pub const __builtin_ptx_read_image2Dif_ = struct { | |
| 16271 | const param_str = "V4iiiff"; | |
| 16272 | const target_set = TargetSet.init(.{ | |
| 16273 | .nvptx = true, | |
| 16274 | }); | |
| 16275 | }; | |
| 16276 | ||
| 16277 | pub const __builtin_ptx_read_image2Dii_ = struct { | |
| 16278 | const param_str = "V4iiiii"; | |
| 16279 | const target_set = TargetSet.init(.{ | |
| 16280 | .nvptx = true, | |
| 16281 | }); | |
| 16282 | }; | |
| 16283 | ||
| 16284 | pub const __builtin_ptx_read_image3Dff_ = struct { | |
| 16285 | const param_str = "V4fiiffff"; | |
| 16286 | const target_set = TargetSet.init(.{ | |
| 16287 | .nvptx = true, | |
| 16288 | }); | |
| 16289 | }; | |
| 16290 | ||
| 16291 | pub const __builtin_ptx_read_image3Dfi_ = struct { | |
| 16292 | const param_str = "V4fiiiiii"; | |
| 16293 | const target_set = TargetSet.init(.{ | |
| 16294 | .nvptx = true, | |
| 16295 | }); | |
| 16296 | }; | |
| 16297 | ||
| 16298 | pub const __builtin_ptx_read_image3Dif_ = struct { | |
| 16299 | const param_str = "V4iiiffff"; | |
| 16300 | const target_set = TargetSet.init(.{ | |
| 16301 | .nvptx = true, | |
| 16302 | }); | |
| 16303 | }; | |
| 16304 | ||
| 16305 | pub const __builtin_ptx_read_image3Dii_ = struct { | |
| 16306 | const param_str = "V4iiiiiii"; | |
| 16307 | const target_set = TargetSet.init(.{ | |
| 16308 | .nvptx = true, | |
| 16309 | }); | |
| 16310 | }; | |
| 16311 | ||
| 16312 | pub const __builtin_ptx_write_image2Df_ = struct { | |
| 16313 | const param_str = "viiiffff"; | |
| 16314 | const target_set = TargetSet.init(.{ | |
| 16315 | .nvptx = true, | |
| 16316 | }); | |
| 16317 | }; | |
| 16318 | ||
| 16319 | pub const __builtin_ptx_write_image2Di_ = struct { | |
| 16320 | const param_str = "viiiiiii"; | |
| 16321 | const target_set = TargetSet.init(.{ | |
| 16322 | .nvptx = true, | |
| 16323 | }); | |
| 16324 | }; | |
| 16325 | ||
| 16326 | pub const __builtin_ptx_write_image2Dui_ = struct { | |
| 16327 | const param_str = "viiiUiUiUiUi"; | |
| 16328 | const target_set = TargetSet.init(.{ | |
| 16329 | .nvptx = true, | |
| 16330 | }); | |
| 16331 | }; | |
| 16332 | ||
| 16333 | pub const __builtin_r600_implicitarg_ptr = struct { | |
| 16334 | const param_str = "Uc*7"; | |
| 16335 | const target_set = TargetSet.init(.{ | |
| 16336 | .amdgpu = true, | |
| 16337 | }); | |
| 16338 | const attributes = Attributes{ | |
| 16339 | .@"const" = true, | |
| 16340 | }; | |
| 16341 | }; | |
| 16342 | ||
| 16343 | pub const __builtin_r600_read_tgid_x = struct { | |
| 16344 | const param_str = "Ui"; | |
| 16345 | const target_set = TargetSet.init(.{ | |
| 16346 | .amdgpu = true, | |
| 16347 | }); | |
| 16348 | const attributes = Attributes{ | |
| 16349 | .@"const" = true, | |
| 16350 | }; | |
| 16351 | }; | |
| 16352 | ||
| 16353 | pub const __builtin_r600_read_tgid_y = struct { | |
| 16354 | const param_str = "Ui"; | |
| 16355 | const target_set = TargetSet.init(.{ | |
| 16356 | .amdgpu = true, | |
| 16357 | }); | |
| 16358 | const attributes = Attributes{ | |
| 16359 | .@"const" = true, | |
| 16360 | }; | |
| 16361 | }; | |
| 16362 | ||
| 16363 | pub const __builtin_r600_read_tgid_z = struct { | |
| 16364 | const param_str = "Ui"; | |
| 16365 | const target_set = TargetSet.init(.{ | |
| 16366 | .amdgpu = true, | |
| 16367 | }); | |
| 16368 | const attributes = Attributes{ | |
| 16369 | .@"const" = true, | |
| 16370 | }; | |
| 16371 | }; | |
| 16372 | ||
| 16373 | pub const __builtin_r600_read_tidig_x = struct { | |
| 16374 | const param_str = "Ui"; | |
| 16375 | const target_set = TargetSet.init(.{ | |
| 16376 | .amdgpu = true, | |
| 16377 | }); | |
| 16378 | const attributes = Attributes{ | |
| 16379 | .@"const" = true, | |
| 16380 | }; | |
| 16381 | }; | |
| 16382 | ||
| 16383 | pub const __builtin_r600_read_tidig_y = struct { | |
| 16384 | const param_str = "Ui"; | |
| 16385 | const target_set = TargetSet.init(.{ | |
| 16386 | .amdgpu = true, | |
| 16387 | }); | |
| 16388 | const attributes = Attributes{ | |
| 16389 | .@"const" = true, | |
| 16390 | }; | |
| 16391 | }; | |
| 16392 | ||
| 16393 | pub const __builtin_r600_read_tidig_z = struct { | |
| 16394 | const param_str = "Ui"; | |
| 16395 | const target_set = TargetSet.init(.{ | |
| 16396 | .amdgpu = true, | |
| 16397 | }); | |
| 16398 | const attributes = Attributes{ | |
| 16399 | .@"const" = true, | |
| 16400 | }; | |
| 16401 | }; | |
| 16402 | ||
| 16403 | pub const __builtin_r600_recipsqrt_ieee = struct { | |
| 16404 | const param_str = "dd"; | |
| 16405 | const target_set = TargetSet.init(.{ | |
| 16406 | .amdgpu = true, | |
| 16407 | }); | |
| 16408 | const attributes = Attributes{ | |
| 16409 | .@"const" = true, | |
| 16410 | }; | |
| 16411 | }; | |
| 16412 | ||
| 16413 | pub const __builtin_r600_recipsqrt_ieeef = struct { | |
| 16414 | const param_str = "ff"; | |
| 16415 | const target_set = TargetSet.init(.{ | |
| 16416 | .amdgpu = true, | |
| 16417 | }); | |
| 16418 | const attributes = Attributes{ | |
| 16419 | .@"const" = true, | |
| 16420 | }; | |
| 16421 | }; | |
| 16422 | ||
| 16423 | pub const __builtin_readcyclecounter = struct { | |
| 16424 | const param_str = "ULLi"; | |
| 16425 | const attributes = Attributes{}; | |
| 16426 | }; | |
| 16427 | ||
| 16428 | pub const __builtin_readflm = struct { | |
| 16429 | const param_str = "d"; | |
| 16430 | const target_set = TargetSet.init(.{ | |
| 16431 | .ppc = true, | |
| 16432 | }); | |
| 16433 | }; | |
| 16434 | ||
| 16435 | pub const __builtin_realloc = struct { | |
| 16436 | const param_str = "v*v*z"; | |
| 16437 | const attributes = Attributes{ | |
| 16438 | .lib_function_with_builtin_prefix = true, | |
| 16439 | }; | |
| 16440 | }; | |
| 16441 | ||
| 16442 | pub const __builtin_reduce_add = struct { | |
| 16443 | const param_str = "v."; | |
| 16444 | const attributes = Attributes{ | |
| 16445 | .@"const" = true, | |
| 16446 | .custom_typecheck = true, | |
| 16447 | }; | |
| 16448 | }; | |
| 16449 | ||
| 16450 | pub const __builtin_reduce_and = struct { | |
| 16451 | const param_str = "v."; | |
| 16452 | const attributes = Attributes{ | |
| 16453 | .@"const" = true, | |
| 16454 | .custom_typecheck = true, | |
| 16455 | }; | |
| 16456 | }; | |
| 16457 | ||
| 16458 | pub const __builtin_reduce_max = struct { | |
| 16459 | const param_str = "v."; | |
| 16460 | const attributes = Attributes{ | |
| 16461 | .@"const" = true, | |
| 16462 | .custom_typecheck = true, | |
| 16463 | }; | |
| 16464 | }; | |
| 16465 | ||
| 16466 | pub const __builtin_reduce_min = struct { | |
| 16467 | const param_str = "v."; | |
| 16468 | const attributes = Attributes{ | |
| 16469 | .@"const" = true, | |
| 16470 | .custom_typecheck = true, | |
| 16471 | }; | |
| 16472 | }; | |
| 16473 | ||
| 16474 | pub const __builtin_reduce_mul = struct { | |
| 16475 | const param_str = "v."; | |
| 16476 | const attributes = Attributes{ | |
| 16477 | .@"const" = true, | |
| 16478 | .custom_typecheck = true, | |
| 16479 | }; | |
| 16480 | }; | |
| 16481 | ||
| 16482 | pub const __builtin_reduce_or = struct { | |
| 16483 | const param_str = "v."; | |
| 16484 | const attributes = Attributes{ | |
| 16485 | .@"const" = true, | |
| 16486 | .custom_typecheck = true, | |
| 16487 | }; | |
| 16488 | }; | |
| 16489 | ||
| 16490 | pub const __builtin_reduce_xor = struct { | |
| 16491 | const param_str = "v."; | |
| 16492 | const attributes = Attributes{ | |
| 16493 | .@"const" = true, | |
| 16494 | .custom_typecheck = true, | |
| 16495 | }; | |
| 16496 | }; | |
| 16497 | ||
| 16498 | pub const __builtin_remainder = struct { | |
| 16499 | const param_str = "ddd"; | |
| 16500 | const attributes = Attributes{ | |
| 16501 | .lib_function_with_builtin_prefix = true, | |
| 16502 | .const_without_errno_and_fp_exceptions = true, | |
| 16503 | }; | |
| 16504 | }; | |
| 16505 | ||
| 16506 | pub const __builtin_remainderf = struct { | |
| 16507 | const param_str = "fff"; | |
| 16508 | const attributes = Attributes{ | |
| 16509 | .lib_function_with_builtin_prefix = true, | |
| 16510 | .const_without_errno_and_fp_exceptions = true, | |
| 16511 | }; | |
| 16512 | }; | |
| 16513 | ||
| 16514 | pub const __builtin_remainderf128 = struct { | |
| 16515 | const param_str = "LLdLLdLLd"; | |
| 16516 | const attributes = Attributes{ | |
| 16517 | .lib_function_with_builtin_prefix = true, | |
| 16518 | .const_without_errno_and_fp_exceptions = true, | |
| 16519 | }; | |
| 16520 | }; | |
| 16521 | ||
| 16522 | pub const __builtin_remainderl = struct { | |
| 16523 | const param_str = "LdLdLd"; | |
| 16524 | const attributes = Attributes{ | |
| 16525 | .lib_function_with_builtin_prefix = true, | |
| 16526 | .const_without_errno_and_fp_exceptions = true, | |
| 16527 | }; | |
| 16528 | }; | |
| 16529 | ||
| 16530 | pub const __builtin_remquo = struct { | |
| 16531 | const param_str = "dddi*"; | |
| 16532 | const attributes = Attributes{ | |
| 16533 | .lib_function_with_builtin_prefix = true, | |
| 16534 | }; | |
| 16535 | }; | |
| 16536 | ||
| 16537 | pub const __builtin_remquof = struct { | |
| 16538 | const param_str = "fffi*"; | |
| 16539 | const attributes = Attributes{ | |
| 16540 | .lib_function_with_builtin_prefix = true, | |
| 16541 | }; | |
| 16542 | }; | |
| 16543 | ||
| 16544 | pub const __builtin_remquof128 = struct { | |
| 16545 | const param_str = "LLdLLdLLdi*"; | |
| 16546 | const attributes = Attributes{ | |
| 16547 | .lib_function_with_builtin_prefix = true, | |
| 16548 | }; | |
| 16549 | }; | |
| 16550 | ||
| 16551 | pub const __builtin_remquol = struct { | |
| 16552 | const param_str = "LdLdLdi*"; | |
| 16553 | const attributes = Attributes{ | |
| 16554 | .lib_function_with_builtin_prefix = true, | |
| 16555 | }; | |
| 16556 | }; | |
| 16557 | ||
| 16558 | pub const __builtin_return_address = struct { | |
| 16559 | const param_str = "v*IUi"; | |
| 16560 | const attributes = Attributes{}; | |
| 16561 | }; | |
| 16562 | ||
| 16563 | pub const __builtin_rindex = struct { | |
| 16564 | const param_str = "c*cC*i"; | |
| 16565 | const attributes = Attributes{ | |
| 16566 | .lib_function_with_builtin_prefix = true, | |
| 16567 | }; | |
| 16568 | }; | |
| 16569 | ||
| 16570 | pub const __builtin_rint = struct { | |
| 16571 | const param_str = "dd"; | |
| 16572 | const attributes = Attributes{ | |
| 16573 | .@"const" = true, | |
| 16574 | .lib_function_with_builtin_prefix = true, | |
| 16575 | }; | |
| 16576 | }; | |
| 16577 | ||
| 16578 | pub const __builtin_rintf = struct { | |
| 16579 | const param_str = "ff"; | |
| 16580 | const attributes = Attributes{ | |
| 16581 | .@"const" = true, | |
| 16582 | .lib_function_with_builtin_prefix = true, | |
| 16583 | }; | |
| 16584 | }; | |
| 16585 | ||
| 16586 | pub const __builtin_rintf128 = struct { | |
| 16587 | const param_str = "LLdLLd"; | |
| 16588 | const attributes = Attributes{ | |
| 16589 | .@"const" = true, | |
| 16590 | .lib_function_with_builtin_prefix = true, | |
| 16591 | }; | |
| 16592 | }; | |
| 16593 | ||
| 16594 | pub const __builtin_rintf16 = struct { | |
| 16595 | const param_str = "hh"; | |
| 16596 | const attributes = Attributes{ | |
| 16597 | .@"const" = true, | |
| 16598 | .lib_function_with_builtin_prefix = true, | |
| 16599 | }; | |
| 16600 | }; | |
| 16601 | ||
| 16602 | pub const __builtin_rintl = struct { | |
| 16603 | const param_str = "LdLd"; | |
| 16604 | const attributes = Attributes{ | |
| 16605 | .@"const" = true, | |
| 16606 | .lib_function_with_builtin_prefix = true, | |
| 16607 | }; | |
| 16608 | }; | |
| 16609 | ||
| 16610 | pub const __builtin_rotateleft16 = struct { | |
| 16611 | const param_str = "UsUsUs"; | |
| 16612 | const attributes = Attributes{ | |
| 16613 | .@"const" = true, | |
| 16614 | .const_evaluable = true, | |
| 16615 | }; | |
| 16616 | }; | |
| 16617 | ||
| 16618 | pub const __builtin_rotateleft32 = struct { | |
| 16619 | const param_str = "UZiUZiUZi"; | |
| 16620 | const attributes = Attributes{ | |
| 16621 | .@"const" = true, | |
| 16622 | .const_evaluable = true, | |
| 16623 | }; | |
| 16624 | }; | |
| 16625 | ||
| 16626 | pub const __builtin_rotateleft64 = struct { | |
| 16627 | const param_str = "UWiUWiUWi"; | |
| 16628 | const attributes = Attributes{ | |
| 16629 | .@"const" = true, | |
| 16630 | .const_evaluable = true, | |
| 16631 | }; | |
| 16632 | }; | |
| 16633 | ||
| 16634 | pub const __builtin_rotateleft8 = struct { | |
| 16635 | const param_str = "UcUcUc"; | |
| 16636 | const attributes = Attributes{ | |
| 16637 | .@"const" = true, | |
| 16638 | .const_evaluable = true, | |
| 16639 | }; | |
| 16640 | }; | |
| 16641 | ||
| 16642 | pub const __builtin_rotateright16 = struct { | |
| 16643 | const param_str = "UsUsUs"; | |
| 16644 | const attributes = Attributes{ | |
| 16645 | .@"const" = true, | |
| 16646 | .const_evaluable = true, | |
| 16647 | }; | |
| 16648 | }; | |
| 16649 | ||
| 16650 | pub const __builtin_rotateright32 = struct { | |
| 16651 | const param_str = "UZiUZiUZi"; | |
| 16652 | const attributes = Attributes{ | |
| 16653 | .@"const" = true, | |
| 16654 | .const_evaluable = true, | |
| 16655 | }; | |
| 16656 | }; | |
| 16657 | ||
| 16658 | pub const __builtin_rotateright64 = struct { | |
| 16659 | const param_str = "UWiUWiUWi"; | |
| 16660 | const attributes = Attributes{ | |
| 16661 | .@"const" = true, | |
| 16662 | .const_evaluable = true, | |
| 16663 | }; | |
| 16664 | }; | |
| 16665 | ||
| 16666 | pub const __builtin_rotateright8 = struct { | |
| 16667 | const param_str = "UcUcUc"; | |
| 16668 | const attributes = Attributes{ | |
| 16669 | .@"const" = true, | |
| 16670 | .const_evaluable = true, | |
| 16671 | }; | |
| 16672 | }; | |
| 16673 | ||
| 16674 | pub const __builtin_round = struct { | |
| 16675 | const param_str = "dd"; | |
| 16676 | const attributes = Attributes{ | |
| 16677 | .@"const" = true, | |
| 16678 | .lib_function_with_builtin_prefix = true, | |
| 16679 | }; | |
| 16680 | }; | |
| 16681 | ||
| 16682 | pub const __builtin_roundf = struct { | |
| 16683 | const param_str = "ff"; | |
| 16684 | const attributes = Attributes{ | |
| 16685 | .@"const" = true, | |
| 16686 | .lib_function_with_builtin_prefix = true, | |
| 16687 | }; | |
| 16688 | }; | |
| 16689 | ||
| 16690 | pub const __builtin_roundf128 = struct { | |
| 16691 | const param_str = "LLdLLd"; | |
| 16692 | const attributes = Attributes{ | |
| 16693 | .@"const" = true, | |
| 16694 | .lib_function_with_builtin_prefix = true, | |
| 16695 | }; | |
| 16696 | }; | |
| 16697 | ||
| 16698 | pub const __builtin_roundf16 = struct { | |
| 16699 | const param_str = "hh"; | |
| 16700 | const attributes = Attributes{ | |
| 16701 | .@"const" = true, | |
| 16702 | .lib_function_with_builtin_prefix = true, | |
| 16703 | }; | |
| 16704 | }; | |
| 16705 | ||
| 16706 | pub const __builtin_roundl = struct { | |
| 16707 | const param_str = "LdLd"; | |
| 16708 | const attributes = Attributes{ | |
| 16709 | .@"const" = true, | |
| 16710 | .lib_function_with_builtin_prefix = true, | |
| 16711 | }; | |
| 16712 | }; | |
| 16713 | ||
| 16714 | pub const __builtin_sadd_overflow = struct { | |
| 16715 | const param_str = "bSiCSiCSi*"; | |
| 16716 | const attributes = Attributes{ | |
| 16717 | .const_evaluable = true, | |
| 16718 | }; | |
| 16719 | }; | |
| 16720 | ||
| 16721 | pub const __builtin_saddl_overflow = struct { | |
| 16722 | const param_str = "bSLiCSLiCSLi*"; | |
| 16723 | const attributes = Attributes{ | |
| 16724 | .const_evaluable = true, | |
| 16725 | }; | |
| 16726 | }; | |
| 16727 | ||
| 16728 | pub const __builtin_saddll_overflow = struct { | |
| 16729 | const param_str = "bSLLiCSLLiCSLLi*"; | |
| 16730 | const attributes = Attributes{ | |
| 16731 | .const_evaluable = true, | |
| 16732 | }; | |
| 16733 | }; | |
| 16734 | ||
| 16735 | pub const __builtin_scalbln = struct { | |
| 16736 | const param_str = "ddLi"; | |
| 16737 | const attributes = Attributes{ | |
| 16738 | .lib_function_with_builtin_prefix = true, | |
| 16739 | .const_without_errno_and_fp_exceptions = true, | |
| 16740 | }; | |
| 16741 | }; | |
| 16742 | ||
| 16743 | pub const __builtin_scalblnf = struct { | |
| 16744 | const param_str = "ffLi"; | |
| 16745 | const attributes = Attributes{ | |
| 16746 | .lib_function_with_builtin_prefix = true, | |
| 16747 | .const_without_errno_and_fp_exceptions = true, | |
| 16748 | }; | |
| 16749 | }; | |
| 16750 | ||
| 16751 | pub const __builtin_scalblnf128 = struct { | |
| 16752 | const param_str = "LLdLLdLi"; | |
| 16753 | const attributes = Attributes{ | |
| 16754 | .lib_function_with_builtin_prefix = true, | |
| 16755 | .const_without_errno_and_fp_exceptions = true, | |
| 16756 | }; | |
| 16757 | }; | |
| 16758 | ||
| 16759 | pub const __builtin_scalblnl = struct { | |
| 16760 | const param_str = "LdLdLi"; | |
| 16761 | const attributes = Attributes{ | |
| 16762 | .lib_function_with_builtin_prefix = true, | |
| 16763 | .const_without_errno_and_fp_exceptions = true, | |
| 16764 | }; | |
| 16765 | }; | |
| 16766 | ||
| 16767 | pub const __builtin_scalbn = struct { | |
| 16768 | const param_str = "ddi"; | |
| 16769 | const attributes = Attributes{ | |
| 16770 | .lib_function_with_builtin_prefix = true, | |
| 16771 | .const_without_errno_and_fp_exceptions = true, | |
| 16772 | }; | |
| 16773 | }; | |
| 16774 | ||
| 16775 | pub const __builtin_scalbnf = struct { | |
| 16776 | const param_str = "ffi"; | |
| 16777 | const attributes = Attributes{ | |
| 16778 | .lib_function_with_builtin_prefix = true, | |
| 16779 | .const_without_errno_and_fp_exceptions = true, | |
| 16780 | }; | |
| 16781 | }; | |
| 16782 | ||
| 16783 | pub const __builtin_scalbnf128 = struct { | |
| 16784 | const param_str = "LLdLLdi"; | |
| 16785 | const attributes = Attributes{ | |
| 16786 | .lib_function_with_builtin_prefix = true, | |
| 16787 | .const_without_errno_and_fp_exceptions = true, | |
| 16788 | }; | |
| 16789 | }; | |
| 16790 | ||
| 16791 | pub const __builtin_scalbnl = struct { | |
| 16792 | const param_str = "LdLdi"; | |
| 16793 | const attributes = Attributes{ | |
| 16794 | .lib_function_with_builtin_prefix = true, | |
| 16795 | .const_without_errno_and_fp_exceptions = true, | |
| 16796 | }; | |
| 16797 | }; | |
| 16798 | ||
| 16799 | pub const __builtin_set_texasr = struct { | |
| 16800 | const param_str = "vLUi"; | |
| 16801 | const target_set = TargetSet.init(.{ | |
| 16802 | .ppc = true, | |
| 16803 | }); | |
| 16804 | const attributes = Attributes{ | |
| 16805 | .@"const" = true, | |
| 16806 | }; | |
| 16807 | }; | |
| 16808 | ||
| 16809 | pub const __builtin_set_texasru = struct { | |
| 16810 | const param_str = "vLUi"; | |
| 16811 | const target_set = TargetSet.init(.{ | |
| 16812 | .ppc = true, | |
| 16813 | }); | |
| 16814 | const attributes = Attributes{ | |
| 16815 | .@"const" = true, | |
| 16816 | }; | |
| 16817 | }; | |
| 16818 | ||
| 16819 | pub const __builtin_set_tfhar = struct { | |
| 16820 | const param_str = "vLUi"; | |
| 16821 | const target_set = TargetSet.init(.{ | |
| 16822 | .ppc = true, | |
| 16823 | }); | |
| 16824 | const attributes = Attributes{ | |
| 16825 | .@"const" = true, | |
| 16826 | }; | |
| 16827 | }; | |
| 16828 | ||
| 16829 | pub const __builtin_set_tfiar = struct { | |
| 16830 | const param_str = "vLUi"; | |
| 16831 | const target_set = TargetSet.init(.{ | |
| 16832 | .ppc = true, | |
| 16833 | }); | |
| 16834 | const attributes = Attributes{ | |
| 16835 | .@"const" = true, | |
| 16836 | }; | |
| 16837 | }; | |
| 16838 | ||
| 16839 | pub const __builtin_setflm = struct { | |
| 16840 | const param_str = "dd"; | |
| 16841 | const target_set = TargetSet.init(.{ | |
| 16842 | .ppc = true, | |
| 16843 | }); | |
| 16844 | }; | |
| 16845 | ||
| 16846 | pub const __builtin_setjmp = struct { | |
| 16847 | const param_str = "iv**"; | |
| 16848 | const attributes = Attributes{ | |
| 16849 | .returns_twice = true, | |
| 16850 | }; | |
| 16851 | }; | |
| 16852 | ||
| 16853 | pub const __builtin_setps = struct { | |
| 16854 | const param_str = "vUiUi"; | |
| 16855 | const target_set = TargetSet.init(.{ | |
| 16856 | .xcore = true, | |
| 16857 | }); | |
| 16858 | const attributes = Attributes{}; | |
| 16859 | }; | |
| 16860 | ||
| 16861 | pub const __builtin_setrnd = struct { | |
| 16862 | const param_str = "di"; | |
| 16863 | const target_set = TargetSet.init(.{ | |
| 16864 | .ppc = true, | |
| 16865 | }); | |
| 16866 | }; | |
| 16867 | ||
| 16868 | pub const __builtin_shufflevector = struct { | |
| 16869 | const param_str = "v."; | |
| 16870 | const attributes = Attributes{ | |
| 16871 | .@"const" = true, | |
| 16872 | .custom_typecheck = true, | |
| 16873 | }; | |
| 16874 | }; | |
| 16875 | ||
| 16876 | pub const __builtin_signbit = struct { | |
| 16877 | const param_str = "i."; | |
| 16878 | const attributes = Attributes{ | |
| 16879 | .@"const" = true, | |
| 16880 | .custom_typecheck = true, | |
| 16881 | .lib_function_with_builtin_prefix = true, | |
| 16882 | }; | |
| 16883 | }; | |
| 16884 | ||
| 16885 | pub const __builtin_signbitf = struct { | |
| 16886 | const param_str = "if"; | |
| 16887 | const attributes = Attributes{ | |
| 16888 | .@"const" = true, | |
| 16889 | .lib_function_with_builtin_prefix = true, | |
| 16890 | }; | |
| 16891 | }; | |
| 16892 | ||
| 16893 | pub const __builtin_signbitl = struct { | |
| 16894 | const param_str = "iLd"; | |
| 16895 | const attributes = Attributes{ | |
| 16896 | .@"const" = true, | |
| 16897 | .lib_function_with_builtin_prefix = true, | |
| 16898 | }; | |
| 16899 | }; | |
| 16900 | ||
| 16901 | pub const __builtin_sin = struct { | |
| 16902 | const param_str = "dd"; | |
| 16903 | const attributes = Attributes{ | |
| 16904 | .lib_function_with_builtin_prefix = true, | |
| 16905 | .const_without_errno_and_fp_exceptions = true, | |
| 16906 | }; | |
| 16907 | }; | |
| 16908 | ||
| 16909 | pub const __builtin_sinf = struct { | |
| 16910 | const param_str = "ff"; | |
| 16911 | const attributes = Attributes{ | |
| 16912 | .lib_function_with_builtin_prefix = true, | |
| 16913 | .const_without_errno_and_fp_exceptions = true, | |
| 16914 | }; | |
| 16915 | }; | |
| 16916 | ||
| 16917 | pub const __builtin_sinf128 = struct { | |
| 16918 | const param_str = "LLdLLd"; | |
| 16919 | const attributes = Attributes{ | |
| 16920 | .lib_function_with_builtin_prefix = true, | |
| 16921 | .const_without_errno_and_fp_exceptions = true, | |
| 16922 | }; | |
| 16923 | }; | |
| 16924 | ||
| 16925 | pub const __builtin_sinf16 = struct { | |
| 16926 | const param_str = "hh"; | |
| 16927 | const attributes = Attributes{ | |
| 16928 | .lib_function_with_builtin_prefix = true, | |
| 16929 | .const_without_errno_and_fp_exceptions = true, | |
| 16930 | }; | |
| 16931 | }; | |
| 16932 | ||
| 16933 | pub const __builtin_sinh = struct { | |
| 16934 | const param_str = "dd"; | |
| 16935 | const attributes = Attributes{ | |
| 16936 | .lib_function_with_builtin_prefix = true, | |
| 16937 | .const_without_errno_and_fp_exceptions = true, | |
| 16938 | }; | |
| 16939 | }; | |
| 16940 | ||
| 16941 | pub const __builtin_sinhf = struct { | |
| 16942 | const param_str = "ff"; | |
| 16943 | const attributes = Attributes{ | |
| 16944 | .lib_function_with_builtin_prefix = true, | |
| 16945 | .const_without_errno_and_fp_exceptions = true, | |
| 16946 | }; | |
| 16947 | }; | |
| 16948 | ||
| 16949 | pub const __builtin_sinhf128 = struct { | |
| 16950 | const param_str = "LLdLLd"; | |
| 16951 | const attributes = Attributes{ | |
| 16952 | .lib_function_with_builtin_prefix = true, | |
| 16953 | .const_without_errno_and_fp_exceptions = true, | |
| 16954 | }; | |
| 16955 | }; | |
| 16956 | ||
| 16957 | pub const __builtin_sinhl = struct { | |
| 16958 | const param_str = "LdLd"; | |
| 16959 | const attributes = Attributes{ | |
| 16960 | .lib_function_with_builtin_prefix = true, | |
| 16961 | .const_without_errno_and_fp_exceptions = true, | |
| 16962 | }; | |
| 16963 | }; | |
| 16964 | ||
| 16965 | pub const __builtin_sinl = struct { | |
| 16966 | const param_str = "LdLd"; | |
| 16967 | const attributes = Attributes{ | |
| 16968 | .lib_function_with_builtin_prefix = true, | |
| 16969 | .const_without_errno_and_fp_exceptions = true, | |
| 16970 | }; | |
| 16971 | }; | |
| 16972 | ||
| 16973 | pub const __builtin_smul_overflow = struct { | |
| 16974 | const param_str = "bSiCSiCSi*"; | |
| 16975 | const attributes = Attributes{ | |
| 16976 | .const_evaluable = true, | |
| 16977 | }; | |
| 16978 | }; | |
| 16979 | ||
| 16980 | pub const __builtin_smull_overflow = struct { | |
| 16981 | const param_str = "bSLiCSLiCSLi*"; | |
| 16982 | const attributes = Attributes{ | |
| 16983 | .const_evaluable = true, | |
| 16984 | }; | |
| 16985 | }; | |
| 16986 | ||
| 16987 | pub const __builtin_smulll_overflow = struct { | |
| 16988 | const param_str = "bSLLiCSLLiCSLLi*"; | |
| 16989 | const attributes = Attributes{ | |
| 16990 | .const_evaluable = true, | |
| 16991 | }; | |
| 16992 | }; | |
| 16993 | ||
| 16994 | pub const __builtin_snprintf = struct { | |
| 16995 | const param_str = "ic*zcC*."; | |
| 16996 | const attributes = Attributes{ | |
| 16997 | .lib_function_with_builtin_prefix = true, | |
| 16998 | .format_kind = .printf, | |
| 16999 | .format_string_position = 2, | |
| 17000 | }; | |
| 17001 | }; | |
| 17002 | ||
| 17003 | pub const __builtin_sponentry = struct { | |
| 17004 | const param_str = "v*"; | |
| 17005 | const target_set = TargetSet.init(.{ | |
| 17006 | .aarch64 = true, | |
| 17007 | .arm = true, | |
| 17008 | }); | |
| 17009 | const attributes = Attributes{ | |
| 17010 | .@"const" = true, | |
| 17011 | }; | |
| 17012 | }; | |
| 17013 | ||
| 17014 | pub const __builtin_sprintf = struct { | |
| 17015 | const param_str = "ic*cC*."; | |
| 17016 | const attributes = Attributes{ | |
| 17017 | .lib_function_with_builtin_prefix = true, | |
| 17018 | .format_kind = .vprintf, | |
| 17019 | .format_string_position = 1, | |
| 17020 | }; | |
| 17021 | }; | |
| 17022 | ||
| 17023 | pub const __builtin_sqrt = struct { | |
| 17024 | const param_str = "dd"; | |
| 17025 | const attributes = Attributes{ | |
| 17026 | .lib_function_with_builtin_prefix = true, | |
| 17027 | .const_without_errno_and_fp_exceptions = true, | |
| 17028 | }; | |
| 17029 | }; | |
| 17030 | ||
| 17031 | pub const __builtin_sqrtf = struct { | |
| 17032 | const param_str = "ff"; | |
| 17033 | const attributes = Attributes{ | |
| 17034 | .lib_function_with_builtin_prefix = true, | |
| 17035 | .const_without_errno_and_fp_exceptions = true, | |
| 17036 | }; | |
| 17037 | }; | |
| 17038 | ||
| 17039 | pub const __builtin_sqrtf128 = struct { | |
| 17040 | const param_str = "LLdLLd"; | |
| 17041 | const attributes = Attributes{ | |
| 17042 | .lib_function_with_builtin_prefix = true, | |
| 17043 | .const_without_errno_and_fp_exceptions = true, | |
| 17044 | }; | |
| 17045 | }; | |
| 17046 | ||
| 17047 | pub const __builtin_sqrtf128_round_to_odd = struct { | |
| 17048 | const param_str = "LLdLLd"; | |
| 17049 | const target_set = TargetSet.init(.{ | |
| 17050 | .ppc = true, | |
| 17051 | }); | |
| 17052 | }; | |
| 17053 | ||
| 17054 | pub const __builtin_sqrtf16 = struct { | |
| 17055 | const param_str = "hh"; | |
| 17056 | const attributes = Attributes{ | |
| 17057 | .lib_function_with_builtin_prefix = true, | |
| 17058 | .const_without_errno_and_fp_exceptions = true, | |
| 17059 | }; | |
| 17060 | }; | |
| 17061 | ||
| 17062 | pub const __builtin_sqrtl = struct { | |
| 17063 | const param_str = "LdLd"; | |
| 17064 | const attributes = Attributes{ | |
| 17065 | .lib_function_with_builtin_prefix = true, | |
| 17066 | .const_without_errno_and_fp_exceptions = true, | |
| 17067 | }; | |
| 17068 | }; | |
| 17069 | ||
| 17070 | pub const __builtin_ssub_overflow = struct { | |
| 17071 | const param_str = "bSiCSiCSi*"; | |
| 17072 | const attributes = Attributes{ | |
| 17073 | .const_evaluable = true, | |
| 17074 | }; | |
| 17075 | }; | |
| 17076 | ||
| 17077 | pub const __builtin_ssubl_overflow = struct { | |
| 17078 | const param_str = "bSLiCSLiCSLi*"; | |
| 17079 | const attributes = Attributes{ | |
| 17080 | .const_evaluable = true, | |
| 17081 | }; | |
| 17082 | }; | |
| 17083 | ||
| 17084 | pub const __builtin_ssubll_overflow = struct { | |
| 17085 | const param_str = "bSLLiCSLLiCSLLi*"; | |
| 17086 | const attributes = Attributes{ | |
| 17087 | .const_evaluable = true, | |
| 17088 | }; | |
| 17089 | }; | |
| 17090 | ||
| 17091 | pub const __builtin_stdarg_start = struct { | |
| 17092 | const param_str = "vA."; | |
| 17093 | const attributes = Attributes{ | |
| 17094 | .custom_typecheck = true, | |
| 17095 | }; | |
| 17096 | }; | |
| 17097 | ||
| 17098 | pub const __builtin_stpcpy = struct { | |
| 17099 | const param_str = "c*c*cC*"; | |
| 17100 | const attributes = Attributes{ | |
| 17101 | .lib_function_with_builtin_prefix = true, | |
| 17102 | }; | |
| 17103 | }; | |
| 17104 | ||
| 17105 | pub const __builtin_stpncpy = struct { | |
| 17106 | const param_str = "c*c*cC*z"; | |
| 17107 | const attributes = Attributes{ | |
| 17108 | .lib_function_with_builtin_prefix = true, | |
| 17109 | }; | |
| 17110 | }; | |
| 17111 | ||
| 17112 | pub const __builtin_strcasecmp = struct { | |
| 17113 | const param_str = "icC*cC*"; | |
| 17114 | const attributes = Attributes{ | |
| 17115 | .lib_function_with_builtin_prefix = true, | |
| 17116 | }; | |
| 17117 | }; | |
| 17118 | ||
| 17119 | pub const __builtin_strcat = struct { | |
| 17120 | const param_str = "c*c*cC*"; | |
| 17121 | const attributes = Attributes{ | |
| 17122 | .lib_function_with_builtin_prefix = true, | |
| 17123 | }; | |
| 17124 | }; | |
| 17125 | ||
| 17126 | pub const __builtin_strchr = struct { | |
| 17127 | const param_str = "c*cC*i"; | |
| 17128 | const attributes = Attributes{ | |
| 17129 | .lib_function_with_builtin_prefix = true, | |
| 17130 | .const_evaluable = true, | |
| 17131 | }; | |
| 17132 | }; | |
| 17133 | ||
| 17134 | pub const __builtin_strcmp = struct { | |
| 17135 | const param_str = "icC*cC*"; | |
| 17136 | const attributes = Attributes{ | |
| 17137 | .lib_function_with_builtin_prefix = true, | |
| 17138 | .const_evaluable = true, | |
| 17139 | }; | |
| 17140 | }; | |
| 17141 | ||
| 17142 | pub const __builtin_strcpy = struct { | |
| 17143 | const param_str = "c*c*cC*"; | |
| 17144 | const attributes = Attributes{ | |
| 17145 | .lib_function_with_builtin_prefix = true, | |
| 17146 | }; | |
| 17147 | }; | |
| 17148 | ||
| 17149 | pub const __builtin_strcspn = struct { | |
| 17150 | const param_str = "zcC*cC*"; | |
| 17151 | const attributes = Attributes{ | |
| 17152 | .lib_function_with_builtin_prefix = true, | |
| 17153 | }; | |
| 17154 | }; | |
| 17155 | ||
| 17156 | pub const __builtin_strdup = struct { | |
| 17157 | const param_str = "c*cC*"; | |
| 17158 | const attributes = Attributes{ | |
| 17159 | .lib_function_with_builtin_prefix = true, | |
| 17160 | }; | |
| 17161 | }; | |
| 17162 | ||
| 17163 | pub const __builtin_strlen = struct { | |
| 17164 | const param_str = "zcC*"; | |
| 17165 | const attributes = Attributes{ | |
| 17166 | .lib_function_with_builtin_prefix = true, | |
| 17167 | .const_evaluable = true, | |
| 17168 | }; | |
| 17169 | }; | |
| 17170 | ||
| 17171 | pub const __builtin_strncasecmp = struct { | |
| 17172 | const param_str = "icC*cC*z"; | |
| 17173 | const attributes = Attributes{ | |
| 17174 | .lib_function_with_builtin_prefix = true, | |
| 17175 | }; | |
| 17176 | }; | |
| 17177 | ||
| 17178 | pub const __builtin_strncat = struct { | |
| 17179 | const param_str = "c*c*cC*z"; | |
| 17180 | const attributes = Attributes{ | |
| 17181 | .lib_function_with_builtin_prefix = true, | |
| 17182 | }; | |
| 17183 | }; | |
| 17184 | ||
| 17185 | pub const __builtin_strncmp = struct { | |
| 17186 | const param_str = "icC*cC*z"; | |
| 17187 | const attributes = Attributes{ | |
| 17188 | .lib_function_with_builtin_prefix = true, | |
| 17189 | .const_evaluable = true, | |
| 17190 | }; | |
| 17191 | }; | |
| 17192 | ||
| 17193 | pub const __builtin_strncpy = struct { | |
| 17194 | const param_str = "c*c*cC*z"; | |
| 17195 | const attributes = Attributes{ | |
| 17196 | .lib_function_with_builtin_prefix = true, | |
| 17197 | }; | |
| 17198 | }; | |
| 17199 | ||
| 17200 | pub const __builtin_strndup = struct { | |
| 17201 | const param_str = "c*cC*z"; | |
| 17202 | const attributes = Attributes{ | |
| 17203 | .lib_function_with_builtin_prefix = true, | |
| 17204 | }; | |
| 17205 | }; | |
| 17206 | ||
| 17207 | pub const __builtin_strpbrk = struct { | |
| 17208 | const param_str = "c*cC*cC*"; | |
| 17209 | const attributes = Attributes{ | |
| 17210 | .lib_function_with_builtin_prefix = true, | |
| 17211 | }; | |
| 17212 | }; | |
| 17213 | ||
| 17214 | pub const __builtin_strrchr = struct { | |
| 17215 | const param_str = "c*cC*i"; | |
| 17216 | const attributes = Attributes{ | |
| 17217 | .lib_function_with_builtin_prefix = true, | |
| 17218 | }; | |
| 17219 | }; | |
| 17220 | ||
| 17221 | pub const __builtin_strspn = struct { | |
| 17222 | const param_str = "zcC*cC*"; | |
| 17223 | const attributes = Attributes{ | |
| 17224 | .lib_function_with_builtin_prefix = true, | |
| 17225 | }; | |
| 17226 | }; | |
| 17227 | ||
| 17228 | pub const __builtin_strstr = struct { | |
| 17229 | const param_str = "c*cC*cC*"; | |
| 17230 | const attributes = Attributes{ | |
| 17231 | .lib_function_with_builtin_prefix = true, | |
| 17232 | }; | |
| 17233 | }; | |
| 17234 | ||
| 17235 | pub const __builtin_sub_overflow = struct { | |
| 17236 | const param_str = "b."; | |
| 17237 | const attributes = Attributes{ | |
| 17238 | .custom_typecheck = true, | |
| 17239 | .const_evaluable = true, | |
| 17240 | }; | |
| 17241 | }; | |
| 17242 | ||
| 17243 | pub const __builtin_subc = struct { | |
| 17244 | const param_str = "UiUiCUiCUiCUi*"; | |
| 17245 | const attributes = Attributes{}; | |
| 17246 | }; | |
| 17247 | ||
| 17248 | pub const __builtin_subcb = struct { | |
| 17249 | const param_str = "UcUcCUcCUcCUc*"; | |
| 17250 | const attributes = Attributes{}; | |
| 17251 | }; | |
| 17252 | ||
| 17253 | pub const __builtin_subcl = struct { | |
| 17254 | const param_str = "ULiULiCULiCULiCULi*"; | |
| 17255 | const attributes = Attributes{}; | |
| 17256 | }; | |
| 17257 | ||
| 17258 | pub const __builtin_subcll = struct { | |
| 17259 | const param_str = "ULLiULLiCULLiCULLiCULLi*"; | |
| 17260 | const attributes = Attributes{}; | |
| 17261 | }; | |
| 17262 | ||
| 17263 | pub const __builtin_subcs = struct { | |
| 17264 | const param_str = "UsUsCUsCUsCUs*"; | |
| 17265 | const attributes = Attributes{}; | |
| 17266 | }; | |
| 17267 | ||
| 17268 | pub const __builtin_subf128_round_to_odd = struct { | |
| 17269 | const param_str = "LLdLLdLLd"; | |
| 17270 | const target_set = TargetSet.init(.{ | |
| 17271 | .ppc = true, | |
| 17272 | }); | |
| 17273 | }; | |
| 17274 | ||
| 17275 | pub const __builtin_tabort = struct { | |
| 17276 | const param_str = "UiUi"; | |
| 17277 | const target_set = TargetSet.init(.{ | |
| 17278 | .ppc = true, | |
| 17279 | }); | |
| 17280 | }; | |
| 17281 | ||
| 17282 | pub const __builtin_tabortdc = struct { | |
| 17283 | const param_str = "UiUiUiUi"; | |
| 17284 | const target_set = TargetSet.init(.{ | |
| 17285 | .ppc = true, | |
| 17286 | }); | |
| 17287 | }; | |
| 17288 | ||
| 17289 | pub const __builtin_tabortdci = struct { | |
| 17290 | const param_str = "UiUiUii"; | |
| 17291 | const target_set = TargetSet.init(.{ | |
| 17292 | .ppc = true, | |
| 17293 | }); | |
| 17294 | }; | |
| 17295 | ||
| 17296 | pub const __builtin_tabortwc = struct { | |
| 17297 | const param_str = "UiUiUiUi"; | |
| 17298 | const target_set = TargetSet.init(.{ | |
| 17299 | .ppc = true, | |
| 17300 | }); | |
| 17301 | }; | |
| 17302 | ||
| 17303 | pub const __builtin_tabortwci = struct { | |
| 17304 | const param_str = "UiUiUii"; | |
| 17305 | const target_set = TargetSet.init(.{ | |
| 17306 | .ppc = true, | |
| 17307 | }); | |
| 17308 | }; | |
| 17309 | ||
| 17310 | pub const __builtin_tan = struct { | |
| 17311 | const param_str = "dd"; | |
| 17312 | const attributes = Attributes{ | |
| 17313 | .lib_function_with_builtin_prefix = true, | |
| 17314 | .const_without_errno_and_fp_exceptions = true, | |
| 17315 | }; | |
| 17316 | }; | |
| 17317 | ||
| 17318 | pub const __builtin_tanf = struct { | |
| 17319 | const param_str = "ff"; | |
| 17320 | const attributes = Attributes{ | |
| 17321 | .lib_function_with_builtin_prefix = true, | |
| 17322 | .const_without_errno_and_fp_exceptions = true, | |
| 17323 | }; | |
| 17324 | }; | |
| 17325 | ||
| 17326 | pub const __builtin_tanf128 = struct { | |
| 17327 | const param_str = "LLdLLd"; | |
| 17328 | const attributes = Attributes{ | |
| 17329 | .lib_function_with_builtin_prefix = true, | |
| 17330 | .const_without_errno_and_fp_exceptions = true, | |
| 17331 | }; | |
| 17332 | }; | |
| 17333 | ||
| 17334 | pub const __builtin_tanh = struct { | |
| 17335 | const param_str = "dd"; | |
| 17336 | const attributes = Attributes{ | |
| 17337 | .lib_function_with_builtin_prefix = true, | |
| 17338 | .const_without_errno_and_fp_exceptions = true, | |
| 17339 | }; | |
| 17340 | }; | |
| 17341 | ||
| 17342 | pub const __builtin_tanhf = struct { | |
| 17343 | const param_str = "ff"; | |
| 17344 | const attributes = Attributes{ | |
| 17345 | .lib_function_with_builtin_prefix = true, | |
| 17346 | .const_without_errno_and_fp_exceptions = true, | |
| 17347 | }; | |
| 17348 | }; | |
| 17349 | ||
| 17350 | pub const __builtin_tanhf128 = struct { | |
| 17351 | const param_str = "LLdLLd"; | |
| 17352 | const attributes = Attributes{ | |
| 17353 | .lib_function_with_builtin_prefix = true, | |
| 17354 | .const_without_errno_and_fp_exceptions = true, | |
| 17355 | }; | |
| 17356 | }; | |
| 17357 | ||
| 17358 | pub const __builtin_tanhl = struct { | |
| 17359 | const param_str = "LdLd"; | |
| 17360 | const attributes = Attributes{ | |
| 17361 | .lib_function_with_builtin_prefix = true, | |
| 17362 | .const_without_errno_and_fp_exceptions = true, | |
| 17363 | }; | |
| 17364 | }; | |
| 17365 | ||
| 17366 | pub const __builtin_tanl = struct { | |
| 17367 | const param_str = "LdLd"; | |
| 17368 | const attributes = Attributes{ | |
| 17369 | .lib_function_with_builtin_prefix = true, | |
| 17370 | .const_without_errno_and_fp_exceptions = true, | |
| 17371 | }; | |
| 17372 | }; | |
| 17373 | ||
| 17374 | pub const __builtin_tbegin = struct { | |
| 17375 | const param_str = "UiUIi"; | |
| 17376 | const target_set = TargetSet.init(.{ | |
| 17377 | .ppc = true, | |
| 17378 | }); | |
| 17379 | }; | |
| 17380 | ||
| 17381 | pub const __builtin_tcheck = struct { | |
| 17382 | const param_str = "Ui"; | |
| 17383 | const target_set = TargetSet.init(.{ | |
| 17384 | .ppc = true, | |
| 17385 | }); | |
| 17386 | }; | |
| 17387 | ||
| 17388 | pub const __builtin_tend = struct { | |
| 17389 | const param_str = "UiUIi"; | |
| 17390 | const target_set = TargetSet.init(.{ | |
| 17391 | .ppc = true, | |
| 17392 | }); | |
| 17393 | }; | |
| 17394 | ||
| 17395 | pub const __builtin_tendall = struct { | |
| 17396 | const param_str = "Ui"; | |
| 17397 | const target_set = TargetSet.init(.{ | |
| 17398 | .ppc = true, | |
| 17399 | }); | |
| 17400 | }; | |
| 17401 | ||
| 17402 | pub const __builtin_tgamma = struct { | |
| 17403 | const param_str = "dd"; | |
| 17404 | const attributes = Attributes{ | |
| 17405 | .lib_function_with_builtin_prefix = true, | |
| 17406 | .const_without_errno_and_fp_exceptions = true, | |
| 17407 | }; | |
| 17408 | }; | |
| 17409 | ||
| 17410 | pub const __builtin_tgammaf = struct { | |
| 17411 | const param_str = "ff"; | |
| 17412 | const attributes = Attributes{ | |
| 17413 | .lib_function_with_builtin_prefix = true, | |
| 17414 | .const_without_errno_and_fp_exceptions = true, | |
| 17415 | }; | |
| 17416 | }; | |
| 17417 | ||
| 17418 | pub const __builtin_tgammaf128 = struct { | |
| 17419 | const param_str = "LLdLLd"; | |
| 17420 | const attributes = Attributes{ | |
| 17421 | .lib_function_with_builtin_prefix = true, | |
| 17422 | .const_without_errno_and_fp_exceptions = true, | |
| 17423 | }; | |
| 17424 | }; | |
| 17425 | ||
| 17426 | pub const __builtin_tgammal = struct { | |
| 17427 | const param_str = "LdLd"; | |
| 17428 | const attributes = Attributes{ | |
| 17429 | .lib_function_with_builtin_prefix = true, | |
| 17430 | .const_without_errno_and_fp_exceptions = true, | |
| 17431 | }; | |
| 17432 | }; | |
| 17433 | ||
| 17434 | pub const __builtin_thread_pointer = struct { | |
| 17435 | const param_str = "v*"; | |
| 17436 | const attributes = Attributes{ | |
| 17437 | .@"const" = true, | |
| 17438 | }; | |
| 17439 | }; | |
| 17440 | ||
| 17441 | pub const __builtin_trap = struct { | |
| 17442 | const param_str = "v"; | |
| 17443 | const attributes = Attributes{ | |
| 17444 | .noreturn = true, | |
| 17445 | }; | |
| 17446 | }; | |
| 17447 | ||
| 17448 | pub const __builtin_trechkpt = struct { | |
| 17449 | const param_str = "Ui"; | |
| 17450 | const target_set = TargetSet.init(.{ | |
| 17451 | .ppc = true, | |
| 17452 | }); | |
| 17453 | }; | |
| 17454 | ||
| 17455 | pub const __builtin_treclaim = struct { | |
| 17456 | const param_str = "UiUi"; | |
| 17457 | const target_set = TargetSet.init(.{ | |
| 17458 | .ppc = true, | |
| 17459 | }); | |
| 17460 | }; | |
| 17461 | ||
| 17462 | pub const __builtin_tresume = struct { | |
| 17463 | const param_str = "Ui"; | |
| 17464 | const target_set = TargetSet.init(.{ | |
| 17465 | .ppc = true, | |
| 17466 | }); | |
| 17467 | }; | |
| 17468 | ||
| 17469 | pub const __builtin_trunc = struct { | |
| 17470 | const param_str = "dd"; | |
| 17471 | const attributes = Attributes{ | |
| 17472 | .@"const" = true, | |
| 17473 | .lib_function_with_builtin_prefix = true, | |
| 17474 | }; | |
| 17475 | }; | |
| 17476 | ||
| 17477 | pub const __builtin_truncf = struct { | |
| 17478 | const param_str = "ff"; | |
| 17479 | const attributes = Attributes{ | |
| 17480 | .@"const" = true, | |
| 17481 | .lib_function_with_builtin_prefix = true, | |
| 17482 | }; | |
| 17483 | }; | |
| 17484 | ||
| 17485 | pub const __builtin_truncf128 = struct { | |
| 17486 | const param_str = "LLdLLd"; | |
| 17487 | const attributes = Attributes{ | |
| 17488 | .@"const" = true, | |
| 17489 | .lib_function_with_builtin_prefix = true, | |
| 17490 | }; | |
| 17491 | }; | |
| 17492 | ||
| 17493 | pub const __builtin_truncf128_round_to_odd = struct { | |
| 17494 | const param_str = "dLLd"; | |
| 17495 | const target_set = TargetSet.init(.{ | |
| 17496 | .ppc = true, | |
| 17497 | }); | |
| 17498 | }; | |
| 17499 | ||
| 17500 | pub const __builtin_truncf16 = struct { | |
| 17501 | const param_str = "hh"; | |
| 17502 | const attributes = Attributes{ | |
| 17503 | .@"const" = true, | |
| 17504 | .lib_function_with_builtin_prefix = true, | |
| 17505 | }; | |
| 17506 | }; | |
| 17507 | ||
| 17508 | pub const __builtin_truncl = struct { | |
| 17509 | const param_str = "LdLd"; | |
| 17510 | const attributes = Attributes{ | |
| 17511 | .@"const" = true, | |
| 17512 | .lib_function_with_builtin_prefix = true, | |
| 17513 | }; | |
| 17514 | }; | |
| 17515 | ||
| 17516 | pub const __builtin_tsr = struct { | |
| 17517 | const param_str = "UiUi"; | |
| 17518 | const target_set = TargetSet.init(.{ | |
| 17519 | .ppc = true, | |
| 17520 | }); | |
| 17521 | }; | |
| 17522 | ||
| 17523 | pub const __builtin_tsuspend = struct { | |
| 17524 | const param_str = "Ui"; | |
| 17525 | const target_set = TargetSet.init(.{ | |
| 17526 | .ppc = true, | |
| 17527 | }); | |
| 17528 | }; | |
| 17529 | ||
| 17530 | pub const __builtin_ttest = struct { | |
| 17531 | const param_str = "LUi"; | |
| 17532 | const target_set = TargetSet.init(.{ | |
| 17533 | .ppc = true, | |
| 17534 | }); | |
| 17535 | }; | |
| 17536 | ||
| 17537 | pub const __builtin_uadd_overflow = struct { | |
| 17538 | const param_str = "bUiCUiCUi*"; | |
| 17539 | const attributes = Attributes{ | |
| 17540 | .const_evaluable = true, | |
| 17541 | }; | |
| 17542 | }; | |
| 17543 | ||
| 17544 | pub const __builtin_uaddl_overflow = struct { | |
| 17545 | const param_str = "bULiCULiCULi*"; | |
| 17546 | const attributes = Attributes{ | |
| 17547 | .const_evaluable = true, | |
| 17548 | }; | |
| 17549 | }; | |
| 17550 | ||
| 17551 | pub const __builtin_uaddll_overflow = struct { | |
| 17552 | const param_str = "bULLiCULLiCULLi*"; | |
| 17553 | const attributes = Attributes{ | |
| 17554 | .const_evaluable = true, | |
| 17555 | }; | |
| 17556 | }; | |
| 17557 | ||
| 17558 | pub const __builtin_umul_overflow = struct { | |
| 17559 | const param_str = "bUiCUiCUi*"; | |
| 17560 | const attributes = Attributes{ | |
| 17561 | .const_evaluable = true, | |
| 17562 | }; | |
| 17563 | }; | |
| 17564 | ||
| 17565 | pub const __builtin_umull_overflow = struct { | |
| 17566 | const param_str = "bULiCULiCULi*"; | |
| 17567 | const attributes = Attributes{ | |
| 17568 | .const_evaluable = true, | |
| 17569 | }; | |
| 17570 | }; | |
| 17571 | ||
| 17572 | pub const __builtin_umulll_overflow = struct { | |
| 17573 | const param_str = "bULLiCULLiCULLi*"; | |
| 17574 | const attributes = Attributes{ | |
| 17575 | .const_evaluable = true, | |
| 17576 | }; | |
| 17577 | }; | |
| 17578 | ||
| 17579 | pub const __builtin_unpack_longdouble = struct { | |
| 17580 | const param_str = "dLdIi"; | |
| 17581 | const target_set = TargetSet.init(.{ | |
| 17582 | .ppc = true, | |
| 17583 | }); | |
| 17584 | }; | |
| 17585 | ||
| 17586 | pub const __builtin_unpack_vector_int128 = struct { | |
| 17587 | const param_str = "ULLiV1LLLii"; | |
| 17588 | const target_set = TargetSet.init(.{ | |
| 17589 | .ppc = true, | |
| 17590 | }); | |
| 17591 | }; | |
| 17592 | ||
| 17593 | pub const __builtin_unpredictable = struct { | |
| 17594 | const param_str = "LiLi"; | |
| 17595 | const attributes = Attributes{ | |
| 17596 | .@"const" = true, | |
| 17597 | }; | |
| 17598 | }; | |
| 17599 | ||
| 17600 | pub const __builtin_unreachable = struct { | |
| 17601 | const param_str = "v"; | |
| 17602 | const attributes = Attributes{ | |
| 17603 | .noreturn = true, | |
| 17604 | }; | |
| 17605 | }; | |
| 17606 | ||
| 17607 | pub const __builtin_unwind_init = struct { | |
| 17608 | const param_str = "v"; | |
| 17609 | }; | |
| 17610 | ||
| 17611 | pub const __builtin_usub_overflow = struct { | |
| 17612 | const param_str = "bUiCUiCUi*"; | |
| 17613 | const attributes = Attributes{ | |
| 17614 | .const_evaluable = true, | |
| 17615 | }; | |
| 17616 | }; | |
| 17617 | ||
| 17618 | pub const __builtin_usubl_overflow = struct { | |
| 17619 | const param_str = "bULiCULiCULi*"; | |
| 17620 | const attributes = Attributes{ | |
| 17621 | .const_evaluable = true, | |
| 17622 | }; | |
| 17623 | }; | |
| 17624 | ||
| 17625 | pub const __builtin_usubll_overflow = struct { | |
| 17626 | const param_str = "bULLiCULLiCULLi*"; | |
| 17627 | const attributes = Attributes{ | |
| 17628 | .const_evaluable = true, | |
| 17629 | }; | |
| 17630 | }; | |
| 17631 | ||
| 17632 | pub const __builtin_va_copy = struct { | |
| 17633 | const param_str = "vAA"; | |
| 17634 | const attributes = Attributes{}; | |
| 17635 | }; | |
| 17636 | ||
| 17637 | pub const __builtin_va_end = struct { | |
| 17638 | const param_str = "vA"; | |
| 17639 | const attributes = Attributes{}; | |
| 17640 | }; | |
| 17641 | ||
| 17642 | pub const __builtin_va_start = struct { | |
| 17643 | const param_str = "vA."; | |
| 17644 | const attributes = Attributes{ | |
| 17645 | .custom_typecheck = true, | |
| 17646 | }; | |
| 17647 | }; | |
| 17648 | ||
| 17649 | pub const __builtin_ve_vl_andm_MMM = struct { | |
| 17650 | const param_str = "V512bV512bV512b"; | |
| 17651 | const target_set = TargetSet.init(.{ | |
| 17652 | .vevl_gen = true, | |
| 17653 | }); | |
| 17654 | const attributes = Attributes{}; | |
| 17655 | }; | |
| 17656 | ||
| 17657 | pub const __builtin_ve_vl_andm_mmm = struct { | |
| 17658 | const param_str = "V256bV256bV256b"; | |
| 17659 | const target_set = TargetSet.init(.{ | |
| 17660 | .vevl_gen = true, | |
| 17661 | }); | |
| 17662 | const attributes = Attributes{}; | |
| 17663 | }; | |
| 17664 | ||
| 17665 | pub const __builtin_ve_vl_eqvm_MMM = struct { | |
| 17666 | const param_str = "V512bV512bV512b"; | |
| 17667 | const target_set = TargetSet.init(.{ | |
| 17668 | .vevl_gen = true, | |
| 17669 | }); | |
| 17670 | const attributes = Attributes{}; | |
| 17671 | }; | |
| 17672 | ||
| 17673 | pub const __builtin_ve_vl_eqvm_mmm = struct { | |
| 17674 | const param_str = "V256bV256bV256b"; | |
| 17675 | const target_set = TargetSet.init(.{ | |
| 17676 | .vevl_gen = true, | |
| 17677 | }); | |
| 17678 | const attributes = Attributes{}; | |
| 17679 | }; | |
| 17680 | ||
| 17681 | pub const __builtin_ve_vl_extract_vm512l = struct { | |
| 17682 | const param_str = "V256bV512b"; | |
| 17683 | const target_set = TargetSet.init(.{ | |
| 17684 | .ve = true, | |
| 17685 | }); | |
| 17686 | const attributes = Attributes{}; | |
| 17687 | }; | |
| 17688 | ||
| 17689 | pub const __builtin_ve_vl_extract_vm512u = struct { | |
| 17690 | const param_str = "V256bV512b"; | |
| 17691 | const target_set = TargetSet.init(.{ | |
| 17692 | .ve = true, | |
| 17693 | }); | |
| 17694 | const attributes = Attributes{}; | |
| 17695 | }; | |
| 17696 | ||
| 17697 | pub const __builtin_ve_vl_fencec_s = struct { | |
| 17698 | const param_str = "vUi"; | |
| 17699 | const target_set = TargetSet.init(.{ | |
| 17700 | .vevl_gen = true, | |
| 17701 | }); | |
| 17702 | const attributes = Attributes{}; | |
| 17703 | }; | |
| 17704 | ||
| 17705 | pub const __builtin_ve_vl_fencei = struct { | |
| 17706 | const param_str = "v"; | |
| 17707 | const target_set = TargetSet.init(.{ | |
| 17708 | .vevl_gen = true, | |
| 17709 | }); | |
| 17710 | const attributes = Attributes{}; | |
| 17711 | }; | |
| 17712 | ||
| 17713 | pub const __builtin_ve_vl_fencem_s = struct { | |
| 17714 | const param_str = "vUi"; | |
| 17715 | const target_set = TargetSet.init(.{ | |
| 17716 | .vevl_gen = true, | |
| 17717 | }); | |
| 17718 | const attributes = Attributes{}; | |
| 17719 | }; | |
| 17720 | ||
| 17721 | pub const __builtin_ve_vl_fidcr_sss = struct { | |
| 17722 | const param_str = "LUiLUiUi"; | |
| 17723 | const target_set = TargetSet.init(.{ | |
| 17724 | .vevl_gen = true, | |
| 17725 | }); | |
| 17726 | const attributes = Attributes{}; | |
| 17727 | }; | |
| 17728 | ||
| 17729 | pub const __builtin_ve_vl_insert_vm512l = struct { | |
| 17730 | const param_str = "V512bV512bV256b"; | |
| 17731 | const target_set = TargetSet.init(.{ | |
| 17732 | .ve = true, | |
| 17733 | }); | |
| 17734 | const attributes = Attributes{}; | |
| 17735 | }; | |
| 17736 | ||
| 17737 | pub const __builtin_ve_vl_insert_vm512u = struct { | |
| 17738 | const param_str = "V512bV512bV256b"; | |
| 17739 | const target_set = TargetSet.init(.{ | |
| 17740 | .ve = true, | |
| 17741 | }); | |
| 17742 | const attributes = Attributes{}; | |
| 17743 | }; | |
| 17744 | ||
| 17745 | pub const __builtin_ve_vl_lcr_sss = struct { | |
| 17746 | const param_str = "LUiLUiLUi"; | |
| 17747 | const target_set = TargetSet.init(.{ | |
| 17748 | .vevl_gen = true, | |
| 17749 | }); | |
| 17750 | const attributes = Attributes{}; | |
| 17751 | }; | |
| 17752 | ||
| 17753 | pub const __builtin_ve_vl_lsv_vvss = struct { | |
| 17754 | const param_str = "V256dV256dUiLUi"; | |
| 17755 | const target_set = TargetSet.init(.{ | |
| 17756 | .vevl_gen = true, | |
| 17757 | }); | |
| 17758 | const attributes = Attributes{}; | |
| 17759 | }; | |
| 17760 | ||
| 17761 | pub const __builtin_ve_vl_lvm_MMss = struct { | |
| 17762 | const param_str = "V512bV512bLUiLUi"; | |
| 17763 | const target_set = TargetSet.init(.{ | |
| 17764 | .vevl_gen = true, | |
| 17765 | }); | |
| 17766 | const attributes = Attributes{}; | |
| 17767 | }; | |
| 17768 | ||
| 17769 | pub const __builtin_ve_vl_lvm_mmss = struct { | |
| 17770 | const param_str = "V256bV256bLUiLUi"; | |
| 17771 | const target_set = TargetSet.init(.{ | |
| 17772 | .vevl_gen = true, | |
| 17773 | }); | |
| 17774 | const attributes = Attributes{}; | |
| 17775 | }; | |
| 17776 | ||
| 17777 | pub const __builtin_ve_vl_lvsd_svs = struct { | |
| 17778 | const param_str = "dV256dUi"; | |
| 17779 | const target_set = TargetSet.init(.{ | |
| 17780 | .vevl_gen = true, | |
| 17781 | }); | |
| 17782 | const attributes = Attributes{}; | |
| 17783 | }; | |
| 17784 | ||
| 17785 | pub const __builtin_ve_vl_lvsl_svs = struct { | |
| 17786 | const param_str = "LUiV256dUi"; | |
| 17787 | const target_set = TargetSet.init(.{ | |
| 17788 | .vevl_gen = true, | |
| 17789 | }); | |
| 17790 | const attributes = Attributes{}; | |
| 17791 | }; | |
| 17792 | ||
| 17793 | pub const __builtin_ve_vl_lvss_svs = struct { | |
| 17794 | const param_str = "fV256dUi"; | |
| 17795 | const target_set = TargetSet.init(.{ | |
| 17796 | .vevl_gen = true, | |
| 17797 | }); | |
| 17798 | const attributes = Attributes{}; | |
| 17799 | }; | |
| 17800 | ||
| 17801 | pub const __builtin_ve_vl_lzvm_sml = struct { | |
| 17802 | const param_str = "LUiV256bUi"; | |
| 17803 | const target_set = TargetSet.init(.{ | |
| 17804 | .vevl_gen = true, | |
| 17805 | }); | |
| 17806 | const attributes = Attributes{}; | |
| 17807 | }; | |
| 17808 | ||
| 17809 | pub const __builtin_ve_vl_negm_MM = struct { | |
| 17810 | const param_str = "V512bV512b"; | |
| 17811 | const target_set = TargetSet.init(.{ | |
| 17812 | .vevl_gen = true, | |
| 17813 | }); | |
| 17814 | const attributes = Attributes{}; | |
| 17815 | }; | |
| 17816 | ||
| 17817 | pub const __builtin_ve_vl_negm_mm = struct { | |
| 17818 | const param_str = "V256bV256b"; | |
| 17819 | const target_set = TargetSet.init(.{ | |
| 17820 | .vevl_gen = true, | |
| 17821 | }); | |
| 17822 | const attributes = Attributes{}; | |
| 17823 | }; | |
| 17824 | ||
| 17825 | pub const __builtin_ve_vl_nndm_MMM = struct { | |
| 17826 | const param_str = "V512bV512bV512b"; | |
| 17827 | const target_set = TargetSet.init(.{ | |
| 17828 | .vevl_gen = true, | |
| 17829 | }); | |
| 17830 | const attributes = Attributes{}; | |
| 17831 | }; | |
| 17832 | ||
| 17833 | pub const __builtin_ve_vl_nndm_mmm = struct { | |
| 17834 | const param_str = "V256bV256bV256b"; | |
| 17835 | const target_set = TargetSet.init(.{ | |
| 17836 | .vevl_gen = true, | |
| 17837 | }); | |
| 17838 | const attributes = Attributes{}; | |
| 17839 | }; | |
| 17840 | ||
| 17841 | pub const __builtin_ve_vl_orm_MMM = struct { | |
| 17842 | const param_str = "V512bV512bV512b"; | |
| 17843 | const target_set = TargetSet.init(.{ | |
| 17844 | .vevl_gen = true, | |
| 17845 | }); | |
| 17846 | const attributes = Attributes{}; | |
| 17847 | }; | |
| 17848 | ||
| 17849 | pub const __builtin_ve_vl_orm_mmm = struct { | |
| 17850 | const param_str = "V256bV256bV256b"; | |
| 17851 | const target_set = TargetSet.init(.{ | |
| 17852 | .vevl_gen = true, | |
| 17853 | }); | |
| 17854 | const attributes = Attributes{}; | |
| 17855 | }; | |
| 17856 | ||
| 17857 | pub const __builtin_ve_vl_pack_f32a = struct { | |
| 17858 | const param_str = "ULifC*"; | |
| 17859 | const target_set = TargetSet.init(.{ | |
| 17860 | .ve = true, | |
| 17861 | }); | |
| 17862 | const attributes = Attributes{}; | |
| 17863 | }; | |
| 17864 | ||
| 17865 | pub const __builtin_ve_vl_pack_f32p = struct { | |
| 17866 | const param_str = "ULifC*fC*"; | |
| 17867 | const target_set = TargetSet.init(.{ | |
| 17868 | .ve = true, | |
| 17869 | }); | |
| 17870 | const attributes = Attributes{}; | |
| 17871 | }; | |
| 17872 | ||
| 17873 | pub const __builtin_ve_vl_pcvm_sml = struct { | |
| 17874 | const param_str = "LUiV256bUi"; | |
| 17875 | const target_set = TargetSet.init(.{ | |
| 17876 | .vevl_gen = true, | |
| 17877 | }); | |
| 17878 | const attributes = Attributes{}; | |
| 17879 | }; | |
| 17880 | ||
| 17881 | pub const __builtin_ve_vl_pfchv_ssl = struct { | |
| 17882 | const param_str = "vLivC*Ui"; | |
| 17883 | const target_set = TargetSet.init(.{ | |
| 17884 | .vevl_gen = true, | |
| 17885 | }); | |
| 17886 | const attributes = Attributes{}; | |
| 17887 | }; | |
| 17888 | ||
| 17889 | pub const __builtin_ve_vl_pfchvnc_ssl = struct { | |
| 17890 | const param_str = "vLivC*Ui"; | |
| 17891 | const target_set = TargetSet.init(.{ | |
| 17892 | .vevl_gen = true, | |
| 17893 | }); | |
| 17894 | const attributes = Attributes{}; | |
| 17895 | }; | |
| 17896 | ||
| 17897 | pub const __builtin_ve_vl_pvadds_vsvMvl = struct { | |
| 17898 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 17899 | const target_set = TargetSet.init(.{ | |
| 17900 | .vevl_gen = true, | |
| 17901 | }); | |
| 17902 | const attributes = Attributes{}; | |
| 17903 | }; | |
| 17904 | ||
| 17905 | pub const __builtin_ve_vl_pvadds_vsvl = struct { | |
| 17906 | const param_str = "V256dLUiV256dUi"; | |
| 17907 | const target_set = TargetSet.init(.{ | |
| 17908 | .vevl_gen = true, | |
| 17909 | }); | |
| 17910 | const attributes = Attributes{}; | |
| 17911 | }; | |
| 17912 | ||
| 17913 | pub const __builtin_ve_vl_pvadds_vsvvl = struct { | |
| 17914 | const param_str = "V256dLUiV256dV256dUi"; | |
| 17915 | const target_set = TargetSet.init(.{ | |
| 17916 | .vevl_gen = true, | |
| 17917 | }); | |
| 17918 | const attributes = Attributes{}; | |
| 17919 | }; | |
| 17920 | ||
| 17921 | pub const __builtin_ve_vl_pvadds_vvvMvl = struct { | |
| 17922 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 17923 | const target_set = TargetSet.init(.{ | |
| 17924 | .vevl_gen = true, | |
| 17925 | }); | |
| 17926 | const attributes = Attributes{}; | |
| 17927 | }; | |
| 17928 | ||
| 17929 | pub const __builtin_ve_vl_pvadds_vvvl = struct { | |
| 17930 | const param_str = "V256dV256dV256dUi"; | |
| 17931 | const target_set = TargetSet.init(.{ | |
| 17932 | .vevl_gen = true, | |
| 17933 | }); | |
| 17934 | const attributes = Attributes{}; | |
| 17935 | }; | |
| 17936 | ||
| 17937 | pub const __builtin_ve_vl_pvadds_vvvvl = struct { | |
| 17938 | const param_str = "V256dV256dV256dV256dUi"; | |
| 17939 | const target_set = TargetSet.init(.{ | |
| 17940 | .vevl_gen = true, | |
| 17941 | }); | |
| 17942 | const attributes = Attributes{}; | |
| 17943 | }; | |
| 17944 | ||
| 17945 | pub const __builtin_ve_vl_pvaddu_vsvMvl = struct { | |
| 17946 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 17947 | const target_set = TargetSet.init(.{ | |
| 17948 | .vevl_gen = true, | |
| 17949 | }); | |
| 17950 | const attributes = Attributes{}; | |
| 17951 | }; | |
| 17952 | ||
| 17953 | pub const __builtin_ve_vl_pvaddu_vsvl = struct { | |
| 17954 | const param_str = "V256dLUiV256dUi"; | |
| 17955 | const target_set = TargetSet.init(.{ | |
| 17956 | .vevl_gen = true, | |
| 17957 | }); | |
| 17958 | const attributes = Attributes{}; | |
| 17959 | }; | |
| 17960 | ||
| 17961 | pub const __builtin_ve_vl_pvaddu_vsvvl = struct { | |
| 17962 | const param_str = "V256dLUiV256dV256dUi"; | |
| 17963 | const target_set = TargetSet.init(.{ | |
| 17964 | .vevl_gen = true, | |
| 17965 | }); | |
| 17966 | const attributes = Attributes{}; | |
| 17967 | }; | |
| 17968 | ||
| 17969 | pub const __builtin_ve_vl_pvaddu_vvvMvl = struct { | |
| 17970 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 17971 | const target_set = TargetSet.init(.{ | |
| 17972 | .vevl_gen = true, | |
| 17973 | }); | |
| 17974 | const attributes = Attributes{}; | |
| 17975 | }; | |
| 17976 | ||
| 17977 | pub const __builtin_ve_vl_pvaddu_vvvl = struct { | |
| 17978 | const param_str = "V256dV256dV256dUi"; | |
| 17979 | const target_set = TargetSet.init(.{ | |
| 17980 | .vevl_gen = true, | |
| 17981 | }); | |
| 17982 | const attributes = Attributes{}; | |
| 17983 | }; | |
| 17984 | ||
| 17985 | pub const __builtin_ve_vl_pvaddu_vvvvl = struct { | |
| 17986 | const param_str = "V256dV256dV256dV256dUi"; | |
| 17987 | const target_set = TargetSet.init(.{ | |
| 17988 | .vevl_gen = true, | |
| 17989 | }); | |
| 17990 | const attributes = Attributes{}; | |
| 17991 | }; | |
| 17992 | ||
| 17993 | pub const __builtin_ve_vl_pvand_vsvMvl = struct { | |
| 17994 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 17995 | const target_set = TargetSet.init(.{ | |
| 17996 | .vevl_gen = true, | |
| 17997 | }); | |
| 17998 | const attributes = Attributes{}; | |
| 17999 | }; | |
| 18000 | ||
| 18001 | pub const __builtin_ve_vl_pvand_vsvl = struct { | |
| 18002 | const param_str = "V256dLUiV256dUi"; | |
| 18003 | const target_set = TargetSet.init(.{ | |
| 18004 | .vevl_gen = true, | |
| 18005 | }); | |
| 18006 | const attributes = Attributes{}; | |
| 18007 | }; | |
| 18008 | ||
| 18009 | pub const __builtin_ve_vl_pvand_vsvvl = struct { | |
| 18010 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18011 | const target_set = TargetSet.init(.{ | |
| 18012 | .vevl_gen = true, | |
| 18013 | }); | |
| 18014 | const attributes = Attributes{}; | |
| 18015 | }; | |
| 18016 | ||
| 18017 | pub const __builtin_ve_vl_pvand_vvvMvl = struct { | |
| 18018 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18019 | const target_set = TargetSet.init(.{ | |
| 18020 | .vevl_gen = true, | |
| 18021 | }); | |
| 18022 | const attributes = Attributes{}; | |
| 18023 | }; | |
| 18024 | ||
| 18025 | pub const __builtin_ve_vl_pvand_vvvl = struct { | |
| 18026 | const param_str = "V256dV256dV256dUi"; | |
| 18027 | const target_set = TargetSet.init(.{ | |
| 18028 | .vevl_gen = true, | |
| 18029 | }); | |
| 18030 | const attributes = Attributes{}; | |
| 18031 | }; | |
| 18032 | ||
| 18033 | pub const __builtin_ve_vl_pvand_vvvvl = struct { | |
| 18034 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18035 | const target_set = TargetSet.init(.{ | |
| 18036 | .vevl_gen = true, | |
| 18037 | }); | |
| 18038 | const attributes = Attributes{}; | |
| 18039 | }; | |
| 18040 | ||
| 18041 | pub const __builtin_ve_vl_pvbrd_vsMvl = struct { | |
| 18042 | const param_str = "V256dLUiV512bV256dUi"; | |
| 18043 | const target_set = TargetSet.init(.{ | |
| 18044 | .vevl_gen = true, | |
| 18045 | }); | |
| 18046 | const attributes = Attributes{}; | |
| 18047 | }; | |
| 18048 | ||
| 18049 | pub const __builtin_ve_vl_pvbrd_vsl = struct { | |
| 18050 | const param_str = "V256dLUiUi"; | |
| 18051 | const target_set = TargetSet.init(.{ | |
| 18052 | .vevl_gen = true, | |
| 18053 | }); | |
| 18054 | const attributes = Attributes{}; | |
| 18055 | }; | |
| 18056 | ||
| 18057 | pub const __builtin_ve_vl_pvbrd_vsvl = struct { | |
| 18058 | const param_str = "V256dLUiV256dUi"; | |
| 18059 | const target_set = TargetSet.init(.{ | |
| 18060 | .vevl_gen = true, | |
| 18061 | }); | |
| 18062 | const attributes = Attributes{}; | |
| 18063 | }; | |
| 18064 | ||
| 18065 | pub const __builtin_ve_vl_pvbrv_vvMvl = struct { | |
| 18066 | const param_str = "V256dV256dV512bV256dUi"; | |
| 18067 | const target_set = TargetSet.init(.{ | |
| 18068 | .vevl_gen = true, | |
| 18069 | }); | |
| 18070 | const attributes = Attributes{}; | |
| 18071 | }; | |
| 18072 | ||
| 18073 | pub const __builtin_ve_vl_pvbrv_vvl = struct { | |
| 18074 | const param_str = "V256dV256dUi"; | |
| 18075 | const target_set = TargetSet.init(.{ | |
| 18076 | .vevl_gen = true, | |
| 18077 | }); | |
| 18078 | const attributes = Attributes{}; | |
| 18079 | }; | |
| 18080 | ||
| 18081 | pub const __builtin_ve_vl_pvbrv_vvvl = struct { | |
| 18082 | const param_str = "V256dV256dV256dUi"; | |
| 18083 | const target_set = TargetSet.init(.{ | |
| 18084 | .vevl_gen = true, | |
| 18085 | }); | |
| 18086 | const attributes = Attributes{}; | |
| 18087 | }; | |
| 18088 | ||
| 18089 | pub const __builtin_ve_vl_pvbrvlo_vvl = struct { | |
| 18090 | const param_str = "V256dV256dUi"; | |
| 18091 | const target_set = TargetSet.init(.{ | |
| 18092 | .vevl_gen = true, | |
| 18093 | }); | |
| 18094 | const attributes = Attributes{}; | |
| 18095 | }; | |
| 18096 | ||
| 18097 | pub const __builtin_ve_vl_pvbrvlo_vvmvl = struct { | |
| 18098 | const param_str = "V256dV256dV256bV256dUi"; | |
| 18099 | const target_set = TargetSet.init(.{ | |
| 18100 | .vevl_gen = true, | |
| 18101 | }); | |
| 18102 | const attributes = Attributes{}; | |
| 18103 | }; | |
| 18104 | ||
| 18105 | pub const __builtin_ve_vl_pvbrvlo_vvvl = struct { | |
| 18106 | const param_str = "V256dV256dV256dUi"; | |
| 18107 | const target_set = TargetSet.init(.{ | |
| 18108 | .vevl_gen = true, | |
| 18109 | }); | |
| 18110 | const attributes = Attributes{}; | |
| 18111 | }; | |
| 18112 | ||
| 18113 | pub const __builtin_ve_vl_pvbrvup_vvl = struct { | |
| 18114 | const param_str = "V256dV256dUi"; | |
| 18115 | const target_set = TargetSet.init(.{ | |
| 18116 | .vevl_gen = true, | |
| 18117 | }); | |
| 18118 | const attributes = Attributes{}; | |
| 18119 | }; | |
| 18120 | ||
| 18121 | pub const __builtin_ve_vl_pvbrvup_vvmvl = struct { | |
| 18122 | const param_str = "V256dV256dV256bV256dUi"; | |
| 18123 | const target_set = TargetSet.init(.{ | |
| 18124 | .vevl_gen = true, | |
| 18125 | }); | |
| 18126 | const attributes = Attributes{}; | |
| 18127 | }; | |
| 18128 | ||
| 18129 | pub const __builtin_ve_vl_pvbrvup_vvvl = struct { | |
| 18130 | const param_str = "V256dV256dV256dUi"; | |
| 18131 | const target_set = TargetSet.init(.{ | |
| 18132 | .vevl_gen = true, | |
| 18133 | }); | |
| 18134 | const attributes = Attributes{}; | |
| 18135 | }; | |
| 18136 | ||
| 18137 | pub const __builtin_ve_vl_pvcmps_vsvMvl = struct { | |
| 18138 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18139 | const target_set = TargetSet.init(.{ | |
| 18140 | .vevl_gen = true, | |
| 18141 | }); | |
| 18142 | const attributes = Attributes{}; | |
| 18143 | }; | |
| 18144 | ||
| 18145 | pub const __builtin_ve_vl_pvcmps_vsvl = struct { | |
| 18146 | const param_str = "V256dLUiV256dUi"; | |
| 18147 | const target_set = TargetSet.init(.{ | |
| 18148 | .vevl_gen = true, | |
| 18149 | }); | |
| 18150 | const attributes = Attributes{}; | |
| 18151 | }; | |
| 18152 | ||
| 18153 | pub const __builtin_ve_vl_pvcmps_vsvvl = struct { | |
| 18154 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18155 | const target_set = TargetSet.init(.{ | |
| 18156 | .vevl_gen = true, | |
| 18157 | }); | |
| 18158 | const attributes = Attributes{}; | |
| 18159 | }; | |
| 18160 | ||
| 18161 | pub const __builtin_ve_vl_pvcmps_vvvMvl = struct { | |
| 18162 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18163 | const target_set = TargetSet.init(.{ | |
| 18164 | .vevl_gen = true, | |
| 18165 | }); | |
| 18166 | const attributes = Attributes{}; | |
| 18167 | }; | |
| 18168 | ||
| 18169 | pub const __builtin_ve_vl_pvcmps_vvvl = struct { | |
| 18170 | const param_str = "V256dV256dV256dUi"; | |
| 18171 | const target_set = TargetSet.init(.{ | |
| 18172 | .vevl_gen = true, | |
| 18173 | }); | |
| 18174 | const attributes = Attributes{}; | |
| 18175 | }; | |
| 18176 | ||
| 18177 | pub const __builtin_ve_vl_pvcmps_vvvvl = struct { | |
| 18178 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18179 | const target_set = TargetSet.init(.{ | |
| 18180 | .vevl_gen = true, | |
| 18181 | }); | |
| 18182 | const attributes = Attributes{}; | |
| 18183 | }; | |
| 18184 | ||
| 18185 | pub const __builtin_ve_vl_pvcmpu_vsvMvl = struct { | |
| 18186 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18187 | const target_set = TargetSet.init(.{ | |
| 18188 | .vevl_gen = true, | |
| 18189 | }); | |
| 18190 | const attributes = Attributes{}; | |
| 18191 | }; | |
| 18192 | ||
| 18193 | pub const __builtin_ve_vl_pvcmpu_vsvl = struct { | |
| 18194 | const param_str = "V256dLUiV256dUi"; | |
| 18195 | const target_set = TargetSet.init(.{ | |
| 18196 | .vevl_gen = true, | |
| 18197 | }); | |
| 18198 | const attributes = Attributes{}; | |
| 18199 | }; | |
| 18200 | ||
| 18201 | pub const __builtin_ve_vl_pvcmpu_vsvvl = struct { | |
| 18202 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18203 | const target_set = TargetSet.init(.{ | |
| 18204 | .vevl_gen = true, | |
| 18205 | }); | |
| 18206 | const attributes = Attributes{}; | |
| 18207 | }; | |
| 18208 | ||
| 18209 | pub const __builtin_ve_vl_pvcmpu_vvvMvl = struct { | |
| 18210 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18211 | const target_set = TargetSet.init(.{ | |
| 18212 | .vevl_gen = true, | |
| 18213 | }); | |
| 18214 | const attributes = Attributes{}; | |
| 18215 | }; | |
| 18216 | ||
| 18217 | pub const __builtin_ve_vl_pvcmpu_vvvl = struct { | |
| 18218 | const param_str = "V256dV256dV256dUi"; | |
| 18219 | const target_set = TargetSet.init(.{ | |
| 18220 | .vevl_gen = true, | |
| 18221 | }); | |
| 18222 | const attributes = Attributes{}; | |
| 18223 | }; | |
| 18224 | ||
| 18225 | pub const __builtin_ve_vl_pvcmpu_vvvvl = struct { | |
| 18226 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18227 | const target_set = TargetSet.init(.{ | |
| 18228 | .vevl_gen = true, | |
| 18229 | }); | |
| 18230 | const attributes = Attributes{}; | |
| 18231 | }; | |
| 18232 | ||
| 18233 | pub const __builtin_ve_vl_pvcvtsw_vvl = struct { | |
| 18234 | const param_str = "V256dV256dUi"; | |
| 18235 | const target_set = TargetSet.init(.{ | |
| 18236 | .vevl_gen = true, | |
| 18237 | }); | |
| 18238 | const attributes = Attributes{}; | |
| 18239 | }; | |
| 18240 | ||
| 18241 | pub const __builtin_ve_vl_pvcvtsw_vvvl = struct { | |
| 18242 | const param_str = "V256dV256dV256dUi"; | |
| 18243 | const target_set = TargetSet.init(.{ | |
| 18244 | .vevl_gen = true, | |
| 18245 | }); | |
| 18246 | const attributes = Attributes{}; | |
| 18247 | }; | |
| 18248 | ||
| 18249 | pub const __builtin_ve_vl_pvcvtws_vvMvl = struct { | |
| 18250 | const param_str = "V256dV256dV512bV256dUi"; | |
| 18251 | const target_set = TargetSet.init(.{ | |
| 18252 | .vevl_gen = true, | |
| 18253 | }); | |
| 18254 | const attributes = Attributes{}; | |
| 18255 | }; | |
| 18256 | ||
| 18257 | pub const __builtin_ve_vl_pvcvtws_vvl = struct { | |
| 18258 | const param_str = "V256dV256dUi"; | |
| 18259 | const target_set = TargetSet.init(.{ | |
| 18260 | .vevl_gen = true, | |
| 18261 | }); | |
| 18262 | const attributes = Attributes{}; | |
| 18263 | }; | |
| 18264 | ||
| 18265 | pub const __builtin_ve_vl_pvcvtws_vvvl = struct { | |
| 18266 | const param_str = "V256dV256dV256dUi"; | |
| 18267 | const target_set = TargetSet.init(.{ | |
| 18268 | .vevl_gen = true, | |
| 18269 | }); | |
| 18270 | const attributes = Attributes{}; | |
| 18271 | }; | |
| 18272 | ||
| 18273 | pub const __builtin_ve_vl_pvcvtwsrz_vvMvl = struct { | |
| 18274 | const param_str = "V256dV256dV512bV256dUi"; | |
| 18275 | const target_set = TargetSet.init(.{ | |
| 18276 | .vevl_gen = true, | |
| 18277 | }); | |
| 18278 | const attributes = Attributes{}; | |
| 18279 | }; | |
| 18280 | ||
| 18281 | pub const __builtin_ve_vl_pvcvtwsrz_vvl = struct { | |
| 18282 | const param_str = "V256dV256dUi"; | |
| 18283 | const target_set = TargetSet.init(.{ | |
| 18284 | .vevl_gen = true, | |
| 18285 | }); | |
| 18286 | const attributes = Attributes{}; | |
| 18287 | }; | |
| 18288 | ||
| 18289 | pub const __builtin_ve_vl_pvcvtwsrz_vvvl = struct { | |
| 18290 | const param_str = "V256dV256dV256dUi"; | |
| 18291 | const target_set = TargetSet.init(.{ | |
| 18292 | .vevl_gen = true, | |
| 18293 | }); | |
| 18294 | const attributes = Attributes{}; | |
| 18295 | }; | |
| 18296 | ||
| 18297 | pub const __builtin_ve_vl_pveqv_vsvMvl = struct { | |
| 18298 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18299 | const target_set = TargetSet.init(.{ | |
| 18300 | .vevl_gen = true, | |
| 18301 | }); | |
| 18302 | const attributes = Attributes{}; | |
| 18303 | }; | |
| 18304 | ||
| 18305 | pub const __builtin_ve_vl_pveqv_vsvl = struct { | |
| 18306 | const param_str = "V256dLUiV256dUi"; | |
| 18307 | const target_set = TargetSet.init(.{ | |
| 18308 | .vevl_gen = true, | |
| 18309 | }); | |
| 18310 | const attributes = Attributes{}; | |
| 18311 | }; | |
| 18312 | ||
| 18313 | pub const __builtin_ve_vl_pveqv_vsvvl = struct { | |
| 18314 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18315 | const target_set = TargetSet.init(.{ | |
| 18316 | .vevl_gen = true, | |
| 18317 | }); | |
| 18318 | const attributes = Attributes{}; | |
| 18319 | }; | |
| 18320 | ||
| 18321 | pub const __builtin_ve_vl_pveqv_vvvMvl = struct { | |
| 18322 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18323 | const target_set = TargetSet.init(.{ | |
| 18324 | .vevl_gen = true, | |
| 18325 | }); | |
| 18326 | const attributes = Attributes{}; | |
| 18327 | }; | |
| 18328 | ||
| 18329 | pub const __builtin_ve_vl_pveqv_vvvl = struct { | |
| 18330 | const param_str = "V256dV256dV256dUi"; | |
| 18331 | const target_set = TargetSet.init(.{ | |
| 18332 | .vevl_gen = true, | |
| 18333 | }); | |
| 18334 | const attributes = Attributes{}; | |
| 18335 | }; | |
| 18336 | ||
| 18337 | pub const __builtin_ve_vl_pveqv_vvvvl = struct { | |
| 18338 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18339 | const target_set = TargetSet.init(.{ | |
| 18340 | .vevl_gen = true, | |
| 18341 | }); | |
| 18342 | const attributes = Attributes{}; | |
| 18343 | }; | |
| 18344 | ||
| 18345 | pub const __builtin_ve_vl_pvfadd_vsvMvl = struct { | |
| 18346 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18347 | const target_set = TargetSet.init(.{ | |
| 18348 | .vevl_gen = true, | |
| 18349 | }); | |
| 18350 | const attributes = Attributes{}; | |
| 18351 | }; | |
| 18352 | ||
| 18353 | pub const __builtin_ve_vl_pvfadd_vsvl = struct { | |
| 18354 | const param_str = "V256dLUiV256dUi"; | |
| 18355 | const target_set = TargetSet.init(.{ | |
| 18356 | .vevl_gen = true, | |
| 18357 | }); | |
| 18358 | const attributes = Attributes{}; | |
| 18359 | }; | |
| 18360 | ||
| 18361 | pub const __builtin_ve_vl_pvfadd_vsvvl = struct { | |
| 18362 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18363 | const target_set = TargetSet.init(.{ | |
| 18364 | .vevl_gen = true, | |
| 18365 | }); | |
| 18366 | const attributes = Attributes{}; | |
| 18367 | }; | |
| 18368 | ||
| 18369 | pub const __builtin_ve_vl_pvfadd_vvvMvl = struct { | |
| 18370 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18371 | const target_set = TargetSet.init(.{ | |
| 18372 | .vevl_gen = true, | |
| 18373 | }); | |
| 18374 | const attributes = Attributes{}; | |
| 18375 | }; | |
| 18376 | ||
| 18377 | pub const __builtin_ve_vl_pvfadd_vvvl = struct { | |
| 18378 | const param_str = "V256dV256dV256dUi"; | |
| 18379 | const target_set = TargetSet.init(.{ | |
| 18380 | .vevl_gen = true, | |
| 18381 | }); | |
| 18382 | const attributes = Attributes{}; | |
| 18383 | }; | |
| 18384 | ||
| 18385 | pub const __builtin_ve_vl_pvfadd_vvvvl = struct { | |
| 18386 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18387 | const target_set = TargetSet.init(.{ | |
| 18388 | .vevl_gen = true, | |
| 18389 | }); | |
| 18390 | const attributes = Attributes{}; | |
| 18391 | }; | |
| 18392 | ||
| 18393 | pub const __builtin_ve_vl_pvfcmp_vsvMvl = struct { | |
| 18394 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18395 | const target_set = TargetSet.init(.{ | |
| 18396 | .vevl_gen = true, | |
| 18397 | }); | |
| 18398 | const attributes = Attributes{}; | |
| 18399 | }; | |
| 18400 | ||
| 18401 | pub const __builtin_ve_vl_pvfcmp_vsvl = struct { | |
| 18402 | const param_str = "V256dLUiV256dUi"; | |
| 18403 | const target_set = TargetSet.init(.{ | |
| 18404 | .vevl_gen = true, | |
| 18405 | }); | |
| 18406 | const attributes = Attributes{}; | |
| 18407 | }; | |
| 18408 | ||
| 18409 | pub const __builtin_ve_vl_pvfcmp_vsvvl = struct { | |
| 18410 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18411 | const target_set = TargetSet.init(.{ | |
| 18412 | .vevl_gen = true, | |
| 18413 | }); | |
| 18414 | const attributes = Attributes{}; | |
| 18415 | }; | |
| 18416 | ||
| 18417 | pub const __builtin_ve_vl_pvfcmp_vvvMvl = struct { | |
| 18418 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18419 | const target_set = TargetSet.init(.{ | |
| 18420 | .vevl_gen = true, | |
| 18421 | }); | |
| 18422 | const attributes = Attributes{}; | |
| 18423 | }; | |
| 18424 | ||
| 18425 | pub const __builtin_ve_vl_pvfcmp_vvvl = struct { | |
| 18426 | const param_str = "V256dV256dV256dUi"; | |
| 18427 | const target_set = TargetSet.init(.{ | |
| 18428 | .vevl_gen = true, | |
| 18429 | }); | |
| 18430 | const attributes = Attributes{}; | |
| 18431 | }; | |
| 18432 | ||
| 18433 | pub const __builtin_ve_vl_pvfcmp_vvvvl = struct { | |
| 18434 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18435 | const target_set = TargetSet.init(.{ | |
| 18436 | .vevl_gen = true, | |
| 18437 | }); | |
| 18438 | const attributes = Attributes{}; | |
| 18439 | }; | |
| 18440 | ||
| 18441 | pub const __builtin_ve_vl_pvfmad_vsvvMvl = struct { | |
| 18442 | const param_str = "V256dLUiV256dV256dV512bV256dUi"; | |
| 18443 | const target_set = TargetSet.init(.{ | |
| 18444 | .vevl_gen = true, | |
| 18445 | }); | |
| 18446 | const attributes = Attributes{}; | |
| 18447 | }; | |
| 18448 | ||
| 18449 | pub const __builtin_ve_vl_pvfmad_vsvvl = struct { | |
| 18450 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18451 | const target_set = TargetSet.init(.{ | |
| 18452 | .vevl_gen = true, | |
| 18453 | }); | |
| 18454 | const attributes = Attributes{}; | |
| 18455 | }; | |
| 18456 | ||
| 18457 | pub const __builtin_ve_vl_pvfmad_vsvvvl = struct { | |
| 18458 | const param_str = "V256dLUiV256dV256dV256dUi"; | |
| 18459 | const target_set = TargetSet.init(.{ | |
| 18460 | .vevl_gen = true, | |
| 18461 | }); | |
| 18462 | const attributes = Attributes{}; | |
| 18463 | }; | |
| 18464 | ||
| 18465 | pub const __builtin_ve_vl_pvfmad_vvsvMvl = struct { | |
| 18466 | const param_str = "V256dV256dLUiV256dV512bV256dUi"; | |
| 18467 | const target_set = TargetSet.init(.{ | |
| 18468 | .vevl_gen = true, | |
| 18469 | }); | |
| 18470 | const attributes = Attributes{}; | |
| 18471 | }; | |
| 18472 | ||
| 18473 | pub const __builtin_ve_vl_pvfmad_vvsvl = struct { | |
| 18474 | const param_str = "V256dV256dLUiV256dUi"; | |
| 18475 | const target_set = TargetSet.init(.{ | |
| 18476 | .vevl_gen = true, | |
| 18477 | }); | |
| 18478 | const attributes = Attributes{}; | |
| 18479 | }; | |
| 18480 | ||
| 18481 | pub const __builtin_ve_vl_pvfmad_vvsvvl = struct { | |
| 18482 | const param_str = "V256dV256dLUiV256dV256dUi"; | |
| 18483 | const target_set = TargetSet.init(.{ | |
| 18484 | .vevl_gen = true, | |
| 18485 | }); | |
| 18486 | const attributes = Attributes{}; | |
| 18487 | }; | |
| 18488 | ||
| 18489 | pub const __builtin_ve_vl_pvfmad_vvvvMvl = struct { | |
| 18490 | const param_str = "V256dV256dV256dV256dV512bV256dUi"; | |
| 18491 | const target_set = TargetSet.init(.{ | |
| 18492 | .vevl_gen = true, | |
| 18493 | }); | |
| 18494 | const attributes = Attributes{}; | |
| 18495 | }; | |
| 18496 | ||
| 18497 | pub const __builtin_ve_vl_pvfmad_vvvvl = struct { | |
| 18498 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18499 | const target_set = TargetSet.init(.{ | |
| 18500 | .vevl_gen = true, | |
| 18501 | }); | |
| 18502 | const attributes = Attributes{}; | |
| 18503 | }; | |
| 18504 | ||
| 18505 | pub const __builtin_ve_vl_pvfmad_vvvvvl = struct { | |
| 18506 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 18507 | const target_set = TargetSet.init(.{ | |
| 18508 | .vevl_gen = true, | |
| 18509 | }); | |
| 18510 | const attributes = Attributes{}; | |
| 18511 | }; | |
| 18512 | ||
| 18513 | pub const __builtin_ve_vl_pvfmax_vsvMvl = struct { | |
| 18514 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18515 | const target_set = TargetSet.init(.{ | |
| 18516 | .vevl_gen = true, | |
| 18517 | }); | |
| 18518 | const attributes = Attributes{}; | |
| 18519 | }; | |
| 18520 | ||
| 18521 | pub const __builtin_ve_vl_pvfmax_vsvl = struct { | |
| 18522 | const param_str = "V256dLUiV256dUi"; | |
| 18523 | const target_set = TargetSet.init(.{ | |
| 18524 | .vevl_gen = true, | |
| 18525 | }); | |
| 18526 | const attributes = Attributes{}; | |
| 18527 | }; | |
| 18528 | ||
| 18529 | pub const __builtin_ve_vl_pvfmax_vsvvl = struct { | |
| 18530 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18531 | const target_set = TargetSet.init(.{ | |
| 18532 | .vevl_gen = true, | |
| 18533 | }); | |
| 18534 | const attributes = Attributes{}; | |
| 18535 | }; | |
| 18536 | ||
| 18537 | pub const __builtin_ve_vl_pvfmax_vvvMvl = struct { | |
| 18538 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18539 | const target_set = TargetSet.init(.{ | |
| 18540 | .vevl_gen = true, | |
| 18541 | }); | |
| 18542 | const attributes = Attributes{}; | |
| 18543 | }; | |
| 18544 | ||
| 18545 | pub const __builtin_ve_vl_pvfmax_vvvl = struct { | |
| 18546 | const param_str = "V256dV256dV256dUi"; | |
| 18547 | const target_set = TargetSet.init(.{ | |
| 18548 | .vevl_gen = true, | |
| 18549 | }); | |
| 18550 | const attributes = Attributes{}; | |
| 18551 | }; | |
| 18552 | ||
| 18553 | pub const __builtin_ve_vl_pvfmax_vvvvl = struct { | |
| 18554 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18555 | const target_set = TargetSet.init(.{ | |
| 18556 | .vevl_gen = true, | |
| 18557 | }); | |
| 18558 | const attributes = Attributes{}; | |
| 18559 | }; | |
| 18560 | ||
| 18561 | pub const __builtin_ve_vl_pvfmin_vsvMvl = struct { | |
| 18562 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 18563 | const target_set = TargetSet.init(.{ | |
| 18564 | .vevl_gen = true, | |
| 18565 | }); | |
| 18566 | const attributes = Attributes{}; | |
| 18567 | }; | |
| 18568 | ||
| 18569 | pub const __builtin_ve_vl_pvfmin_vsvl = struct { | |
| 18570 | const param_str = "V256dLUiV256dUi"; | |
| 18571 | const target_set = TargetSet.init(.{ | |
| 18572 | .vevl_gen = true, | |
| 18573 | }); | |
| 18574 | const attributes = Attributes{}; | |
| 18575 | }; | |
| 18576 | ||
| 18577 | pub const __builtin_ve_vl_pvfmin_vsvvl = struct { | |
| 18578 | const param_str = "V256dLUiV256dV256dUi"; | |
| 18579 | const target_set = TargetSet.init(.{ | |
| 18580 | .vevl_gen = true, | |
| 18581 | }); | |
| 18582 | const attributes = Attributes{}; | |
| 18583 | }; | |
| 18584 | ||
| 18585 | pub const __builtin_ve_vl_pvfmin_vvvMvl = struct { | |
| 18586 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 18587 | const target_set = TargetSet.init(.{ | |
| 18588 | .vevl_gen = true, | |
| 18589 | }); | |
| 18590 | const attributes = Attributes{}; | |
| 18591 | }; | |
| 18592 | ||
| 18593 | pub const __builtin_ve_vl_pvfmin_vvvl = struct { | |
| 18594 | const param_str = "V256dV256dV256dUi"; | |
| 18595 | const target_set = TargetSet.init(.{ | |
| 18596 | .vevl_gen = true, | |
| 18597 | }); | |
| 18598 | const attributes = Attributes{}; | |
| 18599 | }; | |
| 18600 | ||
| 18601 | pub const __builtin_ve_vl_pvfmin_vvvvl = struct { | |
| 18602 | const param_str = "V256dV256dV256dV256dUi"; | |
| 18603 | const target_set = TargetSet.init(.{ | |
| 18604 | .vevl_gen = true, | |
| 18605 | }); | |
| 18606 | const attributes = Attributes{}; | |
| 18607 | }; | |
| 18608 | ||
| 18609 | pub const __builtin_ve_vl_pvfmkaf_Ml = struct { | |
| 18610 | const param_str = "V512bUi"; | |
| 18611 | const target_set = TargetSet.init(.{ | |
| 18612 | .vevl_gen = true, | |
| 18613 | }); | |
| 18614 | const attributes = Attributes{}; | |
| 18615 | }; | |
| 18616 | ||
| 18617 | pub const __builtin_ve_vl_pvfmkat_Ml = struct { | |
| 18618 | const param_str = "V512bUi"; | |
| 18619 | const target_set = TargetSet.init(.{ | |
| 18620 | .vevl_gen = true, | |
| 18621 | }); | |
| 18622 | const attributes = Attributes{}; | |
| 18623 | }; | |
| 18624 | ||
| 18625 | pub const __builtin_ve_vl_pvfmkseq_MvMl = struct { | |
| 18626 | const param_str = "V512bV256dV512bUi"; | |
| 18627 | const target_set = TargetSet.init(.{ | |
| 18628 | .vevl_gen = true, | |
| 18629 | }); | |
| 18630 | const attributes = Attributes{}; | |
| 18631 | }; | |
| 18632 | ||
| 18633 | pub const __builtin_ve_vl_pvfmkseq_Mvl = struct { | |
| 18634 | const param_str = "V512bV256dUi"; | |
| 18635 | const target_set = TargetSet.init(.{ | |
| 18636 | .vevl_gen = true, | |
| 18637 | }); | |
| 18638 | const attributes = Attributes{}; | |
| 18639 | }; | |
| 18640 | ||
| 18641 | pub const __builtin_ve_vl_pvfmkseqnan_MvMl = struct { | |
| 18642 | const param_str = "V512bV256dV512bUi"; | |
| 18643 | const target_set = TargetSet.init(.{ | |
| 18644 | .vevl_gen = true, | |
| 18645 | }); | |
| 18646 | const attributes = Attributes{}; | |
| 18647 | }; | |
| 18648 | ||
| 18649 | pub const __builtin_ve_vl_pvfmkseqnan_Mvl = struct { | |
| 18650 | const param_str = "V512bV256dUi"; | |
| 18651 | const target_set = TargetSet.init(.{ | |
| 18652 | .vevl_gen = true, | |
| 18653 | }); | |
| 18654 | const attributes = Attributes{}; | |
| 18655 | }; | |
| 18656 | ||
| 18657 | pub const __builtin_ve_vl_pvfmksge_MvMl = struct { | |
| 18658 | const param_str = "V512bV256dV512bUi"; | |
| 18659 | const target_set = TargetSet.init(.{ | |
| 18660 | .vevl_gen = true, | |
| 18661 | }); | |
| 18662 | const attributes = Attributes{}; | |
| 18663 | }; | |
| 18664 | ||
| 18665 | pub const __builtin_ve_vl_pvfmksge_Mvl = struct { | |
| 18666 | const param_str = "V512bV256dUi"; | |
| 18667 | const target_set = TargetSet.init(.{ | |
| 18668 | .vevl_gen = true, | |
| 18669 | }); | |
| 18670 | const attributes = Attributes{}; | |
| 18671 | }; | |
| 18672 | ||
| 18673 | pub const __builtin_ve_vl_pvfmksgenan_MvMl = struct { | |
| 18674 | const param_str = "V512bV256dV512bUi"; | |
| 18675 | const target_set = TargetSet.init(.{ | |
| 18676 | .vevl_gen = true, | |
| 18677 | }); | |
| 18678 | const attributes = Attributes{}; | |
| 18679 | }; | |
| 18680 | ||
| 18681 | pub const __builtin_ve_vl_pvfmksgenan_Mvl = struct { | |
| 18682 | const param_str = "V512bV256dUi"; | |
| 18683 | const target_set = TargetSet.init(.{ | |
| 18684 | .vevl_gen = true, | |
| 18685 | }); | |
| 18686 | const attributes = Attributes{}; | |
| 18687 | }; | |
| 18688 | ||
| 18689 | pub const __builtin_ve_vl_pvfmksgt_MvMl = struct { | |
| 18690 | const param_str = "V512bV256dV512bUi"; | |
| 18691 | const target_set = TargetSet.init(.{ | |
| 18692 | .vevl_gen = true, | |
| 18693 | }); | |
| 18694 | const attributes = Attributes{}; | |
| 18695 | }; | |
| 18696 | ||
| 18697 | pub const __builtin_ve_vl_pvfmksgt_Mvl = struct { | |
| 18698 | const param_str = "V512bV256dUi"; | |
| 18699 | const target_set = TargetSet.init(.{ | |
| 18700 | .vevl_gen = true, | |
| 18701 | }); | |
| 18702 | const attributes = Attributes{}; | |
| 18703 | }; | |
| 18704 | ||
| 18705 | pub const __builtin_ve_vl_pvfmksgtnan_MvMl = struct { | |
| 18706 | const param_str = "V512bV256dV512bUi"; | |
| 18707 | const target_set = TargetSet.init(.{ | |
| 18708 | .vevl_gen = true, | |
| 18709 | }); | |
| 18710 | const attributes = Attributes{}; | |
| 18711 | }; | |
| 18712 | ||
| 18713 | pub const __builtin_ve_vl_pvfmksgtnan_Mvl = struct { | |
| 18714 | const param_str = "V512bV256dUi"; | |
| 18715 | const target_set = TargetSet.init(.{ | |
| 18716 | .vevl_gen = true, | |
| 18717 | }); | |
| 18718 | const attributes = Attributes{}; | |
| 18719 | }; | |
| 18720 | ||
| 18721 | pub const __builtin_ve_vl_pvfmksle_MvMl = struct { | |
| 18722 | const param_str = "V512bV256dV512bUi"; | |
| 18723 | const target_set = TargetSet.init(.{ | |
| 18724 | .vevl_gen = true, | |
| 18725 | }); | |
| 18726 | const attributes = Attributes{}; | |
| 18727 | }; | |
| 18728 | ||
| 18729 | pub const __builtin_ve_vl_pvfmksle_Mvl = struct { | |
| 18730 | const param_str = "V512bV256dUi"; | |
| 18731 | const target_set = TargetSet.init(.{ | |
| 18732 | .vevl_gen = true, | |
| 18733 | }); | |
| 18734 | const attributes = Attributes{}; | |
| 18735 | }; | |
| 18736 | ||
| 18737 | pub const __builtin_ve_vl_pvfmkslenan_MvMl = struct { | |
| 18738 | const param_str = "V512bV256dV512bUi"; | |
| 18739 | const target_set = TargetSet.init(.{ | |
| 18740 | .vevl_gen = true, | |
| 18741 | }); | |
| 18742 | const attributes = Attributes{}; | |
| 18743 | }; | |
| 18744 | ||
| 18745 | pub const __builtin_ve_vl_pvfmkslenan_Mvl = struct { | |
| 18746 | const param_str = "V512bV256dUi"; | |
| 18747 | const target_set = TargetSet.init(.{ | |
| 18748 | .vevl_gen = true, | |
| 18749 | }); | |
| 18750 | const attributes = Attributes{}; | |
| 18751 | }; | |
| 18752 | ||
| 18753 | pub const __builtin_ve_vl_pvfmksloeq_mvl = struct { | |
| 18754 | const param_str = "V256bV256dUi"; | |
| 18755 | const target_set = TargetSet.init(.{ | |
| 18756 | .vevl_gen = true, | |
| 18757 | }); | |
| 18758 | const attributes = Attributes{}; | |
| 18759 | }; | |
| 18760 | ||
| 18761 | pub const __builtin_ve_vl_pvfmksloeq_mvml = struct { | |
| 18762 | const param_str = "V256bV256dV256bUi"; | |
| 18763 | const target_set = TargetSet.init(.{ | |
| 18764 | .vevl_gen = true, | |
| 18765 | }); | |
| 18766 | const attributes = Attributes{}; | |
| 18767 | }; | |
| 18768 | ||
| 18769 | pub const __builtin_ve_vl_pvfmksloeqnan_mvl = struct { | |
| 18770 | const param_str = "V256bV256dUi"; | |
| 18771 | const target_set = TargetSet.init(.{ | |
| 18772 | .vevl_gen = true, | |
| 18773 | }); | |
| 18774 | const attributes = Attributes{}; | |
| 18775 | }; | |
| 18776 | ||
| 18777 | pub const __builtin_ve_vl_pvfmksloeqnan_mvml = struct { | |
| 18778 | const param_str = "V256bV256dV256bUi"; | |
| 18779 | const target_set = TargetSet.init(.{ | |
| 18780 | .vevl_gen = true, | |
| 18781 | }); | |
| 18782 | const attributes = Attributes{}; | |
| 18783 | }; | |
| 18784 | ||
| 18785 | pub const __builtin_ve_vl_pvfmksloge_mvl = struct { | |
| 18786 | const param_str = "V256bV256dUi"; | |
| 18787 | const target_set = TargetSet.init(.{ | |
| 18788 | .vevl_gen = true, | |
| 18789 | }); | |
| 18790 | const attributes = Attributes{}; | |
| 18791 | }; | |
| 18792 | ||
| 18793 | pub const __builtin_ve_vl_pvfmksloge_mvml = struct { | |
| 18794 | const param_str = "V256bV256dV256bUi"; | |
| 18795 | const target_set = TargetSet.init(.{ | |
| 18796 | .vevl_gen = true, | |
| 18797 | }); | |
| 18798 | const attributes = Attributes{}; | |
| 18799 | }; | |
| 18800 | ||
| 18801 | pub const __builtin_ve_vl_pvfmkslogenan_mvl = struct { | |
| 18802 | const param_str = "V256bV256dUi"; | |
| 18803 | const target_set = TargetSet.init(.{ | |
| 18804 | .vevl_gen = true, | |
| 18805 | }); | |
| 18806 | const attributes = Attributes{}; | |
| 18807 | }; | |
| 18808 | ||
| 18809 | pub const __builtin_ve_vl_pvfmkslogenan_mvml = struct { | |
| 18810 | const param_str = "V256bV256dV256bUi"; | |
| 18811 | const target_set = TargetSet.init(.{ | |
| 18812 | .vevl_gen = true, | |
| 18813 | }); | |
| 18814 | const attributes = Attributes{}; | |
| 18815 | }; | |
| 18816 | ||
| 18817 | pub const __builtin_ve_vl_pvfmkslogt_mvl = struct { | |
| 18818 | const param_str = "V256bV256dUi"; | |
| 18819 | const target_set = TargetSet.init(.{ | |
| 18820 | .vevl_gen = true, | |
| 18821 | }); | |
| 18822 | const attributes = Attributes{}; | |
| 18823 | }; | |
| 18824 | ||
| 18825 | pub const __builtin_ve_vl_pvfmkslogt_mvml = struct { | |
| 18826 | const param_str = "V256bV256dV256bUi"; | |
| 18827 | const target_set = TargetSet.init(.{ | |
| 18828 | .vevl_gen = true, | |
| 18829 | }); | |
| 18830 | const attributes = Attributes{}; | |
| 18831 | }; | |
| 18832 | ||
| 18833 | pub const __builtin_ve_vl_pvfmkslogtnan_mvl = struct { | |
| 18834 | const param_str = "V256bV256dUi"; | |
| 18835 | const target_set = TargetSet.init(.{ | |
| 18836 | .vevl_gen = true, | |
| 18837 | }); | |
| 18838 | const attributes = Attributes{}; | |
| 18839 | }; | |
| 18840 | ||
| 18841 | pub const __builtin_ve_vl_pvfmkslogtnan_mvml = struct { | |
| 18842 | const param_str = "V256bV256dV256bUi"; | |
| 18843 | const target_set = TargetSet.init(.{ | |
| 18844 | .vevl_gen = true, | |
| 18845 | }); | |
| 18846 | const attributes = Attributes{}; | |
| 18847 | }; | |
| 18848 | ||
| 18849 | pub const __builtin_ve_vl_pvfmkslole_mvl = struct { | |
| 18850 | const param_str = "V256bV256dUi"; | |
| 18851 | const target_set = TargetSet.init(.{ | |
| 18852 | .vevl_gen = true, | |
| 18853 | }); | |
| 18854 | const attributes = Attributes{}; | |
| 18855 | }; | |
| 18856 | ||
| 18857 | pub const __builtin_ve_vl_pvfmkslole_mvml = struct { | |
| 18858 | const param_str = "V256bV256dV256bUi"; | |
| 18859 | const target_set = TargetSet.init(.{ | |
| 18860 | .vevl_gen = true, | |
| 18861 | }); | |
| 18862 | const attributes = Attributes{}; | |
| 18863 | }; | |
| 18864 | ||
| 18865 | pub const __builtin_ve_vl_pvfmkslolenan_mvl = struct { | |
| 18866 | const param_str = "V256bV256dUi"; | |
| 18867 | const target_set = TargetSet.init(.{ | |
| 18868 | .vevl_gen = true, | |
| 18869 | }); | |
| 18870 | const attributes = Attributes{}; | |
| 18871 | }; | |
| 18872 | ||
| 18873 | pub const __builtin_ve_vl_pvfmkslolenan_mvml = struct { | |
| 18874 | const param_str = "V256bV256dV256bUi"; | |
| 18875 | const target_set = TargetSet.init(.{ | |
| 18876 | .vevl_gen = true, | |
| 18877 | }); | |
| 18878 | const attributes = Attributes{}; | |
| 18879 | }; | |
| 18880 | ||
| 18881 | pub const __builtin_ve_vl_pvfmkslolt_mvl = struct { | |
| 18882 | const param_str = "V256bV256dUi"; | |
| 18883 | const target_set = TargetSet.init(.{ | |
| 18884 | .vevl_gen = true, | |
| 18885 | }); | |
| 18886 | const attributes = Attributes{}; | |
| 18887 | }; | |
| 18888 | ||
| 18889 | pub const __builtin_ve_vl_pvfmkslolt_mvml = struct { | |
| 18890 | const param_str = "V256bV256dV256bUi"; | |
| 18891 | const target_set = TargetSet.init(.{ | |
| 18892 | .vevl_gen = true, | |
| 18893 | }); | |
| 18894 | const attributes = Attributes{}; | |
| 18895 | }; | |
| 18896 | ||
| 18897 | pub const __builtin_ve_vl_pvfmksloltnan_mvl = struct { | |
| 18898 | const param_str = "V256bV256dUi"; | |
| 18899 | const target_set = TargetSet.init(.{ | |
| 18900 | .vevl_gen = true, | |
| 18901 | }); | |
| 18902 | const attributes = Attributes{}; | |
| 18903 | }; | |
| 18904 | ||
| 18905 | pub const __builtin_ve_vl_pvfmksloltnan_mvml = struct { | |
| 18906 | const param_str = "V256bV256dV256bUi"; | |
| 18907 | const target_set = TargetSet.init(.{ | |
| 18908 | .vevl_gen = true, | |
| 18909 | }); | |
| 18910 | const attributes = Attributes{}; | |
| 18911 | }; | |
| 18912 | ||
| 18913 | pub const __builtin_ve_vl_pvfmkslonan_mvl = struct { | |
| 18914 | const param_str = "V256bV256dUi"; | |
| 18915 | const target_set = TargetSet.init(.{ | |
| 18916 | .vevl_gen = true, | |
| 18917 | }); | |
| 18918 | const attributes = Attributes{}; | |
| 18919 | }; | |
| 18920 | ||
| 18921 | pub const __builtin_ve_vl_pvfmkslonan_mvml = struct { | |
| 18922 | const param_str = "V256bV256dV256bUi"; | |
| 18923 | const target_set = TargetSet.init(.{ | |
| 18924 | .vevl_gen = true, | |
| 18925 | }); | |
| 18926 | const attributes = Attributes{}; | |
| 18927 | }; | |
| 18928 | ||
| 18929 | pub const __builtin_ve_vl_pvfmkslone_mvl = struct { | |
| 18930 | const param_str = "V256bV256dUi"; | |
| 18931 | const target_set = TargetSet.init(.{ | |
| 18932 | .vevl_gen = true, | |
| 18933 | }); | |
| 18934 | const attributes = Attributes{}; | |
| 18935 | }; | |
| 18936 | ||
| 18937 | pub const __builtin_ve_vl_pvfmkslone_mvml = struct { | |
| 18938 | const param_str = "V256bV256dV256bUi"; | |
| 18939 | const target_set = TargetSet.init(.{ | |
| 18940 | .vevl_gen = true, | |
| 18941 | }); | |
| 18942 | const attributes = Attributes{}; | |
| 18943 | }; | |
| 18944 | ||
| 18945 | pub const __builtin_ve_vl_pvfmkslonenan_mvl = struct { | |
| 18946 | const param_str = "V256bV256dUi"; | |
| 18947 | const target_set = TargetSet.init(.{ | |
| 18948 | .vevl_gen = true, | |
| 18949 | }); | |
| 18950 | const attributes = Attributes{}; | |
| 18951 | }; | |
| 18952 | ||
| 18953 | pub const __builtin_ve_vl_pvfmkslonenan_mvml = struct { | |
| 18954 | const param_str = "V256bV256dV256bUi"; | |
| 18955 | const target_set = TargetSet.init(.{ | |
| 18956 | .vevl_gen = true, | |
| 18957 | }); | |
| 18958 | const attributes = Attributes{}; | |
| 18959 | }; | |
| 18960 | ||
| 18961 | pub const __builtin_ve_vl_pvfmkslonum_mvl = struct { | |
| 18962 | const param_str = "V256bV256dUi"; | |
| 18963 | const target_set = TargetSet.init(.{ | |
| 18964 | .vevl_gen = true, | |
| 18965 | }); | |
| 18966 | const attributes = Attributes{}; | |
| 18967 | }; | |
| 18968 | ||
| 18969 | pub const __builtin_ve_vl_pvfmkslonum_mvml = struct { | |
| 18970 | const param_str = "V256bV256dV256bUi"; | |
| 18971 | const target_set = TargetSet.init(.{ | |
| 18972 | .vevl_gen = true, | |
| 18973 | }); | |
| 18974 | const attributes = Attributes{}; | |
| 18975 | }; | |
| 18976 | ||
| 18977 | pub const __builtin_ve_vl_pvfmkslt_MvMl = struct { | |
| 18978 | const param_str = "V512bV256dV512bUi"; | |
| 18979 | const target_set = TargetSet.init(.{ | |
| 18980 | .vevl_gen = true, | |
| 18981 | }); | |
| 18982 | const attributes = Attributes{}; | |
| 18983 | }; | |
| 18984 | ||
| 18985 | pub const __builtin_ve_vl_pvfmkslt_Mvl = struct { | |
| 18986 | const param_str = "V512bV256dUi"; | |
| 18987 | const target_set = TargetSet.init(.{ | |
| 18988 | .vevl_gen = true, | |
| 18989 | }); | |
| 18990 | const attributes = Attributes{}; | |
| 18991 | }; | |
| 18992 | ||
| 18993 | pub const __builtin_ve_vl_pvfmksltnan_MvMl = struct { | |
| 18994 | const param_str = "V512bV256dV512bUi"; | |
| 18995 | const target_set = TargetSet.init(.{ | |
| 18996 | .vevl_gen = true, | |
| 18997 | }); | |
| 18998 | const attributes = Attributes{}; | |
| 18999 | }; | |
| 19000 | ||
| 19001 | pub const __builtin_ve_vl_pvfmksltnan_Mvl = struct { | |
| 19002 | const param_str = "V512bV256dUi"; | |
| 19003 | const target_set = TargetSet.init(.{ | |
| 19004 | .vevl_gen = true, | |
| 19005 | }); | |
| 19006 | const attributes = Attributes{}; | |
| 19007 | }; | |
| 19008 | ||
| 19009 | pub const __builtin_ve_vl_pvfmksnan_MvMl = struct { | |
| 19010 | const param_str = "V512bV256dV512bUi"; | |
| 19011 | const target_set = TargetSet.init(.{ | |
| 19012 | .vevl_gen = true, | |
| 19013 | }); | |
| 19014 | const attributes = Attributes{}; | |
| 19015 | }; | |
| 19016 | ||
| 19017 | pub const __builtin_ve_vl_pvfmksnan_Mvl = struct { | |
| 19018 | const param_str = "V512bV256dUi"; | |
| 19019 | const target_set = TargetSet.init(.{ | |
| 19020 | .vevl_gen = true, | |
| 19021 | }); | |
| 19022 | const attributes = Attributes{}; | |
| 19023 | }; | |
| 19024 | ||
| 19025 | pub const __builtin_ve_vl_pvfmksne_MvMl = struct { | |
| 19026 | const param_str = "V512bV256dV512bUi"; | |
| 19027 | const target_set = TargetSet.init(.{ | |
| 19028 | .vevl_gen = true, | |
| 19029 | }); | |
| 19030 | const attributes = Attributes{}; | |
| 19031 | }; | |
| 19032 | ||
| 19033 | pub const __builtin_ve_vl_pvfmksne_Mvl = struct { | |
| 19034 | const param_str = "V512bV256dUi"; | |
| 19035 | const target_set = TargetSet.init(.{ | |
| 19036 | .vevl_gen = true, | |
| 19037 | }); | |
| 19038 | const attributes = Attributes{}; | |
| 19039 | }; | |
| 19040 | ||
| 19041 | pub const __builtin_ve_vl_pvfmksnenan_MvMl = struct { | |
| 19042 | const param_str = "V512bV256dV512bUi"; | |
| 19043 | const target_set = TargetSet.init(.{ | |
| 19044 | .vevl_gen = true, | |
| 19045 | }); | |
| 19046 | const attributes = Attributes{}; | |
| 19047 | }; | |
| 19048 | ||
| 19049 | pub const __builtin_ve_vl_pvfmksnenan_Mvl = struct { | |
| 19050 | const param_str = "V512bV256dUi"; | |
| 19051 | const target_set = TargetSet.init(.{ | |
| 19052 | .vevl_gen = true, | |
| 19053 | }); | |
| 19054 | const attributes = Attributes{}; | |
| 19055 | }; | |
| 19056 | ||
| 19057 | pub const __builtin_ve_vl_pvfmksnum_MvMl = struct { | |
| 19058 | const param_str = "V512bV256dV512bUi"; | |
| 19059 | const target_set = TargetSet.init(.{ | |
| 19060 | .vevl_gen = true, | |
| 19061 | }); | |
| 19062 | const attributes = Attributes{}; | |
| 19063 | }; | |
| 19064 | ||
| 19065 | pub const __builtin_ve_vl_pvfmksnum_Mvl = struct { | |
| 19066 | const param_str = "V512bV256dUi"; | |
| 19067 | const target_set = TargetSet.init(.{ | |
| 19068 | .vevl_gen = true, | |
| 19069 | }); | |
| 19070 | const attributes = Attributes{}; | |
| 19071 | }; | |
| 19072 | ||
| 19073 | pub const __builtin_ve_vl_pvfmksupeq_mvl = struct { | |
| 19074 | const param_str = "V256bV256dUi"; | |
| 19075 | const target_set = TargetSet.init(.{ | |
| 19076 | .vevl_gen = true, | |
| 19077 | }); | |
| 19078 | const attributes = Attributes{}; | |
| 19079 | }; | |
| 19080 | ||
| 19081 | pub const __builtin_ve_vl_pvfmksupeq_mvml = struct { | |
| 19082 | const param_str = "V256bV256dV256bUi"; | |
| 19083 | const target_set = TargetSet.init(.{ | |
| 19084 | .vevl_gen = true, | |
| 19085 | }); | |
| 19086 | const attributes = Attributes{}; | |
| 19087 | }; | |
| 19088 | ||
| 19089 | pub const __builtin_ve_vl_pvfmksupeqnan_mvl = struct { | |
| 19090 | const param_str = "V256bV256dUi"; | |
| 19091 | const target_set = TargetSet.init(.{ | |
| 19092 | .vevl_gen = true, | |
| 19093 | }); | |
| 19094 | const attributes = Attributes{}; | |
| 19095 | }; | |
| 19096 | ||
| 19097 | pub const __builtin_ve_vl_pvfmksupeqnan_mvml = struct { | |
| 19098 | const param_str = "V256bV256dV256bUi"; | |
| 19099 | const target_set = TargetSet.init(.{ | |
| 19100 | .vevl_gen = true, | |
| 19101 | }); | |
| 19102 | const attributes = Attributes{}; | |
| 19103 | }; | |
| 19104 | ||
| 19105 | pub const __builtin_ve_vl_pvfmksupge_mvl = struct { | |
| 19106 | const param_str = "V256bV256dUi"; | |
| 19107 | const target_set = TargetSet.init(.{ | |
| 19108 | .vevl_gen = true, | |
| 19109 | }); | |
| 19110 | const attributes = Attributes{}; | |
| 19111 | }; | |
| 19112 | ||
| 19113 | pub const __builtin_ve_vl_pvfmksupge_mvml = struct { | |
| 19114 | const param_str = "V256bV256dV256bUi"; | |
| 19115 | const target_set = TargetSet.init(.{ | |
| 19116 | .vevl_gen = true, | |
| 19117 | }); | |
| 19118 | const attributes = Attributes{}; | |
| 19119 | }; | |
| 19120 | ||
| 19121 | pub const __builtin_ve_vl_pvfmksupgenan_mvl = struct { | |
| 19122 | const param_str = "V256bV256dUi"; | |
| 19123 | const target_set = TargetSet.init(.{ | |
| 19124 | .vevl_gen = true, | |
| 19125 | }); | |
| 19126 | const attributes = Attributes{}; | |
| 19127 | }; | |
| 19128 | ||
| 19129 | pub const __builtin_ve_vl_pvfmksupgenan_mvml = struct { | |
| 19130 | const param_str = "V256bV256dV256bUi"; | |
| 19131 | const target_set = TargetSet.init(.{ | |
| 19132 | .vevl_gen = true, | |
| 19133 | }); | |
| 19134 | const attributes = Attributes{}; | |
| 19135 | }; | |
| 19136 | ||
| 19137 | pub const __builtin_ve_vl_pvfmksupgt_mvl = struct { | |
| 19138 | const param_str = "V256bV256dUi"; | |
| 19139 | const target_set = TargetSet.init(.{ | |
| 19140 | .vevl_gen = true, | |
| 19141 | }); | |
| 19142 | const attributes = Attributes{}; | |
| 19143 | }; | |
| 19144 | ||
| 19145 | pub const __builtin_ve_vl_pvfmksupgt_mvml = struct { | |
| 19146 | const param_str = "V256bV256dV256bUi"; | |
| 19147 | const target_set = TargetSet.init(.{ | |
| 19148 | .vevl_gen = true, | |
| 19149 | }); | |
| 19150 | const attributes = Attributes{}; | |
| 19151 | }; | |
| 19152 | ||
| 19153 | pub const __builtin_ve_vl_pvfmksupgtnan_mvl = struct { | |
| 19154 | const param_str = "V256bV256dUi"; | |
| 19155 | const target_set = TargetSet.init(.{ | |
| 19156 | .vevl_gen = true, | |
| 19157 | }); | |
| 19158 | const attributes = Attributes{}; | |
| 19159 | }; | |
| 19160 | ||
| 19161 | pub const __builtin_ve_vl_pvfmksupgtnan_mvml = struct { | |
| 19162 | const param_str = "V256bV256dV256bUi"; | |
| 19163 | const target_set = TargetSet.init(.{ | |
| 19164 | .vevl_gen = true, | |
| 19165 | }); | |
| 19166 | const attributes = Attributes{}; | |
| 19167 | }; | |
| 19168 | ||
| 19169 | pub const __builtin_ve_vl_pvfmksuple_mvl = struct { | |
| 19170 | const param_str = "V256bV256dUi"; | |
| 19171 | const target_set = TargetSet.init(.{ | |
| 19172 | .vevl_gen = true, | |
| 19173 | }); | |
| 19174 | const attributes = Attributes{}; | |
| 19175 | }; | |
| 19176 | ||
| 19177 | pub const __builtin_ve_vl_pvfmksuple_mvml = struct { | |
| 19178 | const param_str = "V256bV256dV256bUi"; | |
| 19179 | const target_set = TargetSet.init(.{ | |
| 19180 | .vevl_gen = true, | |
| 19181 | }); | |
| 19182 | const attributes = Attributes{}; | |
| 19183 | }; | |
| 19184 | ||
| 19185 | pub const __builtin_ve_vl_pvfmksuplenan_mvl = struct { | |
| 19186 | const param_str = "V256bV256dUi"; | |
| 19187 | const target_set = TargetSet.init(.{ | |
| 19188 | .vevl_gen = true, | |
| 19189 | }); | |
| 19190 | const attributes = Attributes{}; | |
| 19191 | }; | |
| 19192 | ||
| 19193 | pub const __builtin_ve_vl_pvfmksuplenan_mvml = struct { | |
| 19194 | const param_str = "V256bV256dV256bUi"; | |
| 19195 | const target_set = TargetSet.init(.{ | |
| 19196 | .vevl_gen = true, | |
| 19197 | }); | |
| 19198 | const attributes = Attributes{}; | |
| 19199 | }; | |
| 19200 | ||
| 19201 | pub const __builtin_ve_vl_pvfmksuplt_mvl = struct { | |
| 19202 | const param_str = "V256bV256dUi"; | |
| 19203 | const target_set = TargetSet.init(.{ | |
| 19204 | .vevl_gen = true, | |
| 19205 | }); | |
| 19206 | const attributes = Attributes{}; | |
| 19207 | }; | |
| 19208 | ||
| 19209 | pub const __builtin_ve_vl_pvfmksuplt_mvml = struct { | |
| 19210 | const param_str = "V256bV256dV256bUi"; | |
| 19211 | const target_set = TargetSet.init(.{ | |
| 19212 | .vevl_gen = true, | |
| 19213 | }); | |
| 19214 | const attributes = Attributes{}; | |
| 19215 | }; | |
| 19216 | ||
| 19217 | pub const __builtin_ve_vl_pvfmksupltnan_mvl = struct { | |
| 19218 | const param_str = "V256bV256dUi"; | |
| 19219 | const target_set = TargetSet.init(.{ | |
| 19220 | .vevl_gen = true, | |
| 19221 | }); | |
| 19222 | const attributes = Attributes{}; | |
| 19223 | }; | |
| 19224 | ||
| 19225 | pub const __builtin_ve_vl_pvfmksupltnan_mvml = struct { | |
| 19226 | const param_str = "V256bV256dV256bUi"; | |
| 19227 | const target_set = TargetSet.init(.{ | |
| 19228 | .vevl_gen = true, | |
| 19229 | }); | |
| 19230 | const attributes = Attributes{}; | |
| 19231 | }; | |
| 19232 | ||
| 19233 | pub const __builtin_ve_vl_pvfmksupnan_mvl = struct { | |
| 19234 | const param_str = "V256bV256dUi"; | |
| 19235 | const target_set = TargetSet.init(.{ | |
| 19236 | .vevl_gen = true, | |
| 19237 | }); | |
| 19238 | const attributes = Attributes{}; | |
| 19239 | }; | |
| 19240 | ||
| 19241 | pub const __builtin_ve_vl_pvfmksupnan_mvml = struct { | |
| 19242 | const param_str = "V256bV256dV256bUi"; | |
| 19243 | const target_set = TargetSet.init(.{ | |
| 19244 | .vevl_gen = true, | |
| 19245 | }); | |
| 19246 | const attributes = Attributes{}; | |
| 19247 | }; | |
| 19248 | ||
| 19249 | pub const __builtin_ve_vl_pvfmksupne_mvl = struct { | |
| 19250 | const param_str = "V256bV256dUi"; | |
| 19251 | const target_set = TargetSet.init(.{ | |
| 19252 | .vevl_gen = true, | |
| 19253 | }); | |
| 19254 | const attributes = Attributes{}; | |
| 19255 | }; | |
| 19256 | ||
| 19257 | pub const __builtin_ve_vl_pvfmksupne_mvml = struct { | |
| 19258 | const param_str = "V256bV256dV256bUi"; | |
| 19259 | const target_set = TargetSet.init(.{ | |
| 19260 | .vevl_gen = true, | |
| 19261 | }); | |
| 19262 | const attributes = Attributes{}; | |
| 19263 | }; | |
| 19264 | ||
| 19265 | pub const __builtin_ve_vl_pvfmksupnenan_mvl = struct { | |
| 19266 | const param_str = "V256bV256dUi"; | |
| 19267 | const target_set = TargetSet.init(.{ | |
| 19268 | .vevl_gen = true, | |
| 19269 | }); | |
| 19270 | const attributes = Attributes{}; | |
| 19271 | }; | |
| 19272 | ||
| 19273 | pub const __builtin_ve_vl_pvfmksupnenan_mvml = struct { | |
| 19274 | const param_str = "V256bV256dV256bUi"; | |
| 19275 | const target_set = TargetSet.init(.{ | |
| 19276 | .vevl_gen = true, | |
| 19277 | }); | |
| 19278 | const attributes = Attributes{}; | |
| 19279 | }; | |
| 19280 | ||
| 19281 | pub const __builtin_ve_vl_pvfmksupnum_mvl = struct { | |
| 19282 | const param_str = "V256bV256dUi"; | |
| 19283 | const target_set = TargetSet.init(.{ | |
| 19284 | .vevl_gen = true, | |
| 19285 | }); | |
| 19286 | const attributes = Attributes{}; | |
| 19287 | }; | |
| 19288 | ||
| 19289 | pub const __builtin_ve_vl_pvfmksupnum_mvml = struct { | |
| 19290 | const param_str = "V256bV256dV256bUi"; | |
| 19291 | const target_set = TargetSet.init(.{ | |
| 19292 | .vevl_gen = true, | |
| 19293 | }); | |
| 19294 | const attributes = Attributes{}; | |
| 19295 | }; | |
| 19296 | ||
| 19297 | pub const __builtin_ve_vl_pvfmkweq_MvMl = struct { | |
| 19298 | const param_str = "V512bV256dV512bUi"; | |
| 19299 | const target_set = TargetSet.init(.{ | |
| 19300 | .vevl_gen = true, | |
| 19301 | }); | |
| 19302 | const attributes = Attributes{}; | |
| 19303 | }; | |
| 19304 | ||
| 19305 | pub const __builtin_ve_vl_pvfmkweq_Mvl = struct { | |
| 19306 | const param_str = "V512bV256dUi"; | |
| 19307 | const target_set = TargetSet.init(.{ | |
| 19308 | .vevl_gen = true, | |
| 19309 | }); | |
| 19310 | const attributes = Attributes{}; | |
| 19311 | }; | |
| 19312 | ||
| 19313 | pub const __builtin_ve_vl_pvfmkweqnan_MvMl = struct { | |
| 19314 | const param_str = "V512bV256dV512bUi"; | |
| 19315 | const target_set = TargetSet.init(.{ | |
| 19316 | .vevl_gen = true, | |
| 19317 | }); | |
| 19318 | const attributes = Attributes{}; | |
| 19319 | }; | |
| 19320 | ||
| 19321 | pub const __builtin_ve_vl_pvfmkweqnan_Mvl = struct { | |
| 19322 | const param_str = "V512bV256dUi"; | |
| 19323 | const target_set = TargetSet.init(.{ | |
| 19324 | .vevl_gen = true, | |
| 19325 | }); | |
| 19326 | const attributes = Attributes{}; | |
| 19327 | }; | |
| 19328 | ||
| 19329 | pub const __builtin_ve_vl_pvfmkwge_MvMl = struct { | |
| 19330 | const param_str = "V512bV256dV512bUi"; | |
| 19331 | const target_set = TargetSet.init(.{ | |
| 19332 | .vevl_gen = true, | |
| 19333 | }); | |
| 19334 | const attributes = Attributes{}; | |
| 19335 | }; | |
| 19336 | ||
| 19337 | pub const __builtin_ve_vl_pvfmkwge_Mvl = struct { | |
| 19338 | const param_str = "V512bV256dUi"; | |
| 19339 | const target_set = TargetSet.init(.{ | |
| 19340 | .vevl_gen = true, | |
| 19341 | }); | |
| 19342 | const attributes = Attributes{}; | |
| 19343 | }; | |
| 19344 | ||
| 19345 | pub const __builtin_ve_vl_pvfmkwgenan_MvMl = struct { | |
| 19346 | const param_str = "V512bV256dV512bUi"; | |
| 19347 | const target_set = TargetSet.init(.{ | |
| 19348 | .vevl_gen = true, | |
| 19349 | }); | |
| 19350 | const attributes = Attributes{}; | |
| 19351 | }; | |
| 19352 | ||
| 19353 | pub const __builtin_ve_vl_pvfmkwgenan_Mvl = struct { | |
| 19354 | const param_str = "V512bV256dUi"; | |
| 19355 | const target_set = TargetSet.init(.{ | |
| 19356 | .vevl_gen = true, | |
| 19357 | }); | |
| 19358 | const attributes = Attributes{}; | |
| 19359 | }; | |
| 19360 | ||
| 19361 | pub const __builtin_ve_vl_pvfmkwgt_MvMl = struct { | |
| 19362 | const param_str = "V512bV256dV512bUi"; | |
| 19363 | const target_set = TargetSet.init(.{ | |
| 19364 | .vevl_gen = true, | |
| 19365 | }); | |
| 19366 | const attributes = Attributes{}; | |
| 19367 | }; | |
| 19368 | ||
| 19369 | pub const __builtin_ve_vl_pvfmkwgt_Mvl = struct { | |
| 19370 | const param_str = "V512bV256dUi"; | |
| 19371 | const target_set = TargetSet.init(.{ | |
| 19372 | .vevl_gen = true, | |
| 19373 | }); | |
| 19374 | const attributes = Attributes{}; | |
| 19375 | }; | |
| 19376 | ||
| 19377 | pub const __builtin_ve_vl_pvfmkwgtnan_MvMl = struct { | |
| 19378 | const param_str = "V512bV256dV512bUi"; | |
| 19379 | const target_set = TargetSet.init(.{ | |
| 19380 | .vevl_gen = true, | |
| 19381 | }); | |
| 19382 | const attributes = Attributes{}; | |
| 19383 | }; | |
| 19384 | ||
| 19385 | pub const __builtin_ve_vl_pvfmkwgtnan_Mvl = struct { | |
| 19386 | const param_str = "V512bV256dUi"; | |
| 19387 | const target_set = TargetSet.init(.{ | |
| 19388 | .vevl_gen = true, | |
| 19389 | }); | |
| 19390 | const attributes = Attributes{}; | |
| 19391 | }; | |
| 19392 | ||
| 19393 | pub const __builtin_ve_vl_pvfmkwle_MvMl = struct { | |
| 19394 | const param_str = "V512bV256dV512bUi"; | |
| 19395 | const target_set = TargetSet.init(.{ | |
| 19396 | .vevl_gen = true, | |
| 19397 | }); | |
| 19398 | const attributes = Attributes{}; | |
| 19399 | }; | |
| 19400 | ||
| 19401 | pub const __builtin_ve_vl_pvfmkwle_Mvl = struct { | |
| 19402 | const param_str = "V512bV256dUi"; | |
| 19403 | const target_set = TargetSet.init(.{ | |
| 19404 | .vevl_gen = true, | |
| 19405 | }); | |
| 19406 | const attributes = Attributes{}; | |
| 19407 | }; | |
| 19408 | ||
| 19409 | pub const __builtin_ve_vl_pvfmkwlenan_MvMl = struct { | |
| 19410 | const param_str = "V512bV256dV512bUi"; | |
| 19411 | const target_set = TargetSet.init(.{ | |
| 19412 | .vevl_gen = true, | |
| 19413 | }); | |
| 19414 | const attributes = Attributes{}; | |
| 19415 | }; | |
| 19416 | ||
| 19417 | pub const __builtin_ve_vl_pvfmkwlenan_Mvl = struct { | |
| 19418 | const param_str = "V512bV256dUi"; | |
| 19419 | const target_set = TargetSet.init(.{ | |
| 19420 | .vevl_gen = true, | |
| 19421 | }); | |
| 19422 | const attributes = Attributes{}; | |
| 19423 | }; | |
| 19424 | ||
| 19425 | pub const __builtin_ve_vl_pvfmkwloeq_mvl = struct { | |
| 19426 | const param_str = "V256bV256dUi"; | |
| 19427 | const target_set = TargetSet.init(.{ | |
| 19428 | .vevl_gen = true, | |
| 19429 | }); | |
| 19430 | const attributes = Attributes{}; | |
| 19431 | }; | |
| 19432 | ||
| 19433 | pub const __builtin_ve_vl_pvfmkwloeq_mvml = struct { | |
| 19434 | const param_str = "V256bV256dV256bUi"; | |
| 19435 | const target_set = TargetSet.init(.{ | |
| 19436 | .vevl_gen = true, | |
| 19437 | }); | |
| 19438 | const attributes = Attributes{}; | |
| 19439 | }; | |
| 19440 | ||
| 19441 | pub const __builtin_ve_vl_pvfmkwloeqnan_mvl = struct { | |
| 19442 | const param_str = "V256bV256dUi"; | |
| 19443 | const target_set = TargetSet.init(.{ | |
| 19444 | .vevl_gen = true, | |
| 19445 | }); | |
| 19446 | const attributes = Attributes{}; | |
| 19447 | }; | |
| 19448 | ||
| 19449 | pub const __builtin_ve_vl_pvfmkwloeqnan_mvml = struct { | |
| 19450 | const param_str = "V256bV256dV256bUi"; | |
| 19451 | const target_set = TargetSet.init(.{ | |
| 19452 | .vevl_gen = true, | |
| 19453 | }); | |
| 19454 | const attributes = Attributes{}; | |
| 19455 | }; | |
| 19456 | ||
| 19457 | pub const __builtin_ve_vl_pvfmkwloge_mvl = struct { | |
| 19458 | const param_str = "V256bV256dUi"; | |
| 19459 | const target_set = TargetSet.init(.{ | |
| 19460 | .vevl_gen = true, | |
| 19461 | }); | |
| 19462 | const attributes = Attributes{}; | |
| 19463 | }; | |
| 19464 | ||
| 19465 | pub const __builtin_ve_vl_pvfmkwloge_mvml = struct { | |
| 19466 | const param_str = "V256bV256dV256bUi"; | |
| 19467 | const target_set = TargetSet.init(.{ | |
| 19468 | .vevl_gen = true, | |
| 19469 | }); | |
| 19470 | const attributes = Attributes{}; | |
| 19471 | }; | |
| 19472 | ||
| 19473 | pub const __builtin_ve_vl_pvfmkwlogenan_mvl = struct { | |
| 19474 | const param_str = "V256bV256dUi"; | |
| 19475 | const target_set = TargetSet.init(.{ | |
| 19476 | .vevl_gen = true, | |
| 19477 | }); | |
| 19478 | const attributes = Attributes{}; | |
| 19479 | }; | |
| 19480 | ||
| 19481 | pub const __builtin_ve_vl_pvfmkwlogenan_mvml = struct { | |
| 19482 | const param_str = "V256bV256dV256bUi"; | |
| 19483 | const target_set = TargetSet.init(.{ | |
| 19484 | .vevl_gen = true, | |
| 19485 | }); | |
| 19486 | const attributes = Attributes{}; | |
| 19487 | }; | |
| 19488 | ||
| 19489 | pub const __builtin_ve_vl_pvfmkwlogt_mvl = struct { | |
| 19490 | const param_str = "V256bV256dUi"; | |
| 19491 | const target_set = TargetSet.init(.{ | |
| 19492 | .vevl_gen = true, | |
| 19493 | }); | |
| 19494 | const attributes = Attributes{}; | |
| 19495 | }; | |
| 19496 | ||
| 19497 | pub const __builtin_ve_vl_pvfmkwlogt_mvml = struct { | |
| 19498 | const param_str = "V256bV256dV256bUi"; | |
| 19499 | const target_set = TargetSet.init(.{ | |
| 19500 | .vevl_gen = true, | |
| 19501 | }); | |
| 19502 | const attributes = Attributes{}; | |
| 19503 | }; | |
| 19504 | ||
| 19505 | pub const __builtin_ve_vl_pvfmkwlogtnan_mvl = struct { | |
| 19506 | const param_str = "V256bV256dUi"; | |
| 19507 | const target_set = TargetSet.init(.{ | |
| 19508 | .vevl_gen = true, | |
| 19509 | }); | |
| 19510 | const attributes = Attributes{}; | |
| 19511 | }; | |
| 19512 | ||
| 19513 | pub const __builtin_ve_vl_pvfmkwlogtnan_mvml = struct { | |
| 19514 | const param_str = "V256bV256dV256bUi"; | |
| 19515 | const target_set = TargetSet.init(.{ | |
| 19516 | .vevl_gen = true, | |
| 19517 | }); | |
| 19518 | const attributes = Attributes{}; | |
| 19519 | }; | |
| 19520 | ||
| 19521 | pub const __builtin_ve_vl_pvfmkwlole_mvl = struct { | |
| 19522 | const param_str = "V256bV256dUi"; | |
| 19523 | const target_set = TargetSet.init(.{ | |
| 19524 | .vevl_gen = true, | |
| 19525 | }); | |
| 19526 | const attributes = Attributes{}; | |
| 19527 | }; | |
| 19528 | ||
| 19529 | pub const __builtin_ve_vl_pvfmkwlole_mvml = struct { | |
| 19530 | const param_str = "V256bV256dV256bUi"; | |
| 19531 | const target_set = TargetSet.init(.{ | |
| 19532 | .vevl_gen = true, | |
| 19533 | }); | |
| 19534 | const attributes = Attributes{}; | |
| 19535 | }; | |
| 19536 | ||
| 19537 | pub const __builtin_ve_vl_pvfmkwlolenan_mvl = struct { | |
| 19538 | const param_str = "V256bV256dUi"; | |
| 19539 | const target_set = TargetSet.init(.{ | |
| 19540 | .vevl_gen = true, | |
| 19541 | }); | |
| 19542 | const attributes = Attributes{}; | |
| 19543 | }; | |
| 19544 | ||
| 19545 | pub const __builtin_ve_vl_pvfmkwlolenan_mvml = struct { | |
| 19546 | const param_str = "V256bV256dV256bUi"; | |
| 19547 | const target_set = TargetSet.init(.{ | |
| 19548 | .vevl_gen = true, | |
| 19549 | }); | |
| 19550 | const attributes = Attributes{}; | |
| 19551 | }; | |
| 19552 | ||
| 19553 | pub const __builtin_ve_vl_pvfmkwlolt_mvl = struct { | |
| 19554 | const param_str = "V256bV256dUi"; | |
| 19555 | const target_set = TargetSet.init(.{ | |
| 19556 | .vevl_gen = true, | |
| 19557 | }); | |
| 19558 | const attributes = Attributes{}; | |
| 19559 | }; | |
| 19560 | ||
| 19561 | pub const __builtin_ve_vl_pvfmkwlolt_mvml = struct { | |
| 19562 | const param_str = "V256bV256dV256bUi"; | |
| 19563 | const target_set = TargetSet.init(.{ | |
| 19564 | .vevl_gen = true, | |
| 19565 | }); | |
| 19566 | const attributes = Attributes{}; | |
| 19567 | }; | |
| 19568 | ||
| 19569 | pub const __builtin_ve_vl_pvfmkwloltnan_mvl = struct { | |
| 19570 | const param_str = "V256bV256dUi"; | |
| 19571 | const target_set = TargetSet.init(.{ | |
| 19572 | .vevl_gen = true, | |
| 19573 | }); | |
| 19574 | const attributes = Attributes{}; | |
| 19575 | }; | |
| 19576 | ||
| 19577 | pub const __builtin_ve_vl_pvfmkwloltnan_mvml = struct { | |
| 19578 | const param_str = "V256bV256dV256bUi"; | |
| 19579 | const target_set = TargetSet.init(.{ | |
| 19580 | .vevl_gen = true, | |
| 19581 | }); | |
| 19582 | const attributes = Attributes{}; | |
| 19583 | }; | |
| 19584 | ||
| 19585 | pub const __builtin_ve_vl_pvfmkwlonan_mvl = struct { | |
| 19586 | const param_str = "V256bV256dUi"; | |
| 19587 | const target_set = TargetSet.init(.{ | |
| 19588 | .vevl_gen = true, | |
| 19589 | }); | |
| 19590 | const attributes = Attributes{}; | |
| 19591 | }; | |
| 19592 | ||
| 19593 | pub const __builtin_ve_vl_pvfmkwlonan_mvml = struct { | |
| 19594 | const param_str = "V256bV256dV256bUi"; | |
| 19595 | const target_set = TargetSet.init(.{ | |
| 19596 | .vevl_gen = true, | |
| 19597 | }); | |
| 19598 | const attributes = Attributes{}; | |
| 19599 | }; | |
| 19600 | ||
| 19601 | pub const __builtin_ve_vl_pvfmkwlone_mvl = struct { | |
| 19602 | const param_str = "V256bV256dUi"; | |
| 19603 | const target_set = TargetSet.init(.{ | |
| 19604 | .vevl_gen = true, | |
| 19605 | }); | |
| 19606 | const attributes = Attributes{}; | |
| 19607 | }; | |
| 19608 | ||
| 19609 | pub const __builtin_ve_vl_pvfmkwlone_mvml = struct { | |
| 19610 | const param_str = "V256bV256dV256bUi"; | |
| 19611 | const target_set = TargetSet.init(.{ | |
| 19612 | .vevl_gen = true, | |
| 19613 | }); | |
| 19614 | const attributes = Attributes{}; | |
| 19615 | }; | |
| 19616 | ||
| 19617 | pub const __builtin_ve_vl_pvfmkwlonenan_mvl = struct { | |
| 19618 | const param_str = "V256bV256dUi"; | |
| 19619 | const target_set = TargetSet.init(.{ | |
| 19620 | .vevl_gen = true, | |
| 19621 | }); | |
| 19622 | const attributes = Attributes{}; | |
| 19623 | }; | |
| 19624 | ||
| 19625 | pub const __builtin_ve_vl_pvfmkwlonenan_mvml = struct { | |
| 19626 | const param_str = "V256bV256dV256bUi"; | |
| 19627 | const target_set = TargetSet.init(.{ | |
| 19628 | .vevl_gen = true, | |
| 19629 | }); | |
| 19630 | const attributes = Attributes{}; | |
| 19631 | }; | |
| 19632 | ||
| 19633 | pub const __builtin_ve_vl_pvfmkwlonum_mvl = struct { | |
| 19634 | const param_str = "V256bV256dUi"; | |
| 19635 | const target_set = TargetSet.init(.{ | |
| 19636 | .vevl_gen = true, | |
| 19637 | }); | |
| 19638 | const attributes = Attributes{}; | |
| 19639 | }; | |
| 19640 | ||
| 19641 | pub const __builtin_ve_vl_pvfmkwlonum_mvml = struct { | |
| 19642 | const param_str = "V256bV256dV256bUi"; | |
| 19643 | const target_set = TargetSet.init(.{ | |
| 19644 | .vevl_gen = true, | |
| 19645 | }); | |
| 19646 | const attributes = Attributes{}; | |
| 19647 | }; | |
| 19648 | ||
| 19649 | pub const __builtin_ve_vl_pvfmkwlt_MvMl = struct { | |
| 19650 | const param_str = "V512bV256dV512bUi"; | |
| 19651 | const target_set = TargetSet.init(.{ | |
| 19652 | .vevl_gen = true, | |
| 19653 | }); | |
| 19654 | const attributes = Attributes{}; | |
| 19655 | }; | |
| 19656 | ||
| 19657 | pub const __builtin_ve_vl_pvfmkwlt_Mvl = struct { | |
| 19658 | const param_str = "V512bV256dUi"; | |
| 19659 | const target_set = TargetSet.init(.{ | |
| 19660 | .vevl_gen = true, | |
| 19661 | }); | |
| 19662 | const attributes = Attributes{}; | |
| 19663 | }; | |
| 19664 | ||
| 19665 | pub const __builtin_ve_vl_pvfmkwltnan_MvMl = struct { | |
| 19666 | const param_str = "V512bV256dV512bUi"; | |
| 19667 | const target_set = TargetSet.init(.{ | |
| 19668 | .vevl_gen = true, | |
| 19669 | }); | |
| 19670 | const attributes = Attributes{}; | |
| 19671 | }; | |
| 19672 | ||
| 19673 | pub const __builtin_ve_vl_pvfmkwltnan_Mvl = struct { | |
| 19674 | const param_str = "V512bV256dUi"; | |
| 19675 | const target_set = TargetSet.init(.{ | |
| 19676 | .vevl_gen = true, | |
| 19677 | }); | |
| 19678 | const attributes = Attributes{}; | |
| 19679 | }; | |
| 19680 | ||
| 19681 | pub const __builtin_ve_vl_pvfmkwnan_MvMl = struct { | |
| 19682 | const param_str = "V512bV256dV512bUi"; | |
| 19683 | const target_set = TargetSet.init(.{ | |
| 19684 | .vevl_gen = true, | |
| 19685 | }); | |
| 19686 | const attributes = Attributes{}; | |
| 19687 | }; | |
| 19688 | ||
| 19689 | pub const __builtin_ve_vl_pvfmkwnan_Mvl = struct { | |
| 19690 | const param_str = "V512bV256dUi"; | |
| 19691 | const target_set = TargetSet.init(.{ | |
| 19692 | .vevl_gen = true, | |
| 19693 | }); | |
| 19694 | const attributes = Attributes{}; | |
| 19695 | }; | |
| 19696 | ||
| 19697 | pub const __builtin_ve_vl_pvfmkwne_MvMl = struct { | |
| 19698 | const param_str = "V512bV256dV512bUi"; | |
| 19699 | const target_set = TargetSet.init(.{ | |
| 19700 | .vevl_gen = true, | |
| 19701 | }); | |
| 19702 | const attributes = Attributes{}; | |
| 19703 | }; | |
| 19704 | ||
| 19705 | pub const __builtin_ve_vl_pvfmkwne_Mvl = struct { | |
| 19706 | const param_str = "V512bV256dUi"; | |
| 19707 | const target_set = TargetSet.init(.{ | |
| 19708 | .vevl_gen = true, | |
| 19709 | }); | |
| 19710 | const attributes = Attributes{}; | |
| 19711 | }; | |
| 19712 | ||
| 19713 | pub const __builtin_ve_vl_pvfmkwnenan_MvMl = struct { | |
| 19714 | const param_str = "V512bV256dV512bUi"; | |
| 19715 | const target_set = TargetSet.init(.{ | |
| 19716 | .vevl_gen = true, | |
| 19717 | }); | |
| 19718 | const attributes = Attributes{}; | |
| 19719 | }; | |
| 19720 | ||
| 19721 | pub const __builtin_ve_vl_pvfmkwnenan_Mvl = struct { | |
| 19722 | const param_str = "V512bV256dUi"; | |
| 19723 | const target_set = TargetSet.init(.{ | |
| 19724 | .vevl_gen = true, | |
| 19725 | }); | |
| 19726 | const attributes = Attributes{}; | |
| 19727 | }; | |
| 19728 | ||
| 19729 | pub const __builtin_ve_vl_pvfmkwnum_MvMl = struct { | |
| 19730 | const param_str = "V512bV256dV512bUi"; | |
| 19731 | const target_set = TargetSet.init(.{ | |
| 19732 | .vevl_gen = true, | |
| 19733 | }); | |
| 19734 | const attributes = Attributes{}; | |
| 19735 | }; | |
| 19736 | ||
| 19737 | pub const __builtin_ve_vl_pvfmkwnum_Mvl = struct { | |
| 19738 | const param_str = "V512bV256dUi"; | |
| 19739 | const target_set = TargetSet.init(.{ | |
| 19740 | .vevl_gen = true, | |
| 19741 | }); | |
| 19742 | const attributes = Attributes{}; | |
| 19743 | }; | |
| 19744 | ||
| 19745 | pub const __builtin_ve_vl_pvfmkwupeq_mvl = struct { | |
| 19746 | const param_str = "V256bV256dUi"; | |
| 19747 | const target_set = TargetSet.init(.{ | |
| 19748 | .vevl_gen = true, | |
| 19749 | }); | |
| 19750 | const attributes = Attributes{}; | |
| 19751 | }; | |
| 19752 | ||
| 19753 | pub const __builtin_ve_vl_pvfmkwupeq_mvml = struct { | |
| 19754 | const param_str = "V256bV256dV256bUi"; | |
| 19755 | const target_set = TargetSet.init(.{ | |
| 19756 | .vevl_gen = true, | |
| 19757 | }); | |
| 19758 | const attributes = Attributes{}; | |
| 19759 | }; | |
| 19760 | ||
| 19761 | pub const __builtin_ve_vl_pvfmkwupeqnan_mvl = struct { | |
| 19762 | const param_str = "V256bV256dUi"; | |
| 19763 | const target_set = TargetSet.init(.{ | |
| 19764 | .vevl_gen = true, | |
| 19765 | }); | |
| 19766 | const attributes = Attributes{}; | |
| 19767 | }; | |
| 19768 | ||
| 19769 | pub const __builtin_ve_vl_pvfmkwupeqnan_mvml = struct { | |
| 19770 | const param_str = "V256bV256dV256bUi"; | |
| 19771 | const target_set = TargetSet.init(.{ | |
| 19772 | .vevl_gen = true, | |
| 19773 | }); | |
| 19774 | const attributes = Attributes{}; | |
| 19775 | }; | |
| 19776 | ||
| 19777 | pub const __builtin_ve_vl_pvfmkwupge_mvl = struct { | |
| 19778 | const param_str = "V256bV256dUi"; | |
| 19779 | const target_set = TargetSet.init(.{ | |
| 19780 | .vevl_gen = true, | |
| 19781 | }); | |
| 19782 | const attributes = Attributes{}; | |
| 19783 | }; | |
| 19784 | ||
| 19785 | pub const __builtin_ve_vl_pvfmkwupge_mvml = struct { | |
| 19786 | const param_str = "V256bV256dV256bUi"; | |
| 19787 | const target_set = TargetSet.init(.{ | |
| 19788 | .vevl_gen = true, | |
| 19789 | }); | |
| 19790 | const attributes = Attributes{}; | |
| 19791 | }; | |
| 19792 | ||
| 19793 | pub const __builtin_ve_vl_pvfmkwupgenan_mvl = struct { | |
| 19794 | const param_str = "V256bV256dUi"; | |
| 19795 | const target_set = TargetSet.init(.{ | |
| 19796 | .vevl_gen = true, | |
| 19797 | }); | |
| 19798 | const attributes = Attributes{}; | |
| 19799 | }; | |
| 19800 | ||
| 19801 | pub const __builtin_ve_vl_pvfmkwupgenan_mvml = struct { | |
| 19802 | const param_str = "V256bV256dV256bUi"; | |
| 19803 | const target_set = TargetSet.init(.{ | |
| 19804 | .vevl_gen = true, | |
| 19805 | }); | |
| 19806 | const attributes = Attributes{}; | |
| 19807 | }; | |
| 19808 | ||
| 19809 | pub const __builtin_ve_vl_pvfmkwupgt_mvl = struct { | |
| 19810 | const param_str = "V256bV256dUi"; | |
| 19811 | const target_set = TargetSet.init(.{ | |
| 19812 | .vevl_gen = true, | |
| 19813 | }); | |
| 19814 | const attributes = Attributes{}; | |
| 19815 | }; | |
| 19816 | ||
| 19817 | pub const __builtin_ve_vl_pvfmkwupgt_mvml = struct { | |
| 19818 | const param_str = "V256bV256dV256bUi"; | |
| 19819 | const target_set = TargetSet.init(.{ | |
| 19820 | .vevl_gen = true, | |
| 19821 | }); | |
| 19822 | const attributes = Attributes{}; | |
| 19823 | }; | |
| 19824 | ||
| 19825 | pub const __builtin_ve_vl_pvfmkwupgtnan_mvl = struct { | |
| 19826 | const param_str = "V256bV256dUi"; | |
| 19827 | const target_set = TargetSet.init(.{ | |
| 19828 | .vevl_gen = true, | |
| 19829 | }); | |
| 19830 | const attributes = Attributes{}; | |
| 19831 | }; | |
| 19832 | ||
| 19833 | pub const __builtin_ve_vl_pvfmkwupgtnan_mvml = struct { | |
| 19834 | const param_str = "V256bV256dV256bUi"; | |
| 19835 | const target_set = TargetSet.init(.{ | |
| 19836 | .vevl_gen = true, | |
| 19837 | }); | |
| 19838 | const attributes = Attributes{}; | |
| 19839 | }; | |
| 19840 | ||
| 19841 | pub const __builtin_ve_vl_pvfmkwuple_mvl = struct { | |
| 19842 | const param_str = "V256bV256dUi"; | |
| 19843 | const target_set = TargetSet.init(.{ | |
| 19844 | .vevl_gen = true, | |
| 19845 | }); | |
| 19846 | const attributes = Attributes{}; | |
| 19847 | }; | |
| 19848 | ||
| 19849 | pub const __builtin_ve_vl_pvfmkwuple_mvml = struct { | |
| 19850 | const param_str = "V256bV256dV256bUi"; | |
| 19851 | const target_set = TargetSet.init(.{ | |
| 19852 | .vevl_gen = true, | |
| 19853 | }); | |
| 19854 | const attributes = Attributes{}; | |
| 19855 | }; | |
| 19856 | ||
| 19857 | pub const __builtin_ve_vl_pvfmkwuplenan_mvl = struct { | |
| 19858 | const param_str = "V256bV256dUi"; | |
| 19859 | const target_set = TargetSet.init(.{ | |
| 19860 | .vevl_gen = true, | |
| 19861 | }); | |
| 19862 | const attributes = Attributes{}; | |
| 19863 | }; | |
| 19864 | ||
| 19865 | pub const __builtin_ve_vl_pvfmkwuplenan_mvml = struct { | |
| 19866 | const param_str = "V256bV256dV256bUi"; | |
| 19867 | const target_set = TargetSet.init(.{ | |
| 19868 | .vevl_gen = true, | |
| 19869 | }); | |
| 19870 | const attributes = Attributes{}; | |
| 19871 | }; | |
| 19872 | ||
| 19873 | pub const __builtin_ve_vl_pvfmkwuplt_mvl = struct { | |
| 19874 | const param_str = "V256bV256dUi"; | |
| 19875 | const target_set = TargetSet.init(.{ | |
| 19876 | .vevl_gen = true, | |
| 19877 | }); | |
| 19878 | const attributes = Attributes{}; | |
| 19879 | }; | |
| 19880 | ||
| 19881 | pub const __builtin_ve_vl_pvfmkwuplt_mvml = struct { | |
| 19882 | const param_str = "V256bV256dV256bUi"; | |
| 19883 | const target_set = TargetSet.init(.{ | |
| 19884 | .vevl_gen = true, | |
| 19885 | }); | |
| 19886 | const attributes = Attributes{}; | |
| 19887 | }; | |
| 19888 | ||
| 19889 | pub const __builtin_ve_vl_pvfmkwupltnan_mvl = struct { | |
| 19890 | const param_str = "V256bV256dUi"; | |
| 19891 | const target_set = TargetSet.init(.{ | |
| 19892 | .vevl_gen = true, | |
| 19893 | }); | |
| 19894 | const attributes = Attributes{}; | |
| 19895 | }; | |
| 19896 | ||
| 19897 | pub const __builtin_ve_vl_pvfmkwupltnan_mvml = struct { | |
| 19898 | const param_str = "V256bV256dV256bUi"; | |
| 19899 | const target_set = TargetSet.init(.{ | |
| 19900 | .vevl_gen = true, | |
| 19901 | }); | |
| 19902 | const attributes = Attributes{}; | |
| 19903 | }; | |
| 19904 | ||
| 19905 | pub const __builtin_ve_vl_pvfmkwupnan_mvl = struct { | |
| 19906 | const param_str = "V256bV256dUi"; | |
| 19907 | const target_set = TargetSet.init(.{ | |
| 19908 | .vevl_gen = true, | |
| 19909 | }); | |
| 19910 | const attributes = Attributes{}; | |
| 19911 | }; | |
| 19912 | ||
| 19913 | pub const __builtin_ve_vl_pvfmkwupnan_mvml = struct { | |
| 19914 | const param_str = "V256bV256dV256bUi"; | |
| 19915 | const target_set = TargetSet.init(.{ | |
| 19916 | .vevl_gen = true, | |
| 19917 | }); | |
| 19918 | const attributes = Attributes{}; | |
| 19919 | }; | |
| 19920 | ||
| 19921 | pub const __builtin_ve_vl_pvfmkwupne_mvl = struct { | |
| 19922 | const param_str = "V256bV256dUi"; | |
| 19923 | const target_set = TargetSet.init(.{ | |
| 19924 | .vevl_gen = true, | |
| 19925 | }); | |
| 19926 | const attributes = Attributes{}; | |
| 19927 | }; | |
| 19928 | ||
| 19929 | pub const __builtin_ve_vl_pvfmkwupne_mvml = struct { | |
| 19930 | const param_str = "V256bV256dV256bUi"; | |
| 19931 | const target_set = TargetSet.init(.{ | |
| 19932 | .vevl_gen = true, | |
| 19933 | }); | |
| 19934 | const attributes = Attributes{}; | |
| 19935 | }; | |
| 19936 | ||
| 19937 | pub const __builtin_ve_vl_pvfmkwupnenan_mvl = struct { | |
| 19938 | const param_str = "V256bV256dUi"; | |
| 19939 | const target_set = TargetSet.init(.{ | |
| 19940 | .vevl_gen = true, | |
| 19941 | }); | |
| 19942 | const attributes = Attributes{}; | |
| 19943 | }; | |
| 19944 | ||
| 19945 | pub const __builtin_ve_vl_pvfmkwupnenan_mvml = struct { | |
| 19946 | const param_str = "V256bV256dV256bUi"; | |
| 19947 | const target_set = TargetSet.init(.{ | |
| 19948 | .vevl_gen = true, | |
| 19949 | }); | |
| 19950 | const attributes = Attributes{}; | |
| 19951 | }; | |
| 19952 | ||
| 19953 | pub const __builtin_ve_vl_pvfmkwupnum_mvl = struct { | |
| 19954 | const param_str = "V256bV256dUi"; | |
| 19955 | const target_set = TargetSet.init(.{ | |
| 19956 | .vevl_gen = true, | |
| 19957 | }); | |
| 19958 | const attributes = Attributes{}; | |
| 19959 | }; | |
| 19960 | ||
| 19961 | pub const __builtin_ve_vl_pvfmkwupnum_mvml = struct { | |
| 19962 | const param_str = "V256bV256dV256bUi"; | |
| 19963 | const target_set = TargetSet.init(.{ | |
| 19964 | .vevl_gen = true, | |
| 19965 | }); | |
| 19966 | const attributes = Attributes{}; | |
| 19967 | }; | |
| 19968 | ||
| 19969 | pub const __builtin_ve_vl_pvfmsb_vsvvMvl = struct { | |
| 19970 | const param_str = "V256dLUiV256dV256dV512bV256dUi"; | |
| 19971 | const target_set = TargetSet.init(.{ | |
| 19972 | .vevl_gen = true, | |
| 19973 | }); | |
| 19974 | const attributes = Attributes{}; | |
| 19975 | }; | |
| 19976 | ||
| 19977 | pub const __builtin_ve_vl_pvfmsb_vsvvl = struct { | |
| 19978 | const param_str = "V256dLUiV256dV256dUi"; | |
| 19979 | const target_set = TargetSet.init(.{ | |
| 19980 | .vevl_gen = true, | |
| 19981 | }); | |
| 19982 | const attributes = Attributes{}; | |
| 19983 | }; | |
| 19984 | ||
| 19985 | pub const __builtin_ve_vl_pvfmsb_vsvvvl = struct { | |
| 19986 | const param_str = "V256dLUiV256dV256dV256dUi"; | |
| 19987 | const target_set = TargetSet.init(.{ | |
| 19988 | .vevl_gen = true, | |
| 19989 | }); | |
| 19990 | const attributes = Attributes{}; | |
| 19991 | }; | |
| 19992 | ||
| 19993 | pub const __builtin_ve_vl_pvfmsb_vvsvMvl = struct { | |
| 19994 | const param_str = "V256dV256dLUiV256dV512bV256dUi"; | |
| 19995 | const target_set = TargetSet.init(.{ | |
| 19996 | .vevl_gen = true, | |
| 19997 | }); | |
| 19998 | const attributes = Attributes{}; | |
| 19999 | }; | |
| 20000 | ||
| 20001 | pub const __builtin_ve_vl_pvfmsb_vvsvl = struct { | |
| 20002 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20003 | const target_set = TargetSet.init(.{ | |
| 20004 | .vevl_gen = true, | |
| 20005 | }); | |
| 20006 | const attributes = Attributes{}; | |
| 20007 | }; | |
| 20008 | ||
| 20009 | pub const __builtin_ve_vl_pvfmsb_vvsvvl = struct { | |
| 20010 | const param_str = "V256dV256dLUiV256dV256dUi"; | |
| 20011 | const target_set = TargetSet.init(.{ | |
| 20012 | .vevl_gen = true, | |
| 20013 | }); | |
| 20014 | const attributes = Attributes{}; | |
| 20015 | }; | |
| 20016 | ||
| 20017 | pub const __builtin_ve_vl_pvfmsb_vvvvMvl = struct { | |
| 20018 | const param_str = "V256dV256dV256dV256dV512bV256dUi"; | |
| 20019 | const target_set = TargetSet.init(.{ | |
| 20020 | .vevl_gen = true, | |
| 20021 | }); | |
| 20022 | const attributes = Attributes{}; | |
| 20023 | }; | |
| 20024 | ||
| 20025 | pub const __builtin_ve_vl_pvfmsb_vvvvl = struct { | |
| 20026 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20027 | const target_set = TargetSet.init(.{ | |
| 20028 | .vevl_gen = true, | |
| 20029 | }); | |
| 20030 | const attributes = Attributes{}; | |
| 20031 | }; | |
| 20032 | ||
| 20033 | pub const __builtin_ve_vl_pvfmsb_vvvvvl = struct { | |
| 20034 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 20035 | const target_set = TargetSet.init(.{ | |
| 20036 | .vevl_gen = true, | |
| 20037 | }); | |
| 20038 | const attributes = Attributes{}; | |
| 20039 | }; | |
| 20040 | ||
| 20041 | pub const __builtin_ve_vl_pvfmul_vsvMvl = struct { | |
| 20042 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20043 | const target_set = TargetSet.init(.{ | |
| 20044 | .vevl_gen = true, | |
| 20045 | }); | |
| 20046 | const attributes = Attributes{}; | |
| 20047 | }; | |
| 20048 | ||
| 20049 | pub const __builtin_ve_vl_pvfmul_vsvl = struct { | |
| 20050 | const param_str = "V256dLUiV256dUi"; | |
| 20051 | const target_set = TargetSet.init(.{ | |
| 20052 | .vevl_gen = true, | |
| 20053 | }); | |
| 20054 | const attributes = Attributes{}; | |
| 20055 | }; | |
| 20056 | ||
| 20057 | pub const __builtin_ve_vl_pvfmul_vsvvl = struct { | |
| 20058 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20059 | const target_set = TargetSet.init(.{ | |
| 20060 | .vevl_gen = true, | |
| 20061 | }); | |
| 20062 | const attributes = Attributes{}; | |
| 20063 | }; | |
| 20064 | ||
| 20065 | pub const __builtin_ve_vl_pvfmul_vvvMvl = struct { | |
| 20066 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20067 | const target_set = TargetSet.init(.{ | |
| 20068 | .vevl_gen = true, | |
| 20069 | }); | |
| 20070 | const attributes = Attributes{}; | |
| 20071 | }; | |
| 20072 | ||
| 20073 | pub const __builtin_ve_vl_pvfmul_vvvl = struct { | |
| 20074 | const param_str = "V256dV256dV256dUi"; | |
| 20075 | const target_set = TargetSet.init(.{ | |
| 20076 | .vevl_gen = true, | |
| 20077 | }); | |
| 20078 | const attributes = Attributes{}; | |
| 20079 | }; | |
| 20080 | ||
| 20081 | pub const __builtin_ve_vl_pvfmul_vvvvl = struct { | |
| 20082 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20083 | const target_set = TargetSet.init(.{ | |
| 20084 | .vevl_gen = true, | |
| 20085 | }); | |
| 20086 | const attributes = Attributes{}; | |
| 20087 | }; | |
| 20088 | ||
| 20089 | pub const __builtin_ve_vl_pvfnmad_vsvvMvl = struct { | |
| 20090 | const param_str = "V256dLUiV256dV256dV512bV256dUi"; | |
| 20091 | const target_set = TargetSet.init(.{ | |
| 20092 | .vevl_gen = true, | |
| 20093 | }); | |
| 20094 | const attributes = Attributes{}; | |
| 20095 | }; | |
| 20096 | ||
| 20097 | pub const __builtin_ve_vl_pvfnmad_vsvvl = struct { | |
| 20098 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20099 | const target_set = TargetSet.init(.{ | |
| 20100 | .vevl_gen = true, | |
| 20101 | }); | |
| 20102 | const attributes = Attributes{}; | |
| 20103 | }; | |
| 20104 | ||
| 20105 | pub const __builtin_ve_vl_pvfnmad_vsvvvl = struct { | |
| 20106 | const param_str = "V256dLUiV256dV256dV256dUi"; | |
| 20107 | const target_set = TargetSet.init(.{ | |
| 20108 | .vevl_gen = true, | |
| 20109 | }); | |
| 20110 | const attributes = Attributes{}; | |
| 20111 | }; | |
| 20112 | ||
| 20113 | pub const __builtin_ve_vl_pvfnmad_vvsvMvl = struct { | |
| 20114 | const param_str = "V256dV256dLUiV256dV512bV256dUi"; | |
| 20115 | const target_set = TargetSet.init(.{ | |
| 20116 | .vevl_gen = true, | |
| 20117 | }); | |
| 20118 | const attributes = Attributes{}; | |
| 20119 | }; | |
| 20120 | ||
| 20121 | pub const __builtin_ve_vl_pvfnmad_vvsvl = struct { | |
| 20122 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20123 | const target_set = TargetSet.init(.{ | |
| 20124 | .vevl_gen = true, | |
| 20125 | }); | |
| 20126 | const attributes = Attributes{}; | |
| 20127 | }; | |
| 20128 | ||
| 20129 | pub const __builtin_ve_vl_pvfnmad_vvsvvl = struct { | |
| 20130 | const param_str = "V256dV256dLUiV256dV256dUi"; | |
| 20131 | const target_set = TargetSet.init(.{ | |
| 20132 | .vevl_gen = true, | |
| 20133 | }); | |
| 20134 | const attributes = Attributes{}; | |
| 20135 | }; | |
| 20136 | ||
| 20137 | pub const __builtin_ve_vl_pvfnmad_vvvvMvl = struct { | |
| 20138 | const param_str = "V256dV256dV256dV256dV512bV256dUi"; | |
| 20139 | const target_set = TargetSet.init(.{ | |
| 20140 | .vevl_gen = true, | |
| 20141 | }); | |
| 20142 | const attributes = Attributes{}; | |
| 20143 | }; | |
| 20144 | ||
| 20145 | pub const __builtin_ve_vl_pvfnmad_vvvvl = struct { | |
| 20146 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20147 | const target_set = TargetSet.init(.{ | |
| 20148 | .vevl_gen = true, | |
| 20149 | }); | |
| 20150 | const attributes = Attributes{}; | |
| 20151 | }; | |
| 20152 | ||
| 20153 | pub const __builtin_ve_vl_pvfnmad_vvvvvl = struct { | |
| 20154 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 20155 | const target_set = TargetSet.init(.{ | |
| 20156 | .vevl_gen = true, | |
| 20157 | }); | |
| 20158 | const attributes = Attributes{}; | |
| 20159 | }; | |
| 20160 | ||
| 20161 | pub const __builtin_ve_vl_pvfnmsb_vsvvMvl = struct { | |
| 20162 | const param_str = "V256dLUiV256dV256dV512bV256dUi"; | |
| 20163 | const target_set = TargetSet.init(.{ | |
| 20164 | .vevl_gen = true, | |
| 20165 | }); | |
| 20166 | const attributes = Attributes{}; | |
| 20167 | }; | |
| 20168 | ||
| 20169 | pub const __builtin_ve_vl_pvfnmsb_vsvvl = struct { | |
| 20170 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20171 | const target_set = TargetSet.init(.{ | |
| 20172 | .vevl_gen = true, | |
| 20173 | }); | |
| 20174 | const attributes = Attributes{}; | |
| 20175 | }; | |
| 20176 | ||
| 20177 | pub const __builtin_ve_vl_pvfnmsb_vsvvvl = struct { | |
| 20178 | const param_str = "V256dLUiV256dV256dV256dUi"; | |
| 20179 | const target_set = TargetSet.init(.{ | |
| 20180 | .vevl_gen = true, | |
| 20181 | }); | |
| 20182 | const attributes = Attributes{}; | |
| 20183 | }; | |
| 20184 | ||
| 20185 | pub const __builtin_ve_vl_pvfnmsb_vvsvMvl = struct { | |
| 20186 | const param_str = "V256dV256dLUiV256dV512bV256dUi"; | |
| 20187 | const target_set = TargetSet.init(.{ | |
| 20188 | .vevl_gen = true, | |
| 20189 | }); | |
| 20190 | const attributes = Attributes{}; | |
| 20191 | }; | |
| 20192 | ||
| 20193 | pub const __builtin_ve_vl_pvfnmsb_vvsvl = struct { | |
| 20194 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20195 | const target_set = TargetSet.init(.{ | |
| 20196 | .vevl_gen = true, | |
| 20197 | }); | |
| 20198 | const attributes = Attributes{}; | |
| 20199 | }; | |
| 20200 | ||
| 20201 | pub const __builtin_ve_vl_pvfnmsb_vvsvvl = struct { | |
| 20202 | const param_str = "V256dV256dLUiV256dV256dUi"; | |
| 20203 | const target_set = TargetSet.init(.{ | |
| 20204 | .vevl_gen = true, | |
| 20205 | }); | |
| 20206 | const attributes = Attributes{}; | |
| 20207 | }; | |
| 20208 | ||
| 20209 | pub const __builtin_ve_vl_pvfnmsb_vvvvMvl = struct { | |
| 20210 | const param_str = "V256dV256dV256dV256dV512bV256dUi"; | |
| 20211 | const target_set = TargetSet.init(.{ | |
| 20212 | .vevl_gen = true, | |
| 20213 | }); | |
| 20214 | const attributes = Attributes{}; | |
| 20215 | }; | |
| 20216 | ||
| 20217 | pub const __builtin_ve_vl_pvfnmsb_vvvvl = struct { | |
| 20218 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20219 | const target_set = TargetSet.init(.{ | |
| 20220 | .vevl_gen = true, | |
| 20221 | }); | |
| 20222 | const attributes = Attributes{}; | |
| 20223 | }; | |
| 20224 | ||
| 20225 | pub const __builtin_ve_vl_pvfnmsb_vvvvvl = struct { | |
| 20226 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 20227 | const target_set = TargetSet.init(.{ | |
| 20228 | .vevl_gen = true, | |
| 20229 | }); | |
| 20230 | const attributes = Attributes{}; | |
| 20231 | }; | |
| 20232 | ||
| 20233 | pub const __builtin_ve_vl_pvfsub_vsvMvl = struct { | |
| 20234 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20235 | const target_set = TargetSet.init(.{ | |
| 20236 | .vevl_gen = true, | |
| 20237 | }); | |
| 20238 | const attributes = Attributes{}; | |
| 20239 | }; | |
| 20240 | ||
| 20241 | pub const __builtin_ve_vl_pvfsub_vsvl = struct { | |
| 20242 | const param_str = "V256dLUiV256dUi"; | |
| 20243 | const target_set = TargetSet.init(.{ | |
| 20244 | .vevl_gen = true, | |
| 20245 | }); | |
| 20246 | const attributes = Attributes{}; | |
| 20247 | }; | |
| 20248 | ||
| 20249 | pub const __builtin_ve_vl_pvfsub_vsvvl = struct { | |
| 20250 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20251 | const target_set = TargetSet.init(.{ | |
| 20252 | .vevl_gen = true, | |
| 20253 | }); | |
| 20254 | const attributes = Attributes{}; | |
| 20255 | }; | |
| 20256 | ||
| 20257 | pub const __builtin_ve_vl_pvfsub_vvvMvl = struct { | |
| 20258 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20259 | const target_set = TargetSet.init(.{ | |
| 20260 | .vevl_gen = true, | |
| 20261 | }); | |
| 20262 | const attributes = Attributes{}; | |
| 20263 | }; | |
| 20264 | ||
| 20265 | pub const __builtin_ve_vl_pvfsub_vvvl = struct { | |
| 20266 | const param_str = "V256dV256dV256dUi"; | |
| 20267 | const target_set = TargetSet.init(.{ | |
| 20268 | .vevl_gen = true, | |
| 20269 | }); | |
| 20270 | const attributes = Attributes{}; | |
| 20271 | }; | |
| 20272 | ||
| 20273 | pub const __builtin_ve_vl_pvfsub_vvvvl = struct { | |
| 20274 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20275 | const target_set = TargetSet.init(.{ | |
| 20276 | .vevl_gen = true, | |
| 20277 | }); | |
| 20278 | const attributes = Attributes{}; | |
| 20279 | }; | |
| 20280 | ||
| 20281 | pub const __builtin_ve_vl_pvldz_vvMvl = struct { | |
| 20282 | const param_str = "V256dV256dV512bV256dUi"; | |
| 20283 | const target_set = TargetSet.init(.{ | |
| 20284 | .vevl_gen = true, | |
| 20285 | }); | |
| 20286 | const attributes = Attributes{}; | |
| 20287 | }; | |
| 20288 | ||
| 20289 | pub const __builtin_ve_vl_pvldz_vvl = struct { | |
| 20290 | const param_str = "V256dV256dUi"; | |
| 20291 | const target_set = TargetSet.init(.{ | |
| 20292 | .vevl_gen = true, | |
| 20293 | }); | |
| 20294 | const attributes = Attributes{}; | |
| 20295 | }; | |
| 20296 | ||
| 20297 | pub const __builtin_ve_vl_pvldz_vvvl = struct { | |
| 20298 | const param_str = "V256dV256dV256dUi"; | |
| 20299 | const target_set = TargetSet.init(.{ | |
| 20300 | .vevl_gen = true, | |
| 20301 | }); | |
| 20302 | const attributes = Attributes{}; | |
| 20303 | }; | |
| 20304 | ||
| 20305 | pub const __builtin_ve_vl_pvldzlo_vvl = struct { | |
| 20306 | const param_str = "V256dV256dUi"; | |
| 20307 | const target_set = TargetSet.init(.{ | |
| 20308 | .vevl_gen = true, | |
| 20309 | }); | |
| 20310 | const attributes = Attributes{}; | |
| 20311 | }; | |
| 20312 | ||
| 20313 | pub const __builtin_ve_vl_pvldzlo_vvmvl = struct { | |
| 20314 | const param_str = "V256dV256dV256bV256dUi"; | |
| 20315 | const target_set = TargetSet.init(.{ | |
| 20316 | .vevl_gen = true, | |
| 20317 | }); | |
| 20318 | const attributes = Attributes{}; | |
| 20319 | }; | |
| 20320 | ||
| 20321 | pub const __builtin_ve_vl_pvldzlo_vvvl = struct { | |
| 20322 | const param_str = "V256dV256dV256dUi"; | |
| 20323 | const target_set = TargetSet.init(.{ | |
| 20324 | .vevl_gen = true, | |
| 20325 | }); | |
| 20326 | const attributes = Attributes{}; | |
| 20327 | }; | |
| 20328 | ||
| 20329 | pub const __builtin_ve_vl_pvldzup_vvl = struct { | |
| 20330 | const param_str = "V256dV256dUi"; | |
| 20331 | const target_set = TargetSet.init(.{ | |
| 20332 | .vevl_gen = true, | |
| 20333 | }); | |
| 20334 | const attributes = Attributes{}; | |
| 20335 | }; | |
| 20336 | ||
| 20337 | pub const __builtin_ve_vl_pvldzup_vvmvl = struct { | |
| 20338 | const param_str = "V256dV256dV256bV256dUi"; | |
| 20339 | const target_set = TargetSet.init(.{ | |
| 20340 | .vevl_gen = true, | |
| 20341 | }); | |
| 20342 | const attributes = Attributes{}; | |
| 20343 | }; | |
| 20344 | ||
| 20345 | pub const __builtin_ve_vl_pvldzup_vvvl = struct { | |
| 20346 | const param_str = "V256dV256dV256dUi"; | |
| 20347 | const target_set = TargetSet.init(.{ | |
| 20348 | .vevl_gen = true, | |
| 20349 | }); | |
| 20350 | const attributes = Attributes{}; | |
| 20351 | }; | |
| 20352 | ||
| 20353 | pub const __builtin_ve_vl_pvmaxs_vsvMvl = struct { | |
| 20354 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20355 | const target_set = TargetSet.init(.{ | |
| 20356 | .vevl_gen = true, | |
| 20357 | }); | |
| 20358 | const attributes = Attributes{}; | |
| 20359 | }; | |
| 20360 | ||
| 20361 | pub const __builtin_ve_vl_pvmaxs_vsvl = struct { | |
| 20362 | const param_str = "V256dLUiV256dUi"; | |
| 20363 | const target_set = TargetSet.init(.{ | |
| 20364 | .vevl_gen = true, | |
| 20365 | }); | |
| 20366 | const attributes = Attributes{}; | |
| 20367 | }; | |
| 20368 | ||
| 20369 | pub const __builtin_ve_vl_pvmaxs_vsvvl = struct { | |
| 20370 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20371 | const target_set = TargetSet.init(.{ | |
| 20372 | .vevl_gen = true, | |
| 20373 | }); | |
| 20374 | const attributes = Attributes{}; | |
| 20375 | }; | |
| 20376 | ||
| 20377 | pub const __builtin_ve_vl_pvmaxs_vvvMvl = struct { | |
| 20378 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20379 | const target_set = TargetSet.init(.{ | |
| 20380 | .vevl_gen = true, | |
| 20381 | }); | |
| 20382 | const attributes = Attributes{}; | |
| 20383 | }; | |
| 20384 | ||
| 20385 | pub const __builtin_ve_vl_pvmaxs_vvvl = struct { | |
| 20386 | const param_str = "V256dV256dV256dUi"; | |
| 20387 | const target_set = TargetSet.init(.{ | |
| 20388 | .vevl_gen = true, | |
| 20389 | }); | |
| 20390 | const attributes = Attributes{}; | |
| 20391 | }; | |
| 20392 | ||
| 20393 | pub const __builtin_ve_vl_pvmaxs_vvvvl = struct { | |
| 20394 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20395 | const target_set = TargetSet.init(.{ | |
| 20396 | .vevl_gen = true, | |
| 20397 | }); | |
| 20398 | const attributes = Attributes{}; | |
| 20399 | }; | |
| 20400 | ||
| 20401 | pub const __builtin_ve_vl_pvmins_vsvMvl = struct { | |
| 20402 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20403 | const target_set = TargetSet.init(.{ | |
| 20404 | .vevl_gen = true, | |
| 20405 | }); | |
| 20406 | const attributes = Attributes{}; | |
| 20407 | }; | |
| 20408 | ||
| 20409 | pub const __builtin_ve_vl_pvmins_vsvl = struct { | |
| 20410 | const param_str = "V256dLUiV256dUi"; | |
| 20411 | const target_set = TargetSet.init(.{ | |
| 20412 | .vevl_gen = true, | |
| 20413 | }); | |
| 20414 | const attributes = Attributes{}; | |
| 20415 | }; | |
| 20416 | ||
| 20417 | pub const __builtin_ve_vl_pvmins_vsvvl = struct { | |
| 20418 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20419 | const target_set = TargetSet.init(.{ | |
| 20420 | .vevl_gen = true, | |
| 20421 | }); | |
| 20422 | const attributes = Attributes{}; | |
| 20423 | }; | |
| 20424 | ||
| 20425 | pub const __builtin_ve_vl_pvmins_vvvMvl = struct { | |
| 20426 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20427 | const target_set = TargetSet.init(.{ | |
| 20428 | .vevl_gen = true, | |
| 20429 | }); | |
| 20430 | const attributes = Attributes{}; | |
| 20431 | }; | |
| 20432 | ||
| 20433 | pub const __builtin_ve_vl_pvmins_vvvl = struct { | |
| 20434 | const param_str = "V256dV256dV256dUi"; | |
| 20435 | const target_set = TargetSet.init(.{ | |
| 20436 | .vevl_gen = true, | |
| 20437 | }); | |
| 20438 | const attributes = Attributes{}; | |
| 20439 | }; | |
| 20440 | ||
| 20441 | pub const __builtin_ve_vl_pvmins_vvvvl = struct { | |
| 20442 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20443 | const target_set = TargetSet.init(.{ | |
| 20444 | .vevl_gen = true, | |
| 20445 | }); | |
| 20446 | const attributes = Attributes{}; | |
| 20447 | }; | |
| 20448 | ||
| 20449 | pub const __builtin_ve_vl_pvor_vsvMvl = struct { | |
| 20450 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20451 | const target_set = TargetSet.init(.{ | |
| 20452 | .vevl_gen = true, | |
| 20453 | }); | |
| 20454 | const attributes = Attributes{}; | |
| 20455 | }; | |
| 20456 | ||
| 20457 | pub const __builtin_ve_vl_pvor_vsvl = struct { | |
| 20458 | const param_str = "V256dLUiV256dUi"; | |
| 20459 | const target_set = TargetSet.init(.{ | |
| 20460 | .vevl_gen = true, | |
| 20461 | }); | |
| 20462 | const attributes = Attributes{}; | |
| 20463 | }; | |
| 20464 | ||
| 20465 | pub const __builtin_ve_vl_pvor_vsvvl = struct { | |
| 20466 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20467 | const target_set = TargetSet.init(.{ | |
| 20468 | .vevl_gen = true, | |
| 20469 | }); | |
| 20470 | const attributes = Attributes{}; | |
| 20471 | }; | |
| 20472 | ||
| 20473 | pub const __builtin_ve_vl_pvor_vvvMvl = struct { | |
| 20474 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20475 | const target_set = TargetSet.init(.{ | |
| 20476 | .vevl_gen = true, | |
| 20477 | }); | |
| 20478 | const attributes = Attributes{}; | |
| 20479 | }; | |
| 20480 | ||
| 20481 | pub const __builtin_ve_vl_pvor_vvvl = struct { | |
| 20482 | const param_str = "V256dV256dV256dUi"; | |
| 20483 | const target_set = TargetSet.init(.{ | |
| 20484 | .vevl_gen = true, | |
| 20485 | }); | |
| 20486 | const attributes = Attributes{}; | |
| 20487 | }; | |
| 20488 | ||
| 20489 | pub const __builtin_ve_vl_pvor_vvvvl = struct { | |
| 20490 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20491 | const target_set = TargetSet.init(.{ | |
| 20492 | .vevl_gen = true, | |
| 20493 | }); | |
| 20494 | const attributes = Attributes{}; | |
| 20495 | }; | |
| 20496 | ||
| 20497 | pub const __builtin_ve_vl_pvpcnt_vvMvl = struct { | |
| 20498 | const param_str = "V256dV256dV512bV256dUi"; | |
| 20499 | const target_set = TargetSet.init(.{ | |
| 20500 | .vevl_gen = true, | |
| 20501 | }); | |
| 20502 | const attributes = Attributes{}; | |
| 20503 | }; | |
| 20504 | ||
| 20505 | pub const __builtin_ve_vl_pvpcnt_vvl = struct { | |
| 20506 | const param_str = "V256dV256dUi"; | |
| 20507 | const target_set = TargetSet.init(.{ | |
| 20508 | .vevl_gen = true, | |
| 20509 | }); | |
| 20510 | const attributes = Attributes{}; | |
| 20511 | }; | |
| 20512 | ||
| 20513 | pub const __builtin_ve_vl_pvpcnt_vvvl = struct { | |
| 20514 | const param_str = "V256dV256dV256dUi"; | |
| 20515 | const target_set = TargetSet.init(.{ | |
| 20516 | .vevl_gen = true, | |
| 20517 | }); | |
| 20518 | const attributes = Attributes{}; | |
| 20519 | }; | |
| 20520 | ||
| 20521 | pub const __builtin_ve_vl_pvpcntlo_vvl = struct { | |
| 20522 | const param_str = "V256dV256dUi"; | |
| 20523 | const target_set = TargetSet.init(.{ | |
| 20524 | .vevl_gen = true, | |
| 20525 | }); | |
| 20526 | const attributes = Attributes{}; | |
| 20527 | }; | |
| 20528 | ||
| 20529 | pub const __builtin_ve_vl_pvpcntlo_vvmvl = struct { | |
| 20530 | const param_str = "V256dV256dV256bV256dUi"; | |
| 20531 | const target_set = TargetSet.init(.{ | |
| 20532 | .vevl_gen = true, | |
| 20533 | }); | |
| 20534 | const attributes = Attributes{}; | |
| 20535 | }; | |
| 20536 | ||
| 20537 | pub const __builtin_ve_vl_pvpcntlo_vvvl = struct { | |
| 20538 | const param_str = "V256dV256dV256dUi"; | |
| 20539 | const target_set = TargetSet.init(.{ | |
| 20540 | .vevl_gen = true, | |
| 20541 | }); | |
| 20542 | const attributes = Attributes{}; | |
| 20543 | }; | |
| 20544 | ||
| 20545 | pub const __builtin_ve_vl_pvpcntup_vvl = struct { | |
| 20546 | const param_str = "V256dV256dUi"; | |
| 20547 | const target_set = TargetSet.init(.{ | |
| 20548 | .vevl_gen = true, | |
| 20549 | }); | |
| 20550 | const attributes = Attributes{}; | |
| 20551 | }; | |
| 20552 | ||
| 20553 | pub const __builtin_ve_vl_pvpcntup_vvmvl = struct { | |
| 20554 | const param_str = "V256dV256dV256bV256dUi"; | |
| 20555 | const target_set = TargetSet.init(.{ | |
| 20556 | .vevl_gen = true, | |
| 20557 | }); | |
| 20558 | const attributes = Attributes{}; | |
| 20559 | }; | |
| 20560 | ||
| 20561 | pub const __builtin_ve_vl_pvpcntup_vvvl = struct { | |
| 20562 | const param_str = "V256dV256dV256dUi"; | |
| 20563 | const target_set = TargetSet.init(.{ | |
| 20564 | .vevl_gen = true, | |
| 20565 | }); | |
| 20566 | const attributes = Attributes{}; | |
| 20567 | }; | |
| 20568 | ||
| 20569 | pub const __builtin_ve_vl_pvrcp_vvl = struct { | |
| 20570 | const param_str = "V256dV256dUi"; | |
| 20571 | const target_set = TargetSet.init(.{ | |
| 20572 | .vevl_gen = true, | |
| 20573 | }); | |
| 20574 | const attributes = Attributes{}; | |
| 20575 | }; | |
| 20576 | ||
| 20577 | pub const __builtin_ve_vl_pvrcp_vvvl = struct { | |
| 20578 | const param_str = "V256dV256dV256dUi"; | |
| 20579 | const target_set = TargetSet.init(.{ | |
| 20580 | .vevl_gen = true, | |
| 20581 | }); | |
| 20582 | const attributes = Attributes{}; | |
| 20583 | }; | |
| 20584 | ||
| 20585 | pub const __builtin_ve_vl_pvrsqrt_vvl = struct { | |
| 20586 | const param_str = "V256dV256dUi"; | |
| 20587 | const target_set = TargetSet.init(.{ | |
| 20588 | .vevl_gen = true, | |
| 20589 | }); | |
| 20590 | const attributes = Attributes{}; | |
| 20591 | }; | |
| 20592 | ||
| 20593 | pub const __builtin_ve_vl_pvrsqrt_vvvl = struct { | |
| 20594 | const param_str = "V256dV256dV256dUi"; | |
| 20595 | const target_set = TargetSet.init(.{ | |
| 20596 | .vevl_gen = true, | |
| 20597 | }); | |
| 20598 | const attributes = Attributes{}; | |
| 20599 | }; | |
| 20600 | ||
| 20601 | pub const __builtin_ve_vl_pvrsqrtnex_vvl = struct { | |
| 20602 | const param_str = "V256dV256dUi"; | |
| 20603 | const target_set = TargetSet.init(.{ | |
| 20604 | .vevl_gen = true, | |
| 20605 | }); | |
| 20606 | const attributes = Attributes{}; | |
| 20607 | }; | |
| 20608 | ||
| 20609 | pub const __builtin_ve_vl_pvrsqrtnex_vvvl = struct { | |
| 20610 | const param_str = "V256dV256dV256dUi"; | |
| 20611 | const target_set = TargetSet.init(.{ | |
| 20612 | .vevl_gen = true, | |
| 20613 | }); | |
| 20614 | const attributes = Attributes{}; | |
| 20615 | }; | |
| 20616 | ||
| 20617 | pub const __builtin_ve_vl_pvseq_vl = struct { | |
| 20618 | const param_str = "V256dUi"; | |
| 20619 | const target_set = TargetSet.init(.{ | |
| 20620 | .vevl_gen = true, | |
| 20621 | }); | |
| 20622 | const attributes = Attributes{}; | |
| 20623 | }; | |
| 20624 | ||
| 20625 | pub const __builtin_ve_vl_pvseq_vvl = struct { | |
| 20626 | const param_str = "V256dV256dUi"; | |
| 20627 | const target_set = TargetSet.init(.{ | |
| 20628 | .vevl_gen = true, | |
| 20629 | }); | |
| 20630 | const attributes = Attributes{}; | |
| 20631 | }; | |
| 20632 | ||
| 20633 | pub const __builtin_ve_vl_pvseqlo_vl = struct { | |
| 20634 | const param_str = "V256dUi"; | |
| 20635 | const target_set = TargetSet.init(.{ | |
| 20636 | .vevl_gen = true, | |
| 20637 | }); | |
| 20638 | const attributes = Attributes{}; | |
| 20639 | }; | |
| 20640 | ||
| 20641 | pub const __builtin_ve_vl_pvseqlo_vvl = struct { | |
| 20642 | const param_str = "V256dV256dUi"; | |
| 20643 | const target_set = TargetSet.init(.{ | |
| 20644 | .vevl_gen = true, | |
| 20645 | }); | |
| 20646 | const attributes = Attributes{}; | |
| 20647 | }; | |
| 20648 | ||
| 20649 | pub const __builtin_ve_vl_pvsequp_vl = struct { | |
| 20650 | const param_str = "V256dUi"; | |
| 20651 | const target_set = TargetSet.init(.{ | |
| 20652 | .vevl_gen = true, | |
| 20653 | }); | |
| 20654 | const attributes = Attributes{}; | |
| 20655 | }; | |
| 20656 | ||
| 20657 | pub const __builtin_ve_vl_pvsequp_vvl = struct { | |
| 20658 | const param_str = "V256dV256dUi"; | |
| 20659 | const target_set = TargetSet.init(.{ | |
| 20660 | .vevl_gen = true, | |
| 20661 | }); | |
| 20662 | const attributes = Attributes{}; | |
| 20663 | }; | |
| 20664 | ||
| 20665 | pub const __builtin_ve_vl_pvsla_vvsMvl = struct { | |
| 20666 | const param_str = "V256dV256dLUiV512bV256dUi"; | |
| 20667 | const target_set = TargetSet.init(.{ | |
| 20668 | .vevl_gen = true, | |
| 20669 | }); | |
| 20670 | const attributes = Attributes{}; | |
| 20671 | }; | |
| 20672 | ||
| 20673 | pub const __builtin_ve_vl_pvsla_vvsl = struct { | |
| 20674 | const param_str = "V256dV256dLUiUi"; | |
| 20675 | const target_set = TargetSet.init(.{ | |
| 20676 | .vevl_gen = true, | |
| 20677 | }); | |
| 20678 | const attributes = Attributes{}; | |
| 20679 | }; | |
| 20680 | ||
| 20681 | pub const __builtin_ve_vl_pvsla_vvsvl = struct { | |
| 20682 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20683 | const target_set = TargetSet.init(.{ | |
| 20684 | .vevl_gen = true, | |
| 20685 | }); | |
| 20686 | const attributes = Attributes{}; | |
| 20687 | }; | |
| 20688 | ||
| 20689 | pub const __builtin_ve_vl_pvsla_vvvMvl = struct { | |
| 20690 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20691 | const target_set = TargetSet.init(.{ | |
| 20692 | .vevl_gen = true, | |
| 20693 | }); | |
| 20694 | const attributes = Attributes{}; | |
| 20695 | }; | |
| 20696 | ||
| 20697 | pub const __builtin_ve_vl_pvsla_vvvl = struct { | |
| 20698 | const param_str = "V256dV256dV256dUi"; | |
| 20699 | const target_set = TargetSet.init(.{ | |
| 20700 | .vevl_gen = true, | |
| 20701 | }); | |
| 20702 | const attributes = Attributes{}; | |
| 20703 | }; | |
| 20704 | ||
| 20705 | pub const __builtin_ve_vl_pvsla_vvvvl = struct { | |
| 20706 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20707 | const target_set = TargetSet.init(.{ | |
| 20708 | .vevl_gen = true, | |
| 20709 | }); | |
| 20710 | const attributes = Attributes{}; | |
| 20711 | }; | |
| 20712 | ||
| 20713 | pub const __builtin_ve_vl_pvsll_vvsMvl = struct { | |
| 20714 | const param_str = "V256dV256dLUiV512bV256dUi"; | |
| 20715 | const target_set = TargetSet.init(.{ | |
| 20716 | .vevl_gen = true, | |
| 20717 | }); | |
| 20718 | const attributes = Attributes{}; | |
| 20719 | }; | |
| 20720 | ||
| 20721 | pub const __builtin_ve_vl_pvsll_vvsl = struct { | |
| 20722 | const param_str = "V256dV256dLUiUi"; | |
| 20723 | const target_set = TargetSet.init(.{ | |
| 20724 | .vevl_gen = true, | |
| 20725 | }); | |
| 20726 | const attributes = Attributes{}; | |
| 20727 | }; | |
| 20728 | ||
| 20729 | pub const __builtin_ve_vl_pvsll_vvsvl = struct { | |
| 20730 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20731 | const target_set = TargetSet.init(.{ | |
| 20732 | .vevl_gen = true, | |
| 20733 | }); | |
| 20734 | const attributes = Attributes{}; | |
| 20735 | }; | |
| 20736 | ||
| 20737 | pub const __builtin_ve_vl_pvsll_vvvMvl = struct { | |
| 20738 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20739 | const target_set = TargetSet.init(.{ | |
| 20740 | .vevl_gen = true, | |
| 20741 | }); | |
| 20742 | const attributes = Attributes{}; | |
| 20743 | }; | |
| 20744 | ||
| 20745 | pub const __builtin_ve_vl_pvsll_vvvl = struct { | |
| 20746 | const param_str = "V256dV256dV256dUi"; | |
| 20747 | const target_set = TargetSet.init(.{ | |
| 20748 | .vevl_gen = true, | |
| 20749 | }); | |
| 20750 | const attributes = Attributes{}; | |
| 20751 | }; | |
| 20752 | ||
| 20753 | pub const __builtin_ve_vl_pvsll_vvvvl = struct { | |
| 20754 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20755 | const target_set = TargetSet.init(.{ | |
| 20756 | .vevl_gen = true, | |
| 20757 | }); | |
| 20758 | const attributes = Attributes{}; | |
| 20759 | }; | |
| 20760 | ||
| 20761 | pub const __builtin_ve_vl_pvsra_vvsMvl = struct { | |
| 20762 | const param_str = "V256dV256dLUiV512bV256dUi"; | |
| 20763 | const target_set = TargetSet.init(.{ | |
| 20764 | .vevl_gen = true, | |
| 20765 | }); | |
| 20766 | const attributes = Attributes{}; | |
| 20767 | }; | |
| 20768 | ||
| 20769 | pub const __builtin_ve_vl_pvsra_vvsl = struct { | |
| 20770 | const param_str = "V256dV256dLUiUi"; | |
| 20771 | const target_set = TargetSet.init(.{ | |
| 20772 | .vevl_gen = true, | |
| 20773 | }); | |
| 20774 | const attributes = Attributes{}; | |
| 20775 | }; | |
| 20776 | ||
| 20777 | pub const __builtin_ve_vl_pvsra_vvsvl = struct { | |
| 20778 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20779 | const target_set = TargetSet.init(.{ | |
| 20780 | .vevl_gen = true, | |
| 20781 | }); | |
| 20782 | const attributes = Attributes{}; | |
| 20783 | }; | |
| 20784 | ||
| 20785 | pub const __builtin_ve_vl_pvsra_vvvMvl = struct { | |
| 20786 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20787 | const target_set = TargetSet.init(.{ | |
| 20788 | .vevl_gen = true, | |
| 20789 | }); | |
| 20790 | const attributes = Attributes{}; | |
| 20791 | }; | |
| 20792 | ||
| 20793 | pub const __builtin_ve_vl_pvsra_vvvl = struct { | |
| 20794 | const param_str = "V256dV256dV256dUi"; | |
| 20795 | const target_set = TargetSet.init(.{ | |
| 20796 | .vevl_gen = true, | |
| 20797 | }); | |
| 20798 | const attributes = Attributes{}; | |
| 20799 | }; | |
| 20800 | ||
| 20801 | pub const __builtin_ve_vl_pvsra_vvvvl = struct { | |
| 20802 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20803 | const target_set = TargetSet.init(.{ | |
| 20804 | .vevl_gen = true, | |
| 20805 | }); | |
| 20806 | const attributes = Attributes{}; | |
| 20807 | }; | |
| 20808 | ||
| 20809 | pub const __builtin_ve_vl_pvsrl_vvsMvl = struct { | |
| 20810 | const param_str = "V256dV256dLUiV512bV256dUi"; | |
| 20811 | const target_set = TargetSet.init(.{ | |
| 20812 | .vevl_gen = true, | |
| 20813 | }); | |
| 20814 | const attributes = Attributes{}; | |
| 20815 | }; | |
| 20816 | ||
| 20817 | pub const __builtin_ve_vl_pvsrl_vvsl = struct { | |
| 20818 | const param_str = "V256dV256dLUiUi"; | |
| 20819 | const target_set = TargetSet.init(.{ | |
| 20820 | .vevl_gen = true, | |
| 20821 | }); | |
| 20822 | const attributes = Attributes{}; | |
| 20823 | }; | |
| 20824 | ||
| 20825 | pub const __builtin_ve_vl_pvsrl_vvsvl = struct { | |
| 20826 | const param_str = "V256dV256dLUiV256dUi"; | |
| 20827 | const target_set = TargetSet.init(.{ | |
| 20828 | .vevl_gen = true, | |
| 20829 | }); | |
| 20830 | const attributes = Attributes{}; | |
| 20831 | }; | |
| 20832 | ||
| 20833 | pub const __builtin_ve_vl_pvsrl_vvvMvl = struct { | |
| 20834 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20835 | const target_set = TargetSet.init(.{ | |
| 20836 | .vevl_gen = true, | |
| 20837 | }); | |
| 20838 | const attributes = Attributes{}; | |
| 20839 | }; | |
| 20840 | ||
| 20841 | pub const __builtin_ve_vl_pvsrl_vvvl = struct { | |
| 20842 | const param_str = "V256dV256dV256dUi"; | |
| 20843 | const target_set = TargetSet.init(.{ | |
| 20844 | .vevl_gen = true, | |
| 20845 | }); | |
| 20846 | const attributes = Attributes{}; | |
| 20847 | }; | |
| 20848 | ||
| 20849 | pub const __builtin_ve_vl_pvsrl_vvvvl = struct { | |
| 20850 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20851 | const target_set = TargetSet.init(.{ | |
| 20852 | .vevl_gen = true, | |
| 20853 | }); | |
| 20854 | const attributes = Attributes{}; | |
| 20855 | }; | |
| 20856 | ||
| 20857 | pub const __builtin_ve_vl_pvsubs_vsvMvl = struct { | |
| 20858 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20859 | const target_set = TargetSet.init(.{ | |
| 20860 | .vevl_gen = true, | |
| 20861 | }); | |
| 20862 | const attributes = Attributes{}; | |
| 20863 | }; | |
| 20864 | ||
| 20865 | pub const __builtin_ve_vl_pvsubs_vsvl = struct { | |
| 20866 | const param_str = "V256dLUiV256dUi"; | |
| 20867 | const target_set = TargetSet.init(.{ | |
| 20868 | .vevl_gen = true, | |
| 20869 | }); | |
| 20870 | const attributes = Attributes{}; | |
| 20871 | }; | |
| 20872 | ||
| 20873 | pub const __builtin_ve_vl_pvsubs_vsvvl = struct { | |
| 20874 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20875 | const target_set = TargetSet.init(.{ | |
| 20876 | .vevl_gen = true, | |
| 20877 | }); | |
| 20878 | const attributes = Attributes{}; | |
| 20879 | }; | |
| 20880 | ||
| 20881 | pub const __builtin_ve_vl_pvsubs_vvvMvl = struct { | |
| 20882 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20883 | const target_set = TargetSet.init(.{ | |
| 20884 | .vevl_gen = true, | |
| 20885 | }); | |
| 20886 | const attributes = Attributes{}; | |
| 20887 | }; | |
| 20888 | ||
| 20889 | pub const __builtin_ve_vl_pvsubs_vvvl = struct { | |
| 20890 | const param_str = "V256dV256dV256dUi"; | |
| 20891 | const target_set = TargetSet.init(.{ | |
| 20892 | .vevl_gen = true, | |
| 20893 | }); | |
| 20894 | const attributes = Attributes{}; | |
| 20895 | }; | |
| 20896 | ||
| 20897 | pub const __builtin_ve_vl_pvsubs_vvvvl = struct { | |
| 20898 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20899 | const target_set = TargetSet.init(.{ | |
| 20900 | .vevl_gen = true, | |
| 20901 | }); | |
| 20902 | const attributes = Attributes{}; | |
| 20903 | }; | |
| 20904 | ||
| 20905 | pub const __builtin_ve_vl_pvsubu_vsvMvl = struct { | |
| 20906 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20907 | const target_set = TargetSet.init(.{ | |
| 20908 | .vevl_gen = true, | |
| 20909 | }); | |
| 20910 | const attributes = Attributes{}; | |
| 20911 | }; | |
| 20912 | ||
| 20913 | pub const __builtin_ve_vl_pvsubu_vsvl = struct { | |
| 20914 | const param_str = "V256dLUiV256dUi"; | |
| 20915 | const target_set = TargetSet.init(.{ | |
| 20916 | .vevl_gen = true, | |
| 20917 | }); | |
| 20918 | const attributes = Attributes{}; | |
| 20919 | }; | |
| 20920 | ||
| 20921 | pub const __builtin_ve_vl_pvsubu_vsvvl = struct { | |
| 20922 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20923 | const target_set = TargetSet.init(.{ | |
| 20924 | .vevl_gen = true, | |
| 20925 | }); | |
| 20926 | const attributes = Attributes{}; | |
| 20927 | }; | |
| 20928 | ||
| 20929 | pub const __builtin_ve_vl_pvsubu_vvvMvl = struct { | |
| 20930 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20931 | const target_set = TargetSet.init(.{ | |
| 20932 | .vevl_gen = true, | |
| 20933 | }); | |
| 20934 | const attributes = Attributes{}; | |
| 20935 | }; | |
| 20936 | ||
| 20937 | pub const __builtin_ve_vl_pvsubu_vvvl = struct { | |
| 20938 | const param_str = "V256dV256dV256dUi"; | |
| 20939 | const target_set = TargetSet.init(.{ | |
| 20940 | .vevl_gen = true, | |
| 20941 | }); | |
| 20942 | const attributes = Attributes{}; | |
| 20943 | }; | |
| 20944 | ||
| 20945 | pub const __builtin_ve_vl_pvsubu_vvvvl = struct { | |
| 20946 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20947 | const target_set = TargetSet.init(.{ | |
| 20948 | .vevl_gen = true, | |
| 20949 | }); | |
| 20950 | const attributes = Attributes{}; | |
| 20951 | }; | |
| 20952 | ||
| 20953 | pub const __builtin_ve_vl_pvxor_vsvMvl = struct { | |
| 20954 | const param_str = "V256dLUiV256dV512bV256dUi"; | |
| 20955 | const target_set = TargetSet.init(.{ | |
| 20956 | .vevl_gen = true, | |
| 20957 | }); | |
| 20958 | const attributes = Attributes{}; | |
| 20959 | }; | |
| 20960 | ||
| 20961 | pub const __builtin_ve_vl_pvxor_vsvl = struct { | |
| 20962 | const param_str = "V256dLUiV256dUi"; | |
| 20963 | const target_set = TargetSet.init(.{ | |
| 20964 | .vevl_gen = true, | |
| 20965 | }); | |
| 20966 | const attributes = Attributes{}; | |
| 20967 | }; | |
| 20968 | ||
| 20969 | pub const __builtin_ve_vl_pvxor_vsvvl = struct { | |
| 20970 | const param_str = "V256dLUiV256dV256dUi"; | |
| 20971 | const target_set = TargetSet.init(.{ | |
| 20972 | .vevl_gen = true, | |
| 20973 | }); | |
| 20974 | const attributes = Attributes{}; | |
| 20975 | }; | |
| 20976 | ||
| 20977 | pub const __builtin_ve_vl_pvxor_vvvMvl = struct { | |
| 20978 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 20979 | const target_set = TargetSet.init(.{ | |
| 20980 | .vevl_gen = true, | |
| 20981 | }); | |
| 20982 | const attributes = Attributes{}; | |
| 20983 | }; | |
| 20984 | ||
| 20985 | pub const __builtin_ve_vl_pvxor_vvvl = struct { | |
| 20986 | const param_str = "V256dV256dV256dUi"; | |
| 20987 | const target_set = TargetSet.init(.{ | |
| 20988 | .vevl_gen = true, | |
| 20989 | }); | |
| 20990 | const attributes = Attributes{}; | |
| 20991 | }; | |
| 20992 | ||
| 20993 | pub const __builtin_ve_vl_pvxor_vvvvl = struct { | |
| 20994 | const param_str = "V256dV256dV256dV256dUi"; | |
| 20995 | const target_set = TargetSet.init(.{ | |
| 20996 | .vevl_gen = true, | |
| 20997 | }); | |
| 20998 | const attributes = Attributes{}; | |
| 20999 | }; | |
| 21000 | ||
| 21001 | pub const __builtin_ve_vl_scr_sss = struct { | |
| 21002 | const param_str = "vLUiLUiLUi"; | |
| 21003 | const target_set = TargetSet.init(.{ | |
| 21004 | .vevl_gen = true, | |
| 21005 | }); | |
| 21006 | const attributes = Attributes{}; | |
| 21007 | }; | |
| 21008 | ||
| 21009 | pub const __builtin_ve_vl_svm_sMs = struct { | |
| 21010 | const param_str = "LUiV512bLUi"; | |
| 21011 | const target_set = TargetSet.init(.{ | |
| 21012 | .vevl_gen = true, | |
| 21013 | }); | |
| 21014 | const attributes = Attributes{}; | |
| 21015 | }; | |
| 21016 | ||
| 21017 | pub const __builtin_ve_vl_svm_sms = struct { | |
| 21018 | const param_str = "LUiV256bLUi"; | |
| 21019 | const target_set = TargetSet.init(.{ | |
| 21020 | .vevl_gen = true, | |
| 21021 | }); | |
| 21022 | const attributes = Attributes{}; | |
| 21023 | }; | |
| 21024 | ||
| 21025 | pub const __builtin_ve_vl_svob = struct { | |
| 21026 | const param_str = "v"; | |
| 21027 | const target_set = TargetSet.init(.{ | |
| 21028 | .vevl_gen = true, | |
| 21029 | }); | |
| 21030 | const attributes = Attributes{}; | |
| 21031 | }; | |
| 21032 | ||
| 21033 | pub const __builtin_ve_vl_tovm_sml = struct { | |
| 21034 | const param_str = "LUiV256bUi"; | |
| 21035 | const target_set = TargetSet.init(.{ | |
| 21036 | .vevl_gen = true, | |
| 21037 | }); | |
| 21038 | const attributes = Attributes{}; | |
| 21039 | }; | |
| 21040 | ||
| 21041 | pub const __builtin_ve_vl_tscr_ssss = struct { | |
| 21042 | const param_str = "LUiLUiLUiLUi"; | |
| 21043 | const target_set = TargetSet.init(.{ | |
| 21044 | .vevl_gen = true, | |
| 21045 | }); | |
| 21046 | const attributes = Attributes{}; | |
| 21047 | }; | |
| 21048 | ||
| 21049 | pub const __builtin_ve_vl_vaddsl_vsvl = struct { | |
| 21050 | const param_str = "V256dLiV256dUi"; | |
| 21051 | const target_set = TargetSet.init(.{ | |
| 21052 | .vevl_gen = true, | |
| 21053 | }); | |
| 21054 | const attributes = Attributes{}; | |
| 21055 | }; | |
| 21056 | ||
| 21057 | pub const __builtin_ve_vl_vaddsl_vsvmvl = struct { | |
| 21058 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 21059 | const target_set = TargetSet.init(.{ | |
| 21060 | .vevl_gen = true, | |
| 21061 | }); | |
| 21062 | const attributes = Attributes{}; | |
| 21063 | }; | |
| 21064 | ||
| 21065 | pub const __builtin_ve_vl_vaddsl_vsvvl = struct { | |
| 21066 | const param_str = "V256dLiV256dV256dUi"; | |
| 21067 | const target_set = TargetSet.init(.{ | |
| 21068 | .vevl_gen = true, | |
| 21069 | }); | |
| 21070 | const attributes = Attributes{}; | |
| 21071 | }; | |
| 21072 | ||
| 21073 | pub const __builtin_ve_vl_vaddsl_vvvl = struct { | |
| 21074 | const param_str = "V256dV256dV256dUi"; | |
| 21075 | const target_set = TargetSet.init(.{ | |
| 21076 | .vevl_gen = true, | |
| 21077 | }); | |
| 21078 | const attributes = Attributes{}; | |
| 21079 | }; | |
| 21080 | ||
| 21081 | pub const __builtin_ve_vl_vaddsl_vvvmvl = struct { | |
| 21082 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21083 | const target_set = TargetSet.init(.{ | |
| 21084 | .vevl_gen = true, | |
| 21085 | }); | |
| 21086 | const attributes = Attributes{}; | |
| 21087 | }; | |
| 21088 | ||
| 21089 | pub const __builtin_ve_vl_vaddsl_vvvvl = struct { | |
| 21090 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21091 | const target_set = TargetSet.init(.{ | |
| 21092 | .vevl_gen = true, | |
| 21093 | }); | |
| 21094 | const attributes = Attributes{}; | |
| 21095 | }; | |
| 21096 | ||
| 21097 | pub const __builtin_ve_vl_vaddswsx_vsvl = struct { | |
| 21098 | const param_str = "V256diV256dUi"; | |
| 21099 | const target_set = TargetSet.init(.{ | |
| 21100 | .vevl_gen = true, | |
| 21101 | }); | |
| 21102 | const attributes = Attributes{}; | |
| 21103 | }; | |
| 21104 | ||
| 21105 | pub const __builtin_ve_vl_vaddswsx_vsvmvl = struct { | |
| 21106 | const param_str = "V256diV256dV256bV256dUi"; | |
| 21107 | const target_set = TargetSet.init(.{ | |
| 21108 | .vevl_gen = true, | |
| 21109 | }); | |
| 21110 | const attributes = Attributes{}; | |
| 21111 | }; | |
| 21112 | ||
| 21113 | pub const __builtin_ve_vl_vaddswsx_vsvvl = struct { | |
| 21114 | const param_str = "V256diV256dV256dUi"; | |
| 21115 | const target_set = TargetSet.init(.{ | |
| 21116 | .vevl_gen = true, | |
| 21117 | }); | |
| 21118 | const attributes = Attributes{}; | |
| 21119 | }; | |
| 21120 | ||
| 21121 | pub const __builtin_ve_vl_vaddswsx_vvvl = struct { | |
| 21122 | const param_str = "V256dV256dV256dUi"; | |
| 21123 | const target_set = TargetSet.init(.{ | |
| 21124 | .vevl_gen = true, | |
| 21125 | }); | |
| 21126 | const attributes = Attributes{}; | |
| 21127 | }; | |
| 21128 | ||
| 21129 | pub const __builtin_ve_vl_vaddswsx_vvvmvl = struct { | |
| 21130 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21131 | const target_set = TargetSet.init(.{ | |
| 21132 | .vevl_gen = true, | |
| 21133 | }); | |
| 21134 | const attributes = Attributes{}; | |
| 21135 | }; | |
| 21136 | ||
| 21137 | pub const __builtin_ve_vl_vaddswsx_vvvvl = struct { | |
| 21138 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21139 | const target_set = TargetSet.init(.{ | |
| 21140 | .vevl_gen = true, | |
| 21141 | }); | |
| 21142 | const attributes = Attributes{}; | |
| 21143 | }; | |
| 21144 | ||
| 21145 | pub const __builtin_ve_vl_vaddswzx_vsvl = struct { | |
| 21146 | const param_str = "V256diV256dUi"; | |
| 21147 | const target_set = TargetSet.init(.{ | |
| 21148 | .vevl_gen = true, | |
| 21149 | }); | |
| 21150 | const attributes = Attributes{}; | |
| 21151 | }; | |
| 21152 | ||
| 21153 | pub const __builtin_ve_vl_vaddswzx_vsvmvl = struct { | |
| 21154 | const param_str = "V256diV256dV256bV256dUi"; | |
| 21155 | const target_set = TargetSet.init(.{ | |
| 21156 | .vevl_gen = true, | |
| 21157 | }); | |
| 21158 | const attributes = Attributes{}; | |
| 21159 | }; | |
| 21160 | ||
| 21161 | pub const __builtin_ve_vl_vaddswzx_vsvvl = struct { | |
| 21162 | const param_str = "V256diV256dV256dUi"; | |
| 21163 | const target_set = TargetSet.init(.{ | |
| 21164 | .vevl_gen = true, | |
| 21165 | }); | |
| 21166 | const attributes = Attributes{}; | |
| 21167 | }; | |
| 21168 | ||
| 21169 | pub const __builtin_ve_vl_vaddswzx_vvvl = struct { | |
| 21170 | const param_str = "V256dV256dV256dUi"; | |
| 21171 | const target_set = TargetSet.init(.{ | |
| 21172 | .vevl_gen = true, | |
| 21173 | }); | |
| 21174 | const attributes = Attributes{}; | |
| 21175 | }; | |
| 21176 | ||
| 21177 | pub const __builtin_ve_vl_vaddswzx_vvvmvl = struct { | |
| 21178 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21179 | const target_set = TargetSet.init(.{ | |
| 21180 | .vevl_gen = true, | |
| 21181 | }); | |
| 21182 | const attributes = Attributes{}; | |
| 21183 | }; | |
| 21184 | ||
| 21185 | pub const __builtin_ve_vl_vaddswzx_vvvvl = struct { | |
| 21186 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21187 | const target_set = TargetSet.init(.{ | |
| 21188 | .vevl_gen = true, | |
| 21189 | }); | |
| 21190 | const attributes = Attributes{}; | |
| 21191 | }; | |
| 21192 | ||
| 21193 | pub const __builtin_ve_vl_vaddul_vsvl = struct { | |
| 21194 | const param_str = "V256dLUiV256dUi"; | |
| 21195 | const target_set = TargetSet.init(.{ | |
| 21196 | .vevl_gen = true, | |
| 21197 | }); | |
| 21198 | const attributes = Attributes{}; | |
| 21199 | }; | |
| 21200 | ||
| 21201 | pub const __builtin_ve_vl_vaddul_vsvmvl = struct { | |
| 21202 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 21203 | const target_set = TargetSet.init(.{ | |
| 21204 | .vevl_gen = true, | |
| 21205 | }); | |
| 21206 | const attributes = Attributes{}; | |
| 21207 | }; | |
| 21208 | ||
| 21209 | pub const __builtin_ve_vl_vaddul_vsvvl = struct { | |
| 21210 | const param_str = "V256dLUiV256dV256dUi"; | |
| 21211 | const target_set = TargetSet.init(.{ | |
| 21212 | .vevl_gen = true, | |
| 21213 | }); | |
| 21214 | const attributes = Attributes{}; | |
| 21215 | }; | |
| 21216 | ||
| 21217 | pub const __builtin_ve_vl_vaddul_vvvl = struct { | |
| 21218 | const param_str = "V256dV256dV256dUi"; | |
| 21219 | const target_set = TargetSet.init(.{ | |
| 21220 | .vevl_gen = true, | |
| 21221 | }); | |
| 21222 | const attributes = Attributes{}; | |
| 21223 | }; | |
| 21224 | ||
| 21225 | pub const __builtin_ve_vl_vaddul_vvvmvl = struct { | |
| 21226 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21227 | const target_set = TargetSet.init(.{ | |
| 21228 | .vevl_gen = true, | |
| 21229 | }); | |
| 21230 | const attributes = Attributes{}; | |
| 21231 | }; | |
| 21232 | ||
| 21233 | pub const __builtin_ve_vl_vaddul_vvvvl = struct { | |
| 21234 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21235 | const target_set = TargetSet.init(.{ | |
| 21236 | .vevl_gen = true, | |
| 21237 | }); | |
| 21238 | const attributes = Attributes{}; | |
| 21239 | }; | |
| 21240 | ||
| 21241 | pub const __builtin_ve_vl_vadduw_vsvl = struct { | |
| 21242 | const param_str = "V256dUiV256dUi"; | |
| 21243 | const target_set = TargetSet.init(.{ | |
| 21244 | .vevl_gen = true, | |
| 21245 | }); | |
| 21246 | const attributes = Attributes{}; | |
| 21247 | }; | |
| 21248 | ||
| 21249 | pub const __builtin_ve_vl_vadduw_vsvmvl = struct { | |
| 21250 | const param_str = "V256dUiV256dV256bV256dUi"; | |
| 21251 | const target_set = TargetSet.init(.{ | |
| 21252 | .vevl_gen = true, | |
| 21253 | }); | |
| 21254 | const attributes = Attributes{}; | |
| 21255 | }; | |
| 21256 | ||
| 21257 | pub const __builtin_ve_vl_vadduw_vsvvl = struct { | |
| 21258 | const param_str = "V256dUiV256dV256dUi"; | |
| 21259 | const target_set = TargetSet.init(.{ | |
| 21260 | .vevl_gen = true, | |
| 21261 | }); | |
| 21262 | const attributes = Attributes{}; | |
| 21263 | }; | |
| 21264 | ||
| 21265 | pub const __builtin_ve_vl_vadduw_vvvl = struct { | |
| 21266 | const param_str = "V256dV256dV256dUi"; | |
| 21267 | const target_set = TargetSet.init(.{ | |
| 21268 | .vevl_gen = true, | |
| 21269 | }); | |
| 21270 | const attributes = Attributes{}; | |
| 21271 | }; | |
| 21272 | ||
| 21273 | pub const __builtin_ve_vl_vadduw_vvvmvl = struct { | |
| 21274 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21275 | const target_set = TargetSet.init(.{ | |
| 21276 | .vevl_gen = true, | |
| 21277 | }); | |
| 21278 | const attributes = Attributes{}; | |
| 21279 | }; | |
| 21280 | ||
| 21281 | pub const __builtin_ve_vl_vadduw_vvvvl = struct { | |
| 21282 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21283 | const target_set = TargetSet.init(.{ | |
| 21284 | .vevl_gen = true, | |
| 21285 | }); | |
| 21286 | const attributes = Attributes{}; | |
| 21287 | }; | |
| 21288 | ||
| 21289 | pub const __builtin_ve_vl_vand_vsvl = struct { | |
| 21290 | const param_str = "V256dLUiV256dUi"; | |
| 21291 | const target_set = TargetSet.init(.{ | |
| 21292 | .vevl_gen = true, | |
| 21293 | }); | |
| 21294 | const attributes = Attributes{}; | |
| 21295 | }; | |
| 21296 | ||
| 21297 | pub const __builtin_ve_vl_vand_vsvmvl = struct { | |
| 21298 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 21299 | const target_set = TargetSet.init(.{ | |
| 21300 | .vevl_gen = true, | |
| 21301 | }); | |
| 21302 | const attributes = Attributes{}; | |
| 21303 | }; | |
| 21304 | ||
| 21305 | pub const __builtin_ve_vl_vand_vsvvl = struct { | |
| 21306 | const param_str = "V256dLUiV256dV256dUi"; | |
| 21307 | const target_set = TargetSet.init(.{ | |
| 21308 | .vevl_gen = true, | |
| 21309 | }); | |
| 21310 | const attributes = Attributes{}; | |
| 21311 | }; | |
| 21312 | ||
| 21313 | pub const __builtin_ve_vl_vand_vvvl = struct { | |
| 21314 | const param_str = "V256dV256dV256dUi"; | |
| 21315 | const target_set = TargetSet.init(.{ | |
| 21316 | .vevl_gen = true, | |
| 21317 | }); | |
| 21318 | const attributes = Attributes{}; | |
| 21319 | }; | |
| 21320 | ||
| 21321 | pub const __builtin_ve_vl_vand_vvvmvl = struct { | |
| 21322 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21323 | const target_set = TargetSet.init(.{ | |
| 21324 | .vevl_gen = true, | |
| 21325 | }); | |
| 21326 | const attributes = Attributes{}; | |
| 21327 | }; | |
| 21328 | ||
| 21329 | pub const __builtin_ve_vl_vand_vvvvl = struct { | |
| 21330 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21331 | const target_set = TargetSet.init(.{ | |
| 21332 | .vevl_gen = true, | |
| 21333 | }); | |
| 21334 | const attributes = Attributes{}; | |
| 21335 | }; | |
| 21336 | ||
| 21337 | pub const __builtin_ve_vl_vbrdd_vsl = struct { | |
| 21338 | const param_str = "V256ddUi"; | |
| 21339 | const target_set = TargetSet.init(.{ | |
| 21340 | .vevl_gen = true, | |
| 21341 | }); | |
| 21342 | const attributes = Attributes{}; | |
| 21343 | }; | |
| 21344 | ||
| 21345 | pub const __builtin_ve_vl_vbrdd_vsmvl = struct { | |
| 21346 | const param_str = "V256ddV256bV256dUi"; | |
| 21347 | const target_set = TargetSet.init(.{ | |
| 21348 | .vevl_gen = true, | |
| 21349 | }); | |
| 21350 | const attributes = Attributes{}; | |
| 21351 | }; | |
| 21352 | ||
| 21353 | pub const __builtin_ve_vl_vbrdd_vsvl = struct { | |
| 21354 | const param_str = "V256ddV256dUi"; | |
| 21355 | const target_set = TargetSet.init(.{ | |
| 21356 | .vevl_gen = true, | |
| 21357 | }); | |
| 21358 | const attributes = Attributes{}; | |
| 21359 | }; | |
| 21360 | ||
| 21361 | pub const __builtin_ve_vl_vbrdl_vsl = struct { | |
| 21362 | const param_str = "V256dLiUi"; | |
| 21363 | const target_set = TargetSet.init(.{ | |
| 21364 | .vevl_gen = true, | |
| 21365 | }); | |
| 21366 | const attributes = Attributes{}; | |
| 21367 | }; | |
| 21368 | ||
| 21369 | pub const __builtin_ve_vl_vbrdl_vsmvl = struct { | |
| 21370 | const param_str = "V256dLiV256bV256dUi"; | |
| 21371 | const target_set = TargetSet.init(.{ | |
| 21372 | .vevl_gen = true, | |
| 21373 | }); | |
| 21374 | const attributes = Attributes{}; | |
| 21375 | }; | |
| 21376 | ||
| 21377 | pub const __builtin_ve_vl_vbrdl_vsvl = struct { | |
| 21378 | const param_str = "V256dLiV256dUi"; | |
| 21379 | const target_set = TargetSet.init(.{ | |
| 21380 | .vevl_gen = true, | |
| 21381 | }); | |
| 21382 | const attributes = Attributes{}; | |
| 21383 | }; | |
| 21384 | ||
| 21385 | pub const __builtin_ve_vl_vbrds_vsl = struct { | |
| 21386 | const param_str = "V256dfUi"; | |
| 21387 | const target_set = TargetSet.init(.{ | |
| 21388 | .vevl_gen = true, | |
| 21389 | }); | |
| 21390 | const attributes = Attributes{}; | |
| 21391 | }; | |
| 21392 | ||
| 21393 | pub const __builtin_ve_vl_vbrds_vsmvl = struct { | |
| 21394 | const param_str = "V256dfV256bV256dUi"; | |
| 21395 | const target_set = TargetSet.init(.{ | |
| 21396 | .vevl_gen = true, | |
| 21397 | }); | |
| 21398 | const attributes = Attributes{}; | |
| 21399 | }; | |
| 21400 | ||
| 21401 | pub const __builtin_ve_vl_vbrds_vsvl = struct { | |
| 21402 | const param_str = "V256dfV256dUi"; | |
| 21403 | const target_set = TargetSet.init(.{ | |
| 21404 | .vevl_gen = true, | |
| 21405 | }); | |
| 21406 | const attributes = Attributes{}; | |
| 21407 | }; | |
| 21408 | ||
| 21409 | pub const __builtin_ve_vl_vbrdw_vsl = struct { | |
| 21410 | const param_str = "V256diUi"; | |
| 21411 | const target_set = TargetSet.init(.{ | |
| 21412 | .vevl_gen = true, | |
| 21413 | }); | |
| 21414 | const attributes = Attributes{}; | |
| 21415 | }; | |
| 21416 | ||
| 21417 | pub const __builtin_ve_vl_vbrdw_vsmvl = struct { | |
| 21418 | const param_str = "V256diV256bV256dUi"; | |
| 21419 | const target_set = TargetSet.init(.{ | |
| 21420 | .vevl_gen = true, | |
| 21421 | }); | |
| 21422 | const attributes = Attributes{}; | |
| 21423 | }; | |
| 21424 | ||
| 21425 | pub const __builtin_ve_vl_vbrdw_vsvl = struct { | |
| 21426 | const param_str = "V256diV256dUi"; | |
| 21427 | const target_set = TargetSet.init(.{ | |
| 21428 | .vevl_gen = true, | |
| 21429 | }); | |
| 21430 | const attributes = Attributes{}; | |
| 21431 | }; | |
| 21432 | ||
| 21433 | pub const __builtin_ve_vl_vbrv_vvl = struct { | |
| 21434 | const param_str = "V256dV256dUi"; | |
| 21435 | const target_set = TargetSet.init(.{ | |
| 21436 | .vevl_gen = true, | |
| 21437 | }); | |
| 21438 | const attributes = Attributes{}; | |
| 21439 | }; | |
| 21440 | ||
| 21441 | pub const __builtin_ve_vl_vbrv_vvmvl = struct { | |
| 21442 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21443 | const target_set = TargetSet.init(.{ | |
| 21444 | .vevl_gen = true, | |
| 21445 | }); | |
| 21446 | const attributes = Attributes{}; | |
| 21447 | }; | |
| 21448 | ||
| 21449 | pub const __builtin_ve_vl_vbrv_vvvl = struct { | |
| 21450 | const param_str = "V256dV256dV256dUi"; | |
| 21451 | const target_set = TargetSet.init(.{ | |
| 21452 | .vevl_gen = true, | |
| 21453 | }); | |
| 21454 | const attributes = Attributes{}; | |
| 21455 | }; | |
| 21456 | ||
| 21457 | pub const __builtin_ve_vl_vcmpsl_vsvl = struct { | |
| 21458 | const param_str = "V256dLiV256dUi"; | |
| 21459 | const target_set = TargetSet.init(.{ | |
| 21460 | .vevl_gen = true, | |
| 21461 | }); | |
| 21462 | const attributes = Attributes{}; | |
| 21463 | }; | |
| 21464 | ||
| 21465 | pub const __builtin_ve_vl_vcmpsl_vsvmvl = struct { | |
| 21466 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 21467 | const target_set = TargetSet.init(.{ | |
| 21468 | .vevl_gen = true, | |
| 21469 | }); | |
| 21470 | const attributes = Attributes{}; | |
| 21471 | }; | |
| 21472 | ||
| 21473 | pub const __builtin_ve_vl_vcmpsl_vsvvl = struct { | |
| 21474 | const param_str = "V256dLiV256dV256dUi"; | |
| 21475 | const target_set = TargetSet.init(.{ | |
| 21476 | .vevl_gen = true, | |
| 21477 | }); | |
| 21478 | const attributes = Attributes{}; | |
| 21479 | }; | |
| 21480 | ||
| 21481 | pub const __builtin_ve_vl_vcmpsl_vvvl = struct { | |
| 21482 | const param_str = "V256dV256dV256dUi"; | |
| 21483 | const target_set = TargetSet.init(.{ | |
| 21484 | .vevl_gen = true, | |
| 21485 | }); | |
| 21486 | const attributes = Attributes{}; | |
| 21487 | }; | |
| 21488 | ||
| 21489 | pub const __builtin_ve_vl_vcmpsl_vvvmvl = struct { | |
| 21490 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21491 | const target_set = TargetSet.init(.{ | |
| 21492 | .vevl_gen = true, | |
| 21493 | }); | |
| 21494 | const attributes = Attributes{}; | |
| 21495 | }; | |
| 21496 | ||
| 21497 | pub const __builtin_ve_vl_vcmpsl_vvvvl = struct { | |
| 21498 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21499 | const target_set = TargetSet.init(.{ | |
| 21500 | .vevl_gen = true, | |
| 21501 | }); | |
| 21502 | const attributes = Attributes{}; | |
| 21503 | }; | |
| 21504 | ||
| 21505 | pub const __builtin_ve_vl_vcmpswsx_vsvl = struct { | |
| 21506 | const param_str = "V256diV256dUi"; | |
| 21507 | const target_set = TargetSet.init(.{ | |
| 21508 | .vevl_gen = true, | |
| 21509 | }); | |
| 21510 | const attributes = Attributes{}; | |
| 21511 | }; | |
| 21512 | ||
| 21513 | pub const __builtin_ve_vl_vcmpswsx_vsvmvl = struct { | |
| 21514 | const param_str = "V256diV256dV256bV256dUi"; | |
| 21515 | const target_set = TargetSet.init(.{ | |
| 21516 | .vevl_gen = true, | |
| 21517 | }); | |
| 21518 | const attributes = Attributes{}; | |
| 21519 | }; | |
| 21520 | ||
| 21521 | pub const __builtin_ve_vl_vcmpswsx_vsvvl = struct { | |
| 21522 | const param_str = "V256diV256dV256dUi"; | |
| 21523 | const target_set = TargetSet.init(.{ | |
| 21524 | .vevl_gen = true, | |
| 21525 | }); | |
| 21526 | const attributes = Attributes{}; | |
| 21527 | }; | |
| 21528 | ||
| 21529 | pub const __builtin_ve_vl_vcmpswsx_vvvl = struct { | |
| 21530 | const param_str = "V256dV256dV256dUi"; | |
| 21531 | const target_set = TargetSet.init(.{ | |
| 21532 | .vevl_gen = true, | |
| 21533 | }); | |
| 21534 | const attributes = Attributes{}; | |
| 21535 | }; | |
| 21536 | ||
| 21537 | pub const __builtin_ve_vl_vcmpswsx_vvvmvl = struct { | |
| 21538 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21539 | const target_set = TargetSet.init(.{ | |
| 21540 | .vevl_gen = true, | |
| 21541 | }); | |
| 21542 | const attributes = Attributes{}; | |
| 21543 | }; | |
| 21544 | ||
| 21545 | pub const __builtin_ve_vl_vcmpswsx_vvvvl = struct { | |
| 21546 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21547 | const target_set = TargetSet.init(.{ | |
| 21548 | .vevl_gen = true, | |
| 21549 | }); | |
| 21550 | const attributes = Attributes{}; | |
| 21551 | }; | |
| 21552 | ||
| 21553 | pub const __builtin_ve_vl_vcmpswzx_vsvl = struct { | |
| 21554 | const param_str = "V256diV256dUi"; | |
| 21555 | const target_set = TargetSet.init(.{ | |
| 21556 | .vevl_gen = true, | |
| 21557 | }); | |
| 21558 | const attributes = Attributes{}; | |
| 21559 | }; | |
| 21560 | ||
| 21561 | pub const __builtin_ve_vl_vcmpswzx_vsvmvl = struct { | |
| 21562 | const param_str = "V256diV256dV256bV256dUi"; | |
| 21563 | const target_set = TargetSet.init(.{ | |
| 21564 | .vevl_gen = true, | |
| 21565 | }); | |
| 21566 | const attributes = Attributes{}; | |
| 21567 | }; | |
| 21568 | ||
| 21569 | pub const __builtin_ve_vl_vcmpswzx_vsvvl = struct { | |
| 21570 | const param_str = "V256diV256dV256dUi"; | |
| 21571 | const target_set = TargetSet.init(.{ | |
| 21572 | .vevl_gen = true, | |
| 21573 | }); | |
| 21574 | const attributes = Attributes{}; | |
| 21575 | }; | |
| 21576 | ||
| 21577 | pub const __builtin_ve_vl_vcmpswzx_vvvl = struct { | |
| 21578 | const param_str = "V256dV256dV256dUi"; | |
| 21579 | const target_set = TargetSet.init(.{ | |
| 21580 | .vevl_gen = true, | |
| 21581 | }); | |
| 21582 | const attributes = Attributes{}; | |
| 21583 | }; | |
| 21584 | ||
| 21585 | pub const __builtin_ve_vl_vcmpswzx_vvvmvl = struct { | |
| 21586 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21587 | const target_set = TargetSet.init(.{ | |
| 21588 | .vevl_gen = true, | |
| 21589 | }); | |
| 21590 | const attributes = Attributes{}; | |
| 21591 | }; | |
| 21592 | ||
| 21593 | pub const __builtin_ve_vl_vcmpswzx_vvvvl = struct { | |
| 21594 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21595 | const target_set = TargetSet.init(.{ | |
| 21596 | .vevl_gen = true, | |
| 21597 | }); | |
| 21598 | const attributes = Attributes{}; | |
| 21599 | }; | |
| 21600 | ||
| 21601 | pub const __builtin_ve_vl_vcmpul_vsvl = struct { | |
| 21602 | const param_str = "V256dLUiV256dUi"; | |
| 21603 | const target_set = TargetSet.init(.{ | |
| 21604 | .vevl_gen = true, | |
| 21605 | }); | |
| 21606 | const attributes = Attributes{}; | |
| 21607 | }; | |
| 21608 | ||
| 21609 | pub const __builtin_ve_vl_vcmpul_vsvmvl = struct { | |
| 21610 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 21611 | const target_set = TargetSet.init(.{ | |
| 21612 | .vevl_gen = true, | |
| 21613 | }); | |
| 21614 | const attributes = Attributes{}; | |
| 21615 | }; | |
| 21616 | ||
| 21617 | pub const __builtin_ve_vl_vcmpul_vsvvl = struct { | |
| 21618 | const param_str = "V256dLUiV256dV256dUi"; | |
| 21619 | const target_set = TargetSet.init(.{ | |
| 21620 | .vevl_gen = true, | |
| 21621 | }); | |
| 21622 | const attributes = Attributes{}; | |
| 21623 | }; | |
| 21624 | ||
| 21625 | pub const __builtin_ve_vl_vcmpul_vvvl = struct { | |
| 21626 | const param_str = "V256dV256dV256dUi"; | |
| 21627 | const target_set = TargetSet.init(.{ | |
| 21628 | .vevl_gen = true, | |
| 21629 | }); | |
| 21630 | const attributes = Attributes{}; | |
| 21631 | }; | |
| 21632 | ||
| 21633 | pub const __builtin_ve_vl_vcmpul_vvvmvl = struct { | |
| 21634 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21635 | const target_set = TargetSet.init(.{ | |
| 21636 | .vevl_gen = true, | |
| 21637 | }); | |
| 21638 | const attributes = Attributes{}; | |
| 21639 | }; | |
| 21640 | ||
| 21641 | pub const __builtin_ve_vl_vcmpul_vvvvl = struct { | |
| 21642 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21643 | const target_set = TargetSet.init(.{ | |
| 21644 | .vevl_gen = true, | |
| 21645 | }); | |
| 21646 | const attributes = Attributes{}; | |
| 21647 | }; | |
| 21648 | ||
| 21649 | pub const __builtin_ve_vl_vcmpuw_vsvl = struct { | |
| 21650 | const param_str = "V256dUiV256dUi"; | |
| 21651 | const target_set = TargetSet.init(.{ | |
| 21652 | .vevl_gen = true, | |
| 21653 | }); | |
| 21654 | const attributes = Attributes{}; | |
| 21655 | }; | |
| 21656 | ||
| 21657 | pub const __builtin_ve_vl_vcmpuw_vsvmvl = struct { | |
| 21658 | const param_str = "V256dUiV256dV256bV256dUi"; | |
| 21659 | const target_set = TargetSet.init(.{ | |
| 21660 | .vevl_gen = true, | |
| 21661 | }); | |
| 21662 | const attributes = Attributes{}; | |
| 21663 | }; | |
| 21664 | ||
| 21665 | pub const __builtin_ve_vl_vcmpuw_vsvvl = struct { | |
| 21666 | const param_str = "V256dUiV256dV256dUi"; | |
| 21667 | const target_set = TargetSet.init(.{ | |
| 21668 | .vevl_gen = true, | |
| 21669 | }); | |
| 21670 | const attributes = Attributes{}; | |
| 21671 | }; | |
| 21672 | ||
| 21673 | pub const __builtin_ve_vl_vcmpuw_vvvl = struct { | |
| 21674 | const param_str = "V256dV256dV256dUi"; | |
| 21675 | const target_set = TargetSet.init(.{ | |
| 21676 | .vevl_gen = true, | |
| 21677 | }); | |
| 21678 | const attributes = Attributes{}; | |
| 21679 | }; | |
| 21680 | ||
| 21681 | pub const __builtin_ve_vl_vcmpuw_vvvmvl = struct { | |
| 21682 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 21683 | const target_set = TargetSet.init(.{ | |
| 21684 | .vevl_gen = true, | |
| 21685 | }); | |
| 21686 | const attributes = Attributes{}; | |
| 21687 | }; | |
| 21688 | ||
| 21689 | pub const __builtin_ve_vl_vcmpuw_vvvvl = struct { | |
| 21690 | const param_str = "V256dV256dV256dV256dUi"; | |
| 21691 | const target_set = TargetSet.init(.{ | |
| 21692 | .vevl_gen = true, | |
| 21693 | }); | |
| 21694 | const attributes = Attributes{}; | |
| 21695 | }; | |
| 21696 | ||
| 21697 | pub const __builtin_ve_vl_vcp_vvmvl = struct { | |
| 21698 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21699 | const target_set = TargetSet.init(.{ | |
| 21700 | .vevl_gen = true, | |
| 21701 | }); | |
| 21702 | const attributes = Attributes{}; | |
| 21703 | }; | |
| 21704 | ||
| 21705 | pub const __builtin_ve_vl_vcvtdl_vvl = struct { | |
| 21706 | const param_str = "V256dV256dUi"; | |
| 21707 | const target_set = TargetSet.init(.{ | |
| 21708 | .vevl_gen = true, | |
| 21709 | }); | |
| 21710 | const attributes = Attributes{}; | |
| 21711 | }; | |
| 21712 | ||
| 21713 | pub const __builtin_ve_vl_vcvtdl_vvvl = struct { | |
| 21714 | const param_str = "V256dV256dV256dUi"; | |
| 21715 | const target_set = TargetSet.init(.{ | |
| 21716 | .vevl_gen = true, | |
| 21717 | }); | |
| 21718 | const attributes = Attributes{}; | |
| 21719 | }; | |
| 21720 | ||
| 21721 | pub const __builtin_ve_vl_vcvtds_vvl = struct { | |
| 21722 | const param_str = "V256dV256dUi"; | |
| 21723 | const target_set = TargetSet.init(.{ | |
| 21724 | .vevl_gen = true, | |
| 21725 | }); | |
| 21726 | const attributes = Attributes{}; | |
| 21727 | }; | |
| 21728 | ||
| 21729 | pub const __builtin_ve_vl_vcvtds_vvvl = struct { | |
| 21730 | const param_str = "V256dV256dV256dUi"; | |
| 21731 | const target_set = TargetSet.init(.{ | |
| 21732 | .vevl_gen = true, | |
| 21733 | }); | |
| 21734 | const attributes = Attributes{}; | |
| 21735 | }; | |
| 21736 | ||
| 21737 | pub const __builtin_ve_vl_vcvtdw_vvl = struct { | |
| 21738 | const param_str = "V256dV256dUi"; | |
| 21739 | const target_set = TargetSet.init(.{ | |
| 21740 | .vevl_gen = true, | |
| 21741 | }); | |
| 21742 | const attributes = Attributes{}; | |
| 21743 | }; | |
| 21744 | ||
| 21745 | pub const __builtin_ve_vl_vcvtdw_vvvl = struct { | |
| 21746 | const param_str = "V256dV256dV256dUi"; | |
| 21747 | const target_set = TargetSet.init(.{ | |
| 21748 | .vevl_gen = true, | |
| 21749 | }); | |
| 21750 | const attributes = Attributes{}; | |
| 21751 | }; | |
| 21752 | ||
| 21753 | pub const __builtin_ve_vl_vcvtld_vvl = struct { | |
| 21754 | const param_str = "V256dV256dUi"; | |
| 21755 | const target_set = TargetSet.init(.{ | |
| 21756 | .vevl_gen = true, | |
| 21757 | }); | |
| 21758 | const attributes = Attributes{}; | |
| 21759 | }; | |
| 21760 | ||
| 21761 | pub const __builtin_ve_vl_vcvtld_vvmvl = struct { | |
| 21762 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21763 | const target_set = TargetSet.init(.{ | |
| 21764 | .vevl_gen = true, | |
| 21765 | }); | |
| 21766 | const attributes = Attributes{}; | |
| 21767 | }; | |
| 21768 | ||
| 21769 | pub const __builtin_ve_vl_vcvtld_vvvl = struct { | |
| 21770 | const param_str = "V256dV256dV256dUi"; | |
| 21771 | const target_set = TargetSet.init(.{ | |
| 21772 | .vevl_gen = true, | |
| 21773 | }); | |
| 21774 | const attributes = Attributes{}; | |
| 21775 | }; | |
| 21776 | ||
| 21777 | pub const __builtin_ve_vl_vcvtldrz_vvl = struct { | |
| 21778 | const param_str = "V256dV256dUi"; | |
| 21779 | const target_set = TargetSet.init(.{ | |
| 21780 | .vevl_gen = true, | |
| 21781 | }); | |
| 21782 | const attributes = Attributes{}; | |
| 21783 | }; | |
| 21784 | ||
| 21785 | pub const __builtin_ve_vl_vcvtldrz_vvmvl = struct { | |
| 21786 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21787 | const target_set = TargetSet.init(.{ | |
| 21788 | .vevl_gen = true, | |
| 21789 | }); | |
| 21790 | const attributes = Attributes{}; | |
| 21791 | }; | |
| 21792 | ||
| 21793 | pub const __builtin_ve_vl_vcvtldrz_vvvl = struct { | |
| 21794 | const param_str = "V256dV256dV256dUi"; | |
| 21795 | const target_set = TargetSet.init(.{ | |
| 21796 | .vevl_gen = true, | |
| 21797 | }); | |
| 21798 | const attributes = Attributes{}; | |
| 21799 | }; | |
| 21800 | ||
| 21801 | pub const __builtin_ve_vl_vcvtsd_vvl = struct { | |
| 21802 | const param_str = "V256dV256dUi"; | |
| 21803 | const target_set = TargetSet.init(.{ | |
| 21804 | .vevl_gen = true, | |
| 21805 | }); | |
| 21806 | const attributes = Attributes{}; | |
| 21807 | }; | |
| 21808 | ||
| 21809 | pub const __builtin_ve_vl_vcvtsd_vvvl = struct { | |
| 21810 | const param_str = "V256dV256dV256dUi"; | |
| 21811 | const target_set = TargetSet.init(.{ | |
| 21812 | .vevl_gen = true, | |
| 21813 | }); | |
| 21814 | const attributes = Attributes{}; | |
| 21815 | }; | |
| 21816 | ||
| 21817 | pub const __builtin_ve_vl_vcvtsw_vvl = struct { | |
| 21818 | const param_str = "V256dV256dUi"; | |
| 21819 | const target_set = TargetSet.init(.{ | |
| 21820 | .vevl_gen = true, | |
| 21821 | }); | |
| 21822 | const attributes = Attributes{}; | |
| 21823 | }; | |
| 21824 | ||
| 21825 | pub const __builtin_ve_vl_vcvtsw_vvvl = struct { | |
| 21826 | const param_str = "V256dV256dV256dUi"; | |
| 21827 | const target_set = TargetSet.init(.{ | |
| 21828 | .vevl_gen = true, | |
| 21829 | }); | |
| 21830 | const attributes = Attributes{}; | |
| 21831 | }; | |
| 21832 | ||
| 21833 | pub const __builtin_ve_vl_vcvtwdsx_vvl = struct { | |
| 21834 | const param_str = "V256dV256dUi"; | |
| 21835 | const target_set = TargetSet.init(.{ | |
| 21836 | .vevl_gen = true, | |
| 21837 | }); | |
| 21838 | const attributes = Attributes{}; | |
| 21839 | }; | |
| 21840 | ||
| 21841 | pub const __builtin_ve_vl_vcvtwdsx_vvmvl = struct { | |
| 21842 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21843 | const target_set = TargetSet.init(.{ | |
| 21844 | .vevl_gen = true, | |
| 21845 | }); | |
| 21846 | const attributes = Attributes{}; | |
| 21847 | }; | |
| 21848 | ||
| 21849 | pub const __builtin_ve_vl_vcvtwdsx_vvvl = struct { | |
| 21850 | const param_str = "V256dV256dV256dUi"; | |
| 21851 | const target_set = TargetSet.init(.{ | |
| 21852 | .vevl_gen = true, | |
| 21853 | }); | |
| 21854 | const attributes = Attributes{}; | |
| 21855 | }; | |
| 21856 | ||
| 21857 | pub const __builtin_ve_vl_vcvtwdsxrz_vvl = struct { | |
| 21858 | const param_str = "V256dV256dUi"; | |
| 21859 | const target_set = TargetSet.init(.{ | |
| 21860 | .vevl_gen = true, | |
| 21861 | }); | |
| 21862 | const attributes = Attributes{}; | |
| 21863 | }; | |
| 21864 | ||
| 21865 | pub const __builtin_ve_vl_vcvtwdsxrz_vvmvl = struct { | |
| 21866 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21867 | const target_set = TargetSet.init(.{ | |
| 21868 | .vevl_gen = true, | |
| 21869 | }); | |
| 21870 | const attributes = Attributes{}; | |
| 21871 | }; | |
| 21872 | ||
| 21873 | pub const __builtin_ve_vl_vcvtwdsxrz_vvvl = struct { | |
| 21874 | const param_str = "V256dV256dV256dUi"; | |
| 21875 | const target_set = TargetSet.init(.{ | |
| 21876 | .vevl_gen = true, | |
| 21877 | }); | |
| 21878 | const attributes = Attributes{}; | |
| 21879 | }; | |
| 21880 | ||
| 21881 | pub const __builtin_ve_vl_vcvtwdzx_vvl = struct { | |
| 21882 | const param_str = "V256dV256dUi"; | |
| 21883 | const target_set = TargetSet.init(.{ | |
| 21884 | .vevl_gen = true, | |
| 21885 | }); | |
| 21886 | const attributes = Attributes{}; | |
| 21887 | }; | |
| 21888 | ||
| 21889 | pub const __builtin_ve_vl_vcvtwdzx_vvmvl = struct { | |
| 21890 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21891 | const target_set = TargetSet.init(.{ | |
| 21892 | .vevl_gen = true, | |
| 21893 | }); | |
| 21894 | const attributes = Attributes{}; | |
| 21895 | }; | |
| 21896 | ||
| 21897 | pub const __builtin_ve_vl_vcvtwdzx_vvvl = struct { | |
| 21898 | const param_str = "V256dV256dV256dUi"; | |
| 21899 | const target_set = TargetSet.init(.{ | |
| 21900 | .vevl_gen = true, | |
| 21901 | }); | |
| 21902 | const attributes = Attributes{}; | |
| 21903 | }; | |
| 21904 | ||
| 21905 | pub const __builtin_ve_vl_vcvtwdzxrz_vvl = struct { | |
| 21906 | const param_str = "V256dV256dUi"; | |
| 21907 | const target_set = TargetSet.init(.{ | |
| 21908 | .vevl_gen = true, | |
| 21909 | }); | |
| 21910 | const attributes = Attributes{}; | |
| 21911 | }; | |
| 21912 | ||
| 21913 | pub const __builtin_ve_vl_vcvtwdzxrz_vvmvl = struct { | |
| 21914 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21915 | const target_set = TargetSet.init(.{ | |
| 21916 | .vevl_gen = true, | |
| 21917 | }); | |
| 21918 | const attributes = Attributes{}; | |
| 21919 | }; | |
| 21920 | ||
| 21921 | pub const __builtin_ve_vl_vcvtwdzxrz_vvvl = struct { | |
| 21922 | const param_str = "V256dV256dV256dUi"; | |
| 21923 | const target_set = TargetSet.init(.{ | |
| 21924 | .vevl_gen = true, | |
| 21925 | }); | |
| 21926 | const attributes = Attributes{}; | |
| 21927 | }; | |
| 21928 | ||
| 21929 | pub const __builtin_ve_vl_vcvtwssx_vvl = struct { | |
| 21930 | const param_str = "V256dV256dUi"; | |
| 21931 | const target_set = TargetSet.init(.{ | |
| 21932 | .vevl_gen = true, | |
| 21933 | }); | |
| 21934 | const attributes = Attributes{}; | |
| 21935 | }; | |
| 21936 | ||
| 21937 | pub const __builtin_ve_vl_vcvtwssx_vvmvl = struct { | |
| 21938 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21939 | const target_set = TargetSet.init(.{ | |
| 21940 | .vevl_gen = true, | |
| 21941 | }); | |
| 21942 | const attributes = Attributes{}; | |
| 21943 | }; | |
| 21944 | ||
| 21945 | pub const __builtin_ve_vl_vcvtwssx_vvvl = struct { | |
| 21946 | const param_str = "V256dV256dV256dUi"; | |
| 21947 | const target_set = TargetSet.init(.{ | |
| 21948 | .vevl_gen = true, | |
| 21949 | }); | |
| 21950 | const attributes = Attributes{}; | |
| 21951 | }; | |
| 21952 | ||
| 21953 | pub const __builtin_ve_vl_vcvtwssxrz_vvl = struct { | |
| 21954 | const param_str = "V256dV256dUi"; | |
| 21955 | const target_set = TargetSet.init(.{ | |
| 21956 | .vevl_gen = true, | |
| 21957 | }); | |
| 21958 | const attributes = Attributes{}; | |
| 21959 | }; | |
| 21960 | ||
| 21961 | pub const __builtin_ve_vl_vcvtwssxrz_vvmvl = struct { | |
| 21962 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21963 | const target_set = TargetSet.init(.{ | |
| 21964 | .vevl_gen = true, | |
| 21965 | }); | |
| 21966 | const attributes = Attributes{}; | |
| 21967 | }; | |
| 21968 | ||
| 21969 | pub const __builtin_ve_vl_vcvtwssxrz_vvvl = struct { | |
| 21970 | const param_str = "V256dV256dV256dUi"; | |
| 21971 | const target_set = TargetSet.init(.{ | |
| 21972 | .vevl_gen = true, | |
| 21973 | }); | |
| 21974 | const attributes = Attributes{}; | |
| 21975 | }; | |
| 21976 | ||
| 21977 | pub const __builtin_ve_vl_vcvtwszx_vvl = struct { | |
| 21978 | const param_str = "V256dV256dUi"; | |
| 21979 | const target_set = TargetSet.init(.{ | |
| 21980 | .vevl_gen = true, | |
| 21981 | }); | |
| 21982 | const attributes = Attributes{}; | |
| 21983 | }; | |
| 21984 | ||
| 21985 | pub const __builtin_ve_vl_vcvtwszx_vvmvl = struct { | |
| 21986 | const param_str = "V256dV256dV256bV256dUi"; | |
| 21987 | const target_set = TargetSet.init(.{ | |
| 21988 | .vevl_gen = true, | |
| 21989 | }); | |
| 21990 | const attributes = Attributes{}; | |
| 21991 | }; | |
| 21992 | ||
| 21993 | pub const __builtin_ve_vl_vcvtwszx_vvvl = struct { | |
| 21994 | const param_str = "V256dV256dV256dUi"; | |
| 21995 | const target_set = TargetSet.init(.{ | |
| 21996 | .vevl_gen = true, | |
| 21997 | }); | |
| 21998 | const attributes = Attributes{}; | |
| 21999 | }; | |
| 22000 | ||
| 22001 | pub const __builtin_ve_vl_vcvtwszxrz_vvl = struct { | |
| 22002 | const param_str = "V256dV256dUi"; | |
| 22003 | const target_set = TargetSet.init(.{ | |
| 22004 | .vevl_gen = true, | |
| 22005 | }); | |
| 22006 | const attributes = Attributes{}; | |
| 22007 | }; | |
| 22008 | ||
| 22009 | pub const __builtin_ve_vl_vcvtwszxrz_vvmvl = struct { | |
| 22010 | const param_str = "V256dV256dV256bV256dUi"; | |
| 22011 | const target_set = TargetSet.init(.{ | |
| 22012 | .vevl_gen = true, | |
| 22013 | }); | |
| 22014 | const attributes = Attributes{}; | |
| 22015 | }; | |
| 22016 | ||
| 22017 | pub const __builtin_ve_vl_vcvtwszxrz_vvvl = struct { | |
| 22018 | const param_str = "V256dV256dV256dUi"; | |
| 22019 | const target_set = TargetSet.init(.{ | |
| 22020 | .vevl_gen = true, | |
| 22021 | }); | |
| 22022 | const attributes = Attributes{}; | |
| 22023 | }; | |
| 22024 | ||
| 22025 | pub const __builtin_ve_vl_vdivsl_vsvl = struct { | |
| 22026 | const param_str = "V256dLiV256dUi"; | |
| 22027 | const target_set = TargetSet.init(.{ | |
| 22028 | .vevl_gen = true, | |
| 22029 | }); | |
| 22030 | const attributes = Attributes{}; | |
| 22031 | }; | |
| 22032 | ||
| 22033 | pub const __builtin_ve_vl_vdivsl_vsvmvl = struct { | |
| 22034 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 22035 | const target_set = TargetSet.init(.{ | |
| 22036 | .vevl_gen = true, | |
| 22037 | }); | |
| 22038 | const attributes = Attributes{}; | |
| 22039 | }; | |
| 22040 | ||
| 22041 | pub const __builtin_ve_vl_vdivsl_vsvvl = struct { | |
| 22042 | const param_str = "V256dLiV256dV256dUi"; | |
| 22043 | const target_set = TargetSet.init(.{ | |
| 22044 | .vevl_gen = true, | |
| 22045 | }); | |
| 22046 | const attributes = Attributes{}; | |
| 22047 | }; | |
| 22048 | ||
| 22049 | pub const __builtin_ve_vl_vdivsl_vvsl = struct { | |
| 22050 | const param_str = "V256dV256dLiUi"; | |
| 22051 | const target_set = TargetSet.init(.{ | |
| 22052 | .vevl_gen = true, | |
| 22053 | }); | |
| 22054 | const attributes = Attributes{}; | |
| 22055 | }; | |
| 22056 | ||
| 22057 | pub const __builtin_ve_vl_vdivsl_vvsmvl = struct { | |
| 22058 | const param_str = "V256dV256dLiV256bV256dUi"; | |
| 22059 | const target_set = TargetSet.init(.{ | |
| 22060 | .vevl_gen = true, | |
| 22061 | }); | |
| 22062 | const attributes = Attributes{}; | |
| 22063 | }; | |
| 22064 | ||
| 22065 | pub const __builtin_ve_vl_vdivsl_vvsvl = struct { | |
| 22066 | const param_str = "V256dV256dLiV256dUi"; | |
| 22067 | const target_set = TargetSet.init(.{ | |
| 22068 | .vevl_gen = true, | |
| 22069 | }); | |
| 22070 | const attributes = Attributes{}; | |
| 22071 | }; | |
| 22072 | ||
| 22073 | pub const __builtin_ve_vl_vdivsl_vvvl = struct { | |
| 22074 | const param_str = "V256dV256dV256dUi"; | |
| 22075 | const target_set = TargetSet.init(.{ | |
| 22076 | .vevl_gen = true, | |
| 22077 | }); | |
| 22078 | const attributes = Attributes{}; | |
| 22079 | }; | |
| 22080 | ||
| 22081 | pub const __builtin_ve_vl_vdivsl_vvvmvl = struct { | |
| 22082 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22083 | const target_set = TargetSet.init(.{ | |
| 22084 | .vevl_gen = true, | |
| 22085 | }); | |
| 22086 | const attributes = Attributes{}; | |
| 22087 | }; | |
| 22088 | ||
| 22089 | pub const __builtin_ve_vl_vdivsl_vvvvl = struct { | |
| 22090 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22091 | const target_set = TargetSet.init(.{ | |
| 22092 | .vevl_gen = true, | |
| 22093 | }); | |
| 22094 | const attributes = Attributes{}; | |
| 22095 | }; | |
| 22096 | ||
| 22097 | pub const __builtin_ve_vl_vdivswsx_vsvl = struct { | |
| 22098 | const param_str = "V256diV256dUi"; | |
| 22099 | const target_set = TargetSet.init(.{ | |
| 22100 | .vevl_gen = true, | |
| 22101 | }); | |
| 22102 | const attributes = Attributes{}; | |
| 22103 | }; | |
| 22104 | ||
| 22105 | pub const __builtin_ve_vl_vdivswsx_vsvmvl = struct { | |
| 22106 | const param_str = "V256diV256dV256bV256dUi"; | |
| 22107 | const target_set = TargetSet.init(.{ | |
| 22108 | .vevl_gen = true, | |
| 22109 | }); | |
| 22110 | const attributes = Attributes{}; | |
| 22111 | }; | |
| 22112 | ||
| 22113 | pub const __builtin_ve_vl_vdivswsx_vsvvl = struct { | |
| 22114 | const param_str = "V256diV256dV256dUi"; | |
| 22115 | const target_set = TargetSet.init(.{ | |
| 22116 | .vevl_gen = true, | |
| 22117 | }); | |
| 22118 | const attributes = Attributes{}; | |
| 22119 | }; | |
| 22120 | ||
| 22121 | pub const __builtin_ve_vl_vdivswsx_vvsl = struct { | |
| 22122 | const param_str = "V256dV256diUi"; | |
| 22123 | const target_set = TargetSet.init(.{ | |
| 22124 | .vevl_gen = true, | |
| 22125 | }); | |
| 22126 | const attributes = Attributes{}; | |
| 22127 | }; | |
| 22128 | ||
| 22129 | pub const __builtin_ve_vl_vdivswsx_vvsmvl = struct { | |
| 22130 | const param_str = "V256dV256diV256bV256dUi"; | |
| 22131 | const target_set = TargetSet.init(.{ | |
| 22132 | .vevl_gen = true, | |
| 22133 | }); | |
| 22134 | const attributes = Attributes{}; | |
| 22135 | }; | |
| 22136 | ||
| 22137 | pub const __builtin_ve_vl_vdivswsx_vvsvl = struct { | |
| 22138 | const param_str = "V256dV256diV256dUi"; | |
| 22139 | const target_set = TargetSet.init(.{ | |
| 22140 | .vevl_gen = true, | |
| 22141 | }); | |
| 22142 | const attributes = Attributes{}; | |
| 22143 | }; | |
| 22144 | ||
| 22145 | pub const __builtin_ve_vl_vdivswsx_vvvl = struct { | |
| 22146 | const param_str = "V256dV256dV256dUi"; | |
| 22147 | const target_set = TargetSet.init(.{ | |
| 22148 | .vevl_gen = true, | |
| 22149 | }); | |
| 22150 | const attributes = Attributes{}; | |
| 22151 | }; | |
| 22152 | ||
| 22153 | pub const __builtin_ve_vl_vdivswsx_vvvmvl = struct { | |
| 22154 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22155 | const target_set = TargetSet.init(.{ | |
| 22156 | .vevl_gen = true, | |
| 22157 | }); | |
| 22158 | const attributes = Attributes{}; | |
| 22159 | }; | |
| 22160 | ||
| 22161 | pub const __builtin_ve_vl_vdivswsx_vvvvl = struct { | |
| 22162 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22163 | const target_set = TargetSet.init(.{ | |
| 22164 | .vevl_gen = true, | |
| 22165 | }); | |
| 22166 | const attributes = Attributes{}; | |
| 22167 | }; | |
| 22168 | ||
| 22169 | pub const __builtin_ve_vl_vdivswzx_vsvl = struct { | |
| 22170 | const param_str = "V256diV256dUi"; | |
| 22171 | const target_set = TargetSet.init(.{ | |
| 22172 | .vevl_gen = true, | |
| 22173 | }); | |
| 22174 | const attributes = Attributes{}; | |
| 22175 | }; | |
| 22176 | ||
| 22177 | pub const __builtin_ve_vl_vdivswzx_vsvmvl = struct { | |
| 22178 | const param_str = "V256diV256dV256bV256dUi"; | |
| 22179 | const target_set = TargetSet.init(.{ | |
| 22180 | .vevl_gen = true, | |
| 22181 | }); | |
| 22182 | const attributes = Attributes{}; | |
| 22183 | }; | |
| 22184 | ||
| 22185 | pub const __builtin_ve_vl_vdivswzx_vsvvl = struct { | |
| 22186 | const param_str = "V256diV256dV256dUi"; | |
| 22187 | const target_set = TargetSet.init(.{ | |
| 22188 | .vevl_gen = true, | |
| 22189 | }); | |
| 22190 | const attributes = Attributes{}; | |
| 22191 | }; | |
| 22192 | ||
| 22193 | pub const __builtin_ve_vl_vdivswzx_vvsl = struct { | |
| 22194 | const param_str = "V256dV256diUi"; | |
| 22195 | const target_set = TargetSet.init(.{ | |
| 22196 | .vevl_gen = true, | |
| 22197 | }); | |
| 22198 | const attributes = Attributes{}; | |
| 22199 | }; | |
| 22200 | ||
| 22201 | pub const __builtin_ve_vl_vdivswzx_vvsmvl = struct { | |
| 22202 | const param_str = "V256dV256diV256bV256dUi"; | |
| 22203 | const target_set = TargetSet.init(.{ | |
| 22204 | .vevl_gen = true, | |
| 22205 | }); | |
| 22206 | const attributes = Attributes{}; | |
| 22207 | }; | |
| 22208 | ||
| 22209 | pub const __builtin_ve_vl_vdivswzx_vvsvl = struct { | |
| 22210 | const param_str = "V256dV256diV256dUi"; | |
| 22211 | const target_set = TargetSet.init(.{ | |
| 22212 | .vevl_gen = true, | |
| 22213 | }); | |
| 22214 | const attributes = Attributes{}; | |
| 22215 | }; | |
| 22216 | ||
| 22217 | pub const __builtin_ve_vl_vdivswzx_vvvl = struct { | |
| 22218 | const param_str = "V256dV256dV256dUi"; | |
| 22219 | const target_set = TargetSet.init(.{ | |
| 22220 | .vevl_gen = true, | |
| 22221 | }); | |
| 22222 | const attributes = Attributes{}; | |
| 22223 | }; | |
| 22224 | ||
| 22225 | pub const __builtin_ve_vl_vdivswzx_vvvmvl = struct { | |
| 22226 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22227 | const target_set = TargetSet.init(.{ | |
| 22228 | .vevl_gen = true, | |
| 22229 | }); | |
| 22230 | const attributes = Attributes{}; | |
| 22231 | }; | |
| 22232 | ||
| 22233 | pub const __builtin_ve_vl_vdivswzx_vvvvl = struct { | |
| 22234 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22235 | const target_set = TargetSet.init(.{ | |
| 22236 | .vevl_gen = true, | |
| 22237 | }); | |
| 22238 | const attributes = Attributes{}; | |
| 22239 | }; | |
| 22240 | ||
| 22241 | pub const __builtin_ve_vl_vdivul_vsvl = struct { | |
| 22242 | const param_str = "V256dLUiV256dUi"; | |
| 22243 | const target_set = TargetSet.init(.{ | |
| 22244 | .vevl_gen = true, | |
| 22245 | }); | |
| 22246 | const attributes = Attributes{}; | |
| 22247 | }; | |
| 22248 | ||
| 22249 | pub const __builtin_ve_vl_vdivul_vsvmvl = struct { | |
| 22250 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 22251 | const target_set = TargetSet.init(.{ | |
| 22252 | .vevl_gen = true, | |
| 22253 | }); | |
| 22254 | const attributes = Attributes{}; | |
| 22255 | }; | |
| 22256 | ||
| 22257 | pub const __builtin_ve_vl_vdivul_vsvvl = struct { | |
| 22258 | const param_str = "V256dLUiV256dV256dUi"; | |
| 22259 | const target_set = TargetSet.init(.{ | |
| 22260 | .vevl_gen = true, | |
| 22261 | }); | |
| 22262 | const attributes = Attributes{}; | |
| 22263 | }; | |
| 22264 | ||
| 22265 | pub const __builtin_ve_vl_vdivul_vvsl = struct { | |
| 22266 | const param_str = "V256dV256dLUiUi"; | |
| 22267 | const target_set = TargetSet.init(.{ | |
| 22268 | .vevl_gen = true, | |
| 22269 | }); | |
| 22270 | const attributes = Attributes{}; | |
| 22271 | }; | |
| 22272 | ||
| 22273 | pub const __builtin_ve_vl_vdivul_vvsmvl = struct { | |
| 22274 | const param_str = "V256dV256dLUiV256bV256dUi"; | |
| 22275 | const target_set = TargetSet.init(.{ | |
| 22276 | .vevl_gen = true, | |
| 22277 | }); | |
| 22278 | const attributes = Attributes{}; | |
| 22279 | }; | |
| 22280 | ||
| 22281 | pub const __builtin_ve_vl_vdivul_vvsvl = struct { | |
| 22282 | const param_str = "V256dV256dLUiV256dUi"; | |
| 22283 | const target_set = TargetSet.init(.{ | |
| 22284 | .vevl_gen = true, | |
| 22285 | }); | |
| 22286 | const attributes = Attributes{}; | |
| 22287 | }; | |
| 22288 | ||
| 22289 | pub const __builtin_ve_vl_vdivul_vvvl = struct { | |
| 22290 | const param_str = "V256dV256dV256dUi"; | |
| 22291 | const target_set = TargetSet.init(.{ | |
| 22292 | .vevl_gen = true, | |
| 22293 | }); | |
| 22294 | const attributes = Attributes{}; | |
| 22295 | }; | |
| 22296 | ||
| 22297 | pub const __builtin_ve_vl_vdivul_vvvmvl = struct { | |
| 22298 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22299 | const target_set = TargetSet.init(.{ | |
| 22300 | .vevl_gen = true, | |
| 22301 | }); | |
| 22302 | const attributes = Attributes{}; | |
| 22303 | }; | |
| 22304 | ||
| 22305 | pub const __builtin_ve_vl_vdivul_vvvvl = struct { | |
| 22306 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22307 | const target_set = TargetSet.init(.{ | |
| 22308 | .vevl_gen = true, | |
| 22309 | }); | |
| 22310 | const attributes = Attributes{}; | |
| 22311 | }; | |
| 22312 | ||
| 22313 | pub const __builtin_ve_vl_vdivuw_vsvl = struct { | |
| 22314 | const param_str = "V256dUiV256dUi"; | |
| 22315 | const target_set = TargetSet.init(.{ | |
| 22316 | .vevl_gen = true, | |
| 22317 | }); | |
| 22318 | const attributes = Attributes{}; | |
| 22319 | }; | |
| 22320 | ||
| 22321 | pub const __builtin_ve_vl_vdivuw_vsvmvl = struct { | |
| 22322 | const param_str = "V256dUiV256dV256bV256dUi"; | |
| 22323 | const target_set = TargetSet.init(.{ | |
| 22324 | .vevl_gen = true, | |
| 22325 | }); | |
| 22326 | const attributes = Attributes{}; | |
| 22327 | }; | |
| 22328 | ||
| 22329 | pub const __builtin_ve_vl_vdivuw_vsvvl = struct { | |
| 22330 | const param_str = "V256dUiV256dV256dUi"; | |
| 22331 | const target_set = TargetSet.init(.{ | |
| 22332 | .vevl_gen = true, | |
| 22333 | }); | |
| 22334 | const attributes = Attributes{}; | |
| 22335 | }; | |
| 22336 | ||
| 22337 | pub const __builtin_ve_vl_vdivuw_vvsl = struct { | |
| 22338 | const param_str = "V256dV256dUiUi"; | |
| 22339 | const target_set = TargetSet.init(.{ | |
| 22340 | .vevl_gen = true, | |
| 22341 | }); | |
| 22342 | const attributes = Attributes{}; | |
| 22343 | }; | |
| 22344 | ||
| 22345 | pub const __builtin_ve_vl_vdivuw_vvsmvl = struct { | |
| 22346 | const param_str = "V256dV256dUiV256bV256dUi"; | |
| 22347 | const target_set = TargetSet.init(.{ | |
| 22348 | .vevl_gen = true, | |
| 22349 | }); | |
| 22350 | const attributes = Attributes{}; | |
| 22351 | }; | |
| 22352 | ||
| 22353 | pub const __builtin_ve_vl_vdivuw_vvsvl = struct { | |
| 22354 | const param_str = "V256dV256dUiV256dUi"; | |
| 22355 | const target_set = TargetSet.init(.{ | |
| 22356 | .vevl_gen = true, | |
| 22357 | }); | |
| 22358 | const attributes = Attributes{}; | |
| 22359 | }; | |
| 22360 | ||
| 22361 | pub const __builtin_ve_vl_vdivuw_vvvl = struct { | |
| 22362 | const param_str = "V256dV256dV256dUi"; | |
| 22363 | const target_set = TargetSet.init(.{ | |
| 22364 | .vevl_gen = true, | |
| 22365 | }); | |
| 22366 | const attributes = Attributes{}; | |
| 22367 | }; | |
| 22368 | ||
| 22369 | pub const __builtin_ve_vl_vdivuw_vvvmvl = struct { | |
| 22370 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22371 | const target_set = TargetSet.init(.{ | |
| 22372 | .vevl_gen = true, | |
| 22373 | }); | |
| 22374 | const attributes = Attributes{}; | |
| 22375 | }; | |
| 22376 | ||
| 22377 | pub const __builtin_ve_vl_vdivuw_vvvvl = struct { | |
| 22378 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22379 | const target_set = TargetSet.init(.{ | |
| 22380 | .vevl_gen = true, | |
| 22381 | }); | |
| 22382 | const attributes = Attributes{}; | |
| 22383 | }; | |
| 22384 | ||
| 22385 | pub const __builtin_ve_vl_veqv_vsvl = struct { | |
| 22386 | const param_str = "V256dLUiV256dUi"; | |
| 22387 | const target_set = TargetSet.init(.{ | |
| 22388 | .vevl_gen = true, | |
| 22389 | }); | |
| 22390 | const attributes = Attributes{}; | |
| 22391 | }; | |
| 22392 | ||
| 22393 | pub const __builtin_ve_vl_veqv_vsvmvl = struct { | |
| 22394 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 22395 | const target_set = TargetSet.init(.{ | |
| 22396 | .vevl_gen = true, | |
| 22397 | }); | |
| 22398 | const attributes = Attributes{}; | |
| 22399 | }; | |
| 22400 | ||
| 22401 | pub const __builtin_ve_vl_veqv_vsvvl = struct { | |
| 22402 | const param_str = "V256dLUiV256dV256dUi"; | |
| 22403 | const target_set = TargetSet.init(.{ | |
| 22404 | .vevl_gen = true, | |
| 22405 | }); | |
| 22406 | const attributes = Attributes{}; | |
| 22407 | }; | |
| 22408 | ||
| 22409 | pub const __builtin_ve_vl_veqv_vvvl = struct { | |
| 22410 | const param_str = "V256dV256dV256dUi"; | |
| 22411 | const target_set = TargetSet.init(.{ | |
| 22412 | .vevl_gen = true, | |
| 22413 | }); | |
| 22414 | const attributes = Attributes{}; | |
| 22415 | }; | |
| 22416 | ||
| 22417 | pub const __builtin_ve_vl_veqv_vvvmvl = struct { | |
| 22418 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22419 | const target_set = TargetSet.init(.{ | |
| 22420 | .vevl_gen = true, | |
| 22421 | }); | |
| 22422 | const attributes = Attributes{}; | |
| 22423 | }; | |
| 22424 | ||
| 22425 | pub const __builtin_ve_vl_veqv_vvvvl = struct { | |
| 22426 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22427 | const target_set = TargetSet.init(.{ | |
| 22428 | .vevl_gen = true, | |
| 22429 | }); | |
| 22430 | const attributes = Attributes{}; | |
| 22431 | }; | |
| 22432 | ||
| 22433 | pub const __builtin_ve_vl_vex_vvmvl = struct { | |
| 22434 | const param_str = "V256dV256dV256bV256dUi"; | |
| 22435 | const target_set = TargetSet.init(.{ | |
| 22436 | .vevl_gen = true, | |
| 22437 | }); | |
| 22438 | const attributes = Attributes{}; | |
| 22439 | }; | |
| 22440 | ||
| 22441 | pub const __builtin_ve_vl_vfaddd_vsvl = struct { | |
| 22442 | const param_str = "V256ddV256dUi"; | |
| 22443 | const target_set = TargetSet.init(.{ | |
| 22444 | .vevl_gen = true, | |
| 22445 | }); | |
| 22446 | const attributes = Attributes{}; | |
| 22447 | }; | |
| 22448 | ||
| 22449 | pub const __builtin_ve_vl_vfaddd_vsvmvl = struct { | |
| 22450 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 22451 | const target_set = TargetSet.init(.{ | |
| 22452 | .vevl_gen = true, | |
| 22453 | }); | |
| 22454 | const attributes = Attributes{}; | |
| 22455 | }; | |
| 22456 | ||
| 22457 | pub const __builtin_ve_vl_vfaddd_vsvvl = struct { | |
| 22458 | const param_str = "V256ddV256dV256dUi"; | |
| 22459 | const target_set = TargetSet.init(.{ | |
| 22460 | .vevl_gen = true, | |
| 22461 | }); | |
| 22462 | const attributes = Attributes{}; | |
| 22463 | }; | |
| 22464 | ||
| 22465 | pub const __builtin_ve_vl_vfaddd_vvvl = struct { | |
| 22466 | const param_str = "V256dV256dV256dUi"; | |
| 22467 | const target_set = TargetSet.init(.{ | |
| 22468 | .vevl_gen = true, | |
| 22469 | }); | |
| 22470 | const attributes = Attributes{}; | |
| 22471 | }; | |
| 22472 | ||
| 22473 | pub const __builtin_ve_vl_vfaddd_vvvmvl = struct { | |
| 22474 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22475 | const target_set = TargetSet.init(.{ | |
| 22476 | .vevl_gen = true, | |
| 22477 | }); | |
| 22478 | const attributes = Attributes{}; | |
| 22479 | }; | |
| 22480 | ||
| 22481 | pub const __builtin_ve_vl_vfaddd_vvvvl = struct { | |
| 22482 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22483 | const target_set = TargetSet.init(.{ | |
| 22484 | .vevl_gen = true, | |
| 22485 | }); | |
| 22486 | const attributes = Attributes{}; | |
| 22487 | }; | |
| 22488 | ||
| 22489 | pub const __builtin_ve_vl_vfadds_vsvl = struct { | |
| 22490 | const param_str = "V256dfV256dUi"; | |
| 22491 | const target_set = TargetSet.init(.{ | |
| 22492 | .vevl_gen = true, | |
| 22493 | }); | |
| 22494 | const attributes = Attributes{}; | |
| 22495 | }; | |
| 22496 | ||
| 22497 | pub const __builtin_ve_vl_vfadds_vsvmvl = struct { | |
| 22498 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 22499 | const target_set = TargetSet.init(.{ | |
| 22500 | .vevl_gen = true, | |
| 22501 | }); | |
| 22502 | const attributes = Attributes{}; | |
| 22503 | }; | |
| 22504 | ||
| 22505 | pub const __builtin_ve_vl_vfadds_vsvvl = struct { | |
| 22506 | const param_str = "V256dfV256dV256dUi"; | |
| 22507 | const target_set = TargetSet.init(.{ | |
| 22508 | .vevl_gen = true, | |
| 22509 | }); | |
| 22510 | const attributes = Attributes{}; | |
| 22511 | }; | |
| 22512 | ||
| 22513 | pub const __builtin_ve_vl_vfadds_vvvl = struct { | |
| 22514 | const param_str = "V256dV256dV256dUi"; | |
| 22515 | const target_set = TargetSet.init(.{ | |
| 22516 | .vevl_gen = true, | |
| 22517 | }); | |
| 22518 | const attributes = Attributes{}; | |
| 22519 | }; | |
| 22520 | ||
| 22521 | pub const __builtin_ve_vl_vfadds_vvvmvl = struct { | |
| 22522 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22523 | const target_set = TargetSet.init(.{ | |
| 22524 | .vevl_gen = true, | |
| 22525 | }); | |
| 22526 | const attributes = Attributes{}; | |
| 22527 | }; | |
| 22528 | ||
| 22529 | pub const __builtin_ve_vl_vfadds_vvvvl = struct { | |
| 22530 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22531 | const target_set = TargetSet.init(.{ | |
| 22532 | .vevl_gen = true, | |
| 22533 | }); | |
| 22534 | const attributes = Attributes{}; | |
| 22535 | }; | |
| 22536 | ||
| 22537 | pub const __builtin_ve_vl_vfcmpd_vsvl = struct { | |
| 22538 | const param_str = "V256ddV256dUi"; | |
| 22539 | const target_set = TargetSet.init(.{ | |
| 22540 | .vevl_gen = true, | |
| 22541 | }); | |
| 22542 | const attributes = Attributes{}; | |
| 22543 | }; | |
| 22544 | ||
| 22545 | pub const __builtin_ve_vl_vfcmpd_vsvmvl = struct { | |
| 22546 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 22547 | const target_set = TargetSet.init(.{ | |
| 22548 | .vevl_gen = true, | |
| 22549 | }); | |
| 22550 | const attributes = Attributes{}; | |
| 22551 | }; | |
| 22552 | ||
| 22553 | pub const __builtin_ve_vl_vfcmpd_vsvvl = struct { | |
| 22554 | const param_str = "V256ddV256dV256dUi"; | |
| 22555 | const target_set = TargetSet.init(.{ | |
| 22556 | .vevl_gen = true, | |
| 22557 | }); | |
| 22558 | const attributes = Attributes{}; | |
| 22559 | }; | |
| 22560 | ||
| 22561 | pub const __builtin_ve_vl_vfcmpd_vvvl = struct { | |
| 22562 | const param_str = "V256dV256dV256dUi"; | |
| 22563 | const target_set = TargetSet.init(.{ | |
| 22564 | .vevl_gen = true, | |
| 22565 | }); | |
| 22566 | const attributes = Attributes{}; | |
| 22567 | }; | |
| 22568 | ||
| 22569 | pub const __builtin_ve_vl_vfcmpd_vvvmvl = struct { | |
| 22570 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22571 | const target_set = TargetSet.init(.{ | |
| 22572 | .vevl_gen = true, | |
| 22573 | }); | |
| 22574 | const attributes = Attributes{}; | |
| 22575 | }; | |
| 22576 | ||
| 22577 | pub const __builtin_ve_vl_vfcmpd_vvvvl = struct { | |
| 22578 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22579 | const target_set = TargetSet.init(.{ | |
| 22580 | .vevl_gen = true, | |
| 22581 | }); | |
| 22582 | const attributes = Attributes{}; | |
| 22583 | }; | |
| 22584 | ||
| 22585 | pub const __builtin_ve_vl_vfcmps_vsvl = struct { | |
| 22586 | const param_str = "V256dfV256dUi"; | |
| 22587 | const target_set = TargetSet.init(.{ | |
| 22588 | .vevl_gen = true, | |
| 22589 | }); | |
| 22590 | const attributes = Attributes{}; | |
| 22591 | }; | |
| 22592 | ||
| 22593 | pub const __builtin_ve_vl_vfcmps_vsvmvl = struct { | |
| 22594 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 22595 | const target_set = TargetSet.init(.{ | |
| 22596 | .vevl_gen = true, | |
| 22597 | }); | |
| 22598 | const attributes = Attributes{}; | |
| 22599 | }; | |
| 22600 | ||
| 22601 | pub const __builtin_ve_vl_vfcmps_vsvvl = struct { | |
| 22602 | const param_str = "V256dfV256dV256dUi"; | |
| 22603 | const target_set = TargetSet.init(.{ | |
| 22604 | .vevl_gen = true, | |
| 22605 | }); | |
| 22606 | const attributes = Attributes{}; | |
| 22607 | }; | |
| 22608 | ||
| 22609 | pub const __builtin_ve_vl_vfcmps_vvvl = struct { | |
| 22610 | const param_str = "V256dV256dV256dUi"; | |
| 22611 | const target_set = TargetSet.init(.{ | |
| 22612 | .vevl_gen = true, | |
| 22613 | }); | |
| 22614 | const attributes = Attributes{}; | |
| 22615 | }; | |
| 22616 | ||
| 22617 | pub const __builtin_ve_vl_vfcmps_vvvmvl = struct { | |
| 22618 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22619 | const target_set = TargetSet.init(.{ | |
| 22620 | .vevl_gen = true, | |
| 22621 | }); | |
| 22622 | const attributes = Attributes{}; | |
| 22623 | }; | |
| 22624 | ||
| 22625 | pub const __builtin_ve_vl_vfcmps_vvvvl = struct { | |
| 22626 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22627 | const target_set = TargetSet.init(.{ | |
| 22628 | .vevl_gen = true, | |
| 22629 | }); | |
| 22630 | const attributes = Attributes{}; | |
| 22631 | }; | |
| 22632 | ||
| 22633 | pub const __builtin_ve_vl_vfdivd_vsvl = struct { | |
| 22634 | const param_str = "V256ddV256dUi"; | |
| 22635 | const target_set = TargetSet.init(.{ | |
| 22636 | .vevl_gen = true, | |
| 22637 | }); | |
| 22638 | const attributes = Attributes{}; | |
| 22639 | }; | |
| 22640 | ||
| 22641 | pub const __builtin_ve_vl_vfdivd_vsvmvl = struct { | |
| 22642 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 22643 | const target_set = TargetSet.init(.{ | |
| 22644 | .vevl_gen = true, | |
| 22645 | }); | |
| 22646 | const attributes = Attributes{}; | |
| 22647 | }; | |
| 22648 | ||
| 22649 | pub const __builtin_ve_vl_vfdivd_vsvvl = struct { | |
| 22650 | const param_str = "V256ddV256dV256dUi"; | |
| 22651 | const target_set = TargetSet.init(.{ | |
| 22652 | .vevl_gen = true, | |
| 22653 | }); | |
| 22654 | const attributes = Attributes{}; | |
| 22655 | }; | |
| 22656 | ||
| 22657 | pub const __builtin_ve_vl_vfdivd_vvvl = struct { | |
| 22658 | const param_str = "V256dV256dV256dUi"; | |
| 22659 | const target_set = TargetSet.init(.{ | |
| 22660 | .vevl_gen = true, | |
| 22661 | }); | |
| 22662 | const attributes = Attributes{}; | |
| 22663 | }; | |
| 22664 | ||
| 22665 | pub const __builtin_ve_vl_vfdivd_vvvmvl = struct { | |
| 22666 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22667 | const target_set = TargetSet.init(.{ | |
| 22668 | .vevl_gen = true, | |
| 22669 | }); | |
| 22670 | const attributes = Attributes{}; | |
| 22671 | }; | |
| 22672 | ||
| 22673 | pub const __builtin_ve_vl_vfdivd_vvvvl = struct { | |
| 22674 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22675 | const target_set = TargetSet.init(.{ | |
| 22676 | .vevl_gen = true, | |
| 22677 | }); | |
| 22678 | const attributes = Attributes{}; | |
| 22679 | }; | |
| 22680 | ||
| 22681 | pub const __builtin_ve_vl_vfdivs_vsvl = struct { | |
| 22682 | const param_str = "V256dfV256dUi"; | |
| 22683 | const target_set = TargetSet.init(.{ | |
| 22684 | .vevl_gen = true, | |
| 22685 | }); | |
| 22686 | const attributes = Attributes{}; | |
| 22687 | }; | |
| 22688 | ||
| 22689 | pub const __builtin_ve_vl_vfdivs_vsvmvl = struct { | |
| 22690 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 22691 | const target_set = TargetSet.init(.{ | |
| 22692 | .vevl_gen = true, | |
| 22693 | }); | |
| 22694 | const attributes = Attributes{}; | |
| 22695 | }; | |
| 22696 | ||
| 22697 | pub const __builtin_ve_vl_vfdivs_vsvvl = struct { | |
| 22698 | const param_str = "V256dfV256dV256dUi"; | |
| 22699 | const target_set = TargetSet.init(.{ | |
| 22700 | .vevl_gen = true, | |
| 22701 | }); | |
| 22702 | const attributes = Attributes{}; | |
| 22703 | }; | |
| 22704 | ||
| 22705 | pub const __builtin_ve_vl_vfdivs_vvvl = struct { | |
| 22706 | const param_str = "V256dV256dV256dUi"; | |
| 22707 | const target_set = TargetSet.init(.{ | |
| 22708 | .vevl_gen = true, | |
| 22709 | }); | |
| 22710 | const attributes = Attributes{}; | |
| 22711 | }; | |
| 22712 | ||
| 22713 | pub const __builtin_ve_vl_vfdivs_vvvmvl = struct { | |
| 22714 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22715 | const target_set = TargetSet.init(.{ | |
| 22716 | .vevl_gen = true, | |
| 22717 | }); | |
| 22718 | const attributes = Attributes{}; | |
| 22719 | }; | |
| 22720 | ||
| 22721 | pub const __builtin_ve_vl_vfdivs_vvvvl = struct { | |
| 22722 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22723 | const target_set = TargetSet.init(.{ | |
| 22724 | .vevl_gen = true, | |
| 22725 | }); | |
| 22726 | const attributes = Attributes{}; | |
| 22727 | }; | |
| 22728 | ||
| 22729 | pub const __builtin_ve_vl_vfmadd_vsvvl = struct { | |
| 22730 | const param_str = "V256ddV256dV256dUi"; | |
| 22731 | const target_set = TargetSet.init(.{ | |
| 22732 | .vevl_gen = true, | |
| 22733 | }); | |
| 22734 | const attributes = Attributes{}; | |
| 22735 | }; | |
| 22736 | ||
| 22737 | pub const __builtin_ve_vl_vfmadd_vsvvmvl = struct { | |
| 22738 | const param_str = "V256ddV256dV256dV256bV256dUi"; | |
| 22739 | const target_set = TargetSet.init(.{ | |
| 22740 | .vevl_gen = true, | |
| 22741 | }); | |
| 22742 | const attributes = Attributes{}; | |
| 22743 | }; | |
| 22744 | ||
| 22745 | pub const __builtin_ve_vl_vfmadd_vsvvvl = struct { | |
| 22746 | const param_str = "V256ddV256dV256dV256dUi"; | |
| 22747 | const target_set = TargetSet.init(.{ | |
| 22748 | .vevl_gen = true, | |
| 22749 | }); | |
| 22750 | const attributes = Attributes{}; | |
| 22751 | }; | |
| 22752 | ||
| 22753 | pub const __builtin_ve_vl_vfmadd_vvsvl = struct { | |
| 22754 | const param_str = "V256dV256ddV256dUi"; | |
| 22755 | const target_set = TargetSet.init(.{ | |
| 22756 | .vevl_gen = true, | |
| 22757 | }); | |
| 22758 | const attributes = Attributes{}; | |
| 22759 | }; | |
| 22760 | ||
| 22761 | pub const __builtin_ve_vl_vfmadd_vvsvmvl = struct { | |
| 22762 | const param_str = "V256dV256ddV256dV256bV256dUi"; | |
| 22763 | const target_set = TargetSet.init(.{ | |
| 22764 | .vevl_gen = true, | |
| 22765 | }); | |
| 22766 | const attributes = Attributes{}; | |
| 22767 | }; | |
| 22768 | ||
| 22769 | pub const __builtin_ve_vl_vfmadd_vvsvvl = struct { | |
| 22770 | const param_str = "V256dV256ddV256dV256dUi"; | |
| 22771 | const target_set = TargetSet.init(.{ | |
| 22772 | .vevl_gen = true, | |
| 22773 | }); | |
| 22774 | const attributes = Attributes{}; | |
| 22775 | }; | |
| 22776 | ||
| 22777 | pub const __builtin_ve_vl_vfmadd_vvvvl = struct { | |
| 22778 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22779 | const target_set = TargetSet.init(.{ | |
| 22780 | .vevl_gen = true, | |
| 22781 | }); | |
| 22782 | const attributes = Attributes{}; | |
| 22783 | }; | |
| 22784 | ||
| 22785 | pub const __builtin_ve_vl_vfmadd_vvvvmvl = struct { | |
| 22786 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 22787 | const target_set = TargetSet.init(.{ | |
| 22788 | .vevl_gen = true, | |
| 22789 | }); | |
| 22790 | const attributes = Attributes{}; | |
| 22791 | }; | |
| 22792 | ||
| 22793 | pub const __builtin_ve_vl_vfmadd_vvvvvl = struct { | |
| 22794 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 22795 | const target_set = TargetSet.init(.{ | |
| 22796 | .vevl_gen = true, | |
| 22797 | }); | |
| 22798 | const attributes = Attributes{}; | |
| 22799 | }; | |
| 22800 | ||
| 22801 | pub const __builtin_ve_vl_vfmads_vsvvl = struct { | |
| 22802 | const param_str = "V256dfV256dV256dUi"; | |
| 22803 | const target_set = TargetSet.init(.{ | |
| 22804 | .vevl_gen = true, | |
| 22805 | }); | |
| 22806 | const attributes = Attributes{}; | |
| 22807 | }; | |
| 22808 | ||
| 22809 | pub const __builtin_ve_vl_vfmads_vsvvmvl = struct { | |
| 22810 | const param_str = "V256dfV256dV256dV256bV256dUi"; | |
| 22811 | const target_set = TargetSet.init(.{ | |
| 22812 | .vevl_gen = true, | |
| 22813 | }); | |
| 22814 | const attributes = Attributes{}; | |
| 22815 | }; | |
| 22816 | ||
| 22817 | pub const __builtin_ve_vl_vfmads_vsvvvl = struct { | |
| 22818 | const param_str = "V256dfV256dV256dV256dUi"; | |
| 22819 | const target_set = TargetSet.init(.{ | |
| 22820 | .vevl_gen = true, | |
| 22821 | }); | |
| 22822 | const attributes = Attributes{}; | |
| 22823 | }; | |
| 22824 | ||
| 22825 | pub const __builtin_ve_vl_vfmads_vvsvl = struct { | |
| 22826 | const param_str = "V256dV256dfV256dUi"; | |
| 22827 | const target_set = TargetSet.init(.{ | |
| 22828 | .vevl_gen = true, | |
| 22829 | }); | |
| 22830 | const attributes = Attributes{}; | |
| 22831 | }; | |
| 22832 | ||
| 22833 | pub const __builtin_ve_vl_vfmads_vvsvmvl = struct { | |
| 22834 | const param_str = "V256dV256dfV256dV256bV256dUi"; | |
| 22835 | const target_set = TargetSet.init(.{ | |
| 22836 | .vevl_gen = true, | |
| 22837 | }); | |
| 22838 | const attributes = Attributes{}; | |
| 22839 | }; | |
| 22840 | ||
| 22841 | pub const __builtin_ve_vl_vfmads_vvsvvl = struct { | |
| 22842 | const param_str = "V256dV256dfV256dV256dUi"; | |
| 22843 | const target_set = TargetSet.init(.{ | |
| 22844 | .vevl_gen = true, | |
| 22845 | }); | |
| 22846 | const attributes = Attributes{}; | |
| 22847 | }; | |
| 22848 | ||
| 22849 | pub const __builtin_ve_vl_vfmads_vvvvl = struct { | |
| 22850 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22851 | const target_set = TargetSet.init(.{ | |
| 22852 | .vevl_gen = true, | |
| 22853 | }); | |
| 22854 | const attributes = Attributes{}; | |
| 22855 | }; | |
| 22856 | ||
| 22857 | pub const __builtin_ve_vl_vfmads_vvvvmvl = struct { | |
| 22858 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 22859 | const target_set = TargetSet.init(.{ | |
| 22860 | .vevl_gen = true, | |
| 22861 | }); | |
| 22862 | const attributes = Attributes{}; | |
| 22863 | }; | |
| 22864 | ||
| 22865 | pub const __builtin_ve_vl_vfmads_vvvvvl = struct { | |
| 22866 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 22867 | const target_set = TargetSet.init(.{ | |
| 22868 | .vevl_gen = true, | |
| 22869 | }); | |
| 22870 | const attributes = Attributes{}; | |
| 22871 | }; | |
| 22872 | ||
| 22873 | pub const __builtin_ve_vl_vfmaxd_vsvl = struct { | |
| 22874 | const param_str = "V256ddV256dUi"; | |
| 22875 | const target_set = TargetSet.init(.{ | |
| 22876 | .vevl_gen = true, | |
| 22877 | }); | |
| 22878 | const attributes = Attributes{}; | |
| 22879 | }; | |
| 22880 | ||
| 22881 | pub const __builtin_ve_vl_vfmaxd_vsvmvl = struct { | |
| 22882 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 22883 | const target_set = TargetSet.init(.{ | |
| 22884 | .vevl_gen = true, | |
| 22885 | }); | |
| 22886 | const attributes = Attributes{}; | |
| 22887 | }; | |
| 22888 | ||
| 22889 | pub const __builtin_ve_vl_vfmaxd_vsvvl = struct { | |
| 22890 | const param_str = "V256ddV256dV256dUi"; | |
| 22891 | const target_set = TargetSet.init(.{ | |
| 22892 | .vevl_gen = true, | |
| 22893 | }); | |
| 22894 | const attributes = Attributes{}; | |
| 22895 | }; | |
| 22896 | ||
| 22897 | pub const __builtin_ve_vl_vfmaxd_vvvl = struct { | |
| 22898 | const param_str = "V256dV256dV256dUi"; | |
| 22899 | const target_set = TargetSet.init(.{ | |
| 22900 | .vevl_gen = true, | |
| 22901 | }); | |
| 22902 | const attributes = Attributes{}; | |
| 22903 | }; | |
| 22904 | ||
| 22905 | pub const __builtin_ve_vl_vfmaxd_vvvmvl = struct { | |
| 22906 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22907 | const target_set = TargetSet.init(.{ | |
| 22908 | .vevl_gen = true, | |
| 22909 | }); | |
| 22910 | const attributes = Attributes{}; | |
| 22911 | }; | |
| 22912 | ||
| 22913 | pub const __builtin_ve_vl_vfmaxd_vvvvl = struct { | |
| 22914 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22915 | const target_set = TargetSet.init(.{ | |
| 22916 | .vevl_gen = true, | |
| 22917 | }); | |
| 22918 | const attributes = Attributes{}; | |
| 22919 | }; | |
| 22920 | ||
| 22921 | pub const __builtin_ve_vl_vfmaxs_vsvl = struct { | |
| 22922 | const param_str = "V256dfV256dUi"; | |
| 22923 | const target_set = TargetSet.init(.{ | |
| 22924 | .vevl_gen = true, | |
| 22925 | }); | |
| 22926 | const attributes = Attributes{}; | |
| 22927 | }; | |
| 22928 | ||
| 22929 | pub const __builtin_ve_vl_vfmaxs_vsvmvl = struct { | |
| 22930 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 22931 | const target_set = TargetSet.init(.{ | |
| 22932 | .vevl_gen = true, | |
| 22933 | }); | |
| 22934 | const attributes = Attributes{}; | |
| 22935 | }; | |
| 22936 | ||
| 22937 | pub const __builtin_ve_vl_vfmaxs_vsvvl = struct { | |
| 22938 | const param_str = "V256dfV256dV256dUi"; | |
| 22939 | const target_set = TargetSet.init(.{ | |
| 22940 | .vevl_gen = true, | |
| 22941 | }); | |
| 22942 | const attributes = Attributes{}; | |
| 22943 | }; | |
| 22944 | ||
| 22945 | pub const __builtin_ve_vl_vfmaxs_vvvl = struct { | |
| 22946 | const param_str = "V256dV256dV256dUi"; | |
| 22947 | const target_set = TargetSet.init(.{ | |
| 22948 | .vevl_gen = true, | |
| 22949 | }); | |
| 22950 | const attributes = Attributes{}; | |
| 22951 | }; | |
| 22952 | ||
| 22953 | pub const __builtin_ve_vl_vfmaxs_vvvmvl = struct { | |
| 22954 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 22955 | const target_set = TargetSet.init(.{ | |
| 22956 | .vevl_gen = true, | |
| 22957 | }); | |
| 22958 | const attributes = Attributes{}; | |
| 22959 | }; | |
| 22960 | ||
| 22961 | pub const __builtin_ve_vl_vfmaxs_vvvvl = struct { | |
| 22962 | const param_str = "V256dV256dV256dV256dUi"; | |
| 22963 | const target_set = TargetSet.init(.{ | |
| 22964 | .vevl_gen = true, | |
| 22965 | }); | |
| 22966 | const attributes = Attributes{}; | |
| 22967 | }; | |
| 22968 | ||
| 22969 | pub const __builtin_ve_vl_vfmind_vsvl = struct { | |
| 22970 | const param_str = "V256ddV256dUi"; | |
| 22971 | const target_set = TargetSet.init(.{ | |
| 22972 | .vevl_gen = true, | |
| 22973 | }); | |
| 22974 | const attributes = Attributes{}; | |
| 22975 | }; | |
| 22976 | ||
| 22977 | pub const __builtin_ve_vl_vfmind_vsvmvl = struct { | |
| 22978 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 22979 | const target_set = TargetSet.init(.{ | |
| 22980 | .vevl_gen = true, | |
| 22981 | }); | |
| 22982 | const attributes = Attributes{}; | |
| 22983 | }; | |
| 22984 | ||
| 22985 | pub const __builtin_ve_vl_vfmind_vsvvl = struct { | |
| 22986 | const param_str = "V256ddV256dV256dUi"; | |
| 22987 | const target_set = TargetSet.init(.{ | |
| 22988 | .vevl_gen = true, | |
| 22989 | }); | |
| 22990 | const attributes = Attributes{}; | |
| 22991 | }; | |
| 22992 | ||
| 22993 | pub const __builtin_ve_vl_vfmind_vvvl = struct { | |
| 22994 | const param_str = "V256dV256dV256dUi"; | |
| 22995 | const target_set = TargetSet.init(.{ | |
| 22996 | .vevl_gen = true, | |
| 22997 | }); | |
| 22998 | const attributes = Attributes{}; | |
| 22999 | }; | |
| 23000 | ||
| 23001 | pub const __builtin_ve_vl_vfmind_vvvmvl = struct { | |
| 23002 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 23003 | const target_set = TargetSet.init(.{ | |
| 23004 | .vevl_gen = true, | |
| 23005 | }); | |
| 23006 | const attributes = Attributes{}; | |
| 23007 | }; | |
| 23008 | ||
| 23009 | pub const __builtin_ve_vl_vfmind_vvvvl = struct { | |
| 23010 | const param_str = "V256dV256dV256dV256dUi"; | |
| 23011 | const target_set = TargetSet.init(.{ | |
| 23012 | .vevl_gen = true, | |
| 23013 | }); | |
| 23014 | const attributes = Attributes{}; | |
| 23015 | }; | |
| 23016 | ||
| 23017 | pub const __builtin_ve_vl_vfmins_vsvl = struct { | |
| 23018 | const param_str = "V256dfV256dUi"; | |
| 23019 | const target_set = TargetSet.init(.{ | |
| 23020 | .vevl_gen = true, | |
| 23021 | }); | |
| 23022 | const attributes = Attributes{}; | |
| 23023 | }; | |
| 23024 | ||
| 23025 | pub const __builtin_ve_vl_vfmins_vsvmvl = struct { | |
| 23026 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 23027 | const target_set = TargetSet.init(.{ | |
| 23028 | .vevl_gen = true, | |
| 23029 | }); | |
| 23030 | const attributes = Attributes{}; | |
| 23031 | }; | |
| 23032 | ||
| 23033 | pub const __builtin_ve_vl_vfmins_vsvvl = struct { | |
| 23034 | const param_str = "V256dfV256dV256dUi"; | |
| 23035 | const target_set = TargetSet.init(.{ | |
| 23036 | .vevl_gen = true, | |
| 23037 | }); | |
| 23038 | const attributes = Attributes{}; | |
| 23039 | }; | |
| 23040 | ||
| 23041 | pub const __builtin_ve_vl_vfmins_vvvl = struct { | |
| 23042 | const param_str = "V256dV256dV256dUi"; | |
| 23043 | const target_set = TargetSet.init(.{ | |
| 23044 | .vevl_gen = true, | |
| 23045 | }); | |
| 23046 | const attributes = Attributes{}; | |
| 23047 | }; | |
| 23048 | ||
| 23049 | pub const __builtin_ve_vl_vfmins_vvvmvl = struct { | |
| 23050 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 23051 | const target_set = TargetSet.init(.{ | |
| 23052 | .vevl_gen = true, | |
| 23053 | }); | |
| 23054 | const attributes = Attributes{}; | |
| 23055 | }; | |
| 23056 | ||
| 23057 | pub const __builtin_ve_vl_vfmins_vvvvl = struct { | |
| 23058 | const param_str = "V256dV256dV256dV256dUi"; | |
| 23059 | const target_set = TargetSet.init(.{ | |
| 23060 | .vevl_gen = true, | |
| 23061 | }); | |
| 23062 | const attributes = Attributes{}; | |
| 23063 | }; | |
| 23064 | ||
| 23065 | pub const __builtin_ve_vl_vfmkdeq_mvl = struct { | |
| 23066 | const param_str = "V256bV256dUi"; | |
| 23067 | const target_set = TargetSet.init(.{ | |
| 23068 | .vevl_gen = true, | |
| 23069 | }); | |
| 23070 | const attributes = Attributes{}; | |
| 23071 | }; | |
| 23072 | ||
| 23073 | pub const __builtin_ve_vl_vfmkdeq_mvml = struct { | |
| 23074 | const param_str = "V256bV256dV256bUi"; | |
| 23075 | const target_set = TargetSet.init(.{ | |
| 23076 | .vevl_gen = true, | |
| 23077 | }); | |
| 23078 | const attributes = Attributes{}; | |
| 23079 | }; | |
| 23080 | ||
| 23081 | pub const __builtin_ve_vl_vfmkdeqnan_mvl = struct { | |
| 23082 | const param_str = "V256bV256dUi"; | |
| 23083 | const target_set = TargetSet.init(.{ | |
| 23084 | .vevl_gen = true, | |
| 23085 | }); | |
| 23086 | const attributes = Attributes{}; | |
| 23087 | }; | |
| 23088 | ||
| 23089 | pub const __builtin_ve_vl_vfmkdeqnan_mvml = struct { | |
| 23090 | const param_str = "V256bV256dV256bUi"; | |
| 23091 | const target_set = TargetSet.init(.{ | |
| 23092 | .vevl_gen = true, | |
| 23093 | }); | |
| 23094 | const attributes = Attributes{}; | |
| 23095 | }; | |
| 23096 | ||
| 23097 | pub const __builtin_ve_vl_vfmkdge_mvl = struct { | |
| 23098 | const param_str = "V256bV256dUi"; | |
| 23099 | const target_set = TargetSet.init(.{ | |
| 23100 | .vevl_gen = true, | |
| 23101 | }); | |
| 23102 | const attributes = Attributes{}; | |
| 23103 | }; | |
| 23104 | ||
| 23105 | pub const __builtin_ve_vl_vfmkdge_mvml = struct { | |
| 23106 | const param_str = "V256bV256dV256bUi"; | |
| 23107 | const target_set = TargetSet.init(.{ | |
| 23108 | .vevl_gen = true, | |
| 23109 | }); | |
| 23110 | const attributes = Attributes{}; | |
| 23111 | }; | |
| 23112 | ||
| 23113 | pub const __builtin_ve_vl_vfmkdgenan_mvl = struct { | |
| 23114 | const param_str = "V256bV256dUi"; | |
| 23115 | const target_set = TargetSet.init(.{ | |
| 23116 | .vevl_gen = true, | |
| 23117 | }); | |
| 23118 | const attributes = Attributes{}; | |
| 23119 | }; | |
| 23120 | ||
| 23121 | pub const __builtin_ve_vl_vfmkdgenan_mvml = struct { | |
| 23122 | const param_str = "V256bV256dV256bUi"; | |
| 23123 | const target_set = TargetSet.init(.{ | |
| 23124 | .vevl_gen = true, | |
| 23125 | }); | |
| 23126 | const attributes = Attributes{}; | |
| 23127 | }; | |
| 23128 | ||
| 23129 | pub const __builtin_ve_vl_vfmkdgt_mvl = struct { | |
| 23130 | const param_str = "V256bV256dUi"; | |
| 23131 | const target_set = TargetSet.init(.{ | |
| 23132 | .vevl_gen = true, | |
| 23133 | }); | |
| 23134 | const attributes = Attributes{}; | |
| 23135 | }; | |
| 23136 | ||
| 23137 | pub const __builtin_ve_vl_vfmkdgt_mvml = struct { | |
| 23138 | const param_str = "V256bV256dV256bUi"; | |
| 23139 | const target_set = TargetSet.init(.{ | |
| 23140 | .vevl_gen = true, | |
| 23141 | }); | |
| 23142 | const attributes = Attributes{}; | |
| 23143 | }; | |
| 23144 | ||
| 23145 | pub const __builtin_ve_vl_vfmkdgtnan_mvl = struct { | |
| 23146 | const param_str = "V256bV256dUi"; | |
| 23147 | const target_set = TargetSet.init(.{ | |
| 23148 | .vevl_gen = true, | |
| 23149 | }); | |
| 23150 | const attributes = Attributes{}; | |
| 23151 | }; | |
| 23152 | ||
| 23153 | pub const __builtin_ve_vl_vfmkdgtnan_mvml = struct { | |
| 23154 | const param_str = "V256bV256dV256bUi"; | |
| 23155 | const target_set = TargetSet.init(.{ | |
| 23156 | .vevl_gen = true, | |
| 23157 | }); | |
| 23158 | const attributes = Attributes{}; | |
| 23159 | }; | |
| 23160 | ||
| 23161 | pub const __builtin_ve_vl_vfmkdle_mvl = struct { | |
| 23162 | const param_str = "V256bV256dUi"; | |
| 23163 | const target_set = TargetSet.init(.{ | |
| 23164 | .vevl_gen = true, | |
| 23165 | }); | |
| 23166 | const attributes = Attributes{}; | |
| 23167 | }; | |
| 23168 | ||
| 23169 | pub const __builtin_ve_vl_vfmkdle_mvml = struct { | |
| 23170 | const param_str = "V256bV256dV256bUi"; | |
| 23171 | const target_set = TargetSet.init(.{ | |
| 23172 | .vevl_gen = true, | |
| 23173 | }); | |
| 23174 | const attributes = Attributes{}; | |
| 23175 | }; | |
| 23176 | ||
| 23177 | pub const __builtin_ve_vl_vfmkdlenan_mvl = struct { | |
| 23178 | const param_str = "V256bV256dUi"; | |
| 23179 | const target_set = TargetSet.init(.{ | |
| 23180 | .vevl_gen = true, | |
| 23181 | }); | |
| 23182 | const attributes = Attributes{}; | |
| 23183 | }; | |
| 23184 | ||
| 23185 | pub const __builtin_ve_vl_vfmkdlenan_mvml = struct { | |
| 23186 | const param_str = "V256bV256dV256bUi"; | |
| 23187 | const target_set = TargetSet.init(.{ | |
| 23188 | .vevl_gen = true, | |
| 23189 | }); | |
| 23190 | const attributes = Attributes{}; | |
| 23191 | }; | |
| 23192 | ||
| 23193 | pub const __builtin_ve_vl_vfmkdlt_mvl = struct { | |
| 23194 | const param_str = "V256bV256dUi"; | |
| 23195 | const target_set = TargetSet.init(.{ | |
| 23196 | .vevl_gen = true, | |
| 23197 | }); | |
| 23198 | const attributes = Attributes{}; | |
| 23199 | }; | |
| 23200 | ||
| 23201 | pub const __builtin_ve_vl_vfmkdlt_mvml = struct { | |
| 23202 | const param_str = "V256bV256dV256bUi"; | |
| 23203 | const target_set = TargetSet.init(.{ | |
| 23204 | .vevl_gen = true, | |
| 23205 | }); | |
| 23206 | const attributes = Attributes{}; | |
| 23207 | }; | |
| 23208 | ||
| 23209 | pub const __builtin_ve_vl_vfmkdltnan_mvl = struct { | |
| 23210 | const param_str = "V256bV256dUi"; | |
| 23211 | const target_set = TargetSet.init(.{ | |
| 23212 | .vevl_gen = true, | |
| 23213 | }); | |
| 23214 | const attributes = Attributes{}; | |
| 23215 | }; | |
| 23216 | ||
| 23217 | pub const __builtin_ve_vl_vfmkdltnan_mvml = struct { | |
| 23218 | const param_str = "V256bV256dV256bUi"; | |
| 23219 | const target_set = TargetSet.init(.{ | |
| 23220 | .vevl_gen = true, | |
| 23221 | }); | |
| 23222 | const attributes = Attributes{}; | |
| 23223 | }; | |
| 23224 | ||
| 23225 | pub const __builtin_ve_vl_vfmkdnan_mvl = struct { | |
| 23226 | const param_str = "V256bV256dUi"; | |
| 23227 | const target_set = TargetSet.init(.{ | |
| 23228 | .vevl_gen = true, | |
| 23229 | }); | |
| 23230 | const attributes = Attributes{}; | |
| 23231 | }; | |
| 23232 | ||
| 23233 | pub const __builtin_ve_vl_vfmkdnan_mvml = struct { | |
| 23234 | const param_str = "V256bV256dV256bUi"; | |
| 23235 | const target_set = TargetSet.init(.{ | |
| 23236 | .vevl_gen = true, | |
| 23237 | }); | |
| 23238 | const attributes = Attributes{}; | |
| 23239 | }; | |
| 23240 | ||
| 23241 | pub const __builtin_ve_vl_vfmkdne_mvl = struct { | |
| 23242 | const param_str = "V256bV256dUi"; | |
| 23243 | const target_set = TargetSet.init(.{ | |
| 23244 | .vevl_gen = true, | |
| 23245 | }); | |
| 23246 | const attributes = Attributes{}; | |
| 23247 | }; | |
| 23248 | ||
| 23249 | pub const __builtin_ve_vl_vfmkdne_mvml = struct { | |
| 23250 | const param_str = "V256bV256dV256bUi"; | |
| 23251 | const target_set = TargetSet.init(.{ | |
| 23252 | .vevl_gen = true, | |
| 23253 | }); | |
| 23254 | const attributes = Attributes{}; | |
| 23255 | }; | |
| 23256 | ||
| 23257 | pub const __builtin_ve_vl_vfmkdnenan_mvl = struct { | |
| 23258 | const param_str = "V256bV256dUi"; | |
| 23259 | const target_set = TargetSet.init(.{ | |
| 23260 | .vevl_gen = true, | |
| 23261 | }); | |
| 23262 | const attributes = Attributes{}; | |
| 23263 | }; | |
| 23264 | ||
| 23265 | pub const __builtin_ve_vl_vfmkdnenan_mvml = struct { | |
| 23266 | const param_str = "V256bV256dV256bUi"; | |
| 23267 | const target_set = TargetSet.init(.{ | |
| 23268 | .vevl_gen = true, | |
| 23269 | }); | |
| 23270 | const attributes = Attributes{}; | |
| 23271 | }; | |
| 23272 | ||
| 23273 | pub const __builtin_ve_vl_vfmkdnum_mvl = struct { | |
| 23274 | const param_str = "V256bV256dUi"; | |
| 23275 | const target_set = TargetSet.init(.{ | |
| 23276 | .vevl_gen = true, | |
| 23277 | }); | |
| 23278 | const attributes = Attributes{}; | |
| 23279 | }; | |
| 23280 | ||
| 23281 | pub const __builtin_ve_vl_vfmkdnum_mvml = struct { | |
| 23282 | const param_str = "V256bV256dV256bUi"; | |
| 23283 | const target_set = TargetSet.init(.{ | |
| 23284 | .vevl_gen = true, | |
| 23285 | }); | |
| 23286 | const attributes = Attributes{}; | |
| 23287 | }; | |
| 23288 | ||
| 23289 | pub const __builtin_ve_vl_vfmklaf_ml = struct { | |
| 23290 | const param_str = "V256bUi"; | |
| 23291 | const target_set = TargetSet.init(.{ | |
| 23292 | .vevl_gen = true, | |
| 23293 | }); | |
| 23294 | const attributes = Attributes{}; | |
| 23295 | }; | |
| 23296 | ||
| 23297 | pub const __builtin_ve_vl_vfmklat_ml = struct { | |
| 23298 | const param_str = "V256bUi"; | |
| 23299 | const target_set = TargetSet.init(.{ | |
| 23300 | .vevl_gen = true, | |
| 23301 | }); | |
| 23302 | const attributes = Attributes{}; | |
| 23303 | }; | |
| 23304 | ||
| 23305 | pub const __builtin_ve_vl_vfmkleq_mvl = struct { | |
| 23306 | const param_str = "V256bV256dUi"; | |
| 23307 | const target_set = TargetSet.init(.{ | |
| 23308 | .vevl_gen = true, | |
| 23309 | }); | |
| 23310 | const attributes = Attributes{}; | |
| 23311 | }; | |
| 23312 | ||
| 23313 | pub const __builtin_ve_vl_vfmkleq_mvml = struct { | |
| 23314 | const param_str = "V256bV256dV256bUi"; | |
| 23315 | const target_set = TargetSet.init(.{ | |
| 23316 | .vevl_gen = true, | |
| 23317 | }); | |
| 23318 | const attributes = Attributes{}; | |
| 23319 | }; | |
| 23320 | ||
| 23321 | pub const __builtin_ve_vl_vfmkleqnan_mvl = struct { | |
| 23322 | const param_str = "V256bV256dUi"; | |
| 23323 | const target_set = TargetSet.init(.{ | |
| 23324 | .vevl_gen = true, | |
| 23325 | }); | |
| 23326 | const attributes = Attributes{}; | |
| 23327 | }; | |
| 23328 | ||
| 23329 | pub const __builtin_ve_vl_vfmkleqnan_mvml = struct { | |
| 23330 | const param_str = "V256bV256dV256bUi"; | |
| 23331 | const target_set = TargetSet.init(.{ | |
| 23332 | .vevl_gen = true, | |
| 23333 | }); | |
| 23334 | const attributes = Attributes{}; | |
| 23335 | }; | |
| 23336 | ||
| 23337 | pub const __builtin_ve_vl_vfmklge_mvl = struct { | |
| 23338 | const param_str = "V256bV256dUi"; | |
| 23339 | const target_set = TargetSet.init(.{ | |
| 23340 | .vevl_gen = true, | |
| 23341 | }); | |
| 23342 | const attributes = Attributes{}; | |
| 23343 | }; | |
| 23344 | ||
| 23345 | pub const __builtin_ve_vl_vfmklge_mvml = struct { | |
| 23346 | const param_str = "V256bV256dV256bUi"; | |
| 23347 | const target_set = TargetSet.init(.{ | |
| 23348 | .vevl_gen = true, | |
| 23349 | }); | |
| 23350 | const attributes = Attributes{}; | |
| 23351 | }; | |
| 23352 | ||
| 23353 | pub const __builtin_ve_vl_vfmklgenan_mvl = struct { | |
| 23354 | const param_str = "V256bV256dUi"; | |
| 23355 | const target_set = TargetSet.init(.{ | |
| 23356 | .vevl_gen = true, | |
| 23357 | }); | |
| 23358 | const attributes = Attributes{}; | |
| 23359 | }; | |
| 23360 | ||
| 23361 | pub const __builtin_ve_vl_vfmklgenan_mvml = struct { | |
| 23362 | const param_str = "V256bV256dV256bUi"; | |
| 23363 | const target_set = TargetSet.init(.{ | |
| 23364 | .vevl_gen = true, | |
| 23365 | }); | |
| 23366 | const attributes = Attributes{}; | |
| 23367 | }; | |
| 23368 | ||
| 23369 | pub const __builtin_ve_vl_vfmklgt_mvl = struct { | |
| 23370 | const param_str = "V256bV256dUi"; | |
| 23371 | const target_set = TargetSet.init(.{ | |
| 23372 | .vevl_gen = true, | |
| 23373 | }); | |
| 23374 | const attributes = Attributes{}; | |
| 23375 | }; | |
| 23376 | ||
| 23377 | pub const __builtin_ve_vl_vfmklgt_mvml = struct { | |
| 23378 | const param_str = "V256bV256dV256bUi"; | |
| 23379 | const target_set = TargetSet.init(.{ | |
| 23380 | .vevl_gen = true, | |
| 23381 | }); | |
| 23382 | const attributes = Attributes{}; | |
| 23383 | }; | |
| 23384 | ||
| 23385 | pub const __builtin_ve_vl_vfmklgtnan_mvl = struct { | |
| 23386 | const param_str = "V256bV256dUi"; | |
| 23387 | const target_set = TargetSet.init(.{ | |
| 23388 | .vevl_gen = true, | |
| 23389 | }); | |
| 23390 | const attributes = Attributes{}; | |
| 23391 | }; | |
| 23392 | ||
| 23393 | pub const __builtin_ve_vl_vfmklgtnan_mvml = struct { | |
| 23394 | const param_str = "V256bV256dV256bUi"; | |
| 23395 | const target_set = TargetSet.init(.{ | |
| 23396 | .vevl_gen = true, | |
| 23397 | }); | |
| 23398 | const attributes = Attributes{}; | |
| 23399 | }; | |
| 23400 | ||
| 23401 | pub const __builtin_ve_vl_vfmklle_mvl = struct { | |
| 23402 | const param_str = "V256bV256dUi"; | |
| 23403 | const target_set = TargetSet.init(.{ | |
| 23404 | .vevl_gen = true, | |
| 23405 | }); | |
| 23406 | const attributes = Attributes{}; | |
| 23407 | }; | |
| 23408 | ||
| 23409 | pub const __builtin_ve_vl_vfmklle_mvml = struct { | |
| 23410 | const param_str = "V256bV256dV256bUi"; | |
| 23411 | const target_set = TargetSet.init(.{ | |
| 23412 | .vevl_gen = true, | |
| 23413 | }); | |
| 23414 | const attributes = Attributes{}; | |
| 23415 | }; | |
| 23416 | ||
| 23417 | pub const __builtin_ve_vl_vfmkllenan_mvl = struct { | |
| 23418 | const param_str = "V256bV256dUi"; | |
| 23419 | const target_set = TargetSet.init(.{ | |
| 23420 | .vevl_gen = true, | |
| 23421 | }); | |
| 23422 | const attributes = Attributes{}; | |
| 23423 | }; | |
| 23424 | ||
| 23425 | pub const __builtin_ve_vl_vfmkllenan_mvml = struct { | |
| 23426 | const param_str = "V256bV256dV256bUi"; | |
| 23427 | const target_set = TargetSet.init(.{ | |
| 23428 | .vevl_gen = true, | |
| 23429 | }); | |
| 23430 | const attributes = Attributes{}; | |
| 23431 | }; | |
| 23432 | ||
| 23433 | pub const __builtin_ve_vl_vfmkllt_mvl = struct { | |
| 23434 | const param_str = "V256bV256dUi"; | |
| 23435 | const target_set = TargetSet.init(.{ | |
| 23436 | .vevl_gen = true, | |
| 23437 | }); | |
| 23438 | const attributes = Attributes{}; | |
| 23439 | }; | |
| 23440 | ||
| 23441 | pub const __builtin_ve_vl_vfmkllt_mvml = struct { | |
| 23442 | const param_str = "V256bV256dV256bUi"; | |
| 23443 | const target_set = TargetSet.init(.{ | |
| 23444 | .vevl_gen = true, | |
| 23445 | }); | |
| 23446 | const attributes = Attributes{}; | |
| 23447 | }; | |
| 23448 | ||
| 23449 | pub const __builtin_ve_vl_vfmklltnan_mvl = struct { | |
| 23450 | const param_str = "V256bV256dUi"; | |
| 23451 | const target_set = TargetSet.init(.{ | |
| 23452 | .vevl_gen = true, | |
| 23453 | }); | |
| 23454 | const attributes = Attributes{}; | |
| 23455 | }; | |
| 23456 | ||
| 23457 | pub const __builtin_ve_vl_vfmklltnan_mvml = struct { | |
| 23458 | const param_str = "V256bV256dV256bUi"; | |
| 23459 | const target_set = TargetSet.init(.{ | |
| 23460 | .vevl_gen = true, | |
| 23461 | }); | |
| 23462 | const attributes = Attributes{}; | |
| 23463 | }; | |
| 23464 | ||
| 23465 | pub const __builtin_ve_vl_vfmklnan_mvl = struct { | |
| 23466 | const param_str = "V256bV256dUi"; | |
| 23467 | const target_set = TargetSet.init(.{ | |
| 23468 | .vevl_gen = true, | |
| 23469 | }); | |
| 23470 | const attributes = Attributes{}; | |
| 23471 | }; | |
| 23472 | ||
| 23473 | pub const __builtin_ve_vl_vfmklnan_mvml = struct { | |
| 23474 | const param_str = "V256bV256dV256bUi"; | |
| 23475 | const target_set = TargetSet.init(.{ | |
| 23476 | .vevl_gen = true, | |
| 23477 | }); | |
| 23478 | const attributes = Attributes{}; | |
| 23479 | }; | |
| 23480 | ||
| 23481 | pub const __builtin_ve_vl_vfmklne_mvl = struct { | |
| 23482 | const param_str = "V256bV256dUi"; | |
| 23483 | const target_set = TargetSet.init(.{ | |
| 23484 | .vevl_gen = true, | |
| 23485 | }); | |
| 23486 | const attributes = Attributes{}; | |
| 23487 | }; | |
| 23488 | ||
| 23489 | pub const __builtin_ve_vl_vfmklne_mvml = struct { | |
| 23490 | const param_str = "V256bV256dV256bUi"; | |
| 23491 | const target_set = TargetSet.init(.{ | |
| 23492 | .vevl_gen = true, | |
| 23493 | }); | |
| 23494 | const attributes = Attributes{}; | |
| 23495 | }; | |
| 23496 | ||
| 23497 | pub const __builtin_ve_vl_vfmklnenan_mvl = struct { | |
| 23498 | const param_str = "V256bV256dUi"; | |
| 23499 | const target_set = TargetSet.init(.{ | |
| 23500 | .vevl_gen = true, | |
| 23501 | }); | |
| 23502 | const attributes = Attributes{}; | |
| 23503 | }; | |
| 23504 | ||
| 23505 | pub const __builtin_ve_vl_vfmklnenan_mvml = struct { | |
| 23506 | const param_str = "V256bV256dV256bUi"; | |
| 23507 | const target_set = TargetSet.init(.{ | |
| 23508 | .vevl_gen = true, | |
| 23509 | }); | |
| 23510 | const attributes = Attributes{}; | |
| 23511 | }; | |
| 23512 | ||
| 23513 | pub const __builtin_ve_vl_vfmklnum_mvl = struct { | |
| 23514 | const param_str = "V256bV256dUi"; | |
| 23515 | const target_set = TargetSet.init(.{ | |
| 23516 | .vevl_gen = true, | |
| 23517 | }); | |
| 23518 | const attributes = Attributes{}; | |
| 23519 | }; | |
| 23520 | ||
| 23521 | pub const __builtin_ve_vl_vfmklnum_mvml = struct { | |
| 23522 | const param_str = "V256bV256dV256bUi"; | |
| 23523 | const target_set = TargetSet.init(.{ | |
| 23524 | .vevl_gen = true, | |
| 23525 | }); | |
| 23526 | const attributes = Attributes{}; | |
| 23527 | }; | |
| 23528 | ||
| 23529 | pub const __builtin_ve_vl_vfmkseq_mvl = struct { | |
| 23530 | const param_str = "V256bV256dUi"; | |
| 23531 | const target_set = TargetSet.init(.{ | |
| 23532 | .vevl_gen = true, | |
| 23533 | }); | |
| 23534 | const attributes = Attributes{}; | |
| 23535 | }; | |
| 23536 | ||
| 23537 | pub const __builtin_ve_vl_vfmkseq_mvml = struct { | |
| 23538 | const param_str = "V256bV256dV256bUi"; | |
| 23539 | const target_set = TargetSet.init(.{ | |
| 23540 | .vevl_gen = true, | |
| 23541 | }); | |
| 23542 | const attributes = Attributes{}; | |
| 23543 | }; | |
| 23544 | ||
| 23545 | pub const __builtin_ve_vl_vfmkseqnan_mvl = struct { | |
| 23546 | const param_str = "V256bV256dUi"; | |
| 23547 | const target_set = TargetSet.init(.{ | |
| 23548 | .vevl_gen = true, | |
| 23549 | }); | |
| 23550 | const attributes = Attributes{}; | |
| 23551 | }; | |
| 23552 | ||
| 23553 | pub const __builtin_ve_vl_vfmkseqnan_mvml = struct { | |
| 23554 | const param_str = "V256bV256dV256bUi"; | |
| 23555 | const target_set = TargetSet.init(.{ | |
| 23556 | .vevl_gen = true, | |
| 23557 | }); | |
| 23558 | const attributes = Attributes{}; | |
| 23559 | }; | |
| 23560 | ||
| 23561 | pub const __builtin_ve_vl_vfmksge_mvl = struct { | |
| 23562 | const param_str = "V256bV256dUi"; | |
| 23563 | const target_set = TargetSet.init(.{ | |
| 23564 | .vevl_gen = true, | |
| 23565 | }); | |
| 23566 | const attributes = Attributes{}; | |
| 23567 | }; | |
| 23568 | ||
| 23569 | pub const __builtin_ve_vl_vfmksge_mvml = struct { | |
| 23570 | const param_str = "V256bV256dV256bUi"; | |
| 23571 | const target_set = TargetSet.init(.{ | |
| 23572 | .vevl_gen = true, | |
| 23573 | }); | |
| 23574 | const attributes = Attributes{}; | |
| 23575 | }; | |
| 23576 | ||
| 23577 | pub const __builtin_ve_vl_vfmksgenan_mvl = struct { | |
| 23578 | const param_str = "V256bV256dUi"; | |
| 23579 | const target_set = TargetSet.init(.{ | |
| 23580 | .vevl_gen = true, | |
| 23581 | }); | |
| 23582 | const attributes = Attributes{}; | |
| 23583 | }; | |
| 23584 | ||
| 23585 | pub const __builtin_ve_vl_vfmksgenan_mvml = struct { | |
| 23586 | const param_str = "V256bV256dV256bUi"; | |
| 23587 | const target_set = TargetSet.init(.{ | |
| 23588 | .vevl_gen = true, | |
| 23589 | }); | |
| 23590 | const attributes = Attributes{}; | |
| 23591 | }; | |
| 23592 | ||
| 23593 | pub const __builtin_ve_vl_vfmksgt_mvl = struct { | |
| 23594 | const param_str = "V256bV256dUi"; | |
| 23595 | const target_set = TargetSet.init(.{ | |
| 23596 | .vevl_gen = true, | |
| 23597 | }); | |
| 23598 | const attributes = Attributes{}; | |
| 23599 | }; | |
| 23600 | ||
| 23601 | pub const __builtin_ve_vl_vfmksgt_mvml = struct { | |
| 23602 | const param_str = "V256bV256dV256bUi"; | |
| 23603 | const target_set = TargetSet.init(.{ | |
| 23604 | .vevl_gen = true, | |
| 23605 | }); | |
| 23606 | const attributes = Attributes{}; | |
| 23607 | }; | |
| 23608 | ||
| 23609 | pub const __builtin_ve_vl_vfmksgtnan_mvl = struct { | |
| 23610 | const param_str = "V256bV256dUi"; | |
| 23611 | const target_set = TargetSet.init(.{ | |
| 23612 | .vevl_gen = true, | |
| 23613 | }); | |
| 23614 | const attributes = Attributes{}; | |
| 23615 | }; | |
| 23616 | ||
| 23617 | pub const __builtin_ve_vl_vfmksgtnan_mvml = struct { | |
| 23618 | const param_str = "V256bV256dV256bUi"; | |
| 23619 | const target_set = TargetSet.init(.{ | |
| 23620 | .vevl_gen = true, | |
| 23621 | }); | |
| 23622 | const attributes = Attributes{}; | |
| 23623 | }; | |
| 23624 | ||
| 23625 | pub const __builtin_ve_vl_vfmksle_mvl = struct { | |
| 23626 | const param_str = "V256bV256dUi"; | |
| 23627 | const target_set = TargetSet.init(.{ | |
| 23628 | .vevl_gen = true, | |
| 23629 | }); | |
| 23630 | const attributes = Attributes{}; | |
| 23631 | }; | |
| 23632 | ||
| 23633 | pub const __builtin_ve_vl_vfmksle_mvml = struct { | |
| 23634 | const param_str = "V256bV256dV256bUi"; | |
| 23635 | const target_set = TargetSet.init(.{ | |
| 23636 | .vevl_gen = true, | |
| 23637 | }); | |
| 23638 | const attributes = Attributes{}; | |
| 23639 | }; | |
| 23640 | ||
| 23641 | pub const __builtin_ve_vl_vfmkslenan_mvl = struct { | |
| 23642 | const param_str = "V256bV256dUi"; | |
| 23643 | const target_set = TargetSet.init(.{ | |
| 23644 | .vevl_gen = true, | |
| 23645 | }); | |
| 23646 | const attributes = Attributes{}; | |
| 23647 | }; | |
| 23648 | ||
| 23649 | pub const __builtin_ve_vl_vfmkslenan_mvml = struct { | |
| 23650 | const param_str = "V256bV256dV256bUi"; | |
| 23651 | const target_set = TargetSet.init(.{ | |
| 23652 | .vevl_gen = true, | |
| 23653 | }); | |
| 23654 | const attributes = Attributes{}; | |
| 23655 | }; | |
| 23656 | ||
| 23657 | pub const __builtin_ve_vl_vfmkslt_mvl = struct { | |
| 23658 | const param_str = "V256bV256dUi"; | |
| 23659 | const target_set = TargetSet.init(.{ | |
| 23660 | .vevl_gen = true, | |
| 23661 | }); | |
| 23662 | const attributes = Attributes{}; | |
| 23663 | }; | |
| 23664 | ||
| 23665 | pub const __builtin_ve_vl_vfmkslt_mvml = struct { | |
| 23666 | const param_str = "V256bV256dV256bUi"; | |
| 23667 | const target_set = TargetSet.init(.{ | |
| 23668 | .vevl_gen = true, | |
| 23669 | }); | |
| 23670 | const attributes = Attributes{}; | |
| 23671 | }; | |
| 23672 | ||
| 23673 | pub const __builtin_ve_vl_vfmksltnan_mvl = struct { | |
| 23674 | const param_str = "V256bV256dUi"; | |
| 23675 | const target_set = TargetSet.init(.{ | |
| 23676 | .vevl_gen = true, | |
| 23677 | }); | |
| 23678 | const attributes = Attributes{}; | |
| 23679 | }; | |
| 23680 | ||
| 23681 | pub const __builtin_ve_vl_vfmksltnan_mvml = struct { | |
| 23682 | const param_str = "V256bV256dV256bUi"; | |
| 23683 | const target_set = TargetSet.init(.{ | |
| 23684 | .vevl_gen = true, | |
| 23685 | }); | |
| 23686 | const attributes = Attributes{}; | |
| 23687 | }; | |
| 23688 | ||
| 23689 | pub const __builtin_ve_vl_vfmksnan_mvl = struct { | |
| 23690 | const param_str = "V256bV256dUi"; | |
| 23691 | const target_set = TargetSet.init(.{ | |
| 23692 | .vevl_gen = true, | |
| 23693 | }); | |
| 23694 | const attributes = Attributes{}; | |
| 23695 | }; | |
| 23696 | ||
| 23697 | pub const __builtin_ve_vl_vfmksnan_mvml = struct { | |
| 23698 | const param_str = "V256bV256dV256bUi"; | |
| 23699 | const target_set = TargetSet.init(.{ | |
| 23700 | .vevl_gen = true, | |
| 23701 | }); | |
| 23702 | const attributes = Attributes{}; | |
| 23703 | }; | |
| 23704 | ||
| 23705 | pub const __builtin_ve_vl_vfmksne_mvl = struct { | |
| 23706 | const param_str = "V256bV256dUi"; | |
| 23707 | const target_set = TargetSet.init(.{ | |
| 23708 | .vevl_gen = true, | |
| 23709 | }); | |
| 23710 | const attributes = Attributes{}; | |
| 23711 | }; | |
| 23712 | ||
| 23713 | pub const __builtin_ve_vl_vfmksne_mvml = struct { | |
| 23714 | const param_str = "V256bV256dV256bUi"; | |
| 23715 | const target_set = TargetSet.init(.{ | |
| 23716 | .vevl_gen = true, | |
| 23717 | }); | |
| 23718 | const attributes = Attributes{}; | |
| 23719 | }; | |
| 23720 | ||
| 23721 | pub const __builtin_ve_vl_vfmksnenan_mvl = struct { | |
| 23722 | const param_str = "V256bV256dUi"; | |
| 23723 | const target_set = TargetSet.init(.{ | |
| 23724 | .vevl_gen = true, | |
| 23725 | }); | |
| 23726 | const attributes = Attributes{}; | |
| 23727 | }; | |
| 23728 | ||
| 23729 | pub const __builtin_ve_vl_vfmksnenan_mvml = struct { | |
| 23730 | const param_str = "V256bV256dV256bUi"; | |
| 23731 | const target_set = TargetSet.init(.{ | |
| 23732 | .vevl_gen = true, | |
| 23733 | }); | |
| 23734 | const attributes = Attributes{}; | |
| 23735 | }; | |
| 23736 | ||
| 23737 | pub const __builtin_ve_vl_vfmksnum_mvl = struct { | |
| 23738 | const param_str = "V256bV256dUi"; | |
| 23739 | const target_set = TargetSet.init(.{ | |
| 23740 | .vevl_gen = true, | |
| 23741 | }); | |
| 23742 | const attributes = Attributes{}; | |
| 23743 | }; | |
| 23744 | ||
| 23745 | pub const __builtin_ve_vl_vfmksnum_mvml = struct { | |
| 23746 | const param_str = "V256bV256dV256bUi"; | |
| 23747 | const target_set = TargetSet.init(.{ | |
| 23748 | .vevl_gen = true, | |
| 23749 | }); | |
| 23750 | const attributes = Attributes{}; | |
| 23751 | }; | |
| 23752 | ||
| 23753 | pub const __builtin_ve_vl_vfmkweq_mvl = struct { | |
| 23754 | const param_str = "V256bV256dUi"; | |
| 23755 | const target_set = TargetSet.init(.{ | |
| 23756 | .vevl_gen = true, | |
| 23757 | }); | |
| 23758 | const attributes = Attributes{}; | |
| 23759 | }; | |
| 23760 | ||
| 23761 | pub const __builtin_ve_vl_vfmkweq_mvml = struct { | |
| 23762 | const param_str = "V256bV256dV256bUi"; | |
| 23763 | const target_set = TargetSet.init(.{ | |
| 23764 | .vevl_gen = true, | |
| 23765 | }); | |
| 23766 | const attributes = Attributes{}; | |
| 23767 | }; | |
| 23768 | ||
| 23769 | pub const __builtin_ve_vl_vfmkweqnan_mvl = struct { | |
| 23770 | const param_str = "V256bV256dUi"; | |
| 23771 | const target_set = TargetSet.init(.{ | |
| 23772 | .vevl_gen = true, | |
| 23773 | }); | |
| 23774 | const attributes = Attributes{}; | |
| 23775 | }; | |
| 23776 | ||
| 23777 | pub const __builtin_ve_vl_vfmkweqnan_mvml = struct { | |
| 23778 | const param_str = "V256bV256dV256bUi"; | |
| 23779 | const target_set = TargetSet.init(.{ | |
| 23780 | .vevl_gen = true, | |
| 23781 | }); | |
| 23782 | const attributes = Attributes{}; | |
| 23783 | }; | |
| 23784 | ||
| 23785 | pub const __builtin_ve_vl_vfmkwge_mvl = struct { | |
| 23786 | const param_str = "V256bV256dUi"; | |
| 23787 | const target_set = TargetSet.init(.{ | |
| 23788 | .vevl_gen = true, | |
| 23789 | }); | |
| 23790 | const attributes = Attributes{}; | |
| 23791 | }; | |
| 23792 | ||
| 23793 | pub const __builtin_ve_vl_vfmkwge_mvml = struct { | |
| 23794 | const param_str = "V256bV256dV256bUi"; | |
| 23795 | const target_set = TargetSet.init(.{ | |
| 23796 | .vevl_gen = true, | |
| 23797 | }); | |
| 23798 | const attributes = Attributes{}; | |
| 23799 | }; | |
| 23800 | ||
| 23801 | pub const __builtin_ve_vl_vfmkwgenan_mvl = struct { | |
| 23802 | const param_str = "V256bV256dUi"; | |
| 23803 | const target_set = TargetSet.init(.{ | |
| 23804 | .vevl_gen = true, | |
| 23805 | }); | |
| 23806 | const attributes = Attributes{}; | |
| 23807 | }; | |
| 23808 | ||
| 23809 | pub const __builtin_ve_vl_vfmkwgenan_mvml = struct { | |
| 23810 | const param_str = "V256bV256dV256bUi"; | |
| 23811 | const target_set = TargetSet.init(.{ | |
| 23812 | .vevl_gen = true, | |
| 23813 | }); | |
| 23814 | const attributes = Attributes{}; | |
| 23815 | }; | |
| 23816 | ||
| 23817 | pub const __builtin_ve_vl_vfmkwgt_mvl = struct { | |
| 23818 | const param_str = "V256bV256dUi"; | |
| 23819 | const target_set = TargetSet.init(.{ | |
| 23820 | .vevl_gen = true, | |
| 23821 | }); | |
| 23822 | const attributes = Attributes{}; | |
| 23823 | }; | |
| 23824 | ||
| 23825 | pub const __builtin_ve_vl_vfmkwgt_mvml = struct { | |
| 23826 | const param_str = "V256bV256dV256bUi"; | |
| 23827 | const target_set = TargetSet.init(.{ | |
| 23828 | .vevl_gen = true, | |
| 23829 | }); | |
| 23830 | const attributes = Attributes{}; | |
| 23831 | }; | |
| 23832 | ||
| 23833 | pub const __builtin_ve_vl_vfmkwgtnan_mvl = struct { | |
| 23834 | const param_str = "V256bV256dUi"; | |
| 23835 | const target_set = TargetSet.init(.{ | |
| 23836 | .vevl_gen = true, | |
| 23837 | }); | |
| 23838 | const attributes = Attributes{}; | |
| 23839 | }; | |
| 23840 | ||
| 23841 | pub const __builtin_ve_vl_vfmkwgtnan_mvml = struct { | |
| 23842 | const param_str = "V256bV256dV256bUi"; | |
| 23843 | const target_set = TargetSet.init(.{ | |
| 23844 | .vevl_gen = true, | |
| 23845 | }); | |
| 23846 | const attributes = Attributes{}; | |
| 23847 | }; | |
| 23848 | ||
| 23849 | pub const __builtin_ve_vl_vfmkwle_mvl = struct { | |
| 23850 | const param_str = "V256bV256dUi"; | |
| 23851 | const target_set = TargetSet.init(.{ | |
| 23852 | .vevl_gen = true, | |
| 23853 | }); | |
| 23854 | const attributes = Attributes{}; | |
| 23855 | }; | |
| 23856 | ||
| 23857 | pub const __builtin_ve_vl_vfmkwle_mvml = struct { | |
| 23858 | const param_str = "V256bV256dV256bUi"; | |
| 23859 | const target_set = TargetSet.init(.{ | |
| 23860 | .vevl_gen = true, | |
| 23861 | }); | |
| 23862 | const attributes = Attributes{}; | |
| 23863 | }; | |
| 23864 | ||
| 23865 | pub const __builtin_ve_vl_vfmkwlenan_mvl = struct { | |
| 23866 | const param_str = "V256bV256dUi"; | |
| 23867 | const target_set = TargetSet.init(.{ | |
| 23868 | .vevl_gen = true, | |
| 23869 | }); | |
| 23870 | const attributes = Attributes{}; | |
| 23871 | }; | |
| 23872 | ||
| 23873 | pub const __builtin_ve_vl_vfmkwlenan_mvml = struct { | |
| 23874 | const param_str = "V256bV256dV256bUi"; | |
| 23875 | const target_set = TargetSet.init(.{ | |
| 23876 | .vevl_gen = true, | |
| 23877 | }); | |
| 23878 | const attributes = Attributes{}; | |
| 23879 | }; | |
| 23880 | ||
| 23881 | pub const __builtin_ve_vl_vfmkwlt_mvl = struct { | |
| 23882 | const param_str = "V256bV256dUi"; | |
| 23883 | const target_set = TargetSet.init(.{ | |
| 23884 | .vevl_gen = true, | |
| 23885 | }); | |
| 23886 | const attributes = Attributes{}; | |
| 23887 | }; | |
| 23888 | ||
| 23889 | pub const __builtin_ve_vl_vfmkwlt_mvml = struct { | |
| 23890 | const param_str = "V256bV256dV256bUi"; | |
| 23891 | const target_set = TargetSet.init(.{ | |
| 23892 | .vevl_gen = true, | |
| 23893 | }); | |
| 23894 | const attributes = Attributes{}; | |
| 23895 | }; | |
| 23896 | ||
| 23897 | pub const __builtin_ve_vl_vfmkwltnan_mvl = struct { | |
| 23898 | const param_str = "V256bV256dUi"; | |
| 23899 | const target_set = TargetSet.init(.{ | |
| 23900 | .vevl_gen = true, | |
| 23901 | }); | |
| 23902 | const attributes = Attributes{}; | |
| 23903 | }; | |
| 23904 | ||
| 23905 | pub const __builtin_ve_vl_vfmkwltnan_mvml = struct { | |
| 23906 | const param_str = "V256bV256dV256bUi"; | |
| 23907 | const target_set = TargetSet.init(.{ | |
| 23908 | .vevl_gen = true, | |
| 23909 | }); | |
| 23910 | const attributes = Attributes{}; | |
| 23911 | }; | |
| 23912 | ||
| 23913 | pub const __builtin_ve_vl_vfmkwnan_mvl = struct { | |
| 23914 | const param_str = "V256bV256dUi"; | |
| 23915 | const target_set = TargetSet.init(.{ | |
| 23916 | .vevl_gen = true, | |
| 23917 | }); | |
| 23918 | const attributes = Attributes{}; | |
| 23919 | }; | |
| 23920 | ||
| 23921 | pub const __builtin_ve_vl_vfmkwnan_mvml = struct { | |
| 23922 | const param_str = "V256bV256dV256bUi"; | |
| 23923 | const target_set = TargetSet.init(.{ | |
| 23924 | .vevl_gen = true, | |
| 23925 | }); | |
| 23926 | const attributes = Attributes{}; | |
| 23927 | }; | |
| 23928 | ||
| 23929 | pub const __builtin_ve_vl_vfmkwne_mvl = struct { | |
| 23930 | const param_str = "V256bV256dUi"; | |
| 23931 | const target_set = TargetSet.init(.{ | |
| 23932 | .vevl_gen = true, | |
| 23933 | }); | |
| 23934 | const attributes = Attributes{}; | |
| 23935 | }; | |
| 23936 | ||
| 23937 | pub const __builtin_ve_vl_vfmkwne_mvml = struct { | |
| 23938 | const param_str = "V256bV256dV256bUi"; | |
| 23939 | const target_set = TargetSet.init(.{ | |
| 23940 | .vevl_gen = true, | |
| 23941 | }); | |
| 23942 | const attributes = Attributes{}; | |
| 23943 | }; | |
| 23944 | ||
| 23945 | pub const __builtin_ve_vl_vfmkwnenan_mvl = struct { | |
| 23946 | const param_str = "V256bV256dUi"; | |
| 23947 | const target_set = TargetSet.init(.{ | |
| 23948 | .vevl_gen = true, | |
| 23949 | }); | |
| 23950 | const attributes = Attributes{}; | |
| 23951 | }; | |
| 23952 | ||
| 23953 | pub const __builtin_ve_vl_vfmkwnenan_mvml = struct { | |
| 23954 | const param_str = "V256bV256dV256bUi"; | |
| 23955 | const target_set = TargetSet.init(.{ | |
| 23956 | .vevl_gen = true, | |
| 23957 | }); | |
| 23958 | const attributes = Attributes{}; | |
| 23959 | }; | |
| 23960 | ||
| 23961 | pub const __builtin_ve_vl_vfmkwnum_mvl = struct { | |
| 23962 | const param_str = "V256bV256dUi"; | |
| 23963 | const target_set = TargetSet.init(.{ | |
| 23964 | .vevl_gen = true, | |
| 23965 | }); | |
| 23966 | const attributes = Attributes{}; | |
| 23967 | }; | |
| 23968 | ||
| 23969 | pub const __builtin_ve_vl_vfmkwnum_mvml = struct { | |
| 23970 | const param_str = "V256bV256dV256bUi"; | |
| 23971 | const target_set = TargetSet.init(.{ | |
| 23972 | .vevl_gen = true, | |
| 23973 | }); | |
| 23974 | const attributes = Attributes{}; | |
| 23975 | }; | |
| 23976 | ||
| 23977 | pub const __builtin_ve_vl_vfmsbd_vsvvl = struct { | |
| 23978 | const param_str = "V256ddV256dV256dUi"; | |
| 23979 | const target_set = TargetSet.init(.{ | |
| 23980 | .vevl_gen = true, | |
| 23981 | }); | |
| 23982 | const attributes = Attributes{}; | |
| 23983 | }; | |
| 23984 | ||
| 23985 | pub const __builtin_ve_vl_vfmsbd_vsvvmvl = struct { | |
| 23986 | const param_str = "V256ddV256dV256dV256bV256dUi"; | |
| 23987 | const target_set = TargetSet.init(.{ | |
| 23988 | .vevl_gen = true, | |
| 23989 | }); | |
| 23990 | const attributes = Attributes{}; | |
| 23991 | }; | |
| 23992 | ||
| 23993 | pub const __builtin_ve_vl_vfmsbd_vsvvvl = struct { | |
| 23994 | const param_str = "V256ddV256dV256dV256dUi"; | |
| 23995 | const target_set = TargetSet.init(.{ | |
| 23996 | .vevl_gen = true, | |
| 23997 | }); | |
| 23998 | const attributes = Attributes{}; | |
| 23999 | }; | |
| 24000 | ||
| 24001 | pub const __builtin_ve_vl_vfmsbd_vvsvl = struct { | |
| 24002 | const param_str = "V256dV256ddV256dUi"; | |
| 24003 | const target_set = TargetSet.init(.{ | |
| 24004 | .vevl_gen = true, | |
| 24005 | }); | |
| 24006 | const attributes = Attributes{}; | |
| 24007 | }; | |
| 24008 | ||
| 24009 | pub const __builtin_ve_vl_vfmsbd_vvsvmvl = struct { | |
| 24010 | const param_str = "V256dV256ddV256dV256bV256dUi"; | |
| 24011 | const target_set = TargetSet.init(.{ | |
| 24012 | .vevl_gen = true, | |
| 24013 | }); | |
| 24014 | const attributes = Attributes{}; | |
| 24015 | }; | |
| 24016 | ||
| 24017 | pub const __builtin_ve_vl_vfmsbd_vvsvvl = struct { | |
| 24018 | const param_str = "V256dV256ddV256dV256dUi"; | |
| 24019 | const target_set = TargetSet.init(.{ | |
| 24020 | .vevl_gen = true, | |
| 24021 | }); | |
| 24022 | const attributes = Attributes{}; | |
| 24023 | }; | |
| 24024 | ||
| 24025 | pub const __builtin_ve_vl_vfmsbd_vvvvl = struct { | |
| 24026 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24027 | const target_set = TargetSet.init(.{ | |
| 24028 | .vevl_gen = true, | |
| 24029 | }); | |
| 24030 | const attributes = Attributes{}; | |
| 24031 | }; | |
| 24032 | ||
| 24033 | pub const __builtin_ve_vl_vfmsbd_vvvvmvl = struct { | |
| 24034 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 24035 | const target_set = TargetSet.init(.{ | |
| 24036 | .vevl_gen = true, | |
| 24037 | }); | |
| 24038 | const attributes = Attributes{}; | |
| 24039 | }; | |
| 24040 | ||
| 24041 | pub const __builtin_ve_vl_vfmsbd_vvvvvl = struct { | |
| 24042 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 24043 | const target_set = TargetSet.init(.{ | |
| 24044 | .vevl_gen = true, | |
| 24045 | }); | |
| 24046 | const attributes = Attributes{}; | |
| 24047 | }; | |
| 24048 | ||
| 24049 | pub const __builtin_ve_vl_vfmsbs_vsvvl = struct { | |
| 24050 | const param_str = "V256dfV256dV256dUi"; | |
| 24051 | const target_set = TargetSet.init(.{ | |
| 24052 | .vevl_gen = true, | |
| 24053 | }); | |
| 24054 | const attributes = Attributes{}; | |
| 24055 | }; | |
| 24056 | ||
| 24057 | pub const __builtin_ve_vl_vfmsbs_vsvvmvl = struct { | |
| 24058 | const param_str = "V256dfV256dV256dV256bV256dUi"; | |
| 24059 | const target_set = TargetSet.init(.{ | |
| 24060 | .vevl_gen = true, | |
| 24061 | }); | |
| 24062 | const attributes = Attributes{}; | |
| 24063 | }; | |
| 24064 | ||
| 24065 | pub const __builtin_ve_vl_vfmsbs_vsvvvl = struct { | |
| 24066 | const param_str = "V256dfV256dV256dV256dUi"; | |
| 24067 | const target_set = TargetSet.init(.{ | |
| 24068 | .vevl_gen = true, | |
| 24069 | }); | |
| 24070 | const attributes = Attributes{}; | |
| 24071 | }; | |
| 24072 | ||
| 24073 | pub const __builtin_ve_vl_vfmsbs_vvsvl = struct { | |
| 24074 | const param_str = "V256dV256dfV256dUi"; | |
| 24075 | const target_set = TargetSet.init(.{ | |
| 24076 | .vevl_gen = true, | |
| 24077 | }); | |
| 24078 | const attributes = Attributes{}; | |
| 24079 | }; | |
| 24080 | ||
| 24081 | pub const __builtin_ve_vl_vfmsbs_vvsvmvl = struct { | |
| 24082 | const param_str = "V256dV256dfV256dV256bV256dUi"; | |
| 24083 | const target_set = TargetSet.init(.{ | |
| 24084 | .vevl_gen = true, | |
| 24085 | }); | |
| 24086 | const attributes = Attributes{}; | |
| 24087 | }; | |
| 24088 | ||
| 24089 | pub const __builtin_ve_vl_vfmsbs_vvsvvl = struct { | |
| 24090 | const param_str = "V256dV256dfV256dV256dUi"; | |
| 24091 | const target_set = TargetSet.init(.{ | |
| 24092 | .vevl_gen = true, | |
| 24093 | }); | |
| 24094 | const attributes = Attributes{}; | |
| 24095 | }; | |
| 24096 | ||
| 24097 | pub const __builtin_ve_vl_vfmsbs_vvvvl = struct { | |
| 24098 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24099 | const target_set = TargetSet.init(.{ | |
| 24100 | .vevl_gen = true, | |
| 24101 | }); | |
| 24102 | const attributes = Attributes{}; | |
| 24103 | }; | |
| 24104 | ||
| 24105 | pub const __builtin_ve_vl_vfmsbs_vvvvmvl = struct { | |
| 24106 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 24107 | const target_set = TargetSet.init(.{ | |
| 24108 | .vevl_gen = true, | |
| 24109 | }); | |
| 24110 | const attributes = Attributes{}; | |
| 24111 | }; | |
| 24112 | ||
| 24113 | pub const __builtin_ve_vl_vfmsbs_vvvvvl = struct { | |
| 24114 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 24115 | const target_set = TargetSet.init(.{ | |
| 24116 | .vevl_gen = true, | |
| 24117 | }); | |
| 24118 | const attributes = Attributes{}; | |
| 24119 | }; | |
| 24120 | ||
| 24121 | pub const __builtin_ve_vl_vfmuld_vsvl = struct { | |
| 24122 | const param_str = "V256ddV256dUi"; | |
| 24123 | const target_set = TargetSet.init(.{ | |
| 24124 | .vevl_gen = true, | |
| 24125 | }); | |
| 24126 | const attributes = Attributes{}; | |
| 24127 | }; | |
| 24128 | ||
| 24129 | pub const __builtin_ve_vl_vfmuld_vsvmvl = struct { | |
| 24130 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 24131 | const target_set = TargetSet.init(.{ | |
| 24132 | .vevl_gen = true, | |
| 24133 | }); | |
| 24134 | const attributes = Attributes{}; | |
| 24135 | }; | |
| 24136 | ||
| 24137 | pub const __builtin_ve_vl_vfmuld_vsvvl = struct { | |
| 24138 | const param_str = "V256ddV256dV256dUi"; | |
| 24139 | const target_set = TargetSet.init(.{ | |
| 24140 | .vevl_gen = true, | |
| 24141 | }); | |
| 24142 | const attributes = Attributes{}; | |
| 24143 | }; | |
| 24144 | ||
| 24145 | pub const __builtin_ve_vl_vfmuld_vvvl = struct { | |
| 24146 | const param_str = "V256dV256dV256dUi"; | |
| 24147 | const target_set = TargetSet.init(.{ | |
| 24148 | .vevl_gen = true, | |
| 24149 | }); | |
| 24150 | const attributes = Attributes{}; | |
| 24151 | }; | |
| 24152 | ||
| 24153 | pub const __builtin_ve_vl_vfmuld_vvvmvl = struct { | |
| 24154 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 24155 | const target_set = TargetSet.init(.{ | |
| 24156 | .vevl_gen = true, | |
| 24157 | }); | |
| 24158 | const attributes = Attributes{}; | |
| 24159 | }; | |
| 24160 | ||
| 24161 | pub const __builtin_ve_vl_vfmuld_vvvvl = struct { | |
| 24162 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24163 | const target_set = TargetSet.init(.{ | |
| 24164 | .vevl_gen = true, | |
| 24165 | }); | |
| 24166 | const attributes = Attributes{}; | |
| 24167 | }; | |
| 24168 | ||
| 24169 | pub const __builtin_ve_vl_vfmuls_vsvl = struct { | |
| 24170 | const param_str = "V256dfV256dUi"; | |
| 24171 | const target_set = TargetSet.init(.{ | |
| 24172 | .vevl_gen = true, | |
| 24173 | }); | |
| 24174 | const attributes = Attributes{}; | |
| 24175 | }; | |
| 24176 | ||
| 24177 | pub const __builtin_ve_vl_vfmuls_vsvmvl = struct { | |
| 24178 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 24179 | const target_set = TargetSet.init(.{ | |
| 24180 | .vevl_gen = true, | |
| 24181 | }); | |
| 24182 | const attributes = Attributes{}; | |
| 24183 | }; | |
| 24184 | ||
| 24185 | pub const __builtin_ve_vl_vfmuls_vsvvl = struct { | |
| 24186 | const param_str = "V256dfV256dV256dUi"; | |
| 24187 | const target_set = TargetSet.init(.{ | |
| 24188 | .vevl_gen = true, | |
| 24189 | }); | |
| 24190 | const attributes = Attributes{}; | |
| 24191 | }; | |
| 24192 | ||
| 24193 | pub const __builtin_ve_vl_vfmuls_vvvl = struct { | |
| 24194 | const param_str = "V256dV256dV256dUi"; | |
| 24195 | const target_set = TargetSet.init(.{ | |
| 24196 | .vevl_gen = true, | |
| 24197 | }); | |
| 24198 | const attributes = Attributes{}; | |
| 24199 | }; | |
| 24200 | ||
| 24201 | pub const __builtin_ve_vl_vfmuls_vvvmvl = struct { | |
| 24202 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 24203 | const target_set = TargetSet.init(.{ | |
| 24204 | .vevl_gen = true, | |
| 24205 | }); | |
| 24206 | const attributes = Attributes{}; | |
| 24207 | }; | |
| 24208 | ||
| 24209 | pub const __builtin_ve_vl_vfmuls_vvvvl = struct { | |
| 24210 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24211 | const target_set = TargetSet.init(.{ | |
| 24212 | .vevl_gen = true, | |
| 24213 | }); | |
| 24214 | const attributes = Attributes{}; | |
| 24215 | }; | |
| 24216 | ||
| 24217 | pub const __builtin_ve_vl_vfnmadd_vsvvl = struct { | |
| 24218 | const param_str = "V256ddV256dV256dUi"; | |
| 24219 | const target_set = TargetSet.init(.{ | |
| 24220 | .vevl_gen = true, | |
| 24221 | }); | |
| 24222 | const attributes = Attributes{}; | |
| 24223 | }; | |
| 24224 | ||
| 24225 | pub const __builtin_ve_vl_vfnmadd_vsvvmvl = struct { | |
| 24226 | const param_str = "V256ddV256dV256dV256bV256dUi"; | |
| 24227 | const target_set = TargetSet.init(.{ | |
| 24228 | .vevl_gen = true, | |
| 24229 | }); | |
| 24230 | const attributes = Attributes{}; | |
| 24231 | }; | |
| 24232 | ||
| 24233 | pub const __builtin_ve_vl_vfnmadd_vsvvvl = struct { | |
| 24234 | const param_str = "V256ddV256dV256dV256dUi"; | |
| 24235 | const target_set = TargetSet.init(.{ | |
| 24236 | .vevl_gen = true, | |
| 24237 | }); | |
| 24238 | const attributes = Attributes{}; | |
| 24239 | }; | |
| 24240 | ||
| 24241 | pub const __builtin_ve_vl_vfnmadd_vvsvl = struct { | |
| 24242 | const param_str = "V256dV256ddV256dUi"; | |
| 24243 | const target_set = TargetSet.init(.{ | |
| 24244 | .vevl_gen = true, | |
| 24245 | }); | |
| 24246 | const attributes = Attributes{}; | |
| 24247 | }; | |
| 24248 | ||
| 24249 | pub const __builtin_ve_vl_vfnmadd_vvsvmvl = struct { | |
| 24250 | const param_str = "V256dV256ddV256dV256bV256dUi"; | |
| 24251 | const target_set = TargetSet.init(.{ | |
| 24252 | .vevl_gen = true, | |
| 24253 | }); | |
| 24254 | const attributes = Attributes{}; | |
| 24255 | }; | |
| 24256 | ||
| 24257 | pub const __builtin_ve_vl_vfnmadd_vvsvvl = struct { | |
| 24258 | const param_str = "V256dV256ddV256dV256dUi"; | |
| 24259 | const target_set = TargetSet.init(.{ | |
| 24260 | .vevl_gen = true, | |
| 24261 | }); | |
| 24262 | const attributes = Attributes{}; | |
| 24263 | }; | |
| 24264 | ||
| 24265 | pub const __builtin_ve_vl_vfnmadd_vvvvl = struct { | |
| 24266 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24267 | const target_set = TargetSet.init(.{ | |
| 24268 | .vevl_gen = true, | |
| 24269 | }); | |
| 24270 | const attributes = Attributes{}; | |
| 24271 | }; | |
| 24272 | ||
| 24273 | pub const __builtin_ve_vl_vfnmadd_vvvvmvl = struct { | |
| 24274 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 24275 | const target_set = TargetSet.init(.{ | |
| 24276 | .vevl_gen = true, | |
| 24277 | }); | |
| 24278 | const attributes = Attributes{}; | |
| 24279 | }; | |
| 24280 | ||
| 24281 | pub const __builtin_ve_vl_vfnmadd_vvvvvl = struct { | |
| 24282 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 24283 | const target_set = TargetSet.init(.{ | |
| 24284 | .vevl_gen = true, | |
| 24285 | }); | |
| 24286 | const attributes = Attributes{}; | |
| 24287 | }; | |
| 24288 | ||
| 24289 | pub const __builtin_ve_vl_vfnmads_vsvvl = struct { | |
| 24290 | const param_str = "V256dfV256dV256dUi"; | |
| 24291 | const target_set = TargetSet.init(.{ | |
| 24292 | .vevl_gen = true, | |
| 24293 | }); | |
| 24294 | const attributes = Attributes{}; | |
| 24295 | }; | |
| 24296 | ||
| 24297 | pub const __builtin_ve_vl_vfnmads_vsvvmvl = struct { | |
| 24298 | const param_str = "V256dfV256dV256dV256bV256dUi"; | |
| 24299 | const target_set = TargetSet.init(.{ | |
| 24300 | .vevl_gen = true, | |
| 24301 | }); | |
| 24302 | const attributes = Attributes{}; | |
| 24303 | }; | |
| 24304 | ||
| 24305 | pub const __builtin_ve_vl_vfnmads_vsvvvl = struct { | |
| 24306 | const param_str = "V256dfV256dV256dV256dUi"; | |
| 24307 | const target_set = TargetSet.init(.{ | |
| 24308 | .vevl_gen = true, | |
| 24309 | }); | |
| 24310 | const attributes = Attributes{}; | |
| 24311 | }; | |
| 24312 | ||
| 24313 | pub const __builtin_ve_vl_vfnmads_vvsvl = struct { | |
| 24314 | const param_str = "V256dV256dfV256dUi"; | |
| 24315 | const target_set = TargetSet.init(.{ | |
| 24316 | .vevl_gen = true, | |
| 24317 | }); | |
| 24318 | const attributes = Attributes{}; | |
| 24319 | }; | |
| 24320 | ||
| 24321 | pub const __builtin_ve_vl_vfnmads_vvsvmvl = struct { | |
| 24322 | const param_str = "V256dV256dfV256dV256bV256dUi"; | |
| 24323 | const target_set = TargetSet.init(.{ | |
| 24324 | .vevl_gen = true, | |
| 24325 | }); | |
| 24326 | const attributes = Attributes{}; | |
| 24327 | }; | |
| 24328 | ||
| 24329 | pub const __builtin_ve_vl_vfnmads_vvsvvl = struct { | |
| 24330 | const param_str = "V256dV256dfV256dV256dUi"; | |
| 24331 | const target_set = TargetSet.init(.{ | |
| 24332 | .vevl_gen = true, | |
| 24333 | }); | |
| 24334 | const attributes = Attributes{}; | |
| 24335 | }; | |
| 24336 | ||
| 24337 | pub const __builtin_ve_vl_vfnmads_vvvvl = struct { | |
| 24338 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24339 | const target_set = TargetSet.init(.{ | |
| 24340 | .vevl_gen = true, | |
| 24341 | }); | |
| 24342 | const attributes = Attributes{}; | |
| 24343 | }; | |
| 24344 | ||
| 24345 | pub const __builtin_ve_vl_vfnmads_vvvvmvl = struct { | |
| 24346 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 24347 | const target_set = TargetSet.init(.{ | |
| 24348 | .vevl_gen = true, | |
| 24349 | }); | |
| 24350 | const attributes = Attributes{}; | |
| 24351 | }; | |
| 24352 | ||
| 24353 | pub const __builtin_ve_vl_vfnmads_vvvvvl = struct { | |
| 24354 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 24355 | const target_set = TargetSet.init(.{ | |
| 24356 | .vevl_gen = true, | |
| 24357 | }); | |
| 24358 | const attributes = Attributes{}; | |
| 24359 | }; | |
| 24360 | ||
| 24361 | pub const __builtin_ve_vl_vfnmsbd_vsvvl = struct { | |
| 24362 | const param_str = "V256ddV256dV256dUi"; | |
| 24363 | const target_set = TargetSet.init(.{ | |
| 24364 | .vevl_gen = true, | |
| 24365 | }); | |
| 24366 | const attributes = Attributes{}; | |
| 24367 | }; | |
| 24368 | ||
| 24369 | pub const __builtin_ve_vl_vfnmsbd_vsvvmvl = struct { | |
| 24370 | const param_str = "V256ddV256dV256dV256bV256dUi"; | |
| 24371 | const target_set = TargetSet.init(.{ | |
| 24372 | .vevl_gen = true, | |
| 24373 | }); | |
| 24374 | const attributes = Attributes{}; | |
| 24375 | }; | |
| 24376 | ||
| 24377 | pub const __builtin_ve_vl_vfnmsbd_vsvvvl = struct { | |
| 24378 | const param_str = "V256ddV256dV256dV256dUi"; | |
| 24379 | const target_set = TargetSet.init(.{ | |
| 24380 | .vevl_gen = true, | |
| 24381 | }); | |
| 24382 | const attributes = Attributes{}; | |
| 24383 | }; | |
| 24384 | ||
| 24385 | pub const __builtin_ve_vl_vfnmsbd_vvsvl = struct { | |
| 24386 | const param_str = "V256dV256ddV256dUi"; | |
| 24387 | const target_set = TargetSet.init(.{ | |
| 24388 | .vevl_gen = true, | |
| 24389 | }); | |
| 24390 | const attributes = Attributes{}; | |
| 24391 | }; | |
| 24392 | ||
| 24393 | pub const __builtin_ve_vl_vfnmsbd_vvsvmvl = struct { | |
| 24394 | const param_str = "V256dV256ddV256dV256bV256dUi"; | |
| 24395 | const target_set = TargetSet.init(.{ | |
| 24396 | .vevl_gen = true, | |
| 24397 | }); | |
| 24398 | const attributes = Attributes{}; | |
| 24399 | }; | |
| 24400 | ||
| 24401 | pub const __builtin_ve_vl_vfnmsbd_vvsvvl = struct { | |
| 24402 | const param_str = "V256dV256ddV256dV256dUi"; | |
| 24403 | const target_set = TargetSet.init(.{ | |
| 24404 | .vevl_gen = true, | |
| 24405 | }); | |
| 24406 | const attributes = Attributes{}; | |
| 24407 | }; | |
| 24408 | ||
| 24409 | pub const __builtin_ve_vl_vfnmsbd_vvvvl = struct { | |
| 24410 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24411 | const target_set = TargetSet.init(.{ | |
| 24412 | .vevl_gen = true, | |
| 24413 | }); | |
| 24414 | const attributes = Attributes{}; | |
| 24415 | }; | |
| 24416 | ||
| 24417 | pub const __builtin_ve_vl_vfnmsbd_vvvvmvl = struct { | |
| 24418 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 24419 | const target_set = TargetSet.init(.{ | |
| 24420 | .vevl_gen = true, | |
| 24421 | }); | |
| 24422 | const attributes = Attributes{}; | |
| 24423 | }; | |
| 24424 | ||
| 24425 | pub const __builtin_ve_vl_vfnmsbd_vvvvvl = struct { | |
| 24426 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 24427 | const target_set = TargetSet.init(.{ | |
| 24428 | .vevl_gen = true, | |
| 24429 | }); | |
| 24430 | const attributes = Attributes{}; | |
| 24431 | }; | |
| 24432 | ||
| 24433 | pub const __builtin_ve_vl_vfnmsbs_vsvvl = struct { | |
| 24434 | const param_str = "V256dfV256dV256dUi"; | |
| 24435 | const target_set = TargetSet.init(.{ | |
| 24436 | .vevl_gen = true, | |
| 24437 | }); | |
| 24438 | const attributes = Attributes{}; | |
| 24439 | }; | |
| 24440 | ||
| 24441 | pub const __builtin_ve_vl_vfnmsbs_vsvvmvl = struct { | |
| 24442 | const param_str = "V256dfV256dV256dV256bV256dUi"; | |
| 24443 | const target_set = TargetSet.init(.{ | |
| 24444 | .vevl_gen = true, | |
| 24445 | }); | |
| 24446 | const attributes = Attributes{}; | |
| 24447 | }; | |
| 24448 | ||
| 24449 | pub const __builtin_ve_vl_vfnmsbs_vsvvvl = struct { | |
| 24450 | const param_str = "V256dfV256dV256dV256dUi"; | |
| 24451 | const target_set = TargetSet.init(.{ | |
| 24452 | .vevl_gen = true, | |
| 24453 | }); | |
| 24454 | const attributes = Attributes{}; | |
| 24455 | }; | |
| 24456 | ||
| 24457 | pub const __builtin_ve_vl_vfnmsbs_vvsvl = struct { | |
| 24458 | const param_str = "V256dV256dfV256dUi"; | |
| 24459 | const target_set = TargetSet.init(.{ | |
| 24460 | .vevl_gen = true, | |
| 24461 | }); | |
| 24462 | const attributes = Attributes{}; | |
| 24463 | }; | |
| 24464 | ||
| 24465 | pub const __builtin_ve_vl_vfnmsbs_vvsvmvl = struct { | |
| 24466 | const param_str = "V256dV256dfV256dV256bV256dUi"; | |
| 24467 | const target_set = TargetSet.init(.{ | |
| 24468 | .vevl_gen = true, | |
| 24469 | }); | |
| 24470 | const attributes = Attributes{}; | |
| 24471 | }; | |
| 24472 | ||
| 24473 | pub const __builtin_ve_vl_vfnmsbs_vvsvvl = struct { | |
| 24474 | const param_str = "V256dV256dfV256dV256dUi"; | |
| 24475 | const target_set = TargetSet.init(.{ | |
| 24476 | .vevl_gen = true, | |
| 24477 | }); | |
| 24478 | const attributes = Attributes{}; | |
| 24479 | }; | |
| 24480 | ||
| 24481 | pub const __builtin_ve_vl_vfnmsbs_vvvvl = struct { | |
| 24482 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24483 | const target_set = TargetSet.init(.{ | |
| 24484 | .vevl_gen = true, | |
| 24485 | }); | |
| 24486 | const attributes = Attributes{}; | |
| 24487 | }; | |
| 24488 | ||
| 24489 | pub const __builtin_ve_vl_vfnmsbs_vvvvmvl = struct { | |
| 24490 | const param_str = "V256dV256dV256dV256dV256bV256dUi"; | |
| 24491 | const target_set = TargetSet.init(.{ | |
| 24492 | .vevl_gen = true, | |
| 24493 | }); | |
| 24494 | const attributes = Attributes{}; | |
| 24495 | }; | |
| 24496 | ||
| 24497 | pub const __builtin_ve_vl_vfnmsbs_vvvvvl = struct { | |
| 24498 | const param_str = "V256dV256dV256dV256dV256dUi"; | |
| 24499 | const target_set = TargetSet.init(.{ | |
| 24500 | .vevl_gen = true, | |
| 24501 | }); | |
| 24502 | const attributes = Attributes{}; | |
| 24503 | }; | |
| 24504 | ||
| 24505 | pub const __builtin_ve_vl_vfrmaxdfst_vvl = struct { | |
| 24506 | const param_str = "V256dV256dUi"; | |
| 24507 | const target_set = TargetSet.init(.{ | |
| 24508 | .vevl_gen = true, | |
| 24509 | }); | |
| 24510 | const attributes = Attributes{}; | |
| 24511 | }; | |
| 24512 | ||
| 24513 | pub const __builtin_ve_vl_vfrmaxdfst_vvvl = struct { | |
| 24514 | const param_str = "V256dV256dV256dUi"; | |
| 24515 | const target_set = TargetSet.init(.{ | |
| 24516 | .vevl_gen = true, | |
| 24517 | }); | |
| 24518 | const attributes = Attributes{}; | |
| 24519 | }; | |
| 24520 | ||
| 24521 | pub const __builtin_ve_vl_vfrmaxdlst_vvl = struct { | |
| 24522 | const param_str = "V256dV256dUi"; | |
| 24523 | const target_set = TargetSet.init(.{ | |
| 24524 | .vevl_gen = true, | |
| 24525 | }); | |
| 24526 | const attributes = Attributes{}; | |
| 24527 | }; | |
| 24528 | ||
| 24529 | pub const __builtin_ve_vl_vfrmaxdlst_vvvl = struct { | |
| 24530 | const param_str = "V256dV256dV256dUi"; | |
| 24531 | const target_set = TargetSet.init(.{ | |
| 24532 | .vevl_gen = true, | |
| 24533 | }); | |
| 24534 | const attributes = Attributes{}; | |
| 24535 | }; | |
| 24536 | ||
| 24537 | pub const __builtin_ve_vl_vfrmaxsfst_vvl = struct { | |
| 24538 | const param_str = "V256dV256dUi"; | |
| 24539 | const target_set = TargetSet.init(.{ | |
| 24540 | .vevl_gen = true, | |
| 24541 | }); | |
| 24542 | const attributes = Attributes{}; | |
| 24543 | }; | |
| 24544 | ||
| 24545 | pub const __builtin_ve_vl_vfrmaxsfst_vvvl = struct { | |
| 24546 | const param_str = "V256dV256dV256dUi"; | |
| 24547 | const target_set = TargetSet.init(.{ | |
| 24548 | .vevl_gen = true, | |
| 24549 | }); | |
| 24550 | const attributes = Attributes{}; | |
| 24551 | }; | |
| 24552 | ||
| 24553 | pub const __builtin_ve_vl_vfrmaxslst_vvl = struct { | |
| 24554 | const param_str = "V256dV256dUi"; | |
| 24555 | const target_set = TargetSet.init(.{ | |
| 24556 | .vevl_gen = true, | |
| 24557 | }); | |
| 24558 | const attributes = Attributes{}; | |
| 24559 | }; | |
| 24560 | ||
| 24561 | pub const __builtin_ve_vl_vfrmaxslst_vvvl = struct { | |
| 24562 | const param_str = "V256dV256dV256dUi"; | |
| 24563 | const target_set = TargetSet.init(.{ | |
| 24564 | .vevl_gen = true, | |
| 24565 | }); | |
| 24566 | const attributes = Attributes{}; | |
| 24567 | }; | |
| 24568 | ||
| 24569 | pub const __builtin_ve_vl_vfrmindfst_vvl = struct { | |
| 24570 | const param_str = "V256dV256dUi"; | |
| 24571 | const target_set = TargetSet.init(.{ | |
| 24572 | .vevl_gen = true, | |
| 24573 | }); | |
| 24574 | const attributes = Attributes{}; | |
| 24575 | }; | |
| 24576 | ||
| 24577 | pub const __builtin_ve_vl_vfrmindfst_vvvl = struct { | |
| 24578 | const param_str = "V256dV256dV256dUi"; | |
| 24579 | const target_set = TargetSet.init(.{ | |
| 24580 | .vevl_gen = true, | |
| 24581 | }); | |
| 24582 | const attributes = Attributes{}; | |
| 24583 | }; | |
| 24584 | ||
| 24585 | pub const __builtin_ve_vl_vfrmindlst_vvl = struct { | |
| 24586 | const param_str = "V256dV256dUi"; | |
| 24587 | const target_set = TargetSet.init(.{ | |
| 24588 | .vevl_gen = true, | |
| 24589 | }); | |
| 24590 | const attributes = Attributes{}; | |
| 24591 | }; | |
| 24592 | ||
| 24593 | pub const __builtin_ve_vl_vfrmindlst_vvvl = struct { | |
| 24594 | const param_str = "V256dV256dV256dUi"; | |
| 24595 | const target_set = TargetSet.init(.{ | |
| 24596 | .vevl_gen = true, | |
| 24597 | }); | |
| 24598 | const attributes = Attributes{}; | |
| 24599 | }; | |
| 24600 | ||
| 24601 | pub const __builtin_ve_vl_vfrminsfst_vvl = struct { | |
| 24602 | const param_str = "V256dV256dUi"; | |
| 24603 | const target_set = TargetSet.init(.{ | |
| 24604 | .vevl_gen = true, | |
| 24605 | }); | |
| 24606 | const attributes = Attributes{}; | |
| 24607 | }; | |
| 24608 | ||
| 24609 | pub const __builtin_ve_vl_vfrminsfst_vvvl = struct { | |
| 24610 | const param_str = "V256dV256dV256dUi"; | |
| 24611 | const target_set = TargetSet.init(.{ | |
| 24612 | .vevl_gen = true, | |
| 24613 | }); | |
| 24614 | const attributes = Attributes{}; | |
| 24615 | }; | |
| 24616 | ||
| 24617 | pub const __builtin_ve_vl_vfrminslst_vvl = struct { | |
| 24618 | const param_str = "V256dV256dUi"; | |
| 24619 | const target_set = TargetSet.init(.{ | |
| 24620 | .vevl_gen = true, | |
| 24621 | }); | |
| 24622 | const attributes = Attributes{}; | |
| 24623 | }; | |
| 24624 | ||
| 24625 | pub const __builtin_ve_vl_vfrminslst_vvvl = struct { | |
| 24626 | const param_str = "V256dV256dV256dUi"; | |
| 24627 | const target_set = TargetSet.init(.{ | |
| 24628 | .vevl_gen = true, | |
| 24629 | }); | |
| 24630 | const attributes = Attributes{}; | |
| 24631 | }; | |
| 24632 | ||
| 24633 | pub const __builtin_ve_vl_vfsqrtd_vvl = struct { | |
| 24634 | const param_str = "V256dV256dUi"; | |
| 24635 | const target_set = TargetSet.init(.{ | |
| 24636 | .vevl_gen = true, | |
| 24637 | }); | |
| 24638 | const attributes = Attributes{}; | |
| 24639 | }; | |
| 24640 | ||
| 24641 | pub const __builtin_ve_vl_vfsqrtd_vvvl = struct { | |
| 24642 | const param_str = "V256dV256dV256dUi"; | |
| 24643 | const target_set = TargetSet.init(.{ | |
| 24644 | .vevl_gen = true, | |
| 24645 | }); | |
| 24646 | const attributes = Attributes{}; | |
| 24647 | }; | |
| 24648 | ||
| 24649 | pub const __builtin_ve_vl_vfsqrts_vvl = struct { | |
| 24650 | const param_str = "V256dV256dUi"; | |
| 24651 | const target_set = TargetSet.init(.{ | |
| 24652 | .vevl_gen = true, | |
| 24653 | }); | |
| 24654 | const attributes = Attributes{}; | |
| 24655 | }; | |
| 24656 | ||
| 24657 | pub const __builtin_ve_vl_vfsqrts_vvvl = struct { | |
| 24658 | const param_str = "V256dV256dV256dUi"; | |
| 24659 | const target_set = TargetSet.init(.{ | |
| 24660 | .vevl_gen = true, | |
| 24661 | }); | |
| 24662 | const attributes = Attributes{}; | |
| 24663 | }; | |
| 24664 | ||
| 24665 | pub const __builtin_ve_vl_vfsubd_vsvl = struct { | |
| 24666 | const param_str = "V256ddV256dUi"; | |
| 24667 | const target_set = TargetSet.init(.{ | |
| 24668 | .vevl_gen = true, | |
| 24669 | }); | |
| 24670 | const attributes = Attributes{}; | |
| 24671 | }; | |
| 24672 | ||
| 24673 | pub const __builtin_ve_vl_vfsubd_vsvmvl = struct { | |
| 24674 | const param_str = "V256ddV256dV256bV256dUi"; | |
| 24675 | const target_set = TargetSet.init(.{ | |
| 24676 | .vevl_gen = true, | |
| 24677 | }); | |
| 24678 | const attributes = Attributes{}; | |
| 24679 | }; | |
| 24680 | ||
| 24681 | pub const __builtin_ve_vl_vfsubd_vsvvl = struct { | |
| 24682 | const param_str = "V256ddV256dV256dUi"; | |
| 24683 | const target_set = TargetSet.init(.{ | |
| 24684 | .vevl_gen = true, | |
| 24685 | }); | |
| 24686 | const attributes = Attributes{}; | |
| 24687 | }; | |
| 24688 | ||
| 24689 | pub const __builtin_ve_vl_vfsubd_vvvl = struct { | |
| 24690 | const param_str = "V256dV256dV256dUi"; | |
| 24691 | const target_set = TargetSet.init(.{ | |
| 24692 | .vevl_gen = true, | |
| 24693 | }); | |
| 24694 | const attributes = Attributes{}; | |
| 24695 | }; | |
| 24696 | ||
| 24697 | pub const __builtin_ve_vl_vfsubd_vvvmvl = struct { | |
| 24698 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 24699 | const target_set = TargetSet.init(.{ | |
| 24700 | .vevl_gen = true, | |
| 24701 | }); | |
| 24702 | const attributes = Attributes{}; | |
| 24703 | }; | |
| 24704 | ||
| 24705 | pub const __builtin_ve_vl_vfsubd_vvvvl = struct { | |
| 24706 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24707 | const target_set = TargetSet.init(.{ | |
| 24708 | .vevl_gen = true, | |
| 24709 | }); | |
| 24710 | const attributes = Attributes{}; | |
| 24711 | }; | |
| 24712 | ||
| 24713 | pub const __builtin_ve_vl_vfsubs_vsvl = struct { | |
| 24714 | const param_str = "V256dfV256dUi"; | |
| 24715 | const target_set = TargetSet.init(.{ | |
| 24716 | .vevl_gen = true, | |
| 24717 | }); | |
| 24718 | const attributes = Attributes{}; | |
| 24719 | }; | |
| 24720 | ||
| 24721 | pub const __builtin_ve_vl_vfsubs_vsvmvl = struct { | |
| 24722 | const param_str = "V256dfV256dV256bV256dUi"; | |
| 24723 | const target_set = TargetSet.init(.{ | |
| 24724 | .vevl_gen = true, | |
| 24725 | }); | |
| 24726 | const attributes = Attributes{}; | |
| 24727 | }; | |
| 24728 | ||
| 24729 | pub const __builtin_ve_vl_vfsubs_vsvvl = struct { | |
| 24730 | const param_str = "V256dfV256dV256dUi"; | |
| 24731 | const target_set = TargetSet.init(.{ | |
| 24732 | .vevl_gen = true, | |
| 24733 | }); | |
| 24734 | const attributes = Attributes{}; | |
| 24735 | }; | |
| 24736 | ||
| 24737 | pub const __builtin_ve_vl_vfsubs_vvvl = struct { | |
| 24738 | const param_str = "V256dV256dV256dUi"; | |
| 24739 | const target_set = TargetSet.init(.{ | |
| 24740 | .vevl_gen = true, | |
| 24741 | }); | |
| 24742 | const attributes = Attributes{}; | |
| 24743 | }; | |
| 24744 | ||
| 24745 | pub const __builtin_ve_vl_vfsubs_vvvmvl = struct { | |
| 24746 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 24747 | const target_set = TargetSet.init(.{ | |
| 24748 | .vevl_gen = true, | |
| 24749 | }); | |
| 24750 | const attributes = Attributes{}; | |
| 24751 | }; | |
| 24752 | ||
| 24753 | pub const __builtin_ve_vl_vfsubs_vvvvl = struct { | |
| 24754 | const param_str = "V256dV256dV256dV256dUi"; | |
| 24755 | const target_set = TargetSet.init(.{ | |
| 24756 | .vevl_gen = true, | |
| 24757 | }); | |
| 24758 | const attributes = Attributes{}; | |
| 24759 | }; | |
| 24760 | ||
| 24761 | pub const __builtin_ve_vl_vfsumd_vvl = struct { | |
| 24762 | const param_str = "V256dV256dUi"; | |
| 24763 | const target_set = TargetSet.init(.{ | |
| 24764 | .vevl_gen = true, | |
| 24765 | }); | |
| 24766 | const attributes = Attributes{}; | |
| 24767 | }; | |
| 24768 | ||
| 24769 | pub const __builtin_ve_vl_vfsumd_vvml = struct { | |
| 24770 | const param_str = "V256dV256dV256bUi"; | |
| 24771 | const target_set = TargetSet.init(.{ | |
| 24772 | .vevl_gen = true, | |
| 24773 | }); | |
| 24774 | const attributes = Attributes{}; | |
| 24775 | }; | |
| 24776 | ||
| 24777 | pub const __builtin_ve_vl_vfsums_vvl = struct { | |
| 24778 | const param_str = "V256dV256dUi"; | |
| 24779 | const target_set = TargetSet.init(.{ | |
| 24780 | .vevl_gen = true, | |
| 24781 | }); | |
| 24782 | const attributes = Attributes{}; | |
| 24783 | }; | |
| 24784 | ||
| 24785 | pub const __builtin_ve_vl_vfsums_vvml = struct { | |
| 24786 | const param_str = "V256dV256dV256bUi"; | |
| 24787 | const target_set = TargetSet.init(.{ | |
| 24788 | .vevl_gen = true, | |
| 24789 | }); | |
| 24790 | const attributes = Attributes{}; | |
| 24791 | }; | |
| 24792 | ||
| 24793 | pub const __builtin_ve_vl_vgt_vvssl = struct { | |
| 24794 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24795 | const target_set = TargetSet.init(.{ | |
| 24796 | .vevl_gen = true, | |
| 24797 | }); | |
| 24798 | const attributes = Attributes{}; | |
| 24799 | }; | |
| 24800 | ||
| 24801 | pub const __builtin_ve_vl_vgt_vvssml = struct { | |
| 24802 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24803 | const target_set = TargetSet.init(.{ | |
| 24804 | .vevl_gen = true, | |
| 24805 | }); | |
| 24806 | const attributes = Attributes{}; | |
| 24807 | }; | |
| 24808 | ||
| 24809 | pub const __builtin_ve_vl_vgt_vvssmvl = struct { | |
| 24810 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 24811 | const target_set = TargetSet.init(.{ | |
| 24812 | .vevl_gen = true, | |
| 24813 | }); | |
| 24814 | const attributes = Attributes{}; | |
| 24815 | }; | |
| 24816 | ||
| 24817 | pub const __builtin_ve_vl_vgt_vvssvl = struct { | |
| 24818 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 24819 | const target_set = TargetSet.init(.{ | |
| 24820 | .vevl_gen = true, | |
| 24821 | }); | |
| 24822 | const attributes = Attributes{}; | |
| 24823 | }; | |
| 24824 | ||
| 24825 | pub const __builtin_ve_vl_vgtlsx_vvssl = struct { | |
| 24826 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24827 | const target_set = TargetSet.init(.{ | |
| 24828 | .vevl_gen = true, | |
| 24829 | }); | |
| 24830 | const attributes = Attributes{}; | |
| 24831 | }; | |
| 24832 | ||
| 24833 | pub const __builtin_ve_vl_vgtlsx_vvssml = struct { | |
| 24834 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24835 | const target_set = TargetSet.init(.{ | |
| 24836 | .vevl_gen = true, | |
| 24837 | }); | |
| 24838 | const attributes = Attributes{}; | |
| 24839 | }; | |
| 24840 | ||
| 24841 | pub const __builtin_ve_vl_vgtlsx_vvssmvl = struct { | |
| 24842 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 24843 | const target_set = TargetSet.init(.{ | |
| 24844 | .vevl_gen = true, | |
| 24845 | }); | |
| 24846 | const attributes = Attributes{}; | |
| 24847 | }; | |
| 24848 | ||
| 24849 | pub const __builtin_ve_vl_vgtlsx_vvssvl = struct { | |
| 24850 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 24851 | const target_set = TargetSet.init(.{ | |
| 24852 | .vevl_gen = true, | |
| 24853 | }); | |
| 24854 | const attributes = Attributes{}; | |
| 24855 | }; | |
| 24856 | ||
| 24857 | pub const __builtin_ve_vl_vgtlsxnc_vvssl = struct { | |
| 24858 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24859 | const target_set = TargetSet.init(.{ | |
| 24860 | .vevl_gen = true, | |
| 24861 | }); | |
| 24862 | const attributes = Attributes{}; | |
| 24863 | }; | |
| 24864 | ||
| 24865 | pub const __builtin_ve_vl_vgtlsxnc_vvssml = struct { | |
| 24866 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24867 | const target_set = TargetSet.init(.{ | |
| 24868 | .vevl_gen = true, | |
| 24869 | }); | |
| 24870 | const attributes = Attributes{}; | |
| 24871 | }; | |
| 24872 | ||
| 24873 | pub const __builtin_ve_vl_vgtlsxnc_vvssmvl = struct { | |
| 24874 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 24875 | const target_set = TargetSet.init(.{ | |
| 24876 | .vevl_gen = true, | |
| 24877 | }); | |
| 24878 | const attributes = Attributes{}; | |
| 24879 | }; | |
| 24880 | ||
| 24881 | pub const __builtin_ve_vl_vgtlsxnc_vvssvl = struct { | |
| 24882 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 24883 | const target_set = TargetSet.init(.{ | |
| 24884 | .vevl_gen = true, | |
| 24885 | }); | |
| 24886 | const attributes = Attributes{}; | |
| 24887 | }; | |
| 24888 | ||
| 24889 | pub const __builtin_ve_vl_vgtlzx_vvssl = struct { | |
| 24890 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24891 | const target_set = TargetSet.init(.{ | |
| 24892 | .vevl_gen = true, | |
| 24893 | }); | |
| 24894 | const attributes = Attributes{}; | |
| 24895 | }; | |
| 24896 | ||
| 24897 | pub const __builtin_ve_vl_vgtlzx_vvssml = struct { | |
| 24898 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24899 | const target_set = TargetSet.init(.{ | |
| 24900 | .vevl_gen = true, | |
| 24901 | }); | |
| 24902 | const attributes = Attributes{}; | |
| 24903 | }; | |
| 24904 | ||
| 24905 | pub const __builtin_ve_vl_vgtlzx_vvssmvl = struct { | |
| 24906 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 24907 | const target_set = TargetSet.init(.{ | |
| 24908 | .vevl_gen = true, | |
| 24909 | }); | |
| 24910 | const attributes = Attributes{}; | |
| 24911 | }; | |
| 24912 | ||
| 24913 | pub const __builtin_ve_vl_vgtlzx_vvssvl = struct { | |
| 24914 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 24915 | const target_set = TargetSet.init(.{ | |
| 24916 | .vevl_gen = true, | |
| 24917 | }); | |
| 24918 | const attributes = Attributes{}; | |
| 24919 | }; | |
| 24920 | ||
| 24921 | pub const __builtin_ve_vl_vgtlzxnc_vvssl = struct { | |
| 24922 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24923 | const target_set = TargetSet.init(.{ | |
| 24924 | .vevl_gen = true, | |
| 24925 | }); | |
| 24926 | const attributes = Attributes{}; | |
| 24927 | }; | |
| 24928 | ||
| 24929 | pub const __builtin_ve_vl_vgtlzxnc_vvssml = struct { | |
| 24930 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24931 | const target_set = TargetSet.init(.{ | |
| 24932 | .vevl_gen = true, | |
| 24933 | }); | |
| 24934 | const attributes = Attributes{}; | |
| 24935 | }; | |
| 24936 | ||
| 24937 | pub const __builtin_ve_vl_vgtlzxnc_vvssmvl = struct { | |
| 24938 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 24939 | const target_set = TargetSet.init(.{ | |
| 24940 | .vevl_gen = true, | |
| 24941 | }); | |
| 24942 | const attributes = Attributes{}; | |
| 24943 | }; | |
| 24944 | ||
| 24945 | pub const __builtin_ve_vl_vgtlzxnc_vvssvl = struct { | |
| 24946 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 24947 | const target_set = TargetSet.init(.{ | |
| 24948 | .vevl_gen = true, | |
| 24949 | }); | |
| 24950 | const attributes = Attributes{}; | |
| 24951 | }; | |
| 24952 | ||
| 24953 | pub const __builtin_ve_vl_vgtnc_vvssl = struct { | |
| 24954 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24955 | const target_set = TargetSet.init(.{ | |
| 24956 | .vevl_gen = true, | |
| 24957 | }); | |
| 24958 | const attributes = Attributes{}; | |
| 24959 | }; | |
| 24960 | ||
| 24961 | pub const __builtin_ve_vl_vgtnc_vvssml = struct { | |
| 24962 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24963 | const target_set = TargetSet.init(.{ | |
| 24964 | .vevl_gen = true, | |
| 24965 | }); | |
| 24966 | const attributes = Attributes{}; | |
| 24967 | }; | |
| 24968 | ||
| 24969 | pub const __builtin_ve_vl_vgtnc_vvssmvl = struct { | |
| 24970 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 24971 | const target_set = TargetSet.init(.{ | |
| 24972 | .vevl_gen = true, | |
| 24973 | }); | |
| 24974 | const attributes = Attributes{}; | |
| 24975 | }; | |
| 24976 | ||
| 24977 | pub const __builtin_ve_vl_vgtnc_vvssvl = struct { | |
| 24978 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 24979 | const target_set = TargetSet.init(.{ | |
| 24980 | .vevl_gen = true, | |
| 24981 | }); | |
| 24982 | const attributes = Attributes{}; | |
| 24983 | }; | |
| 24984 | ||
| 24985 | pub const __builtin_ve_vl_vgtu_vvssl = struct { | |
| 24986 | const param_str = "V256dV256dLUiLUiUi"; | |
| 24987 | const target_set = TargetSet.init(.{ | |
| 24988 | .vevl_gen = true, | |
| 24989 | }); | |
| 24990 | const attributes = Attributes{}; | |
| 24991 | }; | |
| 24992 | ||
| 24993 | pub const __builtin_ve_vl_vgtu_vvssml = struct { | |
| 24994 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 24995 | const target_set = TargetSet.init(.{ | |
| 24996 | .vevl_gen = true, | |
| 24997 | }); | |
| 24998 | const attributes = Attributes{}; | |
| 24999 | }; | |
| 25000 | ||
| 25001 | pub const __builtin_ve_vl_vgtu_vvssmvl = struct { | |
| 25002 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 25003 | const target_set = TargetSet.init(.{ | |
| 25004 | .vevl_gen = true, | |
| 25005 | }); | |
| 25006 | const attributes = Attributes{}; | |
| 25007 | }; | |
| 25008 | ||
| 25009 | pub const __builtin_ve_vl_vgtu_vvssvl = struct { | |
| 25010 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 25011 | const target_set = TargetSet.init(.{ | |
| 25012 | .vevl_gen = true, | |
| 25013 | }); | |
| 25014 | const attributes = Attributes{}; | |
| 25015 | }; | |
| 25016 | ||
| 25017 | pub const __builtin_ve_vl_vgtunc_vvssl = struct { | |
| 25018 | const param_str = "V256dV256dLUiLUiUi"; | |
| 25019 | const target_set = TargetSet.init(.{ | |
| 25020 | .vevl_gen = true, | |
| 25021 | }); | |
| 25022 | const attributes = Attributes{}; | |
| 25023 | }; | |
| 25024 | ||
| 25025 | pub const __builtin_ve_vl_vgtunc_vvssml = struct { | |
| 25026 | const param_str = "V256dV256dLUiLUiV256bUi"; | |
| 25027 | const target_set = TargetSet.init(.{ | |
| 25028 | .vevl_gen = true, | |
| 25029 | }); | |
| 25030 | const attributes = Attributes{}; | |
| 25031 | }; | |
| 25032 | ||
| 25033 | pub const __builtin_ve_vl_vgtunc_vvssmvl = struct { | |
| 25034 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 25035 | const target_set = TargetSet.init(.{ | |
| 25036 | .vevl_gen = true, | |
| 25037 | }); | |
| 25038 | const attributes = Attributes{}; | |
| 25039 | }; | |
| 25040 | ||
| 25041 | pub const __builtin_ve_vl_vgtunc_vvssvl = struct { | |
| 25042 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 25043 | const target_set = TargetSet.init(.{ | |
| 25044 | .vevl_gen = true, | |
| 25045 | }); | |
| 25046 | const attributes = Attributes{}; | |
| 25047 | }; | |
| 25048 | ||
| 25049 | pub const __builtin_ve_vl_vld2d_vssl = struct { | |
| 25050 | const param_str = "V256dLUivC*Ui"; | |
| 25051 | const target_set = TargetSet.init(.{ | |
| 25052 | .vevl_gen = true, | |
| 25053 | }); | |
| 25054 | const attributes = Attributes{}; | |
| 25055 | }; | |
| 25056 | ||
| 25057 | pub const __builtin_ve_vl_vld2d_vssvl = struct { | |
| 25058 | const param_str = "V256dLUivC*V256dUi"; | |
| 25059 | const target_set = TargetSet.init(.{ | |
| 25060 | .vevl_gen = true, | |
| 25061 | }); | |
| 25062 | const attributes = Attributes{}; | |
| 25063 | }; | |
| 25064 | ||
| 25065 | pub const __builtin_ve_vl_vld2dnc_vssl = struct { | |
| 25066 | const param_str = "V256dLUivC*Ui"; | |
| 25067 | const target_set = TargetSet.init(.{ | |
| 25068 | .vevl_gen = true, | |
| 25069 | }); | |
| 25070 | const attributes = Attributes{}; | |
| 25071 | }; | |
| 25072 | ||
| 25073 | pub const __builtin_ve_vl_vld2dnc_vssvl = struct { | |
| 25074 | const param_str = "V256dLUivC*V256dUi"; | |
| 25075 | const target_set = TargetSet.init(.{ | |
| 25076 | .vevl_gen = true, | |
| 25077 | }); | |
| 25078 | const attributes = Attributes{}; | |
| 25079 | }; | |
| 25080 | ||
| 25081 | pub const __builtin_ve_vl_vld_vssl = struct { | |
| 25082 | const param_str = "V256dLUivC*Ui"; | |
| 25083 | const target_set = TargetSet.init(.{ | |
| 25084 | .vevl_gen = true, | |
| 25085 | }); | |
| 25086 | const attributes = Attributes{}; | |
| 25087 | }; | |
| 25088 | ||
| 25089 | pub const __builtin_ve_vl_vld_vssvl = struct { | |
| 25090 | const param_str = "V256dLUivC*V256dUi"; | |
| 25091 | const target_set = TargetSet.init(.{ | |
| 25092 | .vevl_gen = true, | |
| 25093 | }); | |
| 25094 | const attributes = Attributes{}; | |
| 25095 | }; | |
| 25096 | ||
| 25097 | pub const __builtin_ve_vl_vldl2dsx_vssl = struct { | |
| 25098 | const param_str = "V256dLUivC*Ui"; | |
| 25099 | const target_set = TargetSet.init(.{ | |
| 25100 | .vevl_gen = true, | |
| 25101 | }); | |
| 25102 | const attributes = Attributes{}; | |
| 25103 | }; | |
| 25104 | ||
| 25105 | pub const __builtin_ve_vl_vldl2dsx_vssvl = struct { | |
| 25106 | const param_str = "V256dLUivC*V256dUi"; | |
| 25107 | const target_set = TargetSet.init(.{ | |
| 25108 | .vevl_gen = true, | |
| 25109 | }); | |
| 25110 | const attributes = Attributes{}; | |
| 25111 | }; | |
| 25112 | ||
| 25113 | pub const __builtin_ve_vl_vldl2dsxnc_vssl = struct { | |
| 25114 | const param_str = "V256dLUivC*Ui"; | |
| 25115 | const target_set = TargetSet.init(.{ | |
| 25116 | .vevl_gen = true, | |
| 25117 | }); | |
| 25118 | const attributes = Attributes{}; | |
| 25119 | }; | |
| 25120 | ||
| 25121 | pub const __builtin_ve_vl_vldl2dsxnc_vssvl = struct { | |
| 25122 | const param_str = "V256dLUivC*V256dUi"; | |
| 25123 | const target_set = TargetSet.init(.{ | |
| 25124 | .vevl_gen = true, | |
| 25125 | }); | |
| 25126 | const attributes = Attributes{}; | |
| 25127 | }; | |
| 25128 | ||
| 25129 | pub const __builtin_ve_vl_vldl2dzx_vssl = struct { | |
| 25130 | const param_str = "V256dLUivC*Ui"; | |
| 25131 | const target_set = TargetSet.init(.{ | |
| 25132 | .vevl_gen = true, | |
| 25133 | }); | |
| 25134 | const attributes = Attributes{}; | |
| 25135 | }; | |
| 25136 | ||
| 25137 | pub const __builtin_ve_vl_vldl2dzx_vssvl = struct { | |
| 25138 | const param_str = "V256dLUivC*V256dUi"; | |
| 25139 | const target_set = TargetSet.init(.{ | |
| 25140 | .vevl_gen = true, | |
| 25141 | }); | |
| 25142 | const attributes = Attributes{}; | |
| 25143 | }; | |
| 25144 | ||
| 25145 | pub const __builtin_ve_vl_vldl2dzxnc_vssl = struct { | |
| 25146 | const param_str = "V256dLUivC*Ui"; | |
| 25147 | const target_set = TargetSet.init(.{ | |
| 25148 | .vevl_gen = true, | |
| 25149 | }); | |
| 25150 | const attributes = Attributes{}; | |
| 25151 | }; | |
| 25152 | ||
| 25153 | pub const __builtin_ve_vl_vldl2dzxnc_vssvl = struct { | |
| 25154 | const param_str = "V256dLUivC*V256dUi"; | |
| 25155 | const target_set = TargetSet.init(.{ | |
| 25156 | .vevl_gen = true, | |
| 25157 | }); | |
| 25158 | const attributes = Attributes{}; | |
| 25159 | }; | |
| 25160 | ||
| 25161 | pub const __builtin_ve_vl_vldlsx_vssl = struct { | |
| 25162 | const param_str = "V256dLUivC*Ui"; | |
| 25163 | const target_set = TargetSet.init(.{ | |
| 25164 | .vevl_gen = true, | |
| 25165 | }); | |
| 25166 | const attributes = Attributes{}; | |
| 25167 | }; | |
| 25168 | ||
| 25169 | pub const __builtin_ve_vl_vldlsx_vssvl = struct { | |
| 25170 | const param_str = "V256dLUivC*V256dUi"; | |
| 25171 | const target_set = TargetSet.init(.{ | |
| 25172 | .vevl_gen = true, | |
| 25173 | }); | |
| 25174 | const attributes = Attributes{}; | |
| 25175 | }; | |
| 25176 | ||
| 25177 | pub const __builtin_ve_vl_vldlsxnc_vssl = struct { | |
| 25178 | const param_str = "V256dLUivC*Ui"; | |
| 25179 | const target_set = TargetSet.init(.{ | |
| 25180 | .vevl_gen = true, | |
| 25181 | }); | |
| 25182 | const attributes = Attributes{}; | |
| 25183 | }; | |
| 25184 | ||
| 25185 | pub const __builtin_ve_vl_vldlsxnc_vssvl = struct { | |
| 25186 | const param_str = "V256dLUivC*V256dUi"; | |
| 25187 | const target_set = TargetSet.init(.{ | |
| 25188 | .vevl_gen = true, | |
| 25189 | }); | |
| 25190 | const attributes = Attributes{}; | |
| 25191 | }; | |
| 25192 | ||
| 25193 | pub const __builtin_ve_vl_vldlzx_vssl = struct { | |
| 25194 | const param_str = "V256dLUivC*Ui"; | |
| 25195 | const target_set = TargetSet.init(.{ | |
| 25196 | .vevl_gen = true, | |
| 25197 | }); | |
| 25198 | const attributes = Attributes{}; | |
| 25199 | }; | |
| 25200 | ||
| 25201 | pub const __builtin_ve_vl_vldlzx_vssvl = struct { | |
| 25202 | const param_str = "V256dLUivC*V256dUi"; | |
| 25203 | const target_set = TargetSet.init(.{ | |
| 25204 | .vevl_gen = true, | |
| 25205 | }); | |
| 25206 | const attributes = Attributes{}; | |
| 25207 | }; | |
| 25208 | ||
| 25209 | pub const __builtin_ve_vl_vldlzxnc_vssl = struct { | |
| 25210 | const param_str = "V256dLUivC*Ui"; | |
| 25211 | const target_set = TargetSet.init(.{ | |
| 25212 | .vevl_gen = true, | |
| 25213 | }); | |
| 25214 | const attributes = Attributes{}; | |
| 25215 | }; | |
| 25216 | ||
| 25217 | pub const __builtin_ve_vl_vldlzxnc_vssvl = struct { | |
| 25218 | const param_str = "V256dLUivC*V256dUi"; | |
| 25219 | const target_set = TargetSet.init(.{ | |
| 25220 | .vevl_gen = true, | |
| 25221 | }); | |
| 25222 | const attributes = Attributes{}; | |
| 25223 | }; | |
| 25224 | ||
| 25225 | pub const __builtin_ve_vl_vldnc_vssl = struct { | |
| 25226 | const param_str = "V256dLUivC*Ui"; | |
| 25227 | const target_set = TargetSet.init(.{ | |
| 25228 | .vevl_gen = true, | |
| 25229 | }); | |
| 25230 | const attributes = Attributes{}; | |
| 25231 | }; | |
| 25232 | ||
| 25233 | pub const __builtin_ve_vl_vldnc_vssvl = struct { | |
| 25234 | const param_str = "V256dLUivC*V256dUi"; | |
| 25235 | const target_set = TargetSet.init(.{ | |
| 25236 | .vevl_gen = true, | |
| 25237 | }); | |
| 25238 | const attributes = Attributes{}; | |
| 25239 | }; | |
| 25240 | ||
| 25241 | pub const __builtin_ve_vl_vldu2d_vssl = struct { | |
| 25242 | const param_str = "V256dLUivC*Ui"; | |
| 25243 | const target_set = TargetSet.init(.{ | |
| 25244 | .vevl_gen = true, | |
| 25245 | }); | |
| 25246 | const attributes = Attributes{}; | |
| 25247 | }; | |
| 25248 | ||
| 25249 | pub const __builtin_ve_vl_vldu2d_vssvl = struct { | |
| 25250 | const param_str = "V256dLUivC*V256dUi"; | |
| 25251 | const target_set = TargetSet.init(.{ | |
| 25252 | .vevl_gen = true, | |
| 25253 | }); | |
| 25254 | const attributes = Attributes{}; | |
| 25255 | }; | |
| 25256 | ||
| 25257 | pub const __builtin_ve_vl_vldu2dnc_vssl = struct { | |
| 25258 | const param_str = "V256dLUivC*Ui"; | |
| 25259 | const target_set = TargetSet.init(.{ | |
| 25260 | .vevl_gen = true, | |
| 25261 | }); | |
| 25262 | const attributes = Attributes{}; | |
| 25263 | }; | |
| 25264 | ||
| 25265 | pub const __builtin_ve_vl_vldu2dnc_vssvl = struct { | |
| 25266 | const param_str = "V256dLUivC*V256dUi"; | |
| 25267 | const target_set = TargetSet.init(.{ | |
| 25268 | .vevl_gen = true, | |
| 25269 | }); | |
| 25270 | const attributes = Attributes{}; | |
| 25271 | }; | |
| 25272 | ||
| 25273 | pub const __builtin_ve_vl_vldu_vssl = struct { | |
| 25274 | const param_str = "V256dLUivC*Ui"; | |
| 25275 | const target_set = TargetSet.init(.{ | |
| 25276 | .vevl_gen = true, | |
| 25277 | }); | |
| 25278 | const attributes = Attributes{}; | |
| 25279 | }; | |
| 25280 | ||
| 25281 | pub const __builtin_ve_vl_vldu_vssvl = struct { | |
| 25282 | const param_str = "V256dLUivC*V256dUi"; | |
| 25283 | const target_set = TargetSet.init(.{ | |
| 25284 | .vevl_gen = true, | |
| 25285 | }); | |
| 25286 | const attributes = Attributes{}; | |
| 25287 | }; | |
| 25288 | ||
| 25289 | pub const __builtin_ve_vl_vldunc_vssl = struct { | |
| 25290 | const param_str = "V256dLUivC*Ui"; | |
| 25291 | const target_set = TargetSet.init(.{ | |
| 25292 | .vevl_gen = true, | |
| 25293 | }); | |
| 25294 | const attributes = Attributes{}; | |
| 25295 | }; | |
| 25296 | ||
| 25297 | pub const __builtin_ve_vl_vldunc_vssvl = struct { | |
| 25298 | const param_str = "V256dLUivC*V256dUi"; | |
| 25299 | const target_set = TargetSet.init(.{ | |
| 25300 | .vevl_gen = true, | |
| 25301 | }); | |
| 25302 | const attributes = Attributes{}; | |
| 25303 | }; | |
| 25304 | ||
| 25305 | pub const __builtin_ve_vl_vldz_vvl = struct { | |
| 25306 | const param_str = "V256dV256dUi"; | |
| 25307 | const target_set = TargetSet.init(.{ | |
| 25308 | .vevl_gen = true, | |
| 25309 | }); | |
| 25310 | const attributes = Attributes{}; | |
| 25311 | }; | |
| 25312 | ||
| 25313 | pub const __builtin_ve_vl_vldz_vvmvl = struct { | |
| 25314 | const param_str = "V256dV256dV256bV256dUi"; | |
| 25315 | const target_set = TargetSet.init(.{ | |
| 25316 | .vevl_gen = true, | |
| 25317 | }); | |
| 25318 | const attributes = Attributes{}; | |
| 25319 | }; | |
| 25320 | ||
| 25321 | pub const __builtin_ve_vl_vldz_vvvl = struct { | |
| 25322 | const param_str = "V256dV256dV256dUi"; | |
| 25323 | const target_set = TargetSet.init(.{ | |
| 25324 | .vevl_gen = true, | |
| 25325 | }); | |
| 25326 | const attributes = Attributes{}; | |
| 25327 | }; | |
| 25328 | ||
| 25329 | pub const __builtin_ve_vl_vmaxsl_vsvl = struct { | |
| 25330 | const param_str = "V256dLiV256dUi"; | |
| 25331 | const target_set = TargetSet.init(.{ | |
| 25332 | .vevl_gen = true, | |
| 25333 | }); | |
| 25334 | const attributes = Attributes{}; | |
| 25335 | }; | |
| 25336 | ||
| 25337 | pub const __builtin_ve_vl_vmaxsl_vsvmvl = struct { | |
| 25338 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 25339 | const target_set = TargetSet.init(.{ | |
| 25340 | .vevl_gen = true, | |
| 25341 | }); | |
| 25342 | const attributes = Attributes{}; | |
| 25343 | }; | |
| 25344 | ||
| 25345 | pub const __builtin_ve_vl_vmaxsl_vsvvl = struct { | |
| 25346 | const param_str = "V256dLiV256dV256dUi"; | |
| 25347 | const target_set = TargetSet.init(.{ | |
| 25348 | .vevl_gen = true, | |
| 25349 | }); | |
| 25350 | const attributes = Attributes{}; | |
| 25351 | }; | |
| 25352 | ||
| 25353 | pub const __builtin_ve_vl_vmaxsl_vvvl = struct { | |
| 25354 | const param_str = "V256dV256dV256dUi"; | |
| 25355 | const target_set = TargetSet.init(.{ | |
| 25356 | .vevl_gen = true, | |
| 25357 | }); | |
| 25358 | const attributes = Attributes{}; | |
| 25359 | }; | |
| 25360 | ||
| 25361 | pub const __builtin_ve_vl_vmaxsl_vvvmvl = struct { | |
| 25362 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25363 | const target_set = TargetSet.init(.{ | |
| 25364 | .vevl_gen = true, | |
| 25365 | }); | |
| 25366 | const attributes = Attributes{}; | |
| 25367 | }; | |
| 25368 | ||
| 25369 | pub const __builtin_ve_vl_vmaxsl_vvvvl = struct { | |
| 25370 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25371 | const target_set = TargetSet.init(.{ | |
| 25372 | .vevl_gen = true, | |
| 25373 | }); | |
| 25374 | const attributes = Attributes{}; | |
| 25375 | }; | |
| 25376 | ||
| 25377 | pub const __builtin_ve_vl_vmaxswsx_vsvl = struct { | |
| 25378 | const param_str = "V256diV256dUi"; | |
| 25379 | const target_set = TargetSet.init(.{ | |
| 25380 | .vevl_gen = true, | |
| 25381 | }); | |
| 25382 | const attributes = Attributes{}; | |
| 25383 | }; | |
| 25384 | ||
| 25385 | pub const __builtin_ve_vl_vmaxswsx_vsvmvl = struct { | |
| 25386 | const param_str = "V256diV256dV256bV256dUi"; | |
| 25387 | const target_set = TargetSet.init(.{ | |
| 25388 | .vevl_gen = true, | |
| 25389 | }); | |
| 25390 | const attributes = Attributes{}; | |
| 25391 | }; | |
| 25392 | ||
| 25393 | pub const __builtin_ve_vl_vmaxswsx_vsvvl = struct { | |
| 25394 | const param_str = "V256diV256dV256dUi"; | |
| 25395 | const target_set = TargetSet.init(.{ | |
| 25396 | .vevl_gen = true, | |
| 25397 | }); | |
| 25398 | const attributes = Attributes{}; | |
| 25399 | }; | |
| 25400 | ||
| 25401 | pub const __builtin_ve_vl_vmaxswsx_vvvl = struct { | |
| 25402 | const param_str = "V256dV256dV256dUi"; | |
| 25403 | const target_set = TargetSet.init(.{ | |
| 25404 | .vevl_gen = true, | |
| 25405 | }); | |
| 25406 | const attributes = Attributes{}; | |
| 25407 | }; | |
| 25408 | ||
| 25409 | pub const __builtin_ve_vl_vmaxswsx_vvvmvl = struct { | |
| 25410 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25411 | const target_set = TargetSet.init(.{ | |
| 25412 | .vevl_gen = true, | |
| 25413 | }); | |
| 25414 | const attributes = Attributes{}; | |
| 25415 | }; | |
| 25416 | ||
| 25417 | pub const __builtin_ve_vl_vmaxswsx_vvvvl = struct { | |
| 25418 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25419 | const target_set = TargetSet.init(.{ | |
| 25420 | .vevl_gen = true, | |
| 25421 | }); | |
| 25422 | const attributes = Attributes{}; | |
| 25423 | }; | |
| 25424 | ||
| 25425 | pub const __builtin_ve_vl_vmaxswzx_vsvl = struct { | |
| 25426 | const param_str = "V256diV256dUi"; | |
| 25427 | const target_set = TargetSet.init(.{ | |
| 25428 | .vevl_gen = true, | |
| 25429 | }); | |
| 25430 | const attributes = Attributes{}; | |
| 25431 | }; | |
| 25432 | ||
| 25433 | pub const __builtin_ve_vl_vmaxswzx_vsvmvl = struct { | |
| 25434 | const param_str = "V256diV256dV256bV256dUi"; | |
| 25435 | const target_set = TargetSet.init(.{ | |
| 25436 | .vevl_gen = true, | |
| 25437 | }); | |
| 25438 | const attributes = Attributes{}; | |
| 25439 | }; | |
| 25440 | ||
| 25441 | pub const __builtin_ve_vl_vmaxswzx_vsvvl = struct { | |
| 25442 | const param_str = "V256diV256dV256dUi"; | |
| 25443 | const target_set = TargetSet.init(.{ | |
| 25444 | .vevl_gen = true, | |
| 25445 | }); | |
| 25446 | const attributes = Attributes{}; | |
| 25447 | }; | |
| 25448 | ||
| 25449 | pub const __builtin_ve_vl_vmaxswzx_vvvl = struct { | |
| 25450 | const param_str = "V256dV256dV256dUi"; | |
| 25451 | const target_set = TargetSet.init(.{ | |
| 25452 | .vevl_gen = true, | |
| 25453 | }); | |
| 25454 | const attributes = Attributes{}; | |
| 25455 | }; | |
| 25456 | ||
| 25457 | pub const __builtin_ve_vl_vmaxswzx_vvvmvl = struct { | |
| 25458 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25459 | const target_set = TargetSet.init(.{ | |
| 25460 | .vevl_gen = true, | |
| 25461 | }); | |
| 25462 | const attributes = Attributes{}; | |
| 25463 | }; | |
| 25464 | ||
| 25465 | pub const __builtin_ve_vl_vmaxswzx_vvvvl = struct { | |
| 25466 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25467 | const target_set = TargetSet.init(.{ | |
| 25468 | .vevl_gen = true, | |
| 25469 | }); | |
| 25470 | const attributes = Attributes{}; | |
| 25471 | }; | |
| 25472 | ||
| 25473 | pub const __builtin_ve_vl_vminsl_vsvl = struct { | |
| 25474 | const param_str = "V256dLiV256dUi"; | |
| 25475 | const target_set = TargetSet.init(.{ | |
| 25476 | .vevl_gen = true, | |
| 25477 | }); | |
| 25478 | const attributes = Attributes{}; | |
| 25479 | }; | |
| 25480 | ||
| 25481 | pub const __builtin_ve_vl_vminsl_vsvmvl = struct { | |
| 25482 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 25483 | const target_set = TargetSet.init(.{ | |
| 25484 | .vevl_gen = true, | |
| 25485 | }); | |
| 25486 | const attributes = Attributes{}; | |
| 25487 | }; | |
| 25488 | ||
| 25489 | pub const __builtin_ve_vl_vminsl_vsvvl = struct { | |
| 25490 | const param_str = "V256dLiV256dV256dUi"; | |
| 25491 | const target_set = TargetSet.init(.{ | |
| 25492 | .vevl_gen = true, | |
| 25493 | }); | |
| 25494 | const attributes = Attributes{}; | |
| 25495 | }; | |
| 25496 | ||
| 25497 | pub const __builtin_ve_vl_vminsl_vvvl = struct { | |
| 25498 | const param_str = "V256dV256dV256dUi"; | |
| 25499 | const target_set = TargetSet.init(.{ | |
| 25500 | .vevl_gen = true, | |
| 25501 | }); | |
| 25502 | const attributes = Attributes{}; | |
| 25503 | }; | |
| 25504 | ||
| 25505 | pub const __builtin_ve_vl_vminsl_vvvmvl = struct { | |
| 25506 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25507 | const target_set = TargetSet.init(.{ | |
| 25508 | .vevl_gen = true, | |
| 25509 | }); | |
| 25510 | const attributes = Attributes{}; | |
| 25511 | }; | |
| 25512 | ||
| 25513 | pub const __builtin_ve_vl_vminsl_vvvvl = struct { | |
| 25514 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25515 | const target_set = TargetSet.init(.{ | |
| 25516 | .vevl_gen = true, | |
| 25517 | }); | |
| 25518 | const attributes = Attributes{}; | |
| 25519 | }; | |
| 25520 | ||
| 25521 | pub const __builtin_ve_vl_vminswsx_vsvl = struct { | |
| 25522 | const param_str = "V256diV256dUi"; | |
| 25523 | const target_set = TargetSet.init(.{ | |
| 25524 | .vevl_gen = true, | |
| 25525 | }); | |
| 25526 | const attributes = Attributes{}; | |
| 25527 | }; | |
| 25528 | ||
| 25529 | pub const __builtin_ve_vl_vminswsx_vsvmvl = struct { | |
| 25530 | const param_str = "V256diV256dV256bV256dUi"; | |
| 25531 | const target_set = TargetSet.init(.{ | |
| 25532 | .vevl_gen = true, | |
| 25533 | }); | |
| 25534 | const attributes = Attributes{}; | |
| 25535 | }; | |
| 25536 | ||
| 25537 | pub const __builtin_ve_vl_vminswsx_vsvvl = struct { | |
| 25538 | const param_str = "V256diV256dV256dUi"; | |
| 25539 | const target_set = TargetSet.init(.{ | |
| 25540 | .vevl_gen = true, | |
| 25541 | }); | |
| 25542 | const attributes = Attributes{}; | |
| 25543 | }; | |
| 25544 | ||
| 25545 | pub const __builtin_ve_vl_vminswsx_vvvl = struct { | |
| 25546 | const param_str = "V256dV256dV256dUi"; | |
| 25547 | const target_set = TargetSet.init(.{ | |
| 25548 | .vevl_gen = true, | |
| 25549 | }); | |
| 25550 | const attributes = Attributes{}; | |
| 25551 | }; | |
| 25552 | ||
| 25553 | pub const __builtin_ve_vl_vminswsx_vvvmvl = struct { | |
| 25554 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25555 | const target_set = TargetSet.init(.{ | |
| 25556 | .vevl_gen = true, | |
| 25557 | }); | |
| 25558 | const attributes = Attributes{}; | |
| 25559 | }; | |
| 25560 | ||
| 25561 | pub const __builtin_ve_vl_vminswsx_vvvvl = struct { | |
| 25562 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25563 | const target_set = TargetSet.init(.{ | |
| 25564 | .vevl_gen = true, | |
| 25565 | }); | |
| 25566 | const attributes = Attributes{}; | |
| 25567 | }; | |
| 25568 | ||
| 25569 | pub const __builtin_ve_vl_vminswzx_vsvl = struct { | |
| 25570 | const param_str = "V256diV256dUi"; | |
| 25571 | const target_set = TargetSet.init(.{ | |
| 25572 | .vevl_gen = true, | |
| 25573 | }); | |
| 25574 | const attributes = Attributes{}; | |
| 25575 | }; | |
| 25576 | ||
| 25577 | pub const __builtin_ve_vl_vminswzx_vsvmvl = struct { | |
| 25578 | const param_str = "V256diV256dV256bV256dUi"; | |
| 25579 | const target_set = TargetSet.init(.{ | |
| 25580 | .vevl_gen = true, | |
| 25581 | }); | |
| 25582 | const attributes = Attributes{}; | |
| 25583 | }; | |
| 25584 | ||
| 25585 | pub const __builtin_ve_vl_vminswzx_vsvvl = struct { | |
| 25586 | const param_str = "V256diV256dV256dUi"; | |
| 25587 | const target_set = TargetSet.init(.{ | |
| 25588 | .vevl_gen = true, | |
| 25589 | }); | |
| 25590 | const attributes = Attributes{}; | |
| 25591 | }; | |
| 25592 | ||
| 25593 | pub const __builtin_ve_vl_vminswzx_vvvl = struct { | |
| 25594 | const param_str = "V256dV256dV256dUi"; | |
| 25595 | const target_set = TargetSet.init(.{ | |
| 25596 | .vevl_gen = true, | |
| 25597 | }); | |
| 25598 | const attributes = Attributes{}; | |
| 25599 | }; | |
| 25600 | ||
| 25601 | pub const __builtin_ve_vl_vminswzx_vvvmvl = struct { | |
| 25602 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25603 | const target_set = TargetSet.init(.{ | |
| 25604 | .vevl_gen = true, | |
| 25605 | }); | |
| 25606 | const attributes = Attributes{}; | |
| 25607 | }; | |
| 25608 | ||
| 25609 | pub const __builtin_ve_vl_vminswzx_vvvvl = struct { | |
| 25610 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25611 | const target_set = TargetSet.init(.{ | |
| 25612 | .vevl_gen = true, | |
| 25613 | }); | |
| 25614 | const attributes = Attributes{}; | |
| 25615 | }; | |
| 25616 | ||
| 25617 | pub const __builtin_ve_vl_vmrg_vsvml = struct { | |
| 25618 | const param_str = "V256dLUiV256dV256bUi"; | |
| 25619 | const target_set = TargetSet.init(.{ | |
| 25620 | .vevl_gen = true, | |
| 25621 | }); | |
| 25622 | const attributes = Attributes{}; | |
| 25623 | }; | |
| 25624 | ||
| 25625 | pub const __builtin_ve_vl_vmrg_vsvmvl = struct { | |
| 25626 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 25627 | const target_set = TargetSet.init(.{ | |
| 25628 | .vevl_gen = true, | |
| 25629 | }); | |
| 25630 | const attributes = Attributes{}; | |
| 25631 | }; | |
| 25632 | ||
| 25633 | pub const __builtin_ve_vl_vmrg_vvvml = struct { | |
| 25634 | const param_str = "V256dV256dV256dV256bUi"; | |
| 25635 | const target_set = TargetSet.init(.{ | |
| 25636 | .vevl_gen = true, | |
| 25637 | }); | |
| 25638 | const attributes = Attributes{}; | |
| 25639 | }; | |
| 25640 | ||
| 25641 | pub const __builtin_ve_vl_vmrg_vvvmvl = struct { | |
| 25642 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25643 | const target_set = TargetSet.init(.{ | |
| 25644 | .vevl_gen = true, | |
| 25645 | }); | |
| 25646 | const attributes = Attributes{}; | |
| 25647 | }; | |
| 25648 | ||
| 25649 | pub const __builtin_ve_vl_vmrgw_vsvMl = struct { | |
| 25650 | const param_str = "V256dUiV256dV512bUi"; | |
| 25651 | const target_set = TargetSet.init(.{ | |
| 25652 | .vevl_gen = true, | |
| 25653 | }); | |
| 25654 | const attributes = Attributes{}; | |
| 25655 | }; | |
| 25656 | ||
| 25657 | pub const __builtin_ve_vl_vmrgw_vsvMvl = struct { | |
| 25658 | const param_str = "V256dUiV256dV512bV256dUi"; | |
| 25659 | const target_set = TargetSet.init(.{ | |
| 25660 | .vevl_gen = true, | |
| 25661 | }); | |
| 25662 | const attributes = Attributes{}; | |
| 25663 | }; | |
| 25664 | ||
| 25665 | pub const __builtin_ve_vl_vmrgw_vvvMl = struct { | |
| 25666 | const param_str = "V256dV256dV256dV512bUi"; | |
| 25667 | const target_set = TargetSet.init(.{ | |
| 25668 | .vevl_gen = true, | |
| 25669 | }); | |
| 25670 | const attributes = Attributes{}; | |
| 25671 | }; | |
| 25672 | ||
| 25673 | pub const __builtin_ve_vl_vmrgw_vvvMvl = struct { | |
| 25674 | const param_str = "V256dV256dV256dV512bV256dUi"; | |
| 25675 | const target_set = TargetSet.init(.{ | |
| 25676 | .vevl_gen = true, | |
| 25677 | }); | |
| 25678 | const attributes = Attributes{}; | |
| 25679 | }; | |
| 25680 | ||
| 25681 | pub const __builtin_ve_vl_vmulsl_vsvl = struct { | |
| 25682 | const param_str = "V256dLiV256dUi"; | |
| 25683 | const target_set = TargetSet.init(.{ | |
| 25684 | .vevl_gen = true, | |
| 25685 | }); | |
| 25686 | const attributes = Attributes{}; | |
| 25687 | }; | |
| 25688 | ||
| 25689 | pub const __builtin_ve_vl_vmulsl_vsvmvl = struct { | |
| 25690 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 25691 | const target_set = TargetSet.init(.{ | |
| 25692 | .vevl_gen = true, | |
| 25693 | }); | |
| 25694 | const attributes = Attributes{}; | |
| 25695 | }; | |
| 25696 | ||
| 25697 | pub const __builtin_ve_vl_vmulsl_vsvvl = struct { | |
| 25698 | const param_str = "V256dLiV256dV256dUi"; | |
| 25699 | const target_set = TargetSet.init(.{ | |
| 25700 | .vevl_gen = true, | |
| 25701 | }); | |
| 25702 | const attributes = Attributes{}; | |
| 25703 | }; | |
| 25704 | ||
| 25705 | pub const __builtin_ve_vl_vmulsl_vvvl = struct { | |
| 25706 | const param_str = "V256dV256dV256dUi"; | |
| 25707 | const target_set = TargetSet.init(.{ | |
| 25708 | .vevl_gen = true, | |
| 25709 | }); | |
| 25710 | const attributes = Attributes{}; | |
| 25711 | }; | |
| 25712 | ||
| 25713 | pub const __builtin_ve_vl_vmulsl_vvvmvl = struct { | |
| 25714 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25715 | const target_set = TargetSet.init(.{ | |
| 25716 | .vevl_gen = true, | |
| 25717 | }); | |
| 25718 | const attributes = Attributes{}; | |
| 25719 | }; | |
| 25720 | ||
| 25721 | pub const __builtin_ve_vl_vmulsl_vvvvl = struct { | |
| 25722 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25723 | const target_set = TargetSet.init(.{ | |
| 25724 | .vevl_gen = true, | |
| 25725 | }); | |
| 25726 | const attributes = Attributes{}; | |
| 25727 | }; | |
| 25728 | ||
| 25729 | pub const __builtin_ve_vl_vmulslw_vsvl = struct { | |
| 25730 | const param_str = "V256diV256dUi"; | |
| 25731 | const target_set = TargetSet.init(.{ | |
| 25732 | .vevl_gen = true, | |
| 25733 | }); | |
| 25734 | const attributes = Attributes{}; | |
| 25735 | }; | |
| 25736 | ||
| 25737 | pub const __builtin_ve_vl_vmulslw_vsvvl = struct { | |
| 25738 | const param_str = "V256diV256dV256dUi"; | |
| 25739 | const target_set = TargetSet.init(.{ | |
| 25740 | .vevl_gen = true, | |
| 25741 | }); | |
| 25742 | const attributes = Attributes{}; | |
| 25743 | }; | |
| 25744 | ||
| 25745 | pub const __builtin_ve_vl_vmulslw_vvvl = struct { | |
| 25746 | const param_str = "V256dV256dV256dUi"; | |
| 25747 | const target_set = TargetSet.init(.{ | |
| 25748 | .vevl_gen = true, | |
| 25749 | }); | |
| 25750 | const attributes = Attributes{}; | |
| 25751 | }; | |
| 25752 | ||
| 25753 | pub const __builtin_ve_vl_vmulslw_vvvvl = struct { | |
| 25754 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25755 | const target_set = TargetSet.init(.{ | |
| 25756 | .vevl_gen = true, | |
| 25757 | }); | |
| 25758 | const attributes = Attributes{}; | |
| 25759 | }; | |
| 25760 | ||
| 25761 | pub const __builtin_ve_vl_vmulswsx_vsvl = struct { | |
| 25762 | const param_str = "V256diV256dUi"; | |
| 25763 | const target_set = TargetSet.init(.{ | |
| 25764 | .vevl_gen = true, | |
| 25765 | }); | |
| 25766 | const attributes = Attributes{}; | |
| 25767 | }; | |
| 25768 | ||
| 25769 | pub const __builtin_ve_vl_vmulswsx_vsvmvl = struct { | |
| 25770 | const param_str = "V256diV256dV256bV256dUi"; | |
| 25771 | const target_set = TargetSet.init(.{ | |
| 25772 | .vevl_gen = true, | |
| 25773 | }); | |
| 25774 | const attributes = Attributes{}; | |
| 25775 | }; | |
| 25776 | ||
| 25777 | pub const __builtin_ve_vl_vmulswsx_vsvvl = struct { | |
| 25778 | const param_str = "V256diV256dV256dUi"; | |
| 25779 | const target_set = TargetSet.init(.{ | |
| 25780 | .vevl_gen = true, | |
| 25781 | }); | |
| 25782 | const attributes = Attributes{}; | |
| 25783 | }; | |
| 25784 | ||
| 25785 | pub const __builtin_ve_vl_vmulswsx_vvvl = struct { | |
| 25786 | const param_str = "V256dV256dV256dUi"; | |
| 25787 | const target_set = TargetSet.init(.{ | |
| 25788 | .vevl_gen = true, | |
| 25789 | }); | |
| 25790 | const attributes = Attributes{}; | |
| 25791 | }; | |
| 25792 | ||
| 25793 | pub const __builtin_ve_vl_vmulswsx_vvvmvl = struct { | |
| 25794 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25795 | const target_set = TargetSet.init(.{ | |
| 25796 | .vevl_gen = true, | |
| 25797 | }); | |
| 25798 | const attributes = Attributes{}; | |
| 25799 | }; | |
| 25800 | ||
| 25801 | pub const __builtin_ve_vl_vmulswsx_vvvvl = struct { | |
| 25802 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25803 | const target_set = TargetSet.init(.{ | |
| 25804 | .vevl_gen = true, | |
| 25805 | }); | |
| 25806 | const attributes = Attributes{}; | |
| 25807 | }; | |
| 25808 | ||
| 25809 | pub const __builtin_ve_vl_vmulswzx_vsvl = struct { | |
| 25810 | const param_str = "V256diV256dUi"; | |
| 25811 | const target_set = TargetSet.init(.{ | |
| 25812 | .vevl_gen = true, | |
| 25813 | }); | |
| 25814 | const attributes = Attributes{}; | |
| 25815 | }; | |
| 25816 | ||
| 25817 | pub const __builtin_ve_vl_vmulswzx_vsvmvl = struct { | |
| 25818 | const param_str = "V256diV256dV256bV256dUi"; | |
| 25819 | const target_set = TargetSet.init(.{ | |
| 25820 | .vevl_gen = true, | |
| 25821 | }); | |
| 25822 | const attributes = Attributes{}; | |
| 25823 | }; | |
| 25824 | ||
| 25825 | pub const __builtin_ve_vl_vmulswzx_vsvvl = struct { | |
| 25826 | const param_str = "V256diV256dV256dUi"; | |
| 25827 | const target_set = TargetSet.init(.{ | |
| 25828 | .vevl_gen = true, | |
| 25829 | }); | |
| 25830 | const attributes = Attributes{}; | |
| 25831 | }; | |
| 25832 | ||
| 25833 | pub const __builtin_ve_vl_vmulswzx_vvvl = struct { | |
| 25834 | const param_str = "V256dV256dV256dUi"; | |
| 25835 | const target_set = TargetSet.init(.{ | |
| 25836 | .vevl_gen = true, | |
| 25837 | }); | |
| 25838 | const attributes = Attributes{}; | |
| 25839 | }; | |
| 25840 | ||
| 25841 | pub const __builtin_ve_vl_vmulswzx_vvvmvl = struct { | |
| 25842 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25843 | const target_set = TargetSet.init(.{ | |
| 25844 | .vevl_gen = true, | |
| 25845 | }); | |
| 25846 | const attributes = Attributes{}; | |
| 25847 | }; | |
| 25848 | ||
| 25849 | pub const __builtin_ve_vl_vmulswzx_vvvvl = struct { | |
| 25850 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25851 | const target_set = TargetSet.init(.{ | |
| 25852 | .vevl_gen = true, | |
| 25853 | }); | |
| 25854 | const attributes = Attributes{}; | |
| 25855 | }; | |
| 25856 | ||
| 25857 | pub const __builtin_ve_vl_vmulul_vsvl = struct { | |
| 25858 | const param_str = "V256dLUiV256dUi"; | |
| 25859 | const target_set = TargetSet.init(.{ | |
| 25860 | .vevl_gen = true, | |
| 25861 | }); | |
| 25862 | const attributes = Attributes{}; | |
| 25863 | }; | |
| 25864 | ||
| 25865 | pub const __builtin_ve_vl_vmulul_vsvmvl = struct { | |
| 25866 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 25867 | const target_set = TargetSet.init(.{ | |
| 25868 | .vevl_gen = true, | |
| 25869 | }); | |
| 25870 | const attributes = Attributes{}; | |
| 25871 | }; | |
| 25872 | ||
| 25873 | pub const __builtin_ve_vl_vmulul_vsvvl = struct { | |
| 25874 | const param_str = "V256dLUiV256dV256dUi"; | |
| 25875 | const target_set = TargetSet.init(.{ | |
| 25876 | .vevl_gen = true, | |
| 25877 | }); | |
| 25878 | const attributes = Attributes{}; | |
| 25879 | }; | |
| 25880 | ||
| 25881 | pub const __builtin_ve_vl_vmulul_vvvl = struct { | |
| 25882 | const param_str = "V256dV256dV256dUi"; | |
| 25883 | const target_set = TargetSet.init(.{ | |
| 25884 | .vevl_gen = true, | |
| 25885 | }); | |
| 25886 | const attributes = Attributes{}; | |
| 25887 | }; | |
| 25888 | ||
| 25889 | pub const __builtin_ve_vl_vmulul_vvvmvl = struct { | |
| 25890 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25891 | const target_set = TargetSet.init(.{ | |
| 25892 | .vevl_gen = true, | |
| 25893 | }); | |
| 25894 | const attributes = Attributes{}; | |
| 25895 | }; | |
| 25896 | ||
| 25897 | pub const __builtin_ve_vl_vmulul_vvvvl = struct { | |
| 25898 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25899 | const target_set = TargetSet.init(.{ | |
| 25900 | .vevl_gen = true, | |
| 25901 | }); | |
| 25902 | const attributes = Attributes{}; | |
| 25903 | }; | |
| 25904 | ||
| 25905 | pub const __builtin_ve_vl_vmuluw_vsvl = struct { | |
| 25906 | const param_str = "V256dUiV256dUi"; | |
| 25907 | const target_set = TargetSet.init(.{ | |
| 25908 | .vevl_gen = true, | |
| 25909 | }); | |
| 25910 | const attributes = Attributes{}; | |
| 25911 | }; | |
| 25912 | ||
| 25913 | pub const __builtin_ve_vl_vmuluw_vsvmvl = struct { | |
| 25914 | const param_str = "V256dUiV256dV256bV256dUi"; | |
| 25915 | const target_set = TargetSet.init(.{ | |
| 25916 | .vevl_gen = true, | |
| 25917 | }); | |
| 25918 | const attributes = Attributes{}; | |
| 25919 | }; | |
| 25920 | ||
| 25921 | pub const __builtin_ve_vl_vmuluw_vsvvl = struct { | |
| 25922 | const param_str = "V256dUiV256dV256dUi"; | |
| 25923 | const target_set = TargetSet.init(.{ | |
| 25924 | .vevl_gen = true, | |
| 25925 | }); | |
| 25926 | const attributes = Attributes{}; | |
| 25927 | }; | |
| 25928 | ||
| 25929 | pub const __builtin_ve_vl_vmuluw_vvvl = struct { | |
| 25930 | const param_str = "V256dV256dV256dUi"; | |
| 25931 | const target_set = TargetSet.init(.{ | |
| 25932 | .vevl_gen = true, | |
| 25933 | }); | |
| 25934 | const attributes = Attributes{}; | |
| 25935 | }; | |
| 25936 | ||
| 25937 | pub const __builtin_ve_vl_vmuluw_vvvmvl = struct { | |
| 25938 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 25939 | const target_set = TargetSet.init(.{ | |
| 25940 | .vevl_gen = true, | |
| 25941 | }); | |
| 25942 | const attributes = Attributes{}; | |
| 25943 | }; | |
| 25944 | ||
| 25945 | pub const __builtin_ve_vl_vmuluw_vvvvl = struct { | |
| 25946 | const param_str = "V256dV256dV256dV256dUi"; | |
| 25947 | const target_set = TargetSet.init(.{ | |
| 25948 | .vevl_gen = true, | |
| 25949 | }); | |
| 25950 | const attributes = Attributes{}; | |
| 25951 | }; | |
| 25952 | ||
| 25953 | pub const __builtin_ve_vl_vmv_vsvl = struct { | |
| 25954 | const param_str = "V256dUiV256dUi"; | |
| 25955 | const target_set = TargetSet.init(.{ | |
| 25956 | .vevl_gen = true, | |
| 25957 | }); | |
| 25958 | const attributes = Attributes{}; | |
| 25959 | }; | |
| 25960 | ||
| 25961 | pub const __builtin_ve_vl_vmv_vsvmvl = struct { | |
| 25962 | const param_str = "V256dUiV256dV256bV256dUi"; | |
| 25963 | const target_set = TargetSet.init(.{ | |
| 25964 | .vevl_gen = true, | |
| 25965 | }); | |
| 25966 | const attributes = Attributes{}; | |
| 25967 | }; | |
| 25968 | ||
| 25969 | pub const __builtin_ve_vl_vmv_vsvvl = struct { | |
| 25970 | const param_str = "V256dUiV256dV256dUi"; | |
| 25971 | const target_set = TargetSet.init(.{ | |
| 25972 | .vevl_gen = true, | |
| 25973 | }); | |
| 25974 | const attributes = Attributes{}; | |
| 25975 | }; | |
| 25976 | ||
| 25977 | pub const __builtin_ve_vl_vor_vsvl = struct { | |
| 25978 | const param_str = "V256dLUiV256dUi"; | |
| 25979 | const target_set = TargetSet.init(.{ | |
| 25980 | .vevl_gen = true, | |
| 25981 | }); | |
| 25982 | const attributes = Attributes{}; | |
| 25983 | }; | |
| 25984 | ||
| 25985 | pub const __builtin_ve_vl_vor_vsvmvl = struct { | |
| 25986 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 25987 | const target_set = TargetSet.init(.{ | |
| 25988 | .vevl_gen = true, | |
| 25989 | }); | |
| 25990 | const attributes = Attributes{}; | |
| 25991 | }; | |
| 25992 | ||
| 25993 | pub const __builtin_ve_vl_vor_vsvvl = struct { | |
| 25994 | const param_str = "V256dLUiV256dV256dUi"; | |
| 25995 | const target_set = TargetSet.init(.{ | |
| 25996 | .vevl_gen = true, | |
| 25997 | }); | |
| 25998 | const attributes = Attributes{}; | |
| 25999 | }; | |
| 26000 | ||
| 26001 | pub const __builtin_ve_vl_vor_vvvl = struct { | |
| 26002 | const param_str = "V256dV256dV256dUi"; | |
| 26003 | const target_set = TargetSet.init(.{ | |
| 26004 | .vevl_gen = true, | |
| 26005 | }); | |
| 26006 | const attributes = Attributes{}; | |
| 26007 | }; | |
| 26008 | ||
| 26009 | pub const __builtin_ve_vl_vor_vvvmvl = struct { | |
| 26010 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26011 | const target_set = TargetSet.init(.{ | |
| 26012 | .vevl_gen = true, | |
| 26013 | }); | |
| 26014 | const attributes = Attributes{}; | |
| 26015 | }; | |
| 26016 | ||
| 26017 | pub const __builtin_ve_vl_vor_vvvvl = struct { | |
| 26018 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26019 | const target_set = TargetSet.init(.{ | |
| 26020 | .vevl_gen = true, | |
| 26021 | }); | |
| 26022 | const attributes = Attributes{}; | |
| 26023 | }; | |
| 26024 | ||
| 26025 | pub const __builtin_ve_vl_vpcnt_vvl = struct { | |
| 26026 | const param_str = "V256dV256dUi"; | |
| 26027 | const target_set = TargetSet.init(.{ | |
| 26028 | .vevl_gen = true, | |
| 26029 | }); | |
| 26030 | const attributes = Attributes{}; | |
| 26031 | }; | |
| 26032 | ||
| 26033 | pub const __builtin_ve_vl_vpcnt_vvmvl = struct { | |
| 26034 | const param_str = "V256dV256dV256bV256dUi"; | |
| 26035 | const target_set = TargetSet.init(.{ | |
| 26036 | .vevl_gen = true, | |
| 26037 | }); | |
| 26038 | const attributes = Attributes{}; | |
| 26039 | }; | |
| 26040 | ||
| 26041 | pub const __builtin_ve_vl_vpcnt_vvvl = struct { | |
| 26042 | const param_str = "V256dV256dV256dUi"; | |
| 26043 | const target_set = TargetSet.init(.{ | |
| 26044 | .vevl_gen = true, | |
| 26045 | }); | |
| 26046 | const attributes = Attributes{}; | |
| 26047 | }; | |
| 26048 | ||
| 26049 | pub const __builtin_ve_vl_vrand_vvl = struct { | |
| 26050 | const param_str = "V256dV256dUi"; | |
| 26051 | const target_set = TargetSet.init(.{ | |
| 26052 | .vevl_gen = true, | |
| 26053 | }); | |
| 26054 | const attributes = Attributes{}; | |
| 26055 | }; | |
| 26056 | ||
| 26057 | pub const __builtin_ve_vl_vrand_vvml = struct { | |
| 26058 | const param_str = "V256dV256dV256bUi"; | |
| 26059 | const target_set = TargetSet.init(.{ | |
| 26060 | .vevl_gen = true, | |
| 26061 | }); | |
| 26062 | const attributes = Attributes{}; | |
| 26063 | }; | |
| 26064 | ||
| 26065 | pub const __builtin_ve_vl_vrcpd_vvl = struct { | |
| 26066 | const param_str = "V256dV256dUi"; | |
| 26067 | const target_set = TargetSet.init(.{ | |
| 26068 | .vevl_gen = true, | |
| 26069 | }); | |
| 26070 | const attributes = Attributes{}; | |
| 26071 | }; | |
| 26072 | ||
| 26073 | pub const __builtin_ve_vl_vrcpd_vvvl = struct { | |
| 26074 | const param_str = "V256dV256dV256dUi"; | |
| 26075 | const target_set = TargetSet.init(.{ | |
| 26076 | .vevl_gen = true, | |
| 26077 | }); | |
| 26078 | const attributes = Attributes{}; | |
| 26079 | }; | |
| 26080 | ||
| 26081 | pub const __builtin_ve_vl_vrcps_vvl = struct { | |
| 26082 | const param_str = "V256dV256dUi"; | |
| 26083 | const target_set = TargetSet.init(.{ | |
| 26084 | .vevl_gen = true, | |
| 26085 | }); | |
| 26086 | const attributes = Attributes{}; | |
| 26087 | }; | |
| 26088 | ||
| 26089 | pub const __builtin_ve_vl_vrcps_vvvl = struct { | |
| 26090 | const param_str = "V256dV256dV256dUi"; | |
| 26091 | const target_set = TargetSet.init(.{ | |
| 26092 | .vevl_gen = true, | |
| 26093 | }); | |
| 26094 | const attributes = Attributes{}; | |
| 26095 | }; | |
| 26096 | ||
| 26097 | pub const __builtin_ve_vl_vrmaxslfst_vvl = struct { | |
| 26098 | const param_str = "V256dV256dUi"; | |
| 26099 | const target_set = TargetSet.init(.{ | |
| 26100 | .vevl_gen = true, | |
| 26101 | }); | |
| 26102 | const attributes = Attributes{}; | |
| 26103 | }; | |
| 26104 | ||
| 26105 | pub const __builtin_ve_vl_vrmaxslfst_vvvl = struct { | |
| 26106 | const param_str = "V256dV256dV256dUi"; | |
| 26107 | const target_set = TargetSet.init(.{ | |
| 26108 | .vevl_gen = true, | |
| 26109 | }); | |
| 26110 | const attributes = Attributes{}; | |
| 26111 | }; | |
| 26112 | ||
| 26113 | pub const __builtin_ve_vl_vrmaxsllst_vvl = struct { | |
| 26114 | const param_str = "V256dV256dUi"; | |
| 26115 | const target_set = TargetSet.init(.{ | |
| 26116 | .vevl_gen = true, | |
| 26117 | }); | |
| 26118 | const attributes = Attributes{}; | |
| 26119 | }; | |
| 26120 | ||
| 26121 | pub const __builtin_ve_vl_vrmaxsllst_vvvl = struct { | |
| 26122 | const param_str = "V256dV256dV256dUi"; | |
| 26123 | const target_set = TargetSet.init(.{ | |
| 26124 | .vevl_gen = true, | |
| 26125 | }); | |
| 26126 | const attributes = Attributes{}; | |
| 26127 | }; | |
| 26128 | ||
| 26129 | pub const __builtin_ve_vl_vrmaxswfstsx_vvl = struct { | |
| 26130 | const param_str = "V256dV256dUi"; | |
| 26131 | const target_set = TargetSet.init(.{ | |
| 26132 | .vevl_gen = true, | |
| 26133 | }); | |
| 26134 | const attributes = Attributes{}; | |
| 26135 | }; | |
| 26136 | ||
| 26137 | pub const __builtin_ve_vl_vrmaxswfstsx_vvvl = struct { | |
| 26138 | const param_str = "V256dV256dV256dUi"; | |
| 26139 | const target_set = TargetSet.init(.{ | |
| 26140 | .vevl_gen = true, | |
| 26141 | }); | |
| 26142 | const attributes = Attributes{}; | |
| 26143 | }; | |
| 26144 | ||
| 26145 | pub const __builtin_ve_vl_vrmaxswfstzx_vvl = struct { | |
| 26146 | const param_str = "V256dV256dUi"; | |
| 26147 | const target_set = TargetSet.init(.{ | |
| 26148 | .vevl_gen = true, | |
| 26149 | }); | |
| 26150 | const attributes = Attributes{}; | |
| 26151 | }; | |
| 26152 | ||
| 26153 | pub const __builtin_ve_vl_vrmaxswfstzx_vvvl = struct { | |
| 26154 | const param_str = "V256dV256dV256dUi"; | |
| 26155 | const target_set = TargetSet.init(.{ | |
| 26156 | .vevl_gen = true, | |
| 26157 | }); | |
| 26158 | const attributes = Attributes{}; | |
| 26159 | }; | |
| 26160 | ||
| 26161 | pub const __builtin_ve_vl_vrmaxswlstsx_vvl = struct { | |
| 26162 | const param_str = "V256dV256dUi"; | |
| 26163 | const target_set = TargetSet.init(.{ | |
| 26164 | .vevl_gen = true, | |
| 26165 | }); | |
| 26166 | const attributes = Attributes{}; | |
| 26167 | }; | |
| 26168 | ||
| 26169 | pub const __builtin_ve_vl_vrmaxswlstsx_vvvl = struct { | |
| 26170 | const param_str = "V256dV256dV256dUi"; | |
| 26171 | const target_set = TargetSet.init(.{ | |
| 26172 | .vevl_gen = true, | |
| 26173 | }); | |
| 26174 | const attributes = Attributes{}; | |
| 26175 | }; | |
| 26176 | ||
| 26177 | pub const __builtin_ve_vl_vrmaxswlstzx_vvl = struct { | |
| 26178 | const param_str = "V256dV256dUi"; | |
| 26179 | const target_set = TargetSet.init(.{ | |
| 26180 | .vevl_gen = true, | |
| 26181 | }); | |
| 26182 | const attributes = Attributes{}; | |
| 26183 | }; | |
| 26184 | ||
| 26185 | pub const __builtin_ve_vl_vrmaxswlstzx_vvvl = struct { | |
| 26186 | const param_str = "V256dV256dV256dUi"; | |
| 26187 | const target_set = TargetSet.init(.{ | |
| 26188 | .vevl_gen = true, | |
| 26189 | }); | |
| 26190 | const attributes = Attributes{}; | |
| 26191 | }; | |
| 26192 | ||
| 26193 | pub const __builtin_ve_vl_vrminslfst_vvl = struct { | |
| 26194 | const param_str = "V256dV256dUi"; | |
| 26195 | const target_set = TargetSet.init(.{ | |
| 26196 | .vevl_gen = true, | |
| 26197 | }); | |
| 26198 | const attributes = Attributes{}; | |
| 26199 | }; | |
| 26200 | ||
| 26201 | pub const __builtin_ve_vl_vrminslfst_vvvl = struct { | |
| 26202 | const param_str = "V256dV256dV256dUi"; | |
| 26203 | const target_set = TargetSet.init(.{ | |
| 26204 | .vevl_gen = true, | |
| 26205 | }); | |
| 26206 | const attributes = Attributes{}; | |
| 26207 | }; | |
| 26208 | ||
| 26209 | pub const __builtin_ve_vl_vrminsllst_vvl = struct { | |
| 26210 | const param_str = "V256dV256dUi"; | |
| 26211 | const target_set = TargetSet.init(.{ | |
| 26212 | .vevl_gen = true, | |
| 26213 | }); | |
| 26214 | const attributes = Attributes{}; | |
| 26215 | }; | |
| 26216 | ||
| 26217 | pub const __builtin_ve_vl_vrminsllst_vvvl = struct { | |
| 26218 | const param_str = "V256dV256dV256dUi"; | |
| 26219 | const target_set = TargetSet.init(.{ | |
| 26220 | .vevl_gen = true, | |
| 26221 | }); | |
| 26222 | const attributes = Attributes{}; | |
| 26223 | }; | |
| 26224 | ||
| 26225 | pub const __builtin_ve_vl_vrminswfstsx_vvl = struct { | |
| 26226 | const param_str = "V256dV256dUi"; | |
| 26227 | const target_set = TargetSet.init(.{ | |
| 26228 | .vevl_gen = true, | |
| 26229 | }); | |
| 26230 | const attributes = Attributes{}; | |
| 26231 | }; | |
| 26232 | ||
| 26233 | pub const __builtin_ve_vl_vrminswfstsx_vvvl = struct { | |
| 26234 | const param_str = "V256dV256dV256dUi"; | |
| 26235 | const target_set = TargetSet.init(.{ | |
| 26236 | .vevl_gen = true, | |
| 26237 | }); | |
| 26238 | const attributes = Attributes{}; | |
| 26239 | }; | |
| 26240 | ||
| 26241 | pub const __builtin_ve_vl_vrminswfstzx_vvl = struct { | |
| 26242 | const param_str = "V256dV256dUi"; | |
| 26243 | const target_set = TargetSet.init(.{ | |
| 26244 | .vevl_gen = true, | |
| 26245 | }); | |
| 26246 | const attributes = Attributes{}; | |
| 26247 | }; | |
| 26248 | ||
| 26249 | pub const __builtin_ve_vl_vrminswfstzx_vvvl = struct { | |
| 26250 | const param_str = "V256dV256dV256dUi"; | |
| 26251 | const target_set = TargetSet.init(.{ | |
| 26252 | .vevl_gen = true, | |
| 26253 | }); | |
| 26254 | const attributes = Attributes{}; | |
| 26255 | }; | |
| 26256 | ||
| 26257 | pub const __builtin_ve_vl_vrminswlstsx_vvl = struct { | |
| 26258 | const param_str = "V256dV256dUi"; | |
| 26259 | const target_set = TargetSet.init(.{ | |
| 26260 | .vevl_gen = true, | |
| 26261 | }); | |
| 26262 | const attributes = Attributes{}; | |
| 26263 | }; | |
| 26264 | ||
| 26265 | pub const __builtin_ve_vl_vrminswlstsx_vvvl = struct { | |
| 26266 | const param_str = "V256dV256dV256dUi"; | |
| 26267 | const target_set = TargetSet.init(.{ | |
| 26268 | .vevl_gen = true, | |
| 26269 | }); | |
| 26270 | const attributes = Attributes{}; | |
| 26271 | }; | |
| 26272 | ||
| 26273 | pub const __builtin_ve_vl_vrminswlstzx_vvl = struct { | |
| 26274 | const param_str = "V256dV256dUi"; | |
| 26275 | const target_set = TargetSet.init(.{ | |
| 26276 | .vevl_gen = true, | |
| 26277 | }); | |
| 26278 | const attributes = Attributes{}; | |
| 26279 | }; | |
| 26280 | ||
| 26281 | pub const __builtin_ve_vl_vrminswlstzx_vvvl = struct { | |
| 26282 | const param_str = "V256dV256dV256dUi"; | |
| 26283 | const target_set = TargetSet.init(.{ | |
| 26284 | .vevl_gen = true, | |
| 26285 | }); | |
| 26286 | const attributes = Attributes{}; | |
| 26287 | }; | |
| 26288 | ||
| 26289 | pub const __builtin_ve_vl_vror_vvl = struct { | |
| 26290 | const param_str = "V256dV256dUi"; | |
| 26291 | const target_set = TargetSet.init(.{ | |
| 26292 | .vevl_gen = true, | |
| 26293 | }); | |
| 26294 | const attributes = Attributes{}; | |
| 26295 | }; | |
| 26296 | ||
| 26297 | pub const __builtin_ve_vl_vror_vvml = struct { | |
| 26298 | const param_str = "V256dV256dV256bUi"; | |
| 26299 | const target_set = TargetSet.init(.{ | |
| 26300 | .vevl_gen = true, | |
| 26301 | }); | |
| 26302 | const attributes = Attributes{}; | |
| 26303 | }; | |
| 26304 | ||
| 26305 | pub const __builtin_ve_vl_vrsqrtd_vvl = struct { | |
| 26306 | const param_str = "V256dV256dUi"; | |
| 26307 | const target_set = TargetSet.init(.{ | |
| 26308 | .vevl_gen = true, | |
| 26309 | }); | |
| 26310 | const attributes = Attributes{}; | |
| 26311 | }; | |
| 26312 | ||
| 26313 | pub const __builtin_ve_vl_vrsqrtd_vvvl = struct { | |
| 26314 | const param_str = "V256dV256dV256dUi"; | |
| 26315 | const target_set = TargetSet.init(.{ | |
| 26316 | .vevl_gen = true, | |
| 26317 | }); | |
| 26318 | const attributes = Attributes{}; | |
| 26319 | }; | |
| 26320 | ||
| 26321 | pub const __builtin_ve_vl_vrsqrtdnex_vvl = struct { | |
| 26322 | const param_str = "V256dV256dUi"; | |
| 26323 | const target_set = TargetSet.init(.{ | |
| 26324 | .vevl_gen = true, | |
| 26325 | }); | |
| 26326 | const attributes = Attributes{}; | |
| 26327 | }; | |
| 26328 | ||
| 26329 | pub const __builtin_ve_vl_vrsqrtdnex_vvvl = struct { | |
| 26330 | const param_str = "V256dV256dV256dUi"; | |
| 26331 | const target_set = TargetSet.init(.{ | |
| 26332 | .vevl_gen = true, | |
| 26333 | }); | |
| 26334 | const attributes = Attributes{}; | |
| 26335 | }; | |
| 26336 | ||
| 26337 | pub const __builtin_ve_vl_vrsqrts_vvl = struct { | |
| 26338 | const param_str = "V256dV256dUi"; | |
| 26339 | const target_set = TargetSet.init(.{ | |
| 26340 | .vevl_gen = true, | |
| 26341 | }); | |
| 26342 | const attributes = Attributes{}; | |
| 26343 | }; | |
| 26344 | ||
| 26345 | pub const __builtin_ve_vl_vrsqrts_vvvl = struct { | |
| 26346 | const param_str = "V256dV256dV256dUi"; | |
| 26347 | const target_set = TargetSet.init(.{ | |
| 26348 | .vevl_gen = true, | |
| 26349 | }); | |
| 26350 | const attributes = Attributes{}; | |
| 26351 | }; | |
| 26352 | ||
| 26353 | pub const __builtin_ve_vl_vrsqrtsnex_vvl = struct { | |
| 26354 | const param_str = "V256dV256dUi"; | |
| 26355 | const target_set = TargetSet.init(.{ | |
| 26356 | .vevl_gen = true, | |
| 26357 | }); | |
| 26358 | const attributes = Attributes{}; | |
| 26359 | }; | |
| 26360 | ||
| 26361 | pub const __builtin_ve_vl_vrsqrtsnex_vvvl = struct { | |
| 26362 | const param_str = "V256dV256dV256dUi"; | |
| 26363 | const target_set = TargetSet.init(.{ | |
| 26364 | .vevl_gen = true, | |
| 26365 | }); | |
| 26366 | const attributes = Attributes{}; | |
| 26367 | }; | |
| 26368 | ||
| 26369 | pub const __builtin_ve_vl_vrxor_vvl = struct { | |
| 26370 | const param_str = "V256dV256dUi"; | |
| 26371 | const target_set = TargetSet.init(.{ | |
| 26372 | .vevl_gen = true, | |
| 26373 | }); | |
| 26374 | const attributes = Attributes{}; | |
| 26375 | }; | |
| 26376 | ||
| 26377 | pub const __builtin_ve_vl_vrxor_vvml = struct { | |
| 26378 | const param_str = "V256dV256dV256bUi"; | |
| 26379 | const target_set = TargetSet.init(.{ | |
| 26380 | .vevl_gen = true, | |
| 26381 | }); | |
| 26382 | const attributes = Attributes{}; | |
| 26383 | }; | |
| 26384 | ||
| 26385 | pub const __builtin_ve_vl_vsc_vvssl = struct { | |
| 26386 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26387 | const target_set = TargetSet.init(.{ | |
| 26388 | .vevl_gen = true, | |
| 26389 | }); | |
| 26390 | const attributes = Attributes{}; | |
| 26391 | }; | |
| 26392 | ||
| 26393 | pub const __builtin_ve_vl_vsc_vvssml = struct { | |
| 26394 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26395 | const target_set = TargetSet.init(.{ | |
| 26396 | .vevl_gen = true, | |
| 26397 | }); | |
| 26398 | const attributes = Attributes{}; | |
| 26399 | }; | |
| 26400 | ||
| 26401 | pub const __builtin_ve_vl_vscl_vvssl = struct { | |
| 26402 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26403 | const target_set = TargetSet.init(.{ | |
| 26404 | .vevl_gen = true, | |
| 26405 | }); | |
| 26406 | const attributes = Attributes{}; | |
| 26407 | }; | |
| 26408 | ||
| 26409 | pub const __builtin_ve_vl_vscl_vvssml = struct { | |
| 26410 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26411 | const target_set = TargetSet.init(.{ | |
| 26412 | .vevl_gen = true, | |
| 26413 | }); | |
| 26414 | const attributes = Attributes{}; | |
| 26415 | }; | |
| 26416 | ||
| 26417 | pub const __builtin_ve_vl_vsclnc_vvssl = struct { | |
| 26418 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26419 | const target_set = TargetSet.init(.{ | |
| 26420 | .vevl_gen = true, | |
| 26421 | }); | |
| 26422 | const attributes = Attributes{}; | |
| 26423 | }; | |
| 26424 | ||
| 26425 | pub const __builtin_ve_vl_vsclnc_vvssml = struct { | |
| 26426 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26427 | const target_set = TargetSet.init(.{ | |
| 26428 | .vevl_gen = true, | |
| 26429 | }); | |
| 26430 | const attributes = Attributes{}; | |
| 26431 | }; | |
| 26432 | ||
| 26433 | pub const __builtin_ve_vl_vsclncot_vvssl = struct { | |
| 26434 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26435 | const target_set = TargetSet.init(.{ | |
| 26436 | .vevl_gen = true, | |
| 26437 | }); | |
| 26438 | const attributes = Attributes{}; | |
| 26439 | }; | |
| 26440 | ||
| 26441 | pub const __builtin_ve_vl_vsclncot_vvssml = struct { | |
| 26442 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26443 | const target_set = TargetSet.init(.{ | |
| 26444 | .vevl_gen = true, | |
| 26445 | }); | |
| 26446 | const attributes = Attributes{}; | |
| 26447 | }; | |
| 26448 | ||
| 26449 | pub const __builtin_ve_vl_vsclot_vvssl = struct { | |
| 26450 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26451 | const target_set = TargetSet.init(.{ | |
| 26452 | .vevl_gen = true, | |
| 26453 | }); | |
| 26454 | const attributes = Attributes{}; | |
| 26455 | }; | |
| 26456 | ||
| 26457 | pub const __builtin_ve_vl_vsclot_vvssml = struct { | |
| 26458 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26459 | const target_set = TargetSet.init(.{ | |
| 26460 | .vevl_gen = true, | |
| 26461 | }); | |
| 26462 | const attributes = Attributes{}; | |
| 26463 | }; | |
| 26464 | ||
| 26465 | pub const __builtin_ve_vl_vscnc_vvssl = struct { | |
| 26466 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26467 | const target_set = TargetSet.init(.{ | |
| 26468 | .vevl_gen = true, | |
| 26469 | }); | |
| 26470 | const attributes = Attributes{}; | |
| 26471 | }; | |
| 26472 | ||
| 26473 | pub const __builtin_ve_vl_vscnc_vvssml = struct { | |
| 26474 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26475 | const target_set = TargetSet.init(.{ | |
| 26476 | .vevl_gen = true, | |
| 26477 | }); | |
| 26478 | const attributes = Attributes{}; | |
| 26479 | }; | |
| 26480 | ||
| 26481 | pub const __builtin_ve_vl_vscncot_vvssl = struct { | |
| 26482 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26483 | const target_set = TargetSet.init(.{ | |
| 26484 | .vevl_gen = true, | |
| 26485 | }); | |
| 26486 | const attributes = Attributes{}; | |
| 26487 | }; | |
| 26488 | ||
| 26489 | pub const __builtin_ve_vl_vscncot_vvssml = struct { | |
| 26490 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26491 | const target_set = TargetSet.init(.{ | |
| 26492 | .vevl_gen = true, | |
| 26493 | }); | |
| 26494 | const attributes = Attributes{}; | |
| 26495 | }; | |
| 26496 | ||
| 26497 | pub const __builtin_ve_vl_vscot_vvssl = struct { | |
| 26498 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26499 | const target_set = TargetSet.init(.{ | |
| 26500 | .vevl_gen = true, | |
| 26501 | }); | |
| 26502 | const attributes = Attributes{}; | |
| 26503 | }; | |
| 26504 | ||
| 26505 | pub const __builtin_ve_vl_vscot_vvssml = struct { | |
| 26506 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26507 | const target_set = TargetSet.init(.{ | |
| 26508 | .vevl_gen = true, | |
| 26509 | }); | |
| 26510 | const attributes = Attributes{}; | |
| 26511 | }; | |
| 26512 | ||
| 26513 | pub const __builtin_ve_vl_vscu_vvssl = struct { | |
| 26514 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26515 | const target_set = TargetSet.init(.{ | |
| 26516 | .vevl_gen = true, | |
| 26517 | }); | |
| 26518 | const attributes = Attributes{}; | |
| 26519 | }; | |
| 26520 | ||
| 26521 | pub const __builtin_ve_vl_vscu_vvssml = struct { | |
| 26522 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26523 | const target_set = TargetSet.init(.{ | |
| 26524 | .vevl_gen = true, | |
| 26525 | }); | |
| 26526 | const attributes = Attributes{}; | |
| 26527 | }; | |
| 26528 | ||
| 26529 | pub const __builtin_ve_vl_vscunc_vvssl = struct { | |
| 26530 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26531 | const target_set = TargetSet.init(.{ | |
| 26532 | .vevl_gen = true, | |
| 26533 | }); | |
| 26534 | const attributes = Attributes{}; | |
| 26535 | }; | |
| 26536 | ||
| 26537 | pub const __builtin_ve_vl_vscunc_vvssml = struct { | |
| 26538 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26539 | const target_set = TargetSet.init(.{ | |
| 26540 | .vevl_gen = true, | |
| 26541 | }); | |
| 26542 | const attributes = Attributes{}; | |
| 26543 | }; | |
| 26544 | ||
| 26545 | pub const __builtin_ve_vl_vscuncot_vvssl = struct { | |
| 26546 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26547 | const target_set = TargetSet.init(.{ | |
| 26548 | .vevl_gen = true, | |
| 26549 | }); | |
| 26550 | const attributes = Attributes{}; | |
| 26551 | }; | |
| 26552 | ||
| 26553 | pub const __builtin_ve_vl_vscuncot_vvssml = struct { | |
| 26554 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26555 | const target_set = TargetSet.init(.{ | |
| 26556 | .vevl_gen = true, | |
| 26557 | }); | |
| 26558 | const attributes = Attributes{}; | |
| 26559 | }; | |
| 26560 | ||
| 26561 | pub const __builtin_ve_vl_vscuot_vvssl = struct { | |
| 26562 | const param_str = "vV256dV256dLUiLUiUi"; | |
| 26563 | const target_set = TargetSet.init(.{ | |
| 26564 | .vevl_gen = true, | |
| 26565 | }); | |
| 26566 | const attributes = Attributes{}; | |
| 26567 | }; | |
| 26568 | ||
| 26569 | pub const __builtin_ve_vl_vscuot_vvssml = struct { | |
| 26570 | const param_str = "vV256dV256dLUiLUiV256bUi"; | |
| 26571 | const target_set = TargetSet.init(.{ | |
| 26572 | .vevl_gen = true, | |
| 26573 | }); | |
| 26574 | const attributes = Attributes{}; | |
| 26575 | }; | |
| 26576 | ||
| 26577 | pub const __builtin_ve_vl_vseq_vl = struct { | |
| 26578 | const param_str = "V256dUi"; | |
| 26579 | const target_set = TargetSet.init(.{ | |
| 26580 | .vevl_gen = true, | |
| 26581 | }); | |
| 26582 | const attributes = Attributes{}; | |
| 26583 | }; | |
| 26584 | ||
| 26585 | pub const __builtin_ve_vl_vseq_vvl = struct { | |
| 26586 | const param_str = "V256dV256dUi"; | |
| 26587 | const target_set = TargetSet.init(.{ | |
| 26588 | .vevl_gen = true, | |
| 26589 | }); | |
| 26590 | const attributes = Attributes{}; | |
| 26591 | }; | |
| 26592 | ||
| 26593 | pub const __builtin_ve_vl_vsfa_vvssl = struct { | |
| 26594 | const param_str = "V256dV256dLUiLUiUi"; | |
| 26595 | const target_set = TargetSet.init(.{ | |
| 26596 | .vevl_gen = true, | |
| 26597 | }); | |
| 26598 | const attributes = Attributes{}; | |
| 26599 | }; | |
| 26600 | ||
| 26601 | pub const __builtin_ve_vl_vsfa_vvssmvl = struct { | |
| 26602 | const param_str = "V256dV256dLUiLUiV256bV256dUi"; | |
| 26603 | const target_set = TargetSet.init(.{ | |
| 26604 | .vevl_gen = true, | |
| 26605 | }); | |
| 26606 | const attributes = Attributes{}; | |
| 26607 | }; | |
| 26608 | ||
| 26609 | pub const __builtin_ve_vl_vsfa_vvssvl = struct { | |
| 26610 | const param_str = "V256dV256dLUiLUiV256dUi"; | |
| 26611 | const target_set = TargetSet.init(.{ | |
| 26612 | .vevl_gen = true, | |
| 26613 | }); | |
| 26614 | const attributes = Attributes{}; | |
| 26615 | }; | |
| 26616 | ||
| 26617 | pub const __builtin_ve_vl_vshf_vvvsl = struct { | |
| 26618 | const param_str = "V256dV256dV256dLUiUi"; | |
| 26619 | const target_set = TargetSet.init(.{ | |
| 26620 | .vevl_gen = true, | |
| 26621 | }); | |
| 26622 | const attributes = Attributes{}; | |
| 26623 | }; | |
| 26624 | ||
| 26625 | pub const __builtin_ve_vl_vshf_vvvsvl = struct { | |
| 26626 | const param_str = "V256dV256dV256dLUiV256dUi"; | |
| 26627 | const target_set = TargetSet.init(.{ | |
| 26628 | .vevl_gen = true, | |
| 26629 | }); | |
| 26630 | const attributes = Attributes{}; | |
| 26631 | }; | |
| 26632 | ||
| 26633 | pub const __builtin_ve_vl_vslal_vvsl = struct { | |
| 26634 | const param_str = "V256dV256dLiUi"; | |
| 26635 | const target_set = TargetSet.init(.{ | |
| 26636 | .vevl_gen = true, | |
| 26637 | }); | |
| 26638 | const attributes = Attributes{}; | |
| 26639 | }; | |
| 26640 | ||
| 26641 | pub const __builtin_ve_vl_vslal_vvsmvl = struct { | |
| 26642 | const param_str = "V256dV256dLiV256bV256dUi"; | |
| 26643 | const target_set = TargetSet.init(.{ | |
| 26644 | .vevl_gen = true, | |
| 26645 | }); | |
| 26646 | const attributes = Attributes{}; | |
| 26647 | }; | |
| 26648 | ||
| 26649 | pub const __builtin_ve_vl_vslal_vvsvl = struct { | |
| 26650 | const param_str = "V256dV256dLiV256dUi"; | |
| 26651 | const target_set = TargetSet.init(.{ | |
| 26652 | .vevl_gen = true, | |
| 26653 | }); | |
| 26654 | const attributes = Attributes{}; | |
| 26655 | }; | |
| 26656 | ||
| 26657 | pub const __builtin_ve_vl_vslal_vvvl = struct { | |
| 26658 | const param_str = "V256dV256dV256dUi"; | |
| 26659 | const target_set = TargetSet.init(.{ | |
| 26660 | .vevl_gen = true, | |
| 26661 | }); | |
| 26662 | const attributes = Attributes{}; | |
| 26663 | }; | |
| 26664 | ||
| 26665 | pub const __builtin_ve_vl_vslal_vvvmvl = struct { | |
| 26666 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26667 | const target_set = TargetSet.init(.{ | |
| 26668 | .vevl_gen = true, | |
| 26669 | }); | |
| 26670 | const attributes = Attributes{}; | |
| 26671 | }; | |
| 26672 | ||
| 26673 | pub const __builtin_ve_vl_vslal_vvvvl = struct { | |
| 26674 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26675 | const target_set = TargetSet.init(.{ | |
| 26676 | .vevl_gen = true, | |
| 26677 | }); | |
| 26678 | const attributes = Attributes{}; | |
| 26679 | }; | |
| 26680 | ||
| 26681 | pub const __builtin_ve_vl_vslawsx_vvsl = struct { | |
| 26682 | const param_str = "V256dV256diUi"; | |
| 26683 | const target_set = TargetSet.init(.{ | |
| 26684 | .vevl_gen = true, | |
| 26685 | }); | |
| 26686 | const attributes = Attributes{}; | |
| 26687 | }; | |
| 26688 | ||
| 26689 | pub const __builtin_ve_vl_vslawsx_vvsmvl = struct { | |
| 26690 | const param_str = "V256dV256diV256bV256dUi"; | |
| 26691 | const target_set = TargetSet.init(.{ | |
| 26692 | .vevl_gen = true, | |
| 26693 | }); | |
| 26694 | const attributes = Attributes{}; | |
| 26695 | }; | |
| 26696 | ||
| 26697 | pub const __builtin_ve_vl_vslawsx_vvsvl = struct { | |
| 26698 | const param_str = "V256dV256diV256dUi"; | |
| 26699 | const target_set = TargetSet.init(.{ | |
| 26700 | .vevl_gen = true, | |
| 26701 | }); | |
| 26702 | const attributes = Attributes{}; | |
| 26703 | }; | |
| 26704 | ||
| 26705 | pub const __builtin_ve_vl_vslawsx_vvvl = struct { | |
| 26706 | const param_str = "V256dV256dV256dUi"; | |
| 26707 | const target_set = TargetSet.init(.{ | |
| 26708 | .vevl_gen = true, | |
| 26709 | }); | |
| 26710 | const attributes = Attributes{}; | |
| 26711 | }; | |
| 26712 | ||
| 26713 | pub const __builtin_ve_vl_vslawsx_vvvmvl = struct { | |
| 26714 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26715 | const target_set = TargetSet.init(.{ | |
| 26716 | .vevl_gen = true, | |
| 26717 | }); | |
| 26718 | const attributes = Attributes{}; | |
| 26719 | }; | |
| 26720 | ||
| 26721 | pub const __builtin_ve_vl_vslawsx_vvvvl = struct { | |
| 26722 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26723 | const target_set = TargetSet.init(.{ | |
| 26724 | .vevl_gen = true, | |
| 26725 | }); | |
| 26726 | const attributes = Attributes{}; | |
| 26727 | }; | |
| 26728 | ||
| 26729 | pub const __builtin_ve_vl_vslawzx_vvsl = struct { | |
| 26730 | const param_str = "V256dV256diUi"; | |
| 26731 | const target_set = TargetSet.init(.{ | |
| 26732 | .vevl_gen = true, | |
| 26733 | }); | |
| 26734 | const attributes = Attributes{}; | |
| 26735 | }; | |
| 26736 | ||
| 26737 | pub const __builtin_ve_vl_vslawzx_vvsmvl = struct { | |
| 26738 | const param_str = "V256dV256diV256bV256dUi"; | |
| 26739 | const target_set = TargetSet.init(.{ | |
| 26740 | .vevl_gen = true, | |
| 26741 | }); | |
| 26742 | const attributes = Attributes{}; | |
| 26743 | }; | |
| 26744 | ||
| 26745 | pub const __builtin_ve_vl_vslawzx_vvsvl = struct { | |
| 26746 | const param_str = "V256dV256diV256dUi"; | |
| 26747 | const target_set = TargetSet.init(.{ | |
| 26748 | .vevl_gen = true, | |
| 26749 | }); | |
| 26750 | const attributes = Attributes{}; | |
| 26751 | }; | |
| 26752 | ||
| 26753 | pub const __builtin_ve_vl_vslawzx_vvvl = struct { | |
| 26754 | const param_str = "V256dV256dV256dUi"; | |
| 26755 | const target_set = TargetSet.init(.{ | |
| 26756 | .vevl_gen = true, | |
| 26757 | }); | |
| 26758 | const attributes = Attributes{}; | |
| 26759 | }; | |
| 26760 | ||
| 26761 | pub const __builtin_ve_vl_vslawzx_vvvmvl = struct { | |
| 26762 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26763 | const target_set = TargetSet.init(.{ | |
| 26764 | .vevl_gen = true, | |
| 26765 | }); | |
| 26766 | const attributes = Attributes{}; | |
| 26767 | }; | |
| 26768 | ||
| 26769 | pub const __builtin_ve_vl_vslawzx_vvvvl = struct { | |
| 26770 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26771 | const target_set = TargetSet.init(.{ | |
| 26772 | .vevl_gen = true, | |
| 26773 | }); | |
| 26774 | const attributes = Attributes{}; | |
| 26775 | }; | |
| 26776 | ||
| 26777 | pub const __builtin_ve_vl_vsll_vvsl = struct { | |
| 26778 | const param_str = "V256dV256dLUiUi"; | |
| 26779 | const target_set = TargetSet.init(.{ | |
| 26780 | .vevl_gen = true, | |
| 26781 | }); | |
| 26782 | const attributes = Attributes{}; | |
| 26783 | }; | |
| 26784 | ||
| 26785 | pub const __builtin_ve_vl_vsll_vvsmvl = struct { | |
| 26786 | const param_str = "V256dV256dLUiV256bV256dUi"; | |
| 26787 | const target_set = TargetSet.init(.{ | |
| 26788 | .vevl_gen = true, | |
| 26789 | }); | |
| 26790 | const attributes = Attributes{}; | |
| 26791 | }; | |
| 26792 | ||
| 26793 | pub const __builtin_ve_vl_vsll_vvsvl = struct { | |
| 26794 | const param_str = "V256dV256dLUiV256dUi"; | |
| 26795 | const target_set = TargetSet.init(.{ | |
| 26796 | .vevl_gen = true, | |
| 26797 | }); | |
| 26798 | const attributes = Attributes{}; | |
| 26799 | }; | |
| 26800 | ||
| 26801 | pub const __builtin_ve_vl_vsll_vvvl = struct { | |
| 26802 | const param_str = "V256dV256dV256dUi"; | |
| 26803 | const target_set = TargetSet.init(.{ | |
| 26804 | .vevl_gen = true, | |
| 26805 | }); | |
| 26806 | const attributes = Attributes{}; | |
| 26807 | }; | |
| 26808 | ||
| 26809 | pub const __builtin_ve_vl_vsll_vvvmvl = struct { | |
| 26810 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26811 | const target_set = TargetSet.init(.{ | |
| 26812 | .vevl_gen = true, | |
| 26813 | }); | |
| 26814 | const attributes = Attributes{}; | |
| 26815 | }; | |
| 26816 | ||
| 26817 | pub const __builtin_ve_vl_vsll_vvvvl = struct { | |
| 26818 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26819 | const target_set = TargetSet.init(.{ | |
| 26820 | .vevl_gen = true, | |
| 26821 | }); | |
| 26822 | const attributes = Attributes{}; | |
| 26823 | }; | |
| 26824 | ||
| 26825 | pub const __builtin_ve_vl_vsral_vvsl = struct { | |
| 26826 | const param_str = "V256dV256dLiUi"; | |
| 26827 | const target_set = TargetSet.init(.{ | |
| 26828 | .vevl_gen = true, | |
| 26829 | }); | |
| 26830 | const attributes = Attributes{}; | |
| 26831 | }; | |
| 26832 | ||
| 26833 | pub const __builtin_ve_vl_vsral_vvsmvl = struct { | |
| 26834 | const param_str = "V256dV256dLiV256bV256dUi"; | |
| 26835 | const target_set = TargetSet.init(.{ | |
| 26836 | .vevl_gen = true, | |
| 26837 | }); | |
| 26838 | const attributes = Attributes{}; | |
| 26839 | }; | |
| 26840 | ||
| 26841 | pub const __builtin_ve_vl_vsral_vvsvl = struct { | |
| 26842 | const param_str = "V256dV256dLiV256dUi"; | |
| 26843 | const target_set = TargetSet.init(.{ | |
| 26844 | .vevl_gen = true, | |
| 26845 | }); | |
| 26846 | const attributes = Attributes{}; | |
| 26847 | }; | |
| 26848 | ||
| 26849 | pub const __builtin_ve_vl_vsral_vvvl = struct { | |
| 26850 | const param_str = "V256dV256dV256dUi"; | |
| 26851 | const target_set = TargetSet.init(.{ | |
| 26852 | .vevl_gen = true, | |
| 26853 | }); | |
| 26854 | const attributes = Attributes{}; | |
| 26855 | }; | |
| 26856 | ||
| 26857 | pub const __builtin_ve_vl_vsral_vvvmvl = struct { | |
| 26858 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26859 | const target_set = TargetSet.init(.{ | |
| 26860 | .vevl_gen = true, | |
| 26861 | }); | |
| 26862 | const attributes = Attributes{}; | |
| 26863 | }; | |
| 26864 | ||
| 26865 | pub const __builtin_ve_vl_vsral_vvvvl = struct { | |
| 26866 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26867 | const target_set = TargetSet.init(.{ | |
| 26868 | .vevl_gen = true, | |
| 26869 | }); | |
| 26870 | const attributes = Attributes{}; | |
| 26871 | }; | |
| 26872 | ||
| 26873 | pub const __builtin_ve_vl_vsrawsx_vvsl = struct { | |
| 26874 | const param_str = "V256dV256diUi"; | |
| 26875 | const target_set = TargetSet.init(.{ | |
| 26876 | .vevl_gen = true, | |
| 26877 | }); | |
| 26878 | const attributes = Attributes{}; | |
| 26879 | }; | |
| 26880 | ||
| 26881 | pub const __builtin_ve_vl_vsrawsx_vvsmvl = struct { | |
| 26882 | const param_str = "V256dV256diV256bV256dUi"; | |
| 26883 | const target_set = TargetSet.init(.{ | |
| 26884 | .vevl_gen = true, | |
| 26885 | }); | |
| 26886 | const attributes = Attributes{}; | |
| 26887 | }; | |
| 26888 | ||
| 26889 | pub const __builtin_ve_vl_vsrawsx_vvsvl = struct { | |
| 26890 | const param_str = "V256dV256diV256dUi"; | |
| 26891 | const target_set = TargetSet.init(.{ | |
| 26892 | .vevl_gen = true, | |
| 26893 | }); | |
| 26894 | const attributes = Attributes{}; | |
| 26895 | }; | |
| 26896 | ||
| 26897 | pub const __builtin_ve_vl_vsrawsx_vvvl = struct { | |
| 26898 | const param_str = "V256dV256dV256dUi"; | |
| 26899 | const target_set = TargetSet.init(.{ | |
| 26900 | .vevl_gen = true, | |
| 26901 | }); | |
| 26902 | const attributes = Attributes{}; | |
| 26903 | }; | |
| 26904 | ||
| 26905 | pub const __builtin_ve_vl_vsrawsx_vvvmvl = struct { | |
| 26906 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26907 | const target_set = TargetSet.init(.{ | |
| 26908 | .vevl_gen = true, | |
| 26909 | }); | |
| 26910 | const attributes = Attributes{}; | |
| 26911 | }; | |
| 26912 | ||
| 26913 | pub const __builtin_ve_vl_vsrawsx_vvvvl = struct { | |
| 26914 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26915 | const target_set = TargetSet.init(.{ | |
| 26916 | .vevl_gen = true, | |
| 26917 | }); | |
| 26918 | const attributes = Attributes{}; | |
| 26919 | }; | |
| 26920 | ||
| 26921 | pub const __builtin_ve_vl_vsrawzx_vvsl = struct { | |
| 26922 | const param_str = "V256dV256diUi"; | |
| 26923 | const target_set = TargetSet.init(.{ | |
| 26924 | .vevl_gen = true, | |
| 26925 | }); | |
| 26926 | const attributes = Attributes{}; | |
| 26927 | }; | |
| 26928 | ||
| 26929 | pub const __builtin_ve_vl_vsrawzx_vvsmvl = struct { | |
| 26930 | const param_str = "V256dV256diV256bV256dUi"; | |
| 26931 | const target_set = TargetSet.init(.{ | |
| 26932 | .vevl_gen = true, | |
| 26933 | }); | |
| 26934 | const attributes = Attributes{}; | |
| 26935 | }; | |
| 26936 | ||
| 26937 | pub const __builtin_ve_vl_vsrawzx_vvsvl = struct { | |
| 26938 | const param_str = "V256dV256diV256dUi"; | |
| 26939 | const target_set = TargetSet.init(.{ | |
| 26940 | .vevl_gen = true, | |
| 26941 | }); | |
| 26942 | const attributes = Attributes{}; | |
| 26943 | }; | |
| 26944 | ||
| 26945 | pub const __builtin_ve_vl_vsrawzx_vvvl = struct { | |
| 26946 | const param_str = "V256dV256dV256dUi"; | |
| 26947 | const target_set = TargetSet.init(.{ | |
| 26948 | .vevl_gen = true, | |
| 26949 | }); | |
| 26950 | const attributes = Attributes{}; | |
| 26951 | }; | |
| 26952 | ||
| 26953 | pub const __builtin_ve_vl_vsrawzx_vvvmvl = struct { | |
| 26954 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 26955 | const target_set = TargetSet.init(.{ | |
| 26956 | .vevl_gen = true, | |
| 26957 | }); | |
| 26958 | const attributes = Attributes{}; | |
| 26959 | }; | |
| 26960 | ||
| 26961 | pub const __builtin_ve_vl_vsrawzx_vvvvl = struct { | |
| 26962 | const param_str = "V256dV256dV256dV256dUi"; | |
| 26963 | const target_set = TargetSet.init(.{ | |
| 26964 | .vevl_gen = true, | |
| 26965 | }); | |
| 26966 | const attributes = Attributes{}; | |
| 26967 | }; | |
| 26968 | ||
| 26969 | pub const __builtin_ve_vl_vsrl_vvsl = struct { | |
| 26970 | const param_str = "V256dV256dLUiUi"; | |
| 26971 | const target_set = TargetSet.init(.{ | |
| 26972 | .vevl_gen = true, | |
| 26973 | }); | |
| 26974 | const attributes = Attributes{}; | |
| 26975 | }; | |
| 26976 | ||
| 26977 | pub const __builtin_ve_vl_vsrl_vvsmvl = struct { | |
| 26978 | const param_str = "V256dV256dLUiV256bV256dUi"; | |
| 26979 | const target_set = TargetSet.init(.{ | |
| 26980 | .vevl_gen = true, | |
| 26981 | }); | |
| 26982 | const attributes = Attributes{}; | |
| 26983 | }; | |
| 26984 | ||
| 26985 | pub const __builtin_ve_vl_vsrl_vvsvl = struct { | |
| 26986 | const param_str = "V256dV256dLUiV256dUi"; | |
| 26987 | const target_set = TargetSet.init(.{ | |
| 26988 | .vevl_gen = true, | |
| 26989 | }); | |
| 26990 | const attributes = Attributes{}; | |
| 26991 | }; | |
| 26992 | ||
| 26993 | pub const __builtin_ve_vl_vsrl_vvvl = struct { | |
| 26994 | const param_str = "V256dV256dV256dUi"; | |
| 26995 | const target_set = TargetSet.init(.{ | |
| 26996 | .vevl_gen = true, | |
| 26997 | }); | |
| 26998 | const attributes = Attributes{}; | |
| 26999 | }; | |
| 27000 | ||
| 27001 | pub const __builtin_ve_vl_vsrl_vvvmvl = struct { | |
| 27002 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27003 | const target_set = TargetSet.init(.{ | |
| 27004 | .vevl_gen = true, | |
| 27005 | }); | |
| 27006 | const attributes = Attributes{}; | |
| 27007 | }; | |
| 27008 | ||
| 27009 | pub const __builtin_ve_vl_vsrl_vvvvl = struct { | |
| 27010 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27011 | const target_set = TargetSet.init(.{ | |
| 27012 | .vevl_gen = true, | |
| 27013 | }); | |
| 27014 | const attributes = Attributes{}; | |
| 27015 | }; | |
| 27016 | ||
| 27017 | pub const __builtin_ve_vl_vst2d_vssl = struct { | |
| 27018 | const param_str = "vV256dLUiv*Ui"; | |
| 27019 | const target_set = TargetSet.init(.{ | |
| 27020 | .vevl_gen = true, | |
| 27021 | }); | |
| 27022 | const attributes = Attributes{}; | |
| 27023 | }; | |
| 27024 | ||
| 27025 | pub const __builtin_ve_vl_vst2d_vssml = struct { | |
| 27026 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27027 | const target_set = TargetSet.init(.{ | |
| 27028 | .vevl_gen = true, | |
| 27029 | }); | |
| 27030 | const attributes = Attributes{}; | |
| 27031 | }; | |
| 27032 | ||
| 27033 | pub const __builtin_ve_vl_vst2dnc_vssl = struct { | |
| 27034 | const param_str = "vV256dLUiv*Ui"; | |
| 27035 | const target_set = TargetSet.init(.{ | |
| 27036 | .vevl_gen = true, | |
| 27037 | }); | |
| 27038 | const attributes = Attributes{}; | |
| 27039 | }; | |
| 27040 | ||
| 27041 | pub const __builtin_ve_vl_vst2dnc_vssml = struct { | |
| 27042 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27043 | const target_set = TargetSet.init(.{ | |
| 27044 | .vevl_gen = true, | |
| 27045 | }); | |
| 27046 | const attributes = Attributes{}; | |
| 27047 | }; | |
| 27048 | ||
| 27049 | pub const __builtin_ve_vl_vst2dncot_vssl = struct { | |
| 27050 | const param_str = "vV256dLUiv*Ui"; | |
| 27051 | const target_set = TargetSet.init(.{ | |
| 27052 | .vevl_gen = true, | |
| 27053 | }); | |
| 27054 | const attributes = Attributes{}; | |
| 27055 | }; | |
| 27056 | ||
| 27057 | pub const __builtin_ve_vl_vst2dncot_vssml = struct { | |
| 27058 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27059 | const target_set = TargetSet.init(.{ | |
| 27060 | .vevl_gen = true, | |
| 27061 | }); | |
| 27062 | const attributes = Attributes{}; | |
| 27063 | }; | |
| 27064 | ||
| 27065 | pub const __builtin_ve_vl_vst2dot_vssl = struct { | |
| 27066 | const param_str = "vV256dLUiv*Ui"; | |
| 27067 | const target_set = TargetSet.init(.{ | |
| 27068 | .vevl_gen = true, | |
| 27069 | }); | |
| 27070 | const attributes = Attributes{}; | |
| 27071 | }; | |
| 27072 | ||
| 27073 | pub const __builtin_ve_vl_vst2dot_vssml = struct { | |
| 27074 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27075 | const target_set = TargetSet.init(.{ | |
| 27076 | .vevl_gen = true, | |
| 27077 | }); | |
| 27078 | const attributes = Attributes{}; | |
| 27079 | }; | |
| 27080 | ||
| 27081 | pub const __builtin_ve_vl_vst_vssl = struct { | |
| 27082 | const param_str = "vV256dLUiv*Ui"; | |
| 27083 | const target_set = TargetSet.init(.{ | |
| 27084 | .vevl_gen = true, | |
| 27085 | }); | |
| 27086 | const attributes = Attributes{}; | |
| 27087 | }; | |
| 27088 | ||
| 27089 | pub const __builtin_ve_vl_vst_vssml = struct { | |
| 27090 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27091 | const target_set = TargetSet.init(.{ | |
| 27092 | .vevl_gen = true, | |
| 27093 | }); | |
| 27094 | const attributes = Attributes{}; | |
| 27095 | }; | |
| 27096 | ||
| 27097 | pub const __builtin_ve_vl_vstl2d_vssl = struct { | |
| 27098 | const param_str = "vV256dLUiv*Ui"; | |
| 27099 | const target_set = TargetSet.init(.{ | |
| 27100 | .vevl_gen = true, | |
| 27101 | }); | |
| 27102 | const attributes = Attributes{}; | |
| 27103 | }; | |
| 27104 | ||
| 27105 | pub const __builtin_ve_vl_vstl2d_vssml = struct { | |
| 27106 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27107 | const target_set = TargetSet.init(.{ | |
| 27108 | .vevl_gen = true, | |
| 27109 | }); | |
| 27110 | const attributes = Attributes{}; | |
| 27111 | }; | |
| 27112 | ||
| 27113 | pub const __builtin_ve_vl_vstl2dnc_vssl = struct { | |
| 27114 | const param_str = "vV256dLUiv*Ui"; | |
| 27115 | const target_set = TargetSet.init(.{ | |
| 27116 | .vevl_gen = true, | |
| 27117 | }); | |
| 27118 | const attributes = Attributes{}; | |
| 27119 | }; | |
| 27120 | ||
| 27121 | pub const __builtin_ve_vl_vstl2dnc_vssml = struct { | |
| 27122 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27123 | const target_set = TargetSet.init(.{ | |
| 27124 | .vevl_gen = true, | |
| 27125 | }); | |
| 27126 | const attributes = Attributes{}; | |
| 27127 | }; | |
| 27128 | ||
| 27129 | pub const __builtin_ve_vl_vstl2dncot_vssl = struct { | |
| 27130 | const param_str = "vV256dLUiv*Ui"; | |
| 27131 | const target_set = TargetSet.init(.{ | |
| 27132 | .vevl_gen = true, | |
| 27133 | }); | |
| 27134 | const attributes = Attributes{}; | |
| 27135 | }; | |
| 27136 | ||
| 27137 | pub const __builtin_ve_vl_vstl2dncot_vssml = struct { | |
| 27138 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27139 | const target_set = TargetSet.init(.{ | |
| 27140 | .vevl_gen = true, | |
| 27141 | }); | |
| 27142 | const attributes = Attributes{}; | |
| 27143 | }; | |
| 27144 | ||
| 27145 | pub const __builtin_ve_vl_vstl2dot_vssl = struct { | |
| 27146 | const param_str = "vV256dLUiv*Ui"; | |
| 27147 | const target_set = TargetSet.init(.{ | |
| 27148 | .vevl_gen = true, | |
| 27149 | }); | |
| 27150 | const attributes = Attributes{}; | |
| 27151 | }; | |
| 27152 | ||
| 27153 | pub const __builtin_ve_vl_vstl2dot_vssml = struct { | |
| 27154 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27155 | const target_set = TargetSet.init(.{ | |
| 27156 | .vevl_gen = true, | |
| 27157 | }); | |
| 27158 | const attributes = Attributes{}; | |
| 27159 | }; | |
| 27160 | ||
| 27161 | pub const __builtin_ve_vl_vstl_vssl = struct { | |
| 27162 | const param_str = "vV256dLUiv*Ui"; | |
| 27163 | const target_set = TargetSet.init(.{ | |
| 27164 | .vevl_gen = true, | |
| 27165 | }); | |
| 27166 | const attributes = Attributes{}; | |
| 27167 | }; | |
| 27168 | ||
| 27169 | pub const __builtin_ve_vl_vstl_vssml = struct { | |
| 27170 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27171 | const target_set = TargetSet.init(.{ | |
| 27172 | .vevl_gen = true, | |
| 27173 | }); | |
| 27174 | const attributes = Attributes{}; | |
| 27175 | }; | |
| 27176 | ||
| 27177 | pub const __builtin_ve_vl_vstlnc_vssl = struct { | |
| 27178 | const param_str = "vV256dLUiv*Ui"; | |
| 27179 | const target_set = TargetSet.init(.{ | |
| 27180 | .vevl_gen = true, | |
| 27181 | }); | |
| 27182 | const attributes = Attributes{}; | |
| 27183 | }; | |
| 27184 | ||
| 27185 | pub const __builtin_ve_vl_vstlnc_vssml = struct { | |
| 27186 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27187 | const target_set = TargetSet.init(.{ | |
| 27188 | .vevl_gen = true, | |
| 27189 | }); | |
| 27190 | const attributes = Attributes{}; | |
| 27191 | }; | |
| 27192 | ||
| 27193 | pub const __builtin_ve_vl_vstlncot_vssl = struct { | |
| 27194 | const param_str = "vV256dLUiv*Ui"; | |
| 27195 | const target_set = TargetSet.init(.{ | |
| 27196 | .vevl_gen = true, | |
| 27197 | }); | |
| 27198 | const attributes = Attributes{}; | |
| 27199 | }; | |
| 27200 | ||
| 27201 | pub const __builtin_ve_vl_vstlncot_vssml = struct { | |
| 27202 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27203 | const target_set = TargetSet.init(.{ | |
| 27204 | .vevl_gen = true, | |
| 27205 | }); | |
| 27206 | const attributes = Attributes{}; | |
| 27207 | }; | |
| 27208 | ||
| 27209 | pub const __builtin_ve_vl_vstlot_vssl = struct { | |
| 27210 | const param_str = "vV256dLUiv*Ui"; | |
| 27211 | const target_set = TargetSet.init(.{ | |
| 27212 | .vevl_gen = true, | |
| 27213 | }); | |
| 27214 | const attributes = Attributes{}; | |
| 27215 | }; | |
| 27216 | ||
| 27217 | pub const __builtin_ve_vl_vstlot_vssml = struct { | |
| 27218 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27219 | const target_set = TargetSet.init(.{ | |
| 27220 | .vevl_gen = true, | |
| 27221 | }); | |
| 27222 | const attributes = Attributes{}; | |
| 27223 | }; | |
| 27224 | ||
| 27225 | pub const __builtin_ve_vl_vstnc_vssl = struct { | |
| 27226 | const param_str = "vV256dLUiv*Ui"; | |
| 27227 | const target_set = TargetSet.init(.{ | |
| 27228 | .vevl_gen = true, | |
| 27229 | }); | |
| 27230 | const attributes = Attributes{}; | |
| 27231 | }; | |
| 27232 | ||
| 27233 | pub const __builtin_ve_vl_vstnc_vssml = struct { | |
| 27234 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27235 | const target_set = TargetSet.init(.{ | |
| 27236 | .vevl_gen = true, | |
| 27237 | }); | |
| 27238 | const attributes = Attributes{}; | |
| 27239 | }; | |
| 27240 | ||
| 27241 | pub const __builtin_ve_vl_vstncot_vssl = struct { | |
| 27242 | const param_str = "vV256dLUiv*Ui"; | |
| 27243 | const target_set = TargetSet.init(.{ | |
| 27244 | .vevl_gen = true, | |
| 27245 | }); | |
| 27246 | const attributes = Attributes{}; | |
| 27247 | }; | |
| 27248 | ||
| 27249 | pub const __builtin_ve_vl_vstncot_vssml = struct { | |
| 27250 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27251 | const target_set = TargetSet.init(.{ | |
| 27252 | .vevl_gen = true, | |
| 27253 | }); | |
| 27254 | const attributes = Attributes{}; | |
| 27255 | }; | |
| 27256 | ||
| 27257 | pub const __builtin_ve_vl_vstot_vssl = struct { | |
| 27258 | const param_str = "vV256dLUiv*Ui"; | |
| 27259 | const target_set = TargetSet.init(.{ | |
| 27260 | .vevl_gen = true, | |
| 27261 | }); | |
| 27262 | const attributes = Attributes{}; | |
| 27263 | }; | |
| 27264 | ||
| 27265 | pub const __builtin_ve_vl_vstot_vssml = struct { | |
| 27266 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27267 | const target_set = TargetSet.init(.{ | |
| 27268 | .vevl_gen = true, | |
| 27269 | }); | |
| 27270 | const attributes = Attributes{}; | |
| 27271 | }; | |
| 27272 | ||
| 27273 | pub const __builtin_ve_vl_vstu2d_vssl = struct { | |
| 27274 | const param_str = "vV256dLUiv*Ui"; | |
| 27275 | const target_set = TargetSet.init(.{ | |
| 27276 | .vevl_gen = true, | |
| 27277 | }); | |
| 27278 | const attributes = Attributes{}; | |
| 27279 | }; | |
| 27280 | ||
| 27281 | pub const __builtin_ve_vl_vstu2d_vssml = struct { | |
| 27282 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27283 | const target_set = TargetSet.init(.{ | |
| 27284 | .vevl_gen = true, | |
| 27285 | }); | |
| 27286 | const attributes = Attributes{}; | |
| 27287 | }; | |
| 27288 | ||
| 27289 | pub const __builtin_ve_vl_vstu2dnc_vssl = struct { | |
| 27290 | const param_str = "vV256dLUiv*Ui"; | |
| 27291 | const target_set = TargetSet.init(.{ | |
| 27292 | .vevl_gen = true, | |
| 27293 | }); | |
| 27294 | const attributes = Attributes{}; | |
| 27295 | }; | |
| 27296 | ||
| 27297 | pub const __builtin_ve_vl_vstu2dnc_vssml = struct { | |
| 27298 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27299 | const target_set = TargetSet.init(.{ | |
| 27300 | .vevl_gen = true, | |
| 27301 | }); | |
| 27302 | const attributes = Attributes{}; | |
| 27303 | }; | |
| 27304 | ||
| 27305 | pub const __builtin_ve_vl_vstu2dncot_vssl = struct { | |
| 27306 | const param_str = "vV256dLUiv*Ui"; | |
| 27307 | const target_set = TargetSet.init(.{ | |
| 27308 | .vevl_gen = true, | |
| 27309 | }); | |
| 27310 | const attributes = Attributes{}; | |
| 27311 | }; | |
| 27312 | ||
| 27313 | pub const __builtin_ve_vl_vstu2dncot_vssml = struct { | |
| 27314 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27315 | const target_set = TargetSet.init(.{ | |
| 27316 | .vevl_gen = true, | |
| 27317 | }); | |
| 27318 | const attributes = Attributes{}; | |
| 27319 | }; | |
| 27320 | ||
| 27321 | pub const __builtin_ve_vl_vstu2dot_vssl = struct { | |
| 27322 | const param_str = "vV256dLUiv*Ui"; | |
| 27323 | const target_set = TargetSet.init(.{ | |
| 27324 | .vevl_gen = true, | |
| 27325 | }); | |
| 27326 | const attributes = Attributes{}; | |
| 27327 | }; | |
| 27328 | ||
| 27329 | pub const __builtin_ve_vl_vstu2dot_vssml = struct { | |
| 27330 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27331 | const target_set = TargetSet.init(.{ | |
| 27332 | .vevl_gen = true, | |
| 27333 | }); | |
| 27334 | const attributes = Attributes{}; | |
| 27335 | }; | |
| 27336 | ||
| 27337 | pub const __builtin_ve_vl_vstu_vssl = struct { | |
| 27338 | const param_str = "vV256dLUiv*Ui"; | |
| 27339 | const target_set = TargetSet.init(.{ | |
| 27340 | .vevl_gen = true, | |
| 27341 | }); | |
| 27342 | const attributes = Attributes{}; | |
| 27343 | }; | |
| 27344 | ||
| 27345 | pub const __builtin_ve_vl_vstu_vssml = struct { | |
| 27346 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27347 | const target_set = TargetSet.init(.{ | |
| 27348 | .vevl_gen = true, | |
| 27349 | }); | |
| 27350 | const attributes = Attributes{}; | |
| 27351 | }; | |
| 27352 | ||
| 27353 | pub const __builtin_ve_vl_vstunc_vssl = struct { | |
| 27354 | const param_str = "vV256dLUiv*Ui"; | |
| 27355 | const target_set = TargetSet.init(.{ | |
| 27356 | .vevl_gen = true, | |
| 27357 | }); | |
| 27358 | const attributes = Attributes{}; | |
| 27359 | }; | |
| 27360 | ||
| 27361 | pub const __builtin_ve_vl_vstunc_vssml = struct { | |
| 27362 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27363 | const target_set = TargetSet.init(.{ | |
| 27364 | .vevl_gen = true, | |
| 27365 | }); | |
| 27366 | const attributes = Attributes{}; | |
| 27367 | }; | |
| 27368 | ||
| 27369 | pub const __builtin_ve_vl_vstuncot_vssl = struct { | |
| 27370 | const param_str = "vV256dLUiv*Ui"; | |
| 27371 | const target_set = TargetSet.init(.{ | |
| 27372 | .vevl_gen = true, | |
| 27373 | }); | |
| 27374 | const attributes = Attributes{}; | |
| 27375 | }; | |
| 27376 | ||
| 27377 | pub const __builtin_ve_vl_vstuncot_vssml = struct { | |
| 27378 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27379 | const target_set = TargetSet.init(.{ | |
| 27380 | .vevl_gen = true, | |
| 27381 | }); | |
| 27382 | const attributes = Attributes{}; | |
| 27383 | }; | |
| 27384 | ||
| 27385 | pub const __builtin_ve_vl_vstuot_vssl = struct { | |
| 27386 | const param_str = "vV256dLUiv*Ui"; | |
| 27387 | const target_set = TargetSet.init(.{ | |
| 27388 | .vevl_gen = true, | |
| 27389 | }); | |
| 27390 | const attributes = Attributes{}; | |
| 27391 | }; | |
| 27392 | ||
| 27393 | pub const __builtin_ve_vl_vstuot_vssml = struct { | |
| 27394 | const param_str = "vV256dLUiv*V256bUi"; | |
| 27395 | const target_set = TargetSet.init(.{ | |
| 27396 | .vevl_gen = true, | |
| 27397 | }); | |
| 27398 | const attributes = Attributes{}; | |
| 27399 | }; | |
| 27400 | ||
| 27401 | pub const __builtin_ve_vl_vsubsl_vsvl = struct { | |
| 27402 | const param_str = "V256dLiV256dUi"; | |
| 27403 | const target_set = TargetSet.init(.{ | |
| 27404 | .vevl_gen = true, | |
| 27405 | }); | |
| 27406 | const attributes = Attributes{}; | |
| 27407 | }; | |
| 27408 | ||
| 27409 | pub const __builtin_ve_vl_vsubsl_vsvmvl = struct { | |
| 27410 | const param_str = "V256dLiV256dV256bV256dUi"; | |
| 27411 | const target_set = TargetSet.init(.{ | |
| 27412 | .vevl_gen = true, | |
| 27413 | }); | |
| 27414 | const attributes = Attributes{}; | |
| 27415 | }; | |
| 27416 | ||
| 27417 | pub const __builtin_ve_vl_vsubsl_vsvvl = struct { | |
| 27418 | const param_str = "V256dLiV256dV256dUi"; | |
| 27419 | const target_set = TargetSet.init(.{ | |
| 27420 | .vevl_gen = true, | |
| 27421 | }); | |
| 27422 | const attributes = Attributes{}; | |
| 27423 | }; | |
| 27424 | ||
| 27425 | pub const __builtin_ve_vl_vsubsl_vvvl = struct { | |
| 27426 | const param_str = "V256dV256dV256dUi"; | |
| 27427 | const target_set = TargetSet.init(.{ | |
| 27428 | .vevl_gen = true, | |
| 27429 | }); | |
| 27430 | const attributes = Attributes{}; | |
| 27431 | }; | |
| 27432 | ||
| 27433 | pub const __builtin_ve_vl_vsubsl_vvvmvl = struct { | |
| 27434 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27435 | const target_set = TargetSet.init(.{ | |
| 27436 | .vevl_gen = true, | |
| 27437 | }); | |
| 27438 | const attributes = Attributes{}; | |
| 27439 | }; | |
| 27440 | ||
| 27441 | pub const __builtin_ve_vl_vsubsl_vvvvl = struct { | |
| 27442 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27443 | const target_set = TargetSet.init(.{ | |
| 27444 | .vevl_gen = true, | |
| 27445 | }); | |
| 27446 | const attributes = Attributes{}; | |
| 27447 | }; | |
| 27448 | ||
| 27449 | pub const __builtin_ve_vl_vsubswsx_vsvl = struct { | |
| 27450 | const param_str = "V256diV256dUi"; | |
| 27451 | const target_set = TargetSet.init(.{ | |
| 27452 | .vevl_gen = true, | |
| 27453 | }); | |
| 27454 | const attributes = Attributes{}; | |
| 27455 | }; | |
| 27456 | ||
| 27457 | pub const __builtin_ve_vl_vsubswsx_vsvmvl = struct { | |
| 27458 | const param_str = "V256diV256dV256bV256dUi"; | |
| 27459 | const target_set = TargetSet.init(.{ | |
| 27460 | .vevl_gen = true, | |
| 27461 | }); | |
| 27462 | const attributes = Attributes{}; | |
| 27463 | }; | |
| 27464 | ||
| 27465 | pub const __builtin_ve_vl_vsubswsx_vsvvl = struct { | |
| 27466 | const param_str = "V256diV256dV256dUi"; | |
| 27467 | const target_set = TargetSet.init(.{ | |
| 27468 | .vevl_gen = true, | |
| 27469 | }); | |
| 27470 | const attributes = Attributes{}; | |
| 27471 | }; | |
| 27472 | ||
| 27473 | pub const __builtin_ve_vl_vsubswsx_vvvl = struct { | |
| 27474 | const param_str = "V256dV256dV256dUi"; | |
| 27475 | const target_set = TargetSet.init(.{ | |
| 27476 | .vevl_gen = true, | |
| 27477 | }); | |
| 27478 | const attributes = Attributes{}; | |
| 27479 | }; | |
| 27480 | ||
| 27481 | pub const __builtin_ve_vl_vsubswsx_vvvmvl = struct { | |
| 27482 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27483 | const target_set = TargetSet.init(.{ | |
| 27484 | .vevl_gen = true, | |
| 27485 | }); | |
| 27486 | const attributes = Attributes{}; | |
| 27487 | }; | |
| 27488 | ||
| 27489 | pub const __builtin_ve_vl_vsubswsx_vvvvl = struct { | |
| 27490 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27491 | const target_set = TargetSet.init(.{ | |
| 27492 | .vevl_gen = true, | |
| 27493 | }); | |
| 27494 | const attributes = Attributes{}; | |
| 27495 | }; | |
| 27496 | ||
| 27497 | pub const __builtin_ve_vl_vsubswzx_vsvl = struct { | |
| 27498 | const param_str = "V256diV256dUi"; | |
| 27499 | const target_set = TargetSet.init(.{ | |
| 27500 | .vevl_gen = true, | |
| 27501 | }); | |
| 27502 | const attributes = Attributes{}; | |
| 27503 | }; | |
| 27504 | ||
| 27505 | pub const __builtin_ve_vl_vsubswzx_vsvmvl = struct { | |
| 27506 | const param_str = "V256diV256dV256bV256dUi"; | |
| 27507 | const target_set = TargetSet.init(.{ | |
| 27508 | .vevl_gen = true, | |
| 27509 | }); | |
| 27510 | const attributes = Attributes{}; | |
| 27511 | }; | |
| 27512 | ||
| 27513 | pub const __builtin_ve_vl_vsubswzx_vsvvl = struct { | |
| 27514 | const param_str = "V256diV256dV256dUi"; | |
| 27515 | const target_set = TargetSet.init(.{ | |
| 27516 | .vevl_gen = true, | |
| 27517 | }); | |
| 27518 | const attributes = Attributes{}; | |
| 27519 | }; | |
| 27520 | ||
| 27521 | pub const __builtin_ve_vl_vsubswzx_vvvl = struct { | |
| 27522 | const param_str = "V256dV256dV256dUi"; | |
| 27523 | const target_set = TargetSet.init(.{ | |
| 27524 | .vevl_gen = true, | |
| 27525 | }); | |
| 27526 | const attributes = Attributes{}; | |
| 27527 | }; | |
| 27528 | ||
| 27529 | pub const __builtin_ve_vl_vsubswzx_vvvmvl = struct { | |
| 27530 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27531 | const target_set = TargetSet.init(.{ | |
| 27532 | .vevl_gen = true, | |
| 27533 | }); | |
| 27534 | const attributes = Attributes{}; | |
| 27535 | }; | |
| 27536 | ||
| 27537 | pub const __builtin_ve_vl_vsubswzx_vvvvl = struct { | |
| 27538 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27539 | const target_set = TargetSet.init(.{ | |
| 27540 | .vevl_gen = true, | |
| 27541 | }); | |
| 27542 | const attributes = Attributes{}; | |
| 27543 | }; | |
| 27544 | ||
| 27545 | pub const __builtin_ve_vl_vsubul_vsvl = struct { | |
| 27546 | const param_str = "V256dLUiV256dUi"; | |
| 27547 | const target_set = TargetSet.init(.{ | |
| 27548 | .vevl_gen = true, | |
| 27549 | }); | |
| 27550 | const attributes = Attributes{}; | |
| 27551 | }; | |
| 27552 | ||
| 27553 | pub const __builtin_ve_vl_vsubul_vsvmvl = struct { | |
| 27554 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 27555 | const target_set = TargetSet.init(.{ | |
| 27556 | .vevl_gen = true, | |
| 27557 | }); | |
| 27558 | const attributes = Attributes{}; | |
| 27559 | }; | |
| 27560 | ||
| 27561 | pub const __builtin_ve_vl_vsubul_vsvvl = struct { | |
| 27562 | const param_str = "V256dLUiV256dV256dUi"; | |
| 27563 | const target_set = TargetSet.init(.{ | |
| 27564 | .vevl_gen = true, | |
| 27565 | }); | |
| 27566 | const attributes = Attributes{}; | |
| 27567 | }; | |
| 27568 | ||
| 27569 | pub const __builtin_ve_vl_vsubul_vvvl = struct { | |
| 27570 | const param_str = "V256dV256dV256dUi"; | |
| 27571 | const target_set = TargetSet.init(.{ | |
| 27572 | .vevl_gen = true, | |
| 27573 | }); | |
| 27574 | const attributes = Attributes{}; | |
| 27575 | }; | |
| 27576 | ||
| 27577 | pub const __builtin_ve_vl_vsubul_vvvmvl = struct { | |
| 27578 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27579 | const target_set = TargetSet.init(.{ | |
| 27580 | .vevl_gen = true, | |
| 27581 | }); | |
| 27582 | const attributes = Attributes{}; | |
| 27583 | }; | |
| 27584 | ||
| 27585 | pub const __builtin_ve_vl_vsubul_vvvvl = struct { | |
| 27586 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27587 | const target_set = TargetSet.init(.{ | |
| 27588 | .vevl_gen = true, | |
| 27589 | }); | |
| 27590 | const attributes = Attributes{}; | |
| 27591 | }; | |
| 27592 | ||
| 27593 | pub const __builtin_ve_vl_vsubuw_vsvl = struct { | |
| 27594 | const param_str = "V256dUiV256dUi"; | |
| 27595 | const target_set = TargetSet.init(.{ | |
| 27596 | .vevl_gen = true, | |
| 27597 | }); | |
| 27598 | const attributes = Attributes{}; | |
| 27599 | }; | |
| 27600 | ||
| 27601 | pub const __builtin_ve_vl_vsubuw_vsvmvl = struct { | |
| 27602 | const param_str = "V256dUiV256dV256bV256dUi"; | |
| 27603 | const target_set = TargetSet.init(.{ | |
| 27604 | .vevl_gen = true, | |
| 27605 | }); | |
| 27606 | const attributes = Attributes{}; | |
| 27607 | }; | |
| 27608 | ||
| 27609 | pub const __builtin_ve_vl_vsubuw_vsvvl = struct { | |
| 27610 | const param_str = "V256dUiV256dV256dUi"; | |
| 27611 | const target_set = TargetSet.init(.{ | |
| 27612 | .vevl_gen = true, | |
| 27613 | }); | |
| 27614 | const attributes = Attributes{}; | |
| 27615 | }; | |
| 27616 | ||
| 27617 | pub const __builtin_ve_vl_vsubuw_vvvl = struct { | |
| 27618 | const param_str = "V256dV256dV256dUi"; | |
| 27619 | const target_set = TargetSet.init(.{ | |
| 27620 | .vevl_gen = true, | |
| 27621 | }); | |
| 27622 | const attributes = Attributes{}; | |
| 27623 | }; | |
| 27624 | ||
| 27625 | pub const __builtin_ve_vl_vsubuw_vvvmvl = struct { | |
| 27626 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27627 | const target_set = TargetSet.init(.{ | |
| 27628 | .vevl_gen = true, | |
| 27629 | }); | |
| 27630 | const attributes = Attributes{}; | |
| 27631 | }; | |
| 27632 | ||
| 27633 | pub const __builtin_ve_vl_vsubuw_vvvvl = struct { | |
| 27634 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27635 | const target_set = TargetSet.init(.{ | |
| 27636 | .vevl_gen = true, | |
| 27637 | }); | |
| 27638 | const attributes = Attributes{}; | |
| 27639 | }; | |
| 27640 | ||
| 27641 | pub const __builtin_ve_vl_vsuml_vvl = struct { | |
| 27642 | const param_str = "V256dV256dUi"; | |
| 27643 | const target_set = TargetSet.init(.{ | |
| 27644 | .vevl_gen = true, | |
| 27645 | }); | |
| 27646 | const attributes = Attributes{}; | |
| 27647 | }; | |
| 27648 | ||
| 27649 | pub const __builtin_ve_vl_vsuml_vvml = struct { | |
| 27650 | const param_str = "V256dV256dV256bUi"; | |
| 27651 | const target_set = TargetSet.init(.{ | |
| 27652 | .vevl_gen = true, | |
| 27653 | }); | |
| 27654 | const attributes = Attributes{}; | |
| 27655 | }; | |
| 27656 | ||
| 27657 | pub const __builtin_ve_vl_vsumwsx_vvl = struct { | |
| 27658 | const param_str = "V256dV256dUi"; | |
| 27659 | const target_set = TargetSet.init(.{ | |
| 27660 | .vevl_gen = true, | |
| 27661 | }); | |
| 27662 | const attributes = Attributes{}; | |
| 27663 | }; | |
| 27664 | ||
| 27665 | pub const __builtin_ve_vl_vsumwsx_vvml = struct { | |
| 27666 | const param_str = "V256dV256dV256bUi"; | |
| 27667 | const target_set = TargetSet.init(.{ | |
| 27668 | .vevl_gen = true, | |
| 27669 | }); | |
| 27670 | const attributes = Attributes{}; | |
| 27671 | }; | |
| 27672 | ||
| 27673 | pub const __builtin_ve_vl_vsumwzx_vvl = struct { | |
| 27674 | const param_str = "V256dV256dUi"; | |
| 27675 | const target_set = TargetSet.init(.{ | |
| 27676 | .vevl_gen = true, | |
| 27677 | }); | |
| 27678 | const attributes = Attributes{}; | |
| 27679 | }; | |
| 27680 | ||
| 27681 | pub const __builtin_ve_vl_vsumwzx_vvml = struct { | |
| 27682 | const param_str = "V256dV256dV256bUi"; | |
| 27683 | const target_set = TargetSet.init(.{ | |
| 27684 | .vevl_gen = true, | |
| 27685 | }); | |
| 27686 | const attributes = Attributes{}; | |
| 27687 | }; | |
| 27688 | ||
| 27689 | pub const __builtin_ve_vl_vxor_vsvl = struct { | |
| 27690 | const param_str = "V256dLUiV256dUi"; | |
| 27691 | const target_set = TargetSet.init(.{ | |
| 27692 | .vevl_gen = true, | |
| 27693 | }); | |
| 27694 | const attributes = Attributes{}; | |
| 27695 | }; | |
| 27696 | ||
| 27697 | pub const __builtin_ve_vl_vxor_vsvmvl = struct { | |
| 27698 | const param_str = "V256dLUiV256dV256bV256dUi"; | |
| 27699 | const target_set = TargetSet.init(.{ | |
| 27700 | .vevl_gen = true, | |
| 27701 | }); | |
| 27702 | const attributes = Attributes{}; | |
| 27703 | }; | |
| 27704 | ||
| 27705 | pub const __builtin_ve_vl_vxor_vsvvl = struct { | |
| 27706 | const param_str = "V256dLUiV256dV256dUi"; | |
| 27707 | const target_set = TargetSet.init(.{ | |
| 27708 | .vevl_gen = true, | |
| 27709 | }); | |
| 27710 | const attributes = Attributes{}; | |
| 27711 | }; | |
| 27712 | ||
| 27713 | pub const __builtin_ve_vl_vxor_vvvl = struct { | |
| 27714 | const param_str = "V256dV256dV256dUi"; | |
| 27715 | const target_set = TargetSet.init(.{ | |
| 27716 | .vevl_gen = true, | |
| 27717 | }); | |
| 27718 | const attributes = Attributes{}; | |
| 27719 | }; | |
| 27720 | ||
| 27721 | pub const __builtin_ve_vl_vxor_vvvmvl = struct { | |
| 27722 | const param_str = "V256dV256dV256dV256bV256dUi"; | |
| 27723 | const target_set = TargetSet.init(.{ | |
| 27724 | .vevl_gen = true, | |
| 27725 | }); | |
| 27726 | const attributes = Attributes{}; | |
| 27727 | }; | |
| 27728 | ||
| 27729 | pub const __builtin_ve_vl_vxor_vvvvl = struct { | |
| 27730 | const param_str = "V256dV256dV256dV256dUi"; | |
| 27731 | const target_set = TargetSet.init(.{ | |
| 27732 | .vevl_gen = true, | |
| 27733 | }); | |
| 27734 | const attributes = Attributes{}; | |
| 27735 | }; | |
| 27736 | ||
| 27737 | pub const __builtin_ve_vl_xorm_MMM = struct { | |
| 27738 | const param_str = "V512bV512bV512b"; | |
| 27739 | const target_set = TargetSet.init(.{ | |
| 27740 | .vevl_gen = true, | |
| 27741 | }); | |
| 27742 | const attributes = Attributes{}; | |
| 27743 | }; | |
| 27744 | ||
| 27745 | pub const __builtin_ve_vl_xorm_mmm = struct { | |
| 27746 | const param_str = "V256bV256bV256b"; | |
| 27747 | const target_set = TargetSet.init(.{ | |
| 27748 | .vevl_gen = true, | |
| 27749 | }); | |
| 27750 | const attributes = Attributes{}; | |
| 27751 | }; | |
| 27752 | ||
| 27753 | pub const __builtin_vsnprintf = struct { | |
| 27754 | const param_str = "ic*zcC*a"; | |
| 27755 | const attributes = Attributes{ | |
| 27756 | .lib_function_with_builtin_prefix = true, | |
| 27757 | .format_kind = .vprintf, | |
| 27758 | .format_string_position = 2, | |
| 27759 | }; | |
| 27760 | }; | |
| 27761 | ||
| 27762 | pub const __builtin_vsprintf = struct { | |
| 27763 | const param_str = "ic*cC*a"; | |
| 27764 | const attributes = Attributes{ | |
| 27765 | .lib_function_with_builtin_prefix = true, | |
| 27766 | .format_kind = .vprintf, | |
| 27767 | .format_string_position = 1, | |
| 27768 | }; | |
| 27769 | }; | |
| 27770 | ||
| 27771 | pub const __builtin_vsx_extractuword = struct { | |
| 27772 | const param_str = "V2ULLiV16UcIi"; | |
| 27773 | const target_set = TargetSet.init(.{ | |
| 27774 | .ppc = true, | |
| 27775 | }); | |
| 27776 | }; | |
| 27777 | ||
| 27778 | pub const __builtin_vsx_insertword = struct { | |
| 27779 | const param_str = "V16UcV4UiV16UcIi"; | |
| 27780 | const target_set = TargetSet.init(.{ | |
| 27781 | .ppc = true, | |
| 27782 | }); | |
| 27783 | }; | |
| 27784 | ||
| 27785 | pub const __builtin_vsx_ldrmb = struct { | |
| 27786 | const param_str = "V16UcCc*Ii"; | |
| 27787 | const target_set = TargetSet.init(.{ | |
| 27788 | .ppc = true, | |
| 27789 | }); | |
| 27790 | }; | |
| 27791 | ||
| 27792 | pub const __builtin_vsx_lxvd2x = struct { | |
| 27793 | const param_str = "V2dLivC*"; | |
| 27794 | const target_set = TargetSet.init(.{ | |
| 27795 | .ppc = true, | |
| 27796 | }); | |
| 27797 | }; | |
| 27798 | ||
| 27799 | pub const __builtin_vsx_lxvd2x_be = struct { | |
| 27800 | const param_str = "V2dSLLivC*"; | |
| 27801 | const target_set = TargetSet.init(.{ | |
| 27802 | .ppc = true, | |
| 27803 | }); | |
| 27804 | }; | |
| 27805 | ||
| 27806 | pub const __builtin_vsx_lxvl = struct { | |
| 27807 | const param_str = "V4ivC*ULLi"; | |
| 27808 | const target_set = TargetSet.init(.{ | |
| 27809 | .ppc = true, | |
| 27810 | }); | |
| 27811 | }; | |
| 27812 | ||
| 27813 | pub const __builtin_vsx_lxvll = struct { | |
| 27814 | const param_str = "V4ivC*ULLi"; | |
| 27815 | const target_set = TargetSet.init(.{ | |
| 27816 | .ppc = true, | |
| 27817 | }); | |
| 27818 | }; | |
| 27819 | ||
| 27820 | pub const __builtin_vsx_lxvw4x = struct { | |
| 27821 | const param_str = "V4iLivC*"; | |
| 27822 | const target_set = TargetSet.init(.{ | |
| 27823 | .ppc = true, | |
| 27824 | }); | |
| 27825 | }; | |
| 27826 | ||
| 27827 | pub const __builtin_vsx_lxvw4x_be = struct { | |
| 27828 | const param_str = "V4iSLLivC*"; | |
| 27829 | const target_set = TargetSet.init(.{ | |
| 27830 | .ppc = true, | |
| 27831 | }); | |
| 27832 | }; | |
| 27833 | ||
| 27834 | pub const __builtin_vsx_scalar_extract_expq = struct { | |
| 27835 | const param_str = "ULLiLLd"; | |
| 27836 | const target_set = TargetSet.init(.{ | |
| 27837 | .ppc = true, | |
| 27838 | }); | |
| 27839 | }; | |
| 27840 | ||
| 27841 | pub const __builtin_vsx_scalar_insert_exp_qp = struct { | |
| 27842 | const param_str = "LLdLLdULLi"; | |
| 27843 | const target_set = TargetSet.init(.{ | |
| 27844 | .ppc = true, | |
| 27845 | }); | |
| 27846 | }; | |
| 27847 | ||
| 27848 | pub const __builtin_vsx_strmb = struct { | |
| 27849 | const param_str = "vCc*IiV16Uc"; | |
| 27850 | const target_set = TargetSet.init(.{ | |
| 27851 | .ppc = true, | |
| 27852 | }); | |
| 27853 | }; | |
| 27854 | ||
| 27855 | pub const __builtin_vsx_stxvd2x = struct { | |
| 27856 | const param_str = "vV2dLiv*"; | |
| 27857 | const target_set = TargetSet.init(.{ | |
| 27858 | .ppc = true, | |
| 27859 | }); | |
| 27860 | }; | |
| 27861 | ||
| 27862 | pub const __builtin_vsx_stxvd2x_be = struct { | |
| 27863 | const param_str = "vV2dSLLivC*"; | |
| 27864 | const target_set = TargetSet.init(.{ | |
| 27865 | .ppc = true, | |
| 27866 | }); | |
| 27867 | }; | |
| 27868 | ||
| 27869 | pub const __builtin_vsx_stxvl = struct { | |
| 27870 | const param_str = "vV4iv*ULLi"; | |
| 27871 | const target_set = TargetSet.init(.{ | |
| 27872 | .ppc = true, | |
| 27873 | }); | |
| 27874 | }; | |
| 27875 | ||
| 27876 | pub const __builtin_vsx_stxvll = struct { | |
| 27877 | const param_str = "vV4iv*ULLi"; | |
| 27878 | const target_set = TargetSet.init(.{ | |
| 27879 | .ppc = true, | |
| 27880 | }); | |
| 27881 | }; | |
| 27882 | ||
| 27883 | pub const __builtin_vsx_stxvw4x = struct { | |
| 27884 | const param_str = "vV4iLiv*"; | |
| 27885 | const target_set = TargetSet.init(.{ | |
| 27886 | .ppc = true, | |
| 27887 | }); | |
| 27888 | }; | |
| 27889 | ||
| 27890 | pub const __builtin_vsx_stxvw4x_be = struct { | |
| 27891 | const param_str = "vV4iSLLivC*"; | |
| 27892 | const target_set = TargetSet.init(.{ | |
| 27893 | .ppc = true, | |
| 27894 | }); | |
| 27895 | }; | |
| 27896 | ||
| 27897 | pub const __builtin_vsx_xsmaxdp = struct { | |
| 27898 | const param_str = "ddd"; | |
| 27899 | const target_set = TargetSet.init(.{ | |
| 27900 | .ppc = true, | |
| 27901 | }); | |
| 27902 | }; | |
| 27903 | ||
| 27904 | pub const __builtin_vsx_xsmindp = struct { | |
| 27905 | const param_str = "ddd"; | |
| 27906 | const target_set = TargetSet.init(.{ | |
| 27907 | .ppc = true, | |
| 27908 | }); | |
| 27909 | }; | |
| 27910 | ||
| 27911 | pub const __builtin_vsx_xvabsdp = struct { | |
| 27912 | const param_str = "V2dV2d"; | |
| 27913 | const target_set = TargetSet.init(.{ | |
| 27914 | .ppc = true, | |
| 27915 | }); | |
| 27916 | }; | |
| 27917 | ||
| 27918 | pub const __builtin_vsx_xvabssp = struct { | |
| 27919 | const param_str = "V4fV4f"; | |
| 27920 | const target_set = TargetSet.init(.{ | |
| 27921 | .ppc = true, | |
| 27922 | }); | |
| 27923 | }; | |
| 27924 | ||
| 27925 | pub const __builtin_vsx_xvcmpeqdp = struct { | |
| 27926 | const param_str = "V2ULLiV2dV2d"; | |
| 27927 | const target_set = TargetSet.init(.{ | |
| 27928 | .ppc = true, | |
| 27929 | }); | |
| 27930 | }; | |
| 27931 | ||
| 27932 | pub const __builtin_vsx_xvcmpeqdp_p = struct { | |
| 27933 | const param_str = "iiV2dV2d"; | |
| 27934 | const target_set = TargetSet.init(.{ | |
| 27935 | .ppc = true, | |
| 27936 | }); | |
| 27937 | }; | |
| 27938 | ||
| 27939 | pub const __builtin_vsx_xvcmpeqsp = struct { | |
| 27940 | const param_str = "V4UiV4fV4f"; | |
| 27941 | const target_set = TargetSet.init(.{ | |
| 27942 | .ppc = true, | |
| 27943 | }); | |
| 27944 | }; | |
| 27945 | ||
| 27946 | pub const __builtin_vsx_xvcmpeqsp_p = struct { | |
| 27947 | const param_str = "iiV4fV4f"; | |
| 27948 | const target_set = TargetSet.init(.{ | |
| 27949 | .ppc = true, | |
| 27950 | }); | |
| 27951 | }; | |
| 27952 | ||
| 27953 | pub const __builtin_vsx_xvcmpgedp = struct { | |
| 27954 | const param_str = "V2ULLiV2dV2d"; | |
| 27955 | const target_set = TargetSet.init(.{ | |
| 27956 | .ppc = true, | |
| 27957 | }); | |
| 27958 | }; | |
| 27959 | ||
| 27960 | pub const __builtin_vsx_xvcmpgedp_p = struct { | |
| 27961 | const param_str = "iiV2dV2d"; | |
| 27962 | const target_set = TargetSet.init(.{ | |
| 27963 | .ppc = true, | |
| 27964 | }); | |
| 27965 | }; | |
| 27966 | ||
| 27967 | pub const __builtin_vsx_xvcmpgesp = struct { | |
| 27968 | const param_str = "V4UiV4fV4f"; | |
| 27969 | const target_set = TargetSet.init(.{ | |
| 27970 | .ppc = true, | |
| 27971 | }); | |
| 27972 | }; | |
| 27973 | ||
| 27974 | pub const __builtin_vsx_xvcmpgesp_p = struct { | |
| 27975 | const param_str = "iiV4fV4f"; | |
| 27976 | const target_set = TargetSet.init(.{ | |
| 27977 | .ppc = true, | |
| 27978 | }); | |
| 27979 | }; | |
| 27980 | ||
| 27981 | pub const __builtin_vsx_xvcmpgtdp = struct { | |
| 27982 | const param_str = "V2ULLiV2dV2d"; | |
| 27983 | const target_set = TargetSet.init(.{ | |
| 27984 | .ppc = true, | |
| 27985 | }); | |
| 27986 | }; | |
| 27987 | ||
| 27988 | pub const __builtin_vsx_xvcmpgtdp_p = struct { | |
| 27989 | const param_str = "iiV2dV2d"; | |
| 27990 | const target_set = TargetSet.init(.{ | |
| 27991 | .ppc = true, | |
| 27992 | }); | |
| 27993 | }; | |
| 27994 | ||
| 27995 | pub const __builtin_vsx_xvcmpgtsp = struct { | |
| 27996 | const param_str = "V4UiV4fV4f"; | |
| 27997 | const target_set = TargetSet.init(.{ | |
| 27998 | .ppc = true, | |
| 27999 | }); | |
| 28000 | }; | |
| 28001 | ||
| 28002 | pub const __builtin_vsx_xvcmpgtsp_p = struct { | |
| 28003 | const param_str = "iiV4fV4f"; | |
| 28004 | const target_set = TargetSet.init(.{ | |
| 28005 | .ppc = true, | |
| 28006 | }); | |
| 28007 | }; | |
| 28008 | ||
| 28009 | pub const __builtin_vsx_xvcpsgndp = struct { | |
| 28010 | const param_str = "V2dV2dV2d"; | |
| 28011 | const target_set = TargetSet.init(.{ | |
| 28012 | .ppc = true, | |
| 28013 | }); | |
| 28014 | }; | |
| 28015 | ||
| 28016 | pub const __builtin_vsx_xvcpsgnsp = struct { | |
| 28017 | const param_str = "V4fV4fV4f"; | |
| 28018 | const target_set = TargetSet.init(.{ | |
| 28019 | .ppc = true, | |
| 28020 | }); | |
| 28021 | }; | |
| 28022 | ||
| 28023 | pub const __builtin_vsx_xvcvbf16spn = struct { | |
| 28024 | const param_str = "V16UcV16Uc"; | |
| 28025 | const target_set = TargetSet.init(.{ | |
| 28026 | .ppc = true, | |
| 28027 | }); | |
| 28028 | }; | |
| 28029 | ||
| 28030 | pub const __builtin_vsx_xvcvdpsp = struct { | |
| 28031 | const param_str = "V4fV2d"; | |
| 28032 | const target_set = TargetSet.init(.{ | |
| 28033 | .ppc = true, | |
| 28034 | }); | |
| 28035 | }; | |
| 28036 | ||
| 28037 | pub const __builtin_vsx_xvcvdpsxws = struct { | |
| 28038 | const param_str = "V4SiV2d"; | |
| 28039 | const target_set = TargetSet.init(.{ | |
| 28040 | .ppc = true, | |
| 28041 | }); | |
| 28042 | }; | |
| 28043 | ||
| 28044 | pub const __builtin_vsx_xvcvdpuxws = struct { | |
| 28045 | const param_str = "V4UiV2d"; | |
| 28046 | const target_set = TargetSet.init(.{ | |
| 28047 | .ppc = true, | |
| 28048 | }); | |
| 28049 | }; | |
| 28050 | ||
| 28051 | pub const __builtin_vsx_xvcvhpsp = struct { | |
| 28052 | const param_str = "V4fV8Us"; | |
| 28053 | const target_set = TargetSet.init(.{ | |
| 28054 | .ppc = true, | |
| 28055 | }); | |
| 28056 | }; | |
| 28057 | ||
| 28058 | pub const __builtin_vsx_xvcvspbf16 = struct { | |
| 28059 | const param_str = "V16UcV16Uc"; | |
| 28060 | const target_set = TargetSet.init(.{ | |
| 28061 | .ppc = true, | |
| 28062 | }); | |
| 28063 | }; | |
| 28064 | ||
| 28065 | pub const __builtin_vsx_xvcvspdp = struct { | |
| 28066 | const param_str = "V2dV4f"; | |
| 28067 | const target_set = TargetSet.init(.{ | |
| 28068 | .ppc = true, | |
| 28069 | }); | |
| 28070 | }; | |
| 28071 | ||
| 28072 | pub const __builtin_vsx_xvcvsphp = struct { | |
| 28073 | const param_str = "V4fV4f"; | |
| 28074 | const target_set = TargetSet.init(.{ | |
| 28075 | .ppc = true, | |
| 28076 | }); | |
| 28077 | }; | |
| 28078 | ||
| 28079 | pub const __builtin_vsx_xvcvspsxds = struct { | |
| 28080 | const param_str = "V2SLLiV4f"; | |
| 28081 | const target_set = TargetSet.init(.{ | |
| 28082 | .ppc = true, | |
| 28083 | }); | |
| 28084 | }; | |
| 28085 | ||
| 28086 | pub const __builtin_vsx_xvcvspuxds = struct { | |
| 28087 | const param_str = "V2ULLiV4f"; | |
| 28088 | const target_set = TargetSet.init(.{ | |
| 28089 | .ppc = true, | |
| 28090 | }); | |
| 28091 | }; | |
| 28092 | ||
| 28093 | pub const __builtin_vsx_xvcvsxdsp = struct { | |
| 28094 | const param_str = "V4fV2SLLi"; | |
| 28095 | const target_set = TargetSet.init(.{ | |
| 28096 | .ppc = true, | |
| 28097 | }); | |
| 28098 | }; | |
| 28099 | ||
| 28100 | pub const __builtin_vsx_xvcvsxwdp = struct { | |
| 28101 | const param_str = "V2dV4Si"; | |
| 28102 | const target_set = TargetSet.init(.{ | |
| 28103 | .ppc = true, | |
| 28104 | }); | |
| 28105 | }; | |
| 28106 | ||
| 28107 | pub const __builtin_vsx_xvcvuxdsp = struct { | |
| 28108 | const param_str = "V4fV2ULLi"; | |
| 28109 | const target_set = TargetSet.init(.{ | |
| 28110 | .ppc = true, | |
| 28111 | }); | |
| 28112 | }; | |
| 28113 | ||
| 28114 | pub const __builtin_vsx_xvcvuxwdp = struct { | |
| 28115 | const param_str = "V2dV4Ui"; | |
| 28116 | const target_set = TargetSet.init(.{ | |
| 28117 | .ppc = true, | |
| 28118 | }); | |
| 28119 | }; | |
| 28120 | ||
| 28121 | pub const __builtin_vsx_xvdivdp = struct { | |
| 28122 | const param_str = "V2dV2dV2d"; | |
| 28123 | const target_set = TargetSet.init(.{ | |
| 28124 | .ppc = true, | |
| 28125 | }); | |
| 28126 | }; | |
| 28127 | ||
| 28128 | pub const __builtin_vsx_xvdivsp = struct { | |
| 28129 | const param_str = "V4fV4fV4f"; | |
| 28130 | const target_set = TargetSet.init(.{ | |
| 28131 | .ppc = true, | |
| 28132 | }); | |
| 28133 | }; | |
| 28134 | ||
| 28135 | pub const __builtin_vsx_xviexpdp = struct { | |
| 28136 | const param_str = "V2dV2ULLiV2ULLi"; | |
| 28137 | const target_set = TargetSet.init(.{ | |
| 28138 | .ppc = true, | |
| 28139 | }); | |
| 28140 | }; | |
| 28141 | ||
| 28142 | pub const __builtin_vsx_xviexpsp = struct { | |
| 28143 | const param_str = "V4fV4UiV4Ui"; | |
| 28144 | const target_set = TargetSet.init(.{ | |
| 28145 | .ppc = true, | |
| 28146 | }); | |
| 28147 | }; | |
| 28148 | ||
| 28149 | pub const __builtin_vsx_xvmaddadp = struct { | |
| 28150 | const param_str = "V2dV2dV2dV2d"; | |
| 28151 | const target_set = TargetSet.init(.{ | |
| 28152 | .ppc = true, | |
| 28153 | }); | |
| 28154 | }; | |
| 28155 | ||
| 28156 | pub const __builtin_vsx_xvmaddasp = struct { | |
| 28157 | const param_str = "V4fV4fV4fV4f"; | |
| 28158 | const target_set = TargetSet.init(.{ | |
| 28159 | .ppc = true, | |
| 28160 | }); | |
| 28161 | }; | |
| 28162 | ||
| 28163 | pub const __builtin_vsx_xvmaxdp = struct { | |
| 28164 | const param_str = "V2dV2dV2d"; | |
| 28165 | const target_set = TargetSet.init(.{ | |
| 28166 | .ppc = true, | |
| 28167 | }); | |
| 28168 | }; | |
| 28169 | ||
| 28170 | pub const __builtin_vsx_xvmaxsp = struct { | |
| 28171 | const param_str = "V4fV4fV4f"; | |
| 28172 | const target_set = TargetSet.init(.{ | |
| 28173 | .ppc = true, | |
| 28174 | }); | |
| 28175 | }; | |
| 28176 | ||
| 28177 | pub const __builtin_vsx_xvmindp = struct { | |
| 28178 | const param_str = "V2dV2dV2d"; | |
| 28179 | const target_set = TargetSet.init(.{ | |
| 28180 | .ppc = true, | |
| 28181 | }); | |
| 28182 | }; | |
| 28183 | ||
| 28184 | pub const __builtin_vsx_xvminsp = struct { | |
| 28185 | const param_str = "V4fV4fV4f"; | |
| 28186 | const target_set = TargetSet.init(.{ | |
| 28187 | .ppc = true, | |
| 28188 | }); | |
| 28189 | }; | |
| 28190 | ||
| 28191 | pub const __builtin_vsx_xvmsubadp = struct { | |
| 28192 | const param_str = "V2dV2dV2dV2d"; | |
| 28193 | const target_set = TargetSet.init(.{ | |
| 28194 | .ppc = true, | |
| 28195 | }); | |
| 28196 | }; | |
| 28197 | ||
| 28198 | pub const __builtin_vsx_xvmsubasp = struct { | |
| 28199 | const param_str = "V4fV4fV4fV4f"; | |
| 28200 | const target_set = TargetSet.init(.{ | |
| 28201 | .ppc = true, | |
| 28202 | }); | |
| 28203 | }; | |
| 28204 | ||
| 28205 | pub const __builtin_vsx_xvmuldp = struct { | |
| 28206 | const param_str = "V2dV2dV2d"; | |
| 28207 | const target_set = TargetSet.init(.{ | |
| 28208 | .ppc = true, | |
| 28209 | }); | |
| 28210 | }; | |
| 28211 | ||
| 28212 | pub const __builtin_vsx_xvmulsp = struct { | |
| 28213 | const param_str = "V4fV4fV4f"; | |
| 28214 | const target_set = TargetSet.init(.{ | |
| 28215 | .ppc = true, | |
| 28216 | }); | |
| 28217 | }; | |
| 28218 | ||
| 28219 | pub const __builtin_vsx_xvnmaddadp = struct { | |
| 28220 | const param_str = "V2dV2dV2dV2d"; | |
| 28221 | const target_set = TargetSet.init(.{ | |
| 28222 | .ppc = true, | |
| 28223 | }); | |
| 28224 | }; | |
| 28225 | ||
| 28226 | pub const __builtin_vsx_xvnmaddasp = struct { | |
| 28227 | const param_str = "V4fV4fV4fV4f"; | |
| 28228 | const target_set = TargetSet.init(.{ | |
| 28229 | .ppc = true, | |
| 28230 | }); | |
| 28231 | }; | |
| 28232 | ||
| 28233 | pub const __builtin_vsx_xvnmsubadp = struct { | |
| 28234 | const param_str = "V2dV2dV2dV2d"; | |
| 28235 | const target_set = TargetSet.init(.{ | |
| 28236 | .ppc = true, | |
| 28237 | }); | |
| 28238 | }; | |
| 28239 | ||
| 28240 | pub const __builtin_vsx_xvnmsubasp = struct { | |
| 28241 | const param_str = "V4fV4fV4fV4f"; | |
| 28242 | const target_set = TargetSet.init(.{ | |
| 28243 | .ppc = true, | |
| 28244 | }); | |
| 28245 | }; | |
| 28246 | ||
| 28247 | pub const __builtin_vsx_xvrdpi = struct { | |
| 28248 | const param_str = "V2dV2d"; | |
| 28249 | const target_set = TargetSet.init(.{ | |
| 28250 | .ppc = true, | |
| 28251 | }); | |
| 28252 | }; | |
| 28253 | ||
| 28254 | pub const __builtin_vsx_xvrdpic = struct { | |
| 28255 | const param_str = "V2dV2d"; | |
| 28256 | const target_set = TargetSet.init(.{ | |
| 28257 | .ppc = true, | |
| 28258 | }); | |
| 28259 | }; | |
| 28260 | ||
| 28261 | pub const __builtin_vsx_xvrdpim = struct { | |
| 28262 | const param_str = "V2dV2d"; | |
| 28263 | const target_set = TargetSet.init(.{ | |
| 28264 | .ppc = true, | |
| 28265 | }); | |
| 28266 | }; | |
| 28267 | ||
| 28268 | pub const __builtin_vsx_xvrdpip = struct { | |
| 28269 | const param_str = "V2dV2d"; | |
| 28270 | const target_set = TargetSet.init(.{ | |
| 28271 | .ppc = true, | |
| 28272 | }); | |
| 28273 | }; | |
| 28274 | ||
| 28275 | pub const __builtin_vsx_xvrdpiz = struct { | |
| 28276 | const param_str = "V2dV2d"; | |
| 28277 | const target_set = TargetSet.init(.{ | |
| 28278 | .ppc = true, | |
| 28279 | }); | |
| 28280 | }; | |
| 28281 | ||
| 28282 | pub const __builtin_vsx_xvredp = struct { | |
| 28283 | const param_str = "V2dV2d"; | |
| 28284 | const target_set = TargetSet.init(.{ | |
| 28285 | .ppc = true, | |
| 28286 | }); | |
| 28287 | }; | |
| 28288 | ||
| 28289 | pub const __builtin_vsx_xvresp = struct { | |
| 28290 | const param_str = "V4fV4f"; | |
| 28291 | const target_set = TargetSet.init(.{ | |
| 28292 | .ppc = true, | |
| 28293 | }); | |
| 28294 | }; | |
| 28295 | ||
| 28296 | pub const __builtin_vsx_xvrspi = struct { | |
| 28297 | const param_str = "V4fV4f"; | |
| 28298 | const target_set = TargetSet.init(.{ | |
| 28299 | .ppc = true, | |
| 28300 | }); | |
| 28301 | }; | |
| 28302 | ||
| 28303 | pub const __builtin_vsx_xvrspic = struct { | |
| 28304 | const param_str = "V4fV4f"; | |
| 28305 | const target_set = TargetSet.init(.{ | |
| 28306 | .ppc = true, | |
| 28307 | }); | |
| 28308 | }; | |
| 28309 | ||
| 28310 | pub const __builtin_vsx_xvrspim = struct { | |
| 28311 | const param_str = "V4fV4f"; | |
| 28312 | const target_set = TargetSet.init(.{ | |
| 28313 | .ppc = true, | |
| 28314 | }); | |
| 28315 | }; | |
| 28316 | ||
| 28317 | pub const __builtin_vsx_xvrspip = struct { | |
| 28318 | const param_str = "V4fV4f"; | |
| 28319 | const target_set = TargetSet.init(.{ | |
| 28320 | .ppc = true, | |
| 28321 | }); | |
| 28322 | }; | |
| 28323 | ||
| 28324 | pub const __builtin_vsx_xvrspiz = struct { | |
| 28325 | const param_str = "V4fV4f"; | |
| 28326 | const target_set = TargetSet.init(.{ | |
| 28327 | .ppc = true, | |
| 28328 | }); | |
| 28329 | }; | |
| 28330 | ||
| 28331 | pub const __builtin_vsx_xvrsqrtedp = struct { | |
| 28332 | const param_str = "V2dV2d"; | |
| 28333 | const target_set = TargetSet.init(.{ | |
| 28334 | .ppc = true, | |
| 28335 | }); | |
| 28336 | }; | |
| 28337 | ||
| 28338 | pub const __builtin_vsx_xvrsqrtesp = struct { | |
| 28339 | const param_str = "V4fV4f"; | |
| 28340 | const target_set = TargetSet.init(.{ | |
| 28341 | .ppc = true, | |
| 28342 | }); | |
| 28343 | }; | |
| 28344 | ||
| 28345 | pub const __builtin_vsx_xvsqrtdp = struct { | |
| 28346 | const param_str = "V2dV2d"; | |
| 28347 | const target_set = TargetSet.init(.{ | |
| 28348 | .ppc = true, | |
| 28349 | }); | |
| 28350 | }; | |
| 28351 | ||
| 28352 | pub const __builtin_vsx_xvsqrtsp = struct { | |
| 28353 | const param_str = "V4fV4f"; | |
| 28354 | const target_set = TargetSet.init(.{ | |
| 28355 | .ppc = true, | |
| 28356 | }); | |
| 28357 | }; | |
| 28358 | ||
| 28359 | pub const __builtin_vsx_xvtdivdp = struct { | |
| 28360 | const param_str = "iV2dV2d"; | |
| 28361 | const target_set = TargetSet.init(.{ | |
| 28362 | .ppc = true, | |
| 28363 | }); | |
| 28364 | }; | |
| 28365 | ||
| 28366 | pub const __builtin_vsx_xvtdivsp = struct { | |
| 28367 | const param_str = "iV4fV4f"; | |
| 28368 | const target_set = TargetSet.init(.{ | |
| 28369 | .ppc = true, | |
| 28370 | }); | |
| 28371 | }; | |
| 28372 | ||
| 28373 | pub const __builtin_vsx_xvtlsbb = struct { | |
| 28374 | const param_str = "iV16UcUi"; | |
| 28375 | const target_set = TargetSet.init(.{ | |
| 28376 | .ppc = true, | |
| 28377 | }); | |
| 28378 | }; | |
| 28379 | ||
| 28380 | pub const __builtin_vsx_xvtsqrtdp = struct { | |
| 28381 | const param_str = "iV2d"; | |
| 28382 | const target_set = TargetSet.init(.{ | |
| 28383 | .ppc = true, | |
| 28384 | }); | |
| 28385 | }; | |
| 28386 | ||
| 28387 | pub const __builtin_vsx_xvtsqrtsp = struct { | |
| 28388 | const param_str = "iV4f"; | |
| 28389 | const target_set = TargetSet.init(.{ | |
| 28390 | .ppc = true, | |
| 28391 | }); | |
| 28392 | }; | |
| 28393 | ||
| 28394 | pub const __builtin_vsx_xvtstdcdp = struct { | |
| 28395 | const param_str = "V2ULLiV2dIi"; | |
| 28396 | const target_set = TargetSet.init(.{ | |
| 28397 | .ppc = true, | |
| 28398 | }); | |
| 28399 | }; | |
| 28400 | ||
| 28401 | pub const __builtin_vsx_xvtstdcsp = struct { | |
| 28402 | const param_str = "V4UiV4fIi"; | |
| 28403 | const target_set = TargetSet.init(.{ | |
| 28404 | .ppc = true, | |
| 28405 | }); | |
| 28406 | }; | |
| 28407 | ||
| 28408 | pub const __builtin_vsx_xvxexpdp = struct { | |
| 28409 | const param_str = "V2ULLiV2d"; | |
| 28410 | const target_set = TargetSet.init(.{ | |
| 28411 | .ppc = true, | |
| 28412 | }); | |
| 28413 | }; | |
| 28414 | ||
| 28415 | pub const __builtin_vsx_xvxexpsp = struct { | |
| 28416 | const param_str = "V4UiV4f"; | |
| 28417 | const target_set = TargetSet.init(.{ | |
| 28418 | .ppc = true, | |
| 28419 | }); | |
| 28420 | }; | |
| 28421 | ||
| 28422 | pub const __builtin_vsx_xvxsigdp = struct { | |
| 28423 | const param_str = "V2ULLiV2d"; | |
| 28424 | const target_set = TargetSet.init(.{ | |
| 28425 | .ppc = true, | |
| 28426 | }); | |
| 28427 | }; | |
| 28428 | ||
| 28429 | pub const __builtin_vsx_xvxsigsp = struct { | |
| 28430 | const param_str = "V4UiV4f"; | |
| 28431 | const target_set = TargetSet.init(.{ | |
| 28432 | .ppc = true, | |
| 28433 | }); | |
| 28434 | }; | |
| 28435 | ||
| 28436 | pub const __builtin_vsx_xxblendvb = struct { | |
| 28437 | const param_str = "V16UcV16UcV16UcV16Uc"; | |
| 28438 | const target_set = TargetSet.init(.{ | |
| 28439 | .ppc = true, | |
| 28440 | }); | |
| 28441 | }; | |
| 28442 | ||
| 28443 | pub const __builtin_vsx_xxblendvd = struct { | |
| 28444 | const param_str = "V2ULLiV2ULLiV2ULLiV2ULLi"; | |
| 28445 | const target_set = TargetSet.init(.{ | |
| 28446 | .ppc = true, | |
| 28447 | }); | |
| 28448 | }; | |
| 28449 | ||
| 28450 | pub const __builtin_vsx_xxblendvh = struct { | |
| 28451 | const param_str = "V8UsV8UsV8UsV8Us"; | |
| 28452 | const target_set = TargetSet.init(.{ | |
| 28453 | .ppc = true, | |
| 28454 | }); | |
| 28455 | }; | |
| 28456 | ||
| 28457 | pub const __builtin_vsx_xxblendvw = struct { | |
| 28458 | const param_str = "V4UiV4UiV4UiV4Ui"; | |
| 28459 | const target_set = TargetSet.init(.{ | |
| 28460 | .ppc = true, | |
| 28461 | }); | |
| 28462 | }; | |
| 28463 | ||
| 28464 | pub const __builtin_vsx_xxeval = struct { | |
| 28465 | const param_str = "V2ULLiV2ULLiV2ULLiV2ULLiIi"; | |
| 28466 | const target_set = TargetSet.init(.{ | |
| 28467 | .ppc = true, | |
| 28468 | }); | |
| 28469 | }; | |
| 28470 | ||
| 28471 | pub const __builtin_vsx_xxgenpcvbm = struct { | |
| 28472 | const param_str = "V16UcV16Uci"; | |
| 28473 | const target_set = TargetSet.init(.{ | |
| 28474 | .ppc = true, | |
| 28475 | }); | |
| 28476 | }; | |
| 28477 | ||
| 28478 | pub const __builtin_vsx_xxgenpcvdm = struct { | |
| 28479 | const param_str = "V2ULLiV2ULLii"; | |
| 28480 | const target_set = TargetSet.init(.{ | |
| 28481 | .ppc = true, | |
| 28482 | }); | |
| 28483 | }; | |
| 28484 | ||
| 28485 | pub const __builtin_vsx_xxgenpcvhm = struct { | |
| 28486 | const param_str = "V8UsV8Usi"; | |
| 28487 | const target_set = TargetSet.init(.{ | |
| 28488 | .ppc = true, | |
| 28489 | }); | |
| 28490 | }; | |
| 28491 | ||
| 28492 | pub const __builtin_vsx_xxgenpcvwm = struct { | |
| 28493 | const param_str = "V4UiV4Uii"; | |
| 28494 | const target_set = TargetSet.init(.{ | |
| 28495 | .ppc = true, | |
| 28496 | }); | |
| 28497 | }; | |
| 28498 | ||
| 28499 | pub const __builtin_vsx_xxleqv = struct { | |
| 28500 | const param_str = "V4UiV4UiV4Ui"; | |
| 28501 | const target_set = TargetSet.init(.{ | |
| 28502 | .ppc = true, | |
| 28503 | }); | |
| 28504 | }; | |
| 28505 | ||
| 28506 | pub const __builtin_vsx_xxpermdi = struct { | |
| 28507 | const param_str = "v."; | |
| 28508 | const target_set = TargetSet.init(.{ | |
| 28509 | .ppc = true, | |
| 28510 | }); | |
| 28511 | const attributes = Attributes{ | |
| 28512 | .custom_typecheck = true, | |
| 28513 | }; | |
| 28514 | }; | |
| 28515 | ||
| 28516 | pub const __builtin_vsx_xxpermx = struct { | |
| 28517 | const param_str = "V16UcV16UcV16UcV16UcIi"; | |
| 28518 | const target_set = TargetSet.init(.{ | |
| 28519 | .ppc = true, | |
| 28520 | }); | |
| 28521 | }; | |
| 28522 | ||
| 28523 | pub const __builtin_vsx_xxsldwi = struct { | |
| 28524 | const param_str = "v."; | |
| 28525 | const target_set = TargetSet.init(.{ | |
| 28526 | .ppc = true, | |
| 28527 | }); | |
| 28528 | const attributes = Attributes{ | |
| 28529 | .custom_typecheck = true, | |
| 28530 | }; | |
| 28531 | }; | |
| 28532 | ||
| 28533 | pub const __builtin_wasm_max_f32 = struct { | |
| 28534 | const param_str = "fff"; | |
| 28535 | const target_set = TargetSet.init(.{ | |
| 28536 | .webassembly = true, | |
| 28537 | }); | |
| 28538 | const attributes = Attributes{ | |
| 28539 | .@"const" = true, | |
| 28540 | }; | |
| 28541 | }; | |
| 28542 | ||
| 28543 | pub const __builtin_wasm_max_f64 = struct { | |
| 28544 | const param_str = "ddd"; | |
| 28545 | const target_set = TargetSet.init(.{ | |
| 28546 | .webassembly = true, | |
| 28547 | }); | |
| 28548 | const attributes = Attributes{ | |
| 28549 | .@"const" = true, | |
| 28550 | }; | |
| 28551 | }; | |
| 28552 | ||
| 28553 | pub const __builtin_wasm_memory_grow = struct { | |
| 28554 | const param_str = "zIiz"; | |
| 28555 | const target_set = TargetSet.init(.{ | |
| 28556 | .webassembly = true, | |
| 28557 | }); | |
| 28558 | const attributes = Attributes{}; | |
| 28559 | }; | |
| 28560 | ||
| 28561 | pub const __builtin_wasm_memory_size = struct { | |
| 28562 | const param_str = "zIi"; | |
| 28563 | const target_set = TargetSet.init(.{ | |
| 28564 | .webassembly = true, | |
| 28565 | }); | |
| 28566 | const attributes = Attributes{}; | |
| 28567 | }; | |
| 28568 | ||
| 28569 | pub const __builtin_wasm_min_f32 = struct { | |
| 28570 | const param_str = "fff"; | |
| 28571 | const target_set = TargetSet.init(.{ | |
| 28572 | .webassembly = true, | |
| 28573 | }); | |
| 28574 | const attributes = Attributes{ | |
| 28575 | .@"const" = true, | |
| 28576 | }; | |
| 28577 | }; | |
| 28578 | ||
| 28579 | pub const __builtin_wasm_min_f64 = struct { | |
| 28580 | const param_str = "ddd"; | |
| 28581 | const target_set = TargetSet.init(.{ | |
| 28582 | .webassembly = true, | |
| 28583 | }); | |
| 28584 | const attributes = Attributes{ | |
| 28585 | .@"const" = true, | |
| 28586 | }; | |
| 28587 | }; | |
| 28588 | ||
| 28589 | pub const __builtin_wasm_trunc_s_i32_f32 = struct { | |
| 28590 | const param_str = "if"; | |
| 28591 | const target_set = TargetSet.init(.{ | |
| 28592 | .webassembly = true, | |
| 28593 | }); | |
| 28594 | const attributes = Attributes{ | |
| 28595 | .@"const" = true, | |
| 28596 | }; | |
| 28597 | }; | |
| 28598 | ||
| 28599 | pub const __builtin_wasm_trunc_s_i32_f64 = struct { | |
| 28600 | const param_str = "id"; | |
| 28601 | const target_set = TargetSet.init(.{ | |
| 28602 | .webassembly = true, | |
| 28603 | }); | |
| 28604 | const attributes = Attributes{ | |
| 28605 | .@"const" = true, | |
| 28606 | }; | |
| 28607 | }; | |
| 28608 | ||
| 28609 | pub const __builtin_wasm_trunc_s_i64_f32 = struct { | |
| 28610 | const param_str = "LLif"; | |
| 28611 | const target_set = TargetSet.init(.{ | |
| 28612 | .webassembly = true, | |
| 28613 | }); | |
| 28614 | const attributes = Attributes{ | |
| 28615 | .@"const" = true, | |
| 28616 | }; | |
| 28617 | }; | |
| 28618 | ||
| 28619 | pub const __builtin_wasm_trunc_s_i64_f64 = struct { | |
| 28620 | const param_str = "LLid"; | |
| 28621 | const target_set = TargetSet.init(.{ | |
| 28622 | .webassembly = true, | |
| 28623 | }); | |
| 28624 | const attributes = Attributes{ | |
| 28625 | .@"const" = true, | |
| 28626 | }; | |
| 28627 | }; | |
| 28628 | ||
| 28629 | pub const __builtin_wasm_trunc_u_i32_f32 = struct { | |
| 28630 | const param_str = "if"; | |
| 28631 | const target_set = TargetSet.init(.{ | |
| 28632 | .webassembly = true, | |
| 28633 | }); | |
| 28634 | const attributes = Attributes{ | |
| 28635 | .@"const" = true, | |
| 28636 | }; | |
| 28637 | }; | |
| 28638 | ||
| 28639 | pub const __builtin_wasm_trunc_u_i32_f64 = struct { | |
| 28640 | const param_str = "id"; | |
| 28641 | const target_set = TargetSet.init(.{ | |
| 28642 | .webassembly = true, | |
| 28643 | }); | |
| 28644 | const attributes = Attributes{ | |
| 28645 | .@"const" = true, | |
| 28646 | }; | |
| 28647 | }; | |
| 28648 | ||
| 28649 | pub const __builtin_wasm_trunc_u_i64_f32 = struct { | |
| 28650 | const param_str = "LLif"; | |
| 28651 | const target_set = TargetSet.init(.{ | |
| 28652 | .webassembly = true, | |
| 28653 | }); | |
| 28654 | const attributes = Attributes{ | |
| 28655 | .@"const" = true, | |
| 28656 | }; | |
| 28657 | }; | |
| 28658 | ||
| 28659 | pub const __builtin_wasm_trunc_u_i64_f64 = struct { | |
| 28660 | const param_str = "LLid"; | |
| 28661 | const target_set = TargetSet.init(.{ | |
| 28662 | .webassembly = true, | |
| 28663 | }); | |
| 28664 | const attributes = Attributes{ | |
| 28665 | .@"const" = true, | |
| 28666 | }; | |
| 28667 | }; | |
| 28668 | ||
| 28669 | pub const __builtin_wcschr = struct { | |
| 28670 | const param_str = "w*wC*w"; | |
| 28671 | const attributes = Attributes{ | |
| 28672 | .lib_function_with_builtin_prefix = true, | |
| 28673 | .const_evaluable = true, | |
| 28674 | }; | |
| 28675 | }; | |
| 28676 | ||
| 28677 | pub const __builtin_wcscmp = struct { | |
| 28678 | const param_str = "iwC*wC*"; | |
| 28679 | const attributes = Attributes{ | |
| 28680 | .lib_function_with_builtin_prefix = true, | |
| 28681 | .const_evaluable = true, | |
| 28682 | }; | |
| 28683 | }; | |
| 28684 | ||
| 28685 | pub const __builtin_wcslen = struct { | |
| 28686 | const param_str = "zwC*"; | |
| 28687 | const attributes = Attributes{ | |
| 28688 | .lib_function_with_builtin_prefix = true, | |
| 28689 | .const_evaluable = true, | |
| 28690 | }; | |
| 28691 | }; | |
| 28692 | ||
| 28693 | pub const __builtin_wcsncmp = struct { | |
| 28694 | const param_str = "iwC*wC*z"; | |
| 28695 | const attributes = Attributes{ | |
| 28696 | .lib_function_with_builtin_prefix = true, | |
| 28697 | .const_evaluable = true, | |
| 28698 | }; | |
| 28699 | }; | |
| 28700 | ||
| 28701 | pub const __builtin_wmemchr = struct { | |
| 28702 | const param_str = "w*wC*wz"; | |
| 28703 | const attributes = Attributes{ | |
| 28704 | .lib_function_with_builtin_prefix = true, | |
| 28705 | .const_evaluable = true, | |
| 28706 | }; | |
| 28707 | }; | |
| 28708 | ||
| 28709 | pub const __builtin_wmemcmp = struct { | |
| 28710 | const param_str = "iwC*wC*z"; | |
| 28711 | const attributes = Attributes{ | |
| 28712 | .lib_function_with_builtin_prefix = true, | |
| 28713 | .const_evaluable = true, | |
| 28714 | }; | |
| 28715 | }; | |
| 28716 | ||
| 28717 | pub const __builtin_wmemcpy = struct { | |
| 28718 | const param_str = "w*w*wC*z"; | |
| 28719 | const attributes = Attributes{ | |
| 28720 | .lib_function_with_builtin_prefix = true, | |
| 28721 | .const_evaluable = true, | |
| 28722 | }; | |
| 28723 | }; | |
| 28724 | ||
| 28725 | pub const __builtin_wmemmove = struct { | |
| 28726 | const param_str = "w*w*wC*z"; | |
| 28727 | const attributes = Attributes{ | |
| 28728 | .lib_function_with_builtin_prefix = true, | |
| 28729 | .const_evaluable = true, | |
| 28730 | }; | |
| 28731 | }; | |
| 28732 | ||
| 28733 | pub const __c11_atomic_is_lock_free = struct { | |
| 28734 | const param_str = "bz"; | |
| 28735 | const attributes = Attributes{ | |
| 28736 | .const_evaluable = true, | |
| 28737 | }; | |
| 28738 | }; | |
| 28739 | ||
| 28740 | pub const __c11_atomic_signal_fence = struct { | |
| 28741 | const param_str = "vi"; | |
| 28742 | const attributes = Attributes{}; | |
| 28743 | }; | |
| 28744 | ||
| 28745 | pub const __c11_atomic_thread_fence = struct { | |
| 28746 | const param_str = "vi"; | |
| 28747 | const attributes = Attributes{}; | |
| 28748 | }; | |
| 28749 | ||
| 28750 | pub const __clear_cache = struct { | |
| 28751 | const param_str = "vv*v*"; | |
| 28752 | const target_set = TargetSet.init(.{ | |
| 28753 | .aarch64 = true, | |
| 28754 | .arm = true, | |
| 28755 | }); | |
| 28756 | const attributes = Attributes{}; | |
| 28757 | }; | |
| 28758 | ||
| 28759 | pub const __cospi = struct { | |
| 28760 | const param_str = "dd"; | |
| 28761 | const header = .math; | |
| 28762 | const attributes = Attributes{ | |
| 28763 | .lib_function_without_prefix = true, | |
| 28764 | .const_without_errno_and_fp_exceptions = true, | |
| 28765 | }; | |
| 28766 | }; | |
| 28767 | ||
| 28768 | pub const __cospif = struct { | |
| 28769 | const param_str = "ff"; | |
| 28770 | const header = .math; | |
| 28771 | const attributes = Attributes{ | |
| 28772 | .lib_function_without_prefix = true, | |
| 28773 | .const_without_errno_and_fp_exceptions = true, | |
| 28774 | }; | |
| 28775 | }; | |
| 28776 | ||
| 28777 | pub const __debugbreak = struct { | |
| 28778 | const param_str = "v"; | |
| 28779 | const language = .all_ms_languages; | |
| 28780 | const attributes = Attributes{}; | |
| 28781 | }; | |
| 28782 | ||
| 28783 | pub const __dmb = struct { | |
| 28784 | const param_str = "vUi"; | |
| 28785 | const language = .all_ms_languages; | |
| 28786 | const target_set = TargetSet.init(.{ | |
| 28787 | .aarch64 = true, | |
| 28788 | .arm = true, | |
| 28789 | }); | |
| 28790 | const attributes = Attributes{ | |
| 28791 | .@"const" = true, | |
| 28792 | }; | |
| 28793 | }; | |
| 28794 | ||
| 28795 | pub const __dsb = struct { | |
| 28796 | const param_str = "vUi"; | |
| 28797 | const language = .all_ms_languages; | |
| 28798 | const target_set = TargetSet.init(.{ | |
| 28799 | .aarch64 = true, | |
| 28800 | .arm = true, | |
| 28801 | }); | |
| 28802 | const attributes = Attributes{ | |
| 28803 | .@"const" = true, | |
| 28804 | }; | |
| 28805 | }; | |
| 28806 | ||
| 28807 | pub const __emit = struct { | |
| 28808 | const param_str = "vIUiC"; | |
| 28809 | const language = .all_ms_languages; | |
| 28810 | const target_set = TargetSet.init(.{ | |
| 28811 | .arm = true, | |
| 28812 | }); | |
| 28813 | }; | |
| 28814 | ||
| 28815 | pub const __exception_code = struct { | |
| 28816 | const param_str = "UNi"; | |
| 28817 | const language = .all_ms_languages; | |
| 28818 | const attributes = Attributes{}; | |
| 28819 | }; | |
| 28820 | ||
| 28821 | pub const __exception_info = struct { | |
| 28822 | const param_str = "v*"; | |
| 28823 | const language = .all_ms_languages; | |
| 28824 | const attributes = Attributes{}; | |
| 28825 | }; | |
| 28826 | ||
| 28827 | pub const __exp10 = struct { | |
| 28828 | const param_str = "dd"; | |
| 28829 | const header = .math; | |
| 28830 | const attributes = Attributes{ | |
| 28831 | .lib_function_without_prefix = true, | |
| 28832 | .const_without_errno_and_fp_exceptions = true, | |
| 28833 | }; | |
| 28834 | }; | |
| 28835 | ||
| 28836 | pub const __exp10f = struct { | |
| 28837 | const param_str = "ff"; | |
| 28838 | const header = .math; | |
| 28839 | const attributes = Attributes{ | |
| 28840 | .lib_function_without_prefix = true, | |
| 28841 | .const_without_errno_and_fp_exceptions = true, | |
| 28842 | }; | |
| 28843 | }; | |
| 28844 | ||
| 28845 | pub const __fastfail = struct { | |
| 28846 | const param_str = "vUi"; | |
| 28847 | const language = .all_ms_languages; | |
| 28848 | const attributes = Attributes{ | |
| 28849 | .noreturn = true, | |
| 28850 | }; | |
| 28851 | }; | |
| 28852 | ||
| 28853 | pub const __finite = struct { | |
| 28854 | const param_str = "id"; | |
| 28855 | const header = .math; | |
| 28856 | const attributes = Attributes{ | |
| 28857 | .@"const" = true, | |
| 28858 | .lib_function_without_prefix = true, | |
| 28859 | }; | |
| 28860 | }; | |
| 28861 | ||
| 28862 | pub const __finitef = struct { | |
| 28863 | const param_str = "if"; | |
| 28864 | const header = .math; | |
| 28865 | const attributes = Attributes{ | |
| 28866 | .@"const" = true, | |
| 28867 | .lib_function_without_prefix = true, | |
| 28868 | }; | |
| 28869 | }; | |
| 28870 | ||
| 28871 | pub const __finitel = struct { | |
| 28872 | const param_str = "iLd"; | |
| 28873 | const header = .math; | |
| 28874 | const attributes = Attributes{ | |
| 28875 | .@"const" = true, | |
| 28876 | .lib_function_without_prefix = true, | |
| 28877 | }; | |
| 28878 | }; | |
| 28879 | ||
| 28880 | pub const __isb = struct { | |
| 28881 | const param_str = "vUi"; | |
| 28882 | const language = .all_ms_languages; | |
| 28883 | const target_set = TargetSet.init(.{ | |
| 28884 | .aarch64 = true, | |
| 28885 | .arm = true, | |
| 28886 | }); | |
| 28887 | const attributes = Attributes{ | |
| 28888 | .@"const" = true, | |
| 28889 | }; | |
| 28890 | }; | |
| 28891 | ||
| 28892 | pub const __iso_volatile_load16 = struct { | |
| 28893 | const param_str = "ssCD*"; | |
| 28894 | const language = .all_ms_languages; | |
| 28895 | const attributes = Attributes{}; | |
| 28896 | }; | |
| 28897 | ||
| 28898 | pub const __iso_volatile_load32 = struct { | |
| 28899 | const param_str = "iiCD*"; | |
| 28900 | const language = .all_ms_languages; | |
| 28901 | const attributes = Attributes{}; | |
| 28902 | }; | |
| 28903 | ||
| 28904 | pub const __iso_volatile_load64 = struct { | |
| 28905 | const param_str = "LLiLLiCD*"; | |
| 28906 | const language = .all_ms_languages; | |
| 28907 | const attributes = Attributes{}; | |
| 28908 | }; | |
| 28909 | ||
| 28910 | pub const __iso_volatile_load8 = struct { | |
| 28911 | const param_str = "ccCD*"; | |
| 28912 | const language = .all_ms_languages; | |
| 28913 | const attributes = Attributes{}; | |
| 28914 | }; | |
| 28915 | ||
| 28916 | pub const __iso_volatile_store16 = struct { | |
| 28917 | const param_str = "vsD*s"; | |
| 28918 | const language = .all_ms_languages; | |
| 28919 | const attributes = Attributes{}; | |
| 28920 | }; | |
| 28921 | ||
| 28922 | pub const __iso_volatile_store32 = struct { | |
| 28923 | const param_str = "viD*i"; | |
| 28924 | const language = .all_ms_languages; | |
| 28925 | const attributes = Attributes{}; | |
| 28926 | }; | |
| 28927 | ||
| 28928 | pub const __iso_volatile_store64 = struct { | |
| 28929 | const param_str = "vLLiD*LLi"; | |
| 28930 | const language = .all_ms_languages; | |
| 28931 | const attributes = Attributes{}; | |
| 28932 | }; | |
| 28933 | ||
| 28934 | pub const __iso_volatile_store8 = struct { | |
| 28935 | const param_str = "vcD*c"; | |
| 28936 | const language = .all_ms_languages; | |
| 28937 | const attributes = Attributes{}; | |
| 28938 | }; | |
| 28939 | ||
| 28940 | pub const __ldrexd = struct { | |
| 28941 | const param_str = "WiWiCD*"; | |
| 28942 | const language = .all_ms_languages; | |
| 28943 | const target_set = TargetSet.init(.{ | |
| 28944 | .arm = true, | |
| 28945 | }); | |
| 28946 | }; | |
| 28947 | ||
| 28948 | pub const __lzcnt = struct { | |
| 28949 | const param_str = "UiUi"; | |
| 28950 | const language = .all_ms_languages; | |
| 28951 | const attributes = Attributes{ | |
| 28952 | .@"const" = true, | |
| 28953 | }; | |
| 28954 | }; | |
| 28955 | ||
| 28956 | pub const __lzcnt16 = struct { | |
| 28957 | const param_str = "UsUs"; | |
| 28958 | const language = .all_ms_languages; | |
| 28959 | const attributes = Attributes{ | |
| 28960 | .@"const" = true, | |
| 28961 | }; | |
| 28962 | }; | |
| 28963 | ||
| 28964 | pub const __lzcnt64 = struct { | |
| 28965 | const param_str = "UWiUWi"; | |
| 28966 | const language = .all_ms_languages; | |
| 28967 | const attributes = Attributes{ | |
| 28968 | .@"const" = true, | |
| 28969 | }; | |
| 28970 | }; | |
| 28971 | ||
| 28972 | pub const __noop = struct { | |
| 28973 | const param_str = "i."; | |
| 28974 | const language = .all_ms_languages; | |
| 28975 | const attributes = Attributes{}; | |
| 28976 | }; | |
| 28977 | ||
| 28978 | pub const __nvvm_add_rm_d = struct { | |
| 28979 | const param_str = "ddd"; | |
| 28980 | const target_set = TargetSet.init(.{ | |
| 28981 | .nvptx = true, | |
| 28982 | }); | |
| 28983 | }; | |
| 28984 | ||
| 28985 | pub const __nvvm_add_rm_f = struct { | |
| 28986 | const param_str = "fff"; | |
| 28987 | const target_set = TargetSet.init(.{ | |
| 28988 | .nvptx = true, | |
| 28989 | }); | |
| 28990 | }; | |
| 28991 | ||
| 28992 | pub const __nvvm_add_rm_ftz_f = struct { | |
| 28993 | const param_str = "fff"; | |
| 28994 | const target_set = TargetSet.init(.{ | |
| 28995 | .nvptx = true, | |
| 28996 | }); | |
| 28997 | }; | |
| 28998 | ||
| 28999 | pub const __nvvm_add_rn_d = struct { | |
| 29000 | const param_str = "ddd"; | |
| 29001 | const target_set = TargetSet.init(.{ | |
| 29002 | .nvptx = true, | |
| 29003 | }); | |
| 29004 | }; | |
| 29005 | ||
| 29006 | pub const __nvvm_add_rn_f = struct { | |
| 29007 | const param_str = "fff"; | |
| 29008 | const target_set = TargetSet.init(.{ | |
| 29009 | .nvptx = true, | |
| 29010 | }); | |
| 29011 | }; | |
| 29012 | ||
| 29013 | pub const __nvvm_add_rn_ftz_f = struct { | |
| 29014 | const param_str = "fff"; | |
| 29015 | const target_set = TargetSet.init(.{ | |
| 29016 | .nvptx = true, | |
| 29017 | }); | |
| 29018 | }; | |
| 29019 | ||
| 29020 | pub const __nvvm_add_rp_d = struct { | |
| 29021 | const param_str = "ddd"; | |
| 29022 | const target_set = TargetSet.init(.{ | |
| 29023 | .nvptx = true, | |
| 29024 | }); | |
| 29025 | }; | |
| 29026 | ||
| 29027 | pub const __nvvm_add_rp_f = struct { | |
| 29028 | const param_str = "fff"; | |
| 29029 | const target_set = TargetSet.init(.{ | |
| 29030 | .nvptx = true, | |
| 29031 | }); | |
| 29032 | }; | |
| 29033 | ||
| 29034 | pub const __nvvm_add_rp_ftz_f = struct { | |
| 29035 | const param_str = "fff"; | |
| 29036 | const target_set = TargetSet.init(.{ | |
| 29037 | .nvptx = true, | |
| 29038 | }); | |
| 29039 | }; | |
| 29040 | ||
| 29041 | pub const __nvvm_add_rz_d = struct { | |
| 29042 | const param_str = "ddd"; | |
| 29043 | const target_set = TargetSet.init(.{ | |
| 29044 | .nvptx = true, | |
| 29045 | }); | |
| 29046 | }; | |
| 29047 | ||
| 29048 | pub const __nvvm_add_rz_f = struct { | |
| 29049 | const param_str = "fff"; | |
| 29050 | const target_set = TargetSet.init(.{ | |
| 29051 | .nvptx = true, | |
| 29052 | }); | |
| 29053 | }; | |
| 29054 | ||
| 29055 | pub const __nvvm_add_rz_ftz_f = struct { | |
| 29056 | const param_str = "fff"; | |
| 29057 | const target_set = TargetSet.init(.{ | |
| 29058 | .nvptx = true, | |
| 29059 | }); | |
| 29060 | }; | |
| 29061 | ||
| 29062 | pub const __nvvm_atom_add_gen_f = struct { | |
| 29063 | const param_str = "ffD*f"; | |
| 29064 | const target_set = TargetSet.init(.{ | |
| 29065 | .nvptx = true, | |
| 29066 | }); | |
| 29067 | const attributes = Attributes{}; | |
| 29068 | }; | |
| 29069 | ||
| 29070 | pub const __nvvm_atom_add_gen_i = struct { | |
| 29071 | const param_str = "iiD*i"; | |
| 29072 | const target_set = TargetSet.init(.{ | |
| 29073 | .nvptx = true, | |
| 29074 | }); | |
| 29075 | const attributes = Attributes{}; | |
| 29076 | }; | |
| 29077 | ||
| 29078 | pub const __nvvm_atom_add_gen_l = struct { | |
| 29079 | const param_str = "LiLiD*Li"; | |
| 29080 | const target_set = TargetSet.init(.{ | |
| 29081 | .nvptx = true, | |
| 29082 | }); | |
| 29083 | const attributes = Attributes{}; | |
| 29084 | }; | |
| 29085 | ||
| 29086 | pub const __nvvm_atom_add_gen_ll = struct { | |
| 29087 | const param_str = "LLiLLiD*LLi"; | |
| 29088 | const target_set = TargetSet.init(.{ | |
| 29089 | .nvptx = true, | |
| 29090 | }); | |
| 29091 | const attributes = Attributes{}; | |
| 29092 | }; | |
| 29093 | ||
| 29094 | pub const __nvvm_atom_and_gen_i = struct { | |
| 29095 | const param_str = "iiD*i"; | |
| 29096 | const target_set = TargetSet.init(.{ | |
| 29097 | .nvptx = true, | |
| 29098 | }); | |
| 29099 | const attributes = Attributes{}; | |
| 29100 | }; | |
| 29101 | ||
| 29102 | pub const __nvvm_atom_and_gen_l = struct { | |
| 29103 | const param_str = "LiLiD*Li"; | |
| 29104 | const target_set = TargetSet.init(.{ | |
| 29105 | .nvptx = true, | |
| 29106 | }); | |
| 29107 | const attributes = Attributes{}; | |
| 29108 | }; | |
| 29109 | ||
| 29110 | pub const __nvvm_atom_and_gen_ll = struct { | |
| 29111 | const param_str = "LLiLLiD*LLi"; | |
| 29112 | const target_set = TargetSet.init(.{ | |
| 29113 | .nvptx = true, | |
| 29114 | }); | |
| 29115 | const attributes = Attributes{}; | |
| 29116 | }; | |
| 29117 | ||
| 29118 | pub const __nvvm_atom_cas_gen_i = struct { | |
| 29119 | const param_str = "iiD*ii"; | |
| 29120 | const target_set = TargetSet.init(.{ | |
| 29121 | .nvptx = true, | |
| 29122 | }); | |
| 29123 | const attributes = Attributes{}; | |
| 29124 | }; | |
| 29125 | ||
| 29126 | pub const __nvvm_atom_cas_gen_l = struct { | |
| 29127 | const param_str = "LiLiD*LiLi"; | |
| 29128 | const target_set = TargetSet.init(.{ | |
| 29129 | .nvptx = true, | |
| 29130 | }); | |
| 29131 | const attributes = Attributes{}; | |
| 29132 | }; | |
| 29133 | ||
| 29134 | pub const __nvvm_atom_cas_gen_ll = struct { | |
| 29135 | const param_str = "LLiLLiD*LLiLLi"; | |
| 29136 | const target_set = TargetSet.init(.{ | |
| 29137 | .nvptx = true, | |
| 29138 | }); | |
| 29139 | const attributes = Attributes{}; | |
| 29140 | }; | |
| 29141 | ||
| 29142 | pub const __nvvm_atom_dec_gen_ui = struct { | |
| 29143 | const param_str = "UiUiD*Ui"; | |
| 29144 | const target_set = TargetSet.init(.{ | |
| 29145 | .nvptx = true, | |
| 29146 | }); | |
| 29147 | const attributes = Attributes{}; | |
| 29148 | }; | |
| 29149 | ||
| 29150 | pub const __nvvm_atom_inc_gen_ui = struct { | |
| 29151 | const param_str = "UiUiD*Ui"; | |
| 29152 | const target_set = TargetSet.init(.{ | |
| 29153 | .nvptx = true, | |
| 29154 | }); | |
| 29155 | const attributes = Attributes{}; | |
| 29156 | }; | |
| 29157 | ||
| 29158 | pub const __nvvm_atom_max_gen_i = struct { | |
| 29159 | const param_str = "iiD*i"; | |
| 29160 | const target_set = TargetSet.init(.{ | |
| 29161 | .nvptx = true, | |
| 29162 | }); | |
| 29163 | const attributes = Attributes{}; | |
| 29164 | }; | |
| 29165 | ||
| 29166 | pub const __nvvm_atom_max_gen_l = struct { | |
| 29167 | const param_str = "LiLiD*Li"; | |
| 29168 | const target_set = TargetSet.init(.{ | |
| 29169 | .nvptx = true, | |
| 29170 | }); | |
| 29171 | const attributes = Attributes{}; | |
| 29172 | }; | |
| 29173 | ||
| 29174 | pub const __nvvm_atom_max_gen_ll = struct { | |
| 29175 | const param_str = "LLiLLiD*LLi"; | |
| 29176 | const target_set = TargetSet.init(.{ | |
| 29177 | .nvptx = true, | |
| 29178 | }); | |
| 29179 | const attributes = Attributes{}; | |
| 29180 | }; | |
| 29181 | ||
| 29182 | pub const __nvvm_atom_max_gen_ui = struct { | |
| 29183 | const param_str = "UiUiD*Ui"; | |
| 29184 | const target_set = TargetSet.init(.{ | |
| 29185 | .nvptx = true, | |
| 29186 | }); | |
| 29187 | const attributes = Attributes{}; | |
| 29188 | }; | |
| 29189 | ||
| 29190 | pub const __nvvm_atom_max_gen_ul = struct { | |
| 29191 | const param_str = "ULiULiD*ULi"; | |
| 29192 | const target_set = TargetSet.init(.{ | |
| 29193 | .nvptx = true, | |
| 29194 | }); | |
| 29195 | const attributes = Attributes{}; | |
| 29196 | }; | |
| 29197 | ||
| 29198 | pub const __nvvm_atom_max_gen_ull = struct { | |
| 29199 | const param_str = "ULLiULLiD*ULLi"; | |
| 29200 | const target_set = TargetSet.init(.{ | |
| 29201 | .nvptx = true, | |
| 29202 | }); | |
| 29203 | const attributes = Attributes{}; | |
| 29204 | }; | |
| 29205 | ||
| 29206 | pub const __nvvm_atom_min_gen_i = struct { | |
| 29207 | const param_str = "iiD*i"; | |
| 29208 | const target_set = TargetSet.init(.{ | |
| 29209 | .nvptx = true, | |
| 29210 | }); | |
| 29211 | const attributes = Attributes{}; | |
| 29212 | }; | |
| 29213 | ||
| 29214 | pub const __nvvm_atom_min_gen_l = struct { | |
| 29215 | const param_str = "LiLiD*Li"; | |
| 29216 | const target_set = TargetSet.init(.{ | |
| 29217 | .nvptx = true, | |
| 29218 | }); | |
| 29219 | const attributes = Attributes{}; | |
| 29220 | }; | |
| 29221 | ||
| 29222 | pub const __nvvm_atom_min_gen_ll = struct { | |
| 29223 | const param_str = "LLiLLiD*LLi"; | |
| 29224 | const target_set = TargetSet.init(.{ | |
| 29225 | .nvptx = true, | |
| 29226 | }); | |
| 29227 | const attributes = Attributes{}; | |
| 29228 | }; | |
| 29229 | ||
| 29230 | pub const __nvvm_atom_min_gen_ui = struct { | |
| 29231 | const param_str = "UiUiD*Ui"; | |
| 29232 | const target_set = TargetSet.init(.{ | |
| 29233 | .nvptx = true, | |
| 29234 | }); | |
| 29235 | const attributes = Attributes{}; | |
| 29236 | }; | |
| 29237 | ||
| 29238 | pub const __nvvm_atom_min_gen_ul = struct { | |
| 29239 | const param_str = "ULiULiD*ULi"; | |
| 29240 | const target_set = TargetSet.init(.{ | |
| 29241 | .nvptx = true, | |
| 29242 | }); | |
| 29243 | const attributes = Attributes{}; | |
| 29244 | }; | |
| 29245 | ||
| 29246 | pub const __nvvm_atom_min_gen_ull = struct { | |
| 29247 | const param_str = "ULLiULLiD*ULLi"; | |
| 29248 | const target_set = TargetSet.init(.{ | |
| 29249 | .nvptx = true, | |
| 29250 | }); | |
| 29251 | const attributes = Attributes{}; | |
| 29252 | }; | |
| 29253 | ||
| 29254 | pub const __nvvm_atom_or_gen_i = struct { | |
| 29255 | const param_str = "iiD*i"; | |
| 29256 | const target_set = TargetSet.init(.{ | |
| 29257 | .nvptx = true, | |
| 29258 | }); | |
| 29259 | const attributes = Attributes{}; | |
| 29260 | }; | |
| 29261 | ||
| 29262 | pub const __nvvm_atom_or_gen_l = struct { | |
| 29263 | const param_str = "LiLiD*Li"; | |
| 29264 | const target_set = TargetSet.init(.{ | |
| 29265 | .nvptx = true, | |
| 29266 | }); | |
| 29267 | const attributes = Attributes{}; | |
| 29268 | }; | |
| 29269 | ||
| 29270 | pub const __nvvm_atom_or_gen_ll = struct { | |
| 29271 | const param_str = "LLiLLiD*LLi"; | |
| 29272 | const target_set = TargetSet.init(.{ | |
| 29273 | .nvptx = true, | |
| 29274 | }); | |
| 29275 | const attributes = Attributes{}; | |
| 29276 | }; | |
| 29277 | ||
| 29278 | pub const __nvvm_atom_sub_gen_i = struct { | |
| 29279 | const param_str = "iiD*i"; | |
| 29280 | const target_set = TargetSet.init(.{ | |
| 29281 | .nvptx = true, | |
| 29282 | }); | |
| 29283 | const attributes = Attributes{}; | |
| 29284 | }; | |
| 29285 | ||
| 29286 | pub const __nvvm_atom_sub_gen_l = struct { | |
| 29287 | const param_str = "LiLiD*Li"; | |
| 29288 | const target_set = TargetSet.init(.{ | |
| 29289 | .nvptx = true, | |
| 29290 | }); | |
| 29291 | const attributes = Attributes{}; | |
| 29292 | }; | |
| 29293 | ||
| 29294 | pub const __nvvm_atom_sub_gen_ll = struct { | |
| 29295 | const param_str = "LLiLLiD*LLi"; | |
| 29296 | const target_set = TargetSet.init(.{ | |
| 29297 | .nvptx = true, | |
| 29298 | }); | |
| 29299 | const attributes = Attributes{}; | |
| 29300 | }; | |
| 29301 | ||
| 29302 | pub const __nvvm_atom_xchg_gen_i = struct { | |
| 29303 | const param_str = "iiD*i"; | |
| 29304 | const target_set = TargetSet.init(.{ | |
| 29305 | .nvptx = true, | |
| 29306 | }); | |
| 29307 | const attributes = Attributes{}; | |
| 29308 | }; | |
| 29309 | ||
| 29310 | pub const __nvvm_atom_xchg_gen_l = struct { | |
| 29311 | const param_str = "LiLiD*Li"; | |
| 29312 | const target_set = TargetSet.init(.{ | |
| 29313 | .nvptx = true, | |
| 29314 | }); | |
| 29315 | const attributes = Attributes{}; | |
| 29316 | }; | |
| 29317 | ||
| 29318 | pub const __nvvm_atom_xchg_gen_ll = struct { | |
| 29319 | const param_str = "LLiLLiD*LLi"; | |
| 29320 | const target_set = TargetSet.init(.{ | |
| 29321 | .nvptx = true, | |
| 29322 | }); | |
| 29323 | const attributes = Attributes{}; | |
| 29324 | }; | |
| 29325 | ||
| 29326 | pub const __nvvm_atom_xor_gen_i = struct { | |
| 29327 | const param_str = "iiD*i"; | |
| 29328 | const target_set = TargetSet.init(.{ | |
| 29329 | .nvptx = true, | |
| 29330 | }); | |
| 29331 | const attributes = Attributes{}; | |
| 29332 | }; | |
| 29333 | ||
| 29334 | pub const __nvvm_atom_xor_gen_l = struct { | |
| 29335 | const param_str = "LiLiD*Li"; | |
| 29336 | const target_set = TargetSet.init(.{ | |
| 29337 | .nvptx = true, | |
| 29338 | }); | |
| 29339 | const attributes = Attributes{}; | |
| 29340 | }; | |
| 29341 | ||
| 29342 | pub const __nvvm_atom_xor_gen_ll = struct { | |
| 29343 | const param_str = "LLiLLiD*LLi"; | |
| 29344 | const target_set = TargetSet.init(.{ | |
| 29345 | .nvptx = true, | |
| 29346 | }); | |
| 29347 | const attributes = Attributes{}; | |
| 29348 | }; | |
| 29349 | ||
| 29350 | pub const __nvvm_bar0_and = struct { | |
| 29351 | const param_str = "ii"; | |
| 29352 | const target_set = TargetSet.init(.{ | |
| 29353 | .nvptx = true, | |
| 29354 | }); | |
| 29355 | }; | |
| 29356 | ||
| 29357 | pub const __nvvm_bar0_or = struct { | |
| 29358 | const param_str = "ii"; | |
| 29359 | const target_set = TargetSet.init(.{ | |
| 29360 | .nvptx = true, | |
| 29361 | }); | |
| 29362 | }; | |
| 29363 | ||
| 29364 | pub const __nvvm_bar0_popc = struct { | |
| 29365 | const param_str = "ii"; | |
| 29366 | const target_set = TargetSet.init(.{ | |
| 29367 | .nvptx = true, | |
| 29368 | }); | |
| 29369 | }; | |
| 29370 | ||
| 29371 | pub const __nvvm_bar_sync = struct { | |
| 29372 | const param_str = "vi"; | |
| 29373 | const target_set = TargetSet.init(.{ | |
| 29374 | .nvptx = true, | |
| 29375 | }); | |
| 29376 | const attributes = Attributes{}; | |
| 29377 | }; | |
| 29378 | ||
| 29379 | pub const __nvvm_bitcast_d2ll = struct { | |
| 29380 | const param_str = "LLid"; | |
| 29381 | const target_set = TargetSet.init(.{ | |
| 29382 | .nvptx = true, | |
| 29383 | }); | |
| 29384 | }; | |
| 29385 | ||
| 29386 | pub const __nvvm_bitcast_f2i = struct { | |
| 29387 | const param_str = "if"; | |
| 29388 | const target_set = TargetSet.init(.{ | |
| 29389 | .nvptx = true, | |
| 29390 | }); | |
| 29391 | }; | |
| 29392 | ||
| 29393 | pub const __nvvm_bitcast_i2f = struct { | |
| 29394 | const param_str = "fi"; | |
| 29395 | const target_set = TargetSet.init(.{ | |
| 29396 | .nvptx = true, | |
| 29397 | }); | |
| 29398 | }; | |
| 29399 | ||
| 29400 | pub const __nvvm_bitcast_ll2d = struct { | |
| 29401 | const param_str = "dLLi"; | |
| 29402 | const target_set = TargetSet.init(.{ | |
| 29403 | .nvptx = true, | |
| 29404 | }); | |
| 29405 | }; | |
| 29406 | ||
| 29407 | pub const __nvvm_ceil_d = struct { | |
| 29408 | const param_str = "dd"; | |
| 29409 | const target_set = TargetSet.init(.{ | |
| 29410 | .nvptx = true, | |
| 29411 | }); | |
| 29412 | }; | |
| 29413 | ||
| 29414 | pub const __nvvm_ceil_f = struct { | |
| 29415 | const param_str = "ff"; | |
| 29416 | const target_set = TargetSet.init(.{ | |
| 29417 | .nvptx = true, | |
| 29418 | }); | |
| 29419 | }; | |
| 29420 | ||
| 29421 | pub const __nvvm_ceil_ftz_f = struct { | |
| 29422 | const param_str = "ff"; | |
| 29423 | const target_set = TargetSet.init(.{ | |
| 29424 | .nvptx = true, | |
| 29425 | }); | |
| 29426 | }; | |
| 29427 | ||
| 29428 | pub const __nvvm_compiler_error = struct { | |
| 29429 | const param_str = "vcC*4"; | |
| 29430 | const target_set = TargetSet.init(.{ | |
| 29431 | .nvptx = true, | |
| 29432 | }); | |
| 29433 | const attributes = Attributes{}; | |
| 29434 | }; | |
| 29435 | ||
| 29436 | pub const __nvvm_compiler_warn = struct { | |
| 29437 | const param_str = "vcC*4"; | |
| 29438 | const target_set = TargetSet.init(.{ | |
| 29439 | .nvptx = true, | |
| 29440 | }); | |
| 29441 | const attributes = Attributes{}; | |
| 29442 | }; | |
| 29443 | ||
| 29444 | pub const __nvvm_cos_approx_f = struct { | |
| 29445 | const param_str = "ff"; | |
| 29446 | const target_set = TargetSet.init(.{ | |
| 29447 | .nvptx = true, | |
| 29448 | }); | |
| 29449 | }; | |
| 29450 | ||
| 29451 | pub const __nvvm_cos_approx_ftz_f = struct { | |
| 29452 | const param_str = "ff"; | |
| 29453 | const target_set = TargetSet.init(.{ | |
| 29454 | .nvptx = true, | |
| 29455 | }); | |
| 29456 | }; | |
| 29457 | ||
| 29458 | pub const __nvvm_d2f_rm = struct { | |
| 29459 | const param_str = "fd"; | |
| 29460 | const target_set = TargetSet.init(.{ | |
| 29461 | .nvptx = true, | |
| 29462 | }); | |
| 29463 | }; | |
| 29464 | ||
| 29465 | pub const __nvvm_d2f_rm_ftz = struct { | |
| 29466 | const param_str = "fd"; | |
| 29467 | const target_set = TargetSet.init(.{ | |
| 29468 | .nvptx = true, | |
| 29469 | }); | |
| 29470 | }; | |
| 29471 | ||
| 29472 | pub const __nvvm_d2f_rn = struct { | |
| 29473 | const param_str = "fd"; | |
| 29474 | const target_set = TargetSet.init(.{ | |
| 29475 | .nvptx = true, | |
| 29476 | }); | |
| 29477 | }; | |
| 29478 | ||
| 29479 | pub const __nvvm_d2f_rn_ftz = struct { | |
| 29480 | const param_str = "fd"; | |
| 29481 | const target_set = TargetSet.init(.{ | |
| 29482 | .nvptx = true, | |
| 29483 | }); | |
| 29484 | }; | |
| 29485 | ||
| 29486 | pub const __nvvm_d2f_rp = struct { | |
| 29487 | const param_str = "fd"; | |
| 29488 | const target_set = TargetSet.init(.{ | |
| 29489 | .nvptx = true, | |
| 29490 | }); | |
| 29491 | }; | |
| 29492 | ||
| 29493 | pub const __nvvm_d2f_rp_ftz = struct { | |
| 29494 | const param_str = "fd"; | |
| 29495 | const target_set = TargetSet.init(.{ | |
| 29496 | .nvptx = true, | |
| 29497 | }); | |
| 29498 | }; | |
| 29499 | ||
| 29500 | pub const __nvvm_d2f_rz = struct { | |
| 29501 | const param_str = "fd"; | |
| 29502 | const target_set = TargetSet.init(.{ | |
| 29503 | .nvptx = true, | |
| 29504 | }); | |
| 29505 | }; | |
| 29506 | ||
| 29507 | pub const __nvvm_d2f_rz_ftz = struct { | |
| 29508 | const param_str = "fd"; | |
| 29509 | const target_set = TargetSet.init(.{ | |
| 29510 | .nvptx = true, | |
| 29511 | }); | |
| 29512 | }; | |
| 29513 | ||
| 29514 | pub const __nvvm_d2i_hi = struct { | |
| 29515 | const param_str = "id"; | |
| 29516 | const target_set = TargetSet.init(.{ | |
| 29517 | .nvptx = true, | |
| 29518 | }); | |
| 29519 | }; | |
| 29520 | ||
| 29521 | pub const __nvvm_d2i_lo = struct { | |
| 29522 | const param_str = "id"; | |
| 29523 | const target_set = TargetSet.init(.{ | |
| 29524 | .nvptx = true, | |
| 29525 | }); | |
| 29526 | }; | |
| 29527 | ||
| 29528 | pub const __nvvm_d2i_rm = struct { | |
| 29529 | const param_str = "id"; | |
| 29530 | const target_set = TargetSet.init(.{ | |
| 29531 | .nvptx = true, | |
| 29532 | }); | |
| 29533 | }; | |
| 29534 | ||
| 29535 | pub const __nvvm_d2i_rn = struct { | |
| 29536 | const param_str = "id"; | |
| 29537 | const target_set = TargetSet.init(.{ | |
| 29538 | .nvptx = true, | |
| 29539 | }); | |
| 29540 | }; | |
| 29541 | ||
| 29542 | pub const __nvvm_d2i_rp = struct { | |
| 29543 | const param_str = "id"; | |
| 29544 | const target_set = TargetSet.init(.{ | |
| 29545 | .nvptx = true, | |
| 29546 | }); | |
| 29547 | }; | |
| 29548 | ||
| 29549 | pub const __nvvm_d2i_rz = struct { | |
| 29550 | const param_str = "id"; | |
| 29551 | const target_set = TargetSet.init(.{ | |
| 29552 | .nvptx = true, | |
| 29553 | }); | |
| 29554 | }; | |
| 29555 | ||
| 29556 | pub const __nvvm_d2ll_rm = struct { | |
| 29557 | const param_str = "LLid"; | |
| 29558 | const target_set = TargetSet.init(.{ | |
| 29559 | .nvptx = true, | |
| 29560 | }); | |
| 29561 | }; | |
| 29562 | ||
| 29563 | pub const __nvvm_d2ll_rn = struct { | |
| 29564 | const param_str = "LLid"; | |
| 29565 | const target_set = TargetSet.init(.{ | |
| 29566 | .nvptx = true, | |
| 29567 | }); | |
| 29568 | }; | |
| 29569 | ||
| 29570 | pub const __nvvm_d2ll_rp = struct { | |
| 29571 | const param_str = "LLid"; | |
| 29572 | const target_set = TargetSet.init(.{ | |
| 29573 | .nvptx = true, | |
| 29574 | }); | |
| 29575 | }; | |
| 29576 | ||
| 29577 | pub const __nvvm_d2ll_rz = struct { | |
| 29578 | const param_str = "LLid"; | |
| 29579 | const target_set = TargetSet.init(.{ | |
| 29580 | .nvptx = true, | |
| 29581 | }); | |
| 29582 | }; | |
| 29583 | ||
| 29584 | pub const __nvvm_d2ui_rm = struct { | |
| 29585 | const param_str = "Uid"; | |
| 29586 | const target_set = TargetSet.init(.{ | |
| 29587 | .nvptx = true, | |
| 29588 | }); | |
| 29589 | }; | |
| 29590 | ||
| 29591 | pub const __nvvm_d2ui_rn = struct { | |
| 29592 | const param_str = "Uid"; | |
| 29593 | const target_set = TargetSet.init(.{ | |
| 29594 | .nvptx = true, | |
| 29595 | }); | |
| 29596 | }; | |
| 29597 | ||
| 29598 | pub const __nvvm_d2ui_rp = struct { | |
| 29599 | const param_str = "Uid"; | |
| 29600 | const target_set = TargetSet.init(.{ | |
| 29601 | .nvptx = true, | |
| 29602 | }); | |
| 29603 | }; | |
| 29604 | ||
| 29605 | pub const __nvvm_d2ui_rz = struct { | |
| 29606 | const param_str = "Uid"; | |
| 29607 | const target_set = TargetSet.init(.{ | |
| 29608 | .nvptx = true, | |
| 29609 | }); | |
| 29610 | }; | |
| 29611 | ||
| 29612 | pub const __nvvm_d2ull_rm = struct { | |
| 29613 | const param_str = "ULLid"; | |
| 29614 | const target_set = TargetSet.init(.{ | |
| 29615 | .nvptx = true, | |
| 29616 | }); | |
| 29617 | }; | |
| 29618 | ||
| 29619 | pub const __nvvm_d2ull_rn = struct { | |
| 29620 | const param_str = "ULLid"; | |
| 29621 | const target_set = TargetSet.init(.{ | |
| 29622 | .nvptx = true, | |
| 29623 | }); | |
| 29624 | }; | |
| 29625 | ||
| 29626 | pub const __nvvm_d2ull_rp = struct { | |
| 29627 | const param_str = "ULLid"; | |
| 29628 | const target_set = TargetSet.init(.{ | |
| 29629 | .nvptx = true, | |
| 29630 | }); | |
| 29631 | }; | |
| 29632 | ||
| 29633 | pub const __nvvm_d2ull_rz = struct { | |
| 29634 | const param_str = "ULLid"; | |
| 29635 | const target_set = TargetSet.init(.{ | |
| 29636 | .nvptx = true, | |
| 29637 | }); | |
| 29638 | }; | |
| 29639 | ||
| 29640 | pub const __nvvm_div_approx_f = struct { | |
| 29641 | const param_str = "fff"; | |
| 29642 | const target_set = TargetSet.init(.{ | |
| 29643 | .nvptx = true, | |
| 29644 | }); | |
| 29645 | }; | |
| 29646 | ||
| 29647 | pub const __nvvm_div_approx_ftz_f = struct { | |
| 29648 | const param_str = "fff"; | |
| 29649 | const target_set = TargetSet.init(.{ | |
| 29650 | .nvptx = true, | |
| 29651 | }); | |
| 29652 | }; | |
| 29653 | ||
| 29654 | pub const __nvvm_div_rm_d = struct { | |
| 29655 | const param_str = "ddd"; | |
| 29656 | const target_set = TargetSet.init(.{ | |
| 29657 | .nvptx = true, | |
| 29658 | }); | |
| 29659 | }; | |
| 29660 | ||
| 29661 | pub const __nvvm_div_rm_f = struct { | |
| 29662 | const param_str = "fff"; | |
| 29663 | const target_set = TargetSet.init(.{ | |
| 29664 | .nvptx = true, | |
| 29665 | }); | |
| 29666 | }; | |
| 29667 | ||
| 29668 | pub const __nvvm_div_rm_ftz_f = struct { | |
| 29669 | const param_str = "fff"; | |
| 29670 | const target_set = TargetSet.init(.{ | |
| 29671 | .nvptx = true, | |
| 29672 | }); | |
| 29673 | }; | |
| 29674 | ||
| 29675 | pub const __nvvm_div_rn_d = struct { | |
| 29676 | const param_str = "ddd"; | |
| 29677 | const target_set = TargetSet.init(.{ | |
| 29678 | .nvptx = true, | |
| 29679 | }); | |
| 29680 | }; | |
| 29681 | ||
| 29682 | pub const __nvvm_div_rn_f = struct { | |
| 29683 | const param_str = "fff"; | |
| 29684 | const target_set = TargetSet.init(.{ | |
| 29685 | .nvptx = true, | |
| 29686 | }); | |
| 29687 | }; | |
| 29688 | ||
| 29689 | pub const __nvvm_div_rn_ftz_f = struct { | |
| 29690 | const param_str = "fff"; | |
| 29691 | const target_set = TargetSet.init(.{ | |
| 29692 | .nvptx = true, | |
| 29693 | }); | |
| 29694 | }; | |
| 29695 | ||
| 29696 | pub const __nvvm_div_rp_d = struct { | |
| 29697 | const param_str = "ddd"; | |
| 29698 | const target_set = TargetSet.init(.{ | |
| 29699 | .nvptx = true, | |
| 29700 | }); | |
| 29701 | }; | |
| 29702 | ||
| 29703 | pub const __nvvm_div_rp_f = struct { | |
| 29704 | const param_str = "fff"; | |
| 29705 | const target_set = TargetSet.init(.{ | |
| 29706 | .nvptx = true, | |
| 29707 | }); | |
| 29708 | }; | |
| 29709 | ||
| 29710 | pub const __nvvm_div_rp_ftz_f = struct { | |
| 29711 | const param_str = "fff"; | |
| 29712 | const target_set = TargetSet.init(.{ | |
| 29713 | .nvptx = true, | |
| 29714 | }); | |
| 29715 | }; | |
| 29716 | ||
| 29717 | pub const __nvvm_div_rz_d = struct { | |
| 29718 | const param_str = "ddd"; | |
| 29719 | const target_set = TargetSet.init(.{ | |
| 29720 | .nvptx = true, | |
| 29721 | }); | |
| 29722 | }; | |
| 29723 | ||
| 29724 | pub const __nvvm_div_rz_f = struct { | |
| 29725 | const param_str = "fff"; | |
| 29726 | const target_set = TargetSet.init(.{ | |
| 29727 | .nvptx = true, | |
| 29728 | }); | |
| 29729 | }; | |
| 29730 | ||
| 29731 | pub const __nvvm_div_rz_ftz_f = struct { | |
| 29732 | const param_str = "fff"; | |
| 29733 | const target_set = TargetSet.init(.{ | |
| 29734 | .nvptx = true, | |
| 29735 | }); | |
| 29736 | }; | |
| 29737 | ||
| 29738 | pub const __nvvm_ex2_approx_d = struct { | |
| 29739 | const param_str = "dd"; | |
| 29740 | const target_set = TargetSet.init(.{ | |
| 29741 | .nvptx = true, | |
| 29742 | }); | |
| 29743 | }; | |
| 29744 | ||
| 29745 | pub const __nvvm_ex2_approx_f = struct { | |
| 29746 | const param_str = "ff"; | |
| 29747 | const target_set = TargetSet.init(.{ | |
| 29748 | .nvptx = true, | |
| 29749 | }); | |
| 29750 | }; | |
| 29751 | ||
| 29752 | pub const __nvvm_ex2_approx_ftz_f = struct { | |
| 29753 | const param_str = "ff"; | |
| 29754 | const target_set = TargetSet.init(.{ | |
| 29755 | .nvptx = true, | |
| 29756 | }); | |
| 29757 | }; | |
| 29758 | ||
| 29759 | pub const __nvvm_f2h_rn = struct { | |
| 29760 | const param_str = "Usf"; | |
| 29761 | const target_set = TargetSet.init(.{ | |
| 29762 | .nvptx = true, | |
| 29763 | }); | |
| 29764 | }; | |
| 29765 | ||
| 29766 | pub const __nvvm_f2h_rn_ftz = struct { | |
| 29767 | const param_str = "Usf"; | |
| 29768 | const target_set = TargetSet.init(.{ | |
| 29769 | .nvptx = true, | |
| 29770 | }); | |
| 29771 | }; | |
| 29772 | ||
| 29773 | pub const __nvvm_f2i_rm = struct { | |
| 29774 | const param_str = "if"; | |
| 29775 | const target_set = TargetSet.init(.{ | |
| 29776 | .nvptx = true, | |
| 29777 | }); | |
| 29778 | }; | |
| 29779 | ||
| 29780 | pub const __nvvm_f2i_rm_ftz = struct { | |
| 29781 | const param_str = "if"; | |
| 29782 | const target_set = TargetSet.init(.{ | |
| 29783 | .nvptx = true, | |
| 29784 | }); | |
| 29785 | }; | |
| 29786 | ||
| 29787 | pub const __nvvm_f2i_rn = struct { | |
| 29788 | const param_str = "if"; | |
| 29789 | const target_set = TargetSet.init(.{ | |
| 29790 | .nvptx = true, | |
| 29791 | }); | |
| 29792 | }; | |
| 29793 | ||
| 29794 | pub const __nvvm_f2i_rn_ftz = struct { | |
| 29795 | const param_str = "if"; | |
| 29796 | const target_set = TargetSet.init(.{ | |
| 29797 | .nvptx = true, | |
| 29798 | }); | |
| 29799 | }; | |
| 29800 | ||
| 29801 | pub const __nvvm_f2i_rp = struct { | |
| 29802 | const param_str = "if"; | |
| 29803 | const target_set = TargetSet.init(.{ | |
| 29804 | .nvptx = true, | |
| 29805 | }); | |
| 29806 | }; | |
| 29807 | ||
| 29808 | pub const __nvvm_f2i_rp_ftz = struct { | |
| 29809 | const param_str = "if"; | |
| 29810 | const target_set = TargetSet.init(.{ | |
| 29811 | .nvptx = true, | |
| 29812 | }); | |
| 29813 | }; | |
| 29814 | ||
| 29815 | pub const __nvvm_f2i_rz = struct { | |
| 29816 | const param_str = "if"; | |
| 29817 | const target_set = TargetSet.init(.{ | |
| 29818 | .nvptx = true, | |
| 29819 | }); | |
| 29820 | }; | |
| 29821 | ||
| 29822 | pub const __nvvm_f2i_rz_ftz = struct { | |
| 29823 | const param_str = "if"; | |
| 29824 | const target_set = TargetSet.init(.{ | |
| 29825 | .nvptx = true, | |
| 29826 | }); | |
| 29827 | }; | |
| 29828 | ||
| 29829 | pub const __nvvm_f2ll_rm = struct { | |
| 29830 | const param_str = "LLif"; | |
| 29831 | const target_set = TargetSet.init(.{ | |
| 29832 | .nvptx = true, | |
| 29833 | }); | |
| 29834 | }; | |
| 29835 | ||
| 29836 | pub const __nvvm_f2ll_rm_ftz = struct { | |
| 29837 | const param_str = "LLif"; | |
| 29838 | const target_set = TargetSet.init(.{ | |
| 29839 | .nvptx = true, | |
| 29840 | }); | |
| 29841 | }; | |
| 29842 | ||
| 29843 | pub const __nvvm_f2ll_rn = struct { | |
| 29844 | const param_str = "LLif"; | |
| 29845 | const target_set = TargetSet.init(.{ | |
| 29846 | .nvptx = true, | |
| 29847 | }); | |
| 29848 | }; | |
| 29849 | ||
| 29850 | pub const __nvvm_f2ll_rn_ftz = struct { | |
| 29851 | const param_str = "LLif"; | |
| 29852 | const target_set = TargetSet.init(.{ | |
| 29853 | .nvptx = true, | |
| 29854 | }); | |
| 29855 | }; | |
| 29856 | ||
| 29857 | pub const __nvvm_f2ll_rp = struct { | |
| 29858 | const param_str = "LLif"; | |
| 29859 | const target_set = TargetSet.init(.{ | |
| 29860 | .nvptx = true, | |
| 29861 | }); | |
| 29862 | }; | |
| 29863 | ||
| 29864 | pub const __nvvm_f2ll_rp_ftz = struct { | |
| 29865 | const param_str = "LLif"; | |
| 29866 | const target_set = TargetSet.init(.{ | |
| 29867 | .nvptx = true, | |
| 29868 | }); | |
| 29869 | }; | |
| 29870 | ||
| 29871 | pub const __nvvm_f2ll_rz = struct { | |
| 29872 | const param_str = "LLif"; | |
| 29873 | const target_set = TargetSet.init(.{ | |
| 29874 | .nvptx = true, | |
| 29875 | }); | |
| 29876 | }; | |
| 29877 | ||
| 29878 | pub const __nvvm_f2ll_rz_ftz = struct { | |
| 29879 | const param_str = "LLif"; | |
| 29880 | const target_set = TargetSet.init(.{ | |
| 29881 | .nvptx = true, | |
| 29882 | }); | |
| 29883 | }; | |
| 29884 | ||
| 29885 | pub const __nvvm_f2ui_rm = struct { | |
| 29886 | const param_str = "Uif"; | |
| 29887 | const target_set = TargetSet.init(.{ | |
| 29888 | .nvptx = true, | |
| 29889 | }); | |
| 29890 | }; | |
| 29891 | ||
| 29892 | pub const __nvvm_f2ui_rm_ftz = struct { | |
| 29893 | const param_str = "Uif"; | |
| 29894 | const target_set = TargetSet.init(.{ | |
| 29895 | .nvptx = true, | |
| 29896 | }); | |
| 29897 | }; | |
| 29898 | ||
| 29899 | pub const __nvvm_f2ui_rn = struct { | |
| 29900 | const param_str = "Uif"; | |
| 29901 | const target_set = TargetSet.init(.{ | |
| 29902 | .nvptx = true, | |
| 29903 | }); | |
| 29904 | }; | |
| 29905 | ||
| 29906 | pub const __nvvm_f2ui_rn_ftz = struct { | |
| 29907 | const param_str = "Uif"; | |
| 29908 | const target_set = TargetSet.init(.{ | |
| 29909 | .nvptx = true, | |
| 29910 | }); | |
| 29911 | }; | |
| 29912 | ||
| 29913 | pub const __nvvm_f2ui_rp = struct { | |
| 29914 | const param_str = "Uif"; | |
| 29915 | const target_set = TargetSet.init(.{ | |
| 29916 | .nvptx = true, | |
| 29917 | }); | |
| 29918 | }; | |
| 29919 | ||
| 29920 | pub const __nvvm_f2ui_rp_ftz = struct { | |
| 29921 | const param_str = "Uif"; | |
| 29922 | const target_set = TargetSet.init(.{ | |
| 29923 | .nvptx = true, | |
| 29924 | }); | |
| 29925 | }; | |
| 29926 | ||
| 29927 | pub const __nvvm_f2ui_rz = struct { | |
| 29928 | const param_str = "Uif"; | |
| 29929 | const target_set = TargetSet.init(.{ | |
| 29930 | .nvptx = true, | |
| 29931 | }); | |
| 29932 | }; | |
| 29933 | ||
| 29934 | pub const __nvvm_f2ui_rz_ftz = struct { | |
| 29935 | const param_str = "Uif"; | |
| 29936 | const target_set = TargetSet.init(.{ | |
| 29937 | .nvptx = true, | |
| 29938 | }); | |
| 29939 | }; | |
| 29940 | ||
| 29941 | pub const __nvvm_f2ull_rm = struct { | |
| 29942 | const param_str = "ULLif"; | |
| 29943 | const target_set = TargetSet.init(.{ | |
| 29944 | .nvptx = true, | |
| 29945 | }); | |
| 29946 | }; | |
| 29947 | ||
| 29948 | pub const __nvvm_f2ull_rm_ftz = struct { | |
| 29949 | const param_str = "ULLif"; | |
| 29950 | const target_set = TargetSet.init(.{ | |
| 29951 | .nvptx = true, | |
| 29952 | }); | |
| 29953 | }; | |
| 29954 | ||
| 29955 | pub const __nvvm_f2ull_rn = struct { | |
| 29956 | const param_str = "ULLif"; | |
| 29957 | const target_set = TargetSet.init(.{ | |
| 29958 | .nvptx = true, | |
| 29959 | }); | |
| 29960 | }; | |
| 29961 | ||
| 29962 | pub const __nvvm_f2ull_rn_ftz = struct { | |
| 29963 | const param_str = "ULLif"; | |
| 29964 | const target_set = TargetSet.init(.{ | |
| 29965 | .nvptx = true, | |
| 29966 | }); | |
| 29967 | }; | |
| 29968 | ||
| 29969 | pub const __nvvm_f2ull_rp = struct { | |
| 29970 | const param_str = "ULLif"; | |
| 29971 | const target_set = TargetSet.init(.{ | |
| 29972 | .nvptx = true, | |
| 29973 | }); | |
| 29974 | }; | |
| 29975 | ||
| 29976 | pub const __nvvm_f2ull_rp_ftz = struct { | |
| 29977 | const param_str = "ULLif"; | |
| 29978 | const target_set = TargetSet.init(.{ | |
| 29979 | .nvptx = true, | |
| 29980 | }); | |
| 29981 | }; | |
| 29982 | ||
| 29983 | pub const __nvvm_f2ull_rz = struct { | |
| 29984 | const param_str = "ULLif"; | |
| 29985 | const target_set = TargetSet.init(.{ | |
| 29986 | .nvptx = true, | |
| 29987 | }); | |
| 29988 | }; | |
| 29989 | ||
| 29990 | pub const __nvvm_f2ull_rz_ftz = struct { | |
| 29991 | const param_str = "ULLif"; | |
| 29992 | const target_set = TargetSet.init(.{ | |
| 29993 | .nvptx = true, | |
| 29994 | }); | |
| 29995 | }; | |
| 29996 | ||
| 29997 | pub const __nvvm_fabs_d = struct { | |
| 29998 | const param_str = "dd"; | |
| 29999 | const target_set = TargetSet.init(.{ | |
| 30000 | .nvptx = true, | |
| 30001 | }); | |
| 30002 | }; | |
| 30003 | ||
| 30004 | pub const __nvvm_fabs_f = struct { | |
| 30005 | const param_str = "ff"; | |
| 30006 | const target_set = TargetSet.init(.{ | |
| 30007 | .nvptx = true, | |
| 30008 | }); | |
| 30009 | }; | |
| 30010 | ||
| 30011 | pub const __nvvm_fabs_ftz_f = struct { | |
| 30012 | const param_str = "ff"; | |
| 30013 | const target_set = TargetSet.init(.{ | |
| 30014 | .nvptx = true, | |
| 30015 | }); | |
| 30016 | }; | |
| 30017 | ||
| 30018 | pub const __nvvm_floor_d = struct { | |
| 30019 | const param_str = "dd"; | |
| 30020 | const target_set = TargetSet.init(.{ | |
| 30021 | .nvptx = true, | |
| 30022 | }); | |
| 30023 | }; | |
| 30024 | ||
| 30025 | pub const __nvvm_floor_f = struct { | |
| 30026 | const param_str = "ff"; | |
| 30027 | const target_set = TargetSet.init(.{ | |
| 30028 | .nvptx = true, | |
| 30029 | }); | |
| 30030 | }; | |
| 30031 | ||
| 30032 | pub const __nvvm_floor_ftz_f = struct { | |
| 30033 | const param_str = "ff"; | |
| 30034 | const target_set = TargetSet.init(.{ | |
| 30035 | .nvptx = true, | |
| 30036 | }); | |
| 30037 | }; | |
| 30038 | ||
| 30039 | pub const __nvvm_fma_rm_d = struct { | |
| 30040 | const param_str = "dddd"; | |
| 30041 | const target_set = TargetSet.init(.{ | |
| 30042 | .nvptx = true, | |
| 30043 | }); | |
| 30044 | }; | |
| 30045 | ||
| 30046 | pub const __nvvm_fma_rm_f = struct { | |
| 30047 | const param_str = "ffff"; | |
| 30048 | const target_set = TargetSet.init(.{ | |
| 30049 | .nvptx = true, | |
| 30050 | }); | |
| 30051 | }; | |
| 30052 | ||
| 30053 | pub const __nvvm_fma_rm_ftz_f = struct { | |
| 30054 | const param_str = "ffff"; | |
| 30055 | const target_set = TargetSet.init(.{ | |
| 30056 | .nvptx = true, | |
| 30057 | }); | |
| 30058 | }; | |
| 30059 | ||
| 30060 | pub const __nvvm_fma_rn_d = struct { | |
| 30061 | const param_str = "dddd"; | |
| 30062 | const target_set = TargetSet.init(.{ | |
| 30063 | .nvptx = true, | |
| 30064 | }); | |
| 30065 | }; | |
| 30066 | ||
| 30067 | pub const __nvvm_fma_rn_f = struct { | |
| 30068 | const param_str = "ffff"; | |
| 30069 | const target_set = TargetSet.init(.{ | |
| 30070 | .nvptx = true, | |
| 30071 | }); | |
| 30072 | }; | |
| 30073 | ||
| 30074 | pub const __nvvm_fma_rn_ftz_f = struct { | |
| 30075 | const param_str = "ffff"; | |
| 30076 | const target_set = TargetSet.init(.{ | |
| 30077 | .nvptx = true, | |
| 30078 | }); | |
| 30079 | }; | |
| 30080 | ||
| 30081 | pub const __nvvm_fma_rp_d = struct { | |
| 30082 | const param_str = "dddd"; | |
| 30083 | const target_set = TargetSet.init(.{ | |
| 30084 | .nvptx = true, | |
| 30085 | }); | |
| 30086 | }; | |
| 30087 | ||
| 30088 | pub const __nvvm_fma_rp_f = struct { | |
| 30089 | const param_str = "ffff"; | |
| 30090 | const target_set = TargetSet.init(.{ | |
| 30091 | .nvptx = true, | |
| 30092 | }); | |
| 30093 | }; | |
| 30094 | ||
| 30095 | pub const __nvvm_fma_rp_ftz_f = struct { | |
| 30096 | const param_str = "ffff"; | |
| 30097 | const target_set = TargetSet.init(.{ | |
| 30098 | .nvptx = true, | |
| 30099 | }); | |
| 30100 | }; | |
| 30101 | ||
| 30102 | pub const __nvvm_fma_rz_d = struct { | |
| 30103 | const param_str = "dddd"; | |
| 30104 | const target_set = TargetSet.init(.{ | |
| 30105 | .nvptx = true, | |
| 30106 | }); | |
| 30107 | }; | |
| 30108 | ||
| 30109 | pub const __nvvm_fma_rz_f = struct { | |
| 30110 | const param_str = "ffff"; | |
| 30111 | const target_set = TargetSet.init(.{ | |
| 30112 | .nvptx = true, | |
| 30113 | }); | |
| 30114 | }; | |
| 30115 | ||
| 30116 | pub const __nvvm_fma_rz_ftz_f = struct { | |
| 30117 | const param_str = "ffff"; | |
| 30118 | const target_set = TargetSet.init(.{ | |
| 30119 | .nvptx = true, | |
| 30120 | }); | |
| 30121 | }; | |
| 30122 | ||
| 30123 | pub const __nvvm_fmax_d = struct { | |
| 30124 | const param_str = "ddd"; | |
| 30125 | const target_set = TargetSet.init(.{ | |
| 30126 | .nvptx = true, | |
| 30127 | }); | |
| 30128 | }; | |
| 30129 | ||
| 30130 | pub const __nvvm_fmax_f = struct { | |
| 30131 | const param_str = "fff"; | |
| 30132 | const target_set = TargetSet.init(.{ | |
| 30133 | .nvptx = true, | |
| 30134 | }); | |
| 30135 | }; | |
| 30136 | ||
| 30137 | pub const __nvvm_fmax_ftz_f = struct { | |
| 30138 | const param_str = "fff"; | |
| 30139 | const target_set = TargetSet.init(.{ | |
| 30140 | .nvptx = true, | |
| 30141 | }); | |
| 30142 | }; | |
| 30143 | ||
| 30144 | pub const __nvvm_fmin_d = struct { | |
| 30145 | const param_str = "ddd"; | |
| 30146 | const target_set = TargetSet.init(.{ | |
| 30147 | .nvptx = true, | |
| 30148 | }); | |
| 30149 | }; | |
| 30150 | ||
| 30151 | pub const __nvvm_fmin_f = struct { | |
| 30152 | const param_str = "fff"; | |
| 30153 | const target_set = TargetSet.init(.{ | |
| 30154 | .nvptx = true, | |
| 30155 | }); | |
| 30156 | }; | |
| 30157 | ||
| 30158 | pub const __nvvm_fmin_ftz_f = struct { | |
| 30159 | const param_str = "fff"; | |
| 30160 | const target_set = TargetSet.init(.{ | |
| 30161 | .nvptx = true, | |
| 30162 | }); | |
| 30163 | }; | |
| 30164 | ||
| 30165 | pub const __nvvm_i2d_rm = struct { | |
| 30166 | const param_str = "di"; | |
| 30167 | const target_set = TargetSet.init(.{ | |
| 30168 | .nvptx = true, | |
| 30169 | }); | |
| 30170 | }; | |
| 30171 | ||
| 30172 | pub const __nvvm_i2d_rn = struct { | |
| 30173 | const param_str = "di"; | |
| 30174 | const target_set = TargetSet.init(.{ | |
| 30175 | .nvptx = true, | |
| 30176 | }); | |
| 30177 | }; | |
| 30178 | ||
| 30179 | pub const __nvvm_i2d_rp = struct { | |
| 30180 | const param_str = "di"; | |
| 30181 | const target_set = TargetSet.init(.{ | |
| 30182 | .nvptx = true, | |
| 30183 | }); | |
| 30184 | }; | |
| 30185 | ||
| 30186 | pub const __nvvm_i2d_rz = struct { | |
| 30187 | const param_str = "di"; | |
| 30188 | const target_set = TargetSet.init(.{ | |
| 30189 | .nvptx = true, | |
| 30190 | }); | |
| 30191 | }; | |
| 30192 | ||
| 30193 | pub const __nvvm_i2f_rm = struct { | |
| 30194 | const param_str = "fi"; | |
| 30195 | const target_set = TargetSet.init(.{ | |
| 30196 | .nvptx = true, | |
| 30197 | }); | |
| 30198 | }; | |
| 30199 | ||
| 30200 | pub const __nvvm_i2f_rn = struct { | |
| 30201 | const param_str = "fi"; | |
| 30202 | const target_set = TargetSet.init(.{ | |
| 30203 | .nvptx = true, | |
| 30204 | }); | |
| 30205 | }; | |
| 30206 | ||
| 30207 | pub const __nvvm_i2f_rp = struct { | |
| 30208 | const param_str = "fi"; | |
| 30209 | const target_set = TargetSet.init(.{ | |
| 30210 | .nvptx = true, | |
| 30211 | }); | |
| 30212 | }; | |
| 30213 | ||
| 30214 | pub const __nvvm_i2f_rz = struct { | |
| 30215 | const param_str = "fi"; | |
| 30216 | const target_set = TargetSet.init(.{ | |
| 30217 | .nvptx = true, | |
| 30218 | }); | |
| 30219 | }; | |
| 30220 | ||
| 30221 | pub const __nvvm_isspacep_const = struct { | |
| 30222 | const param_str = "bvC*"; | |
| 30223 | const target_set = TargetSet.init(.{ | |
| 30224 | .nvptx = true, | |
| 30225 | }); | |
| 30226 | const attributes = Attributes{ | |
| 30227 | .@"const" = true, | |
| 30228 | }; | |
| 30229 | }; | |
| 30230 | ||
| 30231 | pub const __nvvm_isspacep_global = struct { | |
| 30232 | const param_str = "bvC*"; | |
| 30233 | const target_set = TargetSet.init(.{ | |
| 30234 | .nvptx = true, | |
| 30235 | }); | |
| 30236 | const attributes = Attributes{ | |
| 30237 | .@"const" = true, | |
| 30238 | }; | |
| 30239 | }; | |
| 30240 | ||
| 30241 | pub const __nvvm_isspacep_local = struct { | |
| 30242 | const param_str = "bvC*"; | |
| 30243 | const target_set = TargetSet.init(.{ | |
| 30244 | .nvptx = true, | |
| 30245 | }); | |
| 30246 | const attributes = Attributes{ | |
| 30247 | .@"const" = true, | |
| 30248 | }; | |
| 30249 | }; | |
| 30250 | ||
| 30251 | pub const __nvvm_isspacep_shared = struct { | |
| 30252 | const param_str = "bvC*"; | |
| 30253 | const target_set = TargetSet.init(.{ | |
| 30254 | .nvptx = true, | |
| 30255 | }); | |
| 30256 | const attributes = Attributes{ | |
| 30257 | .@"const" = true, | |
| 30258 | }; | |
| 30259 | }; | |
| 30260 | ||
| 30261 | pub const __nvvm_ldg_c = struct { | |
| 30262 | const param_str = "ccC*"; | |
| 30263 | const target_set = TargetSet.init(.{ | |
| 30264 | .nvptx = true, | |
| 30265 | }); | |
| 30266 | }; | |
| 30267 | ||
| 30268 | pub const __nvvm_ldg_c2 = struct { | |
| 30269 | const param_str = "E2cE2cC*"; | |
| 30270 | const target_set = TargetSet.init(.{ | |
| 30271 | .nvptx = true, | |
| 30272 | }); | |
| 30273 | }; | |
| 30274 | ||
| 30275 | pub const __nvvm_ldg_c4 = struct { | |
| 30276 | const param_str = "E4cE4cC*"; | |
| 30277 | const target_set = TargetSet.init(.{ | |
| 30278 | .nvptx = true, | |
| 30279 | }); | |
| 30280 | }; | |
| 30281 | ||
| 30282 | pub const __nvvm_ldg_d = struct { | |
| 30283 | const param_str = "ddC*"; | |
| 30284 | const target_set = TargetSet.init(.{ | |
| 30285 | .nvptx = true, | |
| 30286 | }); | |
| 30287 | }; | |
| 30288 | ||
| 30289 | pub const __nvvm_ldg_d2 = struct { | |
| 30290 | const param_str = "E2dE2dC*"; | |
| 30291 | const target_set = TargetSet.init(.{ | |
| 30292 | .nvptx = true, | |
| 30293 | }); | |
| 30294 | }; | |
| 30295 | ||
| 30296 | pub const __nvvm_ldg_f = struct { | |
| 30297 | const param_str = "ffC*"; | |
| 30298 | const target_set = TargetSet.init(.{ | |
| 30299 | .nvptx = true, | |
| 30300 | }); | |
| 30301 | }; | |
| 30302 | ||
| 30303 | pub const __nvvm_ldg_f2 = struct { | |
| 30304 | const param_str = "E2fE2fC*"; | |
| 30305 | const target_set = TargetSet.init(.{ | |
| 30306 | .nvptx = true, | |
| 30307 | }); | |
| 30308 | }; | |
| 30309 | ||
| 30310 | pub const __nvvm_ldg_f4 = struct { | |
| 30311 | const param_str = "E4fE4fC*"; | |
| 30312 | const target_set = TargetSet.init(.{ | |
| 30313 | .nvptx = true, | |
| 30314 | }); | |
| 30315 | }; | |
| 30316 | ||
| 30317 | pub const __nvvm_ldg_i = struct { | |
| 30318 | const param_str = "iiC*"; | |
| 30319 | const target_set = TargetSet.init(.{ | |
| 30320 | .nvptx = true, | |
| 30321 | }); | |
| 30322 | }; | |
| 30323 | ||
| 30324 | pub const __nvvm_ldg_i2 = struct { | |
| 30325 | const param_str = "E2iE2iC*"; | |
| 30326 | const target_set = TargetSet.init(.{ | |
| 30327 | .nvptx = true, | |
| 30328 | }); | |
| 30329 | }; | |
| 30330 | ||
| 30331 | pub const __nvvm_ldg_i4 = struct { | |
| 30332 | const param_str = "E4iE4iC*"; | |
| 30333 | const target_set = TargetSet.init(.{ | |
| 30334 | .nvptx = true, | |
| 30335 | }); | |
| 30336 | }; | |
| 30337 | ||
| 30338 | pub const __nvvm_ldg_l = struct { | |
| 30339 | const param_str = "LiLiC*"; | |
| 30340 | const target_set = TargetSet.init(.{ | |
| 30341 | .nvptx = true, | |
| 30342 | }); | |
| 30343 | }; | |
| 30344 | ||
| 30345 | pub const __nvvm_ldg_ll = struct { | |
| 30346 | const param_str = "LLiLLiC*"; | |
| 30347 | const target_set = TargetSet.init(.{ | |
| 30348 | .nvptx = true, | |
| 30349 | }); | |
| 30350 | }; | |
| 30351 | ||
| 30352 | pub const __nvvm_ldg_ll2 = struct { | |
| 30353 | const param_str = "E2LLiE2LLiC*"; | |
| 30354 | const target_set = TargetSet.init(.{ | |
| 30355 | .nvptx = true, | |
| 30356 | }); | |
| 30357 | }; | |
| 30358 | ||
| 30359 | pub const __nvvm_ldg_s = struct { | |
| 30360 | const param_str = "ssC*"; | |
| 30361 | const target_set = TargetSet.init(.{ | |
| 30362 | .nvptx = true, | |
| 30363 | }); | |
| 30364 | }; | |
| 30365 | ||
| 30366 | pub const __nvvm_ldg_s2 = struct { | |
| 30367 | const param_str = "E2sE2sC*"; | |
| 30368 | const target_set = TargetSet.init(.{ | |
| 30369 | .nvptx = true, | |
| 30370 | }); | |
| 30371 | }; | |
| 30372 | ||
| 30373 | pub const __nvvm_ldg_s4 = struct { | |
| 30374 | const param_str = "E4sE4sC*"; | |
| 30375 | const target_set = TargetSet.init(.{ | |
| 30376 | .nvptx = true, | |
| 30377 | }); | |
| 30378 | }; | |
| 30379 | ||
| 30380 | pub const __nvvm_ldg_uc = struct { | |
| 30381 | const param_str = "UcUcC*"; | |
| 30382 | const target_set = TargetSet.init(.{ | |
| 30383 | .nvptx = true, | |
| 30384 | }); | |
| 30385 | }; | |
| 30386 | ||
| 30387 | pub const __nvvm_ldg_uc2 = struct { | |
| 30388 | const param_str = "E2UcE2UcC*"; | |
| 30389 | const target_set = TargetSet.init(.{ | |
| 30390 | .nvptx = true, | |
| 30391 | }); | |
| 30392 | }; | |
| 30393 | ||
| 30394 | pub const __nvvm_ldg_uc4 = struct { | |
| 30395 | const param_str = "E4UcE4UcC*"; | |
| 30396 | const target_set = TargetSet.init(.{ | |
| 30397 | .nvptx = true, | |
| 30398 | }); | |
| 30399 | }; | |
| 30400 | ||
| 30401 | pub const __nvvm_ldg_ui = struct { | |
| 30402 | const param_str = "UiUiC*"; | |
| 30403 | const target_set = TargetSet.init(.{ | |
| 30404 | .nvptx = true, | |
| 30405 | }); | |
| 30406 | }; | |
| 30407 | ||
| 30408 | pub const __nvvm_ldg_ui2 = struct { | |
| 30409 | const param_str = "E2UiE2UiC*"; | |
| 30410 | const target_set = TargetSet.init(.{ | |
| 30411 | .nvptx = true, | |
| 30412 | }); | |
| 30413 | }; | |
| 30414 | ||
| 30415 | pub const __nvvm_ldg_ui4 = struct { | |
| 30416 | const param_str = "E4UiE4UiC*"; | |
| 30417 | const target_set = TargetSet.init(.{ | |
| 30418 | .nvptx = true, | |
| 30419 | }); | |
| 30420 | }; | |
| 30421 | ||
| 30422 | pub const __nvvm_ldg_ul = struct { | |
| 30423 | const param_str = "ULiULiC*"; | |
| 30424 | const target_set = TargetSet.init(.{ | |
| 30425 | .nvptx = true, | |
| 30426 | }); | |
| 30427 | }; | |
| 30428 | ||
| 30429 | pub const __nvvm_ldg_ull = struct { | |
| 30430 | const param_str = "ULLiULLiC*"; | |
| 30431 | const target_set = TargetSet.init(.{ | |
| 30432 | .nvptx = true, | |
| 30433 | }); | |
| 30434 | }; | |
| 30435 | ||
| 30436 | pub const __nvvm_ldg_ull2 = struct { | |
| 30437 | const param_str = "E2ULLiE2ULLiC*"; | |
| 30438 | const target_set = TargetSet.init(.{ | |
| 30439 | .nvptx = true, | |
| 30440 | }); | |
| 30441 | }; | |
| 30442 | ||
| 30443 | pub const __nvvm_ldg_us = struct { | |
| 30444 | const param_str = "UsUsC*"; | |
| 30445 | const target_set = TargetSet.init(.{ | |
| 30446 | .nvptx = true, | |
| 30447 | }); | |
| 30448 | }; | |
| 30449 | ||
| 30450 | pub const __nvvm_ldg_us2 = struct { | |
| 30451 | const param_str = "E2UsE2UsC*"; | |
| 30452 | const target_set = TargetSet.init(.{ | |
| 30453 | .nvptx = true, | |
| 30454 | }); | |
| 30455 | }; | |
| 30456 | ||
| 30457 | pub const __nvvm_ldg_us4 = struct { | |
| 30458 | const param_str = "E4UsE4UsC*"; | |
| 30459 | const target_set = TargetSet.init(.{ | |
| 30460 | .nvptx = true, | |
| 30461 | }); | |
| 30462 | }; | |
| 30463 | ||
| 30464 | pub const __nvvm_lg2_approx_d = struct { | |
| 30465 | const param_str = "dd"; | |
| 30466 | const target_set = TargetSet.init(.{ | |
| 30467 | .nvptx = true, | |
| 30468 | }); | |
| 30469 | }; | |
| 30470 | ||
| 30471 | pub const __nvvm_lg2_approx_f = struct { | |
| 30472 | const param_str = "ff"; | |
| 30473 | const target_set = TargetSet.init(.{ | |
| 30474 | .nvptx = true, | |
| 30475 | }); | |
| 30476 | }; | |
| 30477 | ||
| 30478 | pub const __nvvm_lg2_approx_ftz_f = struct { | |
| 30479 | const param_str = "ff"; | |
| 30480 | const target_set = TargetSet.init(.{ | |
| 30481 | .nvptx = true, | |
| 30482 | }); | |
| 30483 | }; | |
| 30484 | ||
| 30485 | pub const __nvvm_ll2d_rm = struct { | |
| 30486 | const param_str = "dLLi"; | |
| 30487 | const target_set = TargetSet.init(.{ | |
| 30488 | .nvptx = true, | |
| 30489 | }); | |
| 30490 | }; | |
| 30491 | ||
| 30492 | pub const __nvvm_ll2d_rn = struct { | |
| 30493 | const param_str = "dLLi"; | |
| 30494 | const target_set = TargetSet.init(.{ | |
| 30495 | .nvptx = true, | |
| 30496 | }); | |
| 30497 | }; | |
| 30498 | ||
| 30499 | pub const __nvvm_ll2d_rp = struct { | |
| 30500 | const param_str = "dLLi"; | |
| 30501 | const target_set = TargetSet.init(.{ | |
| 30502 | .nvptx = true, | |
| 30503 | }); | |
| 30504 | }; | |
| 30505 | ||
| 30506 | pub const __nvvm_ll2d_rz = struct { | |
| 30507 | const param_str = "dLLi"; | |
| 30508 | const target_set = TargetSet.init(.{ | |
| 30509 | .nvptx = true, | |
| 30510 | }); | |
| 30511 | }; | |
| 30512 | ||
| 30513 | pub const __nvvm_ll2f_rm = struct { | |
| 30514 | const param_str = "fLLi"; | |
| 30515 | const target_set = TargetSet.init(.{ | |
| 30516 | .nvptx = true, | |
| 30517 | }); | |
| 30518 | }; | |
| 30519 | ||
| 30520 | pub const __nvvm_ll2f_rn = struct { | |
| 30521 | const param_str = "fLLi"; | |
| 30522 | const target_set = TargetSet.init(.{ | |
| 30523 | .nvptx = true, | |
| 30524 | }); | |
| 30525 | }; | |
| 30526 | ||
| 30527 | pub const __nvvm_ll2f_rp = struct { | |
| 30528 | const param_str = "fLLi"; | |
| 30529 | const target_set = TargetSet.init(.{ | |
| 30530 | .nvptx = true, | |
| 30531 | }); | |
| 30532 | }; | |
| 30533 | ||
| 30534 | pub const __nvvm_ll2f_rz = struct { | |
| 30535 | const param_str = "fLLi"; | |
| 30536 | const target_set = TargetSet.init(.{ | |
| 30537 | .nvptx = true, | |
| 30538 | }); | |
| 30539 | }; | |
| 30540 | ||
| 30541 | pub const __nvvm_lohi_i2d = struct { | |
| 30542 | const param_str = "dii"; | |
| 30543 | const target_set = TargetSet.init(.{ | |
| 30544 | .nvptx = true, | |
| 30545 | }); | |
| 30546 | }; | |
| 30547 | ||
| 30548 | pub const __nvvm_membar_cta = struct { | |
| 30549 | const param_str = "v"; | |
| 30550 | const target_set = TargetSet.init(.{ | |
| 30551 | .nvptx = true, | |
| 30552 | }); | |
| 30553 | }; | |
| 30554 | ||
| 30555 | pub const __nvvm_membar_gl = struct { | |
| 30556 | const param_str = "v"; | |
| 30557 | const target_set = TargetSet.init(.{ | |
| 30558 | .nvptx = true, | |
| 30559 | }); | |
| 30560 | }; | |
| 30561 | ||
| 30562 | pub const __nvvm_membar_sys = struct { | |
| 30563 | const param_str = "v"; | |
| 30564 | const target_set = TargetSet.init(.{ | |
| 30565 | .nvptx = true, | |
| 30566 | }); | |
| 30567 | }; | |
| 30568 | ||
| 30569 | pub const __nvvm_memcpy = struct { | |
| 30570 | const param_str = "vUc*Uc*zi"; | |
| 30571 | const target_set = TargetSet.init(.{ | |
| 30572 | .nvptx = true, | |
| 30573 | }); | |
| 30574 | }; | |
| 30575 | ||
| 30576 | pub const __nvvm_memset = struct { | |
| 30577 | const param_str = "vUc*Uczi"; | |
| 30578 | const target_set = TargetSet.init(.{ | |
| 30579 | .nvptx = true, | |
| 30580 | }); | |
| 30581 | }; | |
| 30582 | ||
| 30583 | pub const __nvvm_mul24_i = struct { | |
| 30584 | const param_str = "iii"; | |
| 30585 | const target_set = TargetSet.init(.{ | |
| 30586 | .nvptx = true, | |
| 30587 | }); | |
| 30588 | }; | |
| 30589 | ||
| 30590 | pub const __nvvm_mul24_ui = struct { | |
| 30591 | const param_str = "UiUiUi"; | |
| 30592 | const target_set = TargetSet.init(.{ | |
| 30593 | .nvptx = true, | |
| 30594 | }); | |
| 30595 | }; | |
| 30596 | ||
| 30597 | pub const __nvvm_mul_rm_d = struct { | |
| 30598 | const param_str = "ddd"; | |
| 30599 | const target_set = TargetSet.init(.{ | |
| 30600 | .nvptx = true, | |
| 30601 | }); | |
| 30602 | }; | |
| 30603 | ||
| 30604 | pub const __nvvm_mul_rm_f = struct { | |
| 30605 | const param_str = "fff"; | |
| 30606 | const target_set = TargetSet.init(.{ | |
| 30607 | .nvptx = true, | |
| 30608 | }); | |
| 30609 | }; | |
| 30610 | ||
| 30611 | pub const __nvvm_mul_rm_ftz_f = struct { | |
| 30612 | const param_str = "fff"; | |
| 30613 | const target_set = TargetSet.init(.{ | |
| 30614 | .nvptx = true, | |
| 30615 | }); | |
| 30616 | }; | |
| 30617 | ||
| 30618 | pub const __nvvm_mul_rn_d = struct { | |
| 30619 | const param_str = "ddd"; | |
| 30620 | const target_set = TargetSet.init(.{ | |
| 30621 | .nvptx = true, | |
| 30622 | }); | |
| 30623 | }; | |
| 30624 | ||
| 30625 | pub const __nvvm_mul_rn_f = struct { | |
| 30626 | const param_str = "fff"; | |
| 30627 | const target_set = TargetSet.init(.{ | |
| 30628 | .nvptx = true, | |
| 30629 | }); | |
| 30630 | }; | |
| 30631 | ||
| 30632 | pub const __nvvm_mul_rn_ftz_f = struct { | |
| 30633 | const param_str = "fff"; | |
| 30634 | const target_set = TargetSet.init(.{ | |
| 30635 | .nvptx = true, | |
| 30636 | }); | |
| 30637 | }; | |
| 30638 | ||
| 30639 | pub const __nvvm_mul_rp_d = struct { | |
| 30640 | const param_str = "ddd"; | |
| 30641 | const target_set = TargetSet.init(.{ | |
| 30642 | .nvptx = true, | |
| 30643 | }); | |
| 30644 | }; | |
| 30645 | ||
| 30646 | pub const __nvvm_mul_rp_f = struct { | |
| 30647 | const param_str = "fff"; | |
| 30648 | const target_set = TargetSet.init(.{ | |
| 30649 | .nvptx = true, | |
| 30650 | }); | |
| 30651 | }; | |
| 30652 | ||
| 30653 | pub const __nvvm_mul_rp_ftz_f = struct { | |
| 30654 | const param_str = "fff"; | |
| 30655 | const target_set = TargetSet.init(.{ | |
| 30656 | .nvptx = true, | |
| 30657 | }); | |
| 30658 | }; | |
| 30659 | ||
| 30660 | pub const __nvvm_mul_rz_d = struct { | |
| 30661 | const param_str = "ddd"; | |
| 30662 | const target_set = TargetSet.init(.{ | |
| 30663 | .nvptx = true, | |
| 30664 | }); | |
| 30665 | }; | |
| 30666 | ||
| 30667 | pub const __nvvm_mul_rz_f = struct { | |
| 30668 | const param_str = "fff"; | |
| 30669 | const target_set = TargetSet.init(.{ | |
| 30670 | .nvptx = true, | |
| 30671 | }); | |
| 30672 | }; | |
| 30673 | ||
| 30674 | pub const __nvvm_mul_rz_ftz_f = struct { | |
| 30675 | const param_str = "fff"; | |
| 30676 | const target_set = TargetSet.init(.{ | |
| 30677 | .nvptx = true, | |
| 30678 | }); | |
| 30679 | }; | |
| 30680 | ||
| 30681 | pub const __nvvm_mulhi_i = struct { | |
| 30682 | const param_str = "iii"; | |
| 30683 | const target_set = TargetSet.init(.{ | |
| 30684 | .nvptx = true, | |
| 30685 | }); | |
| 30686 | }; | |
| 30687 | ||
| 30688 | pub const __nvvm_mulhi_ll = struct { | |
| 30689 | const param_str = "LLiLLiLLi"; | |
| 30690 | const target_set = TargetSet.init(.{ | |
| 30691 | .nvptx = true, | |
| 30692 | }); | |
| 30693 | }; | |
| 30694 | ||
| 30695 | pub const __nvvm_mulhi_ui = struct { | |
| 30696 | const param_str = "UiUiUi"; | |
| 30697 | const target_set = TargetSet.init(.{ | |
| 30698 | .nvptx = true, | |
| 30699 | }); | |
| 30700 | }; | |
| 30701 | ||
| 30702 | pub const __nvvm_mulhi_ull = struct { | |
| 30703 | const param_str = "ULLiULLiULLi"; | |
| 30704 | const target_set = TargetSet.init(.{ | |
| 30705 | .nvptx = true, | |
| 30706 | }); | |
| 30707 | }; | |
| 30708 | ||
| 30709 | pub const __nvvm_prmt = struct { | |
| 30710 | const param_str = "UiUiUiUi"; | |
| 30711 | const target_set = TargetSet.init(.{ | |
| 30712 | .nvptx = true, | |
| 30713 | }); | |
| 30714 | }; | |
| 30715 | ||
| 30716 | pub const __nvvm_rcp_approx_ftz_d = struct { | |
| 30717 | const param_str = "dd"; | |
| 30718 | const target_set = TargetSet.init(.{ | |
| 30719 | .nvptx = true, | |
| 30720 | }); | |
| 30721 | }; | |
| 30722 | ||
| 30723 | pub const __nvvm_rcp_approx_ftz_f = struct { | |
| 30724 | const param_str = "ff"; | |
| 30725 | const target_set = TargetSet.init(.{ | |
| 30726 | .nvptx = true, | |
| 30727 | }); | |
| 30728 | }; | |
| 30729 | ||
| 30730 | pub const __nvvm_rcp_rm_d = struct { | |
| 30731 | const param_str = "dd"; | |
| 30732 | const target_set = TargetSet.init(.{ | |
| 30733 | .nvptx = true, | |
| 30734 | }); | |
| 30735 | }; | |
| 30736 | ||
| 30737 | pub const __nvvm_rcp_rm_f = struct { | |
| 30738 | const param_str = "ff"; | |
| 30739 | const target_set = TargetSet.init(.{ | |
| 30740 | .nvptx = true, | |
| 30741 | }); | |
| 30742 | }; | |
| 30743 | ||
| 30744 | pub const __nvvm_rcp_rm_ftz_f = struct { | |
| 30745 | const param_str = "ff"; | |
| 30746 | const target_set = TargetSet.init(.{ | |
| 30747 | .nvptx = true, | |
| 30748 | }); | |
| 30749 | }; | |
| 30750 | ||
| 30751 | pub const __nvvm_rcp_rn_d = struct { | |
| 30752 | const param_str = "dd"; | |
| 30753 | const target_set = TargetSet.init(.{ | |
| 30754 | .nvptx = true, | |
| 30755 | }); | |
| 30756 | }; | |
| 30757 | ||
| 30758 | pub const __nvvm_rcp_rn_f = struct { | |
| 30759 | const param_str = "ff"; | |
| 30760 | const target_set = TargetSet.init(.{ | |
| 30761 | .nvptx = true, | |
| 30762 | }); | |
| 30763 | }; | |
| 30764 | ||
| 30765 | pub const __nvvm_rcp_rn_ftz_f = struct { | |
| 30766 | const param_str = "ff"; | |
| 30767 | const target_set = TargetSet.init(.{ | |
| 30768 | .nvptx = true, | |
| 30769 | }); | |
| 30770 | }; | |
| 30771 | ||
| 30772 | pub const __nvvm_rcp_rp_d = struct { | |
| 30773 | const param_str = "dd"; | |
| 30774 | const target_set = TargetSet.init(.{ | |
| 30775 | .nvptx = true, | |
| 30776 | }); | |
| 30777 | }; | |
| 30778 | ||
| 30779 | pub const __nvvm_rcp_rp_f = struct { | |
| 30780 | const param_str = "ff"; | |
| 30781 | const target_set = TargetSet.init(.{ | |
| 30782 | .nvptx = true, | |
| 30783 | }); | |
| 30784 | }; | |
| 30785 | ||
| 30786 | pub const __nvvm_rcp_rp_ftz_f = struct { | |
| 30787 | const param_str = "ff"; | |
| 30788 | const target_set = TargetSet.init(.{ | |
| 30789 | .nvptx = true, | |
| 30790 | }); | |
| 30791 | }; | |
| 30792 | ||
| 30793 | pub const __nvvm_rcp_rz_d = struct { | |
| 30794 | const param_str = "dd"; | |
| 30795 | const target_set = TargetSet.init(.{ | |
| 30796 | .nvptx = true, | |
| 30797 | }); | |
| 30798 | }; | |
| 30799 | ||
| 30800 | pub const __nvvm_rcp_rz_f = struct { | |
| 30801 | const param_str = "ff"; | |
| 30802 | const target_set = TargetSet.init(.{ | |
| 30803 | .nvptx = true, | |
| 30804 | }); | |
| 30805 | }; | |
| 30806 | ||
| 30807 | pub const __nvvm_rcp_rz_ftz_f = struct { | |
| 30808 | const param_str = "ff"; | |
| 30809 | const target_set = TargetSet.init(.{ | |
| 30810 | .nvptx = true, | |
| 30811 | }); | |
| 30812 | }; | |
| 30813 | ||
| 30814 | pub const __nvvm_read_ptx_sreg_clock = struct { | |
| 30815 | const param_str = "i"; | |
| 30816 | const target_set = TargetSet.init(.{ | |
| 30817 | .nvptx = true, | |
| 30818 | }); | |
| 30819 | const attributes = Attributes{}; | |
| 30820 | }; | |
| 30821 | ||
| 30822 | pub const __nvvm_read_ptx_sreg_clock64 = struct { | |
| 30823 | const param_str = "LLi"; | |
| 30824 | const target_set = TargetSet.init(.{ | |
| 30825 | .nvptx = true, | |
| 30826 | }); | |
| 30827 | const attributes = Attributes{}; | |
| 30828 | }; | |
| 30829 | ||
| 30830 | pub const __nvvm_read_ptx_sreg_ctaid_w = struct { | |
| 30831 | const param_str = "i"; | |
| 30832 | const target_set = TargetSet.init(.{ | |
| 30833 | .nvptx = true, | |
| 30834 | }); | |
| 30835 | const attributes = Attributes{ | |
| 30836 | .@"const" = true, | |
| 30837 | }; | |
| 30838 | }; | |
| 30839 | ||
| 30840 | pub const __nvvm_read_ptx_sreg_ctaid_x = struct { | |
| 30841 | const param_str = "i"; | |
| 30842 | const target_set = TargetSet.init(.{ | |
| 30843 | .nvptx = true, | |
| 30844 | }); | |
| 30845 | const attributes = Attributes{ | |
| 30846 | .@"const" = true, | |
| 30847 | }; | |
| 30848 | }; | |
| 30849 | ||
| 30850 | pub const __nvvm_read_ptx_sreg_ctaid_y = struct { | |
| 30851 | const param_str = "i"; | |
| 30852 | const target_set = TargetSet.init(.{ | |
| 30853 | .nvptx = true, | |
| 30854 | }); | |
| 30855 | const attributes = Attributes{ | |
| 30856 | .@"const" = true, | |
| 30857 | }; | |
| 30858 | }; | |
| 30859 | ||
| 30860 | pub const __nvvm_read_ptx_sreg_ctaid_z = struct { | |
| 30861 | const param_str = "i"; | |
| 30862 | const target_set = TargetSet.init(.{ | |
| 30863 | .nvptx = true, | |
| 30864 | }); | |
| 30865 | const attributes = Attributes{ | |
| 30866 | .@"const" = true, | |
| 30867 | }; | |
| 30868 | }; | |
| 30869 | ||
| 30870 | pub const __nvvm_read_ptx_sreg_gridid = struct { | |
| 30871 | const param_str = "i"; | |
| 30872 | const target_set = TargetSet.init(.{ | |
| 30873 | .nvptx = true, | |
| 30874 | }); | |
| 30875 | const attributes = Attributes{ | |
| 30876 | .@"const" = true, | |
| 30877 | }; | |
| 30878 | }; | |
| 30879 | ||
| 30880 | pub const __nvvm_read_ptx_sreg_laneid = struct { | |
| 30881 | const param_str = "i"; | |
| 30882 | const target_set = TargetSet.init(.{ | |
| 30883 | .nvptx = true, | |
| 30884 | }); | |
| 30885 | const attributes = Attributes{ | |
| 30886 | .@"const" = true, | |
| 30887 | }; | |
| 30888 | }; | |
| 30889 | ||
| 30890 | pub const __nvvm_read_ptx_sreg_lanemask_eq = struct { | |
| 30891 | const param_str = "i"; | |
| 30892 | const target_set = TargetSet.init(.{ | |
| 30893 | .nvptx = true, | |
| 30894 | }); | |
| 30895 | const attributes = Attributes{ | |
| 30896 | .@"const" = true, | |
| 30897 | }; | |
| 30898 | }; | |
| 30899 | ||
| 30900 | pub const __nvvm_read_ptx_sreg_lanemask_ge = struct { | |
| 30901 | const param_str = "i"; | |
| 30902 | const target_set = TargetSet.init(.{ | |
| 30903 | .nvptx = true, | |
| 30904 | }); | |
| 30905 | const attributes = Attributes{ | |
| 30906 | .@"const" = true, | |
| 30907 | }; | |
| 30908 | }; | |
| 30909 | ||
| 30910 | pub const __nvvm_read_ptx_sreg_lanemask_gt = struct { | |
| 30911 | const param_str = "i"; | |
| 30912 | const target_set = TargetSet.init(.{ | |
| 30913 | .nvptx = true, | |
| 30914 | }); | |
| 30915 | const attributes = Attributes{ | |
| 30916 | .@"const" = true, | |
| 30917 | }; | |
| 30918 | }; | |
| 30919 | ||
| 30920 | pub const __nvvm_read_ptx_sreg_lanemask_le = struct { | |
| 30921 | const param_str = "i"; | |
| 30922 | const target_set = TargetSet.init(.{ | |
| 30923 | .nvptx = true, | |
| 30924 | }); | |
| 30925 | const attributes = Attributes{ | |
| 30926 | .@"const" = true, | |
| 30927 | }; | |
| 30928 | }; | |
| 30929 | ||
| 30930 | pub const __nvvm_read_ptx_sreg_lanemask_lt = struct { | |
| 30931 | const param_str = "i"; | |
| 30932 | const target_set = TargetSet.init(.{ | |
| 30933 | .nvptx = true, | |
| 30934 | }); | |
| 30935 | const attributes = Attributes{ | |
| 30936 | .@"const" = true, | |
| 30937 | }; | |
| 30938 | }; | |
| 30939 | ||
| 30940 | pub const __nvvm_read_ptx_sreg_nctaid_w = struct { | |
| 30941 | const param_str = "i"; | |
| 30942 | const target_set = TargetSet.init(.{ | |
| 30943 | .nvptx = true, | |
| 30944 | }); | |
| 30945 | const attributes = Attributes{ | |
| 30946 | .@"const" = true, | |
| 30947 | }; | |
| 30948 | }; | |
| 30949 | ||
| 30950 | pub const __nvvm_read_ptx_sreg_nctaid_x = struct { | |
| 30951 | const param_str = "i"; | |
| 30952 | const target_set = TargetSet.init(.{ | |
| 30953 | .nvptx = true, | |
| 30954 | }); | |
| 30955 | const attributes = Attributes{ | |
| 30956 | .@"const" = true, | |
| 30957 | }; | |
| 30958 | }; | |
| 30959 | ||
| 30960 | pub const __nvvm_read_ptx_sreg_nctaid_y = struct { | |
| 30961 | const param_str = "i"; | |
| 30962 | const target_set = TargetSet.init(.{ | |
| 30963 | .nvptx = true, | |
| 30964 | }); | |
| 30965 | const attributes = Attributes{ | |
| 30966 | .@"const" = true, | |
| 30967 | }; | |
| 30968 | }; | |
| 30969 | ||
| 30970 | pub const __nvvm_read_ptx_sreg_nctaid_z = struct { | |
| 30971 | const param_str = "i"; | |
| 30972 | const target_set = TargetSet.init(.{ | |
| 30973 | .nvptx = true, | |
| 30974 | }); | |
| 30975 | const attributes = Attributes{ | |
| 30976 | .@"const" = true, | |
| 30977 | }; | |
| 30978 | }; | |
| 30979 | ||
| 30980 | pub const __nvvm_read_ptx_sreg_nsmid = struct { | |
| 30981 | const param_str = "i"; | |
| 30982 | const target_set = TargetSet.init(.{ | |
| 30983 | .nvptx = true, | |
| 30984 | }); | |
| 30985 | const attributes = Attributes{ | |
| 30986 | .@"const" = true, | |
| 30987 | }; | |
| 30988 | }; | |
| 30989 | ||
| 30990 | pub const __nvvm_read_ptx_sreg_ntid_w = struct { | |
| 30991 | const param_str = "i"; | |
| 30992 | const target_set = TargetSet.init(.{ | |
| 30993 | .nvptx = true, | |
| 30994 | }); | |
| 30995 | const attributes = Attributes{ | |
| 30996 | .@"const" = true, | |
| 30997 | }; | |
| 30998 | }; | |
| 30999 | ||
| 31000 | pub const __nvvm_read_ptx_sreg_ntid_x = struct { | |
| 31001 | const param_str = "i"; | |
| 31002 | const target_set = TargetSet.init(.{ | |
| 31003 | .nvptx = true, | |
| 31004 | }); | |
| 31005 | const attributes = Attributes{ | |
| 31006 | .@"const" = true, | |
| 31007 | }; | |
| 31008 | }; | |
| 31009 | ||
| 31010 | pub const __nvvm_read_ptx_sreg_ntid_y = struct { | |
| 31011 | const param_str = "i"; | |
| 31012 | const target_set = TargetSet.init(.{ | |
| 31013 | .nvptx = true, | |
| 31014 | }); | |
| 31015 | const attributes = Attributes{ | |
| 31016 | .@"const" = true, | |
| 31017 | }; | |
| 31018 | }; | |
| 31019 | ||
| 31020 | pub const __nvvm_read_ptx_sreg_ntid_z = struct { | |
| 31021 | const param_str = "i"; | |
| 31022 | const target_set = TargetSet.init(.{ | |
| 31023 | .nvptx = true, | |
| 31024 | }); | |
| 31025 | const attributes = Attributes{ | |
| 31026 | .@"const" = true, | |
| 31027 | }; | |
| 31028 | }; | |
| 31029 | ||
| 31030 | pub const __nvvm_read_ptx_sreg_nwarpid = struct { | |
| 31031 | const param_str = "i"; | |
| 31032 | const target_set = TargetSet.init(.{ | |
| 31033 | .nvptx = true, | |
| 31034 | }); | |
| 31035 | const attributes = Attributes{ | |
| 31036 | .@"const" = true, | |
| 31037 | }; | |
| 31038 | }; | |
| 31039 | ||
| 31040 | pub const __nvvm_read_ptx_sreg_pm0 = struct { | |
| 31041 | const param_str = "i"; | |
| 31042 | const target_set = TargetSet.init(.{ | |
| 31043 | .nvptx = true, | |
| 31044 | }); | |
| 31045 | const attributes = Attributes{}; | |
| 31046 | }; | |
| 31047 | ||
| 31048 | pub const __nvvm_read_ptx_sreg_pm1 = struct { | |
| 31049 | const param_str = "i"; | |
| 31050 | const target_set = TargetSet.init(.{ | |
| 31051 | .nvptx = true, | |
| 31052 | }); | |
| 31053 | const attributes = Attributes{}; | |
| 31054 | }; | |
| 31055 | ||
| 31056 | pub const __nvvm_read_ptx_sreg_pm2 = struct { | |
| 31057 | const param_str = "i"; | |
| 31058 | const target_set = TargetSet.init(.{ | |
| 31059 | .nvptx = true, | |
| 31060 | }); | |
| 31061 | const attributes = Attributes{}; | |
| 31062 | }; | |
| 31063 | ||
| 31064 | pub const __nvvm_read_ptx_sreg_pm3 = struct { | |
| 31065 | const param_str = "i"; | |
| 31066 | const target_set = TargetSet.init(.{ | |
| 31067 | .nvptx = true, | |
| 31068 | }); | |
| 31069 | const attributes = Attributes{}; | |
| 31070 | }; | |
| 31071 | ||
| 31072 | pub const __nvvm_read_ptx_sreg_smid = struct { | |
| 31073 | const param_str = "i"; | |
| 31074 | const target_set = TargetSet.init(.{ | |
| 31075 | .nvptx = true, | |
| 31076 | }); | |
| 31077 | const attributes = Attributes{ | |
| 31078 | .@"const" = true, | |
| 31079 | }; | |
| 31080 | }; | |
| 31081 | ||
| 31082 | pub const __nvvm_read_ptx_sreg_tid_w = struct { | |
| 31083 | const param_str = "i"; | |
| 31084 | const target_set = TargetSet.init(.{ | |
| 31085 | .nvptx = true, | |
| 31086 | }); | |
| 31087 | const attributes = Attributes{ | |
| 31088 | .@"const" = true, | |
| 31089 | }; | |
| 31090 | }; | |
| 31091 | ||
| 31092 | pub const __nvvm_read_ptx_sreg_tid_x = struct { | |
| 31093 | const param_str = "i"; | |
| 31094 | const target_set = TargetSet.init(.{ | |
| 31095 | .nvptx = true, | |
| 31096 | }); | |
| 31097 | const attributes = Attributes{ | |
| 31098 | .@"const" = true, | |
| 31099 | }; | |
| 31100 | }; | |
| 31101 | ||
| 31102 | pub const __nvvm_read_ptx_sreg_tid_y = struct { | |
| 31103 | const param_str = "i"; | |
| 31104 | const target_set = TargetSet.init(.{ | |
| 31105 | .nvptx = true, | |
| 31106 | }); | |
| 31107 | const attributes = Attributes{ | |
| 31108 | .@"const" = true, | |
| 31109 | }; | |
| 31110 | }; | |
| 31111 | ||
| 31112 | pub const __nvvm_read_ptx_sreg_tid_z = struct { | |
| 31113 | const param_str = "i"; | |
| 31114 | const target_set = TargetSet.init(.{ | |
| 31115 | .nvptx = true, | |
| 31116 | }); | |
| 31117 | const attributes = Attributes{ | |
| 31118 | .@"const" = true, | |
| 31119 | }; | |
| 31120 | }; | |
| 31121 | ||
| 31122 | pub const __nvvm_read_ptx_sreg_warpid = struct { | |
| 31123 | const param_str = "i"; | |
| 31124 | const target_set = TargetSet.init(.{ | |
| 31125 | .nvptx = true, | |
| 31126 | }); | |
| 31127 | const attributes = Attributes{ | |
| 31128 | .@"const" = true, | |
| 31129 | }; | |
| 31130 | }; | |
| 31131 | ||
| 31132 | pub const __nvvm_round_d = struct { | |
| 31133 | const param_str = "dd"; | |
| 31134 | const target_set = TargetSet.init(.{ | |
| 31135 | .nvptx = true, | |
| 31136 | }); | |
| 31137 | }; | |
| 31138 | ||
| 31139 | pub const __nvvm_round_f = struct { | |
| 31140 | const param_str = "ff"; | |
| 31141 | const target_set = TargetSet.init(.{ | |
| 31142 | .nvptx = true, | |
| 31143 | }); | |
| 31144 | }; | |
| 31145 | ||
| 31146 | pub const __nvvm_round_ftz_f = struct { | |
| 31147 | const param_str = "ff"; | |
| 31148 | const target_set = TargetSet.init(.{ | |
| 31149 | .nvptx = true, | |
| 31150 | }); | |
| 31151 | }; | |
| 31152 | ||
| 31153 | pub const __nvvm_rsqrt_approx_d = struct { | |
| 31154 | const param_str = "dd"; | |
| 31155 | const target_set = TargetSet.init(.{ | |
| 31156 | .nvptx = true, | |
| 31157 | }); | |
| 31158 | }; | |
| 31159 | ||
| 31160 | pub const __nvvm_rsqrt_approx_f = struct { | |
| 31161 | const param_str = "ff"; | |
| 31162 | const target_set = TargetSet.init(.{ | |
| 31163 | .nvptx = true, | |
| 31164 | }); | |
| 31165 | }; | |
| 31166 | ||
| 31167 | pub const __nvvm_rsqrt_approx_ftz_f = struct { | |
| 31168 | const param_str = "ff"; | |
| 31169 | const target_set = TargetSet.init(.{ | |
| 31170 | .nvptx = true, | |
| 31171 | }); | |
| 31172 | }; | |
| 31173 | ||
| 31174 | pub const __nvvm_sad_i = struct { | |
| 31175 | const param_str = "iiii"; | |
| 31176 | const target_set = TargetSet.init(.{ | |
| 31177 | .nvptx = true, | |
| 31178 | }); | |
| 31179 | }; | |
| 31180 | ||
| 31181 | pub const __nvvm_sad_ui = struct { | |
| 31182 | const param_str = "UiUiUiUi"; | |
| 31183 | const target_set = TargetSet.init(.{ | |
| 31184 | .nvptx = true, | |
| 31185 | }); | |
| 31186 | }; | |
| 31187 | ||
| 31188 | pub const __nvvm_saturate_d = struct { | |
| 31189 | const param_str = "dd"; | |
| 31190 | const target_set = TargetSet.init(.{ | |
| 31191 | .nvptx = true, | |
| 31192 | }); | |
| 31193 | }; | |
| 31194 | ||
| 31195 | pub const __nvvm_saturate_f = struct { | |
| 31196 | const param_str = "ff"; | |
| 31197 | const target_set = TargetSet.init(.{ | |
| 31198 | .nvptx = true, | |
| 31199 | }); | |
| 31200 | }; | |
| 31201 | ||
| 31202 | pub const __nvvm_saturate_ftz_f = struct { | |
| 31203 | const param_str = "ff"; | |
| 31204 | const target_set = TargetSet.init(.{ | |
| 31205 | .nvptx = true, | |
| 31206 | }); | |
| 31207 | }; | |
| 31208 | ||
| 31209 | pub const __nvvm_shfl_bfly_f32 = struct { | |
| 31210 | const param_str = "ffii"; | |
| 31211 | const target_set = TargetSet.init(.{ | |
| 31212 | .nvptx = true, | |
| 31213 | }); | |
| 31214 | }; | |
| 31215 | ||
| 31216 | pub const __nvvm_shfl_bfly_i32 = struct { | |
| 31217 | const param_str = "iiii"; | |
| 31218 | const target_set = TargetSet.init(.{ | |
| 31219 | .nvptx = true, | |
| 31220 | }); | |
| 31221 | }; | |
| 31222 | ||
| 31223 | pub const __nvvm_shfl_down_f32 = struct { | |
| 31224 | const param_str = "ffii"; | |
| 31225 | const target_set = TargetSet.init(.{ | |
| 31226 | .nvptx = true, | |
| 31227 | }); | |
| 31228 | }; | |
| 31229 | ||
| 31230 | pub const __nvvm_shfl_down_i32 = struct { | |
| 31231 | const param_str = "iiii"; | |
| 31232 | const target_set = TargetSet.init(.{ | |
| 31233 | .nvptx = true, | |
| 31234 | }); | |
| 31235 | }; | |
| 31236 | ||
| 31237 | pub const __nvvm_shfl_idx_f32 = struct { | |
| 31238 | const param_str = "ffii"; | |
| 31239 | const target_set = TargetSet.init(.{ | |
| 31240 | .nvptx = true, | |
| 31241 | }); | |
| 31242 | }; | |
| 31243 | ||
| 31244 | pub const __nvvm_shfl_idx_i32 = struct { | |
| 31245 | const param_str = "iiii"; | |
| 31246 | const target_set = TargetSet.init(.{ | |
| 31247 | .nvptx = true, | |
| 31248 | }); | |
| 31249 | }; | |
| 31250 | ||
| 31251 | pub const __nvvm_shfl_up_f32 = struct { | |
| 31252 | const param_str = "ffii"; | |
| 31253 | const target_set = TargetSet.init(.{ | |
| 31254 | .nvptx = true, | |
| 31255 | }); | |
| 31256 | }; | |
| 31257 | ||
| 31258 | pub const __nvvm_shfl_up_i32 = struct { | |
| 31259 | const param_str = "iiii"; | |
| 31260 | const target_set = TargetSet.init(.{ | |
| 31261 | .nvptx = true, | |
| 31262 | }); | |
| 31263 | }; | |
| 31264 | ||
| 31265 | pub const __nvvm_sin_approx_f = struct { | |
| 31266 | const param_str = "ff"; | |
| 31267 | const target_set = TargetSet.init(.{ | |
| 31268 | .nvptx = true, | |
| 31269 | }); | |
| 31270 | }; | |
| 31271 | ||
| 31272 | pub const __nvvm_sin_approx_ftz_f = struct { | |
| 31273 | const param_str = "ff"; | |
| 31274 | const target_set = TargetSet.init(.{ | |
| 31275 | .nvptx = true, | |
| 31276 | }); | |
| 31277 | }; | |
| 31278 | ||
| 31279 | pub const __nvvm_sqrt_approx_f = struct { | |
| 31280 | const param_str = "ff"; | |
| 31281 | const target_set = TargetSet.init(.{ | |
| 31282 | .nvptx = true, | |
| 31283 | }); | |
| 31284 | }; | |
| 31285 | ||
| 31286 | pub const __nvvm_sqrt_approx_ftz_f = struct { | |
| 31287 | const param_str = "ff"; | |
| 31288 | const target_set = TargetSet.init(.{ | |
| 31289 | .nvptx = true, | |
| 31290 | }); | |
| 31291 | }; | |
| 31292 | ||
| 31293 | pub const __nvvm_sqrt_rm_d = struct { | |
| 31294 | const param_str = "dd"; | |
| 31295 | const target_set = TargetSet.init(.{ | |
| 31296 | .nvptx = true, | |
| 31297 | }); | |
| 31298 | }; | |
| 31299 | ||
| 31300 | pub const __nvvm_sqrt_rm_f = struct { | |
| 31301 | const param_str = "ff"; | |
| 31302 | const target_set = TargetSet.init(.{ | |
| 31303 | .nvptx = true, | |
| 31304 | }); | |
| 31305 | }; | |
| 31306 | ||
| 31307 | pub const __nvvm_sqrt_rm_ftz_f = struct { | |
| 31308 | const param_str = "ff"; | |
| 31309 | const target_set = TargetSet.init(.{ | |
| 31310 | .nvptx = true, | |
| 31311 | }); | |
| 31312 | }; | |
| 31313 | ||
| 31314 | pub const __nvvm_sqrt_rn_d = struct { | |
| 31315 | const param_str = "dd"; | |
| 31316 | const target_set = TargetSet.init(.{ | |
| 31317 | .nvptx = true, | |
| 31318 | }); | |
| 31319 | }; | |
| 31320 | ||
| 31321 | pub const __nvvm_sqrt_rn_f = struct { | |
| 31322 | const param_str = "ff"; | |
| 31323 | const target_set = TargetSet.init(.{ | |
| 31324 | .nvptx = true, | |
| 31325 | }); | |
| 31326 | }; | |
| 31327 | ||
| 31328 | pub const __nvvm_sqrt_rn_ftz_f = struct { | |
| 31329 | const param_str = "ff"; | |
| 31330 | const target_set = TargetSet.init(.{ | |
| 31331 | .nvptx = true, | |
| 31332 | }); | |
| 31333 | }; | |
| 31334 | ||
| 31335 | pub const __nvvm_sqrt_rp_d = struct { | |
| 31336 | const param_str = "dd"; | |
| 31337 | const target_set = TargetSet.init(.{ | |
| 31338 | .nvptx = true, | |
| 31339 | }); | |
| 31340 | }; | |
| 31341 | ||
| 31342 | pub const __nvvm_sqrt_rp_f = struct { | |
| 31343 | const param_str = "ff"; | |
| 31344 | const target_set = TargetSet.init(.{ | |
| 31345 | .nvptx = true, | |
| 31346 | }); | |
| 31347 | }; | |
| 31348 | ||
| 31349 | pub const __nvvm_sqrt_rp_ftz_f = struct { | |
| 31350 | const param_str = "ff"; | |
| 31351 | const target_set = TargetSet.init(.{ | |
| 31352 | .nvptx = true, | |
| 31353 | }); | |
| 31354 | }; | |
| 31355 | ||
| 31356 | pub const __nvvm_sqrt_rz_d = struct { | |
| 31357 | const param_str = "dd"; | |
| 31358 | const target_set = TargetSet.init(.{ | |
| 31359 | .nvptx = true, | |
| 31360 | }); | |
| 31361 | }; | |
| 31362 | ||
| 31363 | pub const __nvvm_sqrt_rz_f = struct { | |
| 31364 | const param_str = "ff"; | |
| 31365 | const target_set = TargetSet.init(.{ | |
| 31366 | .nvptx = true, | |
| 31367 | }); | |
| 31368 | }; | |
| 31369 | ||
| 31370 | pub const __nvvm_sqrt_rz_ftz_f = struct { | |
| 31371 | const param_str = "ff"; | |
| 31372 | const target_set = TargetSet.init(.{ | |
| 31373 | .nvptx = true, | |
| 31374 | }); | |
| 31375 | }; | |
| 31376 | ||
| 31377 | pub const __nvvm_trunc_d = struct { | |
| 31378 | const param_str = "dd"; | |
| 31379 | const target_set = TargetSet.init(.{ | |
| 31380 | .nvptx = true, | |
| 31381 | }); | |
| 31382 | }; | |
| 31383 | ||
| 31384 | pub const __nvvm_trunc_f = struct { | |
| 31385 | const param_str = "ff"; | |
| 31386 | const target_set = TargetSet.init(.{ | |
| 31387 | .nvptx = true, | |
| 31388 | }); | |
| 31389 | }; | |
| 31390 | ||
| 31391 | pub const __nvvm_trunc_ftz_f = struct { | |
| 31392 | const param_str = "ff"; | |
| 31393 | const target_set = TargetSet.init(.{ | |
| 31394 | .nvptx = true, | |
| 31395 | }); | |
| 31396 | }; | |
| 31397 | ||
| 31398 | pub const __nvvm_ui2d_rm = struct { | |
| 31399 | const param_str = "dUi"; | |
| 31400 | const target_set = TargetSet.init(.{ | |
| 31401 | .nvptx = true, | |
| 31402 | }); | |
| 31403 | }; | |
| 31404 | ||
| 31405 | pub const __nvvm_ui2d_rn = struct { | |
| 31406 | const param_str = "dUi"; | |
| 31407 | const target_set = TargetSet.init(.{ | |
| 31408 | .nvptx = true, | |
| 31409 | }); | |
| 31410 | }; | |
| 31411 | ||
| 31412 | pub const __nvvm_ui2d_rp = struct { | |
| 31413 | const param_str = "dUi"; | |
| 31414 | const target_set = TargetSet.init(.{ | |
| 31415 | .nvptx = true, | |
| 31416 | }); | |
| 31417 | }; | |
| 31418 | ||
| 31419 | pub const __nvvm_ui2d_rz = struct { | |
| 31420 | const param_str = "dUi"; | |
| 31421 | const target_set = TargetSet.init(.{ | |
| 31422 | .nvptx = true, | |
| 31423 | }); | |
| 31424 | }; | |
| 31425 | ||
| 31426 | pub const __nvvm_ui2f_rm = struct { | |
| 31427 | const param_str = "fUi"; | |
| 31428 | const target_set = TargetSet.init(.{ | |
| 31429 | .nvptx = true, | |
| 31430 | }); | |
| 31431 | }; | |
| 31432 | ||
| 31433 | pub const __nvvm_ui2f_rn = struct { | |
| 31434 | const param_str = "fUi"; | |
| 31435 | const target_set = TargetSet.init(.{ | |
| 31436 | .nvptx = true, | |
| 31437 | }); | |
| 31438 | }; | |
| 31439 | ||
| 31440 | pub const __nvvm_ui2f_rp = struct { | |
| 31441 | const param_str = "fUi"; | |
| 31442 | const target_set = TargetSet.init(.{ | |
| 31443 | .nvptx = true, | |
| 31444 | }); | |
| 31445 | }; | |
| 31446 | ||
| 31447 | pub const __nvvm_ui2f_rz = struct { | |
| 31448 | const param_str = "fUi"; | |
| 31449 | const target_set = TargetSet.init(.{ | |
| 31450 | .nvptx = true, | |
| 31451 | }); | |
| 31452 | }; | |
| 31453 | ||
| 31454 | pub const __nvvm_ull2d_rm = struct { | |
| 31455 | const param_str = "dULLi"; | |
| 31456 | const target_set = TargetSet.init(.{ | |
| 31457 | .nvptx = true, | |
| 31458 | }); | |
| 31459 | }; | |
| 31460 | ||
| 31461 | pub const __nvvm_ull2d_rn = struct { | |
| 31462 | const param_str = "dULLi"; | |
| 31463 | const target_set = TargetSet.init(.{ | |
| 31464 | .nvptx = true, | |
| 31465 | }); | |
| 31466 | }; | |
| 31467 | ||
| 31468 | pub const __nvvm_ull2d_rp = struct { | |
| 31469 | const param_str = "dULLi"; | |
| 31470 | const target_set = TargetSet.init(.{ | |
| 31471 | .nvptx = true, | |
| 31472 | }); | |
| 31473 | }; | |
| 31474 | ||
| 31475 | pub const __nvvm_ull2d_rz = struct { | |
| 31476 | const param_str = "dULLi"; | |
| 31477 | const target_set = TargetSet.init(.{ | |
| 31478 | .nvptx = true, | |
| 31479 | }); | |
| 31480 | }; | |
| 31481 | ||
| 31482 | pub const __nvvm_ull2f_rm = struct { | |
| 31483 | const param_str = "fULLi"; | |
| 31484 | const target_set = TargetSet.init(.{ | |
| 31485 | .nvptx = true, | |
| 31486 | }); | |
| 31487 | }; | |
| 31488 | ||
| 31489 | pub const __nvvm_ull2f_rn = struct { | |
| 31490 | const param_str = "fULLi"; | |
| 31491 | const target_set = TargetSet.init(.{ | |
| 31492 | .nvptx = true, | |
| 31493 | }); | |
| 31494 | }; | |
| 31495 | ||
| 31496 | pub const __nvvm_ull2f_rp = struct { | |
| 31497 | const param_str = "fULLi"; | |
| 31498 | const target_set = TargetSet.init(.{ | |
| 31499 | .nvptx = true, | |
| 31500 | }); | |
| 31501 | }; | |
| 31502 | ||
| 31503 | pub const __nvvm_ull2f_rz = struct { | |
| 31504 | const param_str = "fULLi"; | |
| 31505 | const target_set = TargetSet.init(.{ | |
| 31506 | .nvptx = true, | |
| 31507 | }); | |
| 31508 | }; | |
| 31509 | ||
| 31510 | pub const __nvvm_vote_all = struct { | |
| 31511 | const param_str = "bb"; | |
| 31512 | const target_set = TargetSet.init(.{ | |
| 31513 | .nvptx = true, | |
| 31514 | }); | |
| 31515 | }; | |
| 31516 | ||
| 31517 | pub const __nvvm_vote_any = struct { | |
| 31518 | const param_str = "bb"; | |
| 31519 | const target_set = TargetSet.init(.{ | |
| 31520 | .nvptx = true, | |
| 31521 | }); | |
| 31522 | }; | |
| 31523 | ||
| 31524 | pub const __nvvm_vote_ballot = struct { | |
| 31525 | const param_str = "Uib"; | |
| 31526 | const target_set = TargetSet.init(.{ | |
| 31527 | .nvptx = true, | |
| 31528 | }); | |
| 31529 | }; | |
| 31530 | ||
| 31531 | pub const __nvvm_vote_uni = struct { | |
| 31532 | const param_str = "bb"; | |
| 31533 | const target_set = TargetSet.init(.{ | |
| 31534 | .nvptx = true, | |
| 31535 | }); | |
| 31536 | }; | |
| 31537 | ||
| 31538 | pub const __popcnt = struct { | |
| 31539 | const param_str = "UiUi"; | |
| 31540 | const language = .all_ms_languages; | |
| 31541 | const attributes = Attributes{ | |
| 31542 | .@"const" = true, | |
| 31543 | }; | |
| 31544 | }; | |
| 31545 | ||
| 31546 | pub const __popcnt16 = struct { | |
| 31547 | const param_str = "UsUs"; | |
| 31548 | const language = .all_ms_languages; | |
| 31549 | const attributes = Attributes{ | |
| 31550 | .@"const" = true, | |
| 31551 | }; | |
| 31552 | }; | |
| 31553 | ||
| 31554 | pub const __popcnt64 = struct { | |
| 31555 | const param_str = "UWiUWi"; | |
| 31556 | const language = .all_ms_languages; | |
| 31557 | const attributes = Attributes{ | |
| 31558 | .@"const" = true, | |
| 31559 | }; | |
| 31560 | }; | |
| 31561 | ||
| 31562 | pub const __rdtsc = struct { | |
| 31563 | const param_str = "UOi"; | |
| 31564 | const target_set = TargetSet.init(.{ | |
| 31565 | .x86 = true, | |
| 31566 | }); | |
| 31567 | }; | |
| 31568 | ||
| 31569 | pub const __sev = struct { | |
| 31570 | const param_str = "v"; | |
| 31571 | const language = .all_ms_languages; | |
| 31572 | const target_set = TargetSet.init(.{ | |
| 31573 | .aarch64 = true, | |
| 31574 | .arm = true, | |
| 31575 | }); | |
| 31576 | }; | |
| 31577 | ||
| 31578 | pub const __sevl = struct { | |
| 31579 | const param_str = "v"; | |
| 31580 | const language = .all_ms_languages; | |
| 31581 | const target_set = TargetSet.init(.{ | |
| 31582 | .aarch64 = true, | |
| 31583 | .arm = true, | |
| 31584 | }); | |
| 31585 | }; | |
| 31586 | ||
| 31587 | pub const __sigsetjmp = struct { | |
| 31588 | const param_str = "iSJi"; | |
| 31589 | const header = .setjmp; | |
| 31590 | const attributes = Attributes{ | |
| 31591 | .allow_type_mismatch = true, | |
| 31592 | .lib_function_without_prefix = true, | |
| 31593 | .returns_twice = true, | |
| 31594 | }; | |
| 31595 | }; | |
| 31596 | ||
| 31597 | pub const __sinpi = struct { | |
| 31598 | const param_str = "dd"; | |
| 31599 | const header = .math; | |
| 31600 | const attributes = Attributes{ | |
| 31601 | .lib_function_without_prefix = true, | |
| 31602 | .const_without_errno_and_fp_exceptions = true, | |
| 31603 | }; | |
| 31604 | }; | |
| 31605 | ||
| 31606 | pub const __sinpif = struct { | |
| 31607 | const param_str = "ff"; | |
| 31608 | const header = .math; | |
| 31609 | const attributes = Attributes{ | |
| 31610 | .lib_function_without_prefix = true, | |
| 31611 | .const_without_errno_and_fp_exceptions = true, | |
| 31612 | }; | |
| 31613 | }; | |
| 31614 | ||
| 31615 | pub const __sync_add_and_fetch = struct { | |
| 31616 | const param_str = "v."; | |
| 31617 | const attributes = Attributes{ | |
| 31618 | .custom_typecheck = true, | |
| 31619 | }; | |
| 31620 | }; | |
| 31621 | ||
| 31622 | pub const __sync_add_and_fetch_1 = struct { | |
| 31623 | const param_str = "ccD*c."; | |
| 31624 | const attributes = Attributes{ | |
| 31625 | .custom_typecheck = true, | |
| 31626 | }; | |
| 31627 | }; | |
| 31628 | ||
| 31629 | pub const __sync_add_and_fetch_16 = struct { | |
| 31630 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31631 | const attributes = Attributes{ | |
| 31632 | .custom_typecheck = true, | |
| 31633 | }; | |
| 31634 | }; | |
| 31635 | ||
| 31636 | pub const __sync_add_and_fetch_2 = struct { | |
| 31637 | const param_str = "ssD*s."; | |
| 31638 | const attributes = Attributes{ | |
| 31639 | .custom_typecheck = true, | |
| 31640 | }; | |
| 31641 | }; | |
| 31642 | ||
| 31643 | pub const __sync_add_and_fetch_4 = struct { | |
| 31644 | const param_str = "iiD*i."; | |
| 31645 | const attributes = Attributes{ | |
| 31646 | .custom_typecheck = true, | |
| 31647 | }; | |
| 31648 | }; | |
| 31649 | ||
| 31650 | pub const __sync_add_and_fetch_8 = struct { | |
| 31651 | const param_str = "LLiLLiD*LLi."; | |
| 31652 | const attributes = Attributes{ | |
| 31653 | .custom_typecheck = true, | |
| 31654 | }; | |
| 31655 | }; | |
| 31656 | ||
| 31657 | pub const __sync_and_and_fetch = struct { | |
| 31658 | const param_str = "v."; | |
| 31659 | const attributes = Attributes{ | |
| 31660 | .custom_typecheck = true, | |
| 31661 | }; | |
| 31662 | }; | |
| 31663 | ||
| 31664 | pub const __sync_and_and_fetch_1 = struct { | |
| 31665 | const param_str = "ccD*c."; | |
| 31666 | const attributes = Attributes{ | |
| 31667 | .custom_typecheck = true, | |
| 31668 | }; | |
| 31669 | }; | |
| 31670 | ||
| 31671 | pub const __sync_and_and_fetch_16 = struct { | |
| 31672 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31673 | const attributes = Attributes{ | |
| 31674 | .custom_typecheck = true, | |
| 31675 | }; | |
| 31676 | }; | |
| 31677 | ||
| 31678 | pub const __sync_and_and_fetch_2 = struct { | |
| 31679 | const param_str = "ssD*s."; | |
| 31680 | const attributes = Attributes{ | |
| 31681 | .custom_typecheck = true, | |
| 31682 | }; | |
| 31683 | }; | |
| 31684 | ||
| 31685 | pub const __sync_and_and_fetch_4 = struct { | |
| 31686 | const param_str = "iiD*i."; | |
| 31687 | const attributes = Attributes{ | |
| 31688 | .custom_typecheck = true, | |
| 31689 | }; | |
| 31690 | }; | |
| 31691 | ||
| 31692 | pub const __sync_and_and_fetch_8 = struct { | |
| 31693 | const param_str = "LLiLLiD*LLi."; | |
| 31694 | const attributes = Attributes{ | |
| 31695 | .custom_typecheck = true, | |
| 31696 | }; | |
| 31697 | }; | |
| 31698 | ||
| 31699 | pub const __sync_bool_compare_and_swap = struct { | |
| 31700 | const param_str = "v."; | |
| 31701 | const attributes = Attributes{ | |
| 31702 | .custom_typecheck = true, | |
| 31703 | }; | |
| 31704 | }; | |
| 31705 | ||
| 31706 | pub const __sync_bool_compare_and_swap_1 = struct { | |
| 31707 | const param_str = "bcD*cc."; | |
| 31708 | const attributes = Attributes{ | |
| 31709 | .custom_typecheck = true, | |
| 31710 | }; | |
| 31711 | }; | |
| 31712 | ||
| 31713 | pub const __sync_bool_compare_and_swap_16 = struct { | |
| 31714 | const param_str = "bLLLiD*LLLiLLLi."; | |
| 31715 | const attributes = Attributes{ | |
| 31716 | .custom_typecheck = true, | |
| 31717 | }; | |
| 31718 | }; | |
| 31719 | ||
| 31720 | pub const __sync_bool_compare_and_swap_2 = struct { | |
| 31721 | const param_str = "bsD*ss."; | |
| 31722 | const attributes = Attributes{ | |
| 31723 | .custom_typecheck = true, | |
| 31724 | }; | |
| 31725 | }; | |
| 31726 | ||
| 31727 | pub const __sync_bool_compare_and_swap_4 = struct { | |
| 31728 | const param_str = "biD*ii."; | |
| 31729 | const attributes = Attributes{ | |
| 31730 | .custom_typecheck = true, | |
| 31731 | }; | |
| 31732 | }; | |
| 31733 | ||
| 31734 | pub const __sync_bool_compare_and_swap_8 = struct { | |
| 31735 | const param_str = "bLLiD*LLiLLi."; | |
| 31736 | const attributes = Attributes{ | |
| 31737 | .custom_typecheck = true, | |
| 31738 | }; | |
| 31739 | }; | |
| 31740 | ||
| 31741 | pub const __sync_fetch_and_add = struct { | |
| 31742 | const param_str = "v."; | |
| 31743 | const attributes = Attributes{ | |
| 31744 | .custom_typecheck = true, | |
| 31745 | }; | |
| 31746 | }; | |
| 31747 | ||
| 31748 | pub const __sync_fetch_and_add_1 = struct { | |
| 31749 | const param_str = "ccD*c."; | |
| 31750 | const attributes = Attributes{ | |
| 31751 | .custom_typecheck = true, | |
| 31752 | }; | |
| 31753 | }; | |
| 31754 | ||
| 31755 | pub const __sync_fetch_and_add_16 = struct { | |
| 31756 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31757 | const attributes = Attributes{ | |
| 31758 | .custom_typecheck = true, | |
| 31759 | }; | |
| 31760 | }; | |
| 31761 | ||
| 31762 | pub const __sync_fetch_and_add_2 = struct { | |
| 31763 | const param_str = "ssD*s."; | |
| 31764 | const attributes = Attributes{ | |
| 31765 | .custom_typecheck = true, | |
| 31766 | }; | |
| 31767 | }; | |
| 31768 | ||
| 31769 | pub const __sync_fetch_and_add_4 = struct { | |
| 31770 | const param_str = "iiD*i."; | |
| 31771 | const attributes = Attributes{ | |
| 31772 | .custom_typecheck = true, | |
| 31773 | }; | |
| 31774 | }; | |
| 31775 | ||
| 31776 | pub const __sync_fetch_and_add_8 = struct { | |
| 31777 | const param_str = "LLiLLiD*LLi."; | |
| 31778 | const attributes = Attributes{ | |
| 31779 | .custom_typecheck = true, | |
| 31780 | }; | |
| 31781 | }; | |
| 31782 | ||
| 31783 | pub const __sync_fetch_and_and = struct { | |
| 31784 | const param_str = "v."; | |
| 31785 | const attributes = Attributes{ | |
| 31786 | .custom_typecheck = true, | |
| 31787 | }; | |
| 31788 | }; | |
| 31789 | ||
| 31790 | pub const __sync_fetch_and_and_1 = struct { | |
| 31791 | const param_str = "ccD*c."; | |
| 31792 | const attributes = Attributes{ | |
| 31793 | .custom_typecheck = true, | |
| 31794 | }; | |
| 31795 | }; | |
| 31796 | ||
| 31797 | pub const __sync_fetch_and_and_16 = struct { | |
| 31798 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31799 | const attributes = Attributes{ | |
| 31800 | .custom_typecheck = true, | |
| 31801 | }; | |
| 31802 | }; | |
| 31803 | ||
| 31804 | pub const __sync_fetch_and_and_2 = struct { | |
| 31805 | const param_str = "ssD*s."; | |
| 31806 | const attributes = Attributes{ | |
| 31807 | .custom_typecheck = true, | |
| 31808 | }; | |
| 31809 | }; | |
| 31810 | ||
| 31811 | pub const __sync_fetch_and_and_4 = struct { | |
| 31812 | const param_str = "iiD*i."; | |
| 31813 | const attributes = Attributes{ | |
| 31814 | .custom_typecheck = true, | |
| 31815 | }; | |
| 31816 | }; | |
| 31817 | ||
| 31818 | pub const __sync_fetch_and_and_8 = struct { | |
| 31819 | const param_str = "LLiLLiD*LLi."; | |
| 31820 | const attributes = Attributes{ | |
| 31821 | .custom_typecheck = true, | |
| 31822 | }; | |
| 31823 | }; | |
| 31824 | ||
| 31825 | pub const __sync_fetch_and_max = struct { | |
| 31826 | const param_str = "iiD*i"; | |
| 31827 | const attributes = Attributes{}; | |
| 31828 | }; | |
| 31829 | ||
| 31830 | pub const __sync_fetch_and_min = struct { | |
| 31831 | const param_str = "iiD*i"; | |
| 31832 | const attributes = Attributes{}; | |
| 31833 | }; | |
| 31834 | ||
| 31835 | pub const __sync_fetch_and_nand = struct { | |
| 31836 | const param_str = "v."; | |
| 31837 | const attributes = Attributes{ | |
| 31838 | .custom_typecheck = true, | |
| 31839 | }; | |
| 31840 | }; | |
| 31841 | ||
| 31842 | pub const __sync_fetch_and_nand_1 = struct { | |
| 31843 | const param_str = "ccD*c."; | |
| 31844 | const attributes = Attributes{ | |
| 31845 | .custom_typecheck = true, | |
| 31846 | }; | |
| 31847 | }; | |
| 31848 | ||
| 31849 | pub const __sync_fetch_and_nand_16 = struct { | |
| 31850 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31851 | const attributes = Attributes{ | |
| 31852 | .custom_typecheck = true, | |
| 31853 | }; | |
| 31854 | }; | |
| 31855 | ||
| 31856 | pub const __sync_fetch_and_nand_2 = struct { | |
| 31857 | const param_str = "ssD*s."; | |
| 31858 | const attributes = Attributes{ | |
| 31859 | .custom_typecheck = true, | |
| 31860 | }; | |
| 31861 | }; | |
| 31862 | ||
| 31863 | pub const __sync_fetch_and_nand_4 = struct { | |
| 31864 | const param_str = "iiD*i."; | |
| 31865 | const attributes = Attributes{ | |
| 31866 | .custom_typecheck = true, | |
| 31867 | }; | |
| 31868 | }; | |
| 31869 | ||
| 31870 | pub const __sync_fetch_and_nand_8 = struct { | |
| 31871 | const param_str = "LLiLLiD*LLi."; | |
| 31872 | const attributes = Attributes{ | |
| 31873 | .custom_typecheck = true, | |
| 31874 | }; | |
| 31875 | }; | |
| 31876 | ||
| 31877 | pub const __sync_fetch_and_or = struct { | |
| 31878 | const param_str = "v."; | |
| 31879 | const attributes = Attributes{ | |
| 31880 | .custom_typecheck = true, | |
| 31881 | }; | |
| 31882 | }; | |
| 31883 | ||
| 31884 | pub const __sync_fetch_and_or_1 = struct { | |
| 31885 | const param_str = "ccD*c."; | |
| 31886 | const attributes = Attributes{ | |
| 31887 | .custom_typecheck = true, | |
| 31888 | }; | |
| 31889 | }; | |
| 31890 | ||
| 31891 | pub const __sync_fetch_and_or_16 = struct { | |
| 31892 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31893 | const attributes = Attributes{ | |
| 31894 | .custom_typecheck = true, | |
| 31895 | }; | |
| 31896 | }; | |
| 31897 | ||
| 31898 | pub const __sync_fetch_and_or_2 = struct { | |
| 31899 | const param_str = "ssD*s."; | |
| 31900 | const attributes = Attributes{ | |
| 31901 | .custom_typecheck = true, | |
| 31902 | }; | |
| 31903 | }; | |
| 31904 | ||
| 31905 | pub const __sync_fetch_and_or_4 = struct { | |
| 31906 | const param_str = "iiD*i."; | |
| 31907 | const attributes = Attributes{ | |
| 31908 | .custom_typecheck = true, | |
| 31909 | }; | |
| 31910 | }; | |
| 31911 | ||
| 31912 | pub const __sync_fetch_and_or_8 = struct { | |
| 31913 | const param_str = "LLiLLiD*LLi."; | |
| 31914 | const attributes = Attributes{ | |
| 31915 | .custom_typecheck = true, | |
| 31916 | }; | |
| 31917 | }; | |
| 31918 | ||
| 31919 | pub const __sync_fetch_and_sub = struct { | |
| 31920 | const param_str = "v."; | |
| 31921 | const attributes = Attributes{ | |
| 31922 | .custom_typecheck = true, | |
| 31923 | }; | |
| 31924 | }; | |
| 31925 | ||
| 31926 | pub const __sync_fetch_and_sub_1 = struct { | |
| 31927 | const param_str = "ccD*c."; | |
| 31928 | const attributes = Attributes{ | |
| 31929 | .custom_typecheck = true, | |
| 31930 | }; | |
| 31931 | }; | |
| 31932 | ||
| 31933 | pub const __sync_fetch_and_sub_16 = struct { | |
| 31934 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31935 | const attributes = Attributes{ | |
| 31936 | .custom_typecheck = true, | |
| 31937 | }; | |
| 31938 | }; | |
| 31939 | ||
| 31940 | pub const __sync_fetch_and_sub_2 = struct { | |
| 31941 | const param_str = "ssD*s."; | |
| 31942 | const attributes = Attributes{ | |
| 31943 | .custom_typecheck = true, | |
| 31944 | }; | |
| 31945 | }; | |
| 31946 | ||
| 31947 | pub const __sync_fetch_and_sub_4 = struct { | |
| 31948 | const param_str = "iiD*i."; | |
| 31949 | const attributes = Attributes{ | |
| 31950 | .custom_typecheck = true, | |
| 31951 | }; | |
| 31952 | }; | |
| 31953 | ||
| 31954 | pub const __sync_fetch_and_sub_8 = struct { | |
| 31955 | const param_str = "LLiLLiD*LLi."; | |
| 31956 | const attributes = Attributes{ | |
| 31957 | .custom_typecheck = true, | |
| 31958 | }; | |
| 31959 | }; | |
| 31960 | ||
| 31961 | pub const __sync_fetch_and_umax = struct { | |
| 31962 | const param_str = "UiUiD*Ui"; | |
| 31963 | const attributes = Attributes{}; | |
| 31964 | }; | |
| 31965 | ||
| 31966 | pub const __sync_fetch_and_umin = struct { | |
| 31967 | const param_str = "UiUiD*Ui"; | |
| 31968 | const attributes = Attributes{}; | |
| 31969 | }; | |
| 31970 | ||
| 31971 | pub const __sync_fetch_and_xor = struct { | |
| 31972 | const param_str = "v."; | |
| 31973 | const attributes = Attributes{ | |
| 31974 | .custom_typecheck = true, | |
| 31975 | }; | |
| 31976 | }; | |
| 31977 | ||
| 31978 | pub const __sync_fetch_and_xor_1 = struct { | |
| 31979 | const param_str = "ccD*c."; | |
| 31980 | const attributes = Attributes{ | |
| 31981 | .custom_typecheck = true, | |
| 31982 | }; | |
| 31983 | }; | |
| 31984 | ||
| 31985 | pub const __sync_fetch_and_xor_16 = struct { | |
| 31986 | const param_str = "LLLiLLLiD*LLLi."; | |
| 31987 | const attributes = Attributes{ | |
| 31988 | .custom_typecheck = true, | |
| 31989 | }; | |
| 31990 | }; | |
| 31991 | ||
| 31992 | pub const __sync_fetch_and_xor_2 = struct { | |
| 31993 | const param_str = "ssD*s."; | |
| 31994 | const attributes = Attributes{ | |
| 31995 | .custom_typecheck = true, | |
| 31996 | }; | |
| 31997 | }; | |
| 31998 | ||
| 31999 | pub const __sync_fetch_and_xor_4 = struct { | |
| 32000 | const param_str = "iiD*i."; | |
| 32001 | const attributes = Attributes{ | |
| 32002 | .custom_typecheck = true, | |
| 32003 | }; | |
| 32004 | }; | |
| 32005 | ||
| 32006 | pub const __sync_fetch_and_xor_8 = struct { | |
| 32007 | const param_str = "LLiLLiD*LLi."; | |
| 32008 | const attributes = Attributes{ | |
| 32009 | .custom_typecheck = true, | |
| 32010 | }; | |
| 32011 | }; | |
| 32012 | ||
| 32013 | pub const __sync_lock_release = struct { | |
| 32014 | const param_str = "v."; | |
| 32015 | const attributes = Attributes{ | |
| 32016 | .custom_typecheck = true, | |
| 32017 | }; | |
| 32018 | }; | |
| 32019 | ||
| 32020 | pub const __sync_lock_release_1 = struct { | |
| 32021 | const param_str = "vcD*."; | |
| 32022 | const attributes = Attributes{ | |
| 32023 | .custom_typecheck = true, | |
| 32024 | }; | |
| 32025 | }; | |
| 32026 | ||
| 32027 | pub const __sync_lock_release_16 = struct { | |
| 32028 | const param_str = "vLLLiD*."; | |
| 32029 | const attributes = Attributes{ | |
| 32030 | .custom_typecheck = true, | |
| 32031 | }; | |
| 32032 | }; | |
| 32033 | ||
| 32034 | pub const __sync_lock_release_2 = struct { | |
| 32035 | const param_str = "vsD*."; | |
| 32036 | const attributes = Attributes{ | |
| 32037 | .custom_typecheck = true, | |
| 32038 | }; | |
| 32039 | }; | |
| 32040 | ||
| 32041 | pub const __sync_lock_release_4 = struct { | |
| 32042 | const param_str = "viD*."; | |
| 32043 | const attributes = Attributes{ | |
| 32044 | .custom_typecheck = true, | |
| 32045 | }; | |
| 32046 | }; | |
| 32047 | ||
| 32048 | pub const __sync_lock_release_8 = struct { | |
| 32049 | const param_str = "vLLiD*."; | |
| 32050 | const attributes = Attributes{ | |
| 32051 | .custom_typecheck = true, | |
| 32052 | }; | |
| 32053 | }; | |
| 32054 | ||
| 32055 | pub const __sync_lock_test_and_set = struct { | |
| 32056 | const param_str = "v."; | |
| 32057 | const attributes = Attributes{ | |
| 32058 | .custom_typecheck = true, | |
| 32059 | }; | |
| 32060 | }; | |
| 32061 | ||
| 32062 | pub const __sync_lock_test_and_set_1 = struct { | |
| 32063 | const param_str = "ccD*c."; | |
| 32064 | const attributes = Attributes{ | |
| 32065 | .custom_typecheck = true, | |
| 32066 | }; | |
| 32067 | }; | |
| 32068 | ||
| 32069 | pub const __sync_lock_test_and_set_16 = struct { | |
| 32070 | const param_str = "LLLiLLLiD*LLLi."; | |
| 32071 | const attributes = Attributes{ | |
| 32072 | .custom_typecheck = true, | |
| 32073 | }; | |
| 32074 | }; | |
| 32075 | ||
| 32076 | pub const __sync_lock_test_and_set_2 = struct { | |
| 32077 | const param_str = "ssD*s."; | |
| 32078 | const attributes = Attributes{ | |
| 32079 | .custom_typecheck = true, | |
| 32080 | }; | |
| 32081 | }; | |
| 32082 | ||
| 32083 | pub const __sync_lock_test_and_set_4 = struct { | |
| 32084 | const param_str = "iiD*i."; | |
| 32085 | const attributes = Attributes{ | |
| 32086 | .custom_typecheck = true, | |
| 32087 | }; | |
| 32088 | }; | |
| 32089 | ||
| 32090 | pub const __sync_lock_test_and_set_8 = struct { | |
| 32091 | const param_str = "LLiLLiD*LLi."; | |
| 32092 | const attributes = Attributes{ | |
| 32093 | .custom_typecheck = true, | |
| 32094 | }; | |
| 32095 | }; | |
| 32096 | ||
| 32097 | pub const __sync_nand_and_fetch = struct { | |
| 32098 | const param_str = "v."; | |
| 32099 | const attributes = Attributes{ | |
| 32100 | .custom_typecheck = true, | |
| 32101 | }; | |
| 32102 | }; | |
| 32103 | ||
| 32104 | pub const __sync_nand_and_fetch_1 = struct { | |
| 32105 | const param_str = "ccD*c."; | |
| 32106 | const attributes = Attributes{ | |
| 32107 | .custom_typecheck = true, | |
| 32108 | }; | |
| 32109 | }; | |
| 32110 | ||
| 32111 | pub const __sync_nand_and_fetch_16 = struct { | |
| 32112 | const param_str = "LLLiLLLiD*LLLi."; | |
| 32113 | const attributes = Attributes{ | |
| 32114 | .custom_typecheck = true, | |
| 32115 | }; | |
| 32116 | }; | |
| 32117 | ||
| 32118 | pub const __sync_nand_and_fetch_2 = struct { | |
| 32119 | const param_str = "ssD*s."; | |
| 32120 | const attributes = Attributes{ | |
| 32121 | .custom_typecheck = true, | |
| 32122 | }; | |
| 32123 | }; | |
| 32124 | ||
| 32125 | pub const __sync_nand_and_fetch_4 = struct { | |
| 32126 | const param_str = "iiD*i."; | |
| 32127 | const attributes = Attributes{ | |
| 32128 | .custom_typecheck = true, | |
| 32129 | }; | |
| 32130 | }; | |
| 32131 | ||
| 32132 | pub const __sync_nand_and_fetch_8 = struct { | |
| 32133 | const param_str = "LLiLLiD*LLi."; | |
| 32134 | const attributes = Attributes{ | |
| 32135 | .custom_typecheck = true, | |
| 32136 | }; | |
| 32137 | }; | |
| 32138 | ||
| 32139 | pub const __sync_or_and_fetch = struct { | |
| 32140 | const param_str = "v."; | |
| 32141 | const attributes = Attributes{ | |
| 32142 | .custom_typecheck = true, | |
| 32143 | }; | |
| 32144 | }; | |
| 32145 | ||
| 32146 | pub const __sync_or_and_fetch_1 = struct { | |
| 32147 | const param_str = "ccD*c."; | |
| 32148 | const attributes = Attributes{ | |
| 32149 | .custom_typecheck = true, | |
| 32150 | }; | |
| 32151 | }; | |
| 32152 | ||
| 32153 | pub const __sync_or_and_fetch_16 = struct { | |
| 32154 | const param_str = "LLLiLLLiD*LLLi."; | |
| 32155 | const attributes = Attributes{ | |
| 32156 | .custom_typecheck = true, | |
| 32157 | }; | |
| 32158 | }; | |
| 32159 | ||
| 32160 | pub const __sync_or_and_fetch_2 = struct { | |
| 32161 | const param_str = "ssD*s."; | |
| 32162 | const attributes = Attributes{ | |
| 32163 | .custom_typecheck = true, | |
| 32164 | }; | |
| 32165 | }; | |
| 32166 | ||
| 32167 | pub const __sync_or_and_fetch_4 = struct { | |
| 32168 | const param_str = "iiD*i."; | |
| 32169 | const attributes = Attributes{ | |
| 32170 | .custom_typecheck = true, | |
| 32171 | }; | |
| 32172 | }; | |
| 32173 | ||
| 32174 | pub const __sync_or_and_fetch_8 = struct { | |
| 32175 | const param_str = "LLiLLiD*LLi."; | |
| 32176 | const attributes = Attributes{ | |
| 32177 | .custom_typecheck = true, | |
| 32178 | }; | |
| 32179 | }; | |
| 32180 | ||
| 32181 | pub const __sync_sub_and_fetch = struct { | |
| 32182 | const param_str = "v."; | |
| 32183 | const attributes = Attributes{ | |
| 32184 | .custom_typecheck = true, | |
| 32185 | }; | |
| 32186 | }; | |
| 32187 | ||
| 32188 | pub const __sync_sub_and_fetch_1 = struct { | |
| 32189 | const param_str = "ccD*c."; | |
| 32190 | const attributes = Attributes{ | |
| 32191 | .custom_typecheck = true, | |
| 32192 | }; | |
| 32193 | }; | |
| 32194 | ||
| 32195 | pub const __sync_sub_and_fetch_16 = struct { | |
| 32196 | const param_str = "LLLiLLLiD*LLLi."; | |
| 32197 | const attributes = Attributes{ | |
| 32198 | .custom_typecheck = true, | |
| 32199 | }; | |
| 32200 | }; | |
| 32201 | ||
| 32202 | pub const __sync_sub_and_fetch_2 = struct { | |
| 32203 | const param_str = "ssD*s."; | |
| 32204 | const attributes = Attributes{ | |
| 32205 | .custom_typecheck = true, | |
| 32206 | }; | |
| 32207 | }; | |
| 32208 | ||
| 32209 | pub const __sync_sub_and_fetch_4 = struct { | |
| 32210 | const param_str = "iiD*i."; | |
| 32211 | const attributes = Attributes{ | |
| 32212 | .custom_typecheck = true, | |
| 32213 | }; | |
| 32214 | }; | |
| 32215 | ||
| 32216 | pub const __sync_sub_and_fetch_8 = struct { | |
| 32217 | const param_str = "LLiLLiD*LLi."; | |
| 32218 | const attributes = Attributes{ | |
| 32219 | .custom_typecheck = true, | |
| 32220 | }; | |
| 32221 | }; | |
| 32222 | ||
| 32223 | pub const __sync_swap = struct { | |
| 32224 | const param_str = "v."; | |
| 32225 | const attributes = Attributes{ | |
| 32226 | .custom_typecheck = true, | |
| 32227 | }; | |
| 32228 | }; | |
| 32229 | ||
| 32230 | pub const __sync_swap_1 = struct { | |
| 32231 | const param_str = "ccD*c."; | |
| 32232 | const attributes = Attributes{ | |
| 32233 | .custom_typecheck = true, | |
| 32234 | }; | |
| 32235 | }; | |
| 32236 | ||
| 32237 | pub const __sync_swap_16 = struct { | |
| 32238 | const param_str = "LLLiLLLiD*LLLi."; | |
| 32239 | const attributes = Attributes{ | |
| 32240 | .custom_typecheck = true, | |
| 32241 | }; | |
| 32242 | }; | |
| 32243 | ||
| 32244 | pub const __sync_swap_2 = struct { | |
| 32245 | const param_str = "ssD*s."; | |
| 32246 | const attributes = Attributes{ | |
| 32247 | .custom_typecheck = true, | |
| 32248 | }; | |
| 32249 | }; | |
| 32250 | ||
| 32251 | pub const __sync_swap_4 = struct { | |
| 32252 | const param_str = "iiD*i."; | |
| 32253 | const attributes = Attributes{ | |
| 32254 | .custom_typecheck = true, | |
| 32255 | }; | |
| 32256 | }; | |
| 32257 | ||
| 32258 | pub const __sync_swap_8 = struct { | |
| 32259 | const param_str = "LLiLLiD*LLi."; | |
| 32260 | const attributes = Attributes{ | |
| 32261 | .custom_typecheck = true, | |
| 32262 | }; | |
| 32263 | }; | |
| 32264 | ||
| 32265 | pub const __sync_synchronize = struct { | |
| 32266 | const param_str = "v"; | |
| 32267 | const attributes = Attributes{}; | |
| 32268 | }; | |
| 32269 | ||
| 32270 | pub const __sync_val_compare_and_swap = struct { | |
| 32271 | const param_str = "v."; | |
| 32272 | const attributes = Attributes{ | |
| 32273 | .custom_typecheck = true, | |
| 32274 | }; | |
| 32275 | }; | |
| 32276 | ||
| 32277 | pub const __sync_val_compare_and_swap_1 = struct { | |
| 32278 | const param_str = "ccD*cc."; | |
| 32279 | const attributes = Attributes{ | |
| 32280 | .custom_typecheck = true, | |
| 32281 | }; | |
| 32282 | }; | |
| 32283 | ||
| 32284 | pub const __sync_val_compare_and_swap_16 = struct { | |
| 32285 | const param_str = "LLLiLLLiD*LLLiLLLi."; | |
| 32286 | const attributes = Attributes{ | |
| 32287 | .custom_typecheck = true, | |
| 32288 | }; | |
| 32289 | }; | |
| 32290 | ||
| 32291 | pub const __sync_val_compare_and_swap_2 = struct { | |
| 32292 | const param_str = "ssD*ss."; | |
| 32293 | const attributes = Attributes{ | |
| 32294 | .custom_typecheck = true, | |
| 32295 | }; | |
| 32296 | }; | |
| 32297 | ||
| 32298 | pub const __sync_val_compare_and_swap_4 = struct { | |
| 32299 | const param_str = "iiD*ii."; | |
| 32300 | const attributes = Attributes{ | |
| 32301 | .custom_typecheck = true, | |
| 32302 | }; | |
| 32303 | }; | |
| 32304 | ||
| 32305 | pub const __sync_val_compare_and_swap_8 = struct { | |
| 32306 | const param_str = "LLiLLiD*LLiLLi."; | |
| 32307 | const attributes = Attributes{ | |
| 32308 | .custom_typecheck = true, | |
| 32309 | }; | |
| 32310 | }; | |
| 32311 | ||
| 32312 | pub const __sync_xor_and_fetch = struct { | |
| 32313 | const param_str = "v."; | |
| 32314 | const attributes = Attributes{ | |
| 32315 | .custom_typecheck = true, | |
| 32316 | }; | |
| 32317 | }; | |
| 32318 | ||
| 32319 | pub const __sync_xor_and_fetch_1 = struct { | |
| 32320 | const param_str = "ccD*c."; | |
| 32321 | const attributes = Attributes{ | |
| 32322 | .custom_typecheck = true, | |
| 32323 | }; | |
| 32324 | }; | |
| 32325 | ||
| 32326 | pub const __sync_xor_and_fetch_16 = struct { | |
| 32327 | const param_str = "LLLiLLLiD*LLLi."; | |
| 32328 | const attributes = Attributes{ | |
| 32329 | .custom_typecheck = true, | |
| 32330 | }; | |
| 32331 | }; | |
| 32332 | ||
| 32333 | pub const __sync_xor_and_fetch_2 = struct { | |
| 32334 | const param_str = "ssD*s."; | |
| 32335 | const attributes = Attributes{ | |
| 32336 | .custom_typecheck = true, | |
| 32337 | }; | |
| 32338 | }; | |
| 32339 | ||
| 32340 | pub const __sync_xor_and_fetch_4 = struct { | |
| 32341 | const param_str = "iiD*i."; | |
| 32342 | const attributes = Attributes{ | |
| 32343 | .custom_typecheck = true, | |
| 32344 | }; | |
| 32345 | }; | |
| 32346 | ||
| 32347 | pub const __sync_xor_and_fetch_8 = struct { | |
| 32348 | const param_str = "LLiLLiD*LLi."; | |
| 32349 | const attributes = Attributes{ | |
| 32350 | .custom_typecheck = true, | |
| 32351 | }; | |
| 32352 | }; | |
| 32353 | ||
| 32354 | pub const __syncthreads = struct { | |
| 32355 | const param_str = "v"; | |
| 32356 | const target_set = TargetSet.init(.{ | |
| 32357 | .nvptx = true, | |
| 32358 | }); | |
| 32359 | }; | |
| 32360 | ||
| 32361 | pub const __tanpi = struct { | |
| 32362 | const param_str = "dd"; | |
| 32363 | const header = .math; | |
| 32364 | const attributes = Attributes{ | |
| 32365 | .lib_function_without_prefix = true, | |
| 32366 | .const_without_errno_and_fp_exceptions = true, | |
| 32367 | }; | |
| 32368 | }; | |
| 32369 | ||
| 32370 | pub const __tanpif = struct { | |
| 32371 | const param_str = "ff"; | |
| 32372 | const header = .math; | |
| 32373 | const attributes = Attributes{ | |
| 32374 | .lib_function_without_prefix = true, | |
| 32375 | .const_without_errno_and_fp_exceptions = true, | |
| 32376 | }; | |
| 32377 | }; | |
| 32378 | ||
| 32379 | pub const __va_start = struct { | |
| 32380 | const param_str = "vc**."; | |
| 32381 | const language = .all_ms_languages; | |
| 32382 | const attributes = Attributes{ | |
| 32383 | .custom_typecheck = true, | |
| 32384 | }; | |
| 32385 | }; | |
| 32386 | ||
| 32387 | pub const __warn_memset_zero_len = struct { | |
| 32388 | const param_str = "v"; | |
| 32389 | const attributes = Attributes{ | |
| 32390 | .pure = true, | |
| 32391 | }; | |
| 32392 | }; | |
| 32393 | ||
| 32394 | pub const __wfe = struct { | |
| 32395 | const param_str = "v"; | |
| 32396 | const language = .all_ms_languages; | |
| 32397 | const target_set = TargetSet.init(.{ | |
| 32398 | .aarch64 = true, | |
| 32399 | .arm = true, | |
| 32400 | }); | |
| 32401 | }; | |
| 32402 | ||
| 32403 | pub const __wfi = struct { | |
| 32404 | const param_str = "v"; | |
| 32405 | const language = .all_ms_languages; | |
| 32406 | const target_set = TargetSet.init(.{ | |
| 32407 | .aarch64 = true, | |
| 32408 | .arm = true, | |
| 32409 | }); | |
| 32410 | }; | |
| 32411 | ||
| 32412 | pub const __xray_customevent = struct { | |
| 32413 | const param_str = "vcC*z"; | |
| 32414 | }; | |
| 32415 | ||
| 32416 | pub const __xray_typedevent = struct { | |
| 32417 | const param_str = "vzcC*z"; | |
| 32418 | }; | |
| 32419 | ||
| 32420 | pub const __yield = struct { | |
| 32421 | const param_str = "v"; | |
| 32422 | const language = .all_ms_languages; | |
| 32423 | const target_set = TargetSet.init(.{ | |
| 32424 | .aarch64 = true, | |
| 32425 | .arm = true, | |
| 32426 | }); | |
| 32427 | }; | |
| 32428 | ||
| 32429 | pub const _abnormal_termination = struct { | |
| 32430 | const param_str = "i"; | |
| 32431 | const language = .all_ms_languages; | |
| 32432 | const attributes = Attributes{}; | |
| 32433 | }; | |
| 32434 | ||
| 32435 | pub const _alloca = struct { | |
| 32436 | const param_str = "v*z"; | |
| 32437 | const language = .all_ms_languages; | |
| 32438 | const attributes = Attributes{}; | |
| 32439 | }; | |
| 32440 | ||
| 32441 | pub const _bittest = struct { | |
| 32442 | const param_str = "UcNiC*Ni"; | |
| 32443 | const language = .all_ms_languages; | |
| 32444 | const attributes = Attributes{}; | |
| 32445 | }; | |
| 32446 | ||
| 32447 | pub const _bittest64 = struct { | |
| 32448 | const param_str = "UcWiC*Wi"; | |
| 32449 | const language = .all_ms_languages; | |
| 32450 | const attributes = Attributes{}; | |
| 32451 | }; | |
| 32452 | ||
| 32453 | pub const _bittestandcomplement = struct { | |
| 32454 | const param_str = "UcNi*Ni"; | |
| 32455 | const language = .all_ms_languages; | |
| 32456 | const attributes = Attributes{}; | |
| 32457 | }; | |
| 32458 | ||
| 32459 | pub const _bittestandcomplement64 = struct { | |
| 32460 | const param_str = "UcWi*Wi"; | |
| 32461 | const language = .all_ms_languages; | |
| 32462 | const attributes = Attributes{}; | |
| 32463 | }; | |
| 32464 | ||
| 32465 | pub const _bittestandreset = struct { | |
| 32466 | const param_str = "UcNi*Ni"; | |
| 32467 | const language = .all_ms_languages; | |
| 32468 | const attributes = Attributes{}; | |
| 32469 | }; | |
| 32470 | ||
| 32471 | pub const _bittestandreset64 = struct { | |
| 32472 | const param_str = "UcWi*Wi"; | |
| 32473 | const language = .all_ms_languages; | |
| 32474 | const attributes = Attributes{}; | |
| 32475 | }; | |
| 32476 | ||
| 32477 | pub const _bittestandset = struct { | |
| 32478 | const param_str = "UcNi*Ni"; | |
| 32479 | const language = .all_ms_languages; | |
| 32480 | const attributes = Attributes{}; | |
| 32481 | }; | |
| 32482 | ||
| 32483 | pub const _bittestandset64 = struct { | |
| 32484 | const param_str = "UcWi*Wi"; | |
| 32485 | const language = .all_ms_languages; | |
| 32486 | const attributes = Attributes{}; | |
| 32487 | }; | |
| 32488 | ||
| 32489 | pub const _byteswap_uint64 = struct { | |
| 32490 | const param_str = "ULLiULLi"; | |
| 32491 | const language = .all_ms_languages; | |
| 32492 | const header = .stdlib; | |
| 32493 | const attributes = Attributes{ | |
| 32494 | .@"const" = true, | |
| 32495 | .lib_function_without_prefix = true, | |
| 32496 | }; | |
| 32497 | }; | |
| 32498 | ||
| 32499 | pub const _byteswap_ulong = struct { | |
| 32500 | const param_str = "UNiUNi"; | |
| 32501 | const language = .all_ms_languages; | |
| 32502 | const header = .stdlib; | |
| 32503 | const attributes = Attributes{ | |
| 32504 | .@"const" = true, | |
| 32505 | .lib_function_without_prefix = true, | |
| 32506 | }; | |
| 32507 | }; | |
| 32508 | ||
| 32509 | pub const _byteswap_ushort = struct { | |
| 32510 | const param_str = "UsUs"; | |
| 32511 | const language = .all_ms_languages; | |
| 32512 | const header = .stdlib; | |
| 32513 | const attributes = Attributes{ | |
| 32514 | .@"const" = true, | |
| 32515 | .lib_function_without_prefix = true, | |
| 32516 | }; | |
| 32517 | }; | |
| 32518 | ||
| 32519 | pub const _exception_code = struct { | |
| 32520 | const param_str = "UNi"; | |
| 32521 | const language = .all_ms_languages; | |
| 32522 | const attributes = Attributes{}; | |
| 32523 | }; | |
| 32524 | ||
| 32525 | pub const _exception_info = struct { | |
| 32526 | const param_str = "v*"; | |
| 32527 | const language = .all_ms_languages; | |
| 32528 | const attributes = Attributes{}; | |
| 32529 | }; | |
| 32530 | ||
| 32531 | pub const _exit = struct { | |
| 32532 | const param_str = "vi"; | |
| 32533 | const language = .all_gnu_languages; | |
| 32534 | const header = .unistd; | |
| 32535 | const attributes = Attributes{ | |
| 32536 | .noreturn = true, | |
| 32537 | .lib_function_without_prefix = true, | |
| 32538 | }; | |
| 32539 | }; | |
| 32540 | ||
| 32541 | pub const _interlockedbittestandreset = struct { | |
| 32542 | const param_str = "UcNiD*Ni"; | |
| 32543 | const language = .all_ms_languages; | |
| 32544 | const attributes = Attributes{}; | |
| 32545 | }; | |
| 32546 | ||
| 32547 | pub const _interlockedbittestandreset64 = struct { | |
| 32548 | const param_str = "UcWiD*Wi"; | |
| 32549 | const language = .all_ms_languages; | |
| 32550 | const attributes = Attributes{}; | |
| 32551 | }; | |
| 32552 | ||
| 32553 | pub const _interlockedbittestandreset_acq = struct { | |
| 32554 | const param_str = "UcNiD*Ni"; | |
| 32555 | const language = .all_ms_languages; | |
| 32556 | const attributes = Attributes{}; | |
| 32557 | }; | |
| 32558 | ||
| 32559 | pub const _interlockedbittestandreset_nf = struct { | |
| 32560 | const param_str = "UcNiD*Ni"; | |
| 32561 | const language = .all_ms_languages; | |
| 32562 | const attributes = Attributes{}; | |
| 32563 | }; | |
| 32564 | ||
| 32565 | pub const _interlockedbittestandreset_rel = struct { | |
| 32566 | const param_str = "UcNiD*Ni"; | |
| 32567 | const language = .all_ms_languages; | |
| 32568 | const attributes = Attributes{}; | |
| 32569 | }; | |
| 32570 | ||
| 32571 | pub const _interlockedbittestandset = struct { | |
| 32572 | const param_str = "UcNiD*Ni"; | |
| 32573 | const language = .all_ms_languages; | |
| 32574 | const attributes = Attributes{}; | |
| 32575 | }; | |
| 32576 | ||
| 32577 | pub const _interlockedbittestandset64 = struct { | |
| 32578 | const param_str = "UcWiD*Wi"; | |
| 32579 | const language = .all_ms_languages; | |
| 32580 | const attributes = Attributes{}; | |
| 32581 | }; | |
| 32582 | ||
| 32583 | pub const _interlockedbittestandset_acq = struct { | |
| 32584 | const param_str = "UcNiD*Ni"; | |
| 32585 | const language = .all_ms_languages; | |
| 32586 | const attributes = Attributes{}; | |
| 32587 | }; | |
| 32588 | ||
| 32589 | pub const _interlockedbittestandset_nf = struct { | |
| 32590 | const param_str = "UcNiD*Ni"; | |
| 32591 | const language = .all_ms_languages; | |
| 32592 | const attributes = Attributes{}; | |
| 32593 | }; | |
| 32594 | ||
| 32595 | pub const _interlockedbittestandset_rel = struct { | |
| 32596 | const param_str = "UcNiD*Ni"; | |
| 32597 | const language = .all_ms_languages; | |
| 32598 | const attributes = Attributes{}; | |
| 32599 | }; | |
| 32600 | ||
| 32601 | pub const _longjmp = struct { | |
| 32602 | const param_str = "vJi"; | |
| 32603 | const language = .all_gnu_languages; | |
| 32604 | const header = .setjmp; | |
| 32605 | const attributes = Attributes{ | |
| 32606 | .noreturn = true, | |
| 32607 | .allow_type_mismatch = true, | |
| 32608 | .lib_function_without_prefix = true, | |
| 32609 | }; | |
| 32610 | }; | |
| 32611 | ||
| 32612 | pub const _lrotl = struct { | |
| 32613 | const param_str = "ULiULii"; | |
| 32614 | const language = .all_ms_languages; | |
| 32615 | const attributes = Attributes{ | |
| 32616 | .const_evaluable = true, | |
| 32617 | }; | |
| 32618 | }; | |
| 32619 | ||
| 32620 | pub const _lrotr = struct { | |
| 32621 | const param_str = "ULiULii"; | |
| 32622 | const language = .all_ms_languages; | |
| 32623 | const attributes = Attributes{ | |
| 32624 | .const_evaluable = true, | |
| 32625 | }; | |
| 32626 | }; | |
| 32627 | ||
| 32628 | pub const _rotl = struct { | |
| 32629 | const param_str = "UiUii"; | |
| 32630 | const language = .all_ms_languages; | |
| 32631 | const attributes = Attributes{ | |
| 32632 | .const_evaluable = true, | |
| 32633 | }; | |
| 32634 | }; | |
| 32635 | ||
| 32636 | pub const _rotl16 = struct { | |
| 32637 | const param_str = "UsUsUc"; | |
| 32638 | const language = .all_ms_languages; | |
| 32639 | const attributes = Attributes{ | |
| 32640 | .const_evaluable = true, | |
| 32641 | }; | |
| 32642 | }; | |
| 32643 | ||
| 32644 | pub const _rotl64 = struct { | |
| 32645 | const param_str = "UWiUWii"; | |
| 32646 | const language = .all_ms_languages; | |
| 32647 | const attributes = Attributes{ | |
| 32648 | .const_evaluable = true, | |
| 32649 | }; | |
| 32650 | }; | |
| 32651 | ||
| 32652 | pub const _rotl8 = struct { | |
| 32653 | const param_str = "UcUcUc"; | |
| 32654 | const language = .all_ms_languages; | |
| 32655 | const attributes = Attributes{ | |
| 32656 | .const_evaluable = true, | |
| 32657 | }; | |
| 32658 | }; | |
| 32659 | ||
| 32660 | pub const _rotr = struct { | |
| 32661 | const param_str = "UiUii"; | |
| 32662 | const language = .all_ms_languages; | |
| 32663 | const attributes = Attributes{ | |
| 32664 | .const_evaluable = true, | |
| 32665 | }; | |
| 32666 | }; | |
| 32667 | ||
| 32668 | pub const _rotr16 = struct { | |
| 32669 | const param_str = "UsUsUc"; | |
| 32670 | const language = .all_ms_languages; | |
| 32671 | const attributes = Attributes{ | |
| 32672 | .const_evaluable = true, | |
| 32673 | }; | |
| 32674 | }; | |
| 32675 | ||
| 32676 | pub const _rotr64 = struct { | |
| 32677 | const param_str = "UWiUWii"; | |
| 32678 | const language = .all_ms_languages; | |
| 32679 | const attributes = Attributes{ | |
| 32680 | .const_evaluable = true, | |
| 32681 | }; | |
| 32682 | }; | |
| 32683 | ||
| 32684 | pub const _rotr8 = struct { | |
| 32685 | const param_str = "UcUcUc"; | |
| 32686 | const language = .all_ms_languages; | |
| 32687 | const attributes = Attributes{ | |
| 32688 | .const_evaluable = true, | |
| 32689 | }; | |
| 32690 | }; | |
| 32691 | ||
| 32692 | pub const _setjmp = struct { | |
| 32693 | const param_str = "iJ"; | |
| 32694 | const header = .setjmp; | |
| 32695 | const attributes = Attributes{ | |
| 32696 | .allow_type_mismatch = true, | |
| 32697 | .lib_function_without_prefix = true, | |
| 32698 | .returns_twice = true, | |
| 32699 | }; | |
| 32700 | }; | |
| 32701 | ||
| 32702 | pub const _setjmpex = struct { | |
| 32703 | const param_str = "iJ"; | |
| 32704 | const language = .all_ms_languages; | |
| 32705 | const header = .setjmpex; | |
| 32706 | const attributes = Attributes{ | |
| 32707 | .allow_type_mismatch = true, | |
| 32708 | .lib_function_without_prefix = true, | |
| 32709 | .returns_twice = true, | |
| 32710 | }; | |
| 32711 | }; | |
| 32712 | ||
| 32713 | pub const abort = struct { | |
| 32714 | const param_str = "v"; | |
| 32715 | const header = .stdlib; | |
| 32716 | const attributes = Attributes{ | |
| 32717 | .noreturn = true, | |
| 32718 | .lib_function_without_prefix = true, | |
| 32719 | }; | |
| 32720 | }; | |
| 32721 | ||
| 32722 | pub const abs = struct { | |
| 32723 | const param_str = "ii"; | |
| 32724 | const header = .stdlib; | |
| 32725 | const attributes = Attributes{ | |
| 32726 | .@"const" = true, | |
| 32727 | .lib_function_without_prefix = true, | |
| 32728 | }; | |
| 32729 | }; | |
| 32730 | ||
| 32731 | pub const acos = struct { | |
| 32732 | const param_str = "dd"; | |
| 32733 | const header = .math; | |
| 32734 | const attributes = Attributes{ | |
| 32735 | .lib_function_without_prefix = true, | |
| 32736 | .const_without_errno_and_fp_exceptions = true, | |
| 32737 | }; | |
| 32738 | }; | |
| 32739 | ||
| 32740 | pub const acosf = struct { | |
| 32741 | const param_str = "ff"; | |
| 32742 | const header = .math; | |
| 32743 | const attributes = Attributes{ | |
| 32744 | .lib_function_without_prefix = true, | |
| 32745 | .const_without_errno_and_fp_exceptions = true, | |
| 32746 | }; | |
| 32747 | }; | |
| 32748 | ||
| 32749 | pub const acosh = struct { | |
| 32750 | const param_str = "dd"; | |
| 32751 | const header = .math; | |
| 32752 | const attributes = Attributes{ | |
| 32753 | .lib_function_without_prefix = true, | |
| 32754 | .const_without_errno_and_fp_exceptions = true, | |
| 32755 | }; | |
| 32756 | }; | |
| 32757 | ||
| 32758 | pub const acoshf = struct { | |
| 32759 | const param_str = "ff"; | |
| 32760 | const header = .math; | |
| 32761 | const attributes = Attributes{ | |
| 32762 | .lib_function_without_prefix = true, | |
| 32763 | .const_without_errno_and_fp_exceptions = true, | |
| 32764 | }; | |
| 32765 | }; | |
| 32766 | ||
| 32767 | pub const acoshl = struct { | |
| 32768 | const param_str = "LdLd"; | |
| 32769 | const header = .math; | |
| 32770 | const attributes = Attributes{ | |
| 32771 | .lib_function_without_prefix = true, | |
| 32772 | .const_without_errno_and_fp_exceptions = true, | |
| 32773 | }; | |
| 32774 | }; | |
| 32775 | ||
| 32776 | pub const acosl = struct { | |
| 32777 | const param_str = "LdLd"; | |
| 32778 | const header = .math; | |
| 32779 | const attributes = Attributes{ | |
| 32780 | .lib_function_without_prefix = true, | |
| 32781 | .const_without_errno_and_fp_exceptions = true, | |
| 32782 | }; | |
| 32783 | }; | |
| 32784 | ||
| 32785 | pub const aligned_alloc = struct { | |
| 32786 | const param_str = "v*zz"; | |
| 32787 | const header = .stdlib; | |
| 32788 | const attributes = Attributes{ | |
| 32789 | .lib_function_without_prefix = true, | |
| 32790 | }; | |
| 32791 | }; | |
| 32792 | ||
| 32793 | pub const alloca = struct { | |
| 32794 | const param_str = "v*z"; | |
| 32795 | const language = .all_gnu_languages; | |
| 32796 | const header = .stdlib; | |
| 32797 | const attributes = Attributes{ | |
| 32798 | .lib_function_without_prefix = true, | |
| 32799 | }; | |
| 32800 | }; | |
| 32801 | ||
| 32802 | pub const asin = struct { | |
| 32803 | const param_str = "dd"; | |
| 32804 | const header = .math; | |
| 32805 | const attributes = Attributes{ | |
| 32806 | .lib_function_without_prefix = true, | |
| 32807 | .const_without_errno_and_fp_exceptions = true, | |
| 32808 | }; | |
| 32809 | }; | |
| 32810 | ||
| 32811 | pub const asinf = struct { | |
| 32812 | const param_str = "ff"; | |
| 32813 | const header = .math; | |
| 32814 | const attributes = Attributes{ | |
| 32815 | .lib_function_without_prefix = true, | |
| 32816 | .const_without_errno_and_fp_exceptions = true, | |
| 32817 | }; | |
| 32818 | }; | |
| 32819 | ||
| 32820 | pub const asinh = struct { | |
| 32821 | const param_str = "dd"; | |
| 32822 | const header = .math; | |
| 32823 | const attributes = Attributes{ | |
| 32824 | .lib_function_without_prefix = true, | |
| 32825 | .const_without_errno_and_fp_exceptions = true, | |
| 32826 | }; | |
| 32827 | }; | |
| 32828 | ||
| 32829 | pub const asinhf = struct { | |
| 32830 | const param_str = "ff"; | |
| 32831 | const header = .math; | |
| 32832 | const attributes = Attributes{ | |
| 32833 | .lib_function_without_prefix = true, | |
| 32834 | .const_without_errno_and_fp_exceptions = true, | |
| 32835 | }; | |
| 32836 | }; | |
| 32837 | ||
| 32838 | pub const asinhl = struct { | |
| 32839 | const param_str = "LdLd"; | |
| 32840 | const header = .math; | |
| 32841 | const attributes = Attributes{ | |
| 32842 | .lib_function_without_prefix = true, | |
| 32843 | .const_without_errno_and_fp_exceptions = true, | |
| 32844 | }; | |
| 32845 | }; | |
| 32846 | ||
| 32847 | pub const asinl = struct { | |
| 32848 | const param_str = "LdLd"; | |
| 32849 | const header = .math; | |
| 32850 | const attributes = Attributes{ | |
| 32851 | .lib_function_without_prefix = true, | |
| 32852 | .const_without_errno_and_fp_exceptions = true, | |
| 32853 | }; | |
| 32854 | }; | |
| 32855 | ||
| 32856 | pub const atan = struct { | |
| 32857 | const param_str = "dd"; | |
| 32858 | const header = .math; | |
| 32859 | const attributes = Attributes{ | |
| 32860 | .lib_function_without_prefix = true, | |
| 32861 | .const_without_errno_and_fp_exceptions = true, | |
| 32862 | }; | |
| 32863 | }; | |
| 32864 | ||
| 32865 | pub const atan2 = struct { | |
| 32866 | const param_str = "ddd"; | |
| 32867 | const header = .math; | |
| 32868 | const attributes = Attributes{ | |
| 32869 | .lib_function_without_prefix = true, | |
| 32870 | .const_without_errno_and_fp_exceptions = true, | |
| 32871 | }; | |
| 32872 | }; | |
| 32873 | ||
| 32874 | pub const atan2f = struct { | |
| 32875 | const param_str = "fff"; | |
| 32876 | const header = .math; | |
| 32877 | const attributes = Attributes{ | |
| 32878 | .lib_function_without_prefix = true, | |
| 32879 | .const_without_errno_and_fp_exceptions = true, | |
| 32880 | }; | |
| 32881 | }; | |
| 32882 | ||
| 32883 | pub const atan2l = struct { | |
| 32884 | const param_str = "LdLdLd"; | |
| 32885 | const header = .math; | |
| 32886 | const attributes = Attributes{ | |
| 32887 | .lib_function_without_prefix = true, | |
| 32888 | .const_without_errno_and_fp_exceptions = true, | |
| 32889 | }; | |
| 32890 | }; | |
| 32891 | ||
| 32892 | pub const atanf = struct { | |
| 32893 | const param_str = "ff"; | |
| 32894 | const header = .math; | |
| 32895 | const attributes = Attributes{ | |
| 32896 | .lib_function_without_prefix = true, | |
| 32897 | .const_without_errno_and_fp_exceptions = true, | |
| 32898 | }; | |
| 32899 | }; | |
| 32900 | ||
| 32901 | pub const atanh = struct { | |
| 32902 | const param_str = "dd"; | |
| 32903 | const header = .math; | |
| 32904 | const attributes = Attributes{ | |
| 32905 | .lib_function_without_prefix = true, | |
| 32906 | .const_without_errno_and_fp_exceptions = true, | |
| 32907 | }; | |
| 32908 | }; | |
| 32909 | ||
| 32910 | pub const atanhf = struct { | |
| 32911 | const param_str = "ff"; | |
| 32912 | const header = .math; | |
| 32913 | const attributes = Attributes{ | |
| 32914 | .lib_function_without_prefix = true, | |
| 32915 | .const_without_errno_and_fp_exceptions = true, | |
| 32916 | }; | |
| 32917 | }; | |
| 32918 | ||
| 32919 | pub const atanhl = struct { | |
| 32920 | const param_str = "LdLd"; | |
| 32921 | const header = .math; | |
| 32922 | const attributes = Attributes{ | |
| 32923 | .lib_function_without_prefix = true, | |
| 32924 | .const_without_errno_and_fp_exceptions = true, | |
| 32925 | }; | |
| 32926 | }; | |
| 32927 | ||
| 32928 | pub const atanl = struct { | |
| 32929 | const param_str = "LdLd"; | |
| 32930 | const header = .math; | |
| 32931 | const attributes = Attributes{ | |
| 32932 | .lib_function_without_prefix = true, | |
| 32933 | .const_without_errno_and_fp_exceptions = true, | |
| 32934 | }; | |
| 32935 | }; | |
| 32936 | ||
| 32937 | pub const bcmp = struct { | |
| 32938 | const param_str = "ivC*vC*z"; | |
| 32939 | const language = .all_gnu_languages; | |
| 32940 | const header = .strings; | |
| 32941 | const attributes = Attributes{ | |
| 32942 | .lib_function_without_prefix = true, | |
| 32943 | .const_evaluable = true, | |
| 32944 | }; | |
| 32945 | }; | |
| 32946 | ||
| 32947 | pub const bzero = struct { | |
| 32948 | const param_str = "vv*z"; | |
| 32949 | const language = .all_gnu_languages; | |
| 32950 | const header = .strings; | |
| 32951 | const attributes = Attributes{ | |
| 32952 | .lib_function_without_prefix = true, | |
| 32953 | }; | |
| 32954 | }; | |
| 32955 | ||
| 32956 | pub const cabs = struct { | |
| 32957 | const param_str = "dXd"; | |
| 32958 | const header = .complex; | |
| 32959 | const attributes = Attributes{ | |
| 32960 | .lib_function_without_prefix = true, | |
| 32961 | .const_without_errno_and_fp_exceptions = true, | |
| 32962 | }; | |
| 32963 | }; | |
| 32964 | ||
| 32965 | pub const cabsf = struct { | |
| 32966 | const param_str = "fXf"; | |
| 32967 | const header = .complex; | |
| 32968 | const attributes = Attributes{ | |
| 32969 | .lib_function_without_prefix = true, | |
| 32970 | .const_without_errno_and_fp_exceptions = true, | |
| 32971 | }; | |
| 32972 | }; | |
| 32973 | ||
| 32974 | pub const cabsl = struct { | |
| 32975 | const param_str = "LdXLd"; | |
| 32976 | const header = .complex; | |
| 32977 | const attributes = Attributes{ | |
| 32978 | .lib_function_without_prefix = true, | |
| 32979 | .const_without_errno_and_fp_exceptions = true, | |
| 32980 | }; | |
| 32981 | }; | |
| 32982 | ||
| 32983 | pub const cacos = struct { | |
| 32984 | const param_str = "XdXd"; | |
| 32985 | const header = .complex; | |
| 32986 | const attributes = Attributes{ | |
| 32987 | .lib_function_without_prefix = true, | |
| 32988 | .const_without_errno_and_fp_exceptions = true, | |
| 32989 | }; | |
| 32990 | }; | |
| 32991 | ||
| 32992 | pub const cacosf = struct { | |
| 32993 | const param_str = "XfXf"; | |
| 32994 | const header = .complex; | |
| 32995 | const attributes = Attributes{ | |
| 32996 | .lib_function_without_prefix = true, | |
| 32997 | .const_without_errno_and_fp_exceptions = true, | |
| 32998 | }; | |
| 32999 | }; | |
| 33000 | ||
| 33001 | pub const cacosh = struct { | |
| 33002 | const param_str = "XdXd"; | |
| 33003 | const header = .complex; | |
| 33004 | const attributes = Attributes{ | |
| 33005 | .lib_function_without_prefix = true, | |
| 33006 | .const_without_errno_and_fp_exceptions = true, | |
| 33007 | }; | |
| 33008 | }; | |
| 33009 | ||
| 33010 | pub const cacoshf = struct { | |
| 33011 | const param_str = "XfXf"; | |
| 33012 | const header = .complex; | |
| 33013 | const attributes = Attributes{ | |
| 33014 | .lib_function_without_prefix = true, | |
| 33015 | .const_without_errno_and_fp_exceptions = true, | |
| 33016 | }; | |
| 33017 | }; | |
| 33018 | ||
| 33019 | pub const cacoshl = struct { | |
| 33020 | const param_str = "XLdXLd"; | |
| 33021 | const header = .complex; | |
| 33022 | const attributes = Attributes{ | |
| 33023 | .lib_function_without_prefix = true, | |
| 33024 | .const_without_errno_and_fp_exceptions = true, | |
| 33025 | }; | |
| 33026 | }; | |
| 33027 | ||
| 33028 | pub const cacosl = struct { | |
| 33029 | const param_str = "XLdXLd"; | |
| 33030 | const header = .complex; | |
| 33031 | const attributes = Attributes{ | |
| 33032 | .lib_function_without_prefix = true, | |
| 33033 | .const_without_errno_and_fp_exceptions = true, | |
| 33034 | }; | |
| 33035 | }; | |
| 33036 | ||
| 33037 | pub const calloc = struct { | |
| 33038 | const param_str = "v*zz"; | |
| 33039 | const header = .stdlib; | |
| 33040 | const attributes = Attributes{ | |
| 33041 | .lib_function_without_prefix = true, | |
| 33042 | }; | |
| 33043 | }; | |
| 33044 | ||
| 33045 | pub const carg = struct { | |
| 33046 | const param_str = "dXd"; | |
| 33047 | const header = .complex; | |
| 33048 | const attributes = Attributes{ | |
| 33049 | .lib_function_without_prefix = true, | |
| 33050 | .const_without_errno_and_fp_exceptions = true, | |
| 33051 | }; | |
| 33052 | }; | |
| 33053 | ||
| 33054 | pub const cargf = struct { | |
| 33055 | const param_str = "fXf"; | |
| 33056 | const header = .complex; | |
| 33057 | const attributes = Attributes{ | |
| 33058 | .lib_function_without_prefix = true, | |
| 33059 | .const_without_errno_and_fp_exceptions = true, | |
| 33060 | }; | |
| 33061 | }; | |
| 33062 | ||
| 33063 | pub const cargl = struct { | |
| 33064 | const param_str = "LdXLd"; | |
| 33065 | const header = .complex; | |
| 33066 | const attributes = Attributes{ | |
| 33067 | .lib_function_without_prefix = true, | |
| 33068 | .const_without_errno_and_fp_exceptions = true, | |
| 33069 | }; | |
| 33070 | }; | |
| 33071 | ||
| 33072 | pub const casin = struct { | |
| 33073 | const param_str = "XdXd"; | |
| 33074 | const header = .complex; | |
| 33075 | const attributes = Attributes{ | |
| 33076 | .lib_function_without_prefix = true, | |
| 33077 | .const_without_errno_and_fp_exceptions = true, | |
| 33078 | }; | |
| 33079 | }; | |
| 33080 | ||
| 33081 | pub const casinf = struct { | |
| 33082 | const param_str = "XfXf"; | |
| 33083 | const header = .complex; | |
| 33084 | const attributes = Attributes{ | |
| 33085 | .lib_function_without_prefix = true, | |
| 33086 | .const_without_errno_and_fp_exceptions = true, | |
| 33087 | }; | |
| 33088 | }; | |
| 33089 | ||
| 33090 | pub const casinh = struct { | |
| 33091 | const param_str = "XdXd"; | |
| 33092 | const header = .complex; | |
| 33093 | const attributes = Attributes{ | |
| 33094 | .lib_function_without_prefix = true, | |
| 33095 | .const_without_errno_and_fp_exceptions = true, | |
| 33096 | }; | |
| 33097 | }; | |
| 33098 | ||
| 33099 | pub const casinhf = struct { | |
| 33100 | const param_str = "XfXf"; | |
| 33101 | const header = .complex; | |
| 33102 | const attributes = Attributes{ | |
| 33103 | .lib_function_without_prefix = true, | |
| 33104 | .const_without_errno_and_fp_exceptions = true, | |
| 33105 | }; | |
| 33106 | }; | |
| 33107 | ||
| 33108 | pub const casinhl = struct { | |
| 33109 | const param_str = "XLdXLd"; | |
| 33110 | const header = .complex; | |
| 33111 | const attributes = Attributes{ | |
| 33112 | .lib_function_without_prefix = true, | |
| 33113 | .const_without_errno_and_fp_exceptions = true, | |
| 33114 | }; | |
| 33115 | }; | |
| 33116 | ||
| 33117 | pub const casinl = struct { | |
| 33118 | const param_str = "XLdXLd"; | |
| 33119 | const header = .complex; | |
| 33120 | const attributes = Attributes{ | |
| 33121 | .lib_function_without_prefix = true, | |
| 33122 | .const_without_errno_and_fp_exceptions = true, | |
| 33123 | }; | |
| 33124 | }; | |
| 33125 | ||
| 33126 | pub const catan = struct { | |
| 33127 | const param_str = "XdXd"; | |
| 33128 | const header = .complex; | |
| 33129 | const attributes = Attributes{ | |
| 33130 | .lib_function_without_prefix = true, | |
| 33131 | .const_without_errno_and_fp_exceptions = true, | |
| 33132 | }; | |
| 33133 | }; | |
| 33134 | ||
| 33135 | pub const catanf = struct { | |
| 33136 | const param_str = "XfXf"; | |
| 33137 | const header = .complex; | |
| 33138 | const attributes = Attributes{ | |
| 33139 | .lib_function_without_prefix = true, | |
| 33140 | .const_without_errno_and_fp_exceptions = true, | |
| 33141 | }; | |
| 33142 | }; | |
| 33143 | ||
| 33144 | pub const catanh = struct { | |
| 33145 | const param_str = "XdXd"; | |
| 33146 | const header = .complex; | |
| 33147 | const attributes = Attributes{ | |
| 33148 | .lib_function_without_prefix = true, | |
| 33149 | .const_without_errno_and_fp_exceptions = true, | |
| 33150 | }; | |
| 33151 | }; | |
| 33152 | ||
| 33153 | pub const catanhf = struct { | |
| 33154 | const param_str = "XfXf"; | |
| 33155 | const header = .complex; | |
| 33156 | const attributes = Attributes{ | |
| 33157 | .lib_function_without_prefix = true, | |
| 33158 | .const_without_errno_and_fp_exceptions = true, | |
| 33159 | }; | |
| 33160 | }; | |
| 33161 | ||
| 33162 | pub const catanhl = struct { | |
| 33163 | const param_str = "XLdXLd"; | |
| 33164 | const header = .complex; | |
| 33165 | const attributes = Attributes{ | |
| 33166 | .lib_function_without_prefix = true, | |
| 33167 | .const_without_errno_and_fp_exceptions = true, | |
| 33168 | }; | |
| 33169 | }; | |
| 33170 | ||
| 33171 | pub const catanl = struct { | |
| 33172 | const param_str = "XLdXLd"; | |
| 33173 | const header = .complex; | |
| 33174 | const attributes = Attributes{ | |
| 33175 | .lib_function_without_prefix = true, | |
| 33176 | .const_without_errno_and_fp_exceptions = true, | |
| 33177 | }; | |
| 33178 | }; | |
| 33179 | ||
| 33180 | pub const cbrt = struct { | |
| 33181 | const param_str = "dd"; | |
| 33182 | const header = .math; | |
| 33183 | const attributes = Attributes{ | |
| 33184 | .@"const" = true, | |
| 33185 | .lib_function_without_prefix = true, | |
| 33186 | }; | |
| 33187 | }; | |
| 33188 | ||
| 33189 | pub const cbrtf = struct { | |
| 33190 | const param_str = "ff"; | |
| 33191 | const header = .math; | |
| 33192 | const attributes = Attributes{ | |
| 33193 | .@"const" = true, | |
| 33194 | .lib_function_without_prefix = true, | |
| 33195 | }; | |
| 33196 | }; | |
| 33197 | ||
| 33198 | pub const cbrtl = struct { | |
| 33199 | const param_str = "LdLd"; | |
| 33200 | const header = .math; | |
| 33201 | const attributes = Attributes{ | |
| 33202 | .@"const" = true, | |
| 33203 | .lib_function_without_prefix = true, | |
| 33204 | }; | |
| 33205 | }; | |
| 33206 | ||
| 33207 | pub const ccos = struct { | |
| 33208 | const param_str = "XdXd"; | |
| 33209 | const header = .complex; | |
| 33210 | const attributes = Attributes{ | |
| 33211 | .lib_function_without_prefix = true, | |
| 33212 | .const_without_errno_and_fp_exceptions = true, | |
| 33213 | }; | |
| 33214 | }; | |
| 33215 | ||
| 33216 | pub const ccosf = struct { | |
| 33217 | const param_str = "XfXf"; | |
| 33218 | const header = .complex; | |
| 33219 | const attributes = Attributes{ | |
| 33220 | .lib_function_without_prefix = true, | |
| 33221 | .const_without_errno_and_fp_exceptions = true, | |
| 33222 | }; | |
| 33223 | }; | |
| 33224 | ||
| 33225 | pub const ccosh = struct { | |
| 33226 | const param_str = "XdXd"; | |
| 33227 | const header = .complex; | |
| 33228 | const attributes = Attributes{ | |
| 33229 | .lib_function_without_prefix = true, | |
| 33230 | .const_without_errno_and_fp_exceptions = true, | |
| 33231 | }; | |
| 33232 | }; | |
| 33233 | ||
| 33234 | pub const ccoshf = struct { | |
| 33235 | const param_str = "XfXf"; | |
| 33236 | const header = .complex; | |
| 33237 | const attributes = Attributes{ | |
| 33238 | .lib_function_without_prefix = true, | |
| 33239 | .const_without_errno_and_fp_exceptions = true, | |
| 33240 | }; | |
| 33241 | }; | |
| 33242 | ||
| 33243 | pub const ccoshl = struct { | |
| 33244 | const param_str = "XLdXLd"; | |
| 33245 | const header = .complex; | |
| 33246 | const attributes = Attributes{ | |
| 33247 | .lib_function_without_prefix = true, | |
| 33248 | .const_without_errno_and_fp_exceptions = true, | |
| 33249 | }; | |
| 33250 | }; | |
| 33251 | ||
| 33252 | pub const ccosl = struct { | |
| 33253 | const param_str = "XLdXLd"; | |
| 33254 | const header = .complex; | |
| 33255 | const attributes = Attributes{ | |
| 33256 | .lib_function_without_prefix = true, | |
| 33257 | .const_without_errno_and_fp_exceptions = true, | |
| 33258 | }; | |
| 33259 | }; | |
| 33260 | ||
| 33261 | pub const ceil = struct { | |
| 33262 | const param_str = "dd"; | |
| 33263 | const header = .math; | |
| 33264 | const attributes = Attributes{ | |
| 33265 | .@"const" = true, | |
| 33266 | .lib_function_without_prefix = true, | |
| 33267 | }; | |
| 33268 | }; | |
| 33269 | ||
| 33270 | pub const ceilf = struct { | |
| 33271 | const param_str = "ff"; | |
| 33272 | const header = .math; | |
| 33273 | const attributes = Attributes{ | |
| 33274 | .@"const" = true, | |
| 33275 | .lib_function_without_prefix = true, | |
| 33276 | }; | |
| 33277 | }; | |
| 33278 | ||
| 33279 | pub const ceill = struct { | |
| 33280 | const param_str = "LdLd"; | |
| 33281 | const header = .math; | |
| 33282 | const attributes = Attributes{ | |
| 33283 | .@"const" = true, | |
| 33284 | .lib_function_without_prefix = true, | |
| 33285 | }; | |
| 33286 | }; | |
| 33287 | ||
| 33288 | pub const cexp = struct { | |
| 33289 | const param_str = "XdXd"; | |
| 33290 | const header = .complex; | |
| 33291 | const attributes = Attributes{ | |
| 33292 | .lib_function_without_prefix = true, | |
| 33293 | .const_without_errno_and_fp_exceptions = true, | |
| 33294 | }; | |
| 33295 | }; | |
| 33296 | ||
| 33297 | pub const cexpf = struct { | |
| 33298 | const param_str = "XfXf"; | |
| 33299 | const header = .complex; | |
| 33300 | const attributes = Attributes{ | |
| 33301 | .lib_function_without_prefix = true, | |
| 33302 | .const_without_errno_and_fp_exceptions = true, | |
| 33303 | }; | |
| 33304 | }; | |
| 33305 | ||
| 33306 | pub const cexpl = struct { | |
| 33307 | const param_str = "XLdXLd"; | |
| 33308 | const header = .complex; | |
| 33309 | const attributes = Attributes{ | |
| 33310 | .lib_function_without_prefix = true, | |
| 33311 | .const_without_errno_and_fp_exceptions = true, | |
| 33312 | }; | |
| 33313 | }; | |
| 33314 | ||
| 33315 | pub const cimag = struct { | |
| 33316 | const param_str = "dXd"; | |
| 33317 | const header = .complex; | |
| 33318 | const attributes = Attributes{ | |
| 33319 | .@"const" = true, | |
| 33320 | .lib_function_without_prefix = true, | |
| 33321 | }; | |
| 33322 | }; | |
| 33323 | ||
| 33324 | pub const cimagf = struct { | |
| 33325 | const param_str = "fXf"; | |
| 33326 | const header = .complex; | |
| 33327 | const attributes = Attributes{ | |
| 33328 | .@"const" = true, | |
| 33329 | .lib_function_without_prefix = true, | |
| 33330 | }; | |
| 33331 | }; | |
| 33332 | ||
| 33333 | pub const cimagl = struct { | |
| 33334 | const param_str = "LdXLd"; | |
| 33335 | const header = .complex; | |
| 33336 | const attributes = Attributes{ | |
| 33337 | .@"const" = true, | |
| 33338 | .lib_function_without_prefix = true, | |
| 33339 | }; | |
| 33340 | }; | |
| 33341 | ||
| 33342 | pub const clog = struct { | |
| 33343 | const param_str = "XdXd"; | |
| 33344 | const header = .complex; | |
| 33345 | const attributes = Attributes{ | |
| 33346 | .lib_function_without_prefix = true, | |
| 33347 | .const_without_errno_and_fp_exceptions = true, | |
| 33348 | }; | |
| 33349 | }; | |
| 33350 | ||
| 33351 | pub const clogf = struct { | |
| 33352 | const param_str = "XfXf"; | |
| 33353 | const header = .complex; | |
| 33354 | const attributes = Attributes{ | |
| 33355 | .lib_function_without_prefix = true, | |
| 33356 | .const_without_errno_and_fp_exceptions = true, | |
| 33357 | }; | |
| 33358 | }; | |
| 33359 | ||
| 33360 | pub const clogl = struct { | |
| 33361 | const param_str = "XLdXLd"; | |
| 33362 | const header = .complex; | |
| 33363 | const attributes = Attributes{ | |
| 33364 | .lib_function_without_prefix = true, | |
| 33365 | .const_without_errno_and_fp_exceptions = true, | |
| 33366 | }; | |
| 33367 | }; | |
| 33368 | ||
| 33369 | pub const conj = struct { | |
| 33370 | const param_str = "XdXd"; | |
| 33371 | const header = .complex; | |
| 33372 | const attributes = Attributes{ | |
| 33373 | .@"const" = true, | |
| 33374 | .lib_function_without_prefix = true, | |
| 33375 | }; | |
| 33376 | }; | |
| 33377 | ||
| 33378 | pub const conjf = struct { | |
| 33379 | const param_str = "XfXf"; | |
| 33380 | const header = .complex; | |
| 33381 | const attributes = Attributes{ | |
| 33382 | .@"const" = true, | |
| 33383 | .lib_function_without_prefix = true, | |
| 33384 | }; | |
| 33385 | }; | |
| 33386 | ||
| 33387 | pub const conjl = struct { | |
| 33388 | const param_str = "XLdXLd"; | |
| 33389 | const header = .complex; | |
| 33390 | const attributes = Attributes{ | |
| 33391 | .@"const" = true, | |
| 33392 | .lib_function_without_prefix = true, | |
| 33393 | }; | |
| 33394 | }; | |
| 33395 | ||
| 33396 | pub const copysign = struct { | |
| 33397 | const param_str = "ddd"; | |
| 33398 | const header = .math; | |
| 33399 | const attributes = Attributes{ | |
| 33400 | .@"const" = true, | |
| 33401 | .lib_function_without_prefix = true, | |
| 33402 | }; | |
| 33403 | }; | |
| 33404 | ||
| 33405 | pub const copysignf = struct { | |
| 33406 | const param_str = "fff"; | |
| 33407 | const header = .math; | |
| 33408 | const attributes = Attributes{ | |
| 33409 | .@"const" = true, | |
| 33410 | .lib_function_without_prefix = true, | |
| 33411 | }; | |
| 33412 | }; | |
| 33413 | ||
| 33414 | pub const copysignl = struct { | |
| 33415 | const param_str = "LdLdLd"; | |
| 33416 | const header = .math; | |
| 33417 | const attributes = Attributes{ | |
| 33418 | .@"const" = true, | |
| 33419 | .lib_function_without_prefix = true, | |
| 33420 | }; | |
| 33421 | }; | |
| 33422 | ||
| 33423 | pub const cos = struct { | |
| 33424 | const param_str = "dd"; | |
| 33425 | const header = .math; | |
| 33426 | const attributes = Attributes{ | |
| 33427 | .lib_function_without_prefix = true, | |
| 33428 | .const_without_errno_and_fp_exceptions = true, | |
| 33429 | }; | |
| 33430 | }; | |
| 33431 | ||
| 33432 | pub const cosf = struct { | |
| 33433 | const param_str = "ff"; | |
| 33434 | const header = .math; | |
| 33435 | const attributes = Attributes{ | |
| 33436 | .lib_function_without_prefix = true, | |
| 33437 | .const_without_errno_and_fp_exceptions = true, | |
| 33438 | }; | |
| 33439 | }; | |
| 33440 | ||
| 33441 | pub const cosh = struct { | |
| 33442 | const param_str = "dd"; | |
| 33443 | const header = .math; | |
| 33444 | const attributes = Attributes{ | |
| 33445 | .lib_function_without_prefix = true, | |
| 33446 | .const_without_errno_and_fp_exceptions = true, | |
| 33447 | }; | |
| 33448 | }; | |
| 33449 | ||
| 33450 | pub const coshf = struct { | |
| 33451 | const param_str = "ff"; | |
| 33452 | const header = .math; | |
| 33453 | const attributes = Attributes{ | |
| 33454 | .lib_function_without_prefix = true, | |
| 33455 | .const_without_errno_and_fp_exceptions = true, | |
| 33456 | }; | |
| 33457 | }; | |
| 33458 | ||
| 33459 | pub const coshl = struct { | |
| 33460 | const param_str = "LdLd"; | |
| 33461 | const header = .math; | |
| 33462 | const attributes = Attributes{ | |
| 33463 | .lib_function_without_prefix = true, | |
| 33464 | .const_without_errno_and_fp_exceptions = true, | |
| 33465 | }; | |
| 33466 | }; | |
| 33467 | ||
| 33468 | pub const cosl = struct { | |
| 33469 | const param_str = "LdLd"; | |
| 33470 | const header = .math; | |
| 33471 | const attributes = Attributes{ | |
| 33472 | .lib_function_without_prefix = true, | |
| 33473 | .const_without_errno_and_fp_exceptions = true, | |
| 33474 | }; | |
| 33475 | }; | |
| 33476 | ||
| 33477 | pub const cpow = struct { | |
| 33478 | const param_str = "XdXdXd"; | |
| 33479 | const header = .complex; | |
| 33480 | const attributes = Attributes{ | |
| 33481 | .lib_function_without_prefix = true, | |
| 33482 | .const_without_errno_and_fp_exceptions = true, | |
| 33483 | }; | |
| 33484 | }; | |
| 33485 | ||
| 33486 | pub const cpowf = struct { | |
| 33487 | const param_str = "XfXfXf"; | |
| 33488 | const header = .complex; | |
| 33489 | const attributes = Attributes{ | |
| 33490 | .lib_function_without_prefix = true, | |
| 33491 | .const_without_errno_and_fp_exceptions = true, | |
| 33492 | }; | |
| 33493 | }; | |
| 33494 | ||
| 33495 | pub const cpowl = struct { | |
| 33496 | const param_str = "XLdXLdXLd"; | |
| 33497 | const header = .complex; | |
| 33498 | const attributes = Attributes{ | |
| 33499 | .lib_function_without_prefix = true, | |
| 33500 | .const_without_errno_and_fp_exceptions = true, | |
| 33501 | }; | |
| 33502 | }; | |
| 33503 | ||
| 33504 | pub const cproj = struct { | |
| 33505 | const param_str = "XdXd"; | |
| 33506 | const header = .complex; | |
| 33507 | const attributes = Attributes{ | |
| 33508 | .@"const" = true, | |
| 33509 | .lib_function_without_prefix = true, | |
| 33510 | }; | |
| 33511 | }; | |
| 33512 | ||
| 33513 | pub const cprojf = struct { | |
| 33514 | const param_str = "XfXf"; | |
| 33515 | const header = .complex; | |
| 33516 | const attributes = Attributes{ | |
| 33517 | .@"const" = true, | |
| 33518 | .lib_function_without_prefix = true, | |
| 33519 | }; | |
| 33520 | }; | |
| 33521 | ||
| 33522 | pub const cprojl = struct { | |
| 33523 | const param_str = "XLdXLd"; | |
| 33524 | const header = .complex; | |
| 33525 | const attributes = Attributes{ | |
| 33526 | .@"const" = true, | |
| 33527 | .lib_function_without_prefix = true, | |
| 33528 | }; | |
| 33529 | }; | |
| 33530 | ||
| 33531 | pub const creal = struct { | |
| 33532 | const param_str = "dXd"; | |
| 33533 | const header = .complex; | |
| 33534 | const attributes = Attributes{ | |
| 33535 | .@"const" = true, | |
| 33536 | .lib_function_without_prefix = true, | |
| 33537 | }; | |
| 33538 | }; | |
| 33539 | ||
| 33540 | pub const crealf = struct { | |
| 33541 | const param_str = "fXf"; | |
| 33542 | const header = .complex; | |
| 33543 | const attributes = Attributes{ | |
| 33544 | .@"const" = true, | |
| 33545 | .lib_function_without_prefix = true, | |
| 33546 | }; | |
| 33547 | }; | |
| 33548 | ||
| 33549 | pub const creall = struct { | |
| 33550 | const param_str = "LdXLd"; | |
| 33551 | const header = .complex; | |
| 33552 | const attributes = Attributes{ | |
| 33553 | .@"const" = true, | |
| 33554 | .lib_function_without_prefix = true, | |
| 33555 | }; | |
| 33556 | }; | |
| 33557 | ||
| 33558 | pub const csin = struct { | |
| 33559 | const param_str = "XdXd"; | |
| 33560 | const header = .complex; | |
| 33561 | const attributes = Attributes{ | |
| 33562 | .lib_function_without_prefix = true, | |
| 33563 | .const_without_errno_and_fp_exceptions = true, | |
| 33564 | }; | |
| 33565 | }; | |
| 33566 | ||
| 33567 | pub const csinf = struct { | |
| 33568 | const param_str = "XfXf"; | |
| 33569 | const header = .complex; | |
| 33570 | const attributes = Attributes{ | |
| 33571 | .lib_function_without_prefix = true, | |
| 33572 | .const_without_errno_and_fp_exceptions = true, | |
| 33573 | }; | |
| 33574 | }; | |
| 33575 | ||
| 33576 | pub const csinh = struct { | |
| 33577 | const param_str = "XdXd"; | |
| 33578 | const header = .complex; | |
| 33579 | const attributes = Attributes{ | |
| 33580 | .lib_function_without_prefix = true, | |
| 33581 | .const_without_errno_and_fp_exceptions = true, | |
| 33582 | }; | |
| 33583 | }; | |
| 33584 | ||
| 33585 | pub const csinhf = struct { | |
| 33586 | const param_str = "XfXf"; | |
| 33587 | const header = .complex; | |
| 33588 | const attributes = Attributes{ | |
| 33589 | .lib_function_without_prefix = true, | |
| 33590 | .const_without_errno_and_fp_exceptions = true, | |
| 33591 | }; | |
| 33592 | }; | |
| 33593 | ||
| 33594 | pub const csinhl = struct { | |
| 33595 | const param_str = "XLdXLd"; | |
| 33596 | const header = .complex; | |
| 33597 | const attributes = Attributes{ | |
| 33598 | .lib_function_without_prefix = true, | |
| 33599 | .const_without_errno_and_fp_exceptions = true, | |
| 33600 | }; | |
| 33601 | }; | |
| 33602 | ||
| 33603 | pub const csinl = struct { | |
| 33604 | const param_str = "XLdXLd"; | |
| 33605 | const header = .complex; | |
| 33606 | const attributes = Attributes{ | |
| 33607 | .lib_function_without_prefix = true, | |
| 33608 | .const_without_errno_and_fp_exceptions = true, | |
| 33609 | }; | |
| 33610 | }; | |
| 33611 | ||
| 33612 | pub const csqrt = struct { | |
| 33613 | const param_str = "XdXd"; | |
| 33614 | const header = .complex; | |
| 33615 | const attributes = Attributes{ | |
| 33616 | .lib_function_without_prefix = true, | |
| 33617 | .const_without_errno_and_fp_exceptions = true, | |
| 33618 | }; | |
| 33619 | }; | |
| 33620 | ||
| 33621 | pub const csqrtf = struct { | |
| 33622 | const param_str = "XfXf"; | |
| 33623 | const header = .complex; | |
| 33624 | const attributes = Attributes{ | |
| 33625 | .lib_function_without_prefix = true, | |
| 33626 | .const_without_errno_and_fp_exceptions = true, | |
| 33627 | }; | |
| 33628 | }; | |
| 33629 | ||
| 33630 | pub const csqrtl = struct { | |
| 33631 | const param_str = "XLdXLd"; | |
| 33632 | const header = .complex; | |
| 33633 | const attributes = Attributes{ | |
| 33634 | .lib_function_without_prefix = true, | |
| 33635 | .const_without_errno_and_fp_exceptions = true, | |
| 33636 | }; | |
| 33637 | }; | |
| 33638 | ||
| 33639 | pub const ctan = struct { | |
| 33640 | const param_str = "XdXd"; | |
| 33641 | const header = .complex; | |
| 33642 | const attributes = Attributes{ | |
| 33643 | .lib_function_without_prefix = true, | |
| 33644 | .const_without_errno_and_fp_exceptions = true, | |
| 33645 | }; | |
| 33646 | }; | |
| 33647 | ||
| 33648 | pub const ctanf = struct { | |
| 33649 | const param_str = "XfXf"; | |
| 33650 | const header = .complex; | |
| 33651 | const attributes = Attributes{ | |
| 33652 | .lib_function_without_prefix = true, | |
| 33653 | .const_without_errno_and_fp_exceptions = true, | |
| 33654 | }; | |
| 33655 | }; | |
| 33656 | ||
| 33657 | pub const ctanh = struct { | |
| 33658 | const param_str = "XdXd"; | |
| 33659 | const header = .complex; | |
| 33660 | const attributes = Attributes{ | |
| 33661 | .lib_function_without_prefix = true, | |
| 33662 | .const_without_errno_and_fp_exceptions = true, | |
| 33663 | }; | |
| 33664 | }; | |
| 33665 | ||
| 33666 | pub const ctanhf = struct { | |
| 33667 | const param_str = "XfXf"; | |
| 33668 | const header = .complex; | |
| 33669 | const attributes = Attributes{ | |
| 33670 | .lib_function_without_prefix = true, | |
| 33671 | .const_without_errno_and_fp_exceptions = true, | |
| 33672 | }; | |
| 33673 | }; | |
| 33674 | ||
| 33675 | pub const ctanhl = struct { | |
| 33676 | const param_str = "XLdXLd"; | |
| 33677 | const header = .complex; | |
| 33678 | const attributes = Attributes{ | |
| 33679 | .lib_function_without_prefix = true, | |
| 33680 | .const_without_errno_and_fp_exceptions = true, | |
| 33681 | }; | |
| 33682 | }; | |
| 33683 | ||
| 33684 | pub const ctanl = struct { | |
| 33685 | const param_str = "XLdXLd"; | |
| 33686 | const header = .complex; | |
| 33687 | const attributes = Attributes{ | |
| 33688 | .lib_function_without_prefix = true, | |
| 33689 | .const_without_errno_and_fp_exceptions = true, | |
| 33690 | }; | |
| 33691 | }; | |
| 33692 | ||
| 33693 | pub const erf = struct { | |
| 33694 | const param_str = "dd"; | |
| 33695 | const header = .math; | |
| 33696 | const attributes = Attributes{ | |
| 33697 | .lib_function_without_prefix = true, | |
| 33698 | .const_without_errno_and_fp_exceptions = true, | |
| 33699 | }; | |
| 33700 | }; | |
| 33701 | ||
| 33702 | pub const erfc = struct { | |
| 33703 | const param_str = "dd"; | |
| 33704 | const header = .math; | |
| 33705 | const attributes = Attributes{ | |
| 33706 | .lib_function_without_prefix = true, | |
| 33707 | .const_without_errno_and_fp_exceptions = true, | |
| 33708 | }; | |
| 33709 | }; | |
| 33710 | ||
| 33711 | pub const erfcf = struct { | |
| 33712 | const param_str = "ff"; | |
| 33713 | const header = .math; | |
| 33714 | const attributes = Attributes{ | |
| 33715 | .lib_function_without_prefix = true, | |
| 33716 | .const_without_errno_and_fp_exceptions = true, | |
| 33717 | }; | |
| 33718 | }; | |
| 33719 | ||
| 33720 | pub const erfcl = struct { | |
| 33721 | const param_str = "LdLd"; | |
| 33722 | const header = .math; | |
| 33723 | const attributes = Attributes{ | |
| 33724 | .lib_function_without_prefix = true, | |
| 33725 | .const_without_errno_and_fp_exceptions = true, | |
| 33726 | }; | |
| 33727 | }; | |
| 33728 | ||
| 33729 | pub const erff = struct { | |
| 33730 | const param_str = "ff"; | |
| 33731 | const header = .math; | |
| 33732 | const attributes = Attributes{ | |
| 33733 | .lib_function_without_prefix = true, | |
| 33734 | .const_without_errno_and_fp_exceptions = true, | |
| 33735 | }; | |
| 33736 | }; | |
| 33737 | ||
| 33738 | pub const erfl = struct { | |
| 33739 | const param_str = "LdLd"; | |
| 33740 | const header = .math; | |
| 33741 | const attributes = Attributes{ | |
| 33742 | .lib_function_without_prefix = true, | |
| 33743 | .const_without_errno_and_fp_exceptions = true, | |
| 33744 | }; | |
| 33745 | }; | |
| 33746 | ||
| 33747 | pub const exit = struct { | |
| 33748 | const param_str = "vi"; | |
| 33749 | const header = .stdlib; | |
| 33750 | const attributes = Attributes{ | |
| 33751 | .noreturn = true, | |
| 33752 | .lib_function_without_prefix = true, | |
| 33753 | }; | |
| 33754 | }; | |
| 33755 | ||
| 33756 | pub const exp = struct { | |
| 33757 | const param_str = "dd"; | |
| 33758 | const header = .math; | |
| 33759 | const attributes = Attributes{ | |
| 33760 | .lib_function_without_prefix = true, | |
| 33761 | .const_without_errno_and_fp_exceptions = true, | |
| 33762 | }; | |
| 33763 | }; | |
| 33764 | ||
| 33765 | pub const exp2 = struct { | |
| 33766 | const param_str = "dd"; | |
| 33767 | const header = .math; | |
| 33768 | const attributes = Attributes{ | |
| 33769 | .lib_function_without_prefix = true, | |
| 33770 | .const_without_errno_and_fp_exceptions = true, | |
| 33771 | }; | |
| 33772 | }; | |
| 33773 | ||
| 33774 | pub const exp2f = struct { | |
| 33775 | const param_str = "ff"; | |
| 33776 | const header = .math; | |
| 33777 | const attributes = Attributes{ | |
| 33778 | .lib_function_without_prefix = true, | |
| 33779 | .const_without_errno_and_fp_exceptions = true, | |
| 33780 | }; | |
| 33781 | }; | |
| 33782 | ||
| 33783 | pub const exp2l = struct { | |
| 33784 | const param_str = "LdLd"; | |
| 33785 | const header = .math; | |
| 33786 | const attributes = Attributes{ | |
| 33787 | .lib_function_without_prefix = true, | |
| 33788 | .const_without_errno_and_fp_exceptions = true, | |
| 33789 | }; | |
| 33790 | }; | |
| 33791 | ||
| 33792 | pub const expf = struct { | |
| 33793 | const param_str = "ff"; | |
| 33794 | const header = .math; | |
| 33795 | const attributes = Attributes{ | |
| 33796 | .lib_function_without_prefix = true, | |
| 33797 | .const_without_errno_and_fp_exceptions = true, | |
| 33798 | }; | |
| 33799 | }; | |
| 33800 | ||
| 33801 | pub const expl = struct { | |
| 33802 | const param_str = "LdLd"; | |
| 33803 | const header = .math; | |
| 33804 | const attributes = Attributes{ | |
| 33805 | .lib_function_without_prefix = true, | |
| 33806 | .const_without_errno_and_fp_exceptions = true, | |
| 33807 | }; | |
| 33808 | }; | |
| 33809 | ||
| 33810 | pub const expm1 = struct { | |
| 33811 | const param_str = "dd"; | |
| 33812 | const header = .math; | |
| 33813 | const attributes = Attributes{ | |
| 33814 | .lib_function_without_prefix = true, | |
| 33815 | .const_without_errno_and_fp_exceptions = true, | |
| 33816 | }; | |
| 33817 | }; | |
| 33818 | ||
| 33819 | pub const expm1f = struct { | |
| 33820 | const param_str = "ff"; | |
| 33821 | const header = .math; | |
| 33822 | const attributes = Attributes{ | |
| 33823 | .lib_function_without_prefix = true, | |
| 33824 | .const_without_errno_and_fp_exceptions = true, | |
| 33825 | }; | |
| 33826 | }; | |
| 33827 | ||
| 33828 | pub const expm1l = struct { | |
| 33829 | const param_str = "LdLd"; | |
| 33830 | const header = .math; | |
| 33831 | const attributes = Attributes{ | |
| 33832 | .lib_function_without_prefix = true, | |
| 33833 | .const_without_errno_and_fp_exceptions = true, | |
| 33834 | }; | |
| 33835 | }; | |
| 33836 | ||
| 33837 | pub const fabs = struct { | |
| 33838 | const param_str = "dd"; | |
| 33839 | const header = .math; | |
| 33840 | const attributes = Attributes{ | |
| 33841 | .@"const" = true, | |
| 33842 | .lib_function_without_prefix = true, | |
| 33843 | }; | |
| 33844 | }; | |
| 33845 | ||
| 33846 | pub const fabsf = struct { | |
| 33847 | const param_str = "ff"; | |
| 33848 | const header = .math; | |
| 33849 | const attributes = Attributes{ | |
| 33850 | .@"const" = true, | |
| 33851 | .lib_function_without_prefix = true, | |
| 33852 | }; | |
| 33853 | }; | |
| 33854 | ||
| 33855 | pub const fabsl = struct { | |
| 33856 | const param_str = "LdLd"; | |
| 33857 | const header = .math; | |
| 33858 | const attributes = Attributes{ | |
| 33859 | .@"const" = true, | |
| 33860 | .lib_function_without_prefix = true, | |
| 33861 | }; | |
| 33862 | }; | |
| 33863 | ||
| 33864 | pub const fdim = struct { | |
| 33865 | const param_str = "ddd"; | |
| 33866 | const header = .math; | |
| 33867 | const attributes = Attributes{ | |
| 33868 | .lib_function_without_prefix = true, | |
| 33869 | .const_without_errno_and_fp_exceptions = true, | |
| 33870 | }; | |
| 33871 | }; | |
| 33872 | ||
| 33873 | pub const fdimf = struct { | |
| 33874 | const param_str = "fff"; | |
| 33875 | const header = .math; | |
| 33876 | const attributes = Attributes{ | |
| 33877 | .lib_function_without_prefix = true, | |
| 33878 | .const_without_errno_and_fp_exceptions = true, | |
| 33879 | }; | |
| 33880 | }; | |
| 33881 | ||
| 33882 | pub const fdiml = struct { | |
| 33883 | const param_str = "LdLdLd"; | |
| 33884 | const header = .math; | |
| 33885 | const attributes = Attributes{ | |
| 33886 | .lib_function_without_prefix = true, | |
| 33887 | .const_without_errno_and_fp_exceptions = true, | |
| 33888 | }; | |
| 33889 | }; | |
| 33890 | ||
| 33891 | pub const finite = struct { | |
| 33892 | const param_str = "id"; | |
| 33893 | const language = .gnu_lang; | |
| 33894 | const header = .math; | |
| 33895 | const attributes = Attributes{ | |
| 33896 | .@"const" = true, | |
| 33897 | .lib_function_without_prefix = true, | |
| 33898 | }; | |
| 33899 | }; | |
| 33900 | ||
| 33901 | pub const finitef = struct { | |
| 33902 | const param_str = "if"; | |
| 33903 | const language = .gnu_lang; | |
| 33904 | const header = .math; | |
| 33905 | const attributes = Attributes{ | |
| 33906 | .@"const" = true, | |
| 33907 | .lib_function_without_prefix = true, | |
| 33908 | }; | |
| 33909 | }; | |
| 33910 | ||
| 33911 | pub const finitel = struct { | |
| 33912 | const param_str = "iLd"; | |
| 33913 | const language = .gnu_lang; | |
| 33914 | const header = .math; | |
| 33915 | const attributes = Attributes{ | |
| 33916 | .@"const" = true, | |
| 33917 | .lib_function_without_prefix = true, | |
| 33918 | }; | |
| 33919 | }; | |
| 33920 | ||
| 33921 | pub const floor = struct { | |
| 33922 | const param_str = "dd"; | |
| 33923 | const header = .math; | |
| 33924 | const attributes = Attributes{ | |
| 33925 | .@"const" = true, | |
| 33926 | .lib_function_without_prefix = true, | |
| 33927 | }; | |
| 33928 | }; | |
| 33929 | ||
| 33930 | pub const floorf = struct { | |
| 33931 | const param_str = "ff"; | |
| 33932 | const header = .math; | |
| 33933 | const attributes = Attributes{ | |
| 33934 | .@"const" = true, | |
| 33935 | .lib_function_without_prefix = true, | |
| 33936 | }; | |
| 33937 | }; | |
| 33938 | ||
| 33939 | pub const floorl = struct { | |
| 33940 | const param_str = "LdLd"; | |
| 33941 | const header = .math; | |
| 33942 | const attributes = Attributes{ | |
| 33943 | .@"const" = true, | |
| 33944 | .lib_function_without_prefix = true, | |
| 33945 | }; | |
| 33946 | }; | |
| 33947 | ||
| 33948 | pub const fma = struct { | |
| 33949 | const param_str = "dddd"; | |
| 33950 | const header = .math; | |
| 33951 | const attributes = Attributes{ | |
| 33952 | .lib_function_without_prefix = true, | |
| 33953 | .const_without_errno_and_fp_exceptions = true, | |
| 33954 | }; | |
| 33955 | }; | |
| 33956 | ||
| 33957 | pub const fmaf = struct { | |
| 33958 | const param_str = "ffff"; | |
| 33959 | const header = .math; | |
| 33960 | const attributes = Attributes{ | |
| 33961 | .lib_function_without_prefix = true, | |
| 33962 | .const_without_errno_and_fp_exceptions = true, | |
| 33963 | }; | |
| 33964 | }; | |
| 33965 | ||
| 33966 | pub const fmal = struct { | |
| 33967 | const param_str = "LdLdLdLd"; | |
| 33968 | const header = .math; | |
| 33969 | const attributes = Attributes{ | |
| 33970 | .lib_function_without_prefix = true, | |
| 33971 | .const_without_errno_and_fp_exceptions = true, | |
| 33972 | }; | |
| 33973 | }; | |
| 33974 | ||
| 33975 | pub const fmax = struct { | |
| 33976 | const param_str = "ddd"; | |
| 33977 | const header = .math; | |
| 33978 | const attributes = Attributes{ | |
| 33979 | .@"const" = true, | |
| 33980 | .lib_function_without_prefix = true, | |
| 33981 | }; | |
| 33982 | }; | |
| 33983 | ||
| 33984 | pub const fmaxf = struct { | |
| 33985 | const param_str = "fff"; | |
| 33986 | const header = .math; | |
| 33987 | const attributes = Attributes{ | |
| 33988 | .@"const" = true, | |
| 33989 | .lib_function_without_prefix = true, | |
| 33990 | }; | |
| 33991 | }; | |
| 33992 | ||
| 33993 | pub const fmaxl = struct { | |
| 33994 | const param_str = "LdLdLd"; | |
| 33995 | const header = .math; | |
| 33996 | const attributes = Attributes{ | |
| 33997 | .@"const" = true, | |
| 33998 | .lib_function_without_prefix = true, | |
| 33999 | }; | |
| 34000 | }; | |
| 34001 | ||
| 34002 | pub const fmin = struct { | |
| 34003 | const param_str = "ddd"; | |
| 34004 | const header = .math; | |
| 34005 | const attributes = Attributes{ | |
| 34006 | .@"const" = true, | |
| 34007 | .lib_function_without_prefix = true, | |
| 34008 | }; | |
| 34009 | }; | |
| 34010 | ||
| 34011 | pub const fminf = struct { | |
| 34012 | const param_str = "fff"; | |
| 34013 | const header = .math; | |
| 34014 | const attributes = Attributes{ | |
| 34015 | .@"const" = true, | |
| 34016 | .lib_function_without_prefix = true, | |
| 34017 | }; | |
| 34018 | }; | |
| 34019 | ||
| 34020 | pub const fminl = struct { | |
| 34021 | const param_str = "LdLdLd"; | |
| 34022 | const header = .math; | |
| 34023 | const attributes = Attributes{ | |
| 34024 | .@"const" = true, | |
| 34025 | .lib_function_without_prefix = true, | |
| 34026 | }; | |
| 34027 | }; | |
| 34028 | ||
| 34029 | pub const fmod = struct { | |
| 34030 | const param_str = "ddd"; | |
| 34031 | const header = .math; | |
| 34032 | const attributes = Attributes{ | |
| 34033 | .lib_function_without_prefix = true, | |
| 34034 | .const_without_errno_and_fp_exceptions = true, | |
| 34035 | }; | |
| 34036 | }; | |
| 34037 | ||
| 34038 | pub const fmodf = struct { | |
| 34039 | const param_str = "fff"; | |
| 34040 | const header = .math; | |
| 34041 | const attributes = Attributes{ | |
| 34042 | .lib_function_without_prefix = true, | |
| 34043 | .const_without_errno_and_fp_exceptions = true, | |
| 34044 | }; | |
| 34045 | }; | |
| 34046 | ||
| 34047 | pub const fmodl = struct { | |
| 34048 | const param_str = "LdLdLd"; | |
| 34049 | const header = .math; | |
| 34050 | const attributes = Attributes{ | |
| 34051 | .lib_function_without_prefix = true, | |
| 34052 | .const_without_errno_and_fp_exceptions = true, | |
| 34053 | }; | |
| 34054 | }; | |
| 34055 | ||
| 34056 | pub const fopen = struct { | |
| 34057 | const param_str = "P*cC*cC*"; | |
| 34058 | const header = .stdio; | |
| 34059 | const attributes = Attributes{ | |
| 34060 | .lib_function_without_prefix = true, | |
| 34061 | }; | |
| 34062 | }; | |
| 34063 | ||
| 34064 | pub const fprintf = struct { | |
| 34065 | const param_str = "iP*cC*."; | |
| 34066 | const header = .stdio; | |
| 34067 | const attributes = Attributes{ | |
| 34068 | .lib_function_without_prefix = true, | |
| 34069 | .format_kind = .printf, | |
| 34070 | .format_string_position = 1, | |
| 34071 | }; | |
| 34072 | }; | |
| 34073 | ||
| 34074 | pub const fread = struct { | |
| 34075 | const param_str = "zv*zzP*"; | |
| 34076 | const header = .stdio; | |
| 34077 | const attributes = Attributes{ | |
| 34078 | .lib_function_without_prefix = true, | |
| 34079 | }; | |
| 34080 | }; | |
| 34081 | ||
| 34082 | pub const free = struct { | |
| 34083 | const param_str = "vv*"; | |
| 34084 | const header = .stdlib; | |
| 34085 | const attributes = Attributes{ | |
| 34086 | .lib_function_without_prefix = true, | |
| 34087 | }; | |
| 34088 | }; | |
| 34089 | ||
| 34090 | pub const frexp = struct { | |
| 34091 | const param_str = "ddi*"; | |
| 34092 | const header = .math; | |
| 34093 | const attributes = Attributes{ | |
| 34094 | .lib_function_without_prefix = true, | |
| 34095 | }; | |
| 34096 | }; | |
| 34097 | ||
| 34098 | pub const frexpf = struct { | |
| 34099 | const param_str = "ffi*"; | |
| 34100 | const header = .math; | |
| 34101 | const attributes = Attributes{ | |
| 34102 | .lib_function_without_prefix = true, | |
| 34103 | }; | |
| 34104 | }; | |
| 34105 | ||
| 34106 | pub const frexpl = struct { | |
| 34107 | const param_str = "LdLdi*"; | |
| 34108 | const header = .math; | |
| 34109 | const attributes = Attributes{ | |
| 34110 | .lib_function_without_prefix = true, | |
| 34111 | }; | |
| 34112 | }; | |
| 34113 | ||
| 34114 | pub const fscanf = struct { | |
| 34115 | const param_str = "iP*RcC*R."; | |
| 34116 | const header = .stdio; | |
| 34117 | const attributes = Attributes{ | |
| 34118 | .lib_function_without_prefix = true, | |
| 34119 | .format_kind = .scanf, | |
| 34120 | .format_string_position = 1, | |
| 34121 | }; | |
| 34122 | }; | |
| 34123 | ||
| 34124 | pub const fwrite = struct { | |
| 34125 | const param_str = "zvC*zzP*"; | |
| 34126 | const header = .stdio; | |
| 34127 | const attributes = Attributes{ | |
| 34128 | .lib_function_without_prefix = true, | |
| 34129 | }; | |
| 34130 | }; | |
| 34131 | ||
| 34132 | pub const getcontext = struct { | |
| 34133 | const param_str = "iK*"; | |
| 34134 | const header = .setjmp; | |
| 34135 | const attributes = Attributes{ | |
| 34136 | .allow_type_mismatch = true, | |
| 34137 | .lib_function_without_prefix = true, | |
| 34138 | .returns_twice = true, | |
| 34139 | }; | |
| 34140 | }; | |
| 34141 | ||
| 34142 | pub const hypot = struct { | |
| 34143 | const param_str = "ddd"; | |
| 34144 | const header = .math; | |
| 34145 | const attributes = Attributes{ | |
| 34146 | .lib_function_without_prefix = true, | |
| 34147 | .const_without_errno_and_fp_exceptions = true, | |
| 34148 | }; | |
| 34149 | }; | |
| 34150 | ||
| 34151 | pub const hypotf = struct { | |
| 34152 | const param_str = "fff"; | |
| 34153 | const header = .math; | |
| 34154 | const attributes = Attributes{ | |
| 34155 | .lib_function_without_prefix = true, | |
| 34156 | .const_without_errno_and_fp_exceptions = true, | |
| 34157 | }; | |
| 34158 | }; | |
| 34159 | ||
| 34160 | pub const hypotl = struct { | |
| 34161 | const param_str = "LdLdLd"; | |
| 34162 | const header = .math; | |
| 34163 | const attributes = Attributes{ | |
| 34164 | .lib_function_without_prefix = true, | |
| 34165 | .const_without_errno_and_fp_exceptions = true, | |
| 34166 | }; | |
| 34167 | }; | |
| 34168 | ||
| 34169 | pub const ilogb = struct { | |
| 34170 | const param_str = "id"; | |
| 34171 | const header = .math; | |
| 34172 | const attributes = Attributes{ | |
| 34173 | .lib_function_without_prefix = true, | |
| 34174 | .const_without_errno_and_fp_exceptions = true, | |
| 34175 | }; | |
| 34176 | }; | |
| 34177 | ||
| 34178 | pub const ilogbf = struct { | |
| 34179 | const param_str = "if"; | |
| 34180 | const header = .math; | |
| 34181 | const attributes = Attributes{ | |
| 34182 | .lib_function_without_prefix = true, | |
| 34183 | .const_without_errno_and_fp_exceptions = true, | |
| 34184 | }; | |
| 34185 | }; | |
| 34186 | ||
| 34187 | pub const ilogbl = struct { | |
| 34188 | const param_str = "iLd"; | |
| 34189 | const header = .math; | |
| 34190 | const attributes = Attributes{ | |
| 34191 | .lib_function_without_prefix = true, | |
| 34192 | .const_without_errno_and_fp_exceptions = true, | |
| 34193 | }; | |
| 34194 | }; | |
| 34195 | ||
| 34196 | pub const index = struct { | |
| 34197 | const param_str = "c*cC*i"; | |
| 34198 | const language = .all_gnu_languages; | |
| 34199 | const header = .strings; | |
| 34200 | const attributes = Attributes{ | |
| 34201 | .lib_function_without_prefix = true, | |
| 34202 | }; | |
| 34203 | }; | |
| 34204 | ||
| 34205 | pub const isalnum = struct { | |
| 34206 | const param_str = "ii"; | |
| 34207 | const header = .ctype; | |
| 34208 | const attributes = Attributes{ | |
| 34209 | .pure = true, | |
| 34210 | .lib_function_without_prefix = true, | |
| 34211 | }; | |
| 34212 | }; | |
| 34213 | ||
| 34214 | pub const isalpha = struct { | |
| 34215 | const param_str = "ii"; | |
| 34216 | const header = .ctype; | |
| 34217 | const attributes = Attributes{ | |
| 34218 | .pure = true, | |
| 34219 | .lib_function_without_prefix = true, | |
| 34220 | }; | |
| 34221 | }; | |
| 34222 | ||
| 34223 | pub const isblank = struct { | |
| 34224 | const param_str = "ii"; | |
| 34225 | const header = .ctype; | |
| 34226 | const attributes = Attributes{ | |
| 34227 | .pure = true, | |
| 34228 | .lib_function_without_prefix = true, | |
| 34229 | }; | |
| 34230 | }; | |
| 34231 | ||
| 34232 | pub const iscntrl = struct { | |
| 34233 | const param_str = "ii"; | |
| 34234 | const header = .ctype; | |
| 34235 | const attributes = Attributes{ | |
| 34236 | .pure = true, | |
| 34237 | .lib_function_without_prefix = true, | |
| 34238 | }; | |
| 34239 | }; | |
| 34240 | ||
| 34241 | pub const isdigit = struct { | |
| 34242 | const param_str = "ii"; | |
| 34243 | const header = .ctype; | |
| 34244 | const attributes = Attributes{ | |
| 34245 | .pure = true, | |
| 34246 | .lib_function_without_prefix = true, | |
| 34247 | }; | |
| 34248 | }; | |
| 34249 | ||
| 34250 | pub const isgraph = struct { | |
| 34251 | const param_str = "ii"; | |
| 34252 | const header = .ctype; | |
| 34253 | const attributes = Attributes{ | |
| 34254 | .pure = true, | |
| 34255 | .lib_function_without_prefix = true, | |
| 34256 | }; | |
| 34257 | }; | |
| 34258 | ||
| 34259 | pub const islower = struct { | |
| 34260 | const param_str = "ii"; | |
| 34261 | const header = .ctype; | |
| 34262 | const attributes = Attributes{ | |
| 34263 | .pure = true, | |
| 34264 | .lib_function_without_prefix = true, | |
| 34265 | }; | |
| 34266 | }; | |
| 34267 | ||
| 34268 | pub const isprint = struct { | |
| 34269 | const param_str = "ii"; | |
| 34270 | const header = .ctype; | |
| 34271 | const attributes = Attributes{ | |
| 34272 | .pure = true, | |
| 34273 | .lib_function_without_prefix = true, | |
| 34274 | }; | |
| 34275 | }; | |
| 34276 | ||
| 34277 | pub const ispunct = struct { | |
| 34278 | const param_str = "ii"; | |
| 34279 | const header = .ctype; | |
| 34280 | const attributes = Attributes{ | |
| 34281 | .pure = true, | |
| 34282 | .lib_function_without_prefix = true, | |
| 34283 | }; | |
| 34284 | }; | |
| 34285 | ||
| 34286 | pub const isspace = struct { | |
| 34287 | const param_str = "ii"; | |
| 34288 | const header = .ctype; | |
| 34289 | const attributes = Attributes{ | |
| 34290 | .pure = true, | |
| 34291 | .lib_function_without_prefix = true, | |
| 34292 | }; | |
| 34293 | }; | |
| 34294 | ||
| 34295 | pub const isupper = struct { | |
| 34296 | const param_str = "ii"; | |
| 34297 | const header = .ctype; | |
| 34298 | const attributes = Attributes{ | |
| 34299 | .pure = true, | |
| 34300 | .lib_function_without_prefix = true, | |
| 34301 | }; | |
| 34302 | }; | |
| 34303 | ||
| 34304 | pub const isxdigit = struct { | |
| 34305 | const param_str = "ii"; | |
| 34306 | const header = .ctype; | |
| 34307 | const attributes = Attributes{ | |
| 34308 | .pure = true, | |
| 34309 | .lib_function_without_prefix = true, | |
| 34310 | }; | |
| 34311 | }; | |
| 34312 | ||
| 34313 | pub const labs = struct { | |
| 34314 | const param_str = "LiLi"; | |
| 34315 | const header = .stdlib; | |
| 34316 | const attributes = Attributes{ | |
| 34317 | .@"const" = true, | |
| 34318 | .lib_function_without_prefix = true, | |
| 34319 | }; | |
| 34320 | }; | |
| 34321 | ||
| 34322 | pub const ldexp = struct { | |
| 34323 | const param_str = "ddi"; | |
| 34324 | const header = .math; | |
| 34325 | const attributes = Attributes{ | |
| 34326 | .lib_function_without_prefix = true, | |
| 34327 | .const_without_errno_and_fp_exceptions = true, | |
| 34328 | }; | |
| 34329 | }; | |
| 34330 | ||
| 34331 | pub const ldexpf = struct { | |
| 34332 | const param_str = "ffi"; | |
| 34333 | const header = .math; | |
| 34334 | const attributes = Attributes{ | |
| 34335 | .lib_function_without_prefix = true, | |
| 34336 | .const_without_errno_and_fp_exceptions = true, | |
| 34337 | }; | |
| 34338 | }; | |
| 34339 | ||
| 34340 | pub const ldexpl = struct { | |
| 34341 | const param_str = "LdLdi"; | |
| 34342 | const header = .math; | |
| 34343 | const attributes = Attributes{ | |
| 34344 | .lib_function_without_prefix = true, | |
| 34345 | .const_without_errno_and_fp_exceptions = true, | |
| 34346 | }; | |
| 34347 | }; | |
| 34348 | ||
| 34349 | pub const lgamma = struct { | |
| 34350 | const param_str = "dd"; | |
| 34351 | const header = .math; | |
| 34352 | const attributes = Attributes{ | |
| 34353 | .lib_function_without_prefix = true, | |
| 34354 | }; | |
| 34355 | }; | |
| 34356 | ||
| 34357 | pub const lgammaf = struct { | |
| 34358 | const param_str = "ff"; | |
| 34359 | const header = .math; | |
| 34360 | const attributes = Attributes{ | |
| 34361 | .lib_function_without_prefix = true, | |
| 34362 | }; | |
| 34363 | }; | |
| 34364 | ||
| 34365 | pub const lgammal = struct { | |
| 34366 | const param_str = "LdLd"; | |
| 34367 | const header = .math; | |
| 34368 | const attributes = Attributes{ | |
| 34369 | .lib_function_without_prefix = true, | |
| 34370 | }; | |
| 34371 | }; | |
| 34372 | ||
| 34373 | pub const llabs = struct { | |
| 34374 | const param_str = "LLiLLi"; | |
| 34375 | const header = .stdlib; | |
| 34376 | const attributes = Attributes{ | |
| 34377 | .@"const" = true, | |
| 34378 | .lib_function_without_prefix = true, | |
| 34379 | }; | |
| 34380 | }; | |
| 34381 | ||
| 34382 | pub const llrint = struct { | |
| 34383 | const param_str = "LLid"; | |
| 34384 | const header = .math; | |
| 34385 | const attributes = Attributes{ | |
| 34386 | .lib_function_without_prefix = true, | |
| 34387 | .const_without_errno_and_fp_exceptions = true, | |
| 34388 | }; | |
| 34389 | }; | |
| 34390 | ||
| 34391 | pub const llrintf = struct { | |
| 34392 | const param_str = "LLif"; | |
| 34393 | const header = .math; | |
| 34394 | const attributes = Attributes{ | |
| 34395 | .lib_function_without_prefix = true, | |
| 34396 | .const_without_errno_and_fp_exceptions = true, | |
| 34397 | }; | |
| 34398 | }; | |
| 34399 | ||
| 34400 | pub const llrintl = struct { | |
| 34401 | const param_str = "LLiLd"; | |
| 34402 | const header = .math; | |
| 34403 | const attributes = Attributes{ | |
| 34404 | .lib_function_without_prefix = true, | |
| 34405 | .const_without_errno_and_fp_exceptions = true, | |
| 34406 | }; | |
| 34407 | }; | |
| 34408 | ||
| 34409 | pub const llround = struct { | |
| 34410 | const param_str = "LLid"; | |
| 34411 | const header = .math; | |
| 34412 | const attributes = Attributes{ | |
| 34413 | .lib_function_without_prefix = true, | |
| 34414 | .const_without_errno_and_fp_exceptions = true, | |
| 34415 | }; | |
| 34416 | }; | |
| 34417 | ||
| 34418 | pub const llroundf = struct { | |
| 34419 | const param_str = "LLif"; | |
| 34420 | const header = .math; | |
| 34421 | const attributes = Attributes{ | |
| 34422 | .lib_function_without_prefix = true, | |
| 34423 | .const_without_errno_and_fp_exceptions = true, | |
| 34424 | }; | |
| 34425 | }; | |
| 34426 | ||
| 34427 | pub const llroundl = struct { | |
| 34428 | const param_str = "LLiLd"; | |
| 34429 | const header = .math; | |
| 34430 | const attributes = Attributes{ | |
| 34431 | .lib_function_without_prefix = true, | |
| 34432 | .const_without_errno_and_fp_exceptions = true, | |
| 34433 | }; | |
| 34434 | }; | |
| 34435 | ||
| 34436 | pub const log = struct { | |
| 34437 | const param_str = "dd"; | |
| 34438 | const header = .math; | |
| 34439 | const attributes = Attributes{ | |
| 34440 | .lib_function_without_prefix = true, | |
| 34441 | .const_without_errno_and_fp_exceptions = true, | |
| 34442 | }; | |
| 34443 | }; | |
| 34444 | ||
| 34445 | pub const log10 = struct { | |
| 34446 | const param_str = "dd"; | |
| 34447 | const header = .math; | |
| 34448 | const attributes = Attributes{ | |
| 34449 | .lib_function_without_prefix = true, | |
| 34450 | .const_without_errno_and_fp_exceptions = true, | |
| 34451 | }; | |
| 34452 | }; | |
| 34453 | ||
| 34454 | pub const log10f = struct { | |
| 34455 | const param_str = "ff"; | |
| 34456 | const header = .math; | |
| 34457 | const attributes = Attributes{ | |
| 34458 | .lib_function_without_prefix = true, | |
| 34459 | .const_without_errno_and_fp_exceptions = true, | |
| 34460 | }; | |
| 34461 | }; | |
| 34462 | ||
| 34463 | pub const log10l = struct { | |
| 34464 | const param_str = "LdLd"; | |
| 34465 | const header = .math; | |
| 34466 | const attributes = Attributes{ | |
| 34467 | .lib_function_without_prefix = true, | |
| 34468 | .const_without_errno_and_fp_exceptions = true, | |
| 34469 | }; | |
| 34470 | }; | |
| 34471 | ||
| 34472 | pub const log1p = struct { | |
| 34473 | const param_str = "dd"; | |
| 34474 | const header = .math; | |
| 34475 | const attributes = Attributes{ | |
| 34476 | .lib_function_without_prefix = true, | |
| 34477 | .const_without_errno_and_fp_exceptions = true, | |
| 34478 | }; | |
| 34479 | }; | |
| 34480 | ||
| 34481 | pub const log1pf = struct { | |
| 34482 | const param_str = "ff"; | |
| 34483 | const header = .math; | |
| 34484 | const attributes = Attributes{ | |
| 34485 | .lib_function_without_prefix = true, | |
| 34486 | .const_without_errno_and_fp_exceptions = true, | |
| 34487 | }; | |
| 34488 | }; | |
| 34489 | ||
| 34490 | pub const log1pl = struct { | |
| 34491 | const param_str = "LdLd"; | |
| 34492 | const header = .math; | |
| 34493 | const attributes = Attributes{ | |
| 34494 | .lib_function_without_prefix = true, | |
| 34495 | .const_without_errno_and_fp_exceptions = true, | |
| 34496 | }; | |
| 34497 | }; | |
| 34498 | ||
| 34499 | pub const log2 = struct { | |
| 34500 | const param_str = "dd"; | |
| 34501 | const header = .math; | |
| 34502 | const attributes = Attributes{ | |
| 34503 | .lib_function_without_prefix = true, | |
| 34504 | .const_without_errno_and_fp_exceptions = true, | |
| 34505 | }; | |
| 34506 | }; | |
| 34507 | ||
| 34508 | pub const log2f = struct { | |
| 34509 | const param_str = "ff"; | |
| 34510 | const header = .math; | |
| 34511 | const attributes = Attributes{ | |
| 34512 | .lib_function_without_prefix = true, | |
| 34513 | .const_without_errno_and_fp_exceptions = true, | |
| 34514 | }; | |
| 34515 | }; | |
| 34516 | ||
| 34517 | pub const log2l = struct { | |
| 34518 | const param_str = "LdLd"; | |
| 34519 | const header = .math; | |
| 34520 | const attributes = Attributes{ | |
| 34521 | .lib_function_without_prefix = true, | |
| 34522 | .const_without_errno_and_fp_exceptions = true, | |
| 34523 | }; | |
| 34524 | }; | |
| 34525 | ||
| 34526 | pub const logb = struct { | |
| 34527 | const param_str = "dd"; | |
| 34528 | const header = .math; | |
| 34529 | const attributes = Attributes{ | |
| 34530 | .lib_function_without_prefix = true, | |
| 34531 | .const_without_errno_and_fp_exceptions = true, | |
| 34532 | }; | |
| 34533 | }; | |
| 34534 | ||
| 34535 | pub const logbf = struct { | |
| 34536 | const param_str = "ff"; | |
| 34537 | const header = .math; | |
| 34538 | const attributes = Attributes{ | |
| 34539 | .lib_function_without_prefix = true, | |
| 34540 | .const_without_errno_and_fp_exceptions = true, | |
| 34541 | }; | |
| 34542 | }; | |
| 34543 | ||
| 34544 | pub const logbl = struct { | |
| 34545 | const param_str = "LdLd"; | |
| 34546 | const header = .math; | |
| 34547 | const attributes = Attributes{ | |
| 34548 | .lib_function_without_prefix = true, | |
| 34549 | .const_without_errno_and_fp_exceptions = true, | |
| 34550 | }; | |
| 34551 | }; | |
| 34552 | ||
| 34553 | pub const logf = struct { | |
| 34554 | const param_str = "ff"; | |
| 34555 | const header = .math; | |
| 34556 | const attributes = Attributes{ | |
| 34557 | .lib_function_without_prefix = true, | |
| 34558 | .const_without_errno_and_fp_exceptions = true, | |
| 34559 | }; | |
| 34560 | }; | |
| 34561 | ||
| 34562 | pub const logl = struct { | |
| 34563 | const param_str = "LdLd"; | |
| 34564 | const header = .math; | |
| 34565 | const attributes = Attributes{ | |
| 34566 | .lib_function_without_prefix = true, | |
| 34567 | .const_without_errno_and_fp_exceptions = true, | |
| 34568 | }; | |
| 34569 | }; | |
| 34570 | ||
| 34571 | pub const longjmp = struct { | |
| 34572 | const param_str = "vJi"; | |
| 34573 | const header = .setjmp; | |
| 34574 | const attributes = Attributes{ | |
| 34575 | .noreturn = true, | |
| 34576 | .allow_type_mismatch = true, | |
| 34577 | .lib_function_without_prefix = true, | |
| 34578 | }; | |
| 34579 | }; | |
| 34580 | ||
| 34581 | pub const lrint = struct { | |
| 34582 | const param_str = "Lid"; | |
| 34583 | const header = .math; | |
| 34584 | const attributes = Attributes{ | |
| 34585 | .lib_function_without_prefix = true, | |
| 34586 | .const_without_errno_and_fp_exceptions = true, | |
| 34587 | }; | |
| 34588 | }; | |
| 34589 | ||
| 34590 | pub const lrintf = struct { | |
| 34591 | const param_str = "Lif"; | |
| 34592 | const header = .math; | |
| 34593 | const attributes = Attributes{ | |
| 34594 | .lib_function_without_prefix = true, | |
| 34595 | .const_without_errno_and_fp_exceptions = true, | |
| 34596 | }; | |
| 34597 | }; | |
| 34598 | ||
| 34599 | pub const lrintl = struct { | |
| 34600 | const param_str = "LiLd"; | |
| 34601 | const header = .math; | |
| 34602 | const attributes = Attributes{ | |
| 34603 | .lib_function_without_prefix = true, | |
| 34604 | .const_without_errno_and_fp_exceptions = true, | |
| 34605 | }; | |
| 34606 | }; | |
| 34607 | ||
| 34608 | pub const lround = struct { | |
| 34609 | const param_str = "Lid"; | |
| 34610 | const header = .math; | |
| 34611 | const attributes = Attributes{ | |
| 34612 | .lib_function_without_prefix = true, | |
| 34613 | .const_without_errno_and_fp_exceptions = true, | |
| 34614 | }; | |
| 34615 | }; | |
| 34616 | ||
| 34617 | pub const lroundf = struct { | |
| 34618 | const param_str = "Lif"; | |
| 34619 | const header = .math; | |
| 34620 | const attributes = Attributes{ | |
| 34621 | .lib_function_without_prefix = true, | |
| 34622 | .const_without_errno_and_fp_exceptions = true, | |
| 34623 | }; | |
| 34624 | }; | |
| 34625 | ||
| 34626 | pub const lroundl = struct { | |
| 34627 | const param_str = "LiLd"; | |
| 34628 | const header = .math; | |
| 34629 | const attributes = Attributes{ | |
| 34630 | .lib_function_without_prefix = true, | |
| 34631 | .const_without_errno_and_fp_exceptions = true, | |
| 34632 | }; | |
| 34633 | }; | |
| 34634 | ||
| 34635 | pub const malloc = struct { | |
| 34636 | const param_str = "v*z"; | |
| 34637 | const header = .stdlib; | |
| 34638 | const attributes = Attributes{ | |
| 34639 | .lib_function_without_prefix = true, | |
| 34640 | }; | |
| 34641 | }; | |
| 34642 | ||
| 34643 | pub const memalign = struct { | |
| 34644 | const param_str = "v*zz"; | |
| 34645 | const language = .all_gnu_languages; | |
| 34646 | const header = .malloc; | |
| 34647 | const attributes = Attributes{ | |
| 34648 | .lib_function_without_prefix = true, | |
| 34649 | }; | |
| 34650 | }; | |
| 34651 | ||
| 34652 | pub const memccpy = struct { | |
| 34653 | const param_str = "v*v*vC*iz"; | |
| 34654 | const language = .all_gnu_languages; | |
| 34655 | const header = .string; | |
| 34656 | const attributes = Attributes{ | |
| 34657 | .lib_function_without_prefix = true, | |
| 34658 | }; | |
| 34659 | }; | |
| 34660 | ||
| 34661 | pub const memchr = struct { | |
| 34662 | const param_str = "v*vC*iz"; | |
| 34663 | const header = .string; | |
| 34664 | const attributes = Attributes{ | |
| 34665 | .lib_function_without_prefix = true, | |
| 34666 | .const_evaluable = true, | |
| 34667 | }; | |
| 34668 | }; | |
| 34669 | ||
| 34670 | pub const memcmp = struct { | |
| 34671 | const param_str = "ivC*vC*z"; | |
| 34672 | const header = .string; | |
| 34673 | const attributes = Attributes{ | |
| 34674 | .lib_function_without_prefix = true, | |
| 34675 | .const_evaluable = true, | |
| 34676 | }; | |
| 34677 | }; | |
| 34678 | ||
| 34679 | pub const memcpy = struct { | |
| 34680 | const param_str = "v*v*vC*z"; | |
| 34681 | const header = .string; | |
| 34682 | const attributes = Attributes{ | |
| 34683 | .lib_function_without_prefix = true, | |
| 34684 | .const_evaluable = true, | |
| 34685 | }; | |
| 34686 | }; | |
| 34687 | ||
| 34688 | pub const memmove = struct { | |
| 34689 | const param_str = "v*v*vC*z"; | |
| 34690 | const header = .string; | |
| 34691 | const attributes = Attributes{ | |
| 34692 | .lib_function_without_prefix = true, | |
| 34693 | .const_evaluable = true, | |
| 34694 | }; | |
| 34695 | }; | |
| 34696 | ||
| 34697 | pub const mempcpy = struct { | |
| 34698 | const param_str = "v*v*vC*z"; | |
| 34699 | const language = .all_gnu_languages; | |
| 34700 | const header = .string; | |
| 34701 | const attributes = Attributes{ | |
| 34702 | .lib_function_without_prefix = true, | |
| 34703 | }; | |
| 34704 | }; | |
| 34705 | ||
| 34706 | pub const memset = struct { | |
| 34707 | const param_str = "v*v*iz"; | |
| 34708 | const header = .string; | |
| 34709 | const attributes = Attributes{ | |
| 34710 | .lib_function_without_prefix = true, | |
| 34711 | }; | |
| 34712 | }; | |
| 34713 | ||
| 34714 | pub const modf = struct { | |
| 34715 | const param_str = "ddd*"; | |
| 34716 | const header = .math; | |
| 34717 | const attributes = Attributes{ | |
| 34718 | .lib_function_without_prefix = true, | |
| 34719 | }; | |
| 34720 | }; | |
| 34721 | ||
| 34722 | pub const modff = struct { | |
| 34723 | const param_str = "fff*"; | |
| 34724 | const header = .math; | |
| 34725 | const attributes = Attributes{ | |
| 34726 | .lib_function_without_prefix = true, | |
| 34727 | }; | |
| 34728 | }; | |
| 34729 | ||
| 34730 | pub const modfl = struct { | |
| 34731 | const param_str = "LdLdLd*"; | |
| 34732 | const header = .math; | |
| 34733 | const attributes = Attributes{ | |
| 34734 | .lib_function_without_prefix = true, | |
| 34735 | }; | |
| 34736 | }; | |
| 34737 | ||
| 34738 | pub const nan = struct { | |
| 34739 | const param_str = "dcC*"; | |
| 34740 | const header = .math; | |
| 34741 | const attributes = Attributes{ | |
| 34742 | .pure = true, | |
| 34743 | .lib_function_without_prefix = true, | |
| 34744 | }; | |
| 34745 | }; | |
| 34746 | ||
| 34747 | pub const nanf = struct { | |
| 34748 | const param_str = "fcC*"; | |
| 34749 | const header = .math; | |
| 34750 | const attributes = Attributes{ | |
| 34751 | .pure = true, | |
| 34752 | .lib_function_without_prefix = true, | |
| 34753 | }; | |
| 34754 | }; | |
| 34755 | ||
| 34756 | pub const nanl = struct { | |
| 34757 | const param_str = "LdcC*"; | |
| 34758 | const header = .math; | |
| 34759 | const attributes = Attributes{ | |
| 34760 | .pure = true, | |
| 34761 | .lib_function_without_prefix = true, | |
| 34762 | }; | |
| 34763 | }; | |
| 34764 | ||
| 34765 | pub const nearbyint = struct { | |
| 34766 | const param_str = "dd"; | |
| 34767 | const header = .math; | |
| 34768 | const attributes = Attributes{ | |
| 34769 | .@"const" = true, | |
| 34770 | .lib_function_without_prefix = true, | |
| 34771 | }; | |
| 34772 | }; | |
| 34773 | ||
| 34774 | pub const nearbyintf = struct { | |
| 34775 | const param_str = "ff"; | |
| 34776 | const header = .math; | |
| 34777 | const attributes = Attributes{ | |
| 34778 | .@"const" = true, | |
| 34779 | .lib_function_without_prefix = true, | |
| 34780 | }; | |
| 34781 | }; | |
| 34782 | ||
| 34783 | pub const nearbyintl = struct { | |
| 34784 | const param_str = "LdLd"; | |
| 34785 | const header = .math; | |
| 34786 | const attributes = Attributes{ | |
| 34787 | .@"const" = true, | |
| 34788 | .lib_function_without_prefix = true, | |
| 34789 | }; | |
| 34790 | }; | |
| 34791 | ||
| 34792 | pub const nextafter = struct { | |
| 34793 | const param_str = "ddd"; | |
| 34794 | const header = .math; | |
| 34795 | const attributes = Attributes{ | |
| 34796 | .lib_function_without_prefix = true, | |
| 34797 | .const_without_errno_and_fp_exceptions = true, | |
| 34798 | }; | |
| 34799 | }; | |
| 34800 | ||
| 34801 | pub const nextafterf = struct { | |
| 34802 | const param_str = "fff"; | |
| 34803 | const header = .math; | |
| 34804 | const attributes = Attributes{ | |
| 34805 | .lib_function_without_prefix = true, | |
| 34806 | .const_without_errno_and_fp_exceptions = true, | |
| 34807 | }; | |
| 34808 | }; | |
| 34809 | ||
| 34810 | pub const nextafterl = struct { | |
| 34811 | const param_str = "LdLdLd"; | |
| 34812 | const header = .math; | |
| 34813 | const attributes = Attributes{ | |
| 34814 | .lib_function_without_prefix = true, | |
| 34815 | .const_without_errno_and_fp_exceptions = true, | |
| 34816 | }; | |
| 34817 | }; | |
| 34818 | ||
| 34819 | pub const nexttoward = struct { | |
| 34820 | const param_str = "ddLd"; | |
| 34821 | const header = .math; | |
| 34822 | const attributes = Attributes{ | |
| 34823 | .lib_function_without_prefix = true, | |
| 34824 | .const_without_errno_and_fp_exceptions = true, | |
| 34825 | }; | |
| 34826 | }; | |
| 34827 | ||
| 34828 | pub const nexttowardf = struct { | |
| 34829 | const param_str = "ffLd"; | |
| 34830 | const header = .math; | |
| 34831 | const attributes = Attributes{ | |
| 34832 | .lib_function_without_prefix = true, | |
| 34833 | .const_without_errno_and_fp_exceptions = true, | |
| 34834 | }; | |
| 34835 | }; | |
| 34836 | ||
| 34837 | pub const nexttowardl = struct { | |
| 34838 | const param_str = "LdLdLd"; | |
| 34839 | const header = .math; | |
| 34840 | const attributes = Attributes{ | |
| 34841 | .lib_function_without_prefix = true, | |
| 34842 | .const_without_errno_and_fp_exceptions = true, | |
| 34843 | }; | |
| 34844 | }; | |
| 34845 | ||
| 34846 | pub const pow = struct { | |
| 34847 | const param_str = "ddd"; | |
| 34848 | const header = .math; | |
| 34849 | const attributes = Attributes{ | |
| 34850 | .lib_function_without_prefix = true, | |
| 34851 | .const_without_errno_and_fp_exceptions = true, | |
| 34852 | }; | |
| 34853 | }; | |
| 34854 | ||
| 34855 | pub const powf = struct { | |
| 34856 | const param_str = "fff"; | |
| 34857 | const header = .math; | |
| 34858 | const attributes = Attributes{ | |
| 34859 | .lib_function_without_prefix = true, | |
| 34860 | .const_without_errno_and_fp_exceptions = true, | |
| 34861 | }; | |
| 34862 | }; | |
| 34863 | ||
| 34864 | pub const powl = struct { | |
| 34865 | const param_str = "LdLdLd"; | |
| 34866 | const header = .math; | |
| 34867 | const attributes = Attributes{ | |
| 34868 | .lib_function_without_prefix = true, | |
| 34869 | .const_without_errno_and_fp_exceptions = true, | |
| 34870 | }; | |
| 34871 | }; | |
| 34872 | ||
| 34873 | pub const printf = struct { | |
| 34874 | const param_str = "icC*."; | |
| 34875 | const header = .stdio; | |
| 34876 | const attributes = Attributes{ | |
| 34877 | .lib_function_without_prefix = true, | |
| 34878 | .format_kind = .printf, | |
| 34879 | .format_string_position = 0, | |
| 34880 | }; | |
| 34881 | }; | |
| 34882 | ||
| 34883 | pub const realloc = struct { | |
| 34884 | const param_str = "v*v*z"; | |
| 34885 | const header = .stdlib; | |
| 34886 | const attributes = Attributes{ | |
| 34887 | .lib_function_without_prefix = true, | |
| 34888 | }; | |
| 34889 | }; | |
| 34890 | ||
| 34891 | pub const remainder = struct { | |
| 34892 | const param_str = "ddd"; | |
| 34893 | const header = .math; | |
| 34894 | const attributes = Attributes{ | |
| 34895 | .lib_function_without_prefix = true, | |
| 34896 | .const_without_errno_and_fp_exceptions = true, | |
| 34897 | }; | |
| 34898 | }; | |
| 34899 | ||
| 34900 | pub const remainderf = struct { | |
| 34901 | const param_str = "fff"; | |
| 34902 | const header = .math; | |
| 34903 | const attributes = Attributes{ | |
| 34904 | .lib_function_without_prefix = true, | |
| 34905 | .const_without_errno_and_fp_exceptions = true, | |
| 34906 | }; | |
| 34907 | }; | |
| 34908 | ||
| 34909 | pub const remainderl = struct { | |
| 34910 | const param_str = "LdLdLd"; | |
| 34911 | const header = .math; | |
| 34912 | const attributes = Attributes{ | |
| 34913 | .lib_function_without_prefix = true, | |
| 34914 | .const_without_errno_and_fp_exceptions = true, | |
| 34915 | }; | |
| 34916 | }; | |
| 34917 | ||
| 34918 | pub const remquo = struct { | |
| 34919 | const param_str = "dddi*"; | |
| 34920 | const header = .math; | |
| 34921 | const attributes = Attributes{ | |
| 34922 | .lib_function_without_prefix = true, | |
| 34923 | }; | |
| 34924 | }; | |
| 34925 | ||
| 34926 | pub const remquof = struct { | |
| 34927 | const param_str = "fffi*"; | |
| 34928 | const header = .math; | |
| 34929 | const attributes = Attributes{ | |
| 34930 | .lib_function_without_prefix = true, | |
| 34931 | }; | |
| 34932 | }; | |
| 34933 | ||
| 34934 | pub const remquol = struct { | |
| 34935 | const param_str = "LdLdLdi*"; | |
| 34936 | const header = .math; | |
| 34937 | const attributes = Attributes{ | |
| 34938 | .lib_function_without_prefix = true, | |
| 34939 | }; | |
| 34940 | }; | |
| 34941 | ||
| 34942 | pub const rindex = struct { | |
| 34943 | const param_str = "c*cC*i"; | |
| 34944 | const language = .all_gnu_languages; | |
| 34945 | const header = .strings; | |
| 34946 | const attributes = Attributes{ | |
| 34947 | .lib_function_without_prefix = true, | |
| 34948 | }; | |
| 34949 | }; | |
| 34950 | ||
| 34951 | pub const rint = struct { | |
| 34952 | const param_str = "dd"; | |
| 34953 | const header = .math; | |
| 34954 | const attributes = Attributes{ | |
| 34955 | .lib_function_without_prefix = true, | |
| 34956 | .const_without_fp_exceptions = true, | |
| 34957 | }; | |
| 34958 | }; | |
| 34959 | ||
| 34960 | pub const rintf = struct { | |
| 34961 | const param_str = "ff"; | |
| 34962 | const header = .math; | |
| 34963 | const attributes = Attributes{ | |
| 34964 | .lib_function_without_prefix = true, | |
| 34965 | .const_without_fp_exceptions = true, | |
| 34966 | }; | |
| 34967 | }; | |
| 34968 | ||
| 34969 | pub const rintl = struct { | |
| 34970 | const param_str = "LdLd"; | |
| 34971 | const header = .math; | |
| 34972 | const attributes = Attributes{ | |
| 34973 | .lib_function_without_prefix = true, | |
| 34974 | .const_without_fp_exceptions = true, | |
| 34975 | }; | |
| 34976 | }; | |
| 34977 | ||
| 34978 | pub const round = struct { | |
| 34979 | const param_str = "dd"; | |
| 34980 | const header = .math; | |
| 34981 | const attributes = Attributes{ | |
| 34982 | .@"const" = true, | |
| 34983 | .lib_function_without_prefix = true, | |
| 34984 | }; | |
| 34985 | }; | |
| 34986 | ||
| 34987 | pub const roundf = struct { | |
| 34988 | const param_str = "ff"; | |
| 34989 | const header = .math; | |
| 34990 | const attributes = Attributes{ | |
| 34991 | .@"const" = true, | |
| 34992 | .lib_function_without_prefix = true, | |
| 34993 | }; | |
| 34994 | }; | |
| 34995 | ||
| 34996 | pub const roundl = struct { | |
| 34997 | const param_str = "LdLd"; | |
| 34998 | const header = .math; | |
| 34999 | const attributes = Attributes{ | |
| 35000 | .@"const" = true, | |
| 35001 | .lib_function_without_prefix = true, | |
| 35002 | }; | |
| 35003 | }; | |
| 35004 | ||
| 35005 | pub const savectx = struct { | |
| 35006 | const param_str = "iJ"; | |
| 35007 | const header = .setjmp; | |
| 35008 | const attributes = Attributes{ | |
| 35009 | .allow_type_mismatch = true, | |
| 35010 | .lib_function_without_prefix = true, | |
| 35011 | .returns_twice = true, | |
| 35012 | }; | |
| 35013 | }; | |
| 35014 | ||
| 35015 | pub const scalbln = struct { | |
| 35016 | const param_str = "ddLi"; | |
| 35017 | const header = .math; | |
| 35018 | const attributes = Attributes{ | |
| 35019 | .lib_function_without_prefix = true, | |
| 35020 | .const_without_errno_and_fp_exceptions = true, | |
| 35021 | }; | |
| 35022 | }; | |
| 35023 | ||
| 35024 | pub const scalblnf = struct { | |
| 35025 | const param_str = "ffLi"; | |
| 35026 | const header = .math; | |
| 35027 | const attributes = Attributes{ | |
| 35028 | .lib_function_without_prefix = true, | |
| 35029 | .const_without_errno_and_fp_exceptions = true, | |
| 35030 | }; | |
| 35031 | }; | |
| 35032 | ||
| 35033 | pub const scalblnl = struct { | |
| 35034 | const param_str = "LdLdLi"; | |
| 35035 | const header = .math; | |
| 35036 | const attributes = Attributes{ | |
| 35037 | .lib_function_without_prefix = true, | |
| 35038 | .const_without_errno_and_fp_exceptions = true, | |
| 35039 | }; | |
| 35040 | }; | |
| 35041 | ||
| 35042 | pub const scalbn = struct { | |
| 35043 | const param_str = "ddi"; | |
| 35044 | const header = .math; | |
| 35045 | const attributes = Attributes{ | |
| 35046 | .lib_function_without_prefix = true, | |
| 35047 | .const_without_errno_and_fp_exceptions = true, | |
| 35048 | }; | |
| 35049 | }; | |
| 35050 | ||
| 35051 | pub const scalbnf = struct { | |
| 35052 | const param_str = "ffi"; | |
| 35053 | const header = .math; | |
| 35054 | const attributes = Attributes{ | |
| 35055 | .lib_function_without_prefix = true, | |
| 35056 | .const_without_errno_and_fp_exceptions = true, | |
| 35057 | }; | |
| 35058 | }; | |
| 35059 | ||
| 35060 | pub const scalbnl = struct { | |
| 35061 | const param_str = "LdLdi"; | |
| 35062 | const header = .math; | |
| 35063 | const attributes = Attributes{ | |
| 35064 | .lib_function_without_prefix = true, | |
| 35065 | .const_without_errno_and_fp_exceptions = true, | |
| 35066 | }; | |
| 35067 | }; | |
| 35068 | ||
| 35069 | pub const scanf = struct { | |
| 35070 | const param_str = "icC*R."; | |
| 35071 | const header = .stdio; | |
| 35072 | const attributes = Attributes{ | |
| 35073 | .lib_function_without_prefix = true, | |
| 35074 | .format_kind = .scanf, | |
| 35075 | .format_string_position = 0, | |
| 35076 | }; | |
| 35077 | }; | |
| 35078 | ||
| 35079 | pub const setjmp = struct { | |
| 35080 | const param_str = "iJ"; | |
| 35081 | const header = .setjmp; | |
| 35082 | const attributes = Attributes{ | |
| 35083 | .allow_type_mismatch = true, | |
| 35084 | .lib_function_without_prefix = true, | |
| 35085 | .returns_twice = true, | |
| 35086 | }; | |
| 35087 | }; | |
| 35088 | ||
| 35089 | pub const siglongjmp = struct { | |
| 35090 | const param_str = "vSJi"; | |
| 35091 | const language = .all_gnu_languages; | |
| 35092 | const header = .setjmp; | |
| 35093 | const attributes = Attributes{ | |
| 35094 | .noreturn = true, | |
| 35095 | .allow_type_mismatch = true, | |
| 35096 | .lib_function_without_prefix = true, | |
| 35097 | }; | |
| 35098 | }; | |
| 35099 | ||
| 35100 | pub const sigsetjmp = struct { | |
| 35101 | const param_str = "iSJi"; | |
| 35102 | const header = .setjmp; | |
| 35103 | const attributes = Attributes{ | |
| 35104 | .allow_type_mismatch = true, | |
| 35105 | .lib_function_without_prefix = true, | |
| 35106 | .returns_twice = true, | |
| 35107 | }; | |
| 35108 | }; | |
| 35109 | ||
| 35110 | pub const sin = struct { | |
| 35111 | const param_str = "dd"; | |
| 35112 | const header = .math; | |
| 35113 | const attributes = Attributes{ | |
| 35114 | .lib_function_without_prefix = true, | |
| 35115 | .const_without_errno_and_fp_exceptions = true, | |
| 35116 | }; | |
| 35117 | }; | |
| 35118 | ||
| 35119 | pub const sinf = struct { | |
| 35120 | const param_str = "ff"; | |
| 35121 | const header = .math; | |
| 35122 | const attributes = Attributes{ | |
| 35123 | .lib_function_without_prefix = true, | |
| 35124 | .const_without_errno_and_fp_exceptions = true, | |
| 35125 | }; | |
| 35126 | }; | |
| 35127 | ||
| 35128 | pub const sinh = struct { | |
| 35129 | const param_str = "dd"; | |
| 35130 | const header = .math; | |
| 35131 | const attributes = Attributes{ | |
| 35132 | .lib_function_without_prefix = true, | |
| 35133 | .const_without_errno_and_fp_exceptions = true, | |
| 35134 | }; | |
| 35135 | }; | |
| 35136 | ||
| 35137 | pub const sinhf = struct { | |
| 35138 | const param_str = "ff"; | |
| 35139 | const header = .math; | |
| 35140 | const attributes = Attributes{ | |
| 35141 | .lib_function_without_prefix = true, | |
| 35142 | .const_without_errno_and_fp_exceptions = true, | |
| 35143 | }; | |
| 35144 | }; | |
| 35145 | ||
| 35146 | pub const sinhl = struct { | |
| 35147 | const param_str = "LdLd"; | |
| 35148 | const header = .math; | |
| 35149 | const attributes = Attributes{ | |
| 35150 | .lib_function_without_prefix = true, | |
| 35151 | .const_without_errno_and_fp_exceptions = true, | |
| 35152 | }; | |
| 35153 | }; | |
| 35154 | ||
| 35155 | pub const sinl = struct { | |
| 35156 | const param_str = "LdLd"; | |
| 35157 | const header = .math; | |
| 35158 | const attributes = Attributes{ | |
| 35159 | .lib_function_without_prefix = true, | |
| 35160 | .const_without_errno_and_fp_exceptions = true, | |
| 35161 | }; | |
| 35162 | }; | |
| 35163 | ||
| 35164 | pub const snprintf = struct { | |
| 35165 | const param_str = "ic*zcC*."; | |
| 35166 | const header = .stdio; | |
| 35167 | const attributes = Attributes{ | |
| 35168 | .lib_function_without_prefix = true, | |
| 35169 | .format_kind = .printf, | |
| 35170 | .format_string_position = 2, | |
| 35171 | }; | |
| 35172 | }; | |
| 35173 | ||
| 35174 | pub const sprintf = struct { | |
| 35175 | const param_str = "ic*cC*."; | |
| 35176 | const header = .stdio; | |
| 35177 | const attributes = Attributes{ | |
| 35178 | .lib_function_without_prefix = true, | |
| 35179 | .format_kind = .printf, | |
| 35180 | .format_string_position = 1, | |
| 35181 | }; | |
| 35182 | }; | |
| 35183 | ||
| 35184 | pub const sqrt = struct { | |
| 35185 | const param_str = "dd"; | |
| 35186 | const header = .math; | |
| 35187 | const attributes = Attributes{ | |
| 35188 | .lib_function_without_prefix = true, | |
| 35189 | .const_without_errno_and_fp_exceptions = true, | |
| 35190 | }; | |
| 35191 | }; | |
| 35192 | ||
| 35193 | pub const sqrtf = struct { | |
| 35194 | const param_str = "ff"; | |
| 35195 | const header = .math; | |
| 35196 | const attributes = Attributes{ | |
| 35197 | .lib_function_without_prefix = true, | |
| 35198 | .const_without_errno_and_fp_exceptions = true, | |
| 35199 | }; | |
| 35200 | }; | |
| 35201 | ||
| 35202 | pub const sqrtl = struct { | |
| 35203 | const param_str = "LdLd"; | |
| 35204 | const header = .math; | |
| 35205 | const attributes = Attributes{ | |
| 35206 | .lib_function_without_prefix = true, | |
| 35207 | .const_without_errno_and_fp_exceptions = true, | |
| 35208 | }; | |
| 35209 | }; | |
| 35210 | ||
| 35211 | pub const sscanf = struct { | |
| 35212 | const param_str = "icC*RcC*R."; | |
| 35213 | const header = .stdio; | |
| 35214 | const attributes = Attributes{ | |
| 35215 | .lib_function_without_prefix = true, | |
| 35216 | .format_kind = .scanf, | |
| 35217 | .format_string_position = 1, | |
| 35218 | }; | |
| 35219 | }; | |
| 35220 | ||
| 35221 | pub const stpcpy = struct { | |
| 35222 | const param_str = "c*c*cC*"; | |
| 35223 | const language = .all_gnu_languages; | |
| 35224 | const header = .string; | |
| 35225 | const attributes = Attributes{ | |
| 35226 | .lib_function_without_prefix = true, | |
| 35227 | }; | |
| 35228 | }; | |
| 35229 | ||
| 35230 | pub const stpncpy = struct { | |
| 35231 | const param_str = "c*c*cC*z"; | |
| 35232 | const language = .all_gnu_languages; | |
| 35233 | const header = .string; | |
| 35234 | const attributes = Attributes{ | |
| 35235 | .lib_function_without_prefix = true, | |
| 35236 | }; | |
| 35237 | }; | |
| 35238 | ||
| 35239 | pub const strcasecmp = struct { | |
| 35240 | const param_str = "icC*cC*"; | |
| 35241 | const language = .all_gnu_languages; | |
| 35242 | const header = .strings; | |
| 35243 | const attributes = Attributes{ | |
| 35244 | .lib_function_without_prefix = true, | |
| 35245 | }; | |
| 35246 | }; | |
| 35247 | ||
| 35248 | pub const strcat = struct { | |
| 35249 | const param_str = "c*c*cC*"; | |
| 35250 | const header = .string; | |
| 35251 | const attributes = Attributes{ | |
| 35252 | .lib_function_without_prefix = true, | |
| 35253 | }; | |
| 35254 | }; | |
| 35255 | ||
| 35256 | pub const strchr = struct { | |
| 35257 | const param_str = "c*cC*i"; | |
| 35258 | const header = .string; | |
| 35259 | const attributes = Attributes{ | |
| 35260 | .lib_function_without_prefix = true, | |
| 35261 | .const_evaluable = true, | |
| 35262 | }; | |
| 35263 | }; | |
| 35264 | ||
| 35265 | pub const strcmp = struct { | |
| 35266 | const param_str = "icC*cC*"; | |
| 35267 | const header = .string; | |
| 35268 | const attributes = Attributes{ | |
| 35269 | .lib_function_without_prefix = true, | |
| 35270 | .const_evaluable = true, | |
| 35271 | }; | |
| 35272 | }; | |
| 35273 | ||
| 35274 | pub const strcpy = struct { | |
| 35275 | const param_str = "c*c*cC*"; | |
| 35276 | const header = .string; | |
| 35277 | const attributes = Attributes{ | |
| 35278 | .lib_function_without_prefix = true, | |
| 35279 | }; | |
| 35280 | }; | |
| 35281 | ||
| 35282 | pub const strcspn = struct { | |
| 35283 | const param_str = "zcC*cC*"; | |
| 35284 | const header = .string; | |
| 35285 | const attributes = Attributes{ | |
| 35286 | .lib_function_without_prefix = true, | |
| 35287 | }; | |
| 35288 | }; | |
| 35289 | ||
| 35290 | pub const strdup = struct { | |
| 35291 | const param_str = "c*cC*"; | |
| 35292 | const language = .all_gnu_languages; | |
| 35293 | const header = .string; | |
| 35294 | const attributes = Attributes{ | |
| 35295 | .lib_function_without_prefix = true, | |
| 35296 | }; | |
| 35297 | }; | |
| 35298 | ||
| 35299 | pub const strerror = struct { | |
| 35300 | const param_str = "c*i"; | |
| 35301 | const header = .string; | |
| 35302 | const attributes = Attributes{ | |
| 35303 | .lib_function_without_prefix = true, | |
| 35304 | }; | |
| 35305 | }; | |
| 35306 | ||
| 35307 | pub const strlcat = struct { | |
| 35308 | const param_str = "zc*cC*z"; | |
| 35309 | const language = .all_gnu_languages; | |
| 35310 | const header = .string; | |
| 35311 | const attributes = Attributes{ | |
| 35312 | .lib_function_without_prefix = true, | |
| 35313 | }; | |
| 35314 | }; | |
| 35315 | ||
| 35316 | pub const strlcpy = struct { | |
| 35317 | const param_str = "zc*cC*z"; | |
| 35318 | const language = .all_gnu_languages; | |
| 35319 | const header = .string; | |
| 35320 | const attributes = Attributes{ | |
| 35321 | .lib_function_without_prefix = true, | |
| 35322 | }; | |
| 35323 | }; | |
| 35324 | ||
| 35325 | pub const strlen = struct { | |
| 35326 | const param_str = "zcC*"; | |
| 35327 | const header = .string; | |
| 35328 | const attributes = Attributes{ | |
| 35329 | .lib_function_without_prefix = true, | |
| 35330 | .const_evaluable = true, | |
| 35331 | }; | |
| 35332 | }; | |
| 35333 | ||
| 35334 | pub const strncasecmp = struct { | |
| 35335 | const param_str = "icC*cC*z"; | |
| 35336 | const language = .all_gnu_languages; | |
| 35337 | const header = .strings; | |
| 35338 | const attributes = Attributes{ | |
| 35339 | .lib_function_without_prefix = true, | |
| 35340 | }; | |
| 35341 | }; | |
| 35342 | ||
| 35343 | pub const strncat = struct { | |
| 35344 | const param_str = "c*c*cC*z"; | |
| 35345 | const header = .string; | |
| 35346 | const attributes = Attributes{ | |
| 35347 | .lib_function_without_prefix = true, | |
| 35348 | }; | |
| 35349 | }; | |
| 35350 | ||
| 35351 | pub const strncmp = struct { | |
| 35352 | const param_str = "icC*cC*z"; | |
| 35353 | const header = .string; | |
| 35354 | const attributes = Attributes{ | |
| 35355 | .lib_function_without_prefix = true, | |
| 35356 | .const_evaluable = true, | |
| 35357 | }; | |
| 35358 | }; | |
| 35359 | ||
| 35360 | pub const strncpy = struct { | |
| 35361 | const param_str = "c*c*cC*z"; | |
| 35362 | const header = .string; | |
| 35363 | const attributes = Attributes{ | |
| 35364 | .lib_function_without_prefix = true, | |
| 35365 | }; | |
| 35366 | }; | |
| 35367 | ||
| 35368 | pub const strndup = struct { | |
| 35369 | const param_str = "c*cC*z"; | |
| 35370 | const language = .all_gnu_languages; | |
| 35371 | const header = .string; | |
| 35372 | const attributes = Attributes{ | |
| 35373 | .lib_function_without_prefix = true, | |
| 35374 | }; | |
| 35375 | }; | |
| 35376 | ||
| 35377 | pub const strpbrk = struct { | |
| 35378 | const param_str = "c*cC*cC*"; | |
| 35379 | const header = .string; | |
| 35380 | const attributes = Attributes{ | |
| 35381 | .lib_function_without_prefix = true, | |
| 35382 | }; | |
| 35383 | }; | |
| 35384 | ||
| 35385 | pub const strrchr = struct { | |
| 35386 | const param_str = "c*cC*i"; | |
| 35387 | const header = .string; | |
| 35388 | const attributes = Attributes{ | |
| 35389 | .lib_function_without_prefix = true, | |
| 35390 | }; | |
| 35391 | }; | |
| 35392 | ||
| 35393 | pub const strspn = struct { | |
| 35394 | const param_str = "zcC*cC*"; | |
| 35395 | const header = .string; | |
| 35396 | const attributes = Attributes{ | |
| 35397 | .lib_function_without_prefix = true, | |
| 35398 | }; | |
| 35399 | }; | |
| 35400 | ||
| 35401 | pub const strstr = struct { | |
| 35402 | const param_str = "c*cC*cC*"; | |
| 35403 | const header = .string; | |
| 35404 | const attributes = Attributes{ | |
| 35405 | .lib_function_without_prefix = true, | |
| 35406 | }; | |
| 35407 | }; | |
| 35408 | ||
| 35409 | pub const strtod = struct { | |
| 35410 | const param_str = "dcC*c**"; | |
| 35411 | const header = .stdlib; | |
| 35412 | const attributes = Attributes{ | |
| 35413 | .lib_function_without_prefix = true, | |
| 35414 | }; | |
| 35415 | }; | |
| 35416 | ||
| 35417 | pub const strtof = struct { | |
| 35418 | const param_str = "fcC*c**"; | |
| 35419 | const header = .stdlib; | |
| 35420 | const attributes = Attributes{ | |
| 35421 | .lib_function_without_prefix = true, | |
| 35422 | }; | |
| 35423 | }; | |
| 35424 | ||
| 35425 | pub const strtok = struct { | |
| 35426 | const param_str = "c*c*cC*"; | |
| 35427 | const header = .string; | |
| 35428 | const attributes = Attributes{ | |
| 35429 | .lib_function_without_prefix = true, | |
| 35430 | }; | |
| 35431 | }; | |
| 35432 | ||
| 35433 | pub const strtol = struct { | |
| 35434 | const param_str = "LicC*c**i"; | |
| 35435 | const header = .stdlib; | |
| 35436 | const attributes = Attributes{ | |
| 35437 | .lib_function_without_prefix = true, | |
| 35438 | }; | |
| 35439 | }; | |
| 35440 | ||
| 35441 | pub const strtold = struct { | |
| 35442 | const param_str = "LdcC*c**"; | |
| 35443 | const header = .stdlib; | |
| 35444 | const attributes = Attributes{ | |
| 35445 | .lib_function_without_prefix = true, | |
| 35446 | }; | |
| 35447 | }; | |
| 35448 | ||
| 35449 | pub const strtoll = struct { | |
| 35450 | const param_str = "LLicC*c**i"; | |
| 35451 | const header = .stdlib; | |
| 35452 | const attributes = Attributes{ | |
| 35453 | .lib_function_without_prefix = true, | |
| 35454 | }; | |
| 35455 | }; | |
| 35456 | ||
| 35457 | pub const strtoul = struct { | |
| 35458 | const param_str = "ULicC*c**i"; | |
| 35459 | const header = .stdlib; | |
| 35460 | const attributes = Attributes{ | |
| 35461 | .lib_function_without_prefix = true, | |
| 35462 | }; | |
| 35463 | }; | |
| 35464 | ||
| 35465 | pub const strtoull = struct { | |
| 35466 | const param_str = "ULLicC*c**i"; | |
| 35467 | const header = .stdlib; | |
| 35468 | const attributes = Attributes{ | |
| 35469 | .lib_function_without_prefix = true, | |
| 35470 | }; | |
| 35471 | }; | |
| 35472 | ||
| 35473 | pub const strxfrm = struct { | |
| 35474 | const param_str = "zc*cC*z"; | |
| 35475 | const header = .string; | |
| 35476 | const attributes = Attributes{ | |
| 35477 | .lib_function_without_prefix = true, | |
| 35478 | }; | |
| 35479 | }; | |
| 35480 | ||
| 35481 | pub const tan = struct { | |
| 35482 | const param_str = "dd"; | |
| 35483 | const header = .math; | |
| 35484 | const attributes = Attributes{ | |
| 35485 | .lib_function_without_prefix = true, | |
| 35486 | .const_without_errno_and_fp_exceptions = true, | |
| 35487 | }; | |
| 35488 | }; | |
| 35489 | ||
| 35490 | pub const tanf = struct { | |
| 35491 | const param_str = "ff"; | |
| 35492 | const header = .math; | |
| 35493 | const attributes = Attributes{ | |
| 35494 | .lib_function_without_prefix = true, | |
| 35495 | .const_without_errno_and_fp_exceptions = true, | |
| 35496 | }; | |
| 35497 | }; | |
| 35498 | ||
| 35499 | pub const tanh = struct { | |
| 35500 | const param_str = "dd"; | |
| 35501 | const header = .math; | |
| 35502 | const attributes = Attributes{ | |
| 35503 | .lib_function_without_prefix = true, | |
| 35504 | .const_without_errno_and_fp_exceptions = true, | |
| 35505 | }; | |
| 35506 | }; | |
| 35507 | ||
| 35508 | pub const tanhf = struct { | |
| 35509 | const param_str = "ff"; | |
| 35510 | const header = .math; | |
| 35511 | const attributes = Attributes{ | |
| 35512 | .lib_function_without_prefix = true, | |
| 35513 | .const_without_errno_and_fp_exceptions = true, | |
| 35514 | }; | |
| 35515 | }; | |
| 35516 | ||
| 35517 | pub const tanhl = struct { | |
| 35518 | const param_str = "LdLd"; | |
| 35519 | const header = .math; | |
| 35520 | const attributes = Attributes{ | |
| 35521 | .lib_function_without_prefix = true, | |
| 35522 | .const_without_errno_and_fp_exceptions = true, | |
| 35523 | }; | |
| 35524 | }; | |
| 35525 | ||
| 35526 | pub const tanl = struct { | |
| 35527 | const param_str = "LdLd"; | |
| 35528 | const header = .math; | |
| 35529 | const attributes = Attributes{ | |
| 35530 | .lib_function_without_prefix = true, | |
| 35531 | .const_without_errno_and_fp_exceptions = true, | |
| 35532 | }; | |
| 35533 | }; | |
| 35534 | ||
| 35535 | pub const tgamma = struct { | |
| 35536 | const param_str = "dd"; | |
| 35537 | const header = .math; | |
| 35538 | const attributes = Attributes{ | |
| 35539 | .lib_function_without_prefix = true, | |
| 35540 | .const_without_errno_and_fp_exceptions = true, | |
| 35541 | }; | |
| 35542 | }; | |
| 35543 | ||
| 35544 | pub const tgammaf = struct { | |
| 35545 | const param_str = "ff"; | |
| 35546 | const header = .math; | |
| 35547 | const attributes = Attributes{ | |
| 35548 | .lib_function_without_prefix = true, | |
| 35549 | .const_without_errno_and_fp_exceptions = true, | |
| 35550 | }; | |
| 35551 | }; | |
| 35552 | ||
| 35553 | pub const tgammal = struct { | |
| 35554 | const param_str = "LdLd"; | |
| 35555 | const header = .math; | |
| 35556 | const attributes = Attributes{ | |
| 35557 | .lib_function_without_prefix = true, | |
| 35558 | .const_without_errno_and_fp_exceptions = true, | |
| 35559 | }; | |
| 35560 | }; | |
| 35561 | ||
| 35562 | pub const tolower = struct { | |
| 35563 | const param_str = "ii"; | |
| 35564 | const header = .ctype; | |
| 35565 | const attributes = Attributes{ | |
| 35566 | .pure = true, | |
| 35567 | .lib_function_without_prefix = true, | |
| 35568 | }; | |
| 35569 | }; | |
| 35570 | ||
| 35571 | pub const toupper = struct { | |
| 35572 | const param_str = "ii"; | |
| 35573 | const header = .ctype; | |
| 35574 | const attributes = Attributes{ | |
| 35575 | .pure = true, | |
| 35576 | .lib_function_without_prefix = true, | |
| 35577 | }; | |
| 35578 | }; | |
| 35579 | ||
| 35580 | pub const trunc = struct { | |
| 35581 | const param_str = "dd"; | |
| 35582 | const header = .math; | |
| 35583 | const attributes = Attributes{ | |
| 35584 | .@"const" = true, | |
| 35585 | .lib_function_without_prefix = true, | |
| 35586 | }; | |
| 35587 | }; | |
| 35588 | ||
| 35589 | pub const truncf = struct { | |
| 35590 | const param_str = "ff"; | |
| 35591 | const header = .math; | |
| 35592 | const attributes = Attributes{ | |
| 35593 | .@"const" = true, | |
| 35594 | .lib_function_without_prefix = true, | |
| 35595 | }; | |
| 35596 | }; | |
| 35597 | ||
| 35598 | pub const truncl = struct { | |
| 35599 | const param_str = "LdLd"; | |
| 35600 | const header = .math; | |
| 35601 | const attributes = Attributes{ | |
| 35602 | .@"const" = true, | |
| 35603 | .lib_function_without_prefix = true, | |
| 35604 | }; | |
| 35605 | }; | |
| 35606 | ||
| 35607 | pub const va_copy = struct { | |
| 35608 | const param_str = "vAA"; | |
| 35609 | const header = .stdarg; | |
| 35610 | const attributes = Attributes{ | |
| 35611 | .lib_function_without_prefix = true, | |
| 35612 | }; | |
| 35613 | }; | |
| 35614 | ||
| 35615 | pub const va_end = struct { | |
| 35616 | const param_str = "vA"; | |
| 35617 | const header = .stdarg; | |
| 35618 | const attributes = Attributes{ | |
| 35619 | .lib_function_without_prefix = true, | |
| 35620 | }; | |
| 35621 | }; | |
| 35622 | ||
| 35623 | pub const va_start = struct { | |
| 35624 | const param_str = "vA."; | |
| 35625 | const header = .stdarg; | |
| 35626 | const attributes = Attributes{ | |
| 35627 | .lib_function_without_prefix = true, | |
| 35628 | }; | |
| 35629 | }; | |
| 35630 | ||
| 35631 | pub const vfork = struct { | |
| 35632 | const param_str = "p"; | |
| 35633 | const header = .unistd; | |
| 35634 | const attributes = Attributes{ | |
| 35635 | .allow_type_mismatch = true, | |
| 35636 | .lib_function_without_prefix = true, | |
| 35637 | .returns_twice = true, | |
| 35638 | }; | |
| 35639 | }; | |
| 35640 | ||
| 35641 | pub const vfprintf = struct { | |
| 35642 | const param_str = "iP*cC*a"; | |
| 35643 | const header = .stdio; | |
| 35644 | const attributes = Attributes{ | |
| 35645 | .lib_function_without_prefix = true, | |
| 35646 | .format_kind = .vprintf, | |
| 35647 | .format_string_position = 1, | |
| 35648 | }; | |
| 35649 | }; | |
| 35650 | ||
| 35651 | pub const vfscanf = struct { | |
| 35652 | const param_str = "iP*RcC*Ra"; | |
| 35653 | const header = .stdio; | |
| 35654 | const attributes = Attributes{ | |
| 35655 | .lib_function_without_prefix = true, | |
| 35656 | .format_kind = .vscanf, | |
| 35657 | .format_string_position = 1, | |
| 35658 | }; | |
| 35659 | }; | |
| 35660 | ||
| 35661 | pub const vprintf = struct { | |
| 35662 | const param_str = "icC*a"; | |
| 35663 | const header = .stdio; | |
| 35664 | const attributes = Attributes{ | |
| 35665 | .lib_function_without_prefix = true, | |
| 35666 | .format_kind = .vprintf, | |
| 35667 | .format_string_position = 0, | |
| 35668 | }; | |
| 35669 | }; | |
| 35670 | ||
| 35671 | pub const vscanf = struct { | |
| 35672 | const param_str = "icC*Ra"; | |
| 35673 | const header = .stdio; | |
| 35674 | const attributes = Attributes{ | |
| 35675 | .lib_function_without_prefix = true, | |
| 35676 | .format_kind = .vscanf, | |
| 35677 | .format_string_position = 0, | |
| 35678 | }; | |
| 35679 | }; | |
| 35680 | ||
| 35681 | pub const vsnprintf = struct { | |
| 35682 | const param_str = "ic*zcC*a"; | |
| 35683 | const header = .stdio; | |
| 35684 | const attributes = Attributes{ | |
| 35685 | .lib_function_without_prefix = true, | |
| 35686 | .format_kind = .vprintf, | |
| 35687 | .format_string_position = 2, | |
| 35688 | }; | |
| 35689 | }; | |
| 35690 | ||
| 35691 | pub const vsprintf = struct { | |
| 35692 | const param_str = "ic*cC*a"; | |
| 35693 | const header = .stdio; | |
| 35694 | const attributes = Attributes{ | |
| 35695 | .lib_function_without_prefix = true, | |
| 35696 | .format_kind = .vprintf, | |
| 35697 | .format_string_position = 1, | |
| 35698 | }; | |
| 35699 | }; | |
| 35700 | ||
| 35701 | pub const vsscanf = struct { | |
| 35702 | const param_str = "icC*RcC*Ra"; | |
| 35703 | const header = .stdio; | |
| 35704 | const attributes = Attributes{ | |
| 35705 | .lib_function_without_prefix = true, | |
| 35706 | .format_kind = .vscanf, | |
| 35707 | .format_string_position = 1, | |
| 35708 | }; | |
| 35709 | }; | |
| 35710 | ||
| 35711 | pub const wcschr = struct { | |
| 35712 | const param_str = "w*wC*w"; | |
| 35713 | const header = .wchar; | |
| 35714 | const attributes = Attributes{ | |
| 35715 | .lib_function_without_prefix = true, | |
| 35716 | .const_evaluable = true, | |
| 35717 | }; | |
| 35718 | }; | |
| 35719 | ||
| 35720 | pub const wcscmp = struct { | |
| 35721 | const param_str = "iwC*wC*"; | |
| 35722 | const header = .wchar; | |
| 35723 | const attributes = Attributes{ | |
| 35724 | .lib_function_without_prefix = true, | |
| 35725 | .const_evaluable = true, | |
| 35726 | }; | |
| 35727 | }; | |
| 35728 | ||
| 35729 | pub const wcslen = struct { | |
| 35730 | const param_str = "zwC*"; | |
| 35731 | const header = .wchar; | |
| 35732 | const attributes = Attributes{ | |
| 35733 | .lib_function_without_prefix = true, | |
| 35734 | .const_evaluable = true, | |
| 35735 | }; | |
| 35736 | }; | |
| 35737 | ||
| 35738 | pub const wcsncmp = struct { | |
| 35739 | const param_str = "iwC*wC*z"; | |
| 35740 | const header = .wchar; | |
| 35741 | const attributes = Attributes{ | |
| 35742 | .lib_function_without_prefix = true, | |
| 35743 | .const_evaluable = true, | |
| 35744 | }; | |
| 35745 | }; | |
| 35746 | ||
| 35747 | pub const wmemchr = struct { | |
| 35748 | const param_str = "w*wC*wz"; | |
| 35749 | const header = .wchar; | |
| 35750 | const attributes = Attributes{ | |
| 35751 | .lib_function_without_prefix = true, | |
| 35752 | .const_evaluable = true, | |
| 35753 | }; | |
| 35754 | }; | |
| 35755 | ||
| 35756 | pub const wmemcmp = struct { | |
| 35757 | const param_str = "iwC*wC*z"; | |
| 35758 | const header = .wchar; | |
| 35759 | const attributes = Attributes{ | |
| 35760 | .lib_function_without_prefix = true, | |
| 35761 | .const_evaluable = true, | |
| 35762 | }; | |
| 35763 | }; | |
| 35764 | ||
| 35765 | pub const wmemcpy = struct { | |
| 35766 | const param_str = "w*w*wC*z"; | |
| 35767 | const header = .wchar; | |
| 35768 | const attributes = Attributes{ | |
| 35769 | .lib_function_without_prefix = true, | |
| 35770 | .const_evaluable = true, | |
| 35771 | }; | |
| 35772 | }; | |
| 35773 | ||
| 35774 | pub const wmemmove = struct { | |
| 35775 | const param_str = "w*w*wC*z"; | |
| 35776 | const header = .wchar; | |
| 35777 | const attributes = Attributes{ | |
| 35778 | .lib_function_without_prefix = true, | |
| 35779 | .const_evaluable = true, | |
| 35780 | }; | |
| 35781 | }; | |
| 35782 | }; | |
| 35783 | pub const MaxParamCount = 12; |
deps/aro/builtins/Properties.zig created+138| ... | ... | @@ -0,0 +1,138 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | const Properties = @This(); | |
| 4 | ||
| 5 | language: Language, | |
| 6 | attributes: Attributes, | |
| 7 | header: Header, | |
| 8 | target_set: TargetSet, | |
| 9 | ||
| 10 | /// Header which must be included for a builtin to be available | |
| 11 | pub const Header = enum { | |
| 12 | none, | |
| 13 | /// stdio.h | |
| 14 | stdio, | |
| 15 | /// stdlib.h | |
| 16 | stdlib, | |
| 17 | /// setjmpex.h | |
| 18 | setjmpex, | |
| 19 | /// stdarg.h | |
| 20 | stdarg, | |
| 21 | /// string.h | |
| 22 | string, | |
| 23 | /// ctype.h | |
| 24 | ctype, | |
| 25 | /// wchar.h | |
| 26 | wchar, | |
| 27 | /// setjmp.h | |
| 28 | setjmp, | |
| 29 | /// malloc.h | |
| 30 | malloc, | |
| 31 | /// strings.h | |
| 32 | strings, | |
| 33 | /// unistd.h | |
| 34 | unistd, | |
| 35 | /// pthread.h | |
| 36 | pthread, | |
| 37 | /// math.h | |
| 38 | math, | |
| 39 | /// complex.h | |
| 40 | complex, | |
| 41 | /// Blocks.h | |
| 42 | blocks, | |
| 43 | }; | |
| 44 | ||
| 45 | /// Languages in which a builtin is available | |
| 46 | pub const Language = enum { | |
| 47 | all_languages, | |
| 48 | all_ms_languages, | |
| 49 | all_gnu_languages, | |
| 50 | gnu_lang, | |
| 51 | }; | |
| 52 | ||
| 53 | pub const Attributes = packed struct { | |
| 54 | /// Function does not return | |
| 55 | noreturn: bool = false, | |
| 56 | ||
| 57 | /// Function has no side effects | |
| 58 | pure: bool = false, | |
| 59 | ||
| 60 | /// Function has no side effects and does not read memory | |
| 61 | @"const": bool = false, | |
| 62 | ||
| 63 | /// Signature is meaningless; use custom typecheck | |
| 64 | custom_typecheck: bool = false, | |
| 65 | ||
| 66 | /// A declaration of this builtin should be recognized even if the type doesn't match the specified signature. | |
| 67 | allow_type_mismatch: bool = false, | |
| 68 | ||
| 69 | /// this is a libc/libm function with a '__builtin_' prefix added. | |
| 70 | lib_function_with_builtin_prefix: bool = false, | |
| 71 | ||
| 72 | /// this is a libc/libm function without a '__builtin_' prefix. This builtin is disableable by '-fno-builtin-foo' | |
| 73 | lib_function_without_prefix: bool = false, | |
| 74 | ||
| 75 | /// Function returns twice (e.g. setjmp) | |
| 76 | returns_twice: bool = false, | |
| 77 | ||
| 78 | /// Nature of the format string passed to this function | |
| 79 | format_kind: enum(u3) { | |
| 80 | /// Does not take a format string | |
| 81 | none, | |
| 82 | /// this is a printf-like function whose Nth argument is the format string | |
| 83 | printf, | |
| 84 | /// function is like vprintf in that it accepts its arguments as a va_list rather than through an ellipsis | |
| 85 | vprintf, | |
| 86 | /// this is a scanf-like function whose Nth argument is the format string | |
| 87 | scanf, | |
| 88 | /// the function is like vscanf in that it accepts its arguments as a va_list rather than through an ellipsis | |
| 89 | vscanf, | |
| 90 | } = .none, | |
| 91 | ||
| 92 | /// Position of format string argument. Only meaningful if format_kind is not .none | |
| 93 | format_string_position: u5 = 0, | |
| 94 | ||
| 95 | /// if false, arguments are not evaluated | |
| 96 | eval_args: bool = true, | |
| 97 | ||
| 98 | /// no side effects and does not read memory, but only when -fno-math-errno and FP exceptions are ignored | |
| 99 | const_without_errno_and_fp_exceptions: bool = false, | |
| 100 | ||
| 101 | /// no side effects and does not read memory, but only when FP exceptions are ignored | |
| 102 | const_without_fp_exceptions: bool = false, | |
| 103 | ||
| 104 | /// this function can be constant evaluated by the frontend | |
| 105 | const_evaluable: bool = false, | |
| 106 | }; | |
| 107 | ||
| 108 | pub const Target = enum { | |
| 109 | /// Supported on all targets | |
| 110 | basic, | |
| 111 | aarch64, | |
| 112 | aarch64_neon_sve_bridge, | |
| 113 | aarch64_neon_sve_bridge_cg, | |
| 114 | amdgpu, | |
| 115 | arm, | |
| 116 | bpf, | |
| 117 | hexagon, | |
| 118 | hexagon_dep, | |
| 119 | hexagon_map_custom_dep, | |
| 120 | loong_arch, | |
| 121 | mips, | |
| 122 | neon, | |
| 123 | nvptx, | |
| 124 | ppc, | |
| 125 | riscv, | |
| 126 | riscv_vector, | |
| 127 | sve, | |
| 128 | systemz, | |
| 129 | ve, | |
| 130 | vevl_gen, | |
| 131 | webassembly, | |
| 132 | x86, | |
| 133 | x86_64, | |
| 134 | xcore, | |
| 135 | }; | |
| 136 | ||
| 137 | /// Targets for which a builtin is enabled | |
| 138 | pub const TargetSet = std.enums.EnumSet(Target); |
deps/aro/builtins/TypeDescription.zig created+277| ... | ... | @@ -0,0 +1,277 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | const TypeDescription = @This(); | |
| 4 | ||
| 5 | prefix: []const Prefix, | |
| 6 | spec: Spec, | |
| 7 | suffix: []const Suffix, | |
| 8 | ||
| 9 | pub const Component = union(enum) { | |
| 10 | prefix: Prefix, | |
| 11 | spec: Spec, | |
| 12 | suffix: Suffix, | |
| 13 | }; | |
| 14 | ||
| 15 | pub const ComponentIterator = struct { | |
| 16 | str: []const u8, | |
| 17 | idx: usize, | |
| 18 | ||
| 19 | pub fn init(str: []const u8) ComponentIterator { | |
| 20 | return .{ | |
| 21 | .str = str, | |
| 22 | .idx = 0, | |
| 23 | }; | |
| 24 | } | |
| 25 | ||
| 26 | pub fn peek(self: *ComponentIterator) ?Component { | |
| 27 | const idx = self.idx; | |
| 28 | defer self.idx = idx; | |
| 29 | return self.next(); | |
| 30 | } | |
| 31 | ||
| 32 | pub fn next(self: *ComponentIterator) ?Component { | |
| 33 | if (self.idx == self.str.len) return null; | |
| 34 | const c = self.str[self.idx]; | |
| 35 | self.idx += 1; | |
| 36 | switch (c) { | |
| 37 | 'L' => { | |
| 38 | if (self.str[self.idx] != 'L') return .{ .prefix = .L }; | |
| 39 | self.idx += 1; | |
| 40 | if (self.str[self.idx] != 'L') return .{ .prefix = .LL }; | |
| 41 | self.idx += 1; | |
| 42 | return .{ .prefix = .LLL }; | |
| 43 | }, | |
| 44 | 'Z' => return .{ .prefix = .Z }, | |
| 45 | 'W' => return .{ .prefix = .W }, | |
| 46 | 'N' => return .{ .prefix = .N }, | |
| 47 | 'O' => return .{ .prefix = .O }, | |
| 48 | 'S' => { | |
| 49 | if (self.str[self.idx] == 'J') { | |
| 50 | self.idx += 1; | |
| 51 | return .{ .spec = .SJ }; | |
| 52 | } | |
| 53 | return .{ .prefix = .S }; | |
| 54 | }, | |
| 55 | 'U' => return .{ .prefix = .U }, | |
| 56 | 'I' => return .{ .prefix = .I }, | |
| 57 | ||
| 58 | 'v' => return .{ .spec = .v }, | |
| 59 | 'b' => return .{ .spec = .b }, | |
| 60 | 'c' => return .{ .spec = .c }, | |
| 61 | 's' => return .{ .spec = .s }, | |
| 62 | 'i' => return .{ .spec = .i }, | |
| 63 | 'h' => return .{ .spec = .h }, | |
| 64 | 'x' => return .{ .spec = .x }, | |
| 65 | 'y' => return .{ .spec = .y }, | |
| 66 | 'f' => return .{ .spec = .f }, | |
| 67 | 'd' => return .{ .spec = .d }, | |
| 68 | 'z' => return .{ .spec = .z }, | |
| 69 | 'w' => return .{ .spec = .w }, | |
| 70 | 'F' => return .{ .spec = .F }, | |
| 71 | 'a' => return .{ .spec = .a }, | |
| 72 | 'A' => return .{ .spec = .A }, | |
| 73 | 'V', 'q', 'E' => { | |
| 74 | const start = self.idx; | |
| 75 | while (std.ascii.isDigit(self.str[self.idx])) : (self.idx += 1) {} | |
| 76 | const count = std.fmt.parseUnsigned(u32, self.str[start..self.idx], 10) catch unreachable; | |
| 77 | return switch (c) { | |
| 78 | 'V' => .{ .spec = .{ .V = count } }, | |
| 79 | 'q' => .{ .spec = .{ .q = count } }, | |
| 80 | 'E' => .{ .spec = .{ .E = count } }, | |
| 81 | else => unreachable, | |
| 82 | }; | |
| 83 | }, | |
| 84 | 'X' => { | |
| 85 | defer self.idx += 1; | |
| 86 | switch (self.str[self.idx]) { | |
| 87 | 'f' => return .{ .spec = .{ .X = .float } }, | |
| 88 | 'd' => return .{ .spec = .{ .X = .double } }, | |
| 89 | 'L' => { | |
| 90 | self.idx += 1; | |
| 91 | return .{ .spec = .{ .X = .longdouble } }; | |
| 92 | }, | |
| 93 | else => unreachable, | |
| 94 | } | |
| 95 | }, | |
| 96 | 'Y' => return .{ .spec = .Y }, | |
| 97 | 'P' => return .{ .spec = .P }, | |
| 98 | 'J' => return .{ .spec = .J }, | |
| 99 | 'K' => return .{ .spec = .K }, | |
| 100 | 'p' => return .{ .spec = .p }, | |
| 101 | '.' => { | |
| 102 | // can only appear at end of param string; indicates varargs function | |
| 103 | std.debug.assert(self.idx == self.str.len); | |
| 104 | return null; | |
| 105 | }, | |
| 106 | '!' => { | |
| 107 | std.debug.assert(self.str.len == 1); | |
| 108 | return .{ .spec = .@"!" }; | |
| 109 | }, | |
| 110 | ||
| 111 | '*' => { | |
| 112 | if (self.idx < self.str.len and std.ascii.isDigit(self.str[self.idx])) { | |
| 113 | defer self.idx += 1; | |
| 114 | const addr_space = self.str[self.idx] - '0'; | |
| 115 | return .{ .suffix = .{ .@"*" = addr_space } }; | |
| 116 | } else { | |
| 117 | return .{ .suffix = .{ .@"*" = null } }; | |
| 118 | } | |
| 119 | }, | |
| 120 | 'C' => return .{ .suffix = .C }, | |
| 121 | 'D' => return .{ .suffix = .D }, | |
| 122 | 'R' => return .{ .suffix = .R }, | |
| 123 | else => unreachable, | |
| 124 | } | |
| 125 | return null; | |
| 126 | } | |
| 127 | }; | |
| 128 | ||
| 129 | pub const TypeIterator = struct { | |
| 130 | param_str: []const u8, | |
| 131 | prefix: [4]Prefix, | |
| 132 | spec: Spec, | |
| 133 | suffix: [4]Suffix, | |
| 134 | idx: usize, | |
| 135 | ||
| 136 | pub fn init(param_str: []const u8) TypeIterator { | |
| 137 | return .{ | |
| 138 | .param_str = param_str, | |
| 139 | .prefix = undefined, | |
| 140 | .spec = undefined, | |
| 141 | .suffix = undefined, | |
| 142 | .idx = 0, | |
| 143 | }; | |
| 144 | } | |
| 145 | ||
| 146 | /// Returned `TypeDescription` contains fields which are slices into the underlying `TypeIterator` | |
| 147 | /// The returned value is invalidated when `.next()` is called again or the TypeIterator goes out | |
| 148 | // of scope. | |
| 149 | pub fn next(self: *TypeIterator) ?TypeDescription { | |
| 150 | var it = ComponentIterator.init(self.param_str[self.idx..]); | |
| 151 | defer self.idx += it.idx; | |
| 152 | ||
| 153 | var prefix_count: usize = 0; | |
| 154 | var maybe_spec: ?Spec = null; | |
| 155 | var suffix_count: usize = 0; | |
| 156 | while (it.peek()) |component| { | |
| 157 | switch (component) { | |
| 158 | .prefix => |prefix| { | |
| 159 | if (maybe_spec != null) break; | |
| 160 | self.prefix[prefix_count] = prefix; | |
| 161 | prefix_count += 1; | |
| 162 | }, | |
| 163 | .spec => |spec| { | |
| 164 | if (maybe_spec != null) break; | |
| 165 | maybe_spec = spec; | |
| 166 | }, | |
| 167 | .suffix => |suffix| { | |
| 168 | std.debug.assert(maybe_spec != null); | |
| 169 | self.suffix[suffix_count] = suffix; | |
| 170 | suffix_count += 1; | |
| 171 | }, | |
| 172 | } | |
| 173 | _ = it.next(); | |
| 174 | } | |
| 175 | if (maybe_spec) |spec| { | |
| 176 | return TypeDescription{ | |
| 177 | .prefix = self.prefix[0..prefix_count], | |
| 178 | .spec = spec, | |
| 179 | .suffix = self.suffix[0..suffix_count], | |
| 180 | }; | |
| 181 | } | |
| 182 | return null; | |
| 183 | } | |
| 184 | }; | |
| 185 | ||
| 186 | const Prefix = enum { | |
| 187 | /// long (e.g. Li for 'long int', Ld for 'long double') | |
| 188 | L, | |
| 189 | /// long long (e.g. LLi for 'long long int', LLd for __float128) | |
| 190 | LL, | |
| 191 | /// __int128_t (e.g. LLLi) | |
| 192 | LLL, | |
| 193 | /// int32_t (require a native 32-bit integer type on the target) | |
| 194 | Z, | |
| 195 | /// int64_t (require a native 64-bit integer type on the target) | |
| 196 | W, | |
| 197 | /// 'int' size if target is LP64, 'L' otherwise. | |
| 198 | N, | |
| 199 | /// long for OpenCL targets, long long otherwise. | |
| 200 | O, | |
| 201 | /// signed | |
| 202 | S, | |
| 203 | /// unsigned | |
| 204 | U, | |
| 205 | /// Required to constant fold to an integer constant expression. | |
| 206 | I, | |
| 207 | }; | |
| 208 | ||
| 209 | const Spec = union(enum) { | |
| 210 | /// void | |
| 211 | v, | |
| 212 | /// boolean | |
| 213 | b, | |
| 214 | /// char | |
| 215 | c, | |
| 216 | /// short | |
| 217 | s, | |
| 218 | /// int | |
| 219 | i, | |
| 220 | /// half (__fp16, OpenCL) | |
| 221 | h, | |
| 222 | /// half (_Float16) | |
| 223 | x, | |
| 224 | /// half (__bf16) | |
| 225 | y, | |
| 226 | /// float | |
| 227 | f, | |
| 228 | /// double | |
| 229 | d, | |
| 230 | /// size_t | |
| 231 | z, | |
| 232 | /// wchar_t | |
| 233 | w, | |
| 234 | /// constant CFString | |
| 235 | F, | |
| 236 | /// __builtin_va_list | |
| 237 | a, | |
| 238 | /// "reference" to __builtin_va_list | |
| 239 | A, | |
| 240 | /// Vector, followed by the number of elements and the base type. | |
| 241 | V: u32, | |
| 242 | /// Scalable vector, followed by the number of elements and the base type. | |
| 243 | q: u32, | |
| 244 | /// ext_vector, followed by the number of elements and the base type. | |
| 245 | E: u32, | |
| 246 | /// _Complex, followed by the base type. | |
| 247 | X: enum { | |
| 248 | float, | |
| 249 | double, | |
| 250 | longdouble, | |
| 251 | }, | |
| 252 | /// ptrdiff_t | |
| 253 | Y, | |
| 254 | /// FILE | |
| 255 | P, | |
| 256 | /// jmp_buf | |
| 257 | J, | |
| 258 | /// sigjmp_buf | |
| 259 | SJ, | |
| 260 | /// ucontext_t | |
| 261 | K, | |
| 262 | /// pid_t | |
| 263 | p, | |
| 264 | /// Used to indicate a builtin with target-dependent param types. Must appear by itself | |
| 265 | @"!", | |
| 266 | }; | |
| 267 | ||
| 268 | const Suffix = union(enum) { | |
| 269 | /// pointer (optionally followed by an address space number,if no address space is specified than any address space will be accepted) | |
| 270 | @"*": ?u8, | |
| 271 | /// const | |
| 272 | C, | |
| 273 | /// volatile | |
| 274 | D, | |
| 275 | /// restrict | |
| 276 | R, | |
| 277 | }; |
deps/aro/codegen/x86_64.zig created+221| ... | ... | @@ -0,0 +1,221 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Codegen = @import("../Codegen_legacy.zig"); | |
| 3 | const Tree = @import("../Tree.zig"); | |
| 4 | const NodeIndex = Tree.NodeIndex; | |
| 5 | const x86_64 = @import("zig").codegen.x86_64; | |
| 6 | const Register = x86_64.Register; | |
| 7 | const RegisterManager = @import("zig").RegisterManager; | |
| 8 | ||
| 9 | const Fn = @This(); | |
| 10 | ||
| 11 | const Value = union(enum) { | |
| 12 | symbol: []const u8, | |
| 13 | immediate: i64, | |
| 14 | register: Register, | |
| 15 | none, | |
| 16 | }; | |
| 17 | ||
| 18 | register_manager: RegisterManager(Fn, Register, &x86_64.callee_preserved_regs) = .{}, | |
| 19 | data: *std.ArrayList(u8), | |
| 20 | c: *Codegen, | |
| 21 | ||
| 22 | pub fn deinit(func: *Fn) void { | |
| 23 | func.* = undefined; | |
| 24 | } | |
| 25 | ||
| 26 | pub fn genFn(c: *Codegen, decl: NodeIndex, data: *std.ArrayList(u8)) Codegen.Error!void { | |
| 27 | var func = Fn{ .data = data, .c = c }; | |
| 28 | defer func.deinit(); | |
| 29 | ||
| 30 | // function prologue | |
| 31 | try func.data.appendSlice(&.{ | |
| 32 | 0x55, // push rbp | |
| 33 | 0x48, 0x89, 0xe5, // mov rbp,rsp | |
| 34 | }); | |
| 35 | _ = try func.genNode(c.node_data[@intFromEnum(decl)].decl.node); | |
| 36 | // all functions are guaranteed to end in a return statement so no extra work required here | |
| 37 | } | |
| 38 | ||
| 39 | pub fn spillInst(f: *Fn, reg: Register, inst: u32) !void { | |
| 40 | _ = inst; | |
| 41 | _ = reg; | |
| 42 | _ = f; | |
| 43 | } | |
| 44 | ||
| 45 | fn setReg(func: *Fn, val: Value, reg: Register) !void { | |
| 46 | switch (val) { | |
| 47 | .none => unreachable, | |
| 48 | .symbol => |sym| { | |
| 49 | // lea address with 0 and add relocation | |
| 50 | const encoder = try x86_64.Encoder.init(func.data, 8); | |
| 51 | encoder.rex(.{ .w = true }); | |
| 52 | encoder.opcode_1byte(0x8D); | |
| 53 | encoder.modRm_RIPDisp32(reg.low_id()); | |
| 54 | ||
| 55 | const offset = func.data.items.len; | |
| 56 | encoder.imm32(0); | |
| 57 | ||
| 58 | try func.c.obj.addRelocation(sym, .func, offset, -4); | |
| 59 | }, | |
| 60 | .immediate => |x| if (x == 0) { | |
| 61 | // 32-bit moves zero-extend to 64-bit, so xoring the 32-bit | |
| 62 | // register is the fastest way to zero a register. | |
| 63 | // The encoding for `xor r32, r32` is `0x31 /r`. | |
| 64 | const encoder = try x86_64.Encoder.init(func.data, 3); | |
| 65 | ||
| 66 | // If we're accessing e.g. r8d, we need to use a REX prefix before the actual operation. Since | |
| 67 | // this is a 32-bit operation, the W flag is set to zero. X is also zero, as we're not using a SIB. | |
| 68 | // Both R and B are set, as we're extending, in effect, the register bits *and* the operand. | |
| 69 | encoder.rex(.{ .r = reg.isExtended(), .b = reg.isExtended() }); | |
| 70 | encoder.opcode_1byte(0x31); | |
| 71 | // Section 3.1.1.1 of the Intel x64 Manual states that "/r indicates that the | |
| 72 | // ModR/M byte of the instruction contains a register operand and an r/m operand." | |
| 73 | encoder.modRm_direct(reg.low_id(), reg.low_id()); | |
| 74 | } else if (x <= std.math.maxInt(i32)) { | |
| 75 | // Next best case: if we set the lower four bytes, the upper four will be zeroed. | |
| 76 | // | |
| 77 | // The encoding for `mov IMM32 -> REG` is (0xB8 + R) IMM. | |
| 78 | ||
| 79 | const encoder = try x86_64.Encoder.init(func.data, 6); | |
| 80 | // Just as with XORing, we need a REX prefix. This time though, we only | |
| 81 | // need the B bit set, as we're extending the opcode's register field, | |
| 82 | // and there is no Mod R/M byte. | |
| 83 | encoder.rex(.{ .b = reg.isExtended() }); | |
| 84 | encoder.opcode_withReg(0xB8, reg.low_id()); | |
| 85 | ||
| 86 | // no ModR/M byte | |
| 87 | ||
| 88 | // IMM | |
| 89 | encoder.imm32(@intCast(x)); | |
| 90 | } else { | |
| 91 | // Worst case: we need to load the 64-bit register with the IMM. GNU's assemblers calls | |
| 92 | // this `movabs`, though this is officially just a different variant of the plain `mov` | |
| 93 | // instruction. | |
| 94 | // | |
| 95 | // This encoding is, in fact, the *same* as the one used for 32-bit loads. The only | |
| 96 | // difference is that we set REX.W before the instruction, which extends the load to | |
| 97 | // 64-bit and uses the full bit-width of the register. | |
| 98 | { | |
| 99 | const encoder = try x86_64.Encoder.init(func.data, 10); | |
| 100 | encoder.rex(.{ .w = true, .b = reg.isExtended() }); | |
| 101 | encoder.opcode_withReg(0xB8, reg.low_id()); | |
| 102 | encoder.imm64(@bitCast(x)); | |
| 103 | } | |
| 104 | }, | |
| 105 | .register => |src_reg| { | |
| 106 | // If the registers are the same, nothing to do. | |
| 107 | if (src_reg.id() == reg.id()) | |
| 108 | return; | |
| 109 | ||
| 110 | // This is a variant of 8B /r. | |
| 111 | const encoder = try x86_64.Encoder.init(func.data, 3); | |
| 112 | encoder.rex(.{ | |
| 113 | .w = true, | |
| 114 | .r = reg.isExtended(), | |
| 115 | .b = src_reg.isExtended(), | |
| 116 | }); | |
| 117 | encoder.opcode_1byte(0x8B); | |
| 118 | encoder.modRm_direct(reg.low_id(), src_reg.low_id()); | |
| 119 | }, | |
| 120 | } | |
| 121 | } | |
| 122 | ||
| 123 | fn genNode(func: *Fn, node: NodeIndex) Codegen.Error!Value { | |
| 124 | if (func.c.tree.value_map.get(node)) |some| { | |
| 125 | if (some.tag == .int) | |
| 126 | return Value{ .immediate = @bitCast(some.data.int) }; | |
| 127 | } | |
| 128 | ||
| 129 | const data = func.c.node_data[@intFromEnum(node)]; | |
| 130 | switch (func.c.node_tag[@intFromEnum(node)]) { | |
| 131 | .static_assert => return Value{ .none = {} }, | |
| 132 | .compound_stmt_two => { | |
| 133 | if (data.bin.lhs != .none) _ = try func.genNode(data.bin.lhs); | |
| 134 | if (data.bin.rhs != .none) _ = try func.genNode(data.bin.rhs); | |
| 135 | return Value{ .none = {} }; | |
| 136 | }, | |
| 137 | .compound_stmt => { | |
| 138 | for (func.c.tree.data[data.range.start..data.range.end]) |stmt| { | |
| 139 | _ = try func.genNode(stmt); | |
| 140 | } | |
| 141 | return Value{ .none = {} }; | |
| 142 | }, | |
| 143 | .call_expr_one => if (data.bin.rhs != .none) | |
| 144 | return func.genCall(data.bin.lhs, &.{data.bin.rhs}) | |
| 145 | else | |
| 146 | return func.genCall(data.bin.lhs, &.{}), | |
| 147 | .call_expr => return func.genCall(func.c.tree.data[data.range.start], func.c.tree.data[data.range.start + 1 .. data.range.end]), | |
| 148 | .explicit_cast, .implicit_cast => { | |
| 149 | switch (data.cast.kind) { | |
| 150 | .function_to_pointer, | |
| 151 | .array_to_pointer, | |
| 152 | => return func.genNode(data.cast.operand), // no-op | |
| 153 | else => return func.c.comp.diag.fatalNoSrc("TODO x86_64 genNode for cast {s}\n", .{@tagName(data.cast.kind)}), | |
| 154 | } | |
| 155 | }, | |
| 156 | .decl_ref_expr => { | |
| 157 | // TODO locals and arguments | |
| 158 | return Value{ .symbol = func.c.tree.tokSlice(data.decl_ref) }; | |
| 159 | }, | |
| 160 | .return_stmt => { | |
| 161 | const value = try func.genNode(data.un); | |
| 162 | try func.setReg(value, x86_64.c_abi_int_return_regs[0]); | |
| 163 | try func.data.appendSlice(&.{ | |
| 164 | 0x5d, // pop rbp | |
| 165 | 0xc3, // ret | |
| 166 | }); | |
| 167 | return Value{ .none = {} }; | |
| 168 | }, | |
| 169 | .implicit_return => { | |
| 170 | try func.setReg(.{ .immediate = 0 }, x86_64.c_abi_int_return_regs[0]); | |
| 171 | try func.data.appendSlice(&.{ | |
| 172 | 0x5d, // pop rbp | |
| 173 | 0xc3, // ret | |
| 174 | }); | |
| 175 | return Value{ .none = {} }; | |
| 176 | }, | |
| 177 | .int_literal => return Value{ .immediate = @bitCast(data.int) }, | |
| 178 | .string_literal_expr => { | |
| 179 | const range = func.c.tree.value_map.get(node).?.data.bytes; | |
| 180 | const str_bytes = range.slice(func.c.tree.strings); | |
| 181 | const section = try func.c.obj.getSection(.strings); | |
| 182 | const start = section.items.len; | |
| 183 | try section.appendSlice(str_bytes); | |
| 184 | const symbol_name = try func.c.obj.declareSymbol(.strings, null, .Internal, .variable, start, str_bytes.len); | |
| 185 | return Value{ .symbol = symbol_name }; | |
| 186 | }, | |
| 187 | else => return func.c.comp.diag.fatalNoSrc("TODO x86_64 genNode {}\n", .{func.c.node_tag[@intFromEnum(node)]}), | |
| 188 | } | |
| 189 | } | |
| 190 | ||
| 191 | fn genCall(func: *Fn, lhs: NodeIndex, args: []const NodeIndex) Codegen.Error!Value { | |
| 192 | if (args.len > x86_64.c_abi_int_param_regs.len) | |
| 193 | return func.c.comp.diag.fatalNoSrc("TODO more than args {d}\n", .{x86_64.c_abi_int_param_regs.len}); | |
| 194 | ||
| 195 | const func_value = try func.genNode(lhs); | |
| 196 | for (args, 0..) |arg, i| { | |
| 197 | const value = try func.genNode(arg); | |
| 198 | try func.setReg(value, x86_64.c_abi_int_param_regs[i]); | |
| 199 | } | |
| 200 | ||
| 201 | switch (func_value) { | |
| 202 | .none => unreachable, | |
| 203 | .symbol => |sym| { | |
| 204 | const encoder = try x86_64.Encoder.init(func.data, 5); | |
| 205 | encoder.opcode_1byte(0xe8); | |
| 206 | ||
| 207 | const offset = func.data.items.len; | |
| 208 | encoder.imm32(0); | |
| 209 | ||
| 210 | try func.c.obj.addRelocation(sym, .func, offset, -4); | |
| 211 | }, | |
| 212 | .immediate => return func.c.comp.diag.fatalNoSrc("TODO call immediate\n", .{}), | |
| 213 | .register => return func.c.comp.diag.fatalNoSrc("TODO call reg\n", .{}), | |
| 214 | } | |
| 215 | return Value{ .register = x86_64.c_abi_int_return_regs[0] }; | |
| 216 | } | |
| 217 | ||
| 218 | pub fn genVar(c: *Codegen, decl: NodeIndex) Codegen.Error!void { | |
| 219 | _ = c; | |
| 220 | _ = decl; | |
| 221 | } |
deps/aro/features.zig created+76| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Compilation = @import("Compilation.zig"); | |
| 3 | const target_util = @import("target.zig"); | |
| 4 | ||
| 5 | /// Used to implement the __has_feature macro. | |
| 6 | pub fn hasFeature(comp: *Compilation, ext: []const u8) bool { | |
| 7 | const list = .{ | |
| 8 | .assume_nonnull = true, | |
| 9 | .attribute_analyzer_noreturn = true, | |
| 10 | .attribute_availability = true, | |
| 11 | .attribute_availability_with_message = true, | |
| 12 | .attribute_availability_app_extension = true, | |
| 13 | .attribute_availability_with_version_underscores = true, | |
| 14 | .attribute_availability_tvos = true, | |
| 15 | .attribute_availability_watchos = true, | |
| 16 | .attribute_availability_with_strict = true, | |
| 17 | .attribute_availability_with_replacement = true, | |
| 18 | .attribute_availability_in_templates = true, | |
| 19 | .attribute_availability_swift = true, | |
| 20 | .attribute_cf_returns_not_retained = true, | |
| 21 | .attribute_cf_returns_retained = true, | |
| 22 | .attribute_cf_returns_on_parameters = true, | |
| 23 | .attribute_deprecated_with_message = true, | |
| 24 | .attribute_deprecated_with_replacement = true, | |
| 25 | .attribute_ext_vector_type = true, | |
| 26 | .attribute_ns_returns_not_retained = true, | |
| 27 | .attribute_ns_returns_retained = true, | |
| 28 | .attribute_ns_consumes_self = true, | |
| 29 | .attribute_ns_consumed = true, | |
| 30 | .attribute_cf_consumed = true, | |
| 31 | .attribute_overloadable = true, | |
| 32 | .attribute_unavailable_with_message = true, | |
| 33 | .attribute_unused_on_fields = true, | |
| 34 | .attribute_diagnose_if_objc = true, | |
| 35 | .blocks = false, // TODO | |
| 36 | .c_thread_safety_attributes = true, | |
| 37 | .enumerator_attributes = true, | |
| 38 | .nullability = true, | |
| 39 | .nullability_on_arrays = true, | |
| 40 | .nullability_nullable_result = true, | |
| 41 | .c_alignas = comp.langopts.standard.atLeast(.c11), | |
| 42 | .c_alignof = comp.langopts.standard.atLeast(.c11), | |
| 43 | .c_atomic = comp.langopts.standard.atLeast(.c11), | |
| 44 | .c_generic_selections = comp.langopts.standard.atLeast(.c11), | |
| 45 | .c_static_assert = comp.langopts.standard.atLeast(.c11), | |
| 46 | .c_thread_local = comp.langopts.standard.atLeast(.c11) and target_util.isTlsSupported(comp.target), | |
| 47 | }; | |
| 48 | inline for (std.meta.fields(@TypeOf(list))) |f| { | |
| 49 | if (std.mem.eql(u8, f.name, ext)) return @field(list, f.name); | |
| 50 | } | |
| 51 | return false; | |
| 52 | } | |
| 53 | ||
| 54 | /// Used to implement the __has_extension macro. | |
| 55 | pub fn hasExtension(comp: *Compilation, ext: []const u8) bool { | |
| 56 | const list = .{ | |
| 57 | // C11 features | |
| 58 | .c_alignas = true, | |
| 59 | .c_alignof = true, | |
| 60 | .c_atomic = false, // TODO | |
| 61 | .c_generic_selections = true, | |
| 62 | .c_static_assert = true, | |
| 63 | .c_thread_local = target_util.isTlsSupported(comp.target), | |
| 64 | // misc | |
| 65 | .overloadable_unmarked = false, // TODO | |
| 66 | .statement_attributes_with_gnu_syntax = false, // TODO | |
| 67 | .gnu_asm = true, | |
| 68 | .gnu_asm_goto_with_outputs = true, | |
| 69 | .matrix_types = false, // TODO | |
| 70 | .matrix_types_scalar_division = false, // TODO | |
| 71 | }; | |
| 72 | inline for (std.meta.fields(@TypeOf(list))) |f| { | |
| 73 | if (std.mem.eql(u8, f.name, ext)) return @field(list, f.name); | |
| 74 | } | |
| 75 | return false; | |
| 76 | } |
deps/aro/lib.zig created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | /// Deprecated | |
| 2 | pub const Codegen = @import("Codegen_legacy.zig"); | |
| 3 | pub const CodeGen = @import("CodeGen.zig"); | |
| 4 | pub const Compilation = @import("Compilation.zig"); | |
| 5 | pub const Diagnostics = @import("Diagnostics.zig"); | |
| 6 | pub const Driver = @import("Driver.zig"); | |
| 7 | pub const Interner = @import("Interner.zig"); | |
| 8 | pub const Ir = @import("Ir.zig"); | |
| 9 | pub const Object = @import("Object.zig"); | |
| 10 | pub const Parser = @import("Parser.zig"); | |
| 11 | pub const Preprocessor = @import("Preprocessor.zig"); | |
| 12 | pub const Source = @import("Source.zig"); | |
| 13 | pub const Tokenizer = @import("Tokenizer.zig"); | |
| 14 | pub const Tree = @import("Tree.zig"); | |
| 15 | pub const Type = @import("Type.zig"); | |
| 16 | pub const TypeMapper = @import("StringInterner.zig").TypeMapper; | |
| 17 | pub const target_util = @import("target.zig"); | |
| 18 | ||
| 19 | pub const version_str = "0.0.0-dev"; | |
| 20 | pub const version = @import("std").SemanticVersion.parse(version_str) catch unreachable; | |
| 21 | ||
| 22 | pub const CallingConvention = enum { | |
| 23 | C, | |
| 24 | stdcall, | |
| 25 | thiscall, | |
| 26 | vectorcall, | |
| 27 | }; |
deps/aro/number_affixes.zig created+169| ... | ... | @@ -0,0 +1,169 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | ||
| 4 | pub const Prefix = enum(u8) { | |
| 5 | binary = 2, | |
| 6 | octal = 8, | |
| 7 | decimal = 10, | |
| 8 | hex = 16, | |
| 9 | ||
| 10 | pub fn digitAllowed(prefix: Prefix, c: u8) bool { | |
| 11 | return switch (c) { | |
| 12 | '0', '1' => true, | |
| 13 | '2'...'7' => prefix != .binary, | |
| 14 | '8'...'9' => prefix == .decimal or prefix == .hex, | |
| 15 | 'a'...'f', 'A'...'F' => prefix == .hex, | |
| 16 | else => false, | |
| 17 | }; | |
| 18 | } | |
| 19 | ||
| 20 | pub fn fromString(buf: []const u8) Prefix { | |
| 21 | if (buf.len == 1) return .decimal; | |
| 22 | // tokenizer enforces that first byte is a decimal digit or period | |
| 23 | switch (buf[0]) { | |
| 24 | '.', '1'...'9' => return .decimal, | |
| 25 | '0' => {}, | |
| 26 | else => unreachable, | |
| 27 | } | |
| 28 | switch (buf[1]) { | |
| 29 | 'x', 'X' => return if (buf.len == 2) .decimal else .hex, | |
| 30 | 'b', 'B' => return if (buf.len == 2) .decimal else .binary, | |
| 31 | else => { | |
| 32 | if (mem.indexOfAny(u8, buf, "eE.")) |_| { | |
| 33 | // This is a decimal floating point number that happens to start with zero | |
| 34 | return .decimal; | |
| 35 | } else if (Suffix.fromString(buf[1..], .int)) |_| { | |
| 36 | // This is `0` with a valid suffix | |
| 37 | return .decimal; | |
| 38 | } else { | |
| 39 | return .octal; | |
| 40 | } | |
| 41 | }, | |
| 42 | } | |
| 43 | } | |
| 44 | ||
| 45 | /// Length of this prefix as a string | |
| 46 | pub fn stringLen(prefix: Prefix) usize { | |
| 47 | return switch (prefix) { | |
| 48 | .binary => 2, | |
| 49 | .octal => 1, | |
| 50 | .decimal => 0, | |
| 51 | .hex => 2, | |
| 52 | }; | |
| 53 | } | |
| 54 | }; | |
| 55 | ||
| 56 | pub const Suffix = enum { | |
| 57 | // zig fmt: off | |
| 58 | ||
| 59 | // int and imaginary int | |
| 60 | None, I, | |
| 61 | ||
| 62 | // unsigned real integers | |
| 63 | U, UL, ULL, | |
| 64 | ||
| 65 | // unsigned imaginary integers | |
| 66 | IU, IUL, IULL, | |
| 67 | ||
| 68 | // long or long double, real and imaginary | |
| 69 | L, IL, | |
| 70 | ||
| 71 | // long long and imaginary long long | |
| 72 | LL, ILL, | |
| 73 | ||
| 74 | // float and imaginary float | |
| 75 | F, IF, | |
| 76 | ||
| 77 | // _Float16 | |
| 78 | F16, | |
| 79 | ||
| 80 | // Imaginary _Bitint | |
| 81 | IWB, IUWB, | |
| 82 | ||
| 83 | // _Bitint | |
| 84 | WB, UWB, | |
| 85 | ||
| 86 | // zig fmt: on | |
| 87 | ||
| 88 | const Tuple = struct { Suffix, []const []const u8 }; | |
| 89 | ||
| 90 | const IntSuffixes = &[_]Tuple{ | |
| 91 | .{ .U, &.{"U"} }, | |
| 92 | .{ .L, &.{"L"} }, | |
| 93 | .{ .WB, &.{"WB"} }, | |
| 94 | .{ .UL, &.{ "U", "L" } }, | |
| 95 | .{ .UWB, &.{ "U", "WB" } }, | |
| 96 | .{ .LL, &.{"LL"} }, | |
| 97 | .{ .ULL, &.{ "U", "LL" } }, | |
| 98 | ||
| 99 | .{ .I, &.{"I"} }, | |
| 100 | ||
| 101 | .{ .IWB, &.{ "I", "WB" } }, | |
| 102 | .{ .IU, &.{ "I", "U" } }, | |
| 103 | .{ .IL, &.{ "I", "L" } }, | |
| 104 | .{ .IUL, &.{ "I", "U", "L" } }, | |
| 105 | .{ .IUWB, &.{ "I", "U", "WB" } }, | |
| 106 | .{ .ILL, &.{ "I", "LL" } }, | |
| 107 | .{ .IULL, &.{ "I", "U", "LL" } }, | |
| 108 | }; | |
| 109 | ||
| 110 | const FloatSuffixes = &[_]Tuple{ | |
| 111 | .{ .F16, &.{"F16"} }, | |
| 112 | .{ .F, &.{"F"} }, | |
| 113 | .{ .L, &.{"L"} }, | |
| 114 | ||
| 115 | .{ .I, &.{"I"} }, | |
| 116 | .{ .IL, &.{ "I", "L" } }, | |
| 117 | .{ .IF, &.{ "I", "F" } }, | |
| 118 | }; | |
| 119 | ||
| 120 | pub fn fromString(buf: []const u8, suffix_kind: enum { int, float }) ?Suffix { | |
| 121 | if (buf.len == 0) return .None; | |
| 122 | ||
| 123 | const suffixes = switch (suffix_kind) { | |
| 124 | .float => FloatSuffixes, | |
| 125 | .int => IntSuffixes, | |
| 126 | }; | |
| 127 | var scratch: [3]u8 = undefined; | |
| 128 | top: for (suffixes) |candidate| { | |
| 129 | const tag = candidate[0]; | |
| 130 | const parts = candidate[1]; | |
| 131 | var len: usize = 0; | |
| 132 | for (parts) |part| len += part.len; | |
| 133 | if (len != buf.len) continue; | |
| 134 | ||
| 135 | for (parts) |part| { | |
| 136 | const lower = std.ascii.lowerString(&scratch, part); | |
| 137 | if (mem.indexOf(u8, buf, part) == null and mem.indexOf(u8, buf, lower) == null) continue :top; | |
| 138 | } | |
| 139 | return tag; | |
| 140 | } | |
| 141 | return null; | |
| 142 | } | |
| 143 | ||
| 144 | pub fn isImaginary(suffix: Suffix) bool { | |
| 145 | return switch (suffix) { | |
| 146 | .I, .IL, .IF, .IU, .IUL, .ILL, .IULL, .IWB, .IUWB => true, | |
| 147 | .None, .L, .F16, .F, .U, .UL, .LL, .ULL, .WB, .UWB => false, | |
| 148 | }; | |
| 149 | } | |
| 150 | ||
| 151 | pub fn isSignedInteger(suffix: Suffix) bool { | |
| 152 | return switch (suffix) { | |
| 153 | .None, .L, .LL, .I, .IL, .ILL, .WB, .IWB => true, | |
| 154 | .U, .UL, .ULL, .IU, .IUL, .IULL, .UWB, .IUWB => false, | |
| 155 | .F, .IF, .F16 => unreachable, | |
| 156 | }; | |
| 157 | } | |
| 158 | ||
| 159 | pub fn signedness(suffix: Suffix) std.builtin.Signedness { | |
| 160 | return if (suffix.isSignedInteger()) .signed else .unsigned; | |
| 161 | } | |
| 162 | ||
| 163 | pub fn isBitInt(suffix: Suffix) bool { | |
| 164 | return switch (suffix) { | |
| 165 | .WB, .UWB, .IWB, .IUWB => true, | |
| 166 | else => false, | |
| 167 | }; | |
| 168 | } | |
| 169 | }; |
deps/aro/object/Elf.zig created+377| ... | ... | @@ -0,0 +1,377 @@ |
| 1 | const std = @import("std"); | |
| 2 | const Compilation = @import("../Compilation.zig"); | |
| 3 | const Object = @import("../Object.zig"); | |
| 4 | ||
| 5 | const Elf = @This(); | |
| 6 | ||
| 7 | const Section = struct { | |
| 8 | data: std.ArrayList(u8), | |
| 9 | relocations: std.ArrayListUnmanaged(Relocation) = .{}, | |
| 10 | flags: u64, | |
| 11 | type: u32, | |
| 12 | index: u16 = undefined, | |
| 13 | }; | |
| 14 | ||
| 15 | const Symbol = struct { | |
| 16 | section: ?*Section, | |
| 17 | size: u64, | |
| 18 | offset: u64, | |
| 19 | index: u16 = undefined, | |
| 20 | info: u8, | |
| 21 | }; | |
| 22 | ||
| 23 | const Relocation = packed struct { | |
| 24 | symbol: *Symbol, | |
| 25 | addend: i64, | |
| 26 | offset: u48, | |
| 27 | type: u8, | |
| 28 | }; | |
| 29 | ||
| 30 | const additional_sections = 3; // null section, strtab, symtab | |
| 31 | const strtab_index = 1; | |
| 32 | const symtab_index = 2; | |
| 33 | const strtab_default = "\x00.strtab\x00.symtab\x00"; | |
| 34 | const strtab_name = 1; | |
| 35 | const symtab_name = "\x00.strtab\x00".len; | |
| 36 | ||
| 37 | obj: Object, | |
| 38 | /// The keys are owned by the Codegen.tree | |
| 39 | sections: std.StringHashMapUnmanaged(*Section) = .{}, | |
| 40 | local_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, | |
| 41 | global_symbols: std.StringHashMapUnmanaged(*Symbol) = .{}, | |
| 42 | unnamed_symbol_mangle: u32 = 0, | |
| 43 | strtab_len: u64 = strtab_default.len, | |
| 44 | arena: std.heap.ArenaAllocator, | |
| 45 | ||
| 46 | pub fn create(comp: *Compilation) !*Object { | |
| 47 | const elf = try comp.gpa.create(Elf); | |
| 48 | elf.* = .{ | |
| 49 | .obj = .{ .format = .elf, .comp = comp }, | |
| 50 | .arena = std.heap.ArenaAllocator.init(comp.gpa), | |
| 51 | }; | |
| 52 | return &elf.obj; | |
| 53 | } | |
| 54 | ||
| 55 | pub fn deinit(elf: *Elf) void { | |
| 56 | const gpa = elf.arena.child_allocator; | |
| 57 | { | |
| 58 | var it = elf.sections.valueIterator(); | |
| 59 | while (it.next()) |sect| { | |
| 60 | sect.*.data.deinit(); | |
| 61 | sect.*.relocations.deinit(gpa); | |
| 62 | } | |
| 63 | } | |
| 64 | elf.sections.deinit(gpa); | |
| 65 | elf.local_symbols.deinit(gpa); | |
| 66 | elf.global_symbols.deinit(gpa); | |
| 67 | elf.arena.deinit(); | |
| 68 | gpa.destroy(elf); | |
| 69 | } | |
| 70 | ||
| 71 | fn sectionString(sec: Object.Section) []const u8 { | |
| 72 | return switch (sec) { | |
| 73 | .undefined => unreachable, | |
| 74 | .data => "data", | |
| 75 | .read_only_data => "rodata", | |
| 76 | .func => "text", | |
| 77 | .strings => "rodata.str", | |
| 78 | .custom => |name| name, | |
| 79 | }; | |
| 80 | } | |
| 81 | ||
| 82 | pub fn getSection(elf: *Elf, section_kind: Object.Section) !*std.ArrayList(u8) { | |
| 83 | const section_name = sectionString(section_kind); | |
| 84 | const section = elf.sections.get(section_name) orelse blk: { | |
| 85 | const section = try elf.arena.allocator().create(Section); | |
| 86 | section.* = .{ | |
| 87 | .data = std.ArrayList(u8).init(elf.arena.child_allocator), | |
| 88 | .type = std.elf.SHT_PROGBITS, | |
| 89 | .flags = switch (section_kind) { | |
| 90 | .func, .custom => std.elf.SHF_ALLOC + std.elf.SHF_EXECINSTR, | |
| 91 | .strings => std.elf.SHF_ALLOC + std.elf.SHF_MERGE + std.elf.SHF_STRINGS, | |
| 92 | .read_only_data => std.elf.SHF_ALLOC, | |
| 93 | .data => std.elf.SHF_ALLOC + std.elf.SHF_WRITE, | |
| 94 | .undefined => unreachable, | |
| 95 | }, | |
| 96 | }; | |
| 97 | try elf.sections.putNoClobber(elf.arena.child_allocator, section_name, section); | |
| 98 | elf.strtab_len += section_name.len + ".\x00".len; | |
| 99 | break :blk section; | |
| 100 | }; | |
| 101 | return &section.data; | |
| 102 | } | |
| 103 | ||
| 104 | pub fn declareSymbol( | |
| 105 | elf: *Elf, | |
| 106 | section_kind: Object.Section, | |
| 107 | maybe_name: ?[]const u8, | |
| 108 | linkage: std.builtin.GlobalLinkage, | |
| 109 | @"type": Object.SymbolType, | |
| 110 | offset: u64, | |
| 111 | size: u64, | |
| 112 | ) ![]const u8 { | |
| 113 | const section = blk: { | |
| 114 | if (section_kind == .undefined) break :blk null; | |
| 115 | const section_name = sectionString(section_kind); | |
| 116 | break :blk elf.sections.get(section_name); | |
| 117 | }; | |
| 118 | const binding: u8 = switch (linkage) { | |
| 119 | .Internal => std.elf.STB_LOCAL, | |
| 120 | .Strong => std.elf.STB_GLOBAL, | |
| 121 | .Weak => std.elf.STB_WEAK, | |
| 122 | .LinkOnce => unreachable, | |
| 123 | }; | |
| 124 | const sym_type: u8 = switch (@"type") { | |
| 125 | .func => std.elf.STT_FUNC, | |
| 126 | .variable => std.elf.STT_OBJECT, | |
| 127 | .external => std.elf.STT_NOTYPE, | |
| 128 | }; | |
| 129 | const name = if (maybe_name) |some| some else blk: { | |
| 130 | defer elf.unnamed_symbol_mangle += 1; | |
| 131 | break :blk try std.fmt.allocPrint(elf.arena.allocator(), ".L.{d}", .{elf.unnamed_symbol_mangle}); | |
| 132 | }; | |
| 133 | ||
| 134 | const gop = if (linkage == .Internal) | |
| 135 | try elf.local_symbols.getOrPut(elf.arena.child_allocator, name) | |
| 136 | else | |
| 137 | try elf.global_symbols.getOrPut(elf.arena.child_allocator, name); | |
| 138 | ||
| 139 | if (!gop.found_existing) { | |
| 140 | gop.value_ptr.* = try elf.arena.allocator().create(Symbol); | |
| 141 | elf.strtab_len += name.len + 1; // +1 for null byte | |
| 142 | } | |
| 143 | gop.value_ptr.*.* = .{ | |
| 144 | .section = section, | |
| 145 | .size = size, | |
| 146 | .offset = offset, | |
| 147 | .info = (binding << 4) + sym_type, | |
| 148 | }; | |
| 149 | return name; | |
| 150 | } | |
| 151 | ||
| 152 | pub fn addRelocation(elf: *Elf, name: []const u8, section_kind: Object.Section, address: u64, addend: i64) !void { | |
| 153 | const section_name = sectionString(section_kind); | |
| 154 | const symbol = elf.local_symbols.get(name) orelse elf.global_symbols.get(name).?; // reference to undeclared symbol | |
| 155 | const section = elf.sections.get(section_name).?; | |
| 156 | if (section.relocations.items.len == 0) elf.strtab_len += ".rela".len; | |
| 157 | ||
| 158 | try section.relocations.append(elf.arena.child_allocator, .{ | |
| 159 | .symbol = symbol, | |
| 160 | .offset = @intCast(address), | |
| 161 | .addend = addend, | |
| 162 | .type = if (symbol.section == null) 4 else 2, // TODO | |
| 163 | }); | |
| 164 | } | |
| 165 | ||
| 166 | /// elf header | |
| 167 | /// sections contents | |
| 168 | /// symbols | |
| 169 | /// relocations | |
| 170 | /// strtab | |
| 171 | /// section headers | |
| 172 | pub fn finish(elf: *Elf, file: std.fs.File) !void { | |
| 173 | var buf_writer = std.io.bufferedWriter(file.writer()); | |
| 174 | const w = buf_writer.writer(); | |
| 175 | ||
| 176 | var num_sections: std.elf.Elf64_Half = additional_sections; | |
| 177 | var relocations_len: std.elf.Elf64_Off = 0; | |
| 178 | var sections_len: std.elf.Elf64_Off = 0; | |
| 179 | { | |
| 180 | var it = elf.sections.valueIterator(); | |
| 181 | while (it.next()) |sect| { | |
| 182 | sections_len += sect.*.data.items.len; | |
| 183 | relocations_len += sect.*.relocations.items.len * @sizeOf(std.elf.Elf64_Rela); | |
| 184 | sect.*.index = num_sections; | |
| 185 | num_sections += 1; | |
| 186 | num_sections += @intFromBool(sect.*.relocations.items.len != 0); | |
| 187 | } | |
| 188 | } | |
| 189 | const symtab_len = (elf.local_symbols.count() + elf.global_symbols.count() + 1) * @sizeOf(std.elf.Elf64_Sym); | |
| 190 | ||
| 191 | const symtab_offset = @sizeOf(std.elf.Elf64_Ehdr) + sections_len; | |
| 192 | const symtab_offset_aligned = std.mem.alignForward(u64, symtab_offset, 8); | |
| 193 | const rela_offset = symtab_offset_aligned + symtab_len; | |
| 194 | const strtab_offset = rela_offset + relocations_len; | |
| 195 | const sh_offset = strtab_offset + elf.strtab_len; | |
| 196 | const sh_offset_aligned = std.mem.alignForward(u64, sh_offset, 16); | |
| 197 | ||
| 198 | var elf_header = std.elf.Elf64_Ehdr{ | |
| 199 | .e_ident = .{ 0x7F, 'E', 'L', 'F', 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, | |
| 200 | .e_type = std.elf.ET.REL, // we only produce relocatables | |
| 201 | .e_machine = elf.obj.comp.target.cpu.arch.toElfMachine(), | |
| 202 | .e_version = 1, | |
| 203 | .e_entry = 0, // linker will handle this | |
| 204 | .e_phoff = 0, // no program header | |
| 205 | .e_shoff = sh_offset_aligned, // section headers offset | |
| 206 | .e_flags = 0, // no flags | |
| 207 | .e_ehsize = @sizeOf(std.elf.Elf64_Ehdr), | |
| 208 | .e_phentsize = 0, // no program header | |
| 209 | .e_phnum = 0, // no program header | |
| 210 | .e_shentsize = @sizeOf(std.elf.Elf64_Shdr), | |
| 211 | .e_shnum = num_sections, | |
| 212 | .e_shstrndx = strtab_index, | |
| 213 | }; | |
| 214 | try w.writeStruct(elf_header); | |
| 215 | ||
| 216 | // write contents of sections | |
| 217 | { | |
| 218 | var it = elf.sections.valueIterator(); | |
| 219 | while (it.next()) |sect| try w.writeAll(sect.*.data.items); | |
| 220 | } | |
| 221 | ||
| 222 | // pad to 8 bytes | |
| 223 | try w.writeByteNTimes(0, @intCast(symtab_offset_aligned - symtab_offset)); | |
| 224 | ||
| 225 | var name_offset: u32 = strtab_default.len; | |
| 226 | // write symbols | |
| 227 | { | |
| 228 | // first symbol must be null | |
| 229 | try w.writeStruct(std.mem.zeroes(std.elf.Elf64_Sym)); | |
| 230 | ||
| 231 | var sym_index: u16 = 1; | |
| 232 | var it = elf.local_symbols.iterator(); | |
| 233 | while (it.next()) |entry| { | |
| 234 | const sym = entry.value_ptr.*; | |
| 235 | try w.writeStruct(std.elf.Elf64_Sym{ | |
| 236 | .st_name = name_offset, | |
| 237 | .st_info = sym.info, | |
| 238 | .st_other = 0, | |
| 239 | .st_shndx = if (sym.section) |some| some.index else 0, | |
| 240 | .st_value = sym.offset, | |
| 241 | .st_size = sym.size, | |
| 242 | }); | |
| 243 | sym.index = sym_index; | |
| 244 | sym_index += 1; | |
| 245 | name_offset += @intCast(entry.key_ptr.len + 1); // +1 for null byte | |
| 246 | } | |
| 247 | it = elf.global_symbols.iterator(); | |
| 248 | while (it.next()) |entry| { | |
| 249 | const sym = entry.value_ptr.*; | |
| 250 | try w.writeStruct(std.elf.Elf64_Sym{ | |
| 251 | .st_name = name_offset, | |
| 252 | .st_info = sym.info, | |
| 253 | .st_other = 0, | |
| 254 | .st_shndx = if (sym.section) |some| some.index else 0, | |
| 255 | .st_value = sym.offset, | |
| 256 | .st_size = sym.size, | |
| 257 | }); | |
| 258 | sym.index = sym_index; | |
| 259 | sym_index += 1; | |
| 260 | name_offset += @intCast(entry.key_ptr.len + 1); // +1 for null byte | |
| 261 | } | |
| 262 | } | |
| 263 | ||
| 264 | // write relocations | |
| 265 | { | |
| 266 | var it = elf.sections.valueIterator(); | |
| 267 | while (it.next()) |sect| { | |
| 268 | for (sect.*.relocations.items) |rela| { | |
| 269 | try w.writeStruct(std.elf.Elf64_Rela{ | |
| 270 | .r_offset = rela.offset, | |
| 271 | .r_addend = rela.addend, | |
| 272 | .r_info = (@as(u64, rela.symbol.index) << 32) | rela.type, | |
| 273 | }); | |
| 274 | } | |
| 275 | } | |
| 276 | } | |
| 277 | ||
| 278 | // write strtab | |
| 279 | try w.writeAll(strtab_default); | |
| 280 | { | |
| 281 | var it = elf.local_symbols.keyIterator(); | |
| 282 | while (it.next()) |key| try w.print("{s}\x00", .{key.*}); | |
| 283 | it = elf.global_symbols.keyIterator(); | |
| 284 | while (it.next()) |key| try w.print("{s}\x00", .{key.*}); | |
| 285 | } | |
| 286 | { | |
| 287 | var it = elf.sections.iterator(); | |
| 288 | while (it.next()) |entry| { | |
| 289 | if (entry.value_ptr.*.relocations.items.len != 0) try w.writeAll(".rela"); | |
| 290 | try w.print(".{s}\x00", .{entry.key_ptr.*}); | |
| 291 | } | |
| 292 | } | |
| 293 | ||
| 294 | // pad to 16 bytes | |
| 295 | try w.writeByteNTimes(0, @intCast(sh_offset_aligned - sh_offset)); | |
| 296 | // mandatory null header | |
| 297 | try w.writeStruct(std.mem.zeroes(std.elf.Elf64_Shdr)); | |
| 298 | ||
| 299 | // write strtab section header | |
| 300 | { | |
| 301 | var sect_header = std.elf.Elf64_Shdr{ | |
| 302 | .sh_name = strtab_name, | |
| 303 | .sh_type = std.elf.SHT_STRTAB, | |
| 304 | .sh_flags = 0, | |
| 305 | .sh_addr = 0, | |
| 306 | .sh_offset = strtab_offset, | |
| 307 | .sh_size = elf.strtab_len, | |
| 308 | .sh_link = 0, | |
| 309 | .sh_info = 0, | |
| 310 | .sh_addralign = 1, | |
| 311 | .sh_entsize = 0, | |
| 312 | }; | |
| 313 | try w.writeStruct(sect_header); | |
| 314 | } | |
| 315 | ||
| 316 | // write symtab section header | |
| 317 | { | |
| 318 | var sect_header = std.elf.Elf64_Shdr{ | |
| 319 | .sh_name = symtab_name, | |
| 320 | .sh_type = std.elf.SHT_SYMTAB, | |
| 321 | .sh_flags = 0, | |
| 322 | .sh_addr = 0, | |
| 323 | .sh_offset = symtab_offset_aligned, | |
| 324 | .sh_size = symtab_len, | |
| 325 | .sh_link = strtab_index, | |
| 326 | .sh_info = elf.local_symbols.size + 1, | |
| 327 | .sh_addralign = 8, | |
| 328 | .sh_entsize = @sizeOf(std.elf.Elf64_Sym), | |
| 329 | }; | |
| 330 | try w.writeStruct(sect_header); | |
| 331 | } | |
| 332 | ||
| 333 | // remaining section headers | |
| 334 | { | |
| 335 | var sect_offset: u64 = @sizeOf(std.elf.Elf64_Ehdr); | |
| 336 | var rela_sect_offset: u64 = rela_offset; | |
| 337 | var it = elf.sections.iterator(); | |
| 338 | while (it.next()) |entry| { | |
| 339 | const sect = entry.value_ptr.*; | |
| 340 | const rela_count = sect.relocations.items.len; | |
| 341 | const rela_name_offset: u32 = if (rela_count != 0) @truncate(".rela".len) else 0; | |
| 342 | try w.writeStruct(std.elf.Elf64_Shdr{ | |
| 343 | .sh_name = rela_name_offset + name_offset, | |
| 344 | .sh_type = sect.type, | |
| 345 | .sh_flags = sect.flags, | |
| 346 | .sh_addr = 0, | |
| 347 | .sh_offset = sect_offset, | |
| 348 | .sh_size = sect.data.items.len, | |
| 349 | .sh_link = 0, | |
| 350 | .sh_info = 0, | |
| 351 | .sh_addralign = if (sect.flags & std.elf.SHF_EXECINSTR != 0) 16 else 1, | |
| 352 | .sh_entsize = 0, | |
| 353 | }); | |
| 354 | ||
| 355 | if (rela_count != 0) { | |
| 356 | const size = rela_count * @sizeOf(std.elf.Elf64_Rela); | |
| 357 | try w.writeStruct(std.elf.Elf64_Shdr{ | |
| 358 | .sh_name = name_offset, | |
| 359 | .sh_type = std.elf.SHT_RELA, | |
| 360 | .sh_flags = 0, | |
| 361 | .sh_addr = 0, | |
| 362 | .sh_offset = rela_sect_offset, | |
| 363 | .sh_size = rela_count * @sizeOf(std.elf.Elf64_Rela), | |
| 364 | .sh_link = symtab_index, | |
| 365 | .sh_info = sect.index, | |
| 366 | .sh_addralign = 8, | |
| 367 | .sh_entsize = @sizeOf(std.elf.Elf64_Rela), | |
| 368 | }); | |
| 369 | rela_sect_offset += size; | |
| 370 | } | |
| 371 | ||
| 372 | sect_offset += sect.data.items.len; | |
| 373 | name_offset += @as(u32, @intCast(entry.key_ptr.len + ".\x00".len)) + rela_name_offset; | |
| 374 | } | |
| 375 | } | |
| 376 | try buf_writer.flush(); | |
| 377 | } |
deps/aro/pragmas/gcc.zig created+199| ... | ... | @@ -0,0 +1,199 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Compilation = @import("../Compilation.zig"); | |
| 4 | const Pragma = @import("../Pragma.zig"); | |
| 5 | const Diagnostics = @import("../Diagnostics.zig"); | |
| 6 | const Preprocessor = @import("../Preprocessor.zig"); | |
| 7 | const Parser = @import("../Parser.zig"); | |
| 8 | const TokenIndex = @import("../Tree.zig").TokenIndex; | |
| 9 | ||
| 10 | const GCC = @This(); | |
| 11 | ||
| 12 | pragma: Pragma = .{ | |
| 13 | .beforeParse = beforeParse, | |
| 14 | .beforePreprocess = beforePreprocess, | |
| 15 | .afterParse = afterParse, | |
| 16 | .deinit = deinit, | |
| 17 | .preprocessorHandler = preprocessorHandler, | |
| 18 | .parserHandler = parserHandler, | |
| 19 | .preserveTokens = preserveTokens, | |
| 20 | }, | |
| 21 | original_options: Diagnostics.Options = .{}, | |
| 22 | options_stack: std.ArrayListUnmanaged(Diagnostics.Options) = .{}, | |
| 23 | ||
| 24 | const Directive = enum { | |
| 25 | warning, | |
| 26 | @"error", | |
| 27 | diagnostic, | |
| 28 | poison, | |
| 29 | const Diagnostics = enum { | |
| 30 | ignored, | |
| 31 | warning, | |
| 32 | @"error", | |
| 33 | fatal, | |
| 34 | push, | |
| 35 | pop, | |
| 36 | }; | |
| 37 | }; | |
| 38 | ||
| 39 | fn beforePreprocess(pragma: *Pragma, comp: *Compilation) void { | |
| 40 | var self = @fieldParentPtr(GCC, "pragma", pragma); | |
| 41 | self.original_options = comp.diag.options; | |
| 42 | } | |
| 43 | ||
| 44 | fn beforeParse(pragma: *Pragma, comp: *Compilation) void { | |
| 45 | var self = @fieldParentPtr(GCC, "pragma", pragma); | |
| 46 | comp.diag.options = self.original_options; | |
| 47 | self.options_stack.items.len = 0; | |
| 48 | } | |
| 49 | ||
| 50 | fn afterParse(pragma: *Pragma, comp: *Compilation) void { | |
| 51 | var self = @fieldParentPtr(GCC, "pragma", pragma); | |
| 52 | comp.diag.options = self.original_options; | |
| 53 | self.options_stack.items.len = 0; | |
| 54 | } | |
| 55 | ||
| 56 | pub fn init(allocator: mem.Allocator) !*Pragma { | |
| 57 | var gcc = try allocator.create(GCC); | |
| 58 | gcc.* = .{}; | |
| 59 | return &gcc.pragma; | |
| 60 | } | |
| 61 | ||
| 62 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | |
| 63 | var self = @fieldParentPtr(GCC, "pragma", pragma); | |
| 64 | self.options_stack.deinit(comp.gpa); | |
| 65 | comp.gpa.destroy(self); | |
| 66 | } | |
| 67 | ||
| 68 | fn diagnosticHandler(self: *GCC, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { | |
| 69 | const diagnostic_tok = pp.tokens.get(start_idx); | |
| 70 | if (diagnostic_tok.id == .nl) return; | |
| 71 | ||
| 72 | const diagnostic = std.meta.stringToEnum(Directive.Diagnostics, pp.expandedSlice(diagnostic_tok)) orelse | |
| 73 | return error.UnknownPragma; | |
| 74 | ||
| 75 | switch (diagnostic) { | |
| 76 | .ignored, .warning, .@"error", .fatal => { | |
| 77 | const str = Pragma.pasteTokens(pp, start_idx + 1) catch |err| switch (err) { | |
| 78 | error.ExpectedStringLiteral => { | |
| 79 | return pp.comp.diag.add(.{ | |
| 80 | .tag = .pragma_requires_string_literal, | |
| 81 | .loc = diagnostic_tok.loc, | |
| 82 | .extra = .{ .str = "GCC diagnostic" }, | |
| 83 | }, diagnostic_tok.expansionSlice()); | |
| 84 | }, | |
| 85 | else => |e| return e, | |
| 86 | }; | |
| 87 | if (!mem.startsWith(u8, str, "-W")) { | |
| 88 | const next = pp.tokens.get(start_idx + 1); | |
| 89 | return pp.comp.diag.add(.{ | |
| 90 | .tag = .malformed_warning_check, | |
| 91 | .loc = next.loc, | |
| 92 | .extra = .{ .str = "GCC diagnostic" }, | |
| 93 | }, next.expansionSlice()); | |
| 94 | } | |
| 95 | const new_kind = switch (diagnostic) { | |
| 96 | .ignored => Diagnostics.Kind.off, | |
| 97 | .warning => Diagnostics.Kind.warning, | |
| 98 | .@"error" => Diagnostics.Kind.@"error", | |
| 99 | .fatal => Diagnostics.Kind.@"fatal error", | |
| 100 | else => unreachable, | |
| 101 | }; | |
| 102 | ||
| 103 | try pp.comp.diag.set(str[2..], new_kind); | |
| 104 | }, | |
| 105 | .push => try self.options_stack.append(pp.comp.gpa, pp.comp.diag.options), | |
| 106 | .pop => pp.comp.diag.options = self.options_stack.popOrNull() orelse self.original_options, | |
| 107 | } | |
| 108 | } | |
| 109 | ||
| 110 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { | |
| 111 | var self = @fieldParentPtr(GCC, "pragma", pragma); | |
| 112 | const directive_tok = pp.tokens.get(start_idx + 1); | |
| 113 | if (directive_tok.id == .nl) return; | |
| 114 | ||
| 115 | const gcc_pragma = std.meta.stringToEnum(Directive, pp.expandedSlice(directive_tok)) orelse | |
| 116 | return pp.comp.diag.add(.{ | |
| 117 | .tag = .unknown_gcc_pragma, | |
| 118 | .loc = directive_tok.loc, | |
| 119 | }, directive_tok.expansionSlice()); | |
| 120 | ||
| 121 | switch (gcc_pragma) { | |
| 122 | .warning, .@"error" => { | |
| 123 | const text = Pragma.pasteTokens(pp, start_idx + 2) catch |err| switch (err) { | |
| 124 | error.ExpectedStringLiteral => { | |
| 125 | return pp.comp.diag.add(.{ | |
| 126 | .tag = .pragma_requires_string_literal, | |
| 127 | .loc = directive_tok.loc, | |
| 128 | .extra = .{ .str = @tagName(gcc_pragma) }, | |
| 129 | }, directive_tok.expansionSlice()); | |
| 130 | }, | |
| 131 | else => |e| return e, | |
| 132 | }; | |
| 133 | const extra = Diagnostics.Message.Extra{ .str = try pp.comp.diag.arena.allocator().dupe(u8, text) }; | |
| 134 | const diagnostic_tag: Diagnostics.Tag = if (gcc_pragma == .warning) .pragma_warning_message else .pragma_error_message; | |
| 135 | return pp.comp.diag.add( | |
| 136 | .{ .tag = diagnostic_tag, .loc = directive_tok.loc, .extra = extra }, | |
| 137 | directive_tok.expansionSlice(), | |
| 138 | ); | |
| 139 | }, | |
| 140 | .diagnostic => return self.diagnosticHandler(pp, start_idx + 2) catch |err| switch (err) { | |
| 141 | error.UnknownPragma => { | |
| 142 | const tok = pp.tokens.get(start_idx + 2); | |
| 143 | return pp.comp.diag.add(.{ | |
| 144 | .tag = .unknown_gcc_pragma_directive, | |
| 145 | .loc = tok.loc, | |
| 146 | }, tok.expansionSlice()); | |
| 147 | }, | |
| 148 | else => |e| return e, | |
| 149 | }, | |
| 150 | .poison => { | |
| 151 | var i: usize = 2; | |
| 152 | while (true) : (i += 1) { | |
| 153 | const tok = pp.tokens.get(start_idx + i); | |
| 154 | if (tok.id == .nl) break; | |
| 155 | ||
| 156 | if (!tok.id.isMacroIdentifier()) { | |
| 157 | return pp.comp.diag.add(.{ | |
| 158 | .tag = .pragma_poison_identifier, | |
| 159 | .loc = tok.loc, | |
| 160 | }, tok.expansionSlice()); | |
| 161 | } | |
| 162 | const str = pp.expandedSlice(tok); | |
| 163 | if (pp.defines.get(str) != null) { | |
| 164 | try pp.comp.diag.add(.{ | |
| 165 | .tag = .pragma_poison_macro, | |
| 166 | .loc = tok.loc, | |
| 167 | }, tok.expansionSlice()); | |
| 168 | } | |
| 169 | try pp.poisoned_identifiers.put(str, {}); | |
| 170 | } | |
| 171 | return; | |
| 172 | }, | |
| 173 | } | |
| 174 | } | |
| 175 | ||
| 176 | fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { | |
| 177 | var self = @fieldParentPtr(GCC, "pragma", pragma); | |
| 178 | const directive_tok = p.pp.tokens.get(start_idx + 1); | |
| 179 | if (directive_tok.id == .nl) return; | |
| 180 | const name = p.pp.expandedSlice(directive_tok); | |
| 181 | if (mem.eql(u8, name, "diagnostic")) { | |
| 182 | return self.diagnosticHandler(p.pp, start_idx + 2) catch |err| switch (err) { | |
| 183 | error.UnknownPragma => {}, // handled during preprocessing | |
| 184 | error.StopPreprocessing => unreachable, // Only used by #pragma once | |
| 185 | else => |e| return e, | |
| 186 | }; | |
| 187 | } | |
| 188 | } | |
| 189 | ||
| 190 | fn preserveTokens(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) bool { | |
| 191 | const next = pp.tokens.get(start_idx + 1); | |
| 192 | if (next.id != .nl) { | |
| 193 | const name = pp.expandedSlice(next); | |
| 194 | if (mem.eql(u8, name, "poison")) { | |
| 195 | return false; | |
| 196 | } | |
| 197 | } | |
| 198 | return true; | |
| 199 | } |
deps/aro/pragmas/message.zig created+50| ... | ... | @@ -0,0 +1,50 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Compilation = @import("../Compilation.zig"); | |
| 4 | const Pragma = @import("../Pragma.zig"); | |
| 5 | const Diagnostics = @import("../Diagnostics.zig"); | |
| 6 | const Preprocessor = @import("../Preprocessor.zig"); | |
| 7 | const Parser = @import("../Parser.zig"); | |
| 8 | const TokenIndex = @import("../Tree.zig").TokenIndex; | |
| 9 | const Source = @import("../Source.zig"); | |
| 10 | ||
| 11 | const Message = @This(); | |
| 12 | ||
| 13 | pragma: Pragma = .{ | |
| 14 | .deinit = deinit, | |
| 15 | .preprocessorHandler = preprocessorHandler, | |
| 16 | }, | |
| 17 | ||
| 18 | pub fn init(allocator: mem.Allocator) !*Pragma { | |
| 19 | var once = try allocator.create(Message); | |
| 20 | once.* = .{}; | |
| 21 | return &once.pragma; | |
| 22 | } | |
| 23 | ||
| 24 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | |
| 25 | var self = @fieldParentPtr(Message, "pragma", pragma); | |
| 26 | comp.gpa.destroy(self); | |
| 27 | } | |
| 28 | ||
| 29 | fn preprocessorHandler(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { | |
| 30 | const message_tok = pp.tokens.get(start_idx); | |
| 31 | const message_expansion_locs = message_tok.expansionSlice(); | |
| 32 | ||
| 33 | const str = Pragma.pasteTokens(pp, start_idx + 1) catch |err| switch (err) { | |
| 34 | error.ExpectedStringLiteral => { | |
| 35 | return pp.comp.diag.add(.{ | |
| 36 | .tag = .pragma_requires_string_literal, | |
| 37 | .loc = message_tok.loc, | |
| 38 | .extra = .{ .str = "message" }, | |
| 39 | }, message_expansion_locs); | |
| 40 | }, | |
| 41 | else => |e| return e, | |
| 42 | }; | |
| 43 | ||
| 44 | const loc = if (message_expansion_locs.len != 0) | |
| 45 | message_expansion_locs[message_expansion_locs.len - 1] | |
| 46 | else | |
| 47 | message_tok.loc; | |
| 48 | const extra = Diagnostics.Message.Extra{ .str = try pp.comp.diag.arena.allocator().dupe(u8, str) }; | |
| 49 | return pp.comp.diag.add(.{ .tag = .pragma_message, .loc = loc, .extra = extra }, &.{}); | |
| 50 | } |
deps/aro/pragmas/once.zig created+56| ... | ... | @@ -0,0 +1,56 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Compilation = @import("../Compilation.zig"); | |
| 4 | const Pragma = @import("../Pragma.zig"); | |
| 5 | const Diagnostics = @import("../Diagnostics.zig"); | |
| 6 | const Preprocessor = @import("../Preprocessor.zig"); | |
| 7 | const Parser = @import("../Parser.zig"); | |
| 8 | const TokenIndex = @import("../Tree.zig").TokenIndex; | |
| 9 | const Source = @import("../Source.zig"); | |
| 10 | ||
| 11 | const Once = @This(); | |
| 12 | ||
| 13 | pragma: Pragma = .{ | |
| 14 | .afterParse = afterParse, | |
| 15 | .deinit = deinit, | |
| 16 | .preprocessorHandler = preprocessorHandler, | |
| 17 | }, | |
| 18 | pragma_once: std.AutoHashMap(Source.Id, void), | |
| 19 | preprocess_count: u32 = 0, | |
| 20 | ||
| 21 | pub fn init(allocator: mem.Allocator) !*Pragma { | |
| 22 | var once = try allocator.create(Once); | |
| 23 | once.* = .{ | |
| 24 | .pragma_once = std.AutoHashMap(Source.Id, void).init(allocator), | |
| 25 | }; | |
| 26 | return &once.pragma; | |
| 27 | } | |
| 28 | ||
| 29 | fn afterParse(pragma: *Pragma, _: *Compilation) void { | |
| 30 | var self = @fieldParentPtr(Once, "pragma", pragma); | |
| 31 | self.pragma_once.clearRetainingCapacity(); | |
| 32 | } | |
| 33 | ||
| 34 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | |
| 35 | var self = @fieldParentPtr(Once, "pragma", pragma); | |
| 36 | self.pragma_once.deinit(); | |
| 37 | comp.gpa.destroy(self); | |
| 38 | } | |
| 39 | ||
| 40 | fn preprocessorHandler(pragma: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) Pragma.Error!void { | |
| 41 | var self = @fieldParentPtr(Once, "pragma", pragma); | |
| 42 | const name_tok = pp.tokens.get(start_idx); | |
| 43 | const next = pp.tokens.get(start_idx + 1); | |
| 44 | if (next.id != .nl) { | |
| 45 | try pp.comp.diag.add(.{ | |
| 46 | .tag = .extra_tokens_directive_end, | |
| 47 | .loc = name_tok.loc, | |
| 48 | }, next.expansionSlice()); | |
| 49 | } | |
| 50 | const seen = self.preprocess_count == pp.preprocess_count; | |
| 51 | const prev = try self.pragma_once.fetchPut(name_tok.loc.id, {}); | |
| 52 | if (prev != null and !seen) { | |
| 53 | return error.StopPreprocessing; | |
| 54 | } | |
| 55 | self.preprocess_count = pp.preprocess_count; | |
| 56 | } |
deps/aro/pragmas/pack.zig created+164| ... | ... | @@ -0,0 +1,164 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Compilation = @import("../Compilation.zig"); | |
| 4 | const Pragma = @import("../Pragma.zig"); | |
| 5 | const Diagnostics = @import("../Diagnostics.zig"); | |
| 6 | const Preprocessor = @import("../Preprocessor.zig"); | |
| 7 | const Parser = @import("../Parser.zig"); | |
| 8 | const Tree = @import("../Tree.zig"); | |
| 9 | const TokenIndex = Tree.TokenIndex; | |
| 10 | ||
| 11 | const Pack = @This(); | |
| 12 | ||
| 13 | pragma: Pragma = .{ | |
| 14 | .deinit = deinit, | |
| 15 | .parserHandler = parserHandler, | |
| 16 | .preserveTokens = preserveTokens, | |
| 17 | }, | |
| 18 | stack: std.ArrayListUnmanaged(struct { label: []const u8, val: u8 }) = .{}, | |
| 19 | ||
| 20 | pub fn init(allocator: mem.Allocator) !*Pragma { | |
| 21 | var pack = try allocator.create(Pack); | |
| 22 | pack.* = .{}; | |
| 23 | return &pack.pragma; | |
| 24 | } | |
| 25 | ||
| 26 | fn deinit(pragma: *Pragma, comp: *Compilation) void { | |
| 27 | var self = @fieldParentPtr(Pack, "pragma", pragma); | |
| 28 | self.stack.deinit(comp.gpa); | |
| 29 | comp.gpa.destroy(self); | |
| 30 | } | |
| 31 | ||
| 32 | fn parserHandler(pragma: *Pragma, p: *Parser, start_idx: TokenIndex) Compilation.Error!void { | |
| 33 | var pack = @fieldParentPtr(Pack, "pragma", pragma); | |
| 34 | var idx = start_idx + 1; | |
| 35 | const l_paren = p.pp.tokens.get(idx); | |
| 36 | if (l_paren.id != .l_paren) { | |
| 37 | return p.pp.comp.diag.add(.{ | |
| 38 | .tag = .pragma_pack_lparen, | |
| 39 | .loc = l_paren.loc, | |
| 40 | }, l_paren.expansionSlice()); | |
| 41 | } | |
| 42 | idx += 1; | |
| 43 | ||
| 44 | // TODO -fapple-pragma-pack -fxl-pragma-pack | |
| 45 | const apple_or_xl = false; | |
| 46 | const tok_ids = p.pp.tokens.items(.id); | |
| 47 | const arg = idx; | |
| 48 | switch (tok_ids[arg]) { | |
| 49 | .identifier => { | |
| 50 | idx += 1; | |
| 51 | const Action = enum { | |
| 52 | show, | |
| 53 | push, | |
| 54 | pop, | |
| 55 | }; | |
| 56 | const action = std.meta.stringToEnum(Action, p.tokSlice(arg)) orelse { | |
| 57 | return p.errTok(.pragma_pack_unknown_action, arg); | |
| 58 | }; | |
| 59 | switch (action) { | |
| 60 | .show => { | |
| 61 | try p.errExtra(.pragma_pack_show, arg, .{ .unsigned = p.pragma_pack orelse 8 }); | |
| 62 | }, | |
| 63 | .push, .pop => { | |
| 64 | var new_val: ?u8 = null; | |
| 65 | var label: ?[]const u8 = null; | |
| 66 | if (tok_ids[idx] == .comma) { | |
| 67 | idx += 1; | |
| 68 | const next = idx; | |
| 69 | idx += 1; | |
| 70 | switch (tok_ids[next]) { | |
| 71 | .pp_num => new_val = (try packInt(p, next)) orelse return, | |
| 72 | .identifier => { | |
| 73 | label = p.tokSlice(next); | |
| 74 | if (tok_ids[idx] == .comma) { | |
| 75 | idx += 1; | |
| 76 | const int = idx; | |
| 77 | idx += 1; | |
| 78 | if (tok_ids[int] != .pp_num) return p.errTok(.pragma_pack_int_ident, int); | |
| 79 | new_val = (try packInt(p, int)) orelse return; | |
| 80 | } | |
| 81 | }, | |
| 82 | else => return p.errTok(.pragma_pack_int_ident, next), | |
| 83 | } | |
| 84 | } | |
| 85 | if (action == .push) { | |
| 86 | try pack.stack.append(p.pp.comp.gpa, .{ .label = label orelse "", .val = p.pragma_pack orelse 8 }); | |
| 87 | } else { | |
| 88 | pack.pop(p, label); | |
| 89 | if (new_val != null) { | |
| 90 | try p.errTok(.pragma_pack_undefined_pop, arg); | |
| 91 | } else if (pack.stack.items.len == 0) { | |
| 92 | try p.errTok(.pragma_pack_empty_stack, arg); | |
| 93 | } | |
| 94 | } | |
| 95 | if (new_val) |some| { | |
| 96 | p.pragma_pack = some; | |
| 97 | } | |
| 98 | }, | |
| 99 | } | |
| 100 | }, | |
| 101 | .r_paren => if (apple_or_xl) { | |
| 102 | pack.pop(p, null); | |
| 103 | } else { | |
| 104 | p.pragma_pack = null; | |
| 105 | }, | |
| 106 | .pp_num => { | |
| 107 | const new_val = (try packInt(p, arg)) orelse return; | |
| 108 | idx += 1; | |
| 109 | if (apple_or_xl) { | |
| 110 | try pack.stack.append(p.pp.comp.gpa, .{ .label = "", .val = p.pragma_pack }); | |
| 111 | } | |
| 112 | p.pragma_pack = new_val; | |
| 113 | }, | |
| 114 | else => {}, | |
| 115 | } | |
| 116 | ||
| 117 | if (tok_ids[idx] != .r_paren) { | |
| 118 | return p.errTok(.pragma_pack_rparen, idx); | |
| 119 | } | |
| 120 | } | |
| 121 | ||
| 122 | fn packInt(p: *Parser, tok_i: TokenIndex) Compilation.Error!?u8 { | |
| 123 | const res = p.parseNumberToken(tok_i) catch |err| switch (err) { | |
| 124 | error.ParsingFailed => { | |
| 125 | try p.errTok(.pragma_pack_int, tok_i); | |
| 126 | return null; | |
| 127 | }, | |
| 128 | else => |e| return e, | |
| 129 | }; | |
| 130 | const int = if (res.val.tag == .int) res.val.getInt(u64) else 99; | |
| 131 | switch (int) { | |
| 132 | 1, 2, 4, 8, 16 => return @intCast(int), | |
| 133 | else => { | |
| 134 | try p.errTok(.pragma_pack_int, tok_i); | |
| 135 | return null; | |
| 136 | }, | |
| 137 | } | |
| 138 | } | |
| 139 | ||
| 140 | fn pop(pack: *Pack, p: *Parser, maybe_label: ?[]const u8) void { | |
| 141 | if (maybe_label) |label| { | |
| 142 | var i = pack.stack.items.len; | |
| 143 | while (i > 0) { | |
| 144 | i -= 1; | |
| 145 | if (std.mem.eql(u8, pack.stack.items[i].label, label)) { | |
| 146 | const prev = pack.stack.orderedRemove(i); | |
| 147 | p.pragma_pack = prev.val; | |
| 148 | return; | |
| 149 | } | |
| 150 | } | |
| 151 | } else { | |
| 152 | const prev = pack.stack.popOrNull() orelse { | |
| 153 | p.pragma_pack = 2; | |
| 154 | return; | |
| 155 | }; | |
| 156 | p.pragma_pack = prev.val; | |
| 157 | } | |
| 158 | } | |
| 159 | ||
| 160 | fn preserveTokens(_: *Pragma, pp: *Preprocessor, start_idx: TokenIndex) bool { | |
| 161 | _ = pp; | |
| 162 | _ = start_idx; | |
| 163 | return true; | |
| 164 | } |
deps/aro/record_layout.zig created+669| ... | ... | @@ -0,0 +1,669 @@ |
| 1 | //! Record layout code adapted from https://github.com/mahkoh/repr-c | |
| 2 | //! Licensed under MIT license: https://github.com/mahkoh/repr-c/tree/master/repc/facade | |
| 3 | ||
| 4 | const std = @import("std"); | |
| 5 | const Type = @import("Type.zig"); | |
| 6 | const Attribute = @import("Attribute.zig"); | |
| 7 | const Compilation = @import("Compilation.zig"); | |
| 8 | const Parser = @import("Parser.zig"); | |
| 9 | const Record = Type.Record; | |
| 10 | const Field = Record.Field; | |
| 11 | const TypeLayout = Type.TypeLayout; | |
| 12 | const FieldLayout = Type.FieldLayout; | |
| 13 | const target_util = @import("target.zig"); | |
| 14 | ||
| 15 | const BITS_PER_BYTE = 8; | |
| 16 | ||
| 17 | const OngoingBitfield = struct { | |
| 18 | size_bits: u64, | |
| 19 | unused_size_bits: u64, | |
| 20 | }; | |
| 21 | ||
| 22 | const SysVContext = struct { | |
| 23 | /// Does the record have an __attribute__((packed)) annotation. | |
| 24 | attr_packed: bool, | |
| 25 | /// The value of #pragma pack(N) at the type level if any. | |
| 26 | max_field_align_bits: ?u64, | |
| 27 | /// The alignment of this record. | |
| 28 | aligned_bits: u32, | |
| 29 | is_union: bool, | |
| 30 | /// The size of the record. This might not be a multiple of 8 if the record contains bit-fields. | |
| 31 | /// For structs, this is also the offset of the first bit after the last field. | |
| 32 | size_bits: u64, | |
| 33 | /// non-null if the previous field was a non-zero-sized bit-field. Only used by MinGW. | |
| 34 | ongoing_bitfield: ?OngoingBitfield, | |
| 35 | ||
| 36 | comp: *const Compilation, | |
| 37 | ||
| 38 | fn init(ty: Type, comp: *const Compilation, pragma_pack: ?u8) SysVContext { | |
| 39 | var pack_value: ?u64 = null; | |
| 40 | if (pragma_pack) |pak| { | |
| 41 | pack_value = pak * BITS_PER_BYTE; | |
| 42 | } | |
| 43 | var req_align: u29 = BITS_PER_BYTE; | |
| 44 | if (ty.requestedAlignment(comp)) |aln| { | |
| 45 | req_align = aln * BITS_PER_BYTE; | |
| 46 | } | |
| 47 | return SysVContext{ | |
| 48 | .attr_packed = ty.hasAttribute(.@"packed"), | |
| 49 | .max_field_align_bits = pack_value, | |
| 50 | .aligned_bits = req_align, | |
| 51 | .is_union = ty.is(.@"union"), | |
| 52 | .size_bits = 0, | |
| 53 | .comp = comp, | |
| 54 | .ongoing_bitfield = null, | |
| 55 | }; | |
| 56 | } | |
| 57 | ||
| 58 | fn layoutFields(self: *SysVContext, rec: *const Record) void { | |
| 59 | for (rec.fields, 0..) |*fld, fld_indx| { | |
| 60 | const type_layout = computeLayout(fld.ty, self.comp); | |
| 61 | ||
| 62 | var field_attrs: ?[]const Attribute = null; | |
| 63 | if (rec.field_attributes) |attrs| { | |
| 64 | field_attrs = attrs[fld_indx]; | |
| 65 | } | |
| 66 | if (self.comp.target.isMinGW()) { | |
| 67 | fld.layout = self.layoutMinGWField(fld, field_attrs, type_layout); | |
| 68 | } else { | |
| 69 | if (fld.isRegularField()) { | |
| 70 | fld.layout = self.layoutRegularField(field_attrs, type_layout); | |
| 71 | } else { | |
| 72 | fld.layout = self.layoutBitField(field_attrs, type_layout, fld.isNamed(), fld.specifiedBitWidth()); | |
| 73 | } | |
| 74 | } | |
| 75 | } | |
| 76 | } | |
| 77 | ||
| 78 | /// On MinGW the alignment of the field is calculated in the usual way except that the alignment of | |
| 79 | /// the underlying type is ignored in three cases | |
| 80 | /// - the field is packed | |
| 81 | /// - the field is a bit-field and the previous field was a non-zero-sized bit-field with the same type size | |
| 82 | /// - the field is a zero-sized bit-field and the previous field was not a non-zero-sized bit-field | |
| 83 | /// See test case 0068. | |
| 84 | fn ignoreTypeAlignment(is_attr_packed: bool, bit_width: ?u32, ongoing_bitfield: ?OngoingBitfield, fld_layout: TypeLayout) bool { | |
| 85 | if (is_attr_packed) return true; | |
| 86 | if (bit_width) |width| { | |
| 87 | if (ongoing_bitfield) |ongoing| { | |
| 88 | if (ongoing.size_bits == fld_layout.size_bits) return true; | |
| 89 | } else { | |
| 90 | if (width == 0) return true; | |
| 91 | } | |
| 92 | } | |
| 93 | return false; | |
| 94 | } | |
| 95 | ||
| 96 | fn layoutMinGWField( | |
| 97 | self: *SysVContext, | |
| 98 | field: *const Field, | |
| 99 | field_attrs: ?[]const Attribute, | |
| 100 | field_layout: TypeLayout, | |
| 101 | ) FieldLayout { | |
| 102 | const annotation_alignment_bits = BITS_PER_BYTE * (Type.annotationAlignment(self.comp, field_attrs) orelse 1); | |
| 103 | const is_attr_packed = self.attr_packed or isPacked(field_attrs); | |
| 104 | const ignore_type_alignment = ignoreTypeAlignment(is_attr_packed, field.bit_width, self.ongoing_bitfield, field_layout); | |
| 105 | ||
| 106 | var field_alignment_bits: u64 = field_layout.field_alignment_bits; | |
| 107 | if (ignore_type_alignment) { | |
| 108 | field_alignment_bits = BITS_PER_BYTE; | |
| 109 | } | |
| 110 | field_alignment_bits = @max(field_alignment_bits, annotation_alignment_bits); | |
| 111 | if (self.max_field_align_bits) |bits| { | |
| 112 | field_alignment_bits = @min(field_alignment_bits, bits); | |
| 113 | } | |
| 114 | ||
| 115 | // The field affects the record alignment in one of three cases | |
| 116 | // - the field is a regular field | |
| 117 | // - the field is a zero-width bit-field following a non-zero-width bit-field | |
| 118 | // - the field is a non-zero-width bit-field and not packed. | |
| 119 | // See test case 0069. | |
| 120 | const update_record_alignment = | |
| 121 | field.isRegularField() or | |
| 122 | (field.specifiedBitWidth() == 0 and self.ongoing_bitfield != null) or | |
| 123 | (field.specifiedBitWidth() != 0 and !is_attr_packed); | |
| 124 | ||
| 125 | // If a field affects the alignment of a record, the alignment is calculated in the | |
| 126 | // usual way except that __attribute__((packed)) is ignored on a zero-width bit-field. | |
| 127 | // See test case 0068. | |
| 128 | if (update_record_alignment) { | |
| 129 | var ty_alignment_bits = field_layout.field_alignment_bits; | |
| 130 | if (is_attr_packed and (field.isRegularField() or field.specifiedBitWidth() != 0)) { | |
| 131 | ty_alignment_bits = BITS_PER_BYTE; | |
| 132 | } | |
| 133 | ty_alignment_bits = @max(ty_alignment_bits, annotation_alignment_bits); | |
| 134 | if (self.max_field_align_bits) |bits| { | |
| 135 | ty_alignment_bits = @intCast(@min(ty_alignment_bits, bits)); | |
| 136 | } | |
| 137 | self.aligned_bits = @max(self.aligned_bits, ty_alignment_bits); | |
| 138 | } | |
| 139 | ||
| 140 | // NOTE: ty_alignment_bits and field_alignment_bits are different in the following case: | |
| 141 | // Y = { size: 64, alignment: 64 }struct { | |
| 142 | // { offset: 0, size: 1 }c { size: 8, alignment: 8 }char:1, | |
| 143 | // @attr_packed _ { size: 64, alignment: 64 }long long:0, | |
| 144 | // { offset: 8, size: 8 }d { size: 8, alignment: 8 }char, | |
| 145 | // } | |
| 146 | if (field.isRegularField()) { | |
| 147 | return self.layoutRegularFieldMinGW(field_layout.size_bits, field_alignment_bits); | |
| 148 | } else { | |
| 149 | return self.layoutBitFieldMinGW(field_layout.size_bits, field_alignment_bits, field.isNamed(), field.specifiedBitWidth()); | |
| 150 | } | |
| 151 | } | |
| 152 | ||
| 153 | fn layoutBitFieldMinGW( | |
| 154 | self: *SysVContext, | |
| 155 | ty_size_bits: u64, | |
| 156 | field_alignment_bits: u64, | |
| 157 | is_named: bool, | |
| 158 | width: u64, | |
| 159 | ) FieldLayout { | |
| 160 | std.debug.assert(width <= ty_size_bits); // validated in parser | |
| 161 | ||
| 162 | // In a union, the size of the underlying type does not affect the size of the union. | |
| 163 | // See test case 0070. | |
| 164 | if (self.is_union) { | |
| 165 | self.size_bits = @max(self.size_bits, width); | |
| 166 | if (!is_named) return .{}; | |
| 167 | return .{ | |
| 168 | .offset_bits = 0, | |
| 169 | .size_bits = width, | |
| 170 | }; | |
| 171 | } | |
| 172 | if (width == 0) { | |
| 173 | self.ongoing_bitfield = null; | |
| 174 | } else { | |
| 175 | // If there is an ongoing bit-field in a struct whose underlying type has the same size and | |
| 176 | // if there is enough space left to place this bit-field, then this bit-field is placed in | |
| 177 | // the ongoing bit-field and the size of the struct is not affected by this | |
| 178 | // bit-field. See test case 0037. | |
| 179 | if (self.ongoing_bitfield) |*ongoing| { | |
| 180 | if (ongoing.size_bits == ty_size_bits and ongoing.unused_size_bits >= width) { | |
| 181 | const offset_bits = self.size_bits - ongoing.unused_size_bits; | |
| 182 | ongoing.unused_size_bits -= width; | |
| 183 | if (!is_named) return .{}; | |
| 184 | return .{ | |
| 185 | .offset_bits = offset_bits, | |
| 186 | .size_bits = width, | |
| 187 | }; | |
| 188 | } | |
| 189 | } | |
| 190 | // Otherwise this field is part of a new ongoing bit-field. | |
| 191 | self.ongoing_bitfield = .{ | |
| 192 | .size_bits = ty_size_bits, | |
| 193 | .unused_size_bits = ty_size_bits - width, | |
| 194 | }; | |
| 195 | } | |
| 196 | const offset_bits = std.mem.alignForward(u64, self.size_bits, field_alignment_bits); | |
| 197 | self.size_bits = if (width == 0) offset_bits else offset_bits + ty_size_bits; | |
| 198 | if (!is_named) return .{}; | |
| 199 | return .{ | |
| 200 | .offset_bits = offset_bits, | |
| 201 | .size_bits = width, | |
| 202 | }; | |
| 203 | } | |
| 204 | ||
| 205 | fn layoutRegularFieldMinGW( | |
| 206 | self: *SysVContext, | |
| 207 | ty_size_bits: u64, | |
| 208 | field_alignment_bits: u64, | |
| 209 | ) FieldLayout { | |
| 210 | self.ongoing_bitfield = null; | |
| 211 | // A struct field starts at the next offset in the struct that is properly | |
| 212 | // aligned with respect to the start of the struct. See test case 0033. | |
| 213 | // A union field always starts at offset 0. | |
| 214 | const offset_bits = if (self.is_union) 0 else std.mem.alignForward(u64, self.size_bits, field_alignment_bits); | |
| 215 | ||
| 216 | // Set the size of the record to the maximum of the current size and the end of | |
| 217 | // the field. See test case 0034. | |
| 218 | self.size_bits = @max(self.size_bits, offset_bits + ty_size_bits); | |
| 219 | ||
| 220 | return .{ | |
| 221 | .offset_bits = offset_bits, | |
| 222 | .size_bits = ty_size_bits, | |
| 223 | }; | |
| 224 | } | |
| 225 | ||
| 226 | fn layoutRegularField( | |
| 227 | self: *SysVContext, | |
| 228 | fld_attrs: ?[]const Attribute, | |
| 229 | fld_layout: TypeLayout, | |
| 230 | ) FieldLayout { | |
| 231 | var fld_align_bits = fld_layout.field_alignment_bits; | |
| 232 | ||
| 233 | // If the struct or the field is packed, then the alignment of the underlying type is | |
| 234 | // ignored. See test case 0084. | |
| 235 | if (self.attr_packed or isPacked(fld_attrs)) { | |
| 236 | fld_align_bits = BITS_PER_BYTE; | |
| 237 | } | |
| 238 | ||
| 239 | // The field alignment can be increased by __attribute__((aligned)) annotations on the | |
| 240 | // field. See test case 0085. | |
| 241 | if (Type.annotationAlignment(self.comp, fld_attrs)) |anno| { | |
| 242 | fld_align_bits = @max(fld_align_bits, anno * BITS_PER_BYTE); | |
| 243 | } | |
| 244 | ||
| 245 | // #pragma pack takes precedence over all other attributes. See test cases 0084 and | |
| 246 | // 0085. | |
| 247 | if (self.max_field_align_bits) |req_bits| { | |
| 248 | fld_align_bits = @intCast(@min(fld_align_bits, req_bits)); | |
| 249 | } | |
| 250 | ||
| 251 | // A struct field starts at the next offset in the struct that is properly | |
| 252 | // aligned with respect to the start of the struct. | |
| 253 | const offset_bits = if (self.is_union) 0 else std.mem.alignForward(u64, self.size_bits, fld_align_bits); | |
| 254 | const size_bits = fld_layout.size_bits; | |
| 255 | ||
| 256 | // The alignment of a record is the maximum of its field alignments. See test cases | |
| 257 | // 0084, 0085, 0086. | |
| 258 | self.size_bits = @max(self.size_bits, offset_bits + size_bits); | |
| 259 | self.aligned_bits = @max(self.aligned_bits, fld_align_bits); | |
| 260 | ||
| 261 | return .{ | |
| 262 | .offset_bits = offset_bits, | |
| 263 | .size_bits = size_bits, | |
| 264 | }; | |
| 265 | } | |
| 266 | ||
| 267 | fn layoutBitField( | |
| 268 | self: *SysVContext, | |
| 269 | fld_attrs: ?[]const Attribute, | |
| 270 | fld_layout: TypeLayout, | |
| 271 | is_named: bool, | |
| 272 | bit_width: u64, | |
| 273 | ) FieldLayout { | |
| 274 | const ty_size_bits = fld_layout.size_bits; | |
| 275 | var ty_fld_algn_bits: u32 = fld_layout.field_alignment_bits; | |
| 276 | ||
| 277 | if (bit_width > 0) { | |
| 278 | std.debug.assert(bit_width <= ty_size_bits); // Checked in parser | |
| 279 | // Some targets ignore the alignment of the underlying type when laying out | |
| 280 | // non-zero-sized bit-fields. See test case 0072. On such targets, bit-fields never | |
| 281 | // cross a storage boundary. See test case 0081. | |
| 282 | if (target_util.ignoreNonZeroSizedBitfieldTypeAlignment(self.comp.target)) { | |
| 283 | ty_fld_algn_bits = 1; | |
| 284 | } | |
| 285 | } else { | |
| 286 | // Some targets ignore the alignment of the underlying type when laying out | |
| 287 | // zero-sized bit-fields. See test case 0073. | |
| 288 | if (target_util.ignoreZeroSizedBitfieldTypeAlignment(self.comp.target)) { | |
| 289 | ty_fld_algn_bits = 1; | |
| 290 | } | |
| 291 | // Some targets have a minimum alignment of zero-sized bit-fields. See test case | |
| 292 | // 0074. | |
| 293 | if (target_util.minZeroWidthBitfieldAlignment(self.comp.target)) |target_align| { | |
| 294 | ty_fld_algn_bits = @max(ty_fld_algn_bits, target_align); | |
| 295 | } | |
| 296 | } | |
| 297 | ||
| 298 | // __attribute__((packed)) on the record is identical to __attribute__((packed)) on each | |
| 299 | // field. See test case 0067. | |
| 300 | const attr_packed = self.attr_packed or isPacked(fld_attrs); | |
| 301 | const has_packing_annotation = attr_packed or self.max_field_align_bits != null; | |
| 302 | ||
| 303 | const annotation_alignment: u32 = if (Type.annotationAlignment(self.comp, fld_attrs)) |anno| anno * BITS_PER_BYTE else 1; | |
| 304 | ||
| 305 | const first_unused_bit: u64 = if (self.is_union) 0 else self.size_bits; | |
| 306 | var field_align_bits: u64 = 1; | |
| 307 | ||
| 308 | if (bit_width == 0) { | |
| 309 | field_align_bits = @max(ty_fld_algn_bits, annotation_alignment); | |
| 310 | } else if (self.comp.langopts.emulate == .gcc) { | |
| 311 | // On GCC, the field alignment is at least the alignment requested by annotations | |
| 312 | // except as restricted by #pragma pack. See test case 0083. | |
| 313 | field_align_bits = annotation_alignment; | |
| 314 | if (self.max_field_align_bits) |max_bits| { | |
| 315 | field_align_bits = @min(annotation_alignment, max_bits); | |
| 316 | } | |
| 317 | ||
| 318 | // On GCC, if there are no packing annotations and | |
| 319 | // - the field would otherwise start at an offset such that it would cross a | |
| 320 | // storage boundary or | |
| 321 | // - the alignment of the type is larger than its size, | |
| 322 | // then it is aligned to the type's field alignment. See test case 0083. | |
| 323 | if (!has_packing_annotation) { | |
| 324 | const start_bit = std.mem.alignForward(u64, first_unused_bit, field_align_bits); | |
| 325 | ||
| 326 | const does_field_cross_boundary = start_bit % ty_fld_algn_bits + bit_width > ty_size_bits; | |
| 327 | ||
| 328 | if (ty_fld_algn_bits > ty_size_bits or does_field_cross_boundary) { | |
| 329 | field_align_bits = @max(field_align_bits, ty_fld_algn_bits); | |
| 330 | } | |
| 331 | } | |
| 332 | } else { | |
| 333 | std.debug.assert(self.comp.langopts.emulate == .clang); | |
| 334 | ||
| 335 | // On Clang, the alignment requested by annotations is not respected if it is | |
| 336 | // larger than the value of #pragma pack. See test case 0083. | |
| 337 | if (annotation_alignment <= self.max_field_align_bits orelse std.math.maxInt(u29)) { | |
| 338 | field_align_bits = @max(field_align_bits, annotation_alignment); | |
| 339 | } | |
| 340 | // On Clang, if there are no packing annotations and the field would cross a | |
| 341 | // storage boundary if it were positioned at the first unused bit in the record, | |
| 342 | // it is aligned to the type's field alignment. See test case 0083. | |
| 343 | if (!has_packing_annotation) { | |
| 344 | const does_field_cross_boundary = first_unused_bit % ty_fld_algn_bits + bit_width > ty_size_bits; | |
| 345 | ||
| 346 | if (does_field_cross_boundary) | |
| 347 | field_align_bits = @max(field_align_bits, ty_fld_algn_bits); | |
| 348 | } | |
| 349 | } | |
| 350 | ||
| 351 | const offset_bits = std.mem.alignForward(u64, first_unused_bit, field_align_bits); | |
| 352 | self.size_bits = @max(self.size_bits, offset_bits + bit_width); | |
| 353 | ||
| 354 | // Unnamed fields do not contribute to the record alignment except on a few targets. | |
| 355 | // See test case 0079. | |
| 356 | if (is_named or target_util.unnamedFieldAffectsAlignment(self.comp.target)) { | |
| 357 | var inherited_align_bits: u32 = undefined; | |
| 358 | ||
| 359 | if (bit_width == 0) { | |
| 360 | // If the width is 0, #pragma pack and __attribute__((packed)) are ignored. | |
| 361 | // See test case 0075. | |
| 362 | inherited_align_bits = @max(ty_fld_algn_bits, annotation_alignment); | |
| 363 | } else if (self.max_field_align_bits) |max_align_bits| { | |
| 364 | // Otherwise, if a #pragma pack is in effect, __attribute__((packed)) on the field or | |
| 365 | // record is ignored. See test case 0076. | |
| 366 | inherited_align_bits = @max(ty_fld_algn_bits, annotation_alignment); | |
| 367 | inherited_align_bits = @intCast(@min(inherited_align_bits, max_align_bits)); | |
| 368 | } else if (attr_packed) { | |
| 369 | // Otherwise, if the field or the record is packed, the field alignment is 1 bit unless | |
| 370 | // it is explicitly increased with __attribute__((aligned)). See test case 0077. | |
| 371 | inherited_align_bits = annotation_alignment; | |
| 372 | } else { | |
| 373 | // Otherwise, the field alignment is the field alignment of the underlying type unless | |
| 374 | // it is explicitly increased with __attribute__((aligned)). See test case 0078. | |
| 375 | inherited_align_bits = @max(ty_fld_algn_bits, annotation_alignment); | |
| 376 | } | |
| 377 | self.aligned_bits = @max(self.aligned_bits, inherited_align_bits); | |
| 378 | } | |
| 379 | ||
| 380 | if (!is_named) return .{}; | |
| 381 | return .{ | |
| 382 | .size_bits = bit_width, | |
| 383 | .offset_bits = offset_bits, | |
| 384 | }; | |
| 385 | } | |
| 386 | }; | |
| 387 | ||
| 388 | const MsvcContext = struct { | |
| 389 | req_align_bits: u32, | |
| 390 | max_field_align_bits: ?u32, | |
| 391 | /// The alignment of pointers that point to an object of this type. This is greater than or equal | |
| 392 | /// to the required alignment. Once all fields have been laid out, the size of the record will be | |
| 393 | /// rounded up to this value. | |
| 394 | pointer_align_bits: u32, | |
| 395 | /// The alignment of this type when it is used as a record field. This is greater than or equal to | |
| 396 | /// the pointer alignment. | |
| 397 | field_align_bits: u32, | |
| 398 | size_bits: u64, | |
| 399 | ongoing_bitfield: ?OngoingBitfield, | |
| 400 | contains_non_bitfield: bool, | |
| 401 | is_union: bool, | |
| 402 | comp: *const Compilation, | |
| 403 | ||
| 404 | fn init(ty: Type, comp: *const Compilation, pragma_pack: ?u8) MsvcContext { | |
| 405 | var pack_value: ?u32 = null; | |
| 406 | if (ty.hasAttribute(.@"packed")) { | |
| 407 | // __attribute__((packed)) behaves like #pragma pack(1) in clang. See test case 0056. | |
| 408 | pack_value = BITS_PER_BYTE; | |
| 409 | } | |
| 410 | if (pack_value == null) { | |
| 411 | if (pragma_pack) |pack| { | |
| 412 | pack_value = pack * BITS_PER_BYTE; | |
| 413 | } | |
| 414 | } | |
| 415 | if (pack_value) |pack| { | |
| 416 | pack_value = msvcPragmaPack(comp, pack); | |
| 417 | } | |
| 418 | ||
| 419 | // The required alignment can be increased by adding a __declspec(align) | |
| 420 | // annotation. See test case 0023. | |
| 421 | var must_align: u29 = BITS_PER_BYTE; | |
| 422 | if (ty.requestedAlignment(comp)) |req_align| { | |
| 423 | must_align = req_align * BITS_PER_BYTE; | |
| 424 | } | |
| 425 | return MsvcContext{ | |
| 426 | .req_align_bits = must_align, | |
| 427 | .pointer_align_bits = must_align, | |
| 428 | .field_align_bits = must_align, | |
| 429 | .size_bits = 0, | |
| 430 | .max_field_align_bits = pack_value, | |
| 431 | .ongoing_bitfield = null, | |
| 432 | .contains_non_bitfield = false, | |
| 433 | .is_union = ty.is(.@"union"), | |
| 434 | .comp = comp, | |
| 435 | }; | |
| 436 | } | |
| 437 | ||
| 438 | fn layoutField(self: *MsvcContext, fld: *const Field, fld_attrs: ?[]const Attribute) FieldLayout { | |
| 439 | const type_layout = computeLayout(fld.ty, self.comp); | |
| 440 | ||
| 441 | // The required alignment of the field is the maximum of the required alignment of the | |
| 442 | // underlying type and the __declspec(align) annotation on the field itself. | |
| 443 | // See test case 0028. | |
| 444 | var req_align = type_layout.required_alignment_bits; | |
| 445 | if (Type.annotationAlignment(self.comp, fld_attrs)) |anno| { | |
| 446 | req_align = @max(anno * BITS_PER_BYTE, req_align); | |
| 447 | } | |
| 448 | ||
| 449 | // The required alignment of a record is the maximum of the required alignments of its | |
| 450 | // fields except that the required alignment of bitfields is ignored. | |
| 451 | // See test case 0029. | |
| 452 | if (fld.isRegularField()) { | |
| 453 | self.req_align_bits = @max(self.req_align_bits, req_align); | |
| 454 | } | |
| 455 | ||
| 456 | // The offset of the field is based on the field alignment of the underlying type. | |
| 457 | // See test case 0027. | |
| 458 | var fld_align_bits = type_layout.field_alignment_bits; | |
| 459 | if (self.max_field_align_bits) |max_align| { | |
| 460 | fld_align_bits = @min(fld_align_bits, max_align); | |
| 461 | } | |
| 462 | // check the requested alignment of the field type. | |
| 463 | if (fld.ty.requestedAlignment(self.comp)) |type_req_align| { | |
| 464 | fld_align_bits = @max(fld_align_bits, type_req_align * 8); | |
| 465 | } | |
| 466 | ||
| 467 | if (isPacked(fld_attrs)) { | |
| 468 | // __attribute__((packed)) on a field is a clang extension. It behaves as if #pragma | |
| 469 | // pack(1) had been applied only to this field. See test case 0057. | |
| 470 | fld_align_bits = BITS_PER_BYTE; | |
| 471 | } | |
| 472 | // __attribute__((packed)) on a field is a clang extension. It behaves as if #pragma | |
| 473 | // pack(1) had been applied only to this field. See test case 0057. | |
| 474 | fld_align_bits = @max(fld_align_bits, req_align); | |
| 475 | if (fld.isRegularField()) { | |
| 476 | return self.layoutRegularField(type_layout.size_bits, fld_align_bits); | |
| 477 | } else { | |
| 478 | return self.layoutBitField(type_layout.size_bits, fld_align_bits, fld.specifiedBitWidth()); | |
| 479 | } | |
| 480 | } | |
| 481 | ||
| 482 | fn layoutBitField(self: *MsvcContext, ty_size_bits: u64, field_align: u32, bit_width: u32) FieldLayout { | |
| 483 | if (bit_width == 0) { | |
| 484 | // A zero-sized bit-field that does not follow a non-zero-sized bit-field does not affect | |
| 485 | // the overall layout of the record. Even in a union where the order would otherwise | |
| 486 | // not matter. See test case 0035. | |
| 487 | if (self.ongoing_bitfield) |_| { | |
| 488 | self.ongoing_bitfield = null; | |
| 489 | } else { | |
| 490 | // this field takes 0 space. | |
| 491 | return .{ .offset_bits = self.size_bits, .size_bits = bit_width }; | |
| 492 | } | |
| 493 | } else { | |
| 494 | std.debug.assert(bit_width <= ty_size_bits); | |
| 495 | // If there is an ongoing bit-field in a struct whose underlying type has the same size and | |
| 496 | // if there is enough space left to place this bit-field, then this bit-field is placed in | |
| 497 | // the ongoing bit-field and the overall layout of the struct is not affected by this | |
| 498 | // bit-field. See test case 0037. | |
| 499 | if (!self.is_union) { | |
| 500 | if (self.ongoing_bitfield) |*p| { | |
| 501 | if (p.size_bits == ty_size_bits and p.unused_size_bits >= bit_width) { | |
| 502 | const offset_bits = self.size_bits - p.unused_size_bits; | |
| 503 | p.unused_size_bits -= bit_width; | |
| 504 | return .{ .offset_bits = offset_bits, .size_bits = bit_width }; | |
| 505 | } | |
| 506 | } | |
| 507 | } | |
| 508 | // Otherwise this field is part of a new ongoing bit-field. | |
| 509 | self.ongoing_bitfield = .{ .size_bits = ty_size_bits, .unused_size_bits = ty_size_bits - bit_width }; | |
| 510 | } | |
| 511 | const offset_bits = if (!self.is_union) bits: { | |
| 512 | // This is the one place in the layout of a record where the pointer alignment might | |
| 513 | // get assigned a smaller value than the field alignment. This can only happen if | |
| 514 | // the field or the type of the field has a required alignment. Otherwise the value | |
| 515 | // of field_alignment_bits is already bound by max_field_alignment_bits. | |
| 516 | // See test case 0038. | |
| 517 | const p_align = if (self.max_field_align_bits) |max_fld_align| | |
| 518 | @min(max_fld_align, field_align) | |
| 519 | else | |
| 520 | field_align; | |
| 521 | self.pointer_align_bits = @max(self.pointer_align_bits, p_align); | |
| 522 | self.field_align_bits = @max(self.field_align_bits, field_align); | |
| 523 | ||
| 524 | const offset_bits = std.mem.alignForward(u64, self.size_bits, field_align); | |
| 525 | self.size_bits = if (bit_width == 0) offset_bits else offset_bits + ty_size_bits; | |
| 526 | ||
| 527 | break :bits offset_bits; | |
| 528 | } else bits: { | |
| 529 | // Bit-fields do not affect the alignment of a union. See test case 0041. | |
| 530 | self.size_bits = @max(self.size_bits, ty_size_bits); | |
| 531 | break :bits 0; | |
| 532 | }; | |
| 533 | return .{ .offset_bits = offset_bits, .size_bits = bit_width }; | |
| 534 | } | |
| 535 | ||
| 536 | fn layoutRegularField(self: *MsvcContext, size_bits: u64, field_align: u32) FieldLayout { | |
| 537 | self.contains_non_bitfield = true; | |
| 538 | self.ongoing_bitfield = null; | |
| 539 | // The alignment of the field affects both the pointer alignment and the field | |
| 540 | // alignment of the record. See test case 0032. | |
| 541 | self.pointer_align_bits = @max(self.pointer_align_bits, field_align); | |
| 542 | self.field_align_bits = @max(self.field_align_bits, field_align); | |
| 543 | const offset_bits = switch (self.is_union) { | |
| 544 | true => 0, | |
| 545 | false => std.mem.alignForward(u64, self.size_bits, field_align), | |
| 546 | }; | |
| 547 | self.size_bits = @max(self.size_bits, offset_bits + size_bits); | |
| 548 | return .{ .offset_bits = offset_bits, .size_bits = size_bits }; | |
| 549 | } | |
| 550 | fn handleZeroSizedRecord(self: *MsvcContext) void { | |
| 551 | if (self.is_union) { | |
| 552 | // MSVC does not allow unions without fields. | |
| 553 | // If all fields in a union have size 0, the size of the union is set to | |
| 554 | // - its field alignment if it contains at least one non-bitfield | |
| 555 | // - 4 bytes if it contains only bitfields | |
| 556 | // See test case 0025. | |
| 557 | if (self.contains_non_bitfield) { | |
| 558 | self.size_bits = self.field_align_bits; | |
| 559 | } else { | |
| 560 | self.size_bits = 4 * BITS_PER_BYTE; | |
| 561 | } | |
| 562 | } else { | |
| 563 | // If all fields in a struct have size 0, its size is set to its required alignment | |
| 564 | // but at least to 4 bytes. See test case 0026. | |
| 565 | self.size_bits = @max(self.req_align_bits, 4 * BITS_PER_BYTE); | |
| 566 | self.pointer_align_bits = @intCast(@min(self.pointer_align_bits, self.size_bits)); | |
| 567 | } | |
| 568 | } | |
| 569 | }; | |
| 570 | ||
| 571 | pub fn compute(rec: *Type.Record, ty: Type, comp: *const Compilation, pragma_pack: ?u8) void { | |
| 572 | switch (comp.langopts.emulate) { | |
| 573 | .gcc, .clang => { | |
| 574 | var context = SysVContext.init(ty, comp, pragma_pack); | |
| 575 | ||
| 576 | context.layoutFields(rec); | |
| 577 | ||
| 578 | context.size_bits = std.mem.alignForward(u64, context.size_bits, context.aligned_bits); | |
| 579 | ||
| 580 | rec.type_layout = .{ | |
| 581 | .size_bits = context.size_bits, | |
| 582 | .field_alignment_bits = context.aligned_bits, | |
| 583 | .pointer_alignment_bits = context.aligned_bits, | |
| 584 | .required_alignment_bits = BITS_PER_BYTE, | |
| 585 | }; | |
| 586 | }, | |
| 587 | .msvc => { | |
| 588 | var context = MsvcContext.init(ty, comp, pragma_pack); | |
| 589 | for (rec.fields, 0..) |*fld, fld_indx| { | |
| 590 | var field_attrs: ?[]const Attribute = null; | |
| 591 | if (rec.field_attributes) |attrs| { | |
| 592 | field_attrs = attrs[fld_indx]; | |
| 593 | } | |
| 594 | ||
| 595 | fld.layout = context.layoutField(fld, field_attrs); | |
| 596 | } | |
| 597 | if (context.size_bits == 0) { | |
| 598 | // As an extension, MSVC allows records that only contain zero-sized bitfields and empty | |
| 599 | // arrays. Such records would be zero-sized but this case is handled here separately to | |
| 600 | // ensure that there are no zero-sized records. | |
| 601 | context.handleZeroSizedRecord(); | |
| 602 | } | |
| 603 | context.size_bits = std.mem.alignForward(u64, context.size_bits, context.pointer_align_bits); | |
| 604 | rec.type_layout = .{ | |
| 605 | .size_bits = context.size_bits, | |
| 606 | .field_alignment_bits = context.field_align_bits, | |
| 607 | .pointer_alignment_bits = context.pointer_align_bits, | |
| 608 | .required_alignment_bits = context.req_align_bits, | |
| 609 | }; | |
| 610 | }, | |
| 611 | } | |
| 612 | } | |
| 613 | ||
| 614 | fn computeLayout(ty: Type, comp: *const Compilation) TypeLayout { | |
| 615 | if (ty.getRecord()) |rec| { | |
| 616 | const requested = BITS_PER_BYTE * (ty.requestedAlignment(comp) orelse 0); | |
| 617 | return .{ | |
| 618 | .size_bits = rec.type_layout.size_bits, | |
| 619 | .pointer_alignment_bits = @max(requested, rec.type_layout.pointer_alignment_bits), | |
| 620 | .field_alignment_bits = @max(requested, rec.type_layout.field_alignment_bits), | |
| 621 | .required_alignment_bits = rec.type_layout.required_alignment_bits, | |
| 622 | }; | |
| 623 | } else { | |
| 624 | const type_align = ty.alignof(comp) * BITS_PER_BYTE; | |
| 625 | return .{ | |
| 626 | .size_bits = ty.bitSizeof(comp) orelse 0, | |
| 627 | .pointer_alignment_bits = type_align, | |
| 628 | .field_alignment_bits = type_align, | |
| 629 | .required_alignment_bits = BITS_PER_BYTE, | |
| 630 | }; | |
| 631 | } | |
| 632 | } | |
| 633 | ||
| 634 | fn isPacked(attrs: ?[]const Attribute) bool { | |
| 635 | const a = attrs orelse return false; | |
| 636 | ||
| 637 | for (a) |attribute| { | |
| 638 | if (attribute.tag != .@"packed") continue; | |
| 639 | return true; | |
| 640 | } | |
| 641 | return false; | |
| 642 | } | |
| 643 | ||
| 644 | // The effect of #pragma pack(N) depends on the target. | |
| 645 | // | |
| 646 | // x86: By default, there is no maximum field alignment. N={1,2,4} set the maximum field | |
| 647 | // alignment to that value. All other N activate the default. | |
| 648 | // x64: By default, there is no maximum field alignment. N={1,2,4,8} set the maximum field | |
| 649 | // alignment to that value. All other N activate the default. | |
| 650 | // arm: By default, the maximum field alignment is 8. N={1,2,4,8,16} set the maximum field | |
| 651 | // alignment to that value. All other N activate the default. | |
| 652 | // arm64: By default, the maximum field alignment is 8. N={1,2,4,8} set the maximum field | |
| 653 | // alignment to that value. N=16 disables the maximum field alignment. All other N | |
| 654 | // activate the default. | |
| 655 | // | |
| 656 | // See test case 0020. | |
| 657 | pub fn msvcPragmaPack(comp: *const Compilation, pack: u32) ?u32 { | |
| 658 | return switch (pack) { | |
| 659 | 8, 16, 32 => pack, | |
| 660 | 64 => if (comp.target.cpu.arch == .x86) null else pack, | |
| 661 | 128 => if (comp.target.cpu.arch == .thumb) pack else null, | |
| 662 | else => { | |
| 663 | return switch (comp.target.cpu.arch) { | |
| 664 | .thumb, .aarch64 => 64, | |
| 665 | else => null, | |
| 666 | }; | |
| 667 | }, | |
| 668 | }; | |
| 669 | } |
deps/aro/target.zig created+810| ... | ... | @@ -0,0 +1,810 @@ |
| 1 | const std = @import("std"); | |
| 2 | const LangOpts = @import("LangOpts.zig"); | |
| 3 | const Type = @import("Type.zig"); | |
| 4 | const llvm = @import("zig").codegen.llvm; | |
| 5 | const TargetSet = @import("builtins/Properties.zig").TargetSet; | |
| 6 | ||
| 7 | /// intmax_t for this target | |
| 8 | pub fn intMaxType(target: std.Target) Type { | |
| 9 | switch (target.cpu.arch) { | |
| 10 | .aarch64, | |
| 11 | .aarch64_be, | |
| 12 | .sparc64, | |
| 13 | => if (target.os.tag != .openbsd) return .{ .specifier = .long }, | |
| 14 | ||
| 15 | .bpfel, | |
| 16 | .bpfeb, | |
| 17 | .loongarch64, | |
| 18 | .riscv64, | |
| 19 | .powerpc64, | |
| 20 | .powerpc64le, | |
| 21 | .tce, | |
| 22 | .tcele, | |
| 23 | .ve, | |
| 24 | => return .{ .specifier = .long }, | |
| 25 | ||
| 26 | .x86_64 => switch (target.os.tag) { | |
| 27 | .windows, .openbsd => {}, | |
| 28 | else => switch (target.abi) { | |
| 29 | .gnux32, .muslx32 => {}, | |
| 30 | else => return .{ .specifier = .long }, | |
| 31 | }, | |
| 32 | }, | |
| 33 | ||
| 34 | else => {}, | |
| 35 | } | |
| 36 | return .{ .specifier = .long_long }; | |
| 37 | } | |
| 38 | ||
| 39 | /// intptr_t for this target | |
| 40 | pub fn intPtrType(target: std.Target) Type { | |
| 41 | switch (target.os.tag) { | |
| 42 | .haiku => return .{ .specifier = .long }, | |
| 43 | .nacl => return .{ .specifier = .int }, | |
| 44 | else => {}, | |
| 45 | } | |
| 46 | ||
| 47 | switch (target.cpu.arch) { | |
| 48 | .aarch64, .aarch64_be => switch (target.os.tag) { | |
| 49 | .windows => return .{ .specifier = .long_long }, | |
| 50 | else => {}, | |
| 51 | }, | |
| 52 | ||
| 53 | .msp430, | |
| 54 | .csky, | |
| 55 | .loongarch32, | |
| 56 | .riscv32, | |
| 57 | .xcore, | |
| 58 | .hexagon, | |
| 59 | .tce, | |
| 60 | .tcele, | |
| 61 | .m68k, | |
| 62 | .spir, | |
| 63 | .spirv32, | |
| 64 | .arc, | |
| 65 | .avr, | |
| 66 | => return .{ .specifier = .int }, | |
| 67 | ||
| 68 | .sparc, .sparcel => switch (target.os.tag) { | |
| 69 | .netbsd, .openbsd => {}, | |
| 70 | else => return .{ .specifier = .int }, | |
| 71 | }, | |
| 72 | ||
| 73 | .powerpc, .powerpcle => switch (target.os.tag) { | |
| 74 | .linux, .freebsd, .netbsd => return .{ .specifier = .int }, | |
| 75 | else => {}, | |
| 76 | }, | |
| 77 | ||
| 78 | // 32-bit x86 Darwin, OpenBSD, and RTEMS use long (the default); others use int | |
| 79 | .x86 => switch (target.os.tag) { | |
| 80 | .openbsd, .rtems => {}, | |
| 81 | else => if (!target.os.tag.isDarwin()) return .{ .specifier = .int }, | |
| 82 | }, | |
| 83 | ||
| 84 | .x86_64 => switch (target.os.tag) { | |
| 85 | .windows => return .{ .specifier = .long_long }, | |
| 86 | else => switch (target.abi) { | |
| 87 | .gnux32, .muslx32 => return .{ .specifier = .int }, | |
| 88 | else => {}, | |
| 89 | }, | |
| 90 | }, | |
| 91 | ||
| 92 | else => {}, | |
| 93 | } | |
| 94 | ||
| 95 | return .{ .specifier = .long }; | |
| 96 | } | |
| 97 | ||
| 98 | /// int16_t for this target | |
| 99 | pub fn int16Type(target: std.Target) Type { | |
| 100 | return switch (target.cpu.arch) { | |
| 101 | .avr => .{ .specifier = .int }, | |
| 102 | else => .{ .specifier = .short }, | |
| 103 | }; | |
| 104 | } | |
| 105 | ||
| 106 | /// int64_t for this target | |
| 107 | pub fn int64Type(target: std.Target) Type { | |
| 108 | switch (target.cpu.arch) { | |
| 109 | .loongarch64, | |
| 110 | .ve, | |
| 111 | .riscv64, | |
| 112 | .powerpc64, | |
| 113 | .powerpc64le, | |
| 114 | .bpfel, | |
| 115 | .bpfeb, | |
| 116 | => return .{ .specifier = .long }, | |
| 117 | ||
| 118 | .sparc64 => return intMaxType(target), | |
| 119 | ||
| 120 | .x86, .x86_64 => if (!target.isDarwin()) return intMaxType(target), | |
| 121 | .aarch64, .aarch64_be => if (!target.isDarwin() and target.os.tag != .openbsd and target.os.tag != .windows) return .{ .specifier = .long }, | |
| 122 | else => {}, | |
| 123 | } | |
| 124 | return .{ .specifier = .long_long }; | |
| 125 | } | |
| 126 | ||
| 127 | /// This function returns 1 if function alignment is not observable or settable. | |
| 128 | pub fn defaultFunctionAlignment(target: std.Target) u8 { | |
| 129 | return switch (target.cpu.arch) { | |
| 130 | .arm, .armeb => 4, | |
| 131 | .aarch64, .aarch64_32, .aarch64_be => 4, | |
| 132 | .sparc, .sparcel, .sparc64 => 4, | |
| 133 | .riscv64 => 2, | |
| 134 | else => 1, | |
| 135 | }; | |
| 136 | } | |
| 137 | ||
| 138 | pub fn isTlsSupported(target: std.Target) bool { | |
| 139 | if (target.isDarwin()) { | |
| 140 | var supported = false; | |
| 141 | switch (target.os.tag) { | |
| 142 | .macos => supported = !(target.os.isAtLeast(.macos, .{ .major = 10, .minor = 7, .patch = 0 }) orelse false), | |
| 143 | else => {}, | |
| 144 | } | |
| 145 | return supported; | |
| 146 | } | |
| 147 | return switch (target.cpu.arch) { | |
| 148 | .tce, .tcele, .bpfel, .bpfeb, .msp430, .nvptx, .nvptx64, .x86, .arm, .armeb, .thumb, .thumbeb => false, | |
| 149 | else => true, | |
| 150 | }; | |
| 151 | } | |
| 152 | ||
| 153 | pub fn ignoreNonZeroSizedBitfieldTypeAlignment(target: std.Target) bool { | |
| 154 | switch (target.cpu.arch) { | |
| 155 | .avr => return true, | |
| 156 | .arm => { | |
| 157 | if (std.Target.arm.featureSetHas(target.cpu.features, .has_v7)) { | |
| 158 | switch (target.os.tag) { | |
| 159 | .ios => return true, | |
| 160 | else => return false, | |
| 161 | } | |
| 162 | } | |
| 163 | }, | |
| 164 | else => return false, | |
| 165 | } | |
| 166 | return false; | |
| 167 | } | |
| 168 | ||
| 169 | pub fn ignoreZeroSizedBitfieldTypeAlignment(target: std.Target) bool { | |
| 170 | switch (target.cpu.arch) { | |
| 171 | .avr => return true, | |
| 172 | else => return false, | |
| 173 | } | |
| 174 | } | |
| 175 | ||
| 176 | pub fn minZeroWidthBitfieldAlignment(target: std.Target) ?u29 { | |
| 177 | switch (target.cpu.arch) { | |
| 178 | .avr => return 8, | |
| 179 | .arm => { | |
| 180 | if (std.Target.arm.featureSetHas(target.cpu.features, .has_v7)) { | |
| 181 | switch (target.os.tag) { | |
| 182 | .ios => return 32, | |
| 183 | else => return null, | |
| 184 | } | |
| 185 | } else return null; | |
| 186 | }, | |
| 187 | else => return null, | |
| 188 | } | |
| 189 | } | |
| 190 | ||
| 191 | pub fn unnamedFieldAffectsAlignment(target: std.Target) bool { | |
| 192 | switch (target.cpu.arch) { | |
| 193 | .aarch64 => { | |
| 194 | if (target.isDarwin() or target.os.tag == .windows) return false; | |
| 195 | return true; | |
| 196 | }, | |
| 197 | .armeb => { | |
| 198 | if (std.Target.arm.featureSetHas(target.cpu.features, .has_v7)) { | |
| 199 | if (std.Target.Abi.default(target.cpu.arch, target.os) == .eabi) return true; | |
| 200 | } | |
| 201 | }, | |
| 202 | .arm => return true, | |
| 203 | .avr => return true, | |
| 204 | .thumb => { | |
| 205 | if (target.os.tag == .windows) return false; | |
| 206 | return true; | |
| 207 | }, | |
| 208 | else => return false, | |
| 209 | } | |
| 210 | return false; | |
| 211 | } | |
| 212 | ||
| 213 | pub fn packAllEnums(target: std.Target) bool { | |
| 214 | return switch (target.cpu.arch) { | |
| 215 | .hexagon => true, | |
| 216 | else => false, | |
| 217 | }; | |
| 218 | } | |
| 219 | ||
| 220 | /// Default alignment (in bytes) for __attribute__((aligned)) when no alignment is specified | |
| 221 | pub fn defaultAlignment(target: std.Target) u29 { | |
| 222 | switch (target.cpu.arch) { | |
| 223 | .avr => return 1, | |
| 224 | .arm => if (target.isAndroid() or target.os.tag == .ios) return 16 else return 8, | |
| 225 | .sparc => if (std.Target.sparc.featureSetHas(target.cpu.features, .v9)) return 16 else return 8, | |
| 226 | .mips, .mipsel => switch (target.abi) { | |
| 227 | .none, .gnuabi64 => return 16, | |
| 228 | else => return 8, | |
| 229 | }, | |
| 230 | .s390x, .armeb, .thumbeb, .thumb => return 8, | |
| 231 | else => return 16, | |
| 232 | } | |
| 233 | } | |
| 234 | pub fn systemCompiler(target: std.Target) LangOpts.Compiler { | |
| 235 | // Android is linux but not gcc, so these checks go first | |
| 236 | // the rest for documentation as fn returns .clang | |
| 237 | if (target.isDarwin() or | |
| 238 | target.isAndroid() or | |
| 239 | target.isBSD() or | |
| 240 | target.os.tag == .fuchsia or | |
| 241 | target.os.tag == .solaris or | |
| 242 | target.os.tag == .haiku or | |
| 243 | target.cpu.arch == .hexagon) | |
| 244 | { | |
| 245 | return .clang; | |
| 246 | } | |
| 247 | if (target.os.tag == .uefi) return .msvc; | |
| 248 | // this is before windows to grab WindowsGnu | |
| 249 | if (target.abi.isGnu() or | |
| 250 | target.os.tag == .linux) | |
| 251 | { | |
| 252 | return .gcc; | |
| 253 | } | |
| 254 | if (target.os.tag == .windows) { | |
| 255 | return .msvc; | |
| 256 | } | |
| 257 | if (target.cpu.arch == .avr) return .gcc; | |
| 258 | return .clang; | |
| 259 | } | |
| 260 | ||
| 261 | pub fn hasInt128(target: std.Target) bool { | |
| 262 | if (target.cpu.arch == .wasm32) return true; | |
| 263 | if (target.cpu.arch == .x86_64) return true; | |
| 264 | return target.ptrBitWidth() >= 64; | |
| 265 | } | |
| 266 | ||
| 267 | pub fn hasHalfPrecisionFloatABI(target: std.Target) bool { | |
| 268 | return switch (target.cpu.arch) { | |
| 269 | .thumb, .thumbeb, .arm, .aarch64 => true, | |
| 270 | else => false, | |
| 271 | }; | |
| 272 | } | |
| 273 | ||
| 274 | pub const FPSemantics = enum { | |
| 275 | None, | |
| 276 | IEEEHalf, | |
| 277 | BFloat, | |
| 278 | IEEESingle, | |
| 279 | IEEEDouble, | |
| 280 | IEEEQuad, | |
| 281 | /// Minifloat 5-bit exponent 2-bit mantissa | |
| 282 | E5M2, | |
| 283 | /// Minifloat 4-bit exponent 3-bit mantissa | |
| 284 | E4M3, | |
| 285 | x87ExtendedDouble, | |
| 286 | IBMExtendedDouble, | |
| 287 | ||
| 288 | /// Only intended for generating float.h macros for the preprocessor | |
| 289 | pub fn forType(ty: std.Target.CType, target: std.Target) FPSemantics { | |
| 290 | std.debug.assert(ty == .float or ty == .double or ty == .longdouble); | |
| 291 | return switch (target.c_type_bit_size(ty)) { | |
| 292 | 32 => .IEEESingle, | |
| 293 | 64 => .IEEEDouble, | |
| 294 | 80 => .x87ExtendedDouble, | |
| 295 | 128 => switch (target.cpu.arch) { | |
| 296 | .powerpc, .powerpcle, .powerpc64, .powerpc64le => .IBMExtendedDouble, | |
| 297 | else => .IEEEQuad, | |
| 298 | }, | |
| 299 | else => unreachable, | |
| 300 | }; | |
| 301 | } | |
| 302 | ||
| 303 | pub fn halfPrecisionType(target: std.Target) ?FPSemantics { | |
| 304 | switch (target.cpu.arch) { | |
| 305 | .aarch64, | |
| 306 | .aarch64_32, | |
| 307 | .aarch64_be, | |
| 308 | .arm, | |
| 309 | .armeb, | |
| 310 | .hexagon, | |
| 311 | .riscv32, | |
| 312 | .riscv64, | |
| 313 | .spirv32, | |
| 314 | .spirv64, | |
| 315 | => return .IEEEHalf, | |
| 316 | .x86, .x86_64 => if (std.Target.x86.featureSetHas(target.cpu.features, .sse2)) return .IEEEHalf, | |
| 317 | else => {}, | |
| 318 | } | |
| 319 | return null; | |
| 320 | } | |
| 321 | ||
| 322 | pub fn chooseValue(self: FPSemantics, comptime T: type, values: [6]T) T { | |
| 323 | return switch (self) { | |
| 324 | .IEEEHalf => values[0], | |
| 325 | .IEEESingle => values[1], | |
| 326 | .IEEEDouble => values[2], | |
| 327 | .x87ExtendedDouble => values[3], | |
| 328 | .IBMExtendedDouble => values[4], | |
| 329 | .IEEEQuad => values[5], | |
| 330 | else => unreachable, | |
| 331 | }; | |
| 332 | } | |
| 333 | }; | |
| 334 | ||
| 335 | pub fn isLP64(target: std.Target) bool { | |
| 336 | return target.c_type_bit_size(.int) == 32 and target.ptrBitWidth() == 64; | |
| 337 | } | |
| 338 | ||
| 339 | pub fn isKnownWindowsMSVCEnvironment(target: std.Target) bool { | |
| 340 | return target.os.tag == .windows and target.abi == .msvc; | |
| 341 | } | |
| 342 | ||
| 343 | pub fn isWindowsMSVCEnvironment(target: std.Target) bool { | |
| 344 | return target.os.tag == .windows and (target.abi == .msvc or target.abi == .none); | |
| 345 | } | |
| 346 | ||
| 347 | pub fn isCygwinMinGW(target: std.Target) bool { | |
| 348 | return target.os.tag == .windows and (target.abi == .gnu or target.abi == .cygnus); | |
| 349 | } | |
| 350 | ||
| 351 | pub fn builtinEnabled(target: std.Target, enabled_for: TargetSet) bool { | |
| 352 | var copy = enabled_for; | |
| 353 | var it = copy.iterator(); | |
| 354 | while (it.next()) |val| { | |
| 355 | switch (val) { | |
| 356 | .basic => return true, | |
| 357 | .x86_64 => if (target.cpu.arch == .x86_64) return true, | |
| 358 | .aarch64 => if (target.cpu.arch == .aarch64) return true, | |
| 359 | .arm => if (target.cpu.arch == .arm) return true, | |
| 360 | .ppc => switch (target.cpu.arch) { | |
| 361 | .powerpc, .powerpc64, .powerpc64le => return true, | |
| 362 | else => {}, | |
| 363 | }, | |
| 364 | else => { | |
| 365 | // Todo: handle other target predicates | |
| 366 | }, | |
| 367 | } | |
| 368 | } | |
| 369 | return false; | |
| 370 | } | |
| 371 | ||
| 372 | pub fn defaultFpEvalMethod(target: std.Target) LangOpts.FPEvalMethod { | |
| 373 | if (target.os.tag == .aix) return .double; | |
| 374 | switch (target.cpu.arch) { | |
| 375 | .x86, .x86_64 => { | |
| 376 | if (target.ptrBitWidth() == 32 and target.os.tag == .netbsd) { | |
| 377 | if (target.os.version_range.semver.min.order(.{ .major = 6, .minor = 99, .patch = 26 }) != .gt) { | |
| 378 | // NETBSD <= 6.99.26 on 32-bit x86 defaults to double | |
| 379 | return .double; | |
| 380 | } | |
| 381 | } | |
| 382 | if (std.Target.x86.featureSetHas(target.cpu.features, .sse)) { | |
| 383 | return .source; | |
| 384 | } | |
| 385 | return .extended; | |
| 386 | }, | |
| 387 | else => {}, | |
| 388 | } | |
| 389 | return .source; | |
| 390 | } | |
| 391 | ||
| 392 | /// Value of the `-m` flag for `ld` for this target | |
| 393 | pub fn ldEmulationOption(target: std.Target, arm_endianness: ?std.builtin.Endian) ?[]const u8 { | |
| 394 | return switch (target.cpu.arch) { | |
| 395 | .x86 => if (target.os.tag == .elfiamcu) "elf_iamcu" else "elf_i386", | |
| 396 | .arm, | |
| 397 | .armeb, | |
| 398 | .thumb, | |
| 399 | .thumbeb, | |
| 400 | => switch (arm_endianness orelse target.cpu.arch.endian()) { | |
| 401 | .Little => "armelf_linux_eabi", | |
| 402 | .Big => "armelfb_linux_eabi", | |
| 403 | }, | |
| 404 | .aarch64 => "aarch64linux", | |
| 405 | .aarch64_be => "aarch64linuxb", | |
| 406 | .m68k => "m68kelf", | |
| 407 | .powerpc => if (target.os.tag == .linux) "elf32ppclinux" else "elf32ppc", | |
| 408 | .powerpcle => if (target.os.tag == .linux) "elf32lppclinux" else "elf32lppc", | |
| 409 | .powerpc64 => "elf64ppc", | |
| 410 | .powerpc64le => "elf64lppc", | |
| 411 | .riscv32 => "elf32lriscv", | |
| 412 | .riscv64 => "elf64lriscv", | |
| 413 | .sparc, .sparcel => "elf32_sparc", | |
| 414 | .sparc64 => "elf64_sparc", | |
| 415 | .loongarch32 => "elf32loongarch", | |
| 416 | .loongarch64 => "elf64loongarch", | |
| 417 | .mips => "elf32btsmip", | |
| 418 | .mipsel => "elf32ltsmip", | |
| 419 | .mips64 => if (target.abi == .gnuabin32) "elf32btsmipn32" else "elf64btsmip", | |
| 420 | .mips64el => if (target.abi == .gnuabin32) "elf32ltsmipn32" else "elf64ltsmip", | |
| 421 | .x86_64 => if (target.abi == .gnux32 or target.abi == .muslx32) "elf32_x86_64" else "elf_x86_64", | |
| 422 | .ve => "elf64ve", | |
| 423 | .csky => "cskyelf_linux", | |
| 424 | else => null, | |
| 425 | }; | |
| 426 | } | |
| 427 | ||
| 428 | pub fn get32BitArchVariant(target: std.Target) ?std.Target { | |
| 429 | var copy = target; | |
| 430 | switch (target.cpu.arch) { | |
| 431 | .amdgcn, | |
| 432 | .avr, | |
| 433 | .msp430, | |
| 434 | .spu_2, | |
| 435 | .ve, | |
| 436 | .bpfel, | |
| 437 | .bpfeb, | |
| 438 | .s390x, | |
| 439 | => return null, | |
| 440 | ||
| 441 | .arc, | |
| 442 | .arm, | |
| 443 | .armeb, | |
| 444 | .csky, | |
| 445 | .hexagon, | |
| 446 | .m68k, | |
| 447 | .le32, | |
| 448 | .mips, | |
| 449 | .mipsel, | |
| 450 | .powerpc, | |
| 451 | .powerpcle, | |
| 452 | .r600, | |
| 453 | .riscv32, | |
| 454 | .sparc, | |
| 455 | .sparcel, | |
| 456 | .tce, | |
| 457 | .tcele, | |
| 458 | .thumb, | |
| 459 | .thumbeb, | |
| 460 | .x86, | |
| 461 | .xcore, | |
| 462 | .nvptx, | |
| 463 | .amdil, | |
| 464 | .hsail, | |
| 465 | .spir, | |
| 466 | .kalimba, | |
| 467 | .shave, | |
| 468 | .lanai, | |
| 469 | .wasm32, | |
| 470 | .renderscript32, | |
| 471 | .aarch64_32, | |
| 472 | .spirv32, | |
| 473 | .loongarch32, | |
| 474 | .dxil, | |
| 475 | .xtensa, | |
| 476 | => {}, // Already 32 bit | |
| 477 | ||
| 478 | .aarch64 => copy.cpu.arch = .arm, | |
| 479 | .aarch64_be => copy.cpu.arch = .armeb, | |
| 480 | .le64 => copy.cpu.arch = .le32, | |
| 481 | .amdil64 => copy.cpu.arch = .amdil, | |
| 482 | .nvptx64 => copy.cpu.arch = .nvptx, | |
| 483 | .wasm64 => copy.cpu.arch = .wasm32, | |
| 484 | .hsail64 => copy.cpu.arch = .hsail, | |
| 485 | .spir64 => copy.cpu.arch = .spir, | |
| 486 | .spirv64 => copy.cpu.arch = .spirv32, | |
| 487 | .renderscript64 => copy.cpu.arch = .renderscript32, | |
| 488 | .loongarch64 => copy.cpu.arch = .loongarch32, | |
| 489 | .mips64 => copy.cpu.arch = .mips, | |
| 490 | .mips64el => copy.cpu.arch = .mipsel, | |
| 491 | .powerpc64 => copy.cpu.arch = .powerpc, | |
| 492 | .powerpc64le => copy.cpu.arch = .powerpcle, | |
| 493 | .riscv64 => copy.cpu.arch = .riscv32, | |
| 494 | .sparc64 => copy.cpu.arch = .sparc, | |
| 495 | .x86_64 => copy.cpu.arch = .x86, | |
| 496 | } | |
| 497 | return copy; | |
| 498 | } | |
| 499 | ||
| 500 | pub fn get64BitArchVariant(target: std.Target) ?std.Target { | |
| 501 | var copy = target; | |
| 502 | switch (target.cpu.arch) { | |
| 503 | .arc, | |
| 504 | .avr, | |
| 505 | .csky, | |
| 506 | .dxil, | |
| 507 | .hexagon, | |
| 508 | .kalimba, | |
| 509 | .lanai, | |
| 510 | .m68k, | |
| 511 | .msp430, | |
| 512 | .r600, | |
| 513 | .shave, | |
| 514 | .sparcel, | |
| 515 | .spu_2, | |
| 516 | .tce, | |
| 517 | .tcele, | |
| 518 | .xcore, | |
| 519 | .xtensa, | |
| 520 | => return null, | |
| 521 | ||
| 522 | .aarch64, | |
| 523 | .aarch64_be, | |
| 524 | .amdgcn, | |
| 525 | .bpfeb, | |
| 526 | .bpfel, | |
| 527 | .le64, | |
| 528 | .amdil64, | |
| 529 | .nvptx64, | |
| 530 | .wasm64, | |
| 531 | .hsail64, | |
| 532 | .spir64, | |
| 533 | .spirv64, | |
| 534 | .renderscript64, | |
| 535 | .loongarch64, | |
| 536 | .mips64, | |
| 537 | .mips64el, | |
| 538 | .powerpc64, | |
| 539 | .powerpc64le, | |
| 540 | .riscv64, | |
| 541 | .s390x, | |
| 542 | .sparc64, | |
| 543 | .ve, | |
| 544 | .x86_64, | |
| 545 | => {}, // Already 64 bit | |
| 546 | ||
| 547 | .aarch64_32 => copy.cpu.arch = .aarch64, | |
| 548 | .amdil => copy.cpu.arch = .amdil64, | |
| 549 | .arm => copy.cpu.arch = .aarch64, | |
| 550 | .armeb => copy.cpu.arch = .aarch64_be, | |
| 551 | .hsail => copy.cpu.arch = .hsail64, | |
| 552 | .le32 => copy.cpu.arch = .le64, | |
| 553 | .loongarch32 => copy.cpu.arch = .loongarch64, | |
| 554 | .mips => copy.cpu.arch = .mips64, | |
| 555 | .mipsel => copy.cpu.arch = .mips64el, | |
| 556 | .nvptx => copy.cpu.arch = .nvptx64, | |
| 557 | .powerpc => copy.cpu.arch = .powerpc64, | |
| 558 | .powerpcle => copy.cpu.arch = .powerpc64le, | |
| 559 | .renderscript32 => copy.cpu.arch = .renderscript64, | |
| 560 | .riscv32 => copy.cpu.arch = .riscv64, | |
| 561 | .sparc => copy.cpu.arch = .sparc64, | |
| 562 | .spir => copy.cpu.arch = .spir64, | |
| 563 | .spirv32 => copy.cpu.arch = .spirv64, | |
| 564 | .thumb => copy.cpu.arch = .aarch64, | |
| 565 | .thumbeb => copy.cpu.arch = .aarch64_be, | |
| 566 | .wasm32 => copy.cpu.arch = .wasm64, | |
| 567 | .x86 => copy.cpu.arch = .x86_64, | |
| 568 | } | |
| 569 | return copy; | |
| 570 | } | |
| 571 | ||
| 572 | /// Adapted from Zig's src/codegen/llvm.zig | |
| 573 | pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 { | |
| 574 | // 64 bytes is assumed to be large enough to hold any target triple; increase if necessary | |
| 575 | std.debug.assert(buf.len >= 64); | |
| 576 | ||
| 577 | var stream = std.io.fixedBufferStream(buf); | |
| 578 | const writer = stream.writer(); | |
| 579 | ||
| 580 | const llvm_arch = switch (target.cpu.arch) { | |
| 581 | .arm => "arm", | |
| 582 | .armeb => "armeb", | |
| 583 | .aarch64 => "aarch64", | |
| 584 | .aarch64_be => "aarch64_be", | |
| 585 | .aarch64_32 => "aarch64_32", | |
| 586 | .arc => "arc", | |
| 587 | .avr => "avr", | |
| 588 | .bpfel => "bpfel", | |
| 589 | .bpfeb => "bpfeb", | |
| 590 | .csky => "csky", | |
| 591 | .dxil => "dxil", | |
| 592 | .hexagon => "hexagon", | |
| 593 | .loongarch32 => "loongarch32", | |
| 594 | .loongarch64 => "loongarch64", | |
| 595 | .m68k => "m68k", | |
| 596 | .mips => "mips", | |
| 597 | .mipsel => "mipsel", | |
| 598 | .mips64 => "mips64", | |
| 599 | .mips64el => "mips64el", | |
| 600 | .msp430 => "msp430", | |
| 601 | .powerpc => "powerpc", | |
| 602 | .powerpcle => "powerpcle", | |
| 603 | .powerpc64 => "powerpc64", | |
| 604 | .powerpc64le => "powerpc64le", | |
| 605 | .r600 => "r600", | |
| 606 | .amdgcn => "amdgcn", | |
| 607 | .riscv32 => "riscv32", | |
| 608 | .riscv64 => "riscv64", | |
| 609 | .sparc => "sparc", | |
| 610 | .sparc64 => "sparc64", | |
| 611 | .sparcel => "sparcel", | |
| 612 | .s390x => "s390x", | |
| 613 | .tce => "tce", | |
| 614 | .tcele => "tcele", | |
| 615 | .thumb => "thumb", | |
| 616 | .thumbeb => "thumbeb", | |
| 617 | .x86 => "i386", | |
| 618 | .x86_64 => "x86_64", | |
| 619 | .xcore => "xcore", | |
| 620 | .xtensa => "xtensa", | |
| 621 | .nvptx => "nvptx", | |
| 622 | .nvptx64 => "nvptx64", | |
| 623 | .le32 => "le32", | |
| 624 | .le64 => "le64", | |
| 625 | .amdil => "amdil", | |
| 626 | .amdil64 => "amdil64", | |
| 627 | .hsail => "hsail", | |
| 628 | .hsail64 => "hsail64", | |
| 629 | .spir => "spir", | |
| 630 | .spir64 => "spir64", | |
| 631 | .spirv32 => "spirv32", | |
| 632 | .spirv64 => "spirv64", | |
| 633 | .kalimba => "kalimba", | |
| 634 | .shave => "shave", | |
| 635 | .lanai => "lanai", | |
| 636 | .wasm32 => "wasm32", | |
| 637 | .wasm64 => "wasm64", | |
| 638 | .renderscript32 => "renderscript32", | |
| 639 | .renderscript64 => "renderscript64", | |
| 640 | .ve => "ve", | |
| 641 | // Note: spu_2 is not supported in LLVM; this is the Zig arch name | |
| 642 | .spu_2 => "spu_2", | |
| 643 | }; | |
| 644 | writer.writeAll(llvm_arch) catch unreachable; | |
| 645 | writer.writeByte('-') catch unreachable; | |
| 646 | ||
| 647 | const llvm_os = switch (target.os.tag) { | |
| 648 | .freestanding => "unknown", | |
| 649 | .ananas => "ananas", | |
| 650 | .cloudabi => "cloudabi", | |
| 651 | .dragonfly => "dragonfly", | |
| 652 | .freebsd => "freebsd", | |
| 653 | .fuchsia => "fuchsia", | |
| 654 | .kfreebsd => "kfreebsd", | |
| 655 | .linux => "linux", | |
| 656 | .lv2 => "lv2", | |
| 657 | .netbsd => "netbsd", | |
| 658 | .openbsd => "openbsd", | |
| 659 | .solaris => "solaris", | |
| 660 | .windows => "windows", | |
| 661 | .zos => "zos", | |
| 662 | .haiku => "haiku", | |
| 663 | .minix => "minix", | |
| 664 | .rtems => "rtems", | |
| 665 | .nacl => "nacl", | |
| 666 | .aix => "aix", | |
| 667 | .cuda => "cuda", | |
| 668 | .nvcl => "nvcl", | |
| 669 | .amdhsa => "amdhsa", | |
| 670 | .ps4 => "ps4", | |
| 671 | .ps5 => "ps5", | |
| 672 | .elfiamcu => "elfiamcu", | |
| 673 | .mesa3d => "mesa3d", | |
| 674 | .contiki => "contiki", | |
| 675 | .amdpal => "amdpal", | |
| 676 | .hermit => "hermit", | |
| 677 | .hurd => "hurd", | |
| 678 | .wasi => "wasi", | |
| 679 | .emscripten => "emscripten", | |
| 680 | .uefi => "windows", | |
| 681 | .macos => "macosx", | |
| 682 | .ios => "ios", | |
| 683 | .tvos => "tvos", | |
| 684 | .watchos => "watchos", | |
| 685 | .driverkit => "driverkit", | |
| 686 | .shadermodel => "shadermodel", | |
| 687 | .opencl, | |
| 688 | .glsl450, | |
| 689 | .vulkan, | |
| 690 | .plan9, | |
| 691 | .other, | |
| 692 | => "unknown", | |
| 693 | }; | |
| 694 | writer.writeAll(llvm_os) catch unreachable; | |
| 695 | ||
| 696 | if (target.os.tag.isDarwin()) { | |
| 697 | const min_version = target.os.version_range.semver.min; | |
| 698 | writer.print("{d}.{d}.{d}", .{ | |
| 699 | min_version.major, | |
| 700 | min_version.minor, | |
| 701 | min_version.patch, | |
| 702 | }) catch unreachable; | |
| 703 | } | |
| 704 | writer.writeByte('-') catch unreachable; | |
| 705 | ||
| 706 | const llvm_abi = switch (target.abi) { | |
| 707 | .none => "unknown", | |
| 708 | .gnu => "gnu", | |
| 709 | .gnuabin32 => "gnuabin32", | |
| 710 | .gnuabi64 => "gnuabi64", | |
| 711 | .gnueabi => "gnueabi", | |
| 712 | .gnueabihf => "gnueabihf", | |
| 713 | .gnuf32 => "gnuf32", | |
| 714 | .gnuf64 => "gnuf64", | |
| 715 | .gnusf => "gnusf", | |
| 716 | .gnux32 => "gnux32", | |
| 717 | .gnuilp32 => "gnuilp32", | |
| 718 | .code16 => "code16", | |
| 719 | .eabi => "eabi", | |
| 720 | .eabihf => "eabihf", | |
| 721 | .android => "android", | |
| 722 | .musl => "musl", | |
| 723 | .musleabi => "musleabi", | |
| 724 | .musleabihf => "musleabihf", | |
| 725 | .muslx32 => "muslx32", | |
| 726 | .msvc => "msvc", | |
| 727 | .itanium => "itanium", | |
| 728 | .cygnus => "cygnus", | |
| 729 | .coreclr => "coreclr", | |
| 730 | .simulator => "simulator", | |
| 731 | .macabi => "macabi", | |
| 732 | .pixel => "pixel", | |
| 733 | .vertex => "vertex", | |
| 734 | .geometry => "geometry", | |
| 735 | .hull => "hull", | |
| 736 | .domain => "domain", | |
| 737 | .compute => "compute", | |
| 738 | .library => "library", | |
| 739 | .raygeneration => "raygeneration", | |
| 740 | .intersection => "intersection", | |
| 741 | .anyhit => "anyhit", | |
| 742 | .closesthit => "closesthit", | |
| 743 | .miss => "miss", | |
| 744 | .callable => "callable", | |
| 745 | .mesh => "mesh", | |
| 746 | .amplification => "amplification", | |
| 747 | }; | |
| 748 | writer.writeAll(llvm_abi) catch unreachable; | |
| 749 | return stream.getWritten(); | |
| 750 | } | |
| 751 | ||
| 752 | test "alignment functions - smoke test" { | |
| 753 | var target: std.Target = undefined; | |
| 754 | const x86 = std.Target.Cpu.Arch.x86_64; | |
| 755 | target.cpu = std.Target.Cpu.baseline(x86); | |
| 756 | target.os = std.Target.Os.Tag.defaultVersionRange(.linux, x86); | |
| 757 | target.abi = std.Target.Abi.default(x86, target.os); | |
| 758 | ||
| 759 | try std.testing.expect(isTlsSupported(target)); | |
| 760 | try std.testing.expect(!ignoreNonZeroSizedBitfieldTypeAlignment(target)); | |
| 761 | try std.testing.expect(minZeroWidthBitfieldAlignment(target) == null); | |
| 762 | try std.testing.expect(!unnamedFieldAffectsAlignment(target)); | |
| 763 | try std.testing.expect(defaultAlignment(target) == 16); | |
| 764 | try std.testing.expect(!packAllEnums(target)); | |
| 765 | try std.testing.expect(systemCompiler(target) == .gcc); | |
| 766 | ||
| 767 | const arm = std.Target.Cpu.Arch.arm; | |
| 768 | target.cpu = std.Target.Cpu.baseline(arm); | |
| 769 | target.os = std.Target.Os.Tag.defaultVersionRange(.ios, arm); | |
| 770 | target.abi = std.Target.Abi.default(arm, target.os); | |
| 771 | ||
| 772 | try std.testing.expect(!isTlsSupported(target)); | |
| 773 | try std.testing.expect(ignoreNonZeroSizedBitfieldTypeAlignment(target)); | |
| 774 | try std.testing.expectEqual(@as(?u29, 32), minZeroWidthBitfieldAlignment(target)); | |
| 775 | try std.testing.expect(unnamedFieldAffectsAlignment(target)); | |
| 776 | try std.testing.expect(defaultAlignment(target) == 16); | |
| 777 | try std.testing.expect(!packAllEnums(target)); | |
| 778 | try std.testing.expect(systemCompiler(target) == .clang); | |
| 779 | } | |
| 780 | ||
| 781 | test "target size/align tests" { | |
| 782 | var comp: @import("Compilation.zig") = undefined; | |
| 783 | ||
| 784 | const x86 = std.Target.Cpu.Arch.x86; | |
| 785 | comp.target.cpu.arch = x86; | |
| 786 | comp.target.cpu.model = &std.Target.x86.cpu.i586; | |
| 787 | comp.target.os = std.Target.Os.Tag.defaultVersionRange(.linux, x86); | |
| 788 | comp.target.abi = std.Target.Abi.gnu; | |
| 789 | ||
| 790 | const tt: Type = .{ | |
| 791 | .specifier = .long_long, | |
| 792 | }; | |
| 793 | ||
| 794 | try std.testing.expectEqual(@as(u64, 8), tt.sizeof(&comp).?); | |
| 795 | try std.testing.expectEqual(@as(u64, 4), tt.alignof(&comp)); | |
| 796 | ||
| 797 | const arm = std.Target.Cpu.Arch.arm; | |
| 798 | comp.target.cpu = std.Target.Cpu.Model.toCpu(&std.Target.arm.cpu.cortex_r4, arm); | |
| 799 | comp.target.os = std.Target.Os.Tag.defaultVersionRange(.ios, arm); | |
| 800 | comp.target.abi = std.Target.Abi.none; | |
| 801 | ||
| 802 | const ct: Type = .{ | |
| 803 | .specifier = .char, | |
| 804 | }; | |
| 805 | ||
| 806 | try std.testing.expectEqual(true, std.Target.arm.featureSetHas(comp.target.cpu.features, .has_v7)); | |
| 807 | try std.testing.expectEqual(@as(u64, 1), ct.sizeof(&comp).?); | |
| 808 | try std.testing.expectEqual(@as(u64, 1), ct.alignof(&comp)); | |
| 809 | try std.testing.expectEqual(true, ignoreNonZeroSizedBitfieldTypeAlignment(comp.target)); | |
| 810 | } |
deps/aro/toolchains/Linux.zig created+482| ... | ... | @@ -0,0 +1,482 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const Compilation = @import("../Compilation.zig"); | |
| 4 | const GCCDetector = @import("../Driver/GCCDetector.zig"); | |
| 5 | const Toolchain = @import("../Toolchain.zig"); | |
| 6 | const Driver = @import("../Driver.zig"); | |
| 7 | const Distro = @import("../Driver/Distro.zig"); | |
| 8 | const target_util = @import("../target.zig"); | |
| 9 | const system_defaults = @import("system_defaults"); | |
| 10 | ||
| 11 | const Linux = @This(); | |
| 12 | ||
| 13 | distro: Distro.Tag = .unknown, | |
| 14 | extra_opts: std.ArrayListUnmanaged([]const u8) = .{}, | |
| 15 | gcc_detector: GCCDetector = .{}, | |
| 16 | ||
| 17 | pub fn discover(self: *Linux, tc: *Toolchain) !void { | |
| 18 | self.distro = Distro.detect(tc.getTarget(), tc.filesystem); | |
| 19 | try self.gcc_detector.discover(tc); | |
| 20 | tc.selected_multilib = self.gcc_detector.selected; | |
| 21 | ||
| 22 | try self.gcc_detector.appendToolPath(tc); | |
| 23 | try self.buildExtraOpts(tc); | |
| 24 | try self.findPaths(tc); | |
| 25 | } | |
| 26 | ||
| 27 | fn buildExtraOpts(self: *Linux, tc: *const Toolchain) !void { | |
| 28 | const gpa = tc.driver.comp.gpa; | |
| 29 | const target = tc.getTarget(); | |
| 30 | const is_android = target.isAndroid(); | |
| 31 | if (self.distro.isAlpine() or is_android) { | |
| 32 | try self.extra_opts.ensureUnusedCapacity(gpa, 2); | |
| 33 | self.extra_opts.appendAssumeCapacity("-z"); | |
| 34 | self.extra_opts.appendAssumeCapacity("now"); | |
| 35 | } | |
| 36 | ||
| 37 | if (self.distro.isOpenSUSE() or self.distro.isUbuntu() or self.distro.isAlpine() or is_android) { | |
| 38 | try self.extra_opts.ensureUnusedCapacity(gpa, 2); | |
| 39 | self.extra_opts.appendAssumeCapacity("-z"); | |
| 40 | self.extra_opts.appendAssumeCapacity("relro"); | |
| 41 | } | |
| 42 | ||
| 43 | if (target.cpu.arch.isARM() or target.cpu.arch.isAARCH64() or is_android) { | |
| 44 | try self.extra_opts.ensureUnusedCapacity(gpa, 2); | |
| 45 | self.extra_opts.appendAssumeCapacity("-z"); | |
| 46 | self.extra_opts.appendAssumeCapacity("max-page-size=4096"); | |
| 47 | } | |
| 48 | ||
| 49 | if (target.cpu.arch == .arm or target.cpu.arch == .thumb) { | |
| 50 | try self.extra_opts.append(gpa, "-X"); | |
| 51 | } | |
| 52 | ||
| 53 | if (!target.cpu.arch.isMIPS() and target.cpu.arch != .hexagon) { | |
| 54 | const hash_style = if (is_android) .both else self.distro.getHashStyle(); | |
| 55 | try self.extra_opts.append(gpa, switch (hash_style) { | |
| 56 | inline else => |tag| "--hash-style=" ++ @tagName(tag), | |
| 57 | }); | |
| 58 | } | |
| 59 | ||
| 60 | if (system_defaults.enable_linker_build_id) { | |
| 61 | try self.extra_opts.append(gpa, "--build-id"); | |
| 62 | } | |
| 63 | } | |
| 64 | ||
| 65 | fn addMultiLibPaths(self: *Linux, tc: *Toolchain, sysroot: []const u8, os_lib_dir: []const u8) !void { | |
| 66 | if (!self.gcc_detector.is_valid) return; | |
| 67 | const gcc_triple = self.gcc_detector.gcc_triple; | |
| 68 | const lib_path = self.gcc_detector.parent_lib_path; | |
| 69 | ||
| 70 | // Add lib/gcc/$triple/$version, with an optional /multilib suffix. | |
| 71 | try tc.addPathIfExists(&.{ self.gcc_detector.install_path, tc.selected_multilib.gcc_suffix }, .file); | |
| 72 | ||
| 73 | // Add lib/gcc/$triple/$libdir | |
| 74 | // For GCC built with --enable-version-specific-runtime-libs. | |
| 75 | try tc.addPathIfExists(&.{ self.gcc_detector.install_path, "..", os_lib_dir }, .file); | |
| 76 | ||
| 77 | try tc.addPathIfExists(&.{ lib_path, "..", gcc_triple, "lib", "..", os_lib_dir, tc.selected_multilib.os_suffix }, .file); | |
| 78 | ||
| 79 | // If the GCC installation we found is inside of the sysroot, we want to | |
| 80 | // prefer libraries installed in the parent prefix of the GCC installation. | |
| 81 | // It is important to *not* use these paths when the GCC installation is | |
| 82 | // outside of the system root as that can pick up unintended libraries. | |
| 83 | // This usually happens when there is an external cross compiler on the | |
| 84 | // host system, and a more minimal sysroot available that is the target of | |
| 85 | // the cross. Note that GCC does include some of these directories in some | |
| 86 | // configurations but this seems somewhere between questionable and simply | |
| 87 | // a bug. | |
| 88 | if (mem.startsWith(u8, lib_path, sysroot)) { | |
| 89 | try tc.addPathIfExists(&.{ lib_path, "..", os_lib_dir }, .file); | |
| 90 | } | |
| 91 | } | |
| 92 | ||
| 93 | fn addMultiArchPaths(self: *Linux, tc: *Toolchain) !void { | |
| 94 | if (!self.gcc_detector.is_valid) return; | |
| 95 | const lib_path = self.gcc_detector.parent_lib_path; | |
| 96 | const gcc_triple = self.gcc_detector.gcc_triple; | |
| 97 | const multilib = self.gcc_detector.selected; | |
| 98 | try tc.addPathIfExists(&.{ lib_path, "..", gcc_triple, "lib", multilib.os_suffix }, .file); | |
| 99 | } | |
| 100 | ||
| 101 | /// TODO: Very incomplete | |
| 102 | fn findPaths(self: *Linux, tc: *Toolchain) !void { | |
| 103 | const target = tc.getTarget(); | |
| 104 | const sysroot = tc.getSysroot(); | |
| 105 | ||
| 106 | var output: [64]u8 = undefined; | |
| 107 | ||
| 108 | const os_lib_dir = getOSLibDir(target); | |
| 109 | const multiarch_triple = getMultiarchTriple(target) orelse target_util.toLLVMTriple(target, &output); | |
| 110 | ||
| 111 | try self.addMultiLibPaths(tc, sysroot, os_lib_dir); | |
| 112 | ||
| 113 | try tc.addPathIfExists(&.{ sysroot, "/lib", multiarch_triple }, .file); | |
| 114 | try tc.addPathIfExists(&.{ sysroot, "/lib", "..", os_lib_dir }, .file); | |
| 115 | ||
| 116 | if (target.isAndroid()) { | |
| 117 | // TODO | |
| 118 | } | |
| 119 | try tc.addPathIfExists(&.{ sysroot, "/usr", "lib", multiarch_triple }, .file); | |
| 120 | try tc.addPathIfExists(&.{ sysroot, "/usr", "lib", "..", os_lib_dir }, .file); | |
| 121 | ||
| 122 | try self.addMultiArchPaths(tc); | |
| 123 | ||
| 124 | try tc.addPathIfExists(&.{ sysroot, "/lib" }, .file); | |
| 125 | try tc.addPathIfExists(&.{ sysroot, "/usr", "lib" }, .file); | |
| 126 | } | |
| 127 | ||
| 128 | pub fn deinit(self: *Linux, allocator: std.mem.Allocator) void { | |
| 129 | self.extra_opts.deinit(allocator); | |
| 130 | } | |
| 131 | ||
| 132 | fn isPIEDefault(self: *const Linux) bool { | |
| 133 | _ = self; | |
| 134 | return false; | |
| 135 | } | |
| 136 | ||
| 137 | fn getPIE(self: *const Linux, d: *const Driver) bool { | |
| 138 | if (d.shared or d.static or d.relocatable or d.static_pie) { | |
| 139 | return false; | |
| 140 | } | |
| 141 | return d.pie orelse self.isPIEDefault(); | |
| 142 | } | |
| 143 | ||
| 144 | fn getStaticPIE(self: *const Linux, d: *Driver) !bool { | |
| 145 | _ = self; | |
| 146 | if (d.static_pie and d.pie != null) { | |
| 147 | try d.err("cannot specify 'nopie' along with 'static-pie'"); | |
| 148 | } | |
| 149 | return d.static_pie; | |
| 150 | } | |
| 151 | ||
| 152 | fn getStatic(self: *const Linux, d: *const Driver) bool { | |
| 153 | _ = self; | |
| 154 | return d.static and !d.static_pie; | |
| 155 | } | |
| 156 | ||
| 157 | pub fn getDefaultLinker(self: *const Linux, target: std.Target) []const u8 { | |
| 158 | _ = self; | |
| 159 | if (target.isAndroid()) { | |
| 160 | return "ld.lld"; | |
| 161 | } | |
| 162 | return "ld"; | |
| 163 | } | |
| 164 | ||
| 165 | pub fn buildLinkerArgs(self: *const Linux, tc: *const Toolchain, argv: *std.ArrayList([]const u8)) Compilation.Error!void { | |
| 166 | const d = tc.driver; | |
| 167 | const target = tc.getTarget(); | |
| 168 | ||
| 169 | const is_pie = self.getPIE(d); | |
| 170 | const is_static_pie = try self.getStaticPIE(d); | |
| 171 | const is_static = self.getStatic(d); | |
| 172 | const is_android = target.isAndroid(); | |
| 173 | const is_iamcu = target.os.tag == .elfiamcu; | |
| 174 | const is_ve = target.cpu.arch == .ve; | |
| 175 | const has_crt_begin_end_files = target.abi != .none; // TODO: clang checks for MIPS vendor | |
| 176 | ||
| 177 | if (is_pie) { | |
| 178 | try argv.append("-pie"); | |
| 179 | } | |
| 180 | if (is_static_pie) { | |
| 181 | try argv.appendSlice(&.{ "-static", "-pie", "--no-dynamic-linker", "-z", "text" }); | |
| 182 | } | |
| 183 | ||
| 184 | if (d.rdynamic) { | |
| 185 | try argv.append("-export-dynamic"); | |
| 186 | } | |
| 187 | ||
| 188 | if (d.strip) { | |
| 189 | try argv.append("-s"); | |
| 190 | } | |
| 191 | ||
| 192 | try argv.appendSlice(self.extra_opts.items); | |
| 193 | try argv.append("--eh-frame-hdr"); | |
| 194 | ||
| 195 | // Todo: Driver should parse `-EL`/`-EB` for arm to set endianness for arm targets | |
| 196 | if (target_util.ldEmulationOption(d.comp.target, null)) |emulation| { | |
| 197 | try argv.appendSlice(&.{ "-m", emulation }); | |
| 198 | } else { | |
| 199 | try d.err("Unknown target triple"); | |
| 200 | return; | |
| 201 | } | |
| 202 | if (d.comp.target.cpu.arch.isRISCV()) { | |
| 203 | try argv.append("-X"); | |
| 204 | } | |
| 205 | if (d.shared) { | |
| 206 | try argv.append("-shared"); | |
| 207 | } | |
| 208 | if (is_static) { | |
| 209 | try argv.append("-static"); | |
| 210 | } else { | |
| 211 | if (d.rdynamic) { | |
| 212 | try argv.append("-export-dynamic"); | |
| 213 | } | |
| 214 | if (!d.shared and !is_static_pie and !d.relocatable) { | |
| 215 | const dynamic_linker = d.comp.target.standardDynamicLinkerPath(); | |
| 216 | // todo: check for --dyld-prefix | |
| 217 | if (dynamic_linker.get()) |path| { | |
| 218 | try argv.appendSlice(&.{ "-dynamic-linker", try tc.arena.dupe(u8, path) }); | |
| 219 | } else { | |
| 220 | try d.err("Could not find dynamic linker path"); | |
| 221 | } | |
| 222 | } | |
| 223 | } | |
| 224 | ||
| 225 | try argv.appendSlice(&.{ "-o", d.output_name orelse "a.out" }); | |
| 226 | ||
| 227 | if (!d.nostdlib and !d.nostartfiles and !d.relocatable) { | |
| 228 | if (!is_android and !is_iamcu) { | |
| 229 | if (!d.shared) { | |
| 230 | const crt1 = if (is_pie) | |
| 231 | "Scrt1.o" | |
| 232 | else if (is_static_pie) | |
| 233 | "rcrt1.o" | |
| 234 | else | |
| 235 | "crt1.o"; | |
| 236 | try argv.append(try tc.getFilePath(crt1)); | |
| 237 | } | |
| 238 | try argv.append(try tc.getFilePath("crti.o")); | |
| 239 | } | |
| 240 | if (is_ve) { | |
| 241 | try argv.appendSlice(&.{ "-z", "max-page-size=0x4000000" }); | |
| 242 | } | |
| 243 | ||
| 244 | if (is_iamcu) { | |
| 245 | try argv.append(try tc.getFilePath("crt0.o")); | |
| 246 | } else if (has_crt_begin_end_files) { | |
| 247 | var path: []const u8 = ""; | |
| 248 | if (tc.getRuntimeLibKind() == .compiler_rt and !is_android) { | |
| 249 | const crt_begin = try tc.getCompilerRt("crtbegin", .object); | |
| 250 | if (tc.filesystem.exists(crt_begin)) { | |
| 251 | path = crt_begin; | |
| 252 | } | |
| 253 | } | |
| 254 | if (path.len == 0) { | |
| 255 | const crt_begin = if (tc.driver.shared) | |
| 256 | if (is_android) "crtbegin_so.o" else "crtbeginS.o" | |
| 257 | else if (is_static) | |
| 258 | if (is_android) "crtbegin_static.o" else "crtbeginT.o" | |
| 259 | else if (is_pie or is_static_pie) | |
| 260 | if (is_android) "crtbegin_dynamic.o" else "crtbeginS.o" | |
| 261 | else if (is_android) "crtbegin_dynamic.o" else "crtbegin.o"; | |
| 262 | path = try tc.getFilePath(crt_begin); | |
| 263 | } | |
| 264 | try argv.append(path); | |
| 265 | } | |
| 266 | } | |
| 267 | ||
| 268 | // TODO add -L opts | |
| 269 | // TODO add -u opts | |
| 270 | ||
| 271 | try tc.addFilePathLibArgs(argv); | |
| 272 | ||
| 273 | // TODO handle LTO | |
| 274 | ||
| 275 | try argv.appendSlice(d.link_objects.items); | |
| 276 | ||
| 277 | if (!d.nostdlib and !d.relocatable) { | |
| 278 | if (!d.nodefaultlibs) { | |
| 279 | if (is_static or is_static_pie) { | |
| 280 | try argv.append("--start-group"); | |
| 281 | } | |
| 282 | try tc.addRuntimeLibs(argv); | |
| 283 | ||
| 284 | // TODO: add pthread if needed | |
| 285 | if (!d.nolibc) { | |
| 286 | try argv.append("-lc"); | |
| 287 | } | |
| 288 | if (is_iamcu) { | |
| 289 | try argv.append("-lgloss"); | |
| 290 | } | |
| 291 | if (is_static or is_static_pie) { | |
| 292 | try argv.append("--end-group"); | |
| 293 | } else { | |
| 294 | try tc.addRuntimeLibs(argv); | |
| 295 | } | |
| 296 | if (is_iamcu) { | |
| 297 | try argv.appendSlice(&.{ "--as-needed", "-lsoftfp", "--no-as-needed" }); | |
| 298 | } | |
| 299 | } | |
| 300 | if (!d.nostartfiles and !is_iamcu) { | |
| 301 | if (has_crt_begin_end_files) { | |
| 302 | var path: []const u8 = ""; | |
| 303 | if (tc.getRuntimeLibKind() == .compiler_rt and !is_android) { | |
| 304 | const crt_end = try tc.getCompilerRt("crtend", .object); | |
| 305 | if (tc.filesystem.exists(crt_end)) { | |
| 306 | path = crt_end; | |
| 307 | } | |
| 308 | } | |
| 309 | if (path.len == 0) { | |
| 310 | const crt_end = if (d.shared) | |
| 311 | if (is_android) "crtend_so.o" else "crtendS.o" | |
| 312 | else if (is_pie or is_static_pie) | |
| 313 | if (is_android) "crtend_android.o" else "crtendS.o" | |
| 314 | else if (is_android) "crtend_android.o" else "crtend.o"; | |
| 315 | path = try tc.getFilePath(crt_end); | |
| 316 | } | |
| 317 | try argv.append(path); | |
| 318 | } | |
| 319 | if (!is_android) { | |
| 320 | try argv.append(try tc.getFilePath("crtn.o")); | |
| 321 | } | |
| 322 | } | |
| 323 | } | |
| 324 | ||
| 325 | // TODO add -T args | |
| 326 | } | |
| 327 | ||
| 328 | fn getMultiarchTriple(target: std.Target) ?[]const u8 { | |
| 329 | const is_android = target.isAndroid(); | |
| 330 | const is_mips_r6 = std.Target.mips.featureSetHas(target.cpu.features, .mips32r6); | |
| 331 | return switch (target.cpu.arch) { | |
| 332 | .arm, .thumb => if (is_android) "arm-linux-androideabi" else if (target.abi == .gnueabihf) "arm-linux-gnueabihf" else "arm-linux-gnueabi", | |
| 333 | .armeb, .thumbeb => if (target.abi == .gnueabihf) "armeb-linux-gnueabihf" else "armeb-linux-gnueabi", | |
| 334 | .aarch64 => if (is_android) "aarch64-linux-android" else "aarch64-linux-gnu", | |
| 335 | .aarch64_be => "aarch64_be-linux-gnu", | |
| 336 | .x86 => if (is_android) "i686-linux-android" else "i386-linux-gnu", | |
| 337 | .x86_64 => if (is_android) "x86_64-linux-android" else if (target.abi == .gnux32) "x86_64-linux-gnux32" else "x86_64-linux-gnu", | |
| 338 | .m68k => "m68k-linux-gnu", | |
| 339 | .mips => if (is_mips_r6) "mipsisa32r6-linux-gnu" else "mips-linux-gnu", | |
| 340 | .mipsel => if (is_android) "mipsel-linux-android" else if (is_mips_r6) "mipsisa32r6el-linux-gnu" else "mipsel-linux-gnu", | |
| 341 | .powerpcle => "powerpcle-linux-gnu", | |
| 342 | .powerpc64 => "powerpc64-linux-gnu", | |
| 343 | .powerpc64le => "powerpc64le-linux-gnu", | |
| 344 | .riscv64 => "riscv64-linux-gnu", | |
| 345 | .sparc => "sparc-linux-gnu", | |
| 346 | .sparc64 => "sparc64-linux-gnu", | |
| 347 | .s390x => "s390x-linux-gnu", | |
| 348 | ||
| 349 | // TODO: expand this | |
| 350 | else => null, | |
| 351 | }; | |
| 352 | } | |
| 353 | ||
| 354 | fn getOSLibDir(target: std.Target) []const u8 { | |
| 355 | switch (target.cpu.arch) { | |
| 356 | .x86, | |
| 357 | .powerpc, | |
| 358 | .powerpcle, | |
| 359 | .sparc, | |
| 360 | .sparcel, | |
| 361 | => return "lib32", | |
| 362 | else => {}, | |
| 363 | } | |
| 364 | if (target.cpu.arch == .x86_64 and (target.abi == .gnux32 or target.abi == .muslx32)) { | |
| 365 | return "libx32"; | |
| 366 | } | |
| 367 | if (target.cpu.arch == .riscv32) { | |
| 368 | return "lib32"; | |
| 369 | } | |
| 370 | if (target.ptrBitWidth() == 32) { | |
| 371 | return "lib"; | |
| 372 | } | |
| 373 | return "lib64"; | |
| 374 | } | |
| 375 | ||
| 376 | test Linux { | |
| 377 | if (@import("builtin").os.tag == .windows) return error.SkipZigTest; | |
| 378 | ||
| 379 | var arena_instance = std.heap.ArenaAllocator.init(std.testing.allocator); | |
| 380 | defer arena_instance.deinit(); | |
| 381 | const arena = arena_instance.allocator(); | |
| 382 | ||
| 383 | var comp = Compilation.init(std.testing.allocator); | |
| 384 | defer comp.deinit(); | |
| 385 | comp.environment = .{ | |
| 386 | .path = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | |
| 387 | }; | |
| 388 | ||
| 389 | const raw_triple = "x86_64-linux-gnu"; | |
| 390 | const cross = std.zig.CrossTarget.parse(.{ .arch_os_abi = raw_triple }) catch unreachable; | |
| 391 | comp.target = cross.toTarget(); // TODO deprecated | |
| 392 | comp.langopts.setEmulatedCompiler(.gcc); | |
| 393 | ||
| 394 | var driver: Driver = .{ .comp = &comp }; | |
| 395 | defer driver.deinit(); | |
| 396 | driver.raw_target_triple = raw_triple; | |
| 397 | ||
| 398 | const link_obj = try driver.comp.gpa.dupe(u8, "/tmp/foo.o"); | |
| 399 | try driver.link_objects.append(driver.comp.gpa, link_obj); | |
| 400 | driver.temp_file_count += 1; | |
| 401 | ||
| 402 | var toolchain: Toolchain = .{ .driver = &driver, .arena = arena, .filesystem = .{ .fake = &.{ | |
| 403 | .{ .path = "/tmp" }, | |
| 404 | .{ .path = "/usr" }, | |
| 405 | .{ .path = "/usr/lib64" }, | |
| 406 | .{ .path = "/usr/bin" }, | |
| 407 | .{ .path = "/usr/bin/ld", .executable = true }, | |
| 408 | .{ .path = "/lib" }, | |
| 409 | .{ .path = "/lib/x86_64-linux-gnu" }, | |
| 410 | .{ .path = "/lib/x86_64-linux-gnu/crt1.o" }, | |
| 411 | .{ .path = "/lib/x86_64-linux-gnu/crti.o" }, | |
| 412 | .{ .path = "/lib/x86_64-linux-gnu/crtn.o" }, | |
| 413 | .{ .path = "/lib64" }, | |
| 414 | .{ .path = "/usr/lib" }, | |
| 415 | .{ .path = "/usr/lib/gcc" }, | |
| 416 | .{ .path = "/usr/lib/gcc/x86_64-linux-gnu" }, | |
| 417 | .{ .path = "/usr/lib/gcc/x86_64-linux-gnu/9" }, | |
| 418 | .{ .path = "/usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o" }, | |
| 419 | .{ .path = "/usr/lib/gcc/x86_64-linux-gnu/9/crtend.o" }, | |
| 420 | .{ .path = "/usr/lib/x86_64-linux-gnu" }, | |
| 421 | .{ .path = "/etc/lsb-release", .contents = | |
| 422 | \\DISTRIB_ID=Ubuntu | |
| 423 | \\DISTRIB_RELEASE=20.04 | |
| 424 | \\DISTRIB_CODENAME=focal | |
| 425 | \\DISTRIB_DESCRIPTION="Ubuntu 20.04.6 LTS" | |
| 426 | \\ | |
| 427 | }, | |
| 428 | } } }; | |
| 429 | defer toolchain.deinit(); | |
| 430 | ||
| 431 | try toolchain.discover(); | |
| 432 | ||
| 433 | var argv = std.ArrayList([]const u8).init(driver.comp.gpa); | |
| 434 | defer argv.deinit(); | |
| 435 | ||
| 436 | var linker_path_buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; | |
| 437 | const linker_path = try toolchain.getLinkerPath(&linker_path_buf); | |
| 438 | try argv.append(linker_path); | |
| 439 | ||
| 440 | try toolchain.buildLinkerArgs(&argv); | |
| 441 | ||
| 442 | const expected = [_][]const u8{ | |
| 443 | "/usr/bin/ld", | |
| 444 | "-z", | |
| 445 | "relro", | |
| 446 | "--hash-style=gnu", | |
| 447 | "--eh-frame-hdr", | |
| 448 | "-m", | |
| 449 | "elf_x86_64", | |
| 450 | "-dynamic-linker", | |
| 451 | "/lib64/ld-linux-x86-64.so.2", | |
| 452 | "-o", | |
| 453 | "a.out", | |
| 454 | "/lib/x86_64-linux-gnu/crt1.o", | |
| 455 | "/lib/x86_64-linux-gnu/crti.o", | |
| 456 | "/usr/lib/gcc/x86_64-linux-gnu/9/crtbegin.o", | |
| 457 | "-L/usr/lib/gcc/x86_64-linux-gnu/9", | |
| 458 | "-L/usr/lib/gcc/x86_64-linux-gnu/9/../../../../lib64", | |
| 459 | "-L/lib/x86_64-linux-gnu", | |
| 460 | "-L/lib/../lib64", | |
| 461 | "-L/usr/lib/x86_64-linux-gnu", | |
| 462 | "-L/usr/lib/../lib64", | |
| 463 | "-L/lib", | |
| 464 | "-L/usr/lib", | |
| 465 | link_obj, | |
| 466 | "-lgcc", | |
| 467 | "--as-needed", | |
| 468 | "-lgcc_s", | |
| 469 | "--no-as-needed", | |
| 470 | "-lc", | |
| 471 | "-lgcc", | |
| 472 | "--as-needed", | |
| 473 | "-lgcc_s", | |
| 474 | "--no-as-needed", | |
| 475 | "/usr/lib/gcc/x86_64-linux-gnu/9/crtend.o", | |
| 476 | "/lib/x86_64-linux-gnu/crtn.o", | |
| 477 | }; | |
| 478 | try std.testing.expectEqual(expected.len, argv.items.len); | |
| 479 | for (expected, argv.items) |expected_item, actual_item| { | |
| 480 | try std.testing.expectEqualStrings(expected_item, actual_item); | |
| 481 | } | |
| 482 | } |
deps/aro/unicode.zig created+41| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | //! Copied from https://github.com/ziglang/zig/blob/6f0807f50f4e946bb850e746beaa5d6556cf7750/lib/std/unicode.zig | |
| 2 | //! with all safety checks removed. These functions must only be called with known-good buffers that have already | |
| 3 | //! been validated as being legitimate UTF8-encoded data, otherwise undefined behavior will occur. | |
| 4 | ||
| 5 | pub fn utf8ByteSequenceLength_unsafe(first_byte: u8) u3 { | |
| 6 | return switch (first_byte) { | |
| 7 | 0b0000_0000...0b0111_1111 => 1, | |
| 8 | 0b1100_0000...0b1101_1111 => 2, | |
| 9 | 0b1110_0000...0b1110_1111 => 3, | |
| 10 | 0b1111_0000...0b1111_0111 => 4, | |
| 11 | else => unreachable, | |
| 12 | }; | |
| 13 | } | |
| 14 | ||
| 15 | pub fn utf8Decode2_unsafe(bytes: []const u8) u21 { | |
| 16 | var value: u21 = bytes[0] & 0b00011111; | |
| 17 | value <<= 6; | |
| 18 | return value | (bytes[1] & 0b00111111); | |
| 19 | } | |
| 20 | ||
| 21 | pub fn utf8Decode3_unsafe(bytes: []const u8) u21 { | |
| 22 | var value: u21 = bytes[0] & 0b00001111; | |
| 23 | ||
| 24 | value <<= 6; | |
| 25 | value |= bytes[1] & 0b00111111; | |
| 26 | ||
| 27 | value <<= 6; | |
| 28 | return value | (bytes[2] & 0b00111111); | |
| 29 | } | |
| 30 | ||
| 31 | pub fn utf8Decode4_unsafe(bytes: []const u8) u21 { | |
| 32 | var value: u21 = bytes[0] & 0b00000111; | |
| 33 | value <<= 6; | |
| 34 | value |= bytes[1] & 0b00111111; | |
| 35 | ||
| 36 | value <<= 6; | |
| 37 | value |= bytes[2] & 0b00111111; | |
| 38 | ||
| 39 | value <<= 6; | |
| 40 | return value | (bytes[3] & 0b00111111); | |
| 41 | } |
deps/aro/util.zig created+83| ... | ... | @@ -0,0 +1,83 @@ |
| 1 | const std = @import("std"); | |
| 2 | const mem = std.mem; | |
| 3 | const builtin = @import("builtin"); | |
| 4 | const is_windows = builtin.os.tag == .windows; | |
| 5 | ||
| 6 | pub const Color = enum { | |
| 7 | reset, | |
| 8 | red, | |
| 9 | green, | |
| 10 | blue, | |
| 11 | cyan, | |
| 12 | purple, | |
| 13 | yellow, | |
| 14 | white, | |
| 15 | }; | |
| 16 | ||
| 17 | pub fn fileSupportsColor(file: std.fs.File) bool { | |
| 18 | return file.supportsAnsiEscapeCodes() or (is_windows and file.isTty()); | |
| 19 | } | |
| 20 | ||
| 21 | pub fn setColor(color: Color, w: anytype) void { | |
| 22 | if (is_windows) { | |
| 23 | const stderr_file = std.io.getStdErr(); | |
| 24 | if (!stderr_file.isTty()) return; | |
| 25 | const windows = std.os.windows; | |
| 26 | const S = struct { | |
| 27 | var attrs: windows.WORD = undefined; | |
| 28 | var init_attrs = false; | |
| 29 | }; | |
| 30 | if (!S.init_attrs) { | |
| 31 | S.init_attrs = true; | |
| 32 | var info: windows.CONSOLE_SCREEN_BUFFER_INFO = undefined; | |
| 33 | _ = windows.kernel32.GetConsoleScreenBufferInfo(stderr_file.handle, &info); | |
| 34 | S.attrs = info.wAttributes; | |
| 35 | _ = windows.kernel32.SetConsoleOutputCP(65001); | |
| 36 | } | |
| 37 | ||
| 38 | // need to flush bufferedWriter | |
| 39 | const T = if (@typeInfo(@TypeOf(w.context)) == .Pointer) @TypeOf(w.context.*) else @TypeOf(w.context); | |
| 40 | if (T != void and @hasDecl(T, "flush")) w.context.flush() catch {}; | |
| 41 | ||
| 42 | switch (color) { | |
| 43 | .reset => _ = windows.SetConsoleTextAttribute(stderr_file.handle, S.attrs) catch {}, | |
| 44 | .red => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_RED | windows.FOREGROUND_INTENSITY) catch {}, | |
| 45 | .green => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_GREEN | windows.FOREGROUND_INTENSITY) catch {}, | |
| 46 | .blue => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY) catch {}, | |
| 47 | .cyan => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_GREEN | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY) catch {}, | |
| 48 | .purple => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_RED | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY) catch {}, | |
| 49 | .yellow => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_RED | windows.FOREGROUND_GREEN | windows.FOREGROUND_INTENSITY) catch {}, | |
| 50 | .white => _ = windows.SetConsoleTextAttribute(stderr_file.handle, windows.FOREGROUND_RED | windows.FOREGROUND_GREEN | windows.FOREGROUND_BLUE | windows.FOREGROUND_INTENSITY) catch {}, | |
| 51 | } | |
| 52 | } else switch (color) { | |
| 53 | .reset => w.writeAll("\x1b[0m") catch {}, | |
| 54 | .red => w.writeAll("\x1b[31;1m") catch {}, | |
| 55 | .green => w.writeAll("\x1b[32;1m") catch {}, | |
| 56 | .blue => w.writeAll("\x1b[34;1m") catch {}, | |
| 57 | .cyan => w.writeAll("\x1b[36;1m") catch {}, | |
| 58 | .purple => w.writeAll("\x1b[35;1m") catch {}, | |
| 59 | .yellow => w.writeAll("\x1b[93;1m") catch {}, | |
| 60 | .white => w.writeAll("\x1b[0m\x1b[1m") catch {}, | |
| 61 | } | |
| 62 | } | |
| 63 | ||
| 64 | pub fn errorDescription(err: anyerror) []const u8 { | |
| 65 | return switch (err) { | |
| 66 | error.OutOfMemory => "ran out of memory", | |
| 67 | error.FileNotFound => "file not found", | |
| 68 | error.IsDir => "is a directory", | |
| 69 | error.NotDir => "is not a directory", | |
| 70 | error.NotOpenForReading => "file is not open for reading", | |
| 71 | error.NotOpenForWriting => "file is not open for writing", | |
| 72 | error.InvalidUtf8 => "input is not valid UTF-8", | |
| 73 | error.FileBusy => "file is busy", | |
| 74 | error.NameTooLong => "file name is too long", | |
| 75 | error.AccessDenied => "access denied", | |
| 76 | error.FileTooBig => "file is too big", | |
| 77 | error.ProcessFdQuotaExceeded, error.SystemFdQuotaExceeded => "ran out of file descriptors", | |
| 78 | error.SystemResources => "ran out of system resources", | |
| 79 | error.FatalError => "a fatal error occurred", | |
| 80 | error.Unexpected => "an unexpected error occurred", | |
| 81 | else => @errorName(err), | |
| 82 | }; | |
| 83 | } |