Created
March 22, 2020 12:45
-
-
Save maekawatoshiki/7b1bebf0fffa34fdeccfec60f3624026 to your computer and use it in GitHub Desktop.
理想の命令選択パターンマッチ構文を考える
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%c = (%a + %b) => addrr | |
%c = add(%a, $imm) => addri | |
%c = %a + %b | |
: %c i32/f32 | |
: %a i32/f32 | |
: %b i32/f32 | |
=> addrr / faddrr | |
(add a, b | |
:( a GR32 => :( b GR32 => ADDrr a, b ) | |
:( b i32 => ADDri a, b ) ) ) | |
add a, b: | |
GR32 a: | |
i32 b => (ADDri a, b) | |
GR32 b => (ADDrr a, b) | |
[add a, b]: | |
GR32 a: | |
i32 b => [ADDri a, b] | |
GR32 b => [ADDrr a, b] | |
(load (add a, b)): | |
frame_index a: | |
i32 b => (mov [a + b]) | |
GR32 b => (mov [a + b]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment