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>
This commit is contained in:
LJ
2025-10-14 20:56:59 +02:00
committed by GitHub
parent 55f6469956
commit 066a942cbc
27 changed files with 1440 additions and 13 deletions

8
.github/labeler.yml vendored
View File

@@ -371,6 +371,7 @@
- 'lib/compilers/solidity.ts'
- 'lib/compilers/solidity-zksync.ts'
- 'lib/compilers/solx.ts'
- 'lib/compilers/resolc.ts'
- 'etc/config/solidity.*.properties'
'lang-spice':
@@ -447,6 +448,13 @@
- 'etc/config/wasm.*.properties'
- 'static/modes/wat-mode.ts'
'lang-yul':
- changed-files:
- any-glob-to-any-file:
- 'lib/compilers/resolc.ts'
- 'etc/config/yul.*.properties'
- 'static/modes/yul-mode.ts'
'lang-zig':
- changed-files:
- any-glob-to-any-file: