aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/AsmToJSON.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2017-06-20 12:48:26 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2017-06-20 12:48:26 +0200
commit66ba0d63b25bab2a682c92c5a277c190b6c4c847 (patch)
tree17581ec7a49d498b1d004f90b77ab4ca0860fdd8 /powerpc/AsmToJSON.ml
parente89538bf48f86f088e2ad0ad37ca34cc29cb6024 (diff)
downloadcompcert-kvx-66ba0d63b25bab2a682c92c5a277c190b6c4c847.tar.gz
compcert-kvx-66ba0d63b25bab2a682c92c5a277c190b6c4c847.zip
Added pseudo instruction for inline asm.
The inline assembler instructions are numbered with consecutives id's per compilation unit. Bug 21689
Diffstat (limited to 'powerpc/AsmToJSON.ml')
-rw-r--r--powerpc/AsmToJSON.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/powerpc/AsmToJSON.ml b/powerpc/AsmToJSON.ml
index ac52f7b1..efb2d65d 100644
--- a/powerpc/AsmToJSON.ml
+++ b/powerpc/AsmToJSON.ml
@@ -79,17 +79,30 @@ type instruction_arg =
| Freg of freg
| Constant of constant
| Long of Integers.Int.int
+ | Id
| Crbit of crbit
| ALabel of positive
| Float32 of Floats.float32
| Float64 of Floats.float
| Atom of positive
+let id = ref 0
+
+let next_id () =
+ let tmp = !id in
+ incr id;
+ tmp
+
+let reset_id () =
+ id := 0
+
let p_arg oc = function
| Ireg ir -> p_ireg oc ir
| Freg fr -> p_freg oc fr
| Constant c -> p_constant oc c
| Long i -> p_jsingle_object oc "Integer" p_int64 i
+ | Id -> let i = next_id () in
+ p_jsingle_object oc "Integer" (fun oc i -> fprintf oc "%d" i) i
| Crbit cr -> p_crbit oc cr
| ALabel lbl -> p_label oc lbl
| Float32 f -> p_float32_constant oc f
@@ -315,6 +328,7 @@ let p_instruction oc ic =
| Pbuiltin (ef,_,_) ->
begin match ef with
| EF_inline_asm _ ->
+ instruction "Pinlineasm" [Id];
Cerrors.warning ("",-10) Cerrors.Inline_asm_sdump "inline assembler is not supported in sdump"
| _ -> ()
end
@@ -409,6 +423,7 @@ let p_vardef oc (name,v) =
output_string oc "}\n"
let p_program oc prog =
+ reset_id ();
let prog_vars,prog_funs = List.fold_left (fun (vars,funs) (ident,def) ->
match def with
| Gfun (Internal f) ->