-
Notifications
You must be signed in to change notification settings - Fork 55
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
Initial support for RISC-V 32 I M #781
base: main
Are you sure you want to change the base?
Conversation
…s (ADD / ADDI). (#706) * Provides RISCV initial architecture description and first instructions (ADD / ADDI). Co-authored-by: Benjamin Gregoire <Benjamin.Gregoire@inria.fr> Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr> --------- Co-authored-by: Benjamin Gregoire <Benjamin.Gregoire@inria.fr> Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: LE BRETON Come <come.le-breton@inria.fr>
Co-authored-by: LE BRETON Come <come.le-breton@inria.fr>
Co-authored-by: Santiago Arranz Olmos <santiago.arranz1@gmail.com>
Add XOR and OR to compiler/riscv_instr_decl.v --------- Co-authored-by: Julian Wälde <julian.waelde@hs-rm.de> Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Renames registers. Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Riscv compiler skeleton
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet<jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
+ Fix push / pop ra to stack
It looks like gp may be used to access globals. I don't know for tp, but to be safe I added both of them into the list of callee-saved registers.
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Otherwise they are tested alone.
and select a different default on MacOS (We probably don't want to integrate this as is in main)
This pass compiles, on RISC-V, complex loads and stores into 3 equivalent instructions for which assembly can be generated. This is kind of a hack for now. Ideally, we would support subarrays with non-constant offset and a way to do pointer arithmetic.
for arm. Proof still required. Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
Proof missing in params_core. Co-authored-by: Jean-Christophe Léchenet <jean-christophe.lechenet@inria.fr>
…ctions-in-a-same-fashion-as-it-was-done-for-arm-1 789 risc v test every instructions in a same fashion as it was done for arm 1 Bug fixes to main risc-v branch have been added, as well as compiler pass. It notably adds a lowering compiler pass for complex addresses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this hard work. My comments are mostly cosmetic.
@@ -17,7 +17,7 @@ let show_intrinsics asmOp fmt = | |||
let headers = [| | |||
"no size suffix"; | |||
"one optional size suffix, e.g., “_64”"; | |||
"a zero/sign extend suffix, e.g., “_u32u16”"; | |||
"a zero/sign extend suffix, e.g., “_s16” or “_u32u16”"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is surprising: does it mean that it is now possible to write MOVSX_s16
?
ppxlib | ||
ppx_import | ||
ppx_sexp_conv | ||
ppx_yojson_conv | ||
ppx_deriving | ||
sel | ||
lsp | ||
sexplib |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change really meant to be included in this PR?
proofs/compiler/riscv_instr_decl.v
Outdated
(*CHECKME*) | ||
Definition riscv_sra_semi (wn : ty_r) (wm : word U8) : exec ty_r := ok (wsar wn (wunsigned (wand wm (wrepr U8 31)))). | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be checked before merging?
(* TODO: move *) | ||
Lemma write_lval_eq_ex wdb gd X x v s1 s2 vm1 : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be addressed before merging.
(* TODO: move *) | ||
Lemma sem_sopn_eq_ex X gd o xs es s1 s2 vm1 : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
riscv_decl | ||
riscv_extra | ||
riscv_instr_decl | ||
(* riscv_instr_decl_lemmas *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment be removed?
proofs/compiler/riscv_params.v
Outdated
Definition riscv_loparams : lowering_params lowering_options := | ||
{| | ||
lop_lower_i _ _ _ := lower_i; | ||
lop_fvars_correct := fun _ _ _ => true; (* FIXME RISCV: is this correct? *) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this.
(* FIXME try to remove the usage of this lemma, use sem_fopn_args version instead *) | ||
Lemma align_eval_instr {lp ls ii xname vi y al} {wy : word Uptr} : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really a FIXME? If it is the case, then please fix it. Otherwise please change to TODO.
(* FIXME try to remove the usage of this lemma, use sem_fopn_args version instead *) | ||
Lemma sub_eval_instr {lp ls ii xname vi y z} {wy wz : word Uptr} : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
(* Lemma li_lsem_1 s xname vi imm : | ||
let: (xi, x) := mkv xname vi in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment might be removed.
The passes between stack_alloc and reg_alloc are called twice, first in OCaml and then in Coq. Pass LowerAddressing was inserted between stack_alloc and reg_alloc, but was only called in Coq, creating a discrepancy between the two calls (in OCaml and in Coq). The pass is now called also in OCaml. Due to the way complex Coq types are extracted in OCaml, we had to make some types simpler on the Coq side to be able to call the pass in OCaml.
RA is not used as the return address storage AND the return value in the same function.
Fixes #698 and #503 and #783.