authorgravatar for liljaanton2001@gmail.comantlilja <liljaanton2001@gmail.com> 2023-08-17 16:03:40+02:00
committergravatar for liljaanton2001@gmail.comantlilja <liljaanton2001@gmail.com> 2024-02-21 16:24:59+01:00
log8feae5d2d5fa8b82922f6dbb45b1aae7a4d6a93f
tree51001d4e8c65050f63cc21d4d940c2b42ec53e0d
parent955fd65cb1705d8279eb195bdbc69810df1b1d98

LLVM: Assign correct values to enum/union tags


1 files changed, 105 insertions(+), 99 deletions(-)

src/codegen/llvm/Builder.zig+105-99
......@@ -1051,7 +1051,13 @@ pub const Attribute = union(Kind) {
10511051 .no_sanitize_hwaddress,
10521052 .sanitize_address_dyninit,
10531053 => |kind| {
1054 const field = @typeInfo(Attribute).Union.fields[@intFromEnum(kind)];
1054 const field = comptime blk: {
1055 @setEvalBranchQuota(10_000);
1056 inline for (@typeInfo(Attribute).Union.fields) |field| {
1057 if (std.mem.eql(u8, field.name, @tagName(kind))) break :blk field;
1058 }
1059 unreachable;
1060 };
10551061 comptime assert(std.mem.eql(u8, @tagName(kind), field.name));
10561062 return @unionInit(Attribute, field.name, switch (field.type) {
10571063 void => {},
......@@ -1255,100 +1261,100 @@ pub const Attribute = union(Kind) {
12551261
12561262 pub const Kind = enum(u32) {
12571263 // Parameter Attributes
1258 zeroext,
1259 signext,
1260 inreg,
1261 byval,
1262 byref,
1263 preallocated,
1264 inalloca,
1265 sret,
1266 elementtype,
1267 @"align",
1268 @"noalias",
1269 nocapture,
1270 nofree,
1271 nest,
1272 returned,
1273 nonnull,
1274 dereferenceable,
1275 dereferenceable_or_null,
1276 swiftself,
1277 swiftasync,
1278 swifterror,
1279 immarg,
1280 noundef,
1281 nofpclass,
1282 alignstack,
1283 allocalign,
1284 allocptr,
1285 readnone,
1286 readonly,
1287 writeonly,
1264 zeroext = 34,
1265 signext = 24,
1266 inreg = 5,
1267 byval = 3,
1268 byref = 69,
1269 preallocated = 65,
1270 inalloca = 38,
1271 sret = 29, // TODO: ?
1272 elementtype = 77,
1273 @"align" = 1,
1274 @"noalias" = 9,
1275 nocapture = 11,
1276 nofree = 62,
1277 nest = 8,
1278 returned = 22,
1279 nonnull = 39,
1280 dereferenceable = 41,
1281 dereferenceable_or_null = 42,
1282 swiftself = 46,
1283 swiftasync = 75,
1284 swifterror = 47,
1285 immarg = 60,
1286 noundef = 68,
1287 nofpclass = 87,
1288 alignstack = 25,
1289 allocalign = 80,
1290 allocptr = 81,
1291 readnone = 20,
1292 readonly = 21,
1293 writeonly = 52,
12881294
12891295 // Function Attributes
12901296 //alignstack,
1291 allockind,
1292 allocsize,
1293 alwaysinline,
1294 builtin,
1295 cold,
1296 convergent,
1297 disable_sanitizer_information,
1298 fn_ret_thunk_extern,
1299 hot,
1300 inlinehint,
1301 jumptable,
1302 memory,
1303 minsize,
1304 naked,
1305 nobuiltin,
1306 nocallback,
1307 noduplicate,
1297 allockind = 82,
1298 allocsize = 51,
1299 alwaysinline = 2,
1300 builtin = 35,
1301 cold = 36,
1302 convergent = 43,
1303 disable_sanitizer_information = 78,
1304 fn_ret_thunk_extern = 84,
1305 hot = 72,
1306 inlinehint = 4,
1307 jumptable = 40,
1308 memory = 86,
1309 minsize = 6,
1310 naked = 7,
1311 nobuiltin = 10,
1312 nocallback = 71,
1313 noduplicate = 12,
13081314 //nofree,
1309 noimplicitfloat,
1310 @"noinline",
1311 nomerge,
1312 nonlazybind,
1313 noprofile,
1314 skipprofile,
1315 noredzone,
1316 noreturn,
1317 norecurse,
1318 willreturn,
1319 nosync,
1320 nounwind,
1321 nosanitize_bounds,
1322 nosanitize_coverage,
1323 null_pointer_is_valid,
1324 optforfuzzing,
1325 optnone,
1326 optsize,
1315 noimplicitfloat = 13,
1316 @"noinline" = 14,
1317 nomerge = 66,
1318 nonlazybind = 15,
1319 noprofile = 73,
1320 skipprofile = 85,
1321 noredzone = 16,
1322 noreturn = 17,
1323 norecurse = 48,
1324 willreturn = 61,
1325 nosync = 63,
1326 nounwind = 18,
1327 nosanitize_bounds = 79,
1328 nosanitize_coverage = 76,
1329 null_pointer_is_valid = 67,
1330 optforfuzzing = 57,
1331 optnone = 37,
1332 optsize = 19,
13271333 //preallocated,
1328 returns_twice,
1329 safestack,
1330 sanitize_address,
1331 sanitize_memory,
1332 sanitize_thread,
1333 sanitize_hwaddress,
1334 sanitize_memtag,
1335 speculative_load_hardening,
1336 speculatable,
1337 ssp,
1338 sspstrong,
1339 sspreq,
1340 strictfp,
1341 uwtable,
1342 nocf_check,
1343 shadowcallstack,
1344 mustprogress,
1345 vscale_range,
1334 returns_twice = 23,
1335 safestack = 44,
1336 sanitize_address = 30,
1337 sanitize_memory = 32,
1338 sanitize_thread = 31,
1339 sanitize_hwaddress = 55,
1340 sanitize_memtag = 64,
1341 speculative_load_hardening = 59,
1342 speculatable = 53,
1343 ssp = 26,
1344 sspstrong = 28,
1345 sspreq = 27,
1346 strictfp = 54,
1347 uwtable = 33,
1348 nocf_check = 56,
1349 shadowcallstack = 58,
1350 mustprogress = 70,
1351 vscale_range = 74,
13461352
13471353 // Global Attributes
1348 no_sanitize_address,
1349 no_sanitize_hwaddress,
1354 no_sanitize_address = 100,
1355 no_sanitize_hwaddress = 101,
13501356 //sanitize_memtag,
1351 sanitize_address_dyninit,
1357 sanitize_address_dyninit = 102,
13521358
13531359 string = std.math.maxInt(u31),
13541360 none = std.math.maxInt(u32),
......@@ -1709,18 +1715,18 @@ pub const FunctionAttributes = enum(u32) {
17091715 }
17101716};
17111717
1712pub const Linkage = enum {
1713 private,
1714 internal,
1715 weak,
1716 weak_odr,
1717 linkonce,
1718 linkonce_odr,
1719 available_externally,
1720 appending,
1721 common,
1722 extern_weak,
1723 external,
1718pub const Linkage = enum(u4) {
1719 private = 9,
1720 internal = 3,
1721 weak = 1,
1722 weak_odr = 10,
1723 linkonce = 4,
1724 linkonce_odr = 11,
1725 available_externally = 12,
1726 appending = 2,
1727 common = 8,
1728 extern_weak = 7,
1729 external = 0,
17241730
17251731 pub fn format(
17261732 self: Linkage,