diff options
Diffstat (limited to 'riscV')
-rw-r--r-- | riscV/Asm.v | 4 | ||||
-rw-r--r-- | riscV/Asmexpand.ml | 8 | ||||
-rw-r--r-- | riscV/TargetPrinter.ml | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/riscV/Asm.v b/riscV/Asm.v index 6d223c1d..1d8fda11 100644 --- a/riscV/Asm.v +++ b/riscV/Asm.v @@ -344,7 +344,8 @@ Inductive instruction : Type := | Ploadsi (rd: freg) (f: float32) (**r load an immediate single *) | Pbtbl (r: ireg) (tbl: list label) (**r N-way branch through a jump table *) | Pbuiltin: external_function -> list (builtin_arg preg) - -> builtin_res preg -> instruction. (**r built-in function (pseudo) *) + -> builtin_res preg -> instruction (**r built-in function (pseudo) *) + | Pnop : instruction. (**r nop instruction *) (** The pseudo-instructions are the following: @@ -985,6 +986,7 @@ Definition exec_instr (f: function) (i: instruction) (rs: regset) (m: mem) : out | Pfmsubd _ _ _ _ | Pfnmaddd _ _ _ _ | Pfnmsubd _ _ _ _ + | Pnop => Stuck end. diff --git a/riscV/Asmexpand.ml b/riscV/Asmexpand.ml index 0a7f8a8a..3e734747 100644 --- a/riscV/Asmexpand.ml +++ b/riscV/Asmexpand.ml @@ -468,7 +468,8 @@ let expand_builtin_inline name args res = (fun rl -> emit (Pmulw (rl, X a, X b)); emit (Pmulhuw (rh, X a, X b))) - + | "__builtin_nop", [], _ -> + emit Pnop (* Catch-all *) | _ -> raise (Error ("unrecognized builtin " ^ name)) @@ -598,10 +599,7 @@ let preg_to_dwarf = function let expand_function id fn = try set_current_function fn; - if !Clflags.option_g then - expand_debug id (* sp= *) 2 preg_to_dwarf expand_instruction fn.fn_code - else - List.iter expand_instruction fn.fn_code; + expand id (* sp= *) 2 preg_to_dwarf expand_instruction fn.fn_code; Errors.OK (get_current_function ()) with Error s -> Errors.Error (Errors.msg (coqstring_of_camlstring s)) diff --git a/riscV/TargetPrinter.ml b/riscV/TargetPrinter.ml index e3fbfe36..19704bad 100644 --- a/riscV/TargetPrinter.ml +++ b/riscV/TargetPrinter.ml @@ -564,6 +564,8 @@ module Target : TARGET = fprintf oc " jr x5\n"; jumptables := (lbl, tbl) :: !jumptables; fprintf oc "%s end pseudoinstr btbl\n" comment + | Pnop -> + fprintf oc " nop\n" | Pbuiltin(ef, args, res) -> begin match ef with | EF_annot(kind,txt, targs) -> @@ -571,7 +573,7 @@ module Target : TARGET = | 1 -> let annot = annot_text preg_annot "x2" (camlstring_of_coqstring txt) args in fprintf oc "%s annotation: %S\n" comment annot | 2 -> let lbl = new_label () in - fprintf oc "%a: " label lbl; + fprintf oc "%a:\n" label lbl; add_ais_annot lbl preg_annot "x2" (camlstring_of_coqstring txt) args | _ -> assert false end |