Changeset 22f94a4 for src/ResolvExpr
- Timestamp:
- Aug 11, 2020, 4:40:15 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 0d070ca
- Parents:
- 07d867b (diff), 129674b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/ResolvExpr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AlternativeFinder.cc
r07d867b r22f94a4 1216 1216 unify( castExpr->result, alt.expr->result, alt.env, needAssertions, 1217 1217 haveAssertions, openVars, indexer ); 1218 Cost thisCost = castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), 1219 indexer, alt.env ); 1218 Cost thisCost = 1219 castExpr->isGenerated 1220 ? conversionCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), indexer, alt.env ) 1221 : castCost( alt.expr->result, castExpr->result, alt.expr->get_lvalue(), indexer, alt.env ); 1220 1222 PRINT( 1221 1223 std::cerr << "working on cast with result: " << castExpr->result << std::endl; … … 1698 1700 1699 1701 // unification run for side-effects 1700 unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer ); 1702 bool canUnify = unify( toType, alt.expr->result, newEnv, need, have, openVars, indexer ); 1703 (void) canUnify; 1701 1704 // xxx - do some inspecting on this line... why isn't result bound to initAlt.type? 1702 1705 1703 Cost thisCost = c astCost( alt.expr->result, toType, alt.expr->get_lvalue(),1706 Cost thisCost = computeConversionCost( alt.expr->result, toType, alt.expr->get_lvalue(), 1704 1707 indexer, newEnv ); 1708 1709 PRINT( 1710 Cost legacyCost = castCost( alt.expr->result, toType, alt.expr->get_lvalue(), 1711 indexer, newEnv ); 1712 std::cerr << "Considering initialization:"; 1713 std::cerr << std::endl << " FROM: "; alt.expr->result->print(std::cerr); 1714 std::cerr << std::endl << " TO: "; toType ->print(std::cerr); 1715 std::cerr << std::endl << " Unification " << (canUnify ? "succeeded" : "failed"); 1716 std::cerr << std::endl << " Legacy cost " << legacyCost; 1717 std::cerr << std::endl << " New cost " << thisCost; 1718 std::cerr << std::endl; 1719 ) 1720 1705 1721 if ( thisCost != Cost::infinity ) { 1706 1722 // count one safe conversion for each value that is thrown away -
src/ResolvExpr/ConversionCost.cc
r07d867b r22f94a4 10 10 // Created On : Sun May 17 07:06:19 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Oct 4 14:45:00 201912 // Last Modified On : Wed Jul 29 16:11:00 2020 13 13 // Update Count : 28 14 14 // … … 392 392 void ConversionCost::postvisit( const FunctionType * ) {} 393 393 394 void ConversionCost::postvisit( const StructInstType * inst ) {395 /*396 if ( const StructInstType * destAsInst = dynamic_cast< const StructInstType * >( dest ) ) {397 if ( inst->name == destAsInst->name ) {398 cost = Cost::zero;399 } // if400 } // if401 */402 }403 404 void ConversionCost::postvisit( const UnionInstType * inst ) {405 /*406 if ( const UnionInstType * destAsInst = dynamic_cast< const UnionInstType * >( dest ) ) {407 if ( inst->name == destAsInst->name ) {408 cost = Cost::zero;409 } // if410 } // if411 */412 }413 414 394 void ConversionCost::postvisit( const EnumInstType * ) { 415 395 static Type::Qualifiers q; … … 685 665 } 686 666 687 void ConversionCost_new::postvisit( const ast::StructInstType * structInstType ) {688 /*689 if ( const ast::StructInstType * dstAsInst =690 dynamic_cast< const ast::StructInstType * >( dst ) ) {691 if ( structInstType->name == dstAsInst->name ) {692 cost = Cost::zero;693 }694 }695 */696 }697 698 void ConversionCost_new::postvisit( const ast::UnionInstType * unionInstType ) {699 /*700 if ( const ast::UnionInstType * dstAsInst =701 dynamic_cast< const ast::UnionInstType * >( dst ) ) {702 if ( unionInstType->name == dstAsInst->name ) {703 cost = Cost::zero;704 }705 }706 */707 }708 709 667 void ConversionCost_new::postvisit( const ast::EnumInstType * enumInstType ) { 710 668 (void)enumInstType; -
src/ResolvExpr/ConversionCost.h
r07d867b r22f94a4 10 10 // Created On : Sun May 17 09:37:28 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Oct 4 14:59:00 201912 // Last Modified On : Wed Jul 29 16:12:00 2020 13 13 // Update Count : 7 14 14 // … … 51 51 void postvisit( const ReferenceType * refType ); 52 52 void postvisit( const FunctionType * functionType ); 53 void postvisit( const StructInstType * aggregateUseType );54 void postvisit( const UnionInstType * aggregateUseType );55 53 void postvisit( const EnumInstType * aggregateUseType ); 56 54 void postvisit( const TraitInstType * aggregateUseType ); … … 105 103 void postvisit( const ast::ReferenceType * refType ); 106 104 void postvisit( const ast::FunctionType * functionType ); 107 void postvisit( const ast::StructInstType * structInstType );108 void postvisit( const ast::UnionInstType * unionInstType );109 105 void postvisit( const ast::EnumInstType * enumInstType ); 110 106 void postvisit( const ast::TraitInstType * traitInstType );
Note:
See TracChangeset
for help on using the changeset viewer.