IntentTag blankIntentForType(Type* t) { if (isSyncType(t) || isAtomicType(t) || t->symbol->hasFlag(FLAG_ARRAY)) { return INTENT_REF; } else if (is_bool_type(t) || is_int_type(t) || is_uint_type(t) || is_real_type(t) || is_imag_type(t) || is_complex_type(t) || is_enum_type(t) || is_string_type(t) || t == dtStringC || t == dtStringCopy || isClass(t) || isRecord(t) || isUnion(t) || t == dtTaskID || t == dtFile || t == dtTaskList || t == dtNil || t == dtOpaque || t->symbol->hasFlag(FLAG_DOMAIN) || t->symbol->hasFlag(FLAG_DISTRIBUTION) || t->symbol->hasFlag(FLAG_EXTERN)) { return constIntentForType(t); } INT_FATAL(t, "Unhandled type in blankIntentForType()"); return INTENT_BLANK; }
static IntentTag constIntentForType(Type* t) { if (isSyncType(t) || isRecordWrappedType(t) || // domain, array, or distribution isRecord(t) || // may eventually want to decide based on size is_string_type(t)) { return INTENT_CONST_REF; } else if (is_bool_type(t) || is_int_type(t) || is_uint_type(t) || is_real_type(t) || is_imag_type(t) || is_complex_type(t) || is_enum_type(t) || isClass(t) || isUnion(t) || isAtomicType(t) || t == dtOpaque || t == dtTaskID || t == dtFile || t == dtTaskList || t == dtNil || t == dtStringC || t == dtStringCopy || t->symbol->hasFlag(FLAG_EXTERN)) { return INTENT_CONST_IN; } INT_FATAL(t, "Unhandled type in constIntentForType()"); return INTENT_CONST; }
// // SymExpr // void AstDumpToHtml::visitSymExpr(SymExpr* node) { Symbol* sym = node->var; VarSymbol* var = toVarSymbol(sym); if (isBlockStmt(node->parentExpr) == true) { fprintf(mFP, "<DL>\n"); } fprintf(mFP, " "); if (var != 0 && var->immediate != 0) { const size_t bufSize = 128; char imm[bufSize]; snprint_imm(imm, bufSize, *var->immediate); fprintf(mFP, "<i><FONT COLOR=\"blue\">%s%s</FONT></i>", imm, is_imag_type(var->type) ? "i" : ""); } else { writeSymbol(sym, false); } if (isBlockStmt(node->parentExpr)) { fprintf(mFP, "</DL>\n"); } }
// Is this type OK to pass by value (e.g. it's reasonably-sized)? static bool passableByVal(Type* type) { if (is_bool_type(type) || is_int_type(type) || is_uint_type(type) || is_real_type(type) || is_imag_type(type) || is_complex_type(type) || is_enum_type(type) || isClass(type) || type == dtTaskID || // For now, allow ranges as a special case, not records in general. type->symbol->hasFlag(FLAG_RANGE) || 0) return true; // TODO: allow reasonably-sized records. NB this-in-taskfns-in-ctors.chpl // TODO: allow reasonably-sized tuples - heterogeneous and homogeneous. return false; }
IntentTag blankIntentForType(Type* t) { IntentTag retval = INTENT_BLANK; if (isSyncType(t) || isAtomicType(t) || t->symbol->hasFlag(FLAG_DEFAULT_INTENT_IS_REF) || t->symbol->hasFlag(FLAG_ARRAY)) { retval = INTENT_REF; } else if (is_bool_type(t) || is_int_type(t) || is_uint_type(t) || is_real_type(t) || is_imag_type(t) || is_complex_type(t) || is_enum_type(t) || t == dtStringC || t == dtStringCopy || t == dtCVoidPtr || t == dtCFnPtr || isClass(t) || isRecord(t) || isUnion(t) || t == dtTaskID || t == dtFile || t == dtNil || t == dtOpaque || t->symbol->hasFlag(FLAG_DOMAIN) || t->symbol->hasFlag(FLAG_DISTRIBUTION) || t->symbol->hasFlag(FLAG_EXTERN)) { retval = constIntentForType(t); } else { INT_FATAL(t, "Unhandled type in blankIntentForType()"); } return retval; }