aboutsummaryrefslogtreecommitdiffstats
path: root/backend/PrintMach.ml
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-06-13 18:11:19 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-06-13 18:11:19 +0000
commita5ffc59246b09a389e5f8cbc2f217e323e76990f (patch)
treee1bc7cc54518aad7c20645f187cee8110de8cff9 /backend/PrintMach.ml
parent4daccd62b92b23016d3f343d5691f9c164a8a951 (diff)
downloadcompcert-kvx-a5ffc59246b09a389e5f8cbc2f217e323e76990f.tar.gz
compcert-kvx-a5ffc59246b09a389e5f8cbc2f217e323e76990f.zip
Revised handling of annotation statements, and more generally built-in functions, and more generally external functions
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1672 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'backend/PrintMach.ml')
-rw-r--r--backend/PrintMach.ml29
1 files changed, 14 insertions, 15 deletions
diff --git a/backend/PrintMach.ml b/backend/PrintMach.ml
index 5b4887e2..a6a1cc56 100644
--- a/backend/PrintMach.ml
+++ b/backend/PrintMach.ml
@@ -21,21 +21,9 @@ open Integers
open Locations
open Machregsaux
open Mach
+open PrintAST
open PrintOp
-let name_of_chunk = function
- | Mint8signed -> "int8signed"
- | Mint8unsigned -> "int8unsigned"
- | Mint16signed -> "int16signed"
- | Mint16unsigned -> "int16unsigned"
- | Mint32 -> "int32"
- | Mfloat32 -> "float32"
- | Mfloat64 -> "float64"
-
-let name_of_type = function
- | Tint -> "int"
- | Tfloat -> "float"
-
let reg pp r =
match name_of_register r with
| Some s -> fprintf pp "%s" s
@@ -46,6 +34,15 @@ let rec regs pp = function
| [r] -> reg pp r
| r1::rl -> fprintf pp "%a, %a" reg r1 regs rl
+let annot_param pp = function
+ | APreg r -> reg pp r
+ | APstack(chunk, ofs) -> fprintf pp "stack(%s,%ld)" (name_of_chunk chunk) (camlint_of_coqint ofs)
+
+let rec annot_params pp = function
+ | [] -> ()
+ | [r] -> annot_param pp r
+ | r1::rl -> fprintf pp "%a, %a" annot_param r1 annot_params rl
+
let ros pp = function
| Coq_inl r -> reg pp r
| Coq_inr s -> fprintf pp "\"%s\"" (extern_atom s)
@@ -78,8 +75,10 @@ let print_instruction pp i =
| Mtailcall(sg, fn) ->
fprintf pp "tailcall %a@ " ros fn
| Mbuiltin(ef, args, res) ->
- fprintf pp "%a = builtin \"%s\"(%a)@ "
- reg res (extern_atom ef.ef_id) regs args
+ fprintf pp "%a = builtin %s(%a)@ "
+ reg res (name_of_external ef) regs args
+ | Mannot(ef, args) ->
+ fprintf pp "%s(%a)@ " (name_of_external ef) annot_params args
| Mlabel lbl ->
fprintf pp "%ld:@ " (camlint_of_positive lbl)
| Mgoto lbl ->