squeezing for MINIX & bug fix in dumpidf
This commit is contained in:
		
							parent
							
								
									eab3243973
								
							
						
					
					
						commit
						43b01a70a0
					
				
					 6 changed files with 23 additions and 18 deletions
				
			
		| 
						 | 
					@ -364,7 +364,7 @@ int2float(expp, tp)
 | 
				
			||||||
		converted to the floating type tp.
 | 
							converted to the floating type tp.
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	register struct expr *exp = *expp;
 | 
						register struct expr *exp = *expp;
 | 
				
			||||||
	int uns = (*expp)->ex_type->tp_unsigned;
 | 
						int uns = exp->ex_type->tp_unsigned;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (is_cp_cst(exp)) {
 | 
						if (is_cp_cst(exp)) {
 | 
				
			||||||
		*expp = new_expr();
 | 
							*expp = new_expr();
 | 
				
			||||||
| 
						 | 
					@ -596,19 +596,19 @@ field2arith(expp)
 | 
				
			||||||
	(*expp)->ex_type = word_type;
 | 
						(*expp)->ex_type = word_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (tp->tp_unsigned)	{	/* don't worry about the sign bit */
 | 
						if (tp->tp_unsigned)	{	/* don't worry about the sign bit */
 | 
				
			||||||
		if (fd->fd_width >= 8 * word_size)
 | 
							if (fd->fd_width >= 8 * (int)word_size)
 | 
				
			||||||
			(*expp)->ex_type = uword_type;
 | 
								(*expp)->ex_type = uword_type;
 | 
				
			||||||
		ch3bin(expp, RIGHT, intexpr((arith)fd->fd_shift, INT));
 | 
							ch3bin(expp, RIGHT, intexpr((arith)fd->fd_shift, INT));
 | 
				
			||||||
		ch3bin(expp, '&', intexpr(fd->fd_mask, INT));
 | 
							ch3bin(expp, '&', intexpr(fd->fd_mask, INT));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else	{	/* take care of the sign bit: sign extend if needed */
 | 
						else	{	/* take care of the sign bit: sign extend if needed */
 | 
				
			||||||
		arith bits_in_type = word_size * 8;
 | 
							arith other_bits = (int)word_size * 8 - fd->fd_width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ch3bin(expp, LEFT,
 | 
							ch3bin(expp, LEFT,
 | 
				
			||||||
			intexpr(bits_in_type - fd->fd_width - fd->fd_shift,
 | 
								intexpr(other_bits - fd->fd_shift,
 | 
				
			||||||
						INT)
 | 
											INT)
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
		ch3bin(expp, RIGHT, intexpr(bits_in_type - fd->fd_width, INT));
 | 
							ch3bin(expp, RIGHT, intexpr(other_bits, INT));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif NOBITFIELD
 | 
					#endif NOBITFIELD
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,4 +7,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "sizes.h"
 | 
					#include "sizes.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define	ATW(arg)	((((arg) + word_size - 1) / word_size) * word_size)
 | 
					#if word_size==2 || word_size==4
 | 
				
			||||||
 | 
					#define	ATW(arg)	(((arg) + (word_size - 1)) & ~ (word_size - 1))
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define	ATW(arg)	((((arg) + ((int)word_size - 1)) / word_size) * word_size)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,7 @@ dump_type(tp)
 | 
				
			||||||
			ops = 0;
 | 
								ops = 0;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (!ops) tp = tp->tp_up;
 | 
							if (ops) tp = tp->tp_up;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	dumplevel--;
 | 
						dumplevel--;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1019,10 +1019,10 @@ load_val(expr, rlval)
 | 
				
			||||||
load_cst(val, siz)
 | 
					load_cst(val, siz)
 | 
				
			||||||
	arith val, siz;
 | 
						arith val, siz;
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (siz <= word_size)
 | 
						if ((int)siz <= (int)word_size)
 | 
				
			||||||
		C_loc(val);
 | 
							C_loc(val);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	if (siz == dword_size)
 | 
						if ((int)siz == (int)dword_size)
 | 
				
			||||||
		C_ldc(val);
 | 
							C_ldc(val);
 | 
				
			||||||
	else {
 | 
						else {
 | 
				
			||||||
		label datlab;
 | 
							label datlab;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,7 +53,7 @@ eval_field(expr, code)
 | 
				
			||||||
	struct type *tp = leftop->ex_type->tp_up;
 | 
						struct type *tp = leftop->ex_type->tp_up;
 | 
				
			||||||
	arith tmpvar = 0;
 | 
						arith tmpvar = 0;
 | 
				
			||||||
	struct type *atype = ( tp->tp_unsigned
 | 
						struct type *atype = ( tp->tp_unsigned
 | 
				
			||||||
				&& fd->fd_width >= 8 * word_size)
 | 
									&& fd->fd_width >= 8 * (int)word_size)
 | 
				
			||||||
				    ? uword_type
 | 
									    ? uword_type
 | 
				
			||||||
				    : word_type;
 | 
									    : word_type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,7 @@ eval_field(expr, code)
 | 
				
			||||||
			C_and(word_size);
 | 
								C_and(word_size);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else {
 | 
							else {
 | 
				
			||||||
			arith sft = word_size * 8 - fd->fd_width;
 | 
								arith sft = (int)word_size * 8 - fd->fd_width;
 | 
				
			||||||
			C_loc(sft - fd->fd_shift);
 | 
								C_loc(sft - fd->fd_shift);
 | 
				
			||||||
			C_sli(word_size);
 | 
								C_sli(word_size);
 | 
				
			||||||
			C_loc(sft);
 | 
								C_loc(sft);
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ eval_field(expr, code)
 | 
				
			||||||
			retrieval) is on top of stack.
 | 
								retrieval) is on top of stack.
 | 
				
			||||||
		*/
 | 
							*/
 | 
				
			||||||
		if (tp->tp_unsigned == 0) {	/* sign extension */
 | 
							if (tp->tp_unsigned == 0) {	/* sign extension */
 | 
				
			||||||
			register arith shift = word_size * 8 - fd->fd_width;
 | 
								register arith shift = (int)word_size * 8 - fd->fd_width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			C_loc(shift);
 | 
								C_loc(shift);
 | 
				
			||||||
			C_sli(word_size);
 | 
								C_sli(word_size);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,9 +23,9 @@ enter_label(idf, defining)
 | 
				
			||||||
		scope, i.e., on the lowest possible level.
 | 
							scope, i.e., on the lowest possible level.
 | 
				
			||||||
		If defining, the label comes from a label statement.
 | 
							If defining, the label comes from a label statement.
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	if (idf->id_def)	{
 | 
						register struct def *def = idf->id_def;
 | 
				
			||||||
		register struct def *def = idf->id_def;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (def)	{
 | 
				
			||||||
		if (def->df_sc == LABEL)	{
 | 
							if (def->df_sc == LABEL)	{
 | 
				
			||||||
			if (defining && def->df_initialized)
 | 
								if (defining && def->df_initialized)
 | 
				
			||||||
				error("redeclaration of label %s",
 | 
									error("redeclaration of label %s",
 | 
				
			||||||
| 
						 | 
					@ -41,11 +41,12 @@ enter_label(idf, defining)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else	{
 | 
						else	{
 | 
				
			||||||
		add_def(idf, LABEL, label_type, L_LOCAL);
 | 
							add_def(idf, LABEL, label_type, L_LOCAL);
 | 
				
			||||||
 | 
							def = idf->id_def;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (idf->id_def->df_address == 0)
 | 
						if (def->df_address == 0)
 | 
				
			||||||
		idf->id_def->df_address = (arith) text_label();
 | 
							def->df_address = (arith) text_label();
 | 
				
			||||||
	if (defining)
 | 
						if (defining)
 | 
				
			||||||
		idf->id_def->df_initialized = 1;
 | 
							def->df_initialized = 1;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unstack_label(idf)
 | 
					unstack_label(idf)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue