aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgsvelto <gsvelto@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-05 22:21:20 +0000
committergsvelto <gsvelto@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-05 22:21:20 +0000
commit81f01cb929d47185686099a8d834a3e11e4eb9c3 (patch)
tree0f8c7f9c7dbd803858b6cdd0b88f87253cd624fe
parentda3b9128df28a157c33f4eca52baf36dc01f197b (diff)
Honor the -fsyntax-only flag by not emitting any assembly code.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/st/cli-be@147139 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/config/cil32/cil-refs.c20
-rw-r--r--gcc/config/cil32/emit-cil.c23
-rw-r--r--gcc/config/cil32/gimple-to-cil.c1
3 files changed, 26 insertions, 18 deletions
diff --git a/gcc/config/cil32/cil-refs.c b/gcc/config/cil32/cil-refs.c
index 884fbc66b91..caf77afa176 100644
--- a/gcc/config/cil32/cil-refs.c
+++ b/gcc/config/cil32/cil-refs.c
@@ -95,10 +95,13 @@ static GTY(()) VEC(tree, gc) *pending_ctors = NULL;
void
refs_init (void)
{
- ref_types = htab_create_ggc (32, ref_type_hash, ref_type_eq, NULL);
- ref_pinvokes = htab_create_ggc (32, pinvoke_hash, pinvoke_eq, NULL);
- ref_strings = htab_create_ggc (32, str_ref_hash, str_ref_eq, NULL);
- labels_map = htab_create_ggc (32, label_addr_hash, label_addr_eq, NULL);
+ if (ref_types == NULL)
+ {
+ ref_types = htab_create_ggc (32, ref_type_hash, ref_type_eq, NULL);
+ ref_strings = htab_create_ggc (32, str_ref_hash, str_ref_eq, NULL);
+ labels_map = htab_create_ggc (32, label_addr_hash, label_addr_eq, NULL);
+ ref_pinvokes = htab_create_ggc (32, pinvoke_hash, pinvoke_eq, NULL);
+ }
}
/* Tears down the database of referenced entities. */
@@ -855,6 +858,13 @@ referenced_strings_htab ( void )
* Functions *
******************************************************************************/
+static void
+init_pinvokes ( void )
+{
+ if (ref_pinvokes == NULL)
+ ref_pinvokes = htab_create_ggc (32, pinvoke_hash, pinvoke_eq, NULL);
+}
+
/* Hash function for pinvokes */
static hashval_t
@@ -885,6 +895,8 @@ add_pinvoke (tree t)
gcc_assert (TREE_CODE (t) == FUNCTION_DECL);
+ refs_init ();
+
slot = htab_find_slot (ref_pinvokes, t, INSERT);
if (*slot == NULL)
diff --git a/gcc/config/cil32/emit-cil.c b/gcc/config/cil32/emit-cil.c
index 12d26470eca..618bea4c951 100644
--- a/gcc/config/cil32/emit-cil.c
+++ b/gcc/config/cil32/emit-cil.c
@@ -80,12 +80,6 @@ DEF_VEC_O(var_uses_s);
DEF_VEC_ALLOC_O(var_uses_s, heap);
/******************************************************************************
- * Globals *
- ******************************************************************************/
-
-static bool init = false;
-
-/******************************************************************************
* Local function prototypes *
******************************************************************************/
@@ -148,8 +142,6 @@ emit_cil_init (void)
{
FILE *file = asm_out_file;
- gcc_assert (!init);
-
if (TARGET_GCC4NET_LINKER)
{
fputs (".assembly extern mscorlib {}\n"
@@ -170,15 +162,11 @@ emit_cil_init (void)
"void ['OpenSystem.C']'OpenSystem.C'.ModuleAttribute::.ctor() "
"= (01 00 00 00)\n", file);
}
-
- init = true;
}
void
emit_cil_fini (void)
{
- gcc_assert (init);
-
create_init_method ();
emit_referenced_strings ();
emit_referenced_types ();
@@ -188,6 +176,11 @@ emit_cil_fini (void)
void
emit_cil_decl (FILE *file, tree decl)
{
+ if (flag_syntax_only)
+ return;
+
+ refs_init ();
+
if (TREE_CODE (decl) == VAR_DECL
&& (TREE_STATIC (decl) || TREE_PUBLIC (decl)))
{
@@ -2436,7 +2429,7 @@ emit_cil_1 (FILE *file)
static bool
emit_cil_gate (void)
{
- return current_function_decl != NULL;
+ return (current_function_decl != NULL) && !flag_syntax_only;
}
/* Entry point of the CIL assembly emission pass. */
@@ -2542,7 +2535,9 @@ emit_vcg_fini (void)
static bool
emit_cil_vcg_gate (void)
{
- return TARGET_EMIT_VCG && current_function_decl != NULL;
+ return TARGET_EMIT_VCG
+ && (current_function_decl != NULL)
+ && !flag_syntax_only;
}
static unsigned int
diff --git a/gcc/config/cil32/gimple-to-cil.c b/gcc/config/cil32/gimple-to-cil.c
index 7b05aa853d6..3e2e828de56 100644
--- a/gcc/config/cil32/gimple-to-cil.c
+++ b/gcc/config/cil32/gimple-to-cil.c
@@ -3362,6 +3362,7 @@ gimple_to_cil (void)
tree node = NULL_TREE;
/* Initialization */
+ refs_init ();
res_var = NULL_TREE;
/* Preprocessing */