From b1c8e25e7756be73d16cc6dd08879f1f552ce5fc Mon Sep 17 00:00:00 2001 From: David Monniaux Date: Fri, 27 Mar 2020 15:16:21 +0100 Subject: pass to insert a nop at start position in functions --- backend/FirstNop.v | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 backend/FirstNop.v (limited to 'backend/FirstNop.v') diff --git a/backend/FirstNop.v b/backend/FirstNop.v new file mode 100644 index 00000000..3d2211bc --- /dev/null +++ b/backend/FirstNop.v @@ -0,0 +1,18 @@ +Require Import Coqlib Maps Errors Integers Floats Lattice Kildall. +Require Import AST Linking. +Require Import Memory Registers Op RTL. + +Definition transf_function (f: function) : function := + let start_pc := max_pc_function f in + {| fn_sig := f.(fn_sig); + fn_params := f.(fn_params); + fn_stacksize := f.(fn_stacksize); + fn_code := PTree.set start_pc (Inop f.(fn_entrypoint)) f.(fn_code); + fn_entrypoint := start_pc |}. + +Definition transf_fundef (fd: fundef) : fundef := + AST.transf_fundef transf_function fd. + +Definition transf_program (p: program) : program := + transform_program transf_fundef p. + -- cgit