aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/config/cil32/cil-types.h1
-rw-r--r--gcc/config/cil32/cil32.c1
-rw-r--r--gcc/config/cil32/emit-cil.c5
-rw-r--r--gcc/config/cil32/gimple-to-cil.c9
4 files changed, 15 insertions, 1 deletions
diff --git a/gcc/config/cil32/cil-types.h b/gcc/config/cil32/cil-types.h
index 9b537645775..f8c937dcab3 100644
--- a/gcc/config/cil32/cil-types.h
+++ b/gcc/config/cil32/cil-types.h
@@ -337,6 +337,7 @@ struct machine_function GTY(())
{
unsigned int label_id;
tree label_addrs;
+ bool locals_init;
/* Hash table used for mapping CIL sequences to GCC's basic blocks. */
struct htab * GTY ((param_is (struct cil_basic_block_d))) bb_seqs;
diff --git a/gcc/config/cil32/cil32.c b/gcc/config/cil32/cil32.c
index 1dbfe3beeaa..4781d749f2d 100644
--- a/gcc/config/cil32/cil32.c
+++ b/gcc/config/cil32/cil32.c
@@ -119,6 +119,7 @@ cil_init_machine_status (void)
machine->label_id = 0;
machine->label_addrs = NULL_TREE;
+ machine->locals_init = false;
machine->bb_seqs = htab_create_ggc (32, cil_basic_block_hash,
cil_basic_block_eq, NULL);
diff --git a/gcc/config/cil32/emit-cil.c b/gcc/config/cil32/emit-cil.c
index a4b2be5b974..12d26470eca 100644
--- a/gcc/config/cil32/emit-cil.c
+++ b/gcc/config/cil32/emit-cil.c
@@ -2247,7 +2247,10 @@ emit_local_vars (FILE *file)
/* Emit the local variables starting from the most used ones. */
- fprintf (file, "\n\t.locals (");
+ if (cfun->machine->locals_init)
+ fprintf (file, "\n\t.locals init (");
+ else
+ fprintf (file, "\n\t.locals (");
for (i = 0; i < locals_n; i++)
{
diff --git a/gcc/config/cil32/gimple-to-cil.c b/gcc/config/cil32/gimple-to-cil.c
index a4ddaeda438..7b05aa853d6 100644
--- a/gcc/config/cil32/gimple-to-cil.c
+++ b/gcc/config/cil32/gimple-to-cil.c
@@ -3134,6 +3134,10 @@ gimple_to_cil_node (cil_stmt_iterator *csi, tree node)
stmt = cil_build_stmt_arg (CIL_LDLOC, res_var);
csi_insert_after (csi, stmt, CSI_CONTINUE_LINKING);
+
+ /* Flag the function so that the emission phase will emit an 'init'
+ directive in the local variables declaration. */
+ cfun->machine->locals_init = true;
}
stmt = cil_build_stmt (CIL_RET);
@@ -3456,6 +3460,11 @@ gimple_to_cil (void)
stmt = cil_build_stmt (CIL_RET);
csi_insert_after (&csi, stmt, CSI_CONTINUE_LINKING);
+
+ /* Flag the function so that the emission phase will emit an
+ 'init' directive in the local variables declaration. */
+ cfun->machine->locals_init = true;
+
/* FIXME: Is this really needed? */
make_single_succ_edge (bb, EXIT_BLOCK_PTR, EDGE_FALLTHRU);
}