regmove bugfix installed

Jeffrey A Law law@cygnus.com
Wed Oct 14 21:18:00 GMT 1998


I installed the attached patch.  It prevents the compiler from aborting if
it tries to change a the address expression in a volatile memory reference
(ie, it would fail if we changed the address from using reg X to reg Y).


------- Forwarded Message

From:     Joern Rennecke <amylaar@cygnus.co.uk>
To:       law@cygnus.com
cc:       amylaar@cygnus.co.uk
Date:     Wed, 14 Oct 1998 22:01:18 +0100 (BST)
Subject:  Re: optimize_related_values bug

> So it sounds like we want to add an init_recog call to the top of regmove
> then init_recog_novolatile as we exit regmove, then tweak optimize_reg_copy_3
> Right?

Jim suggested to call init_recog at the end of combine:

Wed Oct 14 21:57:08 1998  J"orn Rennecke <amylaar@cygnus.co.uk>

	* combine.c (combine_instructions): When finished, call init_recog.
	* regmove.c (optimize_reg_copy_3): Reject volatile MEMs.

Index: combine.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/combine.c,v
retrieving revision 1.188
diff -p -r1.188 combine.c
*** combine.c	1998/10/09 23:02:28	1.188
--- combine.c	1998/10/14 20:58:28
*************** combine_instructions (f, nregs)
*** 674,679 ****
--- 674,682 ----
    total_successes += combine_successes;
  
    nonzero_sign_valid = 0;
+ 
+   /* Make recognizer allow volatile MEMs again.  */
+   init_recog ();
  }
  
  /* Wipe the reg_last_xxx arrays in preparation for another pass.  */
Index: regmove.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/regmove.c,v
retrieving revision 1.55
diff -p -r1.55 regmove.c
*** regmove.c	1998/10/10 23:05:10	1.55
--- regmove.c	1998/10/14 20:58:29
*************** optimize_reg_copy_3 (insn, dest, src)
*** 2022,2027 ****
--- 2053,2063 ----
    if (! (set = single_set (p))
        || GET_CODE (SET_SRC (set)) != MEM
        || SET_DEST (set) != src_reg)
+     return;
+ 
+   /* Be conserative: although this optimization is also valid for
+      volatile memory references, that could cause trouble in later passes.  */
+   if (MEM_VOLATILE_P (SET_SRC (set)))
      return;
  
    /* Do not use a SUBREG to truncate from one mode to another if truncation

------- End of Forwarded Message




More information about the Gcc-patches mailing list