|
1008 | 1008 | (rd WritableReg) |
1009 | 1009 | (mem MemArg)) |
1010 | 1010 |
|
| 1011 | + ;; Load address referenced by `mem` into `rd`. |
| 1012 | + (LoadIndexedAddr |
| 1013 | + (rd WritableReg) |
| 1014 | + (base Reg) |
| 1015 | + (index Reg) |
| 1016 | + (offset i16) |
| 1017 | + (size u8)) |
| 1018 | + |
| 1019 | + ;; Load address referenced by `mem` into `rd`. |
| 1020 | + (LoadLogicalIndexedAddr |
| 1021 | + (rd WritableReg) |
| 1022 | + (base Reg) |
| 1023 | + (index Reg) |
| 1024 | + (offset u16) |
| 1025 | + (size u8)) |
| 1026 | + |
1011 | 1027 | ;; Meta-instruction to emit a loop around a sequence of instructions. |
1012 | 1028 | ;; This control flow is not visible to the compiler core, in particular |
1013 | 1029 | ;; the register allocator. Therefore, instructions in the loop may not |
|
1741 | 1757 | (decl u32_from_value (u32) Value) |
1742 | 1758 | (extern extractor u32_from_value u32_from_value) |
1743 | 1759 |
|
| 1760 | +(decl u16_from_value (u16) Value) |
| 1761 | +(extern extractor u16_from_value u16_from_value) |
| 1762 | + |
1744 | 1763 | (decl u8_from_value (u8) Value) |
1745 | 1764 | (extern extractor u8_from_value u8_from_value) |
1746 | 1765 |
|
|
1860 | 1879 | (decl pure partial memarg_imm_from_offset_plus_bias (Offset32 u8) SImm20) |
1861 | 1880 | (extern constructor memarg_imm_from_offset_plus_bias memarg_imm_from_offset_plus_bias) |
1862 | 1881 |
|
| 1882 | +(decl pure partial memarg_imm_from_shifted_offset (Offset32 u8) SImm20) |
| 1883 | +(extern constructor memarg_imm_from_shifted_offset memarg_imm_from_shifted_offset) |
| 1884 | + |
1863 | 1885 | ;; Accessors for `MemFlags`. |
1864 | 1886 |
|
1865 | 1887 | (decl littleendian () MemFlags) |
|
1927 | 1949 | (if-let final_offset (memarg_symbol_offset_sum offset sym_offset)) |
1928 | 1950 | (memarg_symbol name final_offset flags)) |
1929 | 1951 |
|
| 1952 | +(rule 2 (lower_address flags (has_type (and (ty_addr64 _) (mie4_enabled)) |
| 1953 | + (iadd (ishl (uextend (iadd x (u16_from_value z))) (u8_from_value shift)) y)) (offset32 0)) |
| 1954 | + (memarg_reg_plus_off (load_logical_indexed_addr x y z shift) 0 0 flags)) |
| 1955 | + |
| 1956 | +(rule 3 (lower_address flags (has_type (and (ty_addr64 _) (mie4_enabled)) |
| 1957 | + (iadd y (ishl (uextend (iadd x (u16_from_value z))) (u8_from_value shift)))) (offset32 0)) |
| 1958 | + (memarg_reg_plus_off (load_logical_indexed_addr y x z shift) 0 0 flags)) |
| 1959 | + |
| 1960 | +(rule 4 (lower_address flags (has_type (and (ty_addr64 _) (mie4_enabled)) |
| 1961 | + (iadd (ishl (sextend (iadd x (i16_from_value z))) (u8_from_value shift)) y)) (offset32 0)) |
| 1962 | + (memarg_reg_plus_off (load_indexed_addr x y z shift) 0 0 flags)) |
| 1963 | + |
| 1964 | +(rule 5 (lower_address flags (has_type (and (ty_addr64 _) (mie4_enabled)) |
| 1965 | + (iadd y (ishl (sextend (iadd x (i16_from_value z))) (u8_from_value shift)))) (offset32 0)) |
| 1966 | + (memarg_reg_plus_off (load_indexed_addr y x z shift) 0 0 flags)) |
1930 | 1967 |
|
1931 | 1968 | ;; Lower an address plus a small bias into a `MemArg`. |
1932 | 1969 |
|
|
2817 | 2854 | (_ Unit (emit (MInst.LoadAddr dst mem)))) |
2818 | 2855 | dst)) |
2819 | 2856 |
|
| 2857 | +;; Helper for emitting `MInst.LoadIndexedAddr` instructions. |
| 2858 | +(decl load_indexed_addr (Reg Reg i16 u8) Reg) |
| 2859 | +(rule (load_indexed_addr base index offset size) |
| 2860 | + (let ((dst WritableReg (temp_writable_reg $I64)) |
| 2861 | + (_ Unit (emit (MInst.LoadIndexedAddr dst base index offset size)))) |
| 2862 | + dst)) |
| 2863 | + |
| 2864 | +;; Helper for emitting `MInst.LoadLogicalIndexedAddr` instructions. |
| 2865 | +(decl load_logical_indexed_addr (Reg Reg u16 u8) Reg) |
| 2866 | +(rule (load_logical_indexed_addr base index offset size) |
| 2867 | + (let ((dst WritableReg (temp_writable_reg $I64)) |
| 2868 | + (_ Unit (emit (MInst.LoadLogicalIndexedAddr dst base index offset size)))) |
| 2869 | + dst)) |
| 2870 | + |
2820 | 2871 | ;; Helper for emitting `MInst.Call` instructions. |
2821 | 2872 | (decl call_impl (WritableReg BoxCallInfo) SideEffectNoResult) |
2822 | 2873 | (rule (call_impl reg info) |
|
0 commit comments