aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/AsmToJSON.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2017-09-25 17:37:14 +0200
committerBernhard Schommer <bernhardschommer@gmail.com>2017-09-25 17:38:30 +0200
commitc0da0f3a550887c84982722c3b9596f03dc97e61 (patch)
treef93ed7a3e19a45a03256e92093a4ecc268943d71 /powerpc/AsmToJSON.ml
parent8d5c6bb8f0cac1339dec7b730997ee30b1517073 (diff)
downloadcompcert-kvx-c0da0f3a550887c84982722c3b9596f03dc97e61.tar.gz
compcert-kvx-c0da0f3a550887c84982722c3b9596f03dc97e61.zip
Added dump-mnemonics option.
This option allows it to dump a list of all used mnemonics into a file. Bug 22239
Diffstat (limited to 'powerpc/AsmToJSON.ml')
-rw-r--r--powerpc/AsmToJSON.ml184
1 files changed, 184 insertions, 0 deletions
diff --git a/powerpc/AsmToJSON.ml b/powerpc/AsmToJSON.ml
index 2017d3e3..fb36b9d7 100644
--- a/powerpc/AsmToJSON.ml
+++ b/powerpc/AsmToJSON.ml
@@ -112,6 +112,184 @@ let pp_arg pp = function
| Atom a -> pp_atom_constant pp a
| String s -> pp_jsingle_object pp "String" pp_jstring s
+ let mnemonic_names =
+ [ "Padd"
+ ; "Paddc"
+ ; "Padde"
+ ; "Paddi"
+ ; "Paddi"
+ ; "Paddic"
+ ; "Paddis"
+ ; "Paddis"
+ ; "Paddze"
+ ; "Pand_"
+ ; "Pandc"
+ ; "Pandi_"
+ ; "Pandi_"
+ ; "Pandis_"
+ ; "Pandis_"
+ ; "Pb"
+ ; "Pbctr"
+ ; "Pbctrl"
+ ; "Pbdnz"
+ ; "Pbf"
+ ; "Pbl"
+ ; "Pbs"
+ ; "Pblr"
+ ; "Pbt"
+ ; "Pbtbl"
+ ; "Pcmpb"
+ ; "Pcmpld"
+ ; "Pcmpldi"
+ ; "Pcmplw"
+ ; "Pcmplwi"
+ ; "Pcmpd"
+ ; "Pcmpdi"
+ ; "Pcmpw"
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
+ ; "Pmulli"
+ ; "Pmullw"
+ ; "Pmulhw"
+ ; "Pmulhwu"
+ ; "Pnand"
+ ; "Pnor"
+ ; "Por"
+ ; "Porc"
+ ; "Pori"
+ ; "Pori"
+ ; "Poris"
+ ; "Poris"
+ ; "Prldicl"
+ ; "Prldinm"
+ ;"Prldimi"
+ ; "Prlwinm"
+ ;"Prlwimi"
+ ; "Psld"
+ ; "Pslw"
+ ; "Psrad"
+ ; "Psradi"
+ ; "Psraw"
+ ; "Psrawi"
+ ; "Psrd"
+ ; "Psrw"
+ ; "Pstb"
+ ; "Pstbx"
+ ; "Pstd"
+ ; "Pstdx"
+ ; "Pstdu"
+ ; "Pstfd"
+ ; "Pstfdu"
+ ; "Pstfdx"
+ ; "Pstfs"
+ ; "Pstfsx"
+ ; "Psth"
+ ; "Psthx"
+ ; "Psthbrx"
+ ; "Pstw"
+ ; "Pstwu"
+ ; "Pstwx"
+ ; "Pstwux"
+ ; "Pstwbrx"
+ ; "Pstwcx_"
+ ; "Psubfc"
+ ; "Psubfe"
+ ; "Psubfze"
+ ; "Psubfic"
+ ; "Psubfic"
+ ; "Psync"
+ ; "Ptrap"
+ ; "Pxor"
+ ; "Pxori"
+ ; "Pxori"
+ ; "Pxoris"
+ ; "Pxoris"
+ ; "Plabel"
+ ; "Pinlineasm"
+ ; "Pannot"
+ ]
+
let pp_instructions pp ic =
let ic = List.filter (fun s -> match s with
| Pbuiltin (ef,_,_) ->
@@ -124,6 +302,7 @@ let pp_instructions pp ic =
| Pcfi_rel_offset _ -> false
| _ -> true) ic in
let instruction pp n args =
+ assert (List.mem n mnemonic_names);
pp_jobject_start pp;
pp_jmember ~first:true pp "Instruction Name" pp_jstring n;
pp_jmember pp "Args" (pp_jarray pp_arg) args;
@@ -467,3 +646,8 @@ let pp_program pp prog =
pp_jmember ~first:true pp "Global Variables" (pp_jarray pp_vardef) prog_vars;
pp_jmember pp "Functions" (pp_jarray pp_fundef) prog_funs;
pp_jobject_end pp
+
+let pp_mnemonics pp =
+ let mnemonic_names = List.sort (String.compare) mnemonic_names in
+ let new_line pp () = pp_print_string pp "\n" in
+ pp_print_list ~pp_sep:new_line pp_print_string pp mnemonic_names