Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pseudoinstructions #519

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 21, 2024

  1. Add pseudoinstructions

    [Draft]
    
    An implementation is proposed for representing pseudoinstructions in Sail.
    
    The realization is similar to instructions, with a few differences:
    
    1. `union clause ast` -> `union clause pseudo`.
    
    1. `mapping clause assembly` -> `mapping clause pseudo_assembly`.
    
    1. `function clause execute` -> `function clause pseudo_execute`:
    
       This calls the `execute` clauses for the respective base instructions as
       defined for each pseudoinstruction.
    
    1. `mapping clause encdec`: This is undefined for pseudoinstructions because,
       for one thing, some pseudoinstructions map to more than one instruction.
       This is replaced by a new scattered mapping:
       `function clause pseudo_of`: This maps the pseudoinstruction AST to a list
       of the assembly clauses (strings) of the mapped instructions, for example:
    
       ```
       function clause pseudo_of(LA(rd, imm)) = [|
         assembly(UTYPE(imm[31..12],rd,RISCV_AUIPC)),
         assembly(ITYPE(imm[11..0],reg_name("x0"),rd,RISCV_ADDI))
       |]
    
       ```
    
       This is roughly analogous to `function clause assembly`, but instead
       of representing the instruction syntax, it represents the syntax of the
       mapped instructions.
    Linda-Njau authored and ThinkOpenly committed Aug 21, 2024
    Configuration menu
    Copy the full SHA
    bd4ef81 View commit details
    Browse the repository at this point in the history