We have integrated resolc into Compiler Explorer–a popular web application for inspecting and understanding the assembly code generated by various compilers.
When a Solidity smart contract is compiled, the Ethereum Solidity solc compiler is used as the Solidity frontend for compiling Solidity down to its intermediate representation (IR) called Yul IR. resolc then lowers Yul to LLVM IR and uses LLVM for further optimization and compilation into RISC-V. During the compilation process, debug information can be requested.
Through Compiler Explorer you can now explore the output of the compilation process (screenshots are also provided below):
- Choose between two input languages:
- Solidity
- Yul (Solidity IR)
- Choose a
resolccompiler - View the assembly
- PolkaVM assembly (if enabling the option
Compile to binary object) - RISC-V (64 bits) assembly
- PolkaVM assembly (if enabling the option
- View intermediate results (click
+orAdd new):- LLVM IR
- Optimized (if enabling the option
Show Optimized) - Unoptimized
- Optimized (if enabling the option
- Yul
- Only available when Solidity is the input language
- LLVM IR
- Optionally, pass additional arguments to the compiler via the
Compiler optionsfield.- Note: Unlike most other compilers,
-Ozis enabled by default.
- Note: Unlike most other compilers,
Limitations:
- Source mappings are currently only available for the Yul IR input language.
- Currently,
solcpropagates Solidity source locations to Yul only as comments, whichresolcdoes not yet parse. We hope to improve this onceethdebug formatlands in an upstream release.
- Currently,
- The assembly output is truncated at 5K LOC. Thus, it is currently suitable for smaller contracts and you may need to isolate parts of your code.
Screenshot 1:
- Input: Yul
- Output: RISC-V and LLVM IR optimized
Screenshot 2:
- Input: Solidity
- Output: PolkaVM assembly and Yul
Please let us know if you spot a translation bug or a cool optimization opportunity in your code! ![]()
