added m68k2 stuff, added patterns
This commit is contained in:
		
							parent
							
								
									0f2f6da38f
								
							
						
					
					
						commit
						b4a2b975a0
					
				
					 18 changed files with 12888 additions and 5470 deletions
				
			
		|  | @ -4,5 +4,6 @@ mach.c | ||||||
| mach.h | mach.h | ||||||
| table | table | ||||||
| whichone.h | whichone.h | ||||||
|  | instrmacs.h | ||||||
| tables1.c | tables1.c | ||||||
| tables1.h | tables1.h | ||||||
|  |  | ||||||
							
								
								
									
										144
									
								
								mach/m68020/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								mach/m68020/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,144 @@ | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define LLP ldl | ||||||
|  | #define LEP lde | ||||||
|  | #define LFP ldf		/* load offsetted pointer */ | ||||||
|  | #define SLP sdl | ||||||
|  | #define SEP sde | ||||||
|  | #define SFP sdf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off2 | ||||||
|  | #define ABS_indoff_int	ABS_indoff2 | ||||||
|  | #define ABSIND_off_int	ABSIND_off2 | ||||||
|  | #define INDOFF_off_int	INDOFF_off2 | ||||||
|  | #define OFF_off_int	OFF_off2 | ||||||
|  | #define OFF_indoff_int	OFF_indoff2 | ||||||
|  | #define abs_index_int	abs_index2 | ||||||
|  | #define absolute_int	absolute2 | ||||||
|  | #define any_int		any2 | ||||||
|  | #define conreg_int	conreg2 | ||||||
|  | #define data_int	data2 | ||||||
|  | #define datalt_int	datalt2 | ||||||
|  | #define dreg_int	dreg2 | ||||||
|  | #define imm_cmp_int	imm_cmp2 | ||||||
|  | #define immediate_int	immediate2 | ||||||
|  | #define indirect_int	indirect2 | ||||||
|  | #define index_off_int	index_off2 | ||||||
|  | #define offsetted_int	offsetted2 | ||||||
|  | #define post_inc_int	post_inc2 | ||||||
|  | #define pre_dec_int	pre_dec2 | ||||||
|  | #define store_int	any2 | ||||||
|  | #define test_set_int	test_set2 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_w | ||||||
|  | #define ADD_I	"add.w" | ||||||
|  | #define and_i	and_w | ||||||
|  | #define AND_I	"and.w" | ||||||
|  | #define asl_i	asl_w | ||||||
|  | #define ASL_I	"asl.w" | ||||||
|  | #define asr_i	asr_w | ||||||
|  | #define ASR_I	"asr.w" | ||||||
|  | #define clr_i	clr_w | ||||||
|  | #define CLR_I	"clr.w" | ||||||
|  | #define cmp_i	cmp_w | ||||||
|  | #define cmp2_i	cmp2_w | ||||||
|  | #define DEC	"sub.w #1," | ||||||
|  | #define DIVS_I	"divs.w" | ||||||
|  | #define DIVU_I	"divu.w" | ||||||
|  | #define eor_i	eor_w | ||||||
|  | #define EOR_I	"eor.w" | ||||||
|  | #define INC	"add.w #1," | ||||||
|  | #define lsr_i	lsr_w | ||||||
|  | #define LSR_I	"lsr.w" | ||||||
|  | #define move_i	move_w | ||||||
|  | #define MOVE_I	"move.w" | ||||||
|  | #define muls_i	muls_w | ||||||
|  | #define MULS_I	"muls.w" | ||||||
|  | #define mulu_i	mulu_w | ||||||
|  | #define MULU_I	"mulu.w" | ||||||
|  | #define neg_i	neg_w | ||||||
|  | #define NEG_I	"neg.w" | ||||||
|  | #define not_i	not_w | ||||||
|  | #define NOT_I	"not.w" | ||||||
|  | #define or_i	or_w | ||||||
|  | #define OR_I	"or.w" | ||||||
|  | #define rol_i	rol_w | ||||||
|  | #define ROL_I	"rol.w" | ||||||
|  | #define ror_i	ror_w | ||||||
|  | #define ROR_I	"ror.w" | ||||||
|  | #define sub_i	sub_w | ||||||
|  | #define SUB_I	"sub.w" | ||||||
|  | #define tst_i	tst_w | ||||||
|  | 
 | ||||||
|  | #else | ||||||
|  | 
 | ||||||
|  | #define LLP lol | ||||||
|  | #define LEP loe | ||||||
|  | #define LFP lof		/* load offsetted pointer */ | ||||||
|  | #define SLP stl | ||||||
|  | #define SEP ste | ||||||
|  | #define SFP stf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off4 | ||||||
|  | #define ABS_indoff_int	ABS_indoff4 | ||||||
|  | #define ABSIND_off_int	ABSIND_off4 | ||||||
|  | #define INDOFF_off_int	INDOFF_off4 | ||||||
|  | #define OFF_off_int	OFF_off4 | ||||||
|  | #define OFF_indoff_int	OFF_indoff4 | ||||||
|  | #define abs_index_int	abs_index4 | ||||||
|  | #define absolute_int	absolute4 | ||||||
|  | #define any_int		any4 | ||||||
|  | #define conreg_int	conreg4 | ||||||
|  | #define data_int	data4 | ||||||
|  | #define datalt_int	datalt4 | ||||||
|  | #define dreg_int	dreg4 | ||||||
|  | #define imm_cmp_int	imm_cmp4 | ||||||
|  | #define immediate_int	immediate4 | ||||||
|  | #define indirect_int	indirect4 | ||||||
|  | #define index_off_int	index_off4 | ||||||
|  | #define offsetted_int	offsetted4 | ||||||
|  | #define post_inc_int	post_inc4 | ||||||
|  | #define pre_dec_int	pre_dec4 | ||||||
|  | #define store_int	store4 | ||||||
|  | #define test_set_int	test_set4 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_l | ||||||
|  | #define ADD_I	"add.l" | ||||||
|  | #define and_i	and_l | ||||||
|  | #define AND_I	"and.l" | ||||||
|  | #define asl_i	asl_l | ||||||
|  | #define ASL_I	"asl.l" | ||||||
|  | #define asr_i	asr_l | ||||||
|  | #define ASR_I	"asr.l" | ||||||
|  | #define clr_i	clr_l | ||||||
|  | #define CLR_I	"clr.l" | ||||||
|  | #define cmp_i	cmp_l | ||||||
|  | #define cmp2_i	cmp2_l | ||||||
|  | #define DEC	"sub.l #1," | ||||||
|  | #define DIVS_I	"divs.l" | ||||||
|  | #define DIVU_I	"divu.l" | ||||||
|  | #define eor_i	eor_l | ||||||
|  | #define EOR_I	"eor.l" | ||||||
|  | #define INC	"add.l #1," | ||||||
|  | #define lsr_i	lsr_l | ||||||
|  | #define LSR_I	"lsr.l" | ||||||
|  | #define move_i	move_l | ||||||
|  | #define MOVE_I	"move.l" | ||||||
|  | #define muls_i	muls_l | ||||||
|  | #define MULS_I	"muls.l" | ||||||
|  | #define mulu_i	mulu_l | ||||||
|  | #define MULU_I	"mulu.l" | ||||||
|  | #define neg_i	neg_l | ||||||
|  | #define NEG_I	"neg.l" | ||||||
|  | #define not_i	not_l | ||||||
|  | #define NOT_I	"not.l" | ||||||
|  | #define or_i	or_l | ||||||
|  | #define OR_I	"or.l" | ||||||
|  | #define rol_i	rol_l | ||||||
|  | #define ROL_I	"rol.l" | ||||||
|  | #define ror_i	ror_l | ||||||
|  | #define ROR_I	"ror.l" | ||||||
|  | #define sub_i	sub_l | ||||||
|  | #define SUB_I	"sub.l" | ||||||
|  | #define tst_i	tst_l | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -10,24 +10,29 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "whichone.h" | #include "whichone.h" | ||||||
|  | #include <stb.h> | ||||||
| 
 | 
 | ||||||
| con_part(sz,w) register sz; word w; { | con_part(sz,w) register sz; word w; { | ||||||
| 
 | 
 | ||||||
| 	while (part_size % sz) | 	while (part_size % sz) | ||||||
| 		part_size++; | 		part_size++; | ||||||
| 	if (part_size == 4) | 	if (part_size == TEM_WSIZE) | ||||||
| 		part_flush(); | 		part_flush(); | ||||||
| 	if (sz == 1) { | 	if (sz == 1) { | ||||||
| 		w &= 0xFF; | 		w &= 0xFF; | ||||||
|  | #if WORD_SIZE==4 | ||||||
| 		w <<= 8*(3-part_size); | 		w <<= 8*(3-part_size); | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else if (sz == 2) { | 	} else if (sz == 2) { | ||||||
| 		w &= 0xFFFF; | 		w &= 0xFFFF; | ||||||
| 		if (part_size == 0) | #endif | ||||||
| 			w <<= 16; | 		if (part_size == 0) { | ||||||
|  | 			/* Shift 8 for m68k2, 16 otherwise */ | ||||||
|  | 			w <<= 4 * TEM_WSIZE; | ||||||
|  | 		} | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else { | 	} else { | ||||||
| 		assert(sz == 4); | 		assert(sz == TEM_WSIZE); | ||||||
| 		part_word = w; | 		part_word = w; | ||||||
| 	} | 	} | ||||||
| 	part_size += sz; | 	part_size += sz; | ||||||
|  | @ -62,7 +67,7 @@ regscore(off,size,typ,score,totyp) | ||||||
| 			score += 5; | 			score += 5; | ||||||
| 			/* fall through .. */ | 			/* fall through .. */ | ||||||
| 		case reg_any: | 		case reg_any: | ||||||
| 			if (size != 4 || totyp == reg_pointer) return -1; | 			if (size != TEM_WSIZE || totyp == reg_pointer) return -1; | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 	if (off >= 0) { | 	if (off >= 0) { | ||||||
|  | @ -176,7 +181,7 @@ prolog(n) full n; { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| mes(type) word type ; { | mes(type) word type ; { | ||||||
| 	int argt ; | 	int argt, a1, a2 ; | ||||||
| 
 | 
 | ||||||
| 	switch ( (int)type ) { | 	switch ( (int)type ) { | ||||||
| 	case ms_ext : | 	case ms_ext : | ||||||
|  | @ -191,6 +196,41 @@ mes(type) word type ; { | ||||||
| 				break ; | 				break ; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	case ms_stb: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			fputs(".symb \"\", ", codefile); | ||||||
|  | 		else { | ||||||
|  | 			fprintf(codefile, ".symb \"%s\", ", str); | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		a1 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		a2 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp); | ||||||
|  | 		fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
|  | 	case ms_std: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			str[0] = '\0'; | ||||||
|  | 		else { | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		swtxt(); | ||||||
|  | 		if (argval == N_SLINE) { | ||||||
|  | #ifdef TBL68020 | ||||||
|  | 			fputs("jsr (___u_LiB)\n", codefile); | ||||||
|  | #else | ||||||
|  | 			fputs("jsr ___u_LiB\n", codefile); | ||||||
|  | #endif | ||||||
|  | 		} | ||||||
|  | 		fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval); | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		fprintf(codefile, "%d\n", (int) argval); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
| 	default : | 	default : | ||||||
| 		while ( getarg(any_ptyp) != sp_cend ) ; | 		while ( getarg(any_ptyp) != sp_cend ) ; | ||||||
| 		break ; | 		break ; | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ TBL68000 or TBL68020, in the file whichone.h, then REMOVE tables.c | ||||||
| and then run "make" again | and then run "make" again | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  | #if WORD_SIZE!=2 && WORD_SIZE!=4 | ||||||
|  | You must specify the appropriate word size, then REMOVE tables.c | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | ||||||
| #define in_ap(y)	/* nothing */ | #define in_ap(y)	/* nothing */ | ||||||
|  | @ -37,7 +40,11 @@ and then run "make" again | ||||||
| #endif | #endif | ||||||
| #define hol_off		"%ld+hol%d" | #define hol_off		"%ld+hol%d" | ||||||
| 
 | 
 | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define con_cst(x)	fprintf(codefile,".data2\t%d\n",x) | ||||||
|  | #else | ||||||
| #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | ||||||
|  | #endif | ||||||
| #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							|  | @ -4,5 +4,6 @@ | ||||||
|  * See the copyright notice in the ACK home directory, in the file "Copyright". |  * See the copyright notice in the ACK home directory, in the file "Copyright". | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #define TBL68020	1 | #define	WORD_SIZE	4	/* should be 2 or 4 */ | ||||||
| /*#define TBL68881	1 	/* use floating point processor */ | #define TBL68020	1	/* should be TBL68020 or TBL68000 */ | ||||||
|  | /* #define TBL68881	1 	/* use floating point processor */ | ||||||
|  |  | ||||||
							
								
								
									
										144
									
								
								mach/m68k2/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								mach/m68k2/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,144 @@ | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define LLP ldl | ||||||
|  | #define LEP lde | ||||||
|  | #define LFP ldf		/* load offsetted pointer */ | ||||||
|  | #define SLP sdl | ||||||
|  | #define SEP sde | ||||||
|  | #define SFP sdf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off2 | ||||||
|  | #define ABS_indoff_int	ABS_indoff2 | ||||||
|  | #define ABSIND_off_int	ABSIND_off2 | ||||||
|  | #define INDOFF_off_int	INDOFF_off2 | ||||||
|  | #define OFF_off_int	OFF_off2 | ||||||
|  | #define OFF_indoff_int	OFF_indoff2 | ||||||
|  | #define abs_index_int	abs_index2 | ||||||
|  | #define absolute_int	absolute2 | ||||||
|  | #define any_int		any2 | ||||||
|  | #define conreg_int	conreg2 | ||||||
|  | #define data_int	data2 | ||||||
|  | #define datalt_int	datalt2 | ||||||
|  | #define dreg_int	dreg2 | ||||||
|  | #define imm_cmp_int	imm_cmp2 | ||||||
|  | #define immediate_int	immediate2 | ||||||
|  | #define indirect_int	indirect2 | ||||||
|  | #define index_off_int	index_off2 | ||||||
|  | #define offsetted_int	offsetted2 | ||||||
|  | #define post_inc_int	post_inc2 | ||||||
|  | #define pre_dec_int	pre_dec2 | ||||||
|  | #define store_int	any2 | ||||||
|  | #define test_set_int	test_set2 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_w | ||||||
|  | #define ADD_I	"add.w" | ||||||
|  | #define and_i	and_w | ||||||
|  | #define AND_I	"and.w" | ||||||
|  | #define asl_i	asl_w | ||||||
|  | #define ASL_I	"asl.w" | ||||||
|  | #define asr_i	asr_w | ||||||
|  | #define ASR_I	"asr.w" | ||||||
|  | #define clr_i	clr_w | ||||||
|  | #define CLR_I	"clr.w" | ||||||
|  | #define cmp_i	cmp_w | ||||||
|  | #define cmp2_i	cmp2_w | ||||||
|  | #define DEC	"sub.w #1," | ||||||
|  | #define DIVS_I	"divs.w" | ||||||
|  | #define DIVU_I	"divu.w" | ||||||
|  | #define eor_i	eor_w | ||||||
|  | #define EOR_I	"eor.w" | ||||||
|  | #define INC	"add.w #1," | ||||||
|  | #define lsr_i	lsr_w | ||||||
|  | #define LSR_I	"lsr.w" | ||||||
|  | #define move_i	move_w | ||||||
|  | #define MOVE_I	"move.w" | ||||||
|  | #define muls_i	muls_w | ||||||
|  | #define MULS_I	"muls.w" | ||||||
|  | #define mulu_i	mulu_w | ||||||
|  | #define MULU_I	"mulu.w" | ||||||
|  | #define neg_i	neg_w | ||||||
|  | #define NEG_I	"neg.w" | ||||||
|  | #define not_i	not_w | ||||||
|  | #define NOT_I	"not.w" | ||||||
|  | #define or_i	or_w | ||||||
|  | #define OR_I	"or.w" | ||||||
|  | #define rol_i	rol_w | ||||||
|  | #define ROL_I	"rol.w" | ||||||
|  | #define ror_i	ror_w | ||||||
|  | #define ROR_I	"ror.w" | ||||||
|  | #define sub_i	sub_w | ||||||
|  | #define SUB_I	"sub.w" | ||||||
|  | #define tst_i	tst_w | ||||||
|  | 
 | ||||||
|  | #else | ||||||
|  | 
 | ||||||
|  | #define LLP lol | ||||||
|  | #define LEP loe | ||||||
|  | #define LFP lof		/* load offsetted pointer */ | ||||||
|  | #define SLP stl | ||||||
|  | #define SEP ste | ||||||
|  | #define SFP stf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off4 | ||||||
|  | #define ABS_indoff_int	ABS_indoff4 | ||||||
|  | #define ABSIND_off_int	ABSIND_off4 | ||||||
|  | #define INDOFF_off_int	INDOFF_off4 | ||||||
|  | #define OFF_off_int	OFF_off4 | ||||||
|  | #define OFF_indoff_int	OFF_indoff4 | ||||||
|  | #define abs_index_int	abs_index4 | ||||||
|  | #define absolute_int	absolute4 | ||||||
|  | #define any_int		any4 | ||||||
|  | #define conreg_int	conreg4 | ||||||
|  | #define data_int	data4 | ||||||
|  | #define datalt_int	datalt4 | ||||||
|  | #define dreg_int	dreg4 | ||||||
|  | #define imm_cmp_int	imm_cmp4 | ||||||
|  | #define immediate_int	immediate4 | ||||||
|  | #define indirect_int	indirect4 | ||||||
|  | #define index_off_int	index_off4 | ||||||
|  | #define offsetted_int	offsetted4 | ||||||
|  | #define post_inc_int	post_inc4 | ||||||
|  | #define pre_dec_int	pre_dec4 | ||||||
|  | #define store_int	store4 | ||||||
|  | #define test_set_int	test_set4 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_l | ||||||
|  | #define ADD_I	"add.l" | ||||||
|  | #define and_i	and_l | ||||||
|  | #define AND_I	"and.l" | ||||||
|  | #define asl_i	asl_l | ||||||
|  | #define ASL_I	"asl.l" | ||||||
|  | #define asr_i	asr_l | ||||||
|  | #define ASR_I	"asr.l" | ||||||
|  | #define clr_i	clr_l | ||||||
|  | #define CLR_I	"clr.l" | ||||||
|  | #define cmp_i	cmp_l | ||||||
|  | #define cmp2_i	cmp2_l | ||||||
|  | #define DEC	"sub.l #1," | ||||||
|  | #define DIVS_I	"divs.l" | ||||||
|  | #define DIVU_I	"divu.l" | ||||||
|  | #define eor_i	eor_l | ||||||
|  | #define EOR_I	"eor.l" | ||||||
|  | #define INC	"add.l #1," | ||||||
|  | #define lsr_i	lsr_l | ||||||
|  | #define LSR_I	"lsr.l" | ||||||
|  | #define move_i	move_l | ||||||
|  | #define MOVE_I	"move.l" | ||||||
|  | #define muls_i	muls_l | ||||||
|  | #define MULS_I	"muls.l" | ||||||
|  | #define mulu_i	mulu_l | ||||||
|  | #define MULU_I	"mulu.l" | ||||||
|  | #define neg_i	neg_l | ||||||
|  | #define NEG_I	"neg.l" | ||||||
|  | #define not_i	not_l | ||||||
|  | #define NOT_I	"not.l" | ||||||
|  | #define or_i	or_l | ||||||
|  | #define OR_I	"or.l" | ||||||
|  | #define rol_i	rol_l | ||||||
|  | #define ROL_I	"rol.l" | ||||||
|  | #define ror_i	ror_l | ||||||
|  | #define ROR_I	"ror.l" | ||||||
|  | #define sub_i	sub_l | ||||||
|  | #define SUB_I	"sub.l" | ||||||
|  | #define tst_i	tst_l | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -10,24 +10,29 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "whichone.h" | #include "whichone.h" | ||||||
|  | #include <stb.h> | ||||||
| 
 | 
 | ||||||
| con_part(sz,w) register sz; word w; { | con_part(sz,w) register sz; word w; { | ||||||
| 
 | 
 | ||||||
| 	while (part_size % sz) | 	while (part_size % sz) | ||||||
| 		part_size++; | 		part_size++; | ||||||
| 	if (part_size == 4) | 	if (part_size == TEM_WSIZE) | ||||||
| 		part_flush(); | 		part_flush(); | ||||||
| 	if (sz == 1) { | 	if (sz == 1) { | ||||||
| 		w &= 0xFF; | 		w &= 0xFF; | ||||||
|  | #if WORD_SIZE==4 | ||||||
| 		w <<= 8*(3-part_size); | 		w <<= 8*(3-part_size); | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else if (sz == 2) { | 	} else if (sz == 2) { | ||||||
| 		w &= 0xFFFF; | 		w &= 0xFFFF; | ||||||
| 		if (part_size == 0) | #endif | ||||||
| 			w <<= 16; | 		if (part_size == 0) { | ||||||
|  | 			/* Shift 8 for m68k2, 16 otherwise */ | ||||||
|  | 			w <<= 4 * TEM_WSIZE; | ||||||
|  | 		} | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else { | 	} else { | ||||||
| 		assert(sz == 4); | 		assert(sz == TEM_WSIZE); | ||||||
| 		part_word = w; | 		part_word = w; | ||||||
| 	} | 	} | ||||||
| 	part_size += sz; | 	part_size += sz; | ||||||
|  | @ -62,7 +67,7 @@ regscore(off,size,typ,score,totyp) | ||||||
| 			score += 5; | 			score += 5; | ||||||
| 			/* fall through .. */ | 			/* fall through .. */ | ||||||
| 		case reg_any: | 		case reg_any: | ||||||
| 			if (size != 4 || totyp == reg_pointer) return -1; | 			if (size != TEM_WSIZE || totyp == reg_pointer) return -1; | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 	if (off >= 0) { | 	if (off >= 0) { | ||||||
|  | @ -176,7 +181,7 @@ prolog(n) full n; { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| mes(type) word type ; { | mes(type) word type ; { | ||||||
| 	int argt ; | 	int argt, a1, a2 ; | ||||||
| 
 | 
 | ||||||
| 	switch ( (int)type ) { | 	switch ( (int)type ) { | ||||||
| 	case ms_ext : | 	case ms_ext : | ||||||
|  | @ -191,6 +196,41 @@ mes(type) word type ; { | ||||||
| 				break ; | 				break ; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	case ms_stb: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			fputs(".symb \"\", ", codefile); | ||||||
|  | 		else { | ||||||
|  | 			fprintf(codefile, ".symb \"%s\", ", str); | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		a1 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		a2 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp); | ||||||
|  | 		fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
|  | 	case ms_std: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			str[0] = '\0'; | ||||||
|  | 		else { | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		swtxt(); | ||||||
|  | 		if (argval == N_SLINE) { | ||||||
|  | #ifdef TBL68020 | ||||||
|  | 			fputs("jsr (___u_LiB)\n", codefile); | ||||||
|  | #else | ||||||
|  | 			fputs("jsr ___u_LiB\n", codefile); | ||||||
|  | #endif | ||||||
|  | 		} | ||||||
|  | 		fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval); | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		fprintf(codefile, "%d\n", (int) argval); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
| 	default : | 	default : | ||||||
| 		while ( getarg(any_ptyp) != sp_cend ) ; | 		while ( getarg(any_ptyp) != sp_cend ) ; | ||||||
| 		break ; | 		break ; | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ TBL68000 or TBL68020, in the file whichone.h, then REMOVE tables.c | ||||||
| and then run "make" again | and then run "make" again | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  | #if WORD_SIZE!=2 && WORD_SIZE!=4 | ||||||
|  | You must specify the appropriate word size, then REMOVE tables.c | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | ||||||
| #define in_ap(y)	/* nothing */ | #define in_ap(y)	/* nothing */ | ||||||
|  | @ -37,7 +40,11 @@ and then run "make" again | ||||||
| #endif | #endif | ||||||
| #define hol_off		"%ld+hol%d" | #define hol_off		"%ld+hol%d" | ||||||
| 
 | 
 | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define con_cst(x)	fprintf(codefile,".data2\t%d\n",x) | ||||||
|  | #else | ||||||
| #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | ||||||
|  | #endif | ||||||
| #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										4383
									
								
								mach/m68k2/ncg/table
									
										
									
									
									
								
							
							
						
						
									
										4383
									
								
								mach/m68k2/ncg/table
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										144
									
								
								mach/m68k4/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								mach/m68k4/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,144 @@ | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define LLP ldl | ||||||
|  | #define LEP lde | ||||||
|  | #define LFP ldf		/* load offsetted pointer */ | ||||||
|  | #define SLP sdl | ||||||
|  | #define SEP sde | ||||||
|  | #define SFP sdf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off2 | ||||||
|  | #define ABS_indoff_int	ABS_indoff2 | ||||||
|  | #define ABSIND_off_int	ABSIND_off2 | ||||||
|  | #define INDOFF_off_int	INDOFF_off2 | ||||||
|  | #define OFF_off_int	OFF_off2 | ||||||
|  | #define OFF_indoff_int	OFF_indoff2 | ||||||
|  | #define abs_index_int	abs_index2 | ||||||
|  | #define absolute_int	absolute2 | ||||||
|  | #define any_int		any2 | ||||||
|  | #define conreg_int	conreg2 | ||||||
|  | #define data_int	data2 | ||||||
|  | #define datalt_int	datalt2 | ||||||
|  | #define dreg_int	dreg2 | ||||||
|  | #define imm_cmp_int	imm_cmp2 | ||||||
|  | #define immediate_int	immediate2 | ||||||
|  | #define indirect_int	indirect2 | ||||||
|  | #define index_off_int	index_off2 | ||||||
|  | #define offsetted_int	offsetted2 | ||||||
|  | #define post_inc_int	post_inc2 | ||||||
|  | #define pre_dec_int	pre_dec2 | ||||||
|  | #define store_int	any2 | ||||||
|  | #define test_set_int	test_set2 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_w | ||||||
|  | #define ADD_I	"add.w" | ||||||
|  | #define and_i	and_w | ||||||
|  | #define AND_I	"and.w" | ||||||
|  | #define asl_i	asl_w | ||||||
|  | #define ASL_I	"asl.w" | ||||||
|  | #define asr_i	asr_w | ||||||
|  | #define ASR_I	"asr.w" | ||||||
|  | #define clr_i	clr_w | ||||||
|  | #define CLR_I	"clr.w" | ||||||
|  | #define cmp_i	cmp_w | ||||||
|  | #define cmp2_i	cmp2_w | ||||||
|  | #define DEC	"sub.w #1," | ||||||
|  | #define DIVS_I	"divs.w" | ||||||
|  | #define DIVU_I	"divu.w" | ||||||
|  | #define eor_i	eor_w | ||||||
|  | #define EOR_I	"eor.w" | ||||||
|  | #define INC	"add.w #1," | ||||||
|  | #define lsr_i	lsr_w | ||||||
|  | #define LSR_I	"lsr.w" | ||||||
|  | #define move_i	move_w | ||||||
|  | #define MOVE_I	"move.w" | ||||||
|  | #define muls_i	muls_w | ||||||
|  | #define MULS_I	"muls.w" | ||||||
|  | #define mulu_i	mulu_w | ||||||
|  | #define MULU_I	"mulu.w" | ||||||
|  | #define neg_i	neg_w | ||||||
|  | #define NEG_I	"neg.w" | ||||||
|  | #define not_i	not_w | ||||||
|  | #define NOT_I	"not.w" | ||||||
|  | #define or_i	or_w | ||||||
|  | #define OR_I	"or.w" | ||||||
|  | #define rol_i	rol_w | ||||||
|  | #define ROL_I	"rol.w" | ||||||
|  | #define ror_i	ror_w | ||||||
|  | #define ROR_I	"ror.w" | ||||||
|  | #define sub_i	sub_w | ||||||
|  | #define SUB_I	"sub.w" | ||||||
|  | #define tst_i	tst_w | ||||||
|  | 
 | ||||||
|  | #else | ||||||
|  | 
 | ||||||
|  | #define LLP lol | ||||||
|  | #define LEP loe | ||||||
|  | #define LFP lof		/* load offsetted pointer */ | ||||||
|  | #define SLP stl | ||||||
|  | #define SEP ste | ||||||
|  | #define SFP stf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off4 | ||||||
|  | #define ABS_indoff_int	ABS_indoff4 | ||||||
|  | #define ABSIND_off_int	ABSIND_off4 | ||||||
|  | #define INDOFF_off_int	INDOFF_off4 | ||||||
|  | #define OFF_off_int	OFF_off4 | ||||||
|  | #define OFF_indoff_int	OFF_indoff4 | ||||||
|  | #define abs_index_int	abs_index4 | ||||||
|  | #define absolute_int	absolute4 | ||||||
|  | #define any_int		any4 | ||||||
|  | #define conreg_int	conreg4 | ||||||
|  | #define data_int	data4 | ||||||
|  | #define datalt_int	datalt4 | ||||||
|  | #define dreg_int	dreg4 | ||||||
|  | #define imm_cmp_int	imm_cmp4 | ||||||
|  | #define immediate_int	immediate4 | ||||||
|  | #define indirect_int	indirect4 | ||||||
|  | #define index_off_int	index_off4 | ||||||
|  | #define offsetted_int	offsetted4 | ||||||
|  | #define post_inc_int	post_inc4 | ||||||
|  | #define pre_dec_int	pre_dec4 | ||||||
|  | #define store_int	store4 | ||||||
|  | #define test_set_int	test_set4 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_l | ||||||
|  | #define ADD_I	"add.l" | ||||||
|  | #define and_i	and_l | ||||||
|  | #define AND_I	"and.l" | ||||||
|  | #define asl_i	asl_l | ||||||
|  | #define ASL_I	"asl.l" | ||||||
|  | #define asr_i	asr_l | ||||||
|  | #define ASR_I	"asr.l" | ||||||
|  | #define clr_i	clr_l | ||||||
|  | #define CLR_I	"clr.l" | ||||||
|  | #define cmp_i	cmp_l | ||||||
|  | #define cmp2_i	cmp2_l | ||||||
|  | #define DEC	"sub.l #1," | ||||||
|  | #define DIVS_I	"divs.l" | ||||||
|  | #define DIVU_I	"divu.l" | ||||||
|  | #define eor_i	eor_l | ||||||
|  | #define EOR_I	"eor.l" | ||||||
|  | #define INC	"add.l #1," | ||||||
|  | #define lsr_i	lsr_l | ||||||
|  | #define LSR_I	"lsr.l" | ||||||
|  | #define move_i	move_l | ||||||
|  | #define MOVE_I	"move.l" | ||||||
|  | #define muls_i	muls_l | ||||||
|  | #define MULS_I	"muls.l" | ||||||
|  | #define mulu_i	mulu_l | ||||||
|  | #define MULU_I	"mulu.l" | ||||||
|  | #define neg_i	neg_l | ||||||
|  | #define NEG_I	"neg.l" | ||||||
|  | #define not_i	not_l | ||||||
|  | #define NOT_I	"not.l" | ||||||
|  | #define or_i	or_l | ||||||
|  | #define OR_I	"or.l" | ||||||
|  | #define rol_i	rol_l | ||||||
|  | #define ROL_I	"rol.l" | ||||||
|  | #define ror_i	ror_l | ||||||
|  | #define ROR_I	"ror.l" | ||||||
|  | #define sub_i	sub_l | ||||||
|  | #define SUB_I	"sub.l" | ||||||
|  | #define tst_i	tst_l | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -10,24 +10,29 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "whichone.h" | #include "whichone.h" | ||||||
|  | #include <stb.h> | ||||||
| 
 | 
 | ||||||
| con_part(sz,w) register sz; word w; { | con_part(sz,w) register sz; word w; { | ||||||
| 
 | 
 | ||||||
| 	while (part_size % sz) | 	while (part_size % sz) | ||||||
| 		part_size++; | 		part_size++; | ||||||
| 	if (part_size == 4) | 	if (part_size == TEM_WSIZE) | ||||||
| 		part_flush(); | 		part_flush(); | ||||||
| 	if (sz == 1) { | 	if (sz == 1) { | ||||||
| 		w &= 0xFF; | 		w &= 0xFF; | ||||||
|  | #if WORD_SIZE==4 | ||||||
| 		w <<= 8*(3-part_size); | 		w <<= 8*(3-part_size); | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else if (sz == 2) { | 	} else if (sz == 2) { | ||||||
| 		w &= 0xFFFF; | 		w &= 0xFFFF; | ||||||
| 		if (part_size == 0) | #endif | ||||||
| 			w <<= 16; | 		if (part_size == 0) { | ||||||
|  | 			/* Shift 8 for m68k2, 16 otherwise */ | ||||||
|  | 			w <<= 4 * TEM_WSIZE; | ||||||
|  | 		} | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else { | 	} else { | ||||||
| 		assert(sz == 4); | 		assert(sz == TEM_WSIZE); | ||||||
| 		part_word = w; | 		part_word = w; | ||||||
| 	} | 	} | ||||||
| 	part_size += sz; | 	part_size += sz; | ||||||
|  | @ -62,7 +67,7 @@ regscore(off,size,typ,score,totyp) | ||||||
| 			score += 5; | 			score += 5; | ||||||
| 			/* fall through .. */ | 			/* fall through .. */ | ||||||
| 		case reg_any: | 		case reg_any: | ||||||
| 			if (size != 4 || totyp == reg_pointer) return -1; | 			if (size != TEM_WSIZE || totyp == reg_pointer) return -1; | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 	if (off >= 0) { | 	if (off >= 0) { | ||||||
|  | @ -176,7 +181,7 @@ prolog(n) full n; { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| mes(type) word type ; { | mes(type) word type ; { | ||||||
| 	int argt ; | 	int argt, a1, a2 ; | ||||||
| 
 | 
 | ||||||
| 	switch ( (int)type ) { | 	switch ( (int)type ) { | ||||||
| 	case ms_ext : | 	case ms_ext : | ||||||
|  | @ -191,6 +196,41 @@ mes(type) word type ; { | ||||||
| 				break ; | 				break ; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	case ms_stb: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			fputs(".symb \"\", ", codefile); | ||||||
|  | 		else { | ||||||
|  | 			fprintf(codefile, ".symb \"%s\", ", str); | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		a1 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		a2 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp); | ||||||
|  | 		fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
|  | 	case ms_std: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			str[0] = '\0'; | ||||||
|  | 		else { | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		swtxt(); | ||||||
|  | 		if (argval == N_SLINE) { | ||||||
|  | #ifdef TBL68020 | ||||||
|  | 			fputs("jsr (___u_LiB)\n", codefile); | ||||||
|  | #else | ||||||
|  | 			fputs("jsr ___u_LiB\n", codefile); | ||||||
|  | #endif | ||||||
|  | 		} | ||||||
|  | 		fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval); | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		fprintf(codefile, "%d\n", (int) argval); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
| 	default : | 	default : | ||||||
| 		while ( getarg(any_ptyp) != sp_cend ) ; | 		while ( getarg(any_ptyp) != sp_cend ) ; | ||||||
| 		break ; | 		break ; | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ TBL68000 or TBL68020, in the file whichone.h, then REMOVE tables.c | ||||||
| and then run "make" again | and then run "make" again | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  | #if WORD_SIZE!=2 && WORD_SIZE!=4 | ||||||
|  | You must specify the appropriate word size, then REMOVE tables.c | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | ||||||
| #define in_ap(y)	/* nothing */ | #define in_ap(y)	/* nothing */ | ||||||
|  | @ -37,7 +40,11 @@ and then run "make" again | ||||||
| #endif | #endif | ||||||
| #define hol_off		"%ld+hol%d" | #define hol_off		"%ld+hol%d" | ||||||
| 
 | 
 | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define con_cst(x)	fprintf(codefile,".data2\t%d\n",x) | ||||||
|  | #else | ||||||
| #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | ||||||
|  | #endif | ||||||
| #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										4383
									
								
								mach/m68k4/ncg/table
									
										
									
									
									
								
							
							
						
						
									
										4383
									
								
								mach/m68k4/ncg/table
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
							
								
								
									
										144
									
								
								mach/moon3/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								mach/moon3/ncg/instrmacs.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,144 @@ | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define LLP ldl | ||||||
|  | #define LEP lde | ||||||
|  | #define LFP ldf		/* load offsetted pointer */ | ||||||
|  | #define SLP sdl | ||||||
|  | #define SEP sde | ||||||
|  | #define SFP sdf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off2 | ||||||
|  | #define ABS_indoff_int	ABS_indoff2 | ||||||
|  | #define ABSIND_off_int	ABSIND_off2 | ||||||
|  | #define INDOFF_off_int	INDOFF_off2 | ||||||
|  | #define OFF_off_int	OFF_off2 | ||||||
|  | #define OFF_indoff_int	OFF_indoff2 | ||||||
|  | #define abs_index_int	abs_index2 | ||||||
|  | #define absolute_int	absolute2 | ||||||
|  | #define any_int		any2 | ||||||
|  | #define conreg_int	conreg2 | ||||||
|  | #define data_int	data2 | ||||||
|  | #define datalt_int	datalt2 | ||||||
|  | #define dreg_int	dreg2 | ||||||
|  | #define imm_cmp_int	imm_cmp2 | ||||||
|  | #define immediate_int	immediate2 | ||||||
|  | #define indirect_int	indirect2 | ||||||
|  | #define index_off_int	index_off2 | ||||||
|  | #define offsetted_int	offsetted2 | ||||||
|  | #define post_inc_int	post_inc2 | ||||||
|  | #define pre_dec_int	pre_dec2 | ||||||
|  | #define store_int	any2 | ||||||
|  | #define test_set_int	test_set2 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_w | ||||||
|  | #define ADD_I	"add.w" | ||||||
|  | #define and_i	and_w | ||||||
|  | #define AND_I	"and.w" | ||||||
|  | #define asl_i	asl_w | ||||||
|  | #define ASL_I	"asl.w" | ||||||
|  | #define asr_i	asr_w | ||||||
|  | #define ASR_I	"asr.w" | ||||||
|  | #define clr_i	clr_w | ||||||
|  | #define CLR_I	"clr.w" | ||||||
|  | #define cmp_i	cmp_w | ||||||
|  | #define cmp2_i	cmp2_w | ||||||
|  | #define DEC	"sub.w #1," | ||||||
|  | #define DIVS_I	"divs.w" | ||||||
|  | #define DIVU_I	"divu.w" | ||||||
|  | #define eor_i	eor_w | ||||||
|  | #define EOR_I	"eor.w" | ||||||
|  | #define INC	"add.w #1," | ||||||
|  | #define lsr_i	lsr_w | ||||||
|  | #define LSR_I	"lsr.w" | ||||||
|  | #define move_i	move_w | ||||||
|  | #define MOVE_I	"move.w" | ||||||
|  | #define muls_i	muls_w | ||||||
|  | #define MULS_I	"muls.w" | ||||||
|  | #define mulu_i	mulu_w | ||||||
|  | #define MULU_I	"mulu.w" | ||||||
|  | #define neg_i	neg_w | ||||||
|  | #define NEG_I	"neg.w" | ||||||
|  | #define not_i	not_w | ||||||
|  | #define NOT_I	"not.w" | ||||||
|  | #define or_i	or_w | ||||||
|  | #define OR_I	"or.w" | ||||||
|  | #define rol_i	rol_w | ||||||
|  | #define ROL_I	"rol.w" | ||||||
|  | #define ror_i	ror_w | ||||||
|  | #define ROR_I	"ror.w" | ||||||
|  | #define sub_i	sub_w | ||||||
|  | #define SUB_I	"sub.w" | ||||||
|  | #define tst_i	tst_w | ||||||
|  | 
 | ||||||
|  | #else | ||||||
|  | 
 | ||||||
|  | #define LLP lol | ||||||
|  | #define LEP loe | ||||||
|  | #define LFP lof		/* load offsetted pointer */ | ||||||
|  | #define SLP stl | ||||||
|  | #define SEP ste | ||||||
|  | #define SFP stf		/* store offsetted pointer */ | ||||||
|  | 
 | ||||||
|  | #define ABS_off_int	ABS_off4 | ||||||
|  | #define ABS_indoff_int	ABS_indoff4 | ||||||
|  | #define ABSIND_off_int	ABSIND_off4 | ||||||
|  | #define INDOFF_off_int	INDOFF_off4 | ||||||
|  | #define OFF_off_int	OFF_off4 | ||||||
|  | #define OFF_indoff_int	OFF_indoff4 | ||||||
|  | #define abs_index_int	abs_index4 | ||||||
|  | #define absolute_int	absolute4 | ||||||
|  | #define any_int		any4 | ||||||
|  | #define conreg_int	conreg4 | ||||||
|  | #define data_int	data4 | ||||||
|  | #define datalt_int	datalt4 | ||||||
|  | #define dreg_int	dreg4 | ||||||
|  | #define imm_cmp_int	imm_cmp4 | ||||||
|  | #define immediate_int	immediate4 | ||||||
|  | #define indirect_int	indirect4 | ||||||
|  | #define index_off_int	index_off4 | ||||||
|  | #define offsetted_int	offsetted4 | ||||||
|  | #define post_inc_int	post_inc4 | ||||||
|  | #define pre_dec_int	pre_dec4 | ||||||
|  | #define store_int	store4 | ||||||
|  | #define test_set_int	test_set4 | ||||||
|  | 
 | ||||||
|  | #define add_i	add_l | ||||||
|  | #define ADD_I	"add.l" | ||||||
|  | #define and_i	and_l | ||||||
|  | #define AND_I	"and.l" | ||||||
|  | #define asl_i	asl_l | ||||||
|  | #define ASL_I	"asl.l" | ||||||
|  | #define asr_i	asr_l | ||||||
|  | #define ASR_I	"asr.l" | ||||||
|  | #define clr_i	clr_l | ||||||
|  | #define CLR_I	"clr.l" | ||||||
|  | #define cmp_i	cmp_l | ||||||
|  | #define cmp2_i	cmp2_l | ||||||
|  | #define DEC	"sub.l #1," | ||||||
|  | #define DIVS_I	"divs.l" | ||||||
|  | #define DIVU_I	"divu.l" | ||||||
|  | #define eor_i	eor_l | ||||||
|  | #define EOR_I	"eor.l" | ||||||
|  | #define INC	"add.l #1," | ||||||
|  | #define lsr_i	lsr_l | ||||||
|  | #define LSR_I	"lsr.l" | ||||||
|  | #define move_i	move_l | ||||||
|  | #define MOVE_I	"move.l" | ||||||
|  | #define muls_i	muls_l | ||||||
|  | #define MULS_I	"muls.l" | ||||||
|  | #define mulu_i	mulu_l | ||||||
|  | #define MULU_I	"mulu.l" | ||||||
|  | #define neg_i	neg_l | ||||||
|  | #define NEG_I	"neg.l" | ||||||
|  | #define not_i	not_l | ||||||
|  | #define NOT_I	"not.l" | ||||||
|  | #define or_i	or_l | ||||||
|  | #define OR_I	"or.l" | ||||||
|  | #define rol_i	rol_l | ||||||
|  | #define ROL_I	"rol.l" | ||||||
|  | #define ror_i	ror_l | ||||||
|  | #define ROR_I	"ror.l" | ||||||
|  | #define sub_i	sub_l | ||||||
|  | #define SUB_I	"sub.l" | ||||||
|  | #define tst_i	tst_l | ||||||
|  | 
 | ||||||
|  | #endif | ||||||
|  | @ -10,24 +10,29 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include "whichone.h" | #include "whichone.h" | ||||||
|  | #include <stb.h> | ||||||
| 
 | 
 | ||||||
| con_part(sz,w) register sz; word w; { | con_part(sz,w) register sz; word w; { | ||||||
| 
 | 
 | ||||||
| 	while (part_size % sz) | 	while (part_size % sz) | ||||||
| 		part_size++; | 		part_size++; | ||||||
| 	if (part_size == 4) | 	if (part_size == TEM_WSIZE) | ||||||
| 		part_flush(); | 		part_flush(); | ||||||
| 	if (sz == 1) { | 	if (sz == 1) { | ||||||
| 		w &= 0xFF; | 		w &= 0xFF; | ||||||
|  | #if WORD_SIZE==4 | ||||||
| 		w <<= 8*(3-part_size); | 		w <<= 8*(3-part_size); | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else if (sz == 2) { | 	} else if (sz == 2) { | ||||||
| 		w &= 0xFFFF; | 		w &= 0xFFFF; | ||||||
| 		if (part_size == 0) | #endif | ||||||
| 			w <<= 16; | 		if (part_size == 0) { | ||||||
|  | 			/* Shift 8 for m68k2, 16 otherwise */ | ||||||
|  | 			w <<= 4 * TEM_WSIZE; | ||||||
|  | 		} | ||||||
| 		part_word |= w; | 		part_word |= w; | ||||||
| 	} else { | 	} else { | ||||||
| 		assert(sz == 4); | 		assert(sz == TEM_WSIZE); | ||||||
| 		part_word = w; | 		part_word = w; | ||||||
| 	} | 	} | ||||||
| 	part_size += sz; | 	part_size += sz; | ||||||
|  | @ -62,7 +67,7 @@ regscore(off,size,typ,score,totyp) | ||||||
| 			score += 5; | 			score += 5; | ||||||
| 			/* fall through .. */ | 			/* fall through .. */ | ||||||
| 		case reg_any: | 		case reg_any: | ||||||
| 			if (size != 4 || totyp == reg_pointer) return -1; | 			if (size != TEM_WSIZE || totyp == reg_pointer) return -1; | ||||||
| 			break; | 			break; | ||||||
| 	} | 	} | ||||||
| 	if (off >= 0) { | 	if (off >= 0) { | ||||||
|  | @ -176,7 +181,7 @@ prolog(n) full n; { | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| mes(type) word type ; { | mes(type) word type ; { | ||||||
| 	int argt ; | 	int argt, a1, a2 ; | ||||||
| 
 | 
 | ||||||
| 	switch ( (int)type ) { | 	switch ( (int)type ) { | ||||||
| 	case ms_ext : | 	case ms_ext : | ||||||
|  | @ -191,6 +196,41 @@ mes(type) word type ; { | ||||||
| 				break ; | 				break ; | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | 	case ms_stb: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			fputs(".symb \"\", ", codefile); | ||||||
|  | 		else { | ||||||
|  | 			fprintf(codefile, ".symb \"%s\", ", str); | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		a1 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		a2 = argval; | ||||||
|  | 		argt = getarg(cst_ptyp|nof_ptyp|sof_ptyp|ilb_ptyp|pro_ptyp); | ||||||
|  | 		fprintf(codefile, "%s, 0x%x, %d\n", strarg(argt), a1, a2); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
|  | 	case ms_std: | ||||||
|  | 		argt = getarg(str_ptyp | cst_ptyp); | ||||||
|  | 		if (argt == sp_cstx) | ||||||
|  | 			str[0] = '\0'; | ||||||
|  | 		else { | ||||||
|  | 			argt = getarg(cst_ptyp); | ||||||
|  | 		} | ||||||
|  | 		swtxt(); | ||||||
|  | 		if (argval == N_SLINE) { | ||||||
|  | #ifdef TBL68020 | ||||||
|  | 			fputs("jsr (___u_LiB)\n", codefile); | ||||||
|  | #else | ||||||
|  | 			fputs("jsr ___u_LiB\n", codefile); | ||||||
|  | #endif | ||||||
|  | 		} | ||||||
|  | 		fprintf(codefile, ".symd \"%s\", 0x%x,", str, (int) argval); | ||||||
|  | 		argt = getarg(cst_ptyp); | ||||||
|  | 		fprintf(codefile, "%d\n", (int) argval); | ||||||
|  | 		argt = getarg(end_ptyp); | ||||||
|  | 		break; | ||||||
| 	default : | 	default : | ||||||
| 		while ( getarg(any_ptyp) != sp_cend ) ; | 		while ( getarg(any_ptyp) != sp_cend ) ; | ||||||
| 		break ; | 		break ; | ||||||
|  |  | ||||||
|  | @ -12,6 +12,9 @@ TBL68000 or TBL68020, in the file whichone.h, then REMOVE tables.c | ||||||
| and then run "make" again | and then run "make" again | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  | #if WORD_SIZE!=2 && WORD_SIZE!=4 | ||||||
|  | You must specify the appropriate word size, then REMOVE tables.c | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | #define ex_ap(y)	fprintf(codefile,".extern %s\n",y) | ||||||
| #define in_ap(y)	/* nothing */ | #define in_ap(y)	/* nothing */ | ||||||
|  | @ -37,7 +40,11 @@ and then run "make" again | ||||||
| #endif | #endif | ||||||
| #define hol_off		"%ld+hol%d" | #define hol_off		"%ld+hol%d" | ||||||
| 
 | 
 | ||||||
|  | #if WORD_SIZE==2 | ||||||
|  | #define con_cst(x)	fprintf(codefile,".data2\t%d\n",x) | ||||||
|  | #else | ||||||
| #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | #define con_cst(x)	fprintf(codefile,".data4\t%ld\n",x) | ||||||
|  | #endif | ||||||
| #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_ilb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | #define con_dlb(x)	fprintf(codefile,".data4\t%s\n",x) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										4383
									
								
								mach/moon3/ncg/table
									
										
									
									
									
								
							
							
						
						
									
										4383
									
								
								mach/moon3/ncg/table
									
										
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							
		Loading…
	
	Add table
		
		Reference in a new issue