diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2018-09-12 14:32:01 +0200 |
---|---|---|
committer | Xavier Leroy <xavierleroy@users.noreply.github.com> | 2018-09-12 14:32:01 +0200 |
commit | 591073be98300e1c07527af45c7c4ce8dff5bc39 (patch) | |
tree | 1f5143b8405b4d33a6133a7210839dab1e6eaad6 /powerpc | |
parent | 25ba7367a0d9391a4bea2d7685b8cfe8e304e2f8 (diff) | |
download | compcert-591073be98300e1c07527af45c7c4ce8dff5bc39.tar.gz compcert-591073be98300e1c07527af45c7c4ce8dff5bc39.zip |
Generate a nop instruction after some ais annotations (#137)
* Generate a nop instruction after ais annotations.
In order to prevent the merging of ais annotations with following
Labels a nop instruction is inserted, but only if the annotation
is followed immediately by a label.
The insertion of nop instructions is performed during the
expansion of builtin and pseudo assembler instructions and is
processor independent, by inserting a __builtin_nop built-in.
* Add Pnop instruction to ARM, RISC-V, and x86
ARM as well as RISC-V don't have nop instructions that can
be easily encoded by for example add with zero instructions.
For x86 we used to use `mov X0, X0` for nop but this may
not be as efficient as the true nop instruction.
* Implement __builtin_nop on all supported target architectures.
This builtin is not yet made available on the C side for all architectures.
Bug 24067
Diffstat (limited to 'powerpc')
-rw-r--r-- | powerpc/Asmexpand.ml | 7 | ||||
-rw-r--r-- | powerpc/TargetPrinter.ml | 2 |
2 files changed, 3 insertions, 6 deletions
diff --git a/powerpc/Asmexpand.ml b/powerpc/Asmexpand.ml index a17be2ee..5a2df8d3 100644 --- a/powerpc/Asmexpand.ml +++ b/powerpc/Asmexpand.ml @@ -891,7 +891,7 @@ let expand_instruction instr = expand_builtin_memcpy (Z.to_int sz) (Z.to_int al) args | EF_annot_val(kind,txt, targ) -> expand_annot_val kind txt targ args res - | EF_annot _ | EF_debug _ | EF_inline_asm _ -> + | EF_annot _ | EF_debug _ | EF_inline_asm _ -> emit instr | _ -> assert false @@ -932,10 +932,7 @@ let preg_to_dwarf = function let expand_function id fn = try set_current_function fn; - if !Clflags.option_g then - expand_debug id 1 preg_to_dwarf expand_instruction fn.fn_code - else - List.iter expand_instruction fn.fn_code; + expand id 1 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/powerpc/TargetPrinter.ml b/powerpc/TargetPrinter.ml index 3e11406c..d8b0ee4b 100644 --- a/powerpc/TargetPrinter.ml +++ b/powerpc/TargetPrinter.ml @@ -844,7 +844,7 @@ module Target (System : SYSTEM):TARGET = 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 "r1" (camlstring_of_coqstring txt) args | _ -> assert false end |