From ce4951549999f403446415c135ad1403a16a15c3 Mon Sep 17 00:00:00 2001 From: xleroy Date: Mon, 12 Nov 2012 13:42:22 +0000 Subject: Globalenvs: allocate one-byte block with permissions Nonempty for each function definition, so that comparisons between function pointers are correctly defined. AST, Globalenvs, and many other files: represent programs as a list of (function or variable) definitions instead of two lists, one for functions and the other for variables. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2067 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/Cminorgen.v | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'cfrontend/Cminorgen.v') diff --git a/cfrontend/Cminorgen.v b/cfrontend/Cminorgen.v index 2c02813b..a47efb24 100644 --- a/cfrontend/Cminorgen.v +++ b/cfrontend/Cminorgen.v @@ -565,19 +565,19 @@ Definition build_compilenv (fn_variables f) (globenv, 0). -Definition assign_global_variable - (ce: compilenv) (info: ident * globvar var_kind) : compilenv := - match info with - | (id, mkglobvar vk _ _ _) => - PMap.set id (match vk with Vscalar chunk => Var_global_scalar chunk - | Varray _ _ => Var_global_array - end) - ce - end. +Definition assign_global_def + (ce: compilenv) (gdef: ident * globdef Csharpminor.fundef var_kind) : compilenv := + let (id, gd) := gdef in + let kind := + match gd with + | Gvar (mkglobvar (Vscalar chunk) _ _ _) => Var_global_scalar chunk + | Gvar (mkglobvar (Varray _ _) _ _ _) => Var_global_array + | Gfun f => Var_global_array + end in + PMap.set id kind ce. Definition build_global_compilenv (p: Csharpminor.program) : compilenv := - List.fold_left assign_global_variable - p.(prog_vars) (PMap.init Var_global_array). + List.fold_left assign_global_def p.(prog_defs) (PMap.init Var_global_array). (** * Translation of functions *) -- cgit