aboutsummaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2016-03-16 13:51:33 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2016-03-16 13:51:33 +0100
commit1e08d4adb241e076a96f9525fdb8359cf8845527 (patch)
tree0ef2e4239e970c9904a94a5675ce0f73dc0f1fb4 /backend
parent9d95c2ce76bffe4be06697ac99936c7703c18a07 (diff)
downloadcompcert-kvx-1e08d4adb241e076a96f9525fdb8359cf8845527.tar.gz
compcert-kvx-1e08d4adb241e076a96f9525fdb8359cf8845527.zip
Added interface for the Asmexpansion.
Hide the reference used internally behind the interface and added some functions to access the needed values. Bug 18394
Diffstat (limited to 'backend')
-rw-r--r--backend/Asmexpandaux.ml9
-rw-r--r--backend/Asmexpandaux.mli36
2 files changed, 45 insertions, 0 deletions
diff --git a/backend/Asmexpandaux.ml b/backend/Asmexpandaux.ml
index 3d1dd754..13aa71d2 100644
--- a/backend/Asmexpandaux.ml
+++ b/backend/Asmexpandaux.ml
@@ -50,6 +50,15 @@ let new_label () =
let set_current_function f =
current_function := f; next_label := None; current_code := []
+let get_current_function_args () =
+ (!current_function).fn_sig.sig_args
+
+let is_current_function_variadic () =
+ (!current_function).fn_sig.sig_cc.cc_vararg
+
+let get_current_function_sig () =
+ (!current_function).fn_sig
+
let get_current_function () =
let c = List.rev !current_code in
let fn = !current_function in
diff --git a/backend/Asmexpandaux.mli b/backend/Asmexpandaux.mli
new file mode 100644
index 00000000..797eb10c
--- /dev/null
+++ b/backend/Asmexpandaux.mli
@@ -0,0 +1,36 @@
+(* *********************************************************************)
+(* *)
+(* The Compcert verified compiler *)
+(* *)
+(* Xavier Leroy, INRIA Paris-Rocquencourt *)
+(* Bernhard Schommer, AbsInt Angewandte Informatik GmbH *)
+(* *)
+(* Copyright Institut National de Recherche en Informatique et en *)
+(* Automatique. All rights reserved. This file is distributed *)
+(* under the terms of the INRIA Non-Commercial License Agreement. *)
+(* *)
+(* *********************************************************************)
+
+open Asm
+open AST
+open BinNums
+
+(** Auxiliary functions for builtin expansion *)
+
+val emit: instruction -> unit
+ (* Emit an instruction *)
+val new_label: unit -> label
+ (* Compute a fresh label *)
+val is_current_function_variadic: unit -> bool
+ (* Test wether the current function is a variadic function *)
+val get_current_function_args: unit -> typ list
+ (* Get the types of the current function arguments *)
+val get_current_function_sig: unit -> signature
+ (* Get the signature of the current function *)
+val set_current_function: coq_function -> unit
+ (* Set the current function *)
+val get_current_function: unit -> coq_function
+ (* Get the current function *)
+val expand_debug: positive -> int -> (preg -> int) -> (instruction -> unit) -> instruction list -> unit
+ (* Expand builtin debug function. Takes the function id, the register number of the stackpointer, a
+ function to get the dwarf mapping of varibale names and for the expansion of simple instructions *)