aboutsummaryrefslogtreecommitdiffstats
path: root/cfrontend/Cminorgen.v
diff options
context:
space:
mode:
authorxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-11-12 13:42:22 +0000
committerxleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-11-12 13:42:22 +0000
commitce4951549999f403446415c135ad1403a16a15c3 (patch)
treecac9bbb2fea29fce331916b277c38ed8fe29e471 /cfrontend/Cminorgen.v
parentdcb9f48f51cec5e864565862a700c27df2a1a7e6 (diff)
downloadcompcert-kvx-ce4951549999f403446415c135ad1403a16a15c3.tar.gz
compcert-kvx-ce4951549999f403446415c135ad1403a16a15c3.zip
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
Diffstat (limited to 'cfrontend/Cminorgen.v')
-rw-r--r--cfrontend/Cminorgen.v22
1 files changed, 11 insertions, 11 deletions
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 *)