-
Notifications
You must be signed in to change notification settings - Fork 61
Open
Labels
A-semaArea: semantic analysisArea: semantic analysisC-enhancementCategory: an issue proposing an enhancement or a PR with oneCategory: an issue proposing an enhancement or a PR with oneE-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.P-highHigh priorityHigh priority
Description
Describe the feature
Currently HIR lowering is incomplete, as inline assembly AST nodes are not lowered.
Lower Yul/inline assembly to HIR.
The main caveat here is that we want to try to merge Yul to standard HIR nodes as much as possible. This means, for example, we translate Yul variable declarations to Solidity ones, function calls to binary operators where possible etc.
For example:
function f() {
assembly {
function yulfn(a, b) -> c, d {}
let x := add(42, 69)
let c, d := yulfn(x, 10)
}
}
// Becomes
function f() {
unchecked {
uint256 x = uint256(42) + uint256(69);
(uint256 c, uint256 d) = yulfn(x, uint256(10));
}
}
function yulfn(uint256 a, uint256 b) private returns (uint256 c, uint256 d) {}
Not literally in source code or AST, but when lowering to HIR we create normal HIR nodes for Yul nodes that map to the same operations.
This means we need to handle all the Yul builtins and add them to the builtin enum. Since Yul functions are untyped we can have a utility here that creates a function type with N arguments and M returns of type uint256.
Additional context
No response
Metadata
Metadata
Assignees
Labels
A-semaArea: semantic analysisArea: semantic analysisC-enhancementCategory: an issue proposing an enhancement or a PR with oneCategory: an issue proposing an enhancement or a PR with oneE-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.P-highHigh priorityHigh priority