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.
		
			
				
	
	
		
			110 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
	
		
			2 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
wordsize: 4
 | 
						|
pointersize: 4
 | 
						|
%%RA
 | 
						|
general registers: 5
 | 
						|
address registers: 4
 | 
						|
floating point registers: 0
 | 
						|
use general as pointer: no
 | 
						|
 | 
						|
register score parameters:
 | 
						|
	local variable:
 | 
						|
		(2 cases)
 | 
						|
		pointer,pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(6,4)
 | 
						|
		general,general
 | 
						|
			(1 size)
 | 
						|
			default ->	(1,2)
 | 
						|
	address of local variable:
 | 
						|
		(2 cases)
 | 
						|
		pointer,pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(0,0)
 | 
						|
		general,pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(2,2)
 | 
						|
	constant:
 | 
						|
		(3 sizes)
 | 
						|
		in_0_8 ->	(0,0)
 | 
						|
		fitbyte ->	(2,2)
 | 
						|
		default ->	(4,4)
 | 
						|
	double constant:
 | 
						|
		(1 size)
 | 
						|
		default ->	(-1,-1)
 | 
						|
	address of global variable:
 | 
						|
		(1 size)
 | 
						|
		default ->	(1,4)
 | 
						|
	address of procedure:
 | 
						|
		(1 size)
 | 
						|
		default ->	(1,4)
 | 
						|
 | 
						|
opening cost parameters:
 | 
						|
	local variable:
 | 
						|
		(2 cases)
 | 
						|
		pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(6,4)
 | 
						|
		general
 | 
						|
			(1 size)
 | 
						|
			default ->	(6,4)
 | 
						|
	address of local variable:
 | 
						|
		(2 cases)
 | 
						|
		pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(4,4)
 | 
						|
		general
 | 
						|
			(1 size)
 | 
						|
			general ->	(4,4)
 | 
						|
	constant:
 | 
						|
		(2 sizes)
 | 
						|
		fitbyte ->	(4,2)
 | 
						|
		default ->	(6,6)
 | 
						|
	double constant:
 | 
						|
		(1 size)
 | 
						|
		default ->	(1000,1000)
 | 
						|
	address of global variable:
 | 
						|
		(1 size)
 | 
						|
		default ->	(6,6)
 | 
						|
	address of procedure:
 | 
						|
		(1 size)
 | 
						|
		default ->	(6,6)
 | 
						|
 | 
						|
register save costs:
 | 
						|
	(11 cases)
 | 
						|
	0 -> (0,0)
 | 
						|
	1 -> (12,6)
 | 
						|
	2 -> (24,10)
 | 
						|
	3 -> (34,10)
 | 
						|
	4 -> (42,10)
 | 
						|
	5 -> (50,10)
 | 
						|
	6 -> (58,10)
 | 
						|
	7 -> (66,10)
 | 
						|
	8 -> (84,10)
 | 
						|
	9 -> (92,10)
 | 
						|
	0 -> (0,0)
 | 
						|
%%UD
 | 
						|
access costs of global variables:
 | 
						|
	(1 size)
 | 
						|
	default ->	(7,4)
 | 
						|
access costs of local variables:
 | 
						|
	(1 size)
 | 
						|
	default ->	(4,2)
 | 
						|
%%SR
 | 
						|
overflow harmful?:  no
 | 
						|
array bound harmful?:  no
 | 
						|
reduce sli if shift count larger than:  0
 | 
						|
%%CS
 | 
						|
#include "em_mnem.h"
 | 
						|
first time then space:
 | 
						|
addressing modes: op_adp op_lof op_ldf op_loi op_dch op_lpb -1
 | 
						|
		  op_adp op_lof op_ldf op_loi op_dch op_lpb -1
 | 
						|
cheap operations: op_ciu op_cui op_cuu op_cmi op_cmu op_cmp -1
 | 
						|
		  op_ciu op_cui op_cuu op_cmi op_cmu op_cmp -1
 | 
						|
lexical tresholds: 1 1
 | 
						|
indirection limit: 8
 | 
						|
convert remainder to division?: no no
 | 
						|
do not eliminate sli if index on shiftcounts:	-1
 | 
						|
						-1
 | 
						|
forbidden operators: -1 -1
 | 
						|
%%SP
 | 
						|
global stack pollution allowed?: yes
 |