Enable this in CS for PowerPC; disable it for all other machines. PowerPC has no remainder instruction; the back end uses division to compute remainder. If CS finds both a / b and a % b, then CS now rewrites a % b as a - b * (a / b) and computes a / b only once. This removes an extra division in the PowerPC code, so it saves both time and space. I have not considered whether to enable this optimization for other machines. It might be less useful in machines with a remainder instruction. Also, if a % b occurs before a / b, the EM code gets a DUP. PowerPC ncg handles this DUP well; other back ends might not.
		
			
				
	
	
		
			26 lines
		
	
	
	
		
			736 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
	
		
			736 B
		
	
	
	
		
			C
		
	
	
	
	
	
| /* $Id$ */
 | |
| /*
 | |
|  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
 | |
|  * See the copyright notice in the ACK home directory, in the file "Copyright".
 | |
|  */
 | |
| void cs_machinit(void *vp);	/* (FILE *f)
 | |
| 				 * Read phase-specific information from f.
 | |
| 				 */
 | |
| 
 | |
| bool may_become_aar(avail_p avp);
 | |
| 				/*
 | |
| 				 * Return whether a LAR/SAR may become
 | |
| 				 * an AAR LOI/STI.
 | |
| 				 */
 | |
| 
 | |
| bool may_become_dv(void);	/*
 | |
| 				 * Return whether an RMI/RMU may become
 | |
| 				 * a DVI/DVU: a % b = a - (a / b * b).
 | |
| 				 */
 | |
| 
 | |
| bool desirable(avail_p avp);	/*
 | |
| 				 * Return whether it is desirable to eliminate
 | |
| 				 * the recurrences of the expression in avp.
 | |
| 				 * At the same time delete the recurrences
 | |
| 				 * for which it is not allowed.
 | |
| 				 */
 |