780 Commits
Author SHA1 Message Date
Steinar H. Gunderson 8556c81d80 Add a pass to reverse if/else blocks (#215)
Negates the condition and swaps the blocks, leaving the meaning
the same but often influencing basic block layout (unless the compiler
feels very strongly about it for some reason).

This can generally only run so many times in a permute before it's
not useful anymore, so it's got low default weight, but it's still
a transformation none of the other passes are able to do reliably.

We could be more elegant with inverting conditions, such as writing
(a != b) instead of !(a == b) (or similar with greater-than, de Morgan's
laws, etc.), but generally, this is kept simple for now.
2026-10-06 10:18:29 +02:00
Simon Lindholm 059609d4ae mypy/black fixes 2026-09-08 00:52:13 +02:00
Steinar H. Gunderson 4a6d45ca00 Add a pass to remove/merge two variables. (#212)
A typical use for this pass is when you have used two different
loop variables at different places in the function, but the original
code uses the same in both places; this can strongly affect register
allocation. (For newer SSA-based compilers, this is of course irrelevant,
as every operation creates a new variable anyway.)
2026-09-08 00:49:25 +02:00
John Stiles 41bd0bfc32 Call "bash compile.sh" instead of relying on shebang (#206) 2026-09-05 18:04:47 +02:00
Simon Lindholm 6786c403af perm_pycparser: update readme with m2c commit hash 2026-09-04 00:43:29 +02:00
Simon Lindholm be1fd44508 c_generator: simplify _generate_attrs a little 2026-09-04 00:38:50 +02:00
John Stiles 226623d7b2 Fix __attribute__ position in visit_Decl for plain local declarations (#211) 2026-09-04 00:35:50 +02:00
prj-2501 d801386f6b c_generator.py: emit attribute at the end (#209) 2026-09-04 00:18:35 +02:00
Simon Lindholm fb516c435c Add perm_alias_array randomization pass 2026-08-22 18:23:49 +02:00
Simon Lindholm 98784cf8a8 import.py: only skip last -o 2026-08-22 15:17:35 +02:00
Simon Lindholm bb878112ab import.py: handle pipeline errors in compile.sh 2026-08-22 15:17:35 +02:00
Simon Lindholm 2795247304 Don't crash on relocations to hex-imm instructions 2026-08-05 12:34:27 +02:00
Simon Lindholm 2eefdac0ea Prune fn bodies even when import.py --decompme does not find function
Closes #203.
2026-07-27 01:06:59 +02:00
Simon Lindholm 70d74f7eff Update mypy Python version 2026-06-30 23:52:32 +02:00
Simon Lindholm 6c8b32fde0 Don't duplicate complex statements in perm_var_cond_block 2026-06-30 23:50:58 +02:00
Simon Lindholm f888fb352e Fix expr dedup for perm_var_cond_block and adjust weights 2026-06-30 23:30:26 +02:00
twevs 5583a94f28 Add perm_var_cond_block rule (#160) 2026-06-30 23:10:58 +02:00
ser-pounce efc5c5e7d9 Strip all dependency generation flags (#200) 2026-04-03 10:57:16 +02:00
Jurre Groenendijk c0b466d6ec Recursively de-duplicate structs (#199) 2026-03-15 10:09:38 +01:00
Jurre Groenendijk 61c9519196 Don't emit duplicate structs for "typedef struct { ... } A, B;" (#198) 2026-03-14 16:48:36 +01:00
Jurre Groenendijk 3f9e9d89ec Fix context minimization for "typedef struct { ... } A, *B;" (#197) 2026-03-09 18:30:19 +01:00
Simon Lindholm 4fd443c29c Update pycparser 2026-03-07 14:00:51 +01:00
Simon Lindholm 22be36bacc Use m2c's vendored pycparser copy
This adds support for parsing GCC attributes and similar.
2026-03-06 00:15:22 +01:00
Simon Lindholm dfc0733b33 Handle asmproc --input-enc in import.py 2026-03-05 16:18:42 +01:00
Sean Burke d745ac2fdd Add support for x86 binaries (#192) 2026-03-03 23:30:59 +01:00
Ethan Roseman 4bfc164b14 Fix fetch compilers request (#196) 2026-03-01 10:06:27 +01:00
Simon Lindholm 9061f3d914 Don't crash on --debug with empty diff 2026-02-21 23:29:11 +01:00
Simon Lindholm b16ad15e90 Fix compatibility with pycparser 3.0
Fixes #194.
2026-02-21 23:28:35 +01:00
Simon Lindholm ec2efeebb3 Improve pycparser stubs 2025-11-22 15:34:51 +01:00
Ethan Roseman 3e911a5e94 Use new endpoint for compilers on decomp.me (#191)
We're trying to deprecate and remove the /compilers endpoint, and /compiler is the new one-stop shop for all your compiler metadata needs.
2025-09-25 11:14:23 +02:00
Anghelo Carvajal 45981f9c46 Update labels for better support with latest splat/spimdisasm (#190) 2025-09-03 00:12:29 +02:00
Ethan Roseman 333b0c716c Add valid User-Agent to decomp.me imports (#188) 2025-06-13 10:14:05 +02:00
Ethan Roseman d462b02e56 Fix markdown on controller readme (#187) 2025-05-25 19:54:31 +02:00
ser-pounce 040ef456e0 Add settings flag to specify decomp.me compiler flags (#185) 2025-04-24 21:47:13 +02:00
Simon Lindholm 3218501b17 Fix detecting "-123" as a literal 2025-04-21 17:25:10 +02:00
Simon Lindholm fd1c054af3 Cleaner type checking in import.py 2025-03-24 23:33:29 +01:00
Simon Lindholm 28f4be75b7 Remove unused vars 2025-03-24 23:21:57 +01:00
Simon Lindholm 910dbd14e5 Improve --no-ignore-branch-targets help text 2025-03-24 23:19:25 +01:00
Simon Lindholm 44dbc4961e Update black 2025-03-24 23:19:25 +01:00
Simon Lindholm 6d4379ef54 Add pyright config, typing fixes 2025-03-24 23:19:25 +01:00
Simon Lindholm a2eb5566b2 Fix "incompatible method override" error in pycparser stubs 2025-03-24 23:10:59 +01:00
Karas e6f3f1020d Custom objdump support, formatting adjustments to assembly in debug output, and minor fixes (#184) 2025-03-24 22:21:02 +01:00
Simon Lindholm b44b062226 Add endlabel macro to prelude 2024-12-30 11:17:34 +01:00
Gilles Siberlin 497db75770 Add settings file parameter to import.py (#180) 2024-11-27 22:55:07 +01:00
Maide 2e4bf759d2 Implement a basic speed setting to reduce the resources spent on permuting (#178) 2024-11-06 10:28:58 +01:00
Simon Lindholm 10ca253061 Handle __asm__ in import.py 2024-11-02 13:52:10 +01:00
Simon Lindholm 5c3a809559 Resolve asm_prelude_file relative to project dir 2024-11-02 10:26:10 +01:00
Simon Lindholm f542c61bb0 Allow arbitrary whitespace after .globl 2024-10-27 21:39:57 +01:00
Simon Lindholm 93c432b0f9 Improve import.py compiler cmd debug log 2024-10-27 21:19:00 +01:00
Simon Lindholm 6224cb97ee Add random "x++; x--;"
Fixes #174.
2024-10-27 21:03:11 +01:00