예제 #1
0
파일: vl_menu.c 프로젝트: jbmulligan/quip
static void _vf_info(QSP_ARG_DECL  Vector_Function *vfp)
{
	int i;
	int n_printed=0;

	sprintf(msg_str,"Vector function %s:",VF_NAME(vfp));
	prt_msg(msg_str);

#define MAX_PER_LINE	4

	prt_msg_frag("\tallowable precisions:");
	for(i=0;i<N_MACHINE_PRECS;i++){
		if( VF_PRECMASK(vfp) & (1<<i) ){
			/* BUG?  is 0 a legal precision code? it is PREC_NONE... */
			sprintf(msg_str,"%s%s",
			(n_printed>=MAX_PER_LINE?",\n\t\t\t": (n_printed>0?", ":"")),
			PREC_NAME(prec_for_code(i)) );
			prt_msg_frag(msg_str);
			if( n_printed >= MAX_PER_LINE ) n_printed=0;
			n_printed++;
		}
	}
	prt_msg("");
	prt_msg_frag("\tallowable types:");
	n_printed=0;
	for(i=0;i<N_ARGSET_TYPES;i++){
		if( VF_TYPEMASK(vfp) & VL_TYPE_MASK(i) ){
			sprintf(msg_str,"%s%s",
			n_printed>0?", ":"",
			number_type_name[i]);
			prt_msg_frag(msg_str);
			n_printed++;
		}
	}
	prt_msg("");
}
예제 #2
0
파일: dumptree.c 프로젝트: jbmulligan/quip
static void _dump_node_basic(QSP_ARG_DECL  Vec_Expr_Node *enp)
{
	Tree_Code code;
	int i;
	const char *s;

	if( enp==NULL ) return;

	/* print the node "name", and a code that tells about shape knowledge */

// Temporarily print to stderr instead of stdout for debugging...
	prt_node(enp,msg_str);
	prt_msg_frag(msg_str);

	if( SHOWING_LHS_REFS ){
		sprintf(msg_str,"\t%d",VN_LHS_REFS(enp));
		prt_msg_frag(msg_str);
	}

	if( SHOWING_COST ){
		if( VN_SHAPE(enp) != NULL ){
			sprintf(msg_str,"\t%d", SHP_N_MACH_ELTS(VN_SHAPE(enp)));
		}

		prt_msg_frag(msg_str);

		sprintf(msg_str,"\t%d\t%d", VN_FLOPS(enp),VN_N_MATH(enp));
		prt_msg_frag(msg_str);
	}

	if( IS_CURDLED(enp) ){
		sprintf(msg_str,"\t%s (curdled!?)", NNAME(enp));
		prt_msg(msg_str);
		return;
	}

	sprintf(msg_str,"\t%s", NNAME(enp));
	prt_msg_frag(msg_str);

	/* print the special op-dependent args in human-readable form */

	code = VN_CODE(enp);

	if( code==T_DYN_OBJ || code == T_UNDEF || code == T_PROTO || code==T_POINTER || code==T_FUNCPTR || code==T_STR_PTR ){
		sprintf(msg_str,"\t%s",VN_STRING(enp));
		prt_msg_frag(msg_str);
		if( code == T_POINTER ){
			Identifier *idp;
			/* We don't use get_set_ptr() here because we don't want an error msg... */
			idp = id_of(VN_STRING(enp));
			if( idp != NULL && IS_POINTER(idp) && POINTER_IS_SET(idp) ){
				if( PTR_REF(ID_PTR(idp)) == NULL ){
					/* how could this ever happen??? */
					prt_msg_frag("->???");
				} else {
					Data_Obj *dp;
					dp = REF_OBJ(PTR_REF(ID_PTR(idp)));
					sprintf(msg_str,"->%s",OBJ_NAME(dp));
					prt_msg_frag(msg_str);
				}
			}
		}
	} else if( code == T_STATIC_OBJ ){
		sprintf(msg_str,"\t%s",OBJ_NAME(VN_OBJ(enp)));
		prt_msg_frag(msg_str);
#ifdef SCALARS_NOT_OBJECTS
	} else if( code == T_SCALAR_VAR ){
		sprintf(msg_str,"\t%s",VN_STRING(enp));
		prt_msg_frag(msg_str);
#endif // SCALARS_NOT_OBJECTS
	} else if ( code == T_FUNCREF ){
		Subrt *srp;
		srp=VN_SUBRT(enp);
		sprintf(msg_str,"\t%s",SR_NAME(srp));
		prt_msg_frag(msg_str);
	} else if( code == T_SIZE_FN ){
		sprintf(msg_str,"\t%s",FUNC_NAME(VN_FUNC_PTR(enp)));
		prt_msg_frag(msg_str);
	}
#ifdef NOT_YET
	else if(code == T_CALL_NATIVE ){
		// was kw_token???
		// curr_native_func_tbl...
		sprintf(msg_str,"\t%s",FUNC_NAME(VN_FUNC_PTR(enp)));
		prt_msg_frag(msg_str);
	}
#endif /* NOT_YET */
	else if(code == T_TYPECAST ){
		// BUG not how we do precision any more!!!
		//sprintf(msg_str,"  %s",NAME_FOR_PREC_CODE(VN_INTVAL(enp)));
        if( VN_SHAPE(enp) == NULL ) error1("CAUTIOUS:  null node shape for typecast node!?");
        else {
            sprintf(msg_str,"  %s",PREC_NAME(VN_PREC_PTR(enp)));
            prt_msg_frag(msg_str);
        }
    } else if( code == T_SUBRT_DECL || code == T_SCRIPT ){
		Subrt *srp;
		srp=VN_SUBRT(enp);
		sprintf(msg_str,"\t%s",SR_NAME(srp));
		prt_msg_frag(msg_str);
	} else if( code==T_DECL_STAT ){
		//sprintf(msg_str," %s",NAME_FOR_PREC_CODE(VN_INTVAL(enp)));
		sprintf(msg_str," %s",PREC_NAME(VN_DECL_PREC(enp)));
		prt_msg_frag(msg_str);
	} else if( IS_DECL(code) ){
		sprintf(msg_str," %s",VN_STRING(enp));
		prt_msg_frag(msg_str);
	} else if( code==T_ADVISE ){
		/* BUG need to elim yylex_qsp */
		s=eval_string(VN_CHILD(enp,0));
		sprintf(msg_str,"\t\"%s\"",s);
		prt_msg_frag(msg_str);
	} else if( code==T_WARN ){
		/* BUG need to elim yylex_qsp */
		s=eval_string(VN_CHILD(enp,0));
		sprintf(msg_str,"\t\"%s\"",s);
		prt_msg_frag(msg_str);
	} else if( code==T_STRING ){
		sprintf(msg_str,"\t\"%s\"",VN_STRING(enp));
		prt_msg_frag(msg_str);
	} else if( code == T_LABEL || code ==T_GO_BACK || code == T_GO_FWD ){
		sprintf(msg_str," %s",VN_STRING(enp));
		prt_msg_frag(msg_str);
	} else if( code==T_LIT_DBL ){
		sprintf(msg_str," %g",VN_DBLVAL(enp));
		prt_msg_frag(msg_str);
	} else if( code == T_MATH0_FN ){
		sprintf(msg_str," %s",FUNC_NAME(VN_FUNC_PTR(enp)));
		prt_msg_frag(msg_str);
	} else if( code == T_MATH1_FN ){
		sprintf(msg_str," %s",FUNC_NAME(VN_FUNC_PTR(enp)));
		prt_msg_frag(msg_str);
	} else if( code == T_MATH2_FN ){
		sprintf(msg_str," %s",FUNC_NAME(VN_FUNC_PTR(enp)));
		prt_msg_frag(msg_str);
	} else if (
		   code == T_MATH0_VFN
		|| code == T_MATH1_VFN
		|| code == T_MATH2_VFN
		|| code == T_MATH2_VSFN
		|| code == T_CHAR_VFN
			/* BUG? shouldn't there bre a VSFN2 ??? */
		|| code == T_VS_FUNC
		|| code == T_VV_FUNC
		){
		sprintf(msg_str," %s",VF_NAME(FIND_VEC_FUNC(VN_VFUNC_CODE(enp))));
		prt_msg_frag(msg_str);
	} else if( code==T_CALLFUNC ){
assert(VN_SUBRT(enp)!=NULL);
		sprintf(msg_str," %s", SR_NAME(VN_SUBRT(enp)));
		prt_msg_frag(msg_str);
	} else if( code==T_LIT_INT ){
		sprintf(msg_str," %"PRId64, VN_INTVAL(enp) );
		prt_msg_frag(msg_str);
	} else if( code==T_ASSIGN ){
		prt_msg_frag("\t");
	} else if( code==T_MAXVAL ){
		prt_msg_frag("\t");
	} else if( code==T_MINVAL ){
		prt_msg_frag("\t");
	} else if( code==T_RAMP ){
		prt_msg_frag("\t");
	}

	/* Now print the addresses of the child nodes */

	if( VN_CHILD(enp,0)!=NULL){
		sprintf(msg_str,"\t\tn%d",VN_SERIAL(VN_CHILD(enp,0)));
		prt_msg_frag(msg_str);
	}
	for(i=1;i<MAX_CHILDREN(enp);i++){
		if( VN_CHILD(enp,i)!=NULL){
			sprintf(msg_str,", n%d",VN_SERIAL(VN_CHILD(enp,i)));
			prt_msg_frag(msg_str);
		}
	}
	prt_msg("");

	if( SHOWING_SHAPES && VN_SHAPE(enp) != NULL ){
		prt_msg_frag("\t");
		if( OWNS_SHAPE(enp) ){
			sprintf(msg_str,"* 0x%lx  ",(u_long)VN_SHAPE(enp));
			prt_msg_frag(msg_str);
		}
		else {
			sprintf(msg_str,"@ 0x%lx  ",(u_long)VN_SHAPE(enp));
			prt_msg_frag(msg_str);
		}
		prt_msg_frag("\t");
		describe_shape(VN_SHAPE(enp));
	}

	if( SHOWING_RESOLVERS && VN_RESOLVERS(enp)!=NULL ){
		Node *np; Vec_Expr_Node *enp2;
		prt_msg("\tResolvers:");
		np=QLIST_HEAD(VN_RESOLVERS(enp));
		while(np!=NULL){
			enp2=(Vec_Expr_Node *)NODE_DATA(np);
			sprintf(msg_str,"\t\t%s",node_desc(enp2));
			prt_msg(msg_str);
			np=NODE_NEXT(np);
		}
	}
}
예제 #3
0
파일: cu2.c 프로젝트: E-LLP/QuIP
// not used?
int cu2_dispatch( QSP_ARG_DECL  Vector_Function *vfp, Vec_Obj_Args *oap )
{
	int i;

	i = vfp->vf_code;
	if( cu2_func_tbl[i].cu2_func == NULL){
		sprintf(DEFAULT_ERROR_STRING,"Sorry, function %s has not yet been implemented for the cuda2 platform.",VF_NAME(vfp));
		NWARN(DEFAULT_ERROR_STRING);
		return(-1);
	}
// BUG?  why not typtbl???
//fprintf(stderr,"cu2_dispatch calling tabled function %d at 0x%lx\n",
//i,(u_long)vec_func_tbl[i].cu2_func);
//fprintf(stderr,"cu2_dispatch calling function %s\n",
//VF_NAME(&vec_func_tbl[i]));
	(*cu2_func_tbl[i].cu2_func)(VF_CODE(vfp),oap);
	return(0);
}