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.
		
			
				
	
	
		
			149 lines
		
	
	
	
		
			2.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			149 lines
		
	
	
	
		
			2.7 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
wordsize: 4
 | 
						|
pointersize: 4
 | 
						|
%%RA
 | 
						|
general registers: 19
 | 
						|
address registers: 0
 | 
						|
floating point registers: 18
 | 
						|
use general as pointer: yes
 | 
						|
 | 
						|
register score parameters:
 | 
						|
	local variable:
 | 
						|
		(3 cases)
 | 
						|
		pointer,general
 | 
						|
			(1 size)
 | 
						|
			default ->	(3,4)
 | 
						|
		general,general
 | 
						|
			(1 size)
 | 
						|
			default ->	(3,4)
 | 
						|
		float,float
 | 
						|
			(1 size)
 | 
						|
			default ->	(5,4)
 | 
						|
	address of local variable:
 | 
						|
		(3 cases)
 | 
						|
		pointer,general
 | 
						|
			(1 size)
 | 
						|
			default ->	(0,0)
 | 
						|
		general,general
 | 
						|
			(1 size)
 | 
						|
			default ->	(0,0)
 | 
						|
		float,float
 | 
						|
			(1 size)
 | 
						|
			default ->	(0,0)
 | 
						|
	constant:
 | 
						|
		(2 sizes)
 | 
						|
		fitbyte ->	(-1,-1)
 | 
						|
		default ->	(-1,-1)
 | 
						|
	double constant:
 | 
						|
		(1 size)
 | 
						|
		default ->	(-1,-1)
 | 
						|
	address of global variable:
 | 
						|
		(1 size)
 | 
						|
		default ->	(2,8)
 | 
						|
	address of procedure:
 | 
						|
		(1 size)
 | 
						|
		default ->	(-1,-1)
 | 
						|
 | 
						|
opening cost parameters:
 | 
						|
	local variable:
 | 
						|
		(3 cases)
 | 
						|
		pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(3,4)
 | 
						|
		general
 | 
						|
			(1 size)
 | 
						|
			default ->	(3,4)
 | 
						|
		float
 | 
						|
			(1 size)
 | 
						|
			default ->	(5,4)
 | 
						|
	address of local variable:
 | 
						|
		(3 cases)
 | 
						|
		pointer
 | 
						|
			(1 size)
 | 
						|
			default ->	(1,4)
 | 
						|
		general
 | 
						|
			(1 size)
 | 
						|
			default ->	(1,4)
 | 
						|
		float
 | 
						|
			(1 size)
 | 
						|
			default ->	(1,4)
 | 
						|
	constant:
 | 
						|
		(2 sizes)
 | 
						|
		fitbyte ->	(1000,1000)
 | 
						|
		default ->	(1000,1000)
 | 
						|
	double constant:
 | 
						|
		(1 size)
 | 
						|
		default ->	(1000,1000)
 | 
						|
	address of global variable:
 | 
						|
		(1 size)
 | 
						|
		default ->	(2,8)
 | 
						|
	address of procedure:
 | 
						|
		(1 size)
 | 
						|
		default ->	(1000,1000)
 | 
						|
 | 
						|
register save costs:
 | 
						|
	(39 cases)
 | 
						|
	0 -> (0,0)
 | 
						|
	1 -> (6,8)
 | 
						|
	2 -> (12,16)
 | 
						|
	3 -> (18,24)
 | 
						|
	4 -> (24,32)
 | 
						|
	5 -> (30,40)
 | 
						|
	6 -> (36,48)
 | 
						|
	7 -> (42,56)
 | 
						|
	8 -> (48,64)
 | 
						|
	9 -> (54,72)
 | 
						|
	10 -> (60,80)
 | 
						|
	11 -> (66,88)
 | 
						|
	12 -> (72,96)
 | 
						|
	13 -> (78,104)
 | 
						|
	14 -> (84,112)
 | 
						|
	15 -> (90,120)
 | 
						|
	16 -> (96,128)
 | 
						|
	17 -> (102,136)
 | 
						|
	18 -> (108,144)
 | 
						|
	19 -> (114,152)
 | 
						|
	20 -> (120,160)
 | 
						|
	21 -> (126,168)
 | 
						|
	22 -> (132,176)
 | 
						|
	23 -> (138,184)
 | 
						|
	24 -> (144,192)
 | 
						|
	25 -> (150,200)
 | 
						|
	26 -> (156,208)
 | 
						|
	27 -> (162,216)
 | 
						|
	28 -> (168,224)
 | 
						|
	29 -> (174,232)
 | 
						|
	30 -> (180,240)
 | 
						|
	31 -> (186,248)
 | 
						|
	32 -> (192,256)
 | 
						|
	33 -> (198,264)
 | 
						|
	34 -> (204,272)
 | 
						|
	35 -> (210,280)
 | 
						|
	36 -> (216,288)
 | 
						|
	37 -> (222,296)
 | 
						|
	0 -> (0,0)
 | 
						|
%%UD
 | 
						|
access costs of global variables:
 | 
						|
	(1 size)
 | 
						|
	default ->	(5,12)
 | 
						|
access costs of local variables:
 | 
						|
	(1 size)
 | 
						|
	default ->	(3,4)
 | 
						|
%%SR
 | 
						|
overflow harmful?:  no
 | 
						|
array bound harmful?:  yes
 | 
						|
reduce sli if shift count larger than:  0
 | 
						|
%%CS
 | 
						|
#include "em_mnem.h"
 | 
						|
first time then space:
 | 
						|
addressing modes: op_ads op_adp op_lof op_ldf op_loi op_dch op_lpb -1
 | 
						|
		  op_ads op_adp op_lof op_ldf op_loi op_dch op_lpb -1
 | 
						|
cheap operations: op_cii op_ciu op_cui op_cuu op_cmi op_cmu op_cmp -1
 | 
						|
		  op_cii op_ciu op_cui op_cuu op_cmi op_cmu op_cmp -1
 | 
						|
lexical tresholds: 1 1
 | 
						|
indirection limit: 8
 | 
						|
convert remainder to division?: yes yes
 | 
						|
do not eliminate sli if index on shiftcounts:	-1
 | 
						|
						-1
 | 
						|
forbidden operators: -1 -1
 | 
						|
%%SP
 | 
						|
global stack pollution allowed?: yes
 |