summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrts <rts@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-18 14:32:19 +0000
committerrts <rts@138bc75d-0d04-0410-961f-82ee72b054a4>2015-05-18 14:32:19 +0000
commitc4d690638373344b37eea1360d1555f247d8e2ef (patch)
tree5ad0f52e91ee9d4b7f00693f325152c97ccdc41c
parentbf4fc9191fbcad6d7b2dd4fbe04b4d176f04e3d9 (diff)
downloadgcc-c4d690638373344b37eea1360d1555f247d8e2ef.tar.gz
Fix ICE when both micromips and nomicromips attributes are used.
gcc/ChangeLog: 2015-05-18 Robert Suchanek <robert.suchanek@imgtec.com> * config/mips/mips.c (micromips_globals): New variable. (mips_set_compression_mode): Save and reinitialize target-dependent state for microMIPS. gcc/testsuite/ChangeLog: 2015-05-18 Robert Suchanek <robert.suchanek@imgtec.com> * gcc.target/mips/umips-attr.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223294 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/mips/mips.c10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/mips/umips-attr.c13
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bebe44c5257..27b4d266d20 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-05-18 Robert Suchanek <robert.suchanek@imgtec.com>
+
+ * config/mips/mips.c (micromips_globals): New variable.
+ (mips_set_compression_mode): Save and reinitialize target-dependent
+ state for microMIPS.
+
2015-05-18 Martin Liska <mliska@suse.cz>
* dbgcnt.def: Add new counter.
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 8c66cbd89c8..e619baadae8 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -676,6 +676,9 @@ const char *mips_hi_relocs[NUM_SYMBOL_TYPES];
/* Target state for MIPS16. */
struct target_globals *mips16_globals;
+/* Target state for MICROMIPS. */
+struct target_globals *micromips_globals;
+
/* Cached value of can_issue_more. This is cached in mips_variable_issue hook
and returned from mips_sched_reorder2. */
static int cached_can_issue_more;
@@ -17162,6 +17165,13 @@ mips_set_compression_mode (unsigned int compression_mode)
else
restore_target_globals (mips16_globals);
}
+ else if (compression_mode & MASK_MICROMIPS)
+ {
+ if (!micromips_globals)
+ micromips_globals = save_target_globals_default_opts ();
+ else
+ restore_target_globals (micromips_globals);
+ }
else
restore_target_globals (&default_target_globals);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 985478e6b44..5206d883a15 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-05-18 Robert Suchanek <robert.suchanek@imgtec.com>
+
+ * gcc.target/mips/umips-attr.c: New test.
+
2015-05-17 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/20150120-1.c (dg-final): Cleanup original tree dump.
diff --git a/gcc/testsuite/gcc.target/mips/umips-attr.c b/gcc/testsuite/gcc.target/mips/umips-attr.c
new file mode 100644
index 00000000000..f8c4517c560
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/umips-attr.c
@@ -0,0 +1,13 @@
+/* { dg-options "(-mmicromips)" } */
+
+int MICROMIPS
+foo (int a)
+{
+ return a;
+}
+
+int NOMICROMIPS
+foo2 (int a)
+{
+ return a;
+}