1007 Commits

Author SHA1 Message Date
Hayden Gray
aeaffd6755 [odin] accommodate changes made in dev-2025-02 (#8328)
in `dev-2025-02`, odin changed from single-module debug builds to
multi-module and prevents it from spitting out a single `.s` file. this
adds version checking to make sure that any odin version after
`dev-2025-02` uses `-use-single-module`. additionally, changes were made
around name canonicalization that required changing the matching for
label names to avoid clogging the assembly output (both standard and
binary)
2025-12-15 19:53:32 -06:00
Frank Leon Rose
e35662fbb5 Fix Clojure dependencies (#8249) 2025-11-27 17:29:43 +01:00
Partouf
5b39ab8f42 gocache limit stat on construct and also support cache for trunk 2025-11-25 18:13:01 +01:00
Patrick Quist
194a6c8df6 Add GOCACHE support for Go compiler with writeable cache directory (#8283) 2025-11-25 00:55:45 +01:00
narpfel
b5c0045556 Adapt isOutputLikelyLlvmIr for Rust (#8253)
The existing heuristics don’t reliably recognise LLVM IR produced by
`rustc` (e. g. when the generated code does not use any LLVM
intrinsics), so this adds LLVM IR detection based on the
`--emit=llvm-ir` and `--emit llvm-ir` command line flags.
2025-11-15 17:16:35 +01:00
Ofek
b76ebf9cf7 Fix #8023: Cleanup msvc version text. (#8264) 2025-11-09 15:21:09 +02:00
Oguz Ulgen
f7bc52a923 Add Helion language support (#8206)
Helion is a Python-embedded domain-specific language (DSL) for authoring
machine learning kernels, designed to compile down to Triton.

https://github.com/pytorch/helion

I mostly followed the Triton example, please let me know if there's more
I need to do or anything I missed.

infra PR: https://github.com/compiler-explorer/infra/pull/1875
2025-11-04 12:08:20 -06:00
LJ
5a15d893d7 Add support for Yul intermediate view when compiling Solidity (#8219)
## What

Adds support for seeing Yul (Solidity IR) as intermediate output when
compiling Solidity.

This PR also enables that view for the Resolc compiler.

### Main Additions

- [x] Support viewing Yul in a supplementary view
- Solidity compilers can enable this by setting
`this.compiler.supportsYulView = true` in the compiler's constructor
- If custom processing of the Yul output or the Yul output filename is
needed, the compiler can override `processYulOutput()` or
`getYulOutputFilename()`
- [x] Enable the Yul view for Resolc
- [x] Implement a Yul backend option for filtering out debug info from
the output

### Notes

Source mappings are currently not handled for Yul -> Solidity.

## Overall Usage

### Steps

* Choose Solidity as the language
* Choose a Resolc compiler
* View intermediate results:
  * Yul
* (Hide/show debug info by toggling "Hide Debug Info" in the Yul view
filters)

## Screenshots

<img width="1502" height="903" alt="ce-yul-view"
src="https://github.com/user-attachments/assets/ccc897e2-cd8d-4c33-962c-522d60b63134"
/>
2025-11-04 09:00:19 -06:00
Ofek
901b7e1826 Fix for win32 link-binary (#8236)
(+ a rename).
Turns out when 'Link to Binary' was checked, msvc objdumped the obj (not
exe) file. This fixes it.
2025-11-01 12:54:31 +02:00
Matt Godbolt
b51b8250b0 Expose the naming convention of the jailing process (#8211)
To allow resolc to correctly find in-sandbox named artifacts

See #8164
2025-10-22 11:34:14 -05:00
narpfel
d21e62d3a1 Fix race condition in Rust opt pipeline view (#8205)
The same race condition that was reported in #7012 also affects the opt
pipeline view.

I couldn’t reproduce the race condition locally, but on the live site it
happens relatively often, e. g. in https://godbolt.org/z/4Y1qfvTvz.
2025-10-22 09:58:21 -05:00
Frank Leon Rose
b9dc265973 Clojure language support (#8146)
<img width="1405" height="474" alt="Clojure in Compiler Explorer 2"
src="https://github.com/user-attachments/assets/76dfed9b-d0eb-4764-b371-9c6023088a50"
/>

With Macro Expansion:
<img width="1642" height="594" alt="image"
src="https://github.com/user-attachments/assets/8b511af9-3617-426e-868d-5a99e5db5756"
/>

TODO
- [x] Language configuration
- [x] Compile via wrapper
  - Inject namespace if necessary to simplify minimal code sample
  - Parse Unix style command line parameters into compiler bindings
  - Place file in path according to namespace
- [x] Install some versions of Clojure [PR
here](https://github.com/compiler-explorer/infra/pull/1849)
- [x] Macroexpansion view (modeled on Rust macro expansion view)
- [x] Filter out command line options that would break wrapper operation
- [x] ~~Parse `--help` output to a list of options~~ Reverted because
not applicable.
- [x] Short form compiler options
- [x] Support Clojure compiler settings via env var, like
`JAVA_OPTS=-Dclojure.compiler.direct-linking=true
-Dclojure.compiler.elide-meta=[:doc,:file]`

NOT DOING
- [x] ~~Support loading dependencies~~ Non-trivial enhancement. Not
necessary for initial release.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-10-22 09:04:20 -05:00
LJ
066a942cbc Add Resolc 0.4.0 compiler for Solidity and Yul (#8164)
## What

Adds [Revive's Resolc](https://github.com/paritytech/revive) compiler
for compiling Solidity and Yul (Solidity IR) to RISC-V and PolkaVM
assembly.

### Main Additions

- [x] Implement new `ResolcCompiler`
- [x] Implement Yul language definition and config for Monaco
- [x] Add Resolc as a compiler for the Solidity and Yul languages
  - The `ResolcCompiler` handles both kinds of language input 
- [x] Implement initial `PolkaVMAsmParser` (no source mappings)
- [x] Enable viewing LLVM IR in a supplementary view
- [x] Implement a new LLVM IR backend option for toggling between
optimized and unoptimized ll
- Affects non-resolc files ([see
commit](606bab9a59))
  - Disabled by default
- (Enable by setting `this.compiler.supportsIrViewOptToggleOption =
true` in a compiler's constructor)
- The compiler's `getIrOutputFilename()` will receive the LLVM IR
backend options

### CE Infra

Accompanying CE Infra PR:
https://github.com/compiler-explorer/infra/pull/1855

## Overall Usage

### Steps

(See screenshots)

* Choose between two input languages:
  * Solidity
  * Yul (Solidity IR)
* Choose a Resolc compiler
* View assembly:
  * PolkaVM assembly (if enabling "Compile to binary")
  * RISC-V (64 bits) assembly
* View intermediate results:
  * Optimized LLVM IR (if enabling "Show Optimized" in the LLVM IR view)
  * Unoptimized LLVM IR

### Notes

Source mappings currently only exist between:
- Yul and RISC-V
- Yul and LLVM-IR

## Screenshots

<img width="1502" height="903" alt="CE Yul RISC-V LLVM IR"
src="https://github.com/user-attachments/assets/7503b9b5-0f2c-4ddf-9405-669e4bdcd02d"
/>

<img width="1502" height="903" alt="CE Solidity PolkaVM"
src="https://github.com/user-attachments/assets/eeb51c99-3eaa-4dda-b13c-ac7783e66cb8"
/>

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-10-14 13:56:59 -05:00
Nathan S.
822292e4ea Add support for Swift LLVM IR (#8180)
This adds support for the LLVM IR view for Swift, based on what other
LLVM based compilers do.

I tested it on my machine and it seems to work well, including with the
demangler. I'm not sure what `minIrArgs` is though, I added it because
it was there for other languages.

Co-authored-by: Nathan SALAUN <nathan.salaun@sofia.dev>
2025-10-13 14:20:25 -05:00
narpfel
685f68450a Don’t add --crate-type to rust compiler options when explicitly specified by user (#8191)
Resolves #8186.
2025-10-13 14:16:01 -05:00
Matt Godbolt
a1783e111a Remove spurious error logging in Java bytecode parser (#8194)
## Summary
- Removes misleading error log in Java bytecode parser for legitimate
compiler behavior
- Some Java-family compilers (Clojure, Kotlin) generate initial bytecode
instructions without source line mappings
- The code already handles this correctly; the error log was spurious

## Context
Issue #2986 has been open since 2021 with error logs about "Skipping
over instruction even though currentSourceLine == -1". After analyzing
the code path and compiler behavior:

1. **The "error" is actually expected behavior**: When compilers
generate bytecode with LineNumberTables that don't start at instruction
0, the initial instructions legitimately have no source line mappings
2. **The code handles this correctly**: These instructions are displayed
without source associations, which is the right behavior
3. **No functional issues**: After 3+ years, no users have reported
actual problems related to this

As @frankleonrose noted in the issue, this is legitimate compiler
output, not a CE bug.

## Test plan
- [x] TypeScript type checking passes
- [x] Linting passes  
- [x] Java-specific tests pass (10/10)
- [x] Related tests pass (77/77)

Closes #2986

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-13 14:02:30 -05:00
Patrick Quist
f3571b9bc4 cmake on windows improvements (#8174) 2025-10-11 15:55:26 +02:00
Ofek
00ee2fc8b0 Initial support for binary/binary-obj in msvc (#8165) 2025-10-06 18:00:53 +03:00
Ofek
5eb5262c64 Various type improvements, mostly in tests (#8144) 2025-09-27 10:17:55 +03:00
Matt Godbolt
f824efe73e Library updates and lint fixes (#8099)
* Minor updates only
* Added explicit radix parameter (10) to all Number.parseInt() calls throughout the codebase (new lint rule)
* Updated several @ts-ignore comments to @ts-expect-error for better TypeScript practices (new lint rule)
* Removed unnecessary @ts-ignore comments in some mode files (ditto)
* Used "none return" based arrow functions for some map stuff
* Replaced a `map()` call that didn't return anything to a for() loop
* Fixed up some cypress stuff, noting work for the future
2025-09-12 14:23:49 -05:00
Partouf
74a7611f3e fix #2986 2025-08-26 12:39:37 +02:00
kevinjeon-g
fc37e42d13 Fix errors in dex2oat compilation (#8050)
This fixes missing inlines (noticed on ArrayList iterators) and
incorrectly-emitted read barriers on local dex2oat.
2025-08-25 21:17:55 -05:00
Ofek
96103f044f Fix #8000: stop forcing dwarf 4 (#8036) 2025-08-16 17:39:09 +03:00
Matt Godbolt
2ae38a0c3f Make argument parsers instances instead of static classes (#8017)
- Made parsers stateful instances instead of shared static state (for
mllvm options). Fixes #8011 as this is caused by multiple clang-based
compilers being run concurrently and stomping over each others' state.
- passes `Compiler` to the constructor, which removes some param passing
- Added some missing awaits
- Tried to get things less dependent on `examples`, only `go` needs it
- Spotted that `zig` c++ might have issues in discovery
- Fly-by fixed a broken go path in ppc64le_gl122
- removed a redundant override in coccinelle
- made the mojo parser actually use the parser it defined
- canonified tablegen's special method
- 

I changed the zig parser too but as best I can tell it was broken before
(the `1` return value from the command it runs:)

```
ubuntu@ip-172-30-0-164:/infra/.deploy$ /opt/compiler-explorer/zig-0.14.1/zig c++ -mllvm --help-list-hidden /infra/.deploy/examples/c++/default.cpp -S -o /tmp/output.s
...
  --x86-use-vzeroupper                                                       - Minimize AVX to SSE transition penalty
  --xcore-max-threads=<number>                                               - Maximum number of threads (for emulation thread-local storage)
/infra/.deploy/examples/c++/default.cpp:1:1: error: FileNotFound
```
return code 1 (means it's not cached)

---------

Co-authored-by: Partouf <partouf@gmail.com>
2025-08-11 12:14:13 -05:00
A. R. Shajii
bea6e67715 Add Codon Python compiler (#8008) 2025-08-11 11:14:26 -05:00
Shawn Zhong
8befc91a79 Add Triton language and compiler (#7919)
Close #5530. Infra:
https://github.com/compiler-explorer/infra/pull/1711. Previous work by
@siboehm at #5531


## Summary

This pull request introduces support for the
[Triton](https://github.com/triton-lang/triton) language, a Python-based
DSL for writing highly efficient GPU kernels.


- [x] **New Language Support**: I've added comprehensive support for the
Triton programming language, allowing users to compile and inspect
Triton kernels within Compiler Explorer. (c.f.,
`lib/compilers/triton.ts`)
- [x] **Python Wrapper for Compilation**: A new Python wrapper script
(`triton_wrapper.py`) has been introduced to manage Triton compilation,
patching its behavior to dump compiled kernels and intermediate
representations without requiring actual execution, and consolidating
the output for Compiler Explorer.
- [x] **Device Assembly View**: Enables viewing of generated device
assembly code (e.g., PTX, AMDGCN) and various intermediate
representations (MLIR, LLVM IR) produced by the Triton compiler.
- [x] **MLIR Parsing**: New parsers (`asm-parser-mlir.ts` and
`mlir-pass-dump-parser.ts`) have been added to correctly interpret and
display MLIR assembly and optimization pass dumps, including source
location information.
- [x] **Multi-Version & Multi-Backend Support**: Painstakingly includes
all 8 versions (from 2.2.0 to 3.3.1) of Triton that supports Python
3.12. Supports both CUDA and HIP backend for Triton 3.

## Screenshots

Source and assembly:
<img width="1354" height="789" alt="image"
src="https://github.com/user-attachments/assets/c29650ff-2073-40e0-a9e6-ff8377094b5e"
/>



Device view for MLIR and LLVM IR: 
<img width="1402" height="670" alt="image"
src="https://github.com/user-attachments/assets/43dd5c68-ca78-41b1-9865-e97ffe3ef73c"
/>

Opt pipeline viewer:
<img width="1408" height="668" alt="image"
src="https://github.com/user-attachments/assets/429eef8c-aaac-4781-aafa-39ef0ffc7241"
/>

Diff of TTIR in Triton 3.3.1 vs 2.3.0:
<img width="1580" height="726" alt="image"
src="https://github.com/user-attachments/assets/a928c893-dd9a-4c3a-a048-14046e56a14c"
/>

CUDA & HIP:
<img width="1596" height="800" alt="image"
src="https://github.com/user-attachments/assets/c18800c3-cfad-4e5e-96de-ba92c9f236ea"
/>

## Implementation Details (and Notes for Reviewers)

- For Device Assembly View, I Implemented `MlirAsmParser` for parsing
MLIR assembly. Technically MLIR is not an assembly language, but there
is no better choice to make the source line map work w/ device view.
- I Implemented `MlirPassDumpParser` for processing MLIR optimization
pass dumps. I tried to subclass `LlvmPassDumpParser`, but they turn out
to be too different to worth doing it.
- `LlvmPassDumpParser` made some assumptions that do not hold true for
MLIR passed. Some effort is put to make sure that the passes are
properly diff-ed, since some passes can run multiple times and also
sometimes pass can be nested (i.e., some number of `before`s followed by
some number of `after`s)
- A lot of effort is put into `patch_triton` to make sure that the we
only compile the kernel without actually running it, and that needs to
work across all the versions we support.

## Steps to Run Locally

1. Clone https://github.com/ShawnZhong/compiler-explorer-infra.git
2. Install Triton to `/opt/compiler-explorer/triton`:
```sh
$ cd compiler-explorer-infra
$ ./bin/ce_install install triton
$ ls /opt/compiler-explorer/triton
# v2.2.0  v2.3.0  v2.3.1  v3.0.0  v3.1.0  v3.2.0  v3.3.0  v3.3.1
```
3. Clone https://github.com/ShawnZhong/compiler-explorer.git and
checkout branch `triton`
4. Run Compiler Explorer
```sh
make EXTRA_ARGS='--language triton' dev
```
5. Enjoy

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-07-30 10:15:28 -05:00
Jacob Panov
1a388a580f Fix NIM compiler ENOENT error when -c passed as options (#7952)
This PR addresses an issue that causes an `ENOENT` in the presence of the `-c` parameter being passed as an option in binary mode.
2025-07-30 09:55:17 -05:00
Matt Godbolt
8734c3e492 Update biome (#7956)
- latest biome, and fix its configuration
- fixes "static" content to be globally configured too (instead of
per-line)
- fixes issues:
  - imports fixed up
  - `Date.now()` vs `+new Date()`
  - some unused things `_` prefixed
 
After discussion with the team, turned off the unused parameter warning.
2025-07-28 10:34:46 -05:00
Quinton Miller
33f433cb1f Crystal: support Intel assembly output syntax (#7940) 2025-07-27 14:44:02 +02:00
Apurva Modak
20ef5784cf Add RGA compiler support for HLSL (#7941) 2025-07-27 14:40:41 +02:00
Ofek Shilon
8a2a77fe21 Restrict zig -fllvm to supported versions 2025-07-19 16:17:43 +03:00
Ofek
a0570b37f3 Fix #7908: Restrict zig -fno-strip switch to versions that support it (#7931)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-07-19 14:17:51 +03:00
Ofek
a08da10ddb Fix #7907: Add fllvm to zig compilations (#7930)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-07-19 14:01:59 +03:00
Ofek
6a0188a5ed Fix #7852: return processRawOptRemarks back to BaseCompiler (#7860)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-24 07:33:53 +03:00
Ofek
37ae297d95 Fix #7849: Enable llvm opt-remarks for flang (#7851)
Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-21 20:56:15 +03:00
Patrick Quist
b5e7219baa Add dedicated PTX assembly parser to fix directive filtering (#7839) 2025-06-20 14:46:24 +02:00
Patrick Quist
4069bf3b3e Fix/msvc lib debug release naming (#7840) 2025-06-19 23:15:55 +02:00
Patrick Quist
02b4aa9f02 Fix MSVC library naming for debug/release modes (#7838) 2025-06-19 10:40:07 +02:00
Peter Hill
12fcac5e05 Add more recent LFortran linker flag (#7800)
More recent versions of LFortran use `LFORTRAN_LINKER` env var for
linking, rather than `LFORTRAN_CC`.

Tested locally with 0.42 and 0.51
2025-06-17 16:19:40 -05:00
Ofek
d59702383b Fix regression in rustc-nightly opt remarks (#7818)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->

Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-16 21:24:52 +03:00
Ofek
daf15af5ab Fix #7809 plus some refactoring (#7812)
Fix #7809 and then some:

Stop processing opt-remarks if none were requested,
Make gcc dump remarks to file,
separate opt-file handling to ClangCompiler and GccCompiler,
make DefaultCompiler inherit GccCompiler,
move some tests around.
2025-06-16 10:13:32 -05:00
narpfel
299d7a251c Fix argument parser for Rust >= 1.88 (#7806)
Resolves #7780.

Basically a follow-up to #7652; the output format of `rustc --help` was
changed to include angle brackets `<` and `>`. This PR updates the
regexes used to parse the help output and adds some tests.
2025-06-16 09:55:02 -05:00
Mats Jun Larsen
a3be869e3a Replace PascalUtils class with top-level functions (NFC) (#7610) 2025-06-11 07:11:57 +00:00
Christoffer Lerno
112d000ad2 Fix C3 0.6.8 (#7786) 2025-06-09 18:09:01 -05:00
timo
bd80d171de Add raku language and rakudo compiler (#7784)
This relies on https://github.com/compiler-explorer/infra/pull/1658 to
put rakudo release versions in the right spot.


![image](https://github.com/user-attachments/assets/30ba7c2b-389a-4d3f-895b-c13da5b5f072)

There are more things that can be added, such as opcode tooltips,
suggested options for `--target=parse`, `--target=ast`,
`--target=optimize`, and probably other things I haven't thought of yet.
But this pull request should be a good starting point, and fine to merge
without waiting for further features.
2025-06-09 12:39:53 -05:00
Rob Parolin
157662eb31 [mojo-lang] Fixing LLVM IR panel due to calling the mojo compiler with incorrect args. (#7716)
This PR fixes the LLVM IR output for the Mojo compiler integration,
ensuring the LLVM IR panel works correctly and no longer shows "Internal
error; unable to open output path" errors.
2025-05-30 07:48:28 -05:00
Partouf
2e0549b3fb more fixes 2025-05-28 15:21:02 +02:00
Partouf
d16d717220 hotfix windows 2025-05-28 14:49:51 +02:00
Partouf
de3e34bda8 windows hotfix 2025-05-28 14:00:09 +02:00
Patrick Quist
2e76639163 Windows library support (#7554)
Huray
2025-05-28 10:50:26 +02:00