aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2011-01-14 03:27:32 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-01-14 03:27:32 +0000
commit3dac68b99e0aa1503c2743f70e67a84401002a45 (patch)
tree01bf0d7874de7304a90a873d92d8904544ec31c7 /gcc
parent632469d01e0652c465f9074d2ec7f5de1cb7dac9 (diff)
downloadgcc-3dac68b99e0aa1503c2743f70e67a84401002a45.zip
gcc-3dac68b99e0aa1503c2743f70e67a84401002a45.tar.gz
gcc-3dac68b99e0aa1503c2743f70e67a84401002a45.tar.bz2
Move clearing of flag_strict_aliasing to gcc interface.
From-SVN: r168774
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/ChangeLog9
-rw-r--r--gcc/go/Make-lang.in9
-rw-r--r--gcc/go/go-backend.c25
-rw-r--r--gcc/go/go-c.h4
-rw-r--r--gcc/go/gofrontend/gogo-tree.cc12
-rw-r--r--gcc/go/gofrontend/unsafe.cc7
6 files changed, 46 insertions, 20 deletions
diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog
index d25a523..6354ce5 100644
--- a/gcc/go/ChangeLog
+++ b/gcc/go/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-13 Ian Lance Taylor <iant@google.com>
+
+ * go-backend.c: Include "rtl.h" and "target.h".
+ (go_imported_unsafe): New function.
+ * go-c.h (go_imported_unsafe): Declare.
+ * Make-lang.in (go/go-backend.o): Depend on $(RTL_H).
+ (go/gogo-tree.o): Remove dependency on $(RTL_H).
+ (go/unsafe.o): Depend on $(GO_C_H).
+
2010-12-31 Joern Rennecke <amylaar@spamcop.net>
PR go/47113
diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in
index 48799f4..a8c3aa6 100644
--- a/gcc/go/Make-lang.in
+++ b/gcc/go/Make-lang.in
@@ -1,6 +1,6 @@
# Make-lang.in -- Top level -*- makefile -*- fragment for gcc Go frontend.
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
# This file is part of GCC.
@@ -221,7 +221,7 @@ GO_EXPRESSIONS_H = go/gofrontend/expressions.h go/gofrontend/operator.h
GO_IMPORT_H = go/gofrontend/import.h go/gofrontend/export.h
go/go-backend.o: go/go-backend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
- $(TREE_H) $(TM_H) $(TM_P_H)
+ $(TM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(TARGET_H)
go/go-lang.o: go/go-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(OPTS_H) \
$(TREE_H) $(GIMPLE_H) $(GGC_H) $(TOPLEV_H) debug.h options.h \
@@ -254,7 +254,7 @@ go/go-dump.o: go/gofrontend/go-dump.cc $(GO_SYSTEM_H) $(GO_C_H) \
go/gofrontend/go-dump.h
go/gogo-tree.o: go/gofrontend/gogo-tree.cc $(GO_SYSTEM_H) $(TOPLEV_H) \
$(TREE_H) $(GIMPLE_H) tree-iterator.h $(CGRAPH_H) langhooks.h \
- convert.h output.h $(DIAGNOSTIC_H) $(RTL_H) $(GO_TYPES_H) \
+ convert.h output.h $(DIAGNOSTIC_H) $(GO_TYPES_H) \
$(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) $(GO_GOGO_H)
go/gogo.o: go/gofrontend/gogo.cc $(GO_SYSTEM_H) $(GO_C_H) \
go/gofrontend/go-dump.h $(GO_LEX_H) $(GO_TYPES_H) $(GO_STATEMENTS_H) \
@@ -277,4 +277,5 @@ go/types.o: go/gofrontend/types.cc $(GO_SYSTEM_H) $(TOPLEV_H) intl.h $(TREE_H) \
$(GIMPLE_H) $(REAL_H) convert.h $(GO_C_H) $(GO_GOGO_H) \
go/gofrontend/operator.h $(GO_EXPRESSIONS_H) $(GO_STATEMENTS_H) \
go/gofrontend/export.h $(GO_IMPORT_H) $(GO_TYPES_H)
-go/unsafe.o: go/gofrontend/unsafe.cc $(GO_SYSTEM_H) $(GO_TYPES_H) $(GO_GOGO_H)
+go/unsafe.o: go/gofrontend/unsafe.cc $(GO_SYSTEM_H) $(GO_C_H) $(GO_TYPES_H) \
+ $(GO_GOGO_H)
diff --git a/gcc/go/go-backend.c b/gcc/go/go-backend.c
index 9ffe38a..5ecc99b 100644
--- a/gcc/go/go-backend.c
+++ b/gcc/go/go-backend.c
@@ -1,5 +1,5 @@
/* go-backend.c -- Go frontend interface to gcc backend.
- Copyright (C) 2010 Free Software Foundation, Inc.
+ Copyright (C) 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -20,9 +20,11 @@ along with GCC; see the file COPYING3. If not see
#include "config.h"
#include "system.h"
#include "coretypes.h"
-#include "tree.h"
#include "tm.h"
+#include "rtl.h"
+#include "tree.h"
#include "tm_p.h"
+#include "target.h"
#include "go-c.h"
@@ -70,3 +72,22 @@ go_trampoline_info (unsigned int *size, unsigned int *alignment)
*size = TRAMPOLINE_SIZE;
*alignment = TRAMPOLINE_ALIGNMENT;
}
+
+/* This is called by the Go frontend proper if the unsafe package was
+ imported. When that happens we can not do type-based alias
+ analysis. */
+
+void
+go_imported_unsafe (void)
+{
+ flag_strict_aliasing = false;
+
+ /* This is a real hack. init_varasm_once has already grabbed an
+ alias set, which we don't want when we aren't doing strict
+ aliasing. We reinitialize to make it do it again. This should
+ be OK in practice since we haven't really done anything yet. */
+ init_varasm_once ();
+
+ /* Let the backend know that the options have changed. */
+ targetm.override_options_after_change ();
+}
diff --git a/gcc/go/go-c.h b/gcc/go/go-c.h
index 19d5c05..a451517 100644
--- a/gcc/go/go-c.h
+++ b/gcc/go/go-c.h
@@ -1,5 +1,5 @@
/* go-c.h -- Header file for go frontend gcc C interface.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -65,6 +65,8 @@ extern unsigned int go_field_alignment (tree);
extern void go_trampoline_info (unsigned int *size, unsigned int *alignment);
+extern void go_imported_unsafe (void);
+
#if defined(__cplusplus) && !defined(ENABLE_BUILD_WITH_CXX)
} /* End extern "C". */
#endif
diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc
index bcb2519..ccd17c6 100644
--- a/gcc/go/gofrontend/gogo-tree.cc
+++ b/gcc/go/gofrontend/gogo-tree.cc
@@ -22,7 +22,6 @@ extern "C"
#include "convert.h"
#include "output.h"
#include "diagnostic.h"
-#include "rtl.h"
#ifndef ENABLE_BUILD_WITH_CXX
}
@@ -810,17 +809,6 @@ Gogo::write_globals()
// Pass everything back to the middle-end.
- if (this->imported_unsafe_)
- {
- // Importing the "unsafe" package automatically disables TBAA.
- flag_strict_aliasing = false;
-
- // This is a real hack. init_varasm_once has already grabbed an
- // alias set, which we don't want when we aren't going strict
- // aliasing. We reinitialize to make it do it again. FIXME.
- init_varasm_once();
- }
-
wrapup_global_declarations(vec, count);
cgraph_finalize_compilation_unit();
diff --git a/gcc/go/gofrontend/unsafe.cc b/gcc/go/gofrontend/unsafe.cc
index 51d812b..e219f61 100644
--- a/gcc/go/gofrontend/unsafe.cc
+++ b/gcc/go/gofrontend/unsafe.cc
@@ -6,6 +6,7 @@
#include "go-system.h"
+#include "go-c.h"
#include "types.h"
#include "gogo.h"
@@ -130,5 +131,9 @@ Gogo::import_unsafe(const std::string& local_name, bool is_local_name_exported,
if (add_to_globals)
this->add_named_object(no);
- this->imported_unsafe_ = true;
+ if (!this->imported_unsafe_)
+ {
+ go_imported_unsafe();
+ this->imported_unsafe_ = true;
+ }
}