Support solc v0.8.31 (#430)

- Support for solc v0.8.31.
- Support for the `clz` Yul builtin.

---------

Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
xermicus
2025-12-05 15:25:13 +01:00
committed by GitHub
parent d0c10e6d5c
commit 11f82c8488
16 changed files with 142 additions and 11 deletions
@@ -348,6 +348,14 @@ impl FunctionCall {
)
.map(Some)
}
Name::Clz => {
let arguments = self.pop_arguments_llvm::<1>(context)?;
revive_llvm_context::polkavm_evm_bitwise::count_leading_zeros(
context,
arguments[0].into_int_value(),
)
.map(Some)
}
Name::Byte => {
let arguments = self.pop_arguments_llvm::<2>(context)?;
revive_llvm_context::polkavm_evm_bitwise::byte(
@@ -54,6 +54,8 @@ pub enum Name {
Shr,
/// signed arithmetic shift right `y` by `x` bits
Sar,
/// number of leading zero bits of x, 256 if x == 0
Clz,
/// `n`th byte of `x`, where the most significant byte is the `0`th byte
Byte,
/// discard value x
@@ -270,6 +272,7 @@ impl From<&str> for Name {
"shl" => Self::Shl,
"shr" => Self::Shr,
"sar" => Self::Sar,
"clz" => Self::Clz,
"byte" => Self::Byte,
"pop" => Self::Pop,
@@ -393,6 +396,7 @@ impl fmt::Display for Name {
Self::Shl => "shl",
Self::Shr => "shr",
Self::Sar => "sar",
Self::Clz => "clz",
Self::Byte => "byte",
Self::Pop => "pop",