- Timestamp:
- Jan 11, 2025, 5:48:46 PM (12 months ago)
- Branches:
- master
- Children:
- f886608
- Parents:
- 7d65715f (diff), 32a119e9 (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
- Files:
-
- 11 edited
-
BasicTypes-gen.cpp (modified) (7 diffs)
-
CodeGen/CodeGenerator.cpp (modified) (2 diffs)
-
CodeGen/CodeGenerator.hpp (modified) (1 diff)
-
ControlStruct/ExceptDecl.cpp (modified) (4 diffs)
-
GenPoly/Box.cpp (modified) (17 diffs)
-
Makefile.am (modified) (2 diffs)
-
ResolvExpr/CandidateFinder.cpp (modified) (1 diff)
-
ResolvExpr/CommonType.cpp (modified) (13 diffs)
-
ResolvExpr/ConversionCost.cpp (modified) (4 diffs)
-
Virtual/ExpandCasts.cpp (modified) (1 diff)
-
Virtual/ExpandCasts.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/BasicTypes-gen.cpp
r7d65715f rd60a4c2 36 36 Float, 37 37 FloatComplex, 38 // FloatImaginary,39 38 Float32x, 40 39 Float32xComplex, … … 43 42 Double, 44 43 DoubleComplex, 45 // DoubleImaginary,46 44 Float64x, 47 45 Float64xComplex, … … 52 50 LongDouble, 53 51 LongDoubleComplex, 54 // LongDoubleImaginary,55 52 Float128x, 56 53 Float128xComplex, … … 87 84 88 85 { ShortSignedInt, "ShortSignedInt", "SI", "signed short int", "s", Signed, ShortUnsignedInt, SignedInt, -1, 2 }, 89 { ShortUnsignedInt, "ShortUnsignedInt", " SUI", "unsigned short int", "t", Unsigned, UnsignedInt, SignedInt, -1, 2 },86 { ShortUnsignedInt, "ShortUnsignedInt", "USI", "unsigned short int", "t", Unsigned, UnsignedInt, SignedInt, -1, 2 }, 90 87 91 88 { SignedInt, "SignedInt", "I", "signed int", "i", Signed, UnsignedInt, LongSignedInt, -1, 3 }, … … 93 90 94 91 { LongSignedInt, "LongSignedInt", "LI", "signed long int", "l", Signed, LongUnsignedInt, LongLongSignedInt, -1, 4 }, 95 { LongUnsignedInt, "LongUnsignedInt", " LUI", "unsigned long int", "m", Unsigned, LongLongSignedInt, LongLongUnsignedInt, -1, 4 },92 { LongUnsignedInt, "LongUnsignedInt", "ULI", "unsigned long int", "m", Unsigned, LongLongSignedInt, LongLongUnsignedInt, -1, 4 }, 96 93 97 94 { LongLongSignedInt, "LongLongSignedInt", "LLI", "signed long long int", "x", Signed, LongLongUnsignedInt, SignedInt128, -1, 5 }, 98 { LongLongUnsignedInt, "LongLongUnsignedInt", " LLUI", "unsigned long long int", "y", Unsigned, SignedInt128, UnsignedInt128, -1, 5 },99 100 { SignedInt128, "SignedInt128", " IB", "__int128", "n", Signed, UnsignedInt128, Float16, -1, 6 },101 { UnsignedInt128, "UnsignedInt128", " UIB", "unsigned __int128", "o", Unsigned, Float16, -1, -1, 6 },95 { LongLongUnsignedInt, "LongLongUnsignedInt", "ULLI", "unsigned long long int", "y", Unsigned, SignedInt128, UnsignedInt128, -1, 5 }, 96 97 { SignedInt128, "SignedInt128", "__ID", "__int128", "n", Signed, UnsignedInt128, Float16, -1, 6 }, 98 { UnsignedInt128, "UnsignedInt128", "__UID", "unsigned __int128", "o", Unsigned, Float16, -1, -1, 6 }, 102 99 103 100 { Float16, "Float16", "_FH", "_Float16", "DF16_", Floating, Float32, Float16Complex, -1, 7 }, 104 { Float16Complex, "Float16Complex", "_FH", "_Float16 _Complex", "CDF16_", Floating, Float32Complex, -1, -1, 7 }, 101 { Float16Complex, "Float16Complex", "_FHC", "_Float16 _Complex", "CDF16_", Floating, Float32Complex, -1, -1, 7 }, 102 105 103 { Float32, "Float32", "_F", "_Float32", "DF32_", Floating, Float, Float32Complex, -1, 8 }, 106 104 { Float32Complex, "Float32Complex", "_FC", "_Float32 _Complex", "CDF32_", Floating, FloatComplex, -1, -1, 8 }, 107 105 { Float, "Float", "F", "float", "f", Floating, Float32x, FloatComplex, -1, 9 }, 108 106 { FloatComplex, "FloatComplex", "FC", "float _Complex", "Cf", Floating, Float32xComplex, -1, -1, 9 }, 109 // { FloatImaginary, "FloatImaginary", "FI", "float _Imaginary", "If", false, DoubleImaginary, FloatComplex, -1, 9 },110 111 107 { Float32x, "Float32x", "_FX", "_Float32x", "DF32x_", Floating, Float64, Float32xComplex, -1, 10 }, 112 108 { Float32xComplex, "Float32xComplex", "_FXC", "_Float32x _Complex", "CDF32x_", Floating, Float64Complex, -1, -1, 10 }, 113 { Float64, "Float64", "FD", "_Float64", "DF64_", Floating, Double, Float64Complex, -1, 11 }, 109 110 { Float64, "Float64", "_FD", "_Float64", "DF64_", Floating, Double, Float64Complex, -1, 11 }, 114 111 { Float64Complex, "Float64Complex", "_FDC", "_Float64 _Complex", "CDF64_", Floating, DoubleComplex, -1, -1, 11 }, 115 112 { Double, "Double", "D", "double", "d", Floating, Float64x, DoubleComplex, -1, 12 }, 116 113 { DoubleComplex, "DoubleComplex", "DC", "double _Complex", "Cd", Floating, Float64xComplex, -1, -1, 12 }, 117 // { DoubleImaginary, "DoubleImaginary", "DI", "double _Imaginary", "Id", false, LongDoubleImaginary, DoubleComplex, -1, 12 }, 118 119 { Float64x, "Float64x", "F80X", "_Float64x", "DF64x_", Floating, Float80, Float64xComplex, -1, 13 }, 114 { Float64x, "Float64x", "_FDX", "_Float64x", "DF64x_", Floating, Float80, Float64xComplex, -1, 13 }, 120 115 { Float64xComplex, "Float64xComplex", "_FDXC", "_Float64x _Complex", "CDF64x_", Floating, Float128Complex, -1, -1, 13 }, 121 { Float80, "Float80", "F80", "__float80", "Dq", Floating, Float128, Float64xComplex, -1, 14 }, 122 { Float128, "Float128", "_FB", "_Float128", "DF128_", Floating, uuFloat128, Float128Complex, -1, 15 }, 116 117 { Float80, "Float80", "_F80", "__float80", "Dq", Floating, Float128, Float64xComplex, -1, 14 }, 118 // __float80 _Complex, no complex counterpart 119 120 { Float128, "Float128", "_FLD", "_Float128", "DF128_", Floating, uuFloat128, Float128Complex, -1, 15 }, 123 121 { Float128Complex, "Float128Complex", "_FLDC", "_Float128 _Complex", "CDF128_", Floating, LongDoubleComplex, -1, -1, 15 }, 124 { uuFloat128, "uuFloat128", "FB", "__float128", "g", Floating, LongDouble, Float128Complex, -1, 16 }, 122 { uuFloat128, "uuFloat128", "__FLD", "__float128", "g", Floating, LongDouble, Float128Complex, -1, 16 }, 123 // __float128 _Complex, no complex counterpart 125 124 { LongDouble, "LongDouble", "LD", "long double", "e", Floating, Float128x, LongDoubleComplex, -1, 17 }, 126 125 { LongDoubleComplex, "LongDoubleComplex", "LDC", "long double _Complex", "Ce", Floating, Float128xComplex, -1, -1, 17 }, 127 // { LongDoubleImaginary, "LongDoubleImaginary", "LDI", "long double _Imaginary", "Ie", false, LongDoubleComplex, -1, -1, 17 }, 128 129 { Float128x, "Float128x", "_F BX", "_Float128x", "DF128x_", Floating, Float128xComplex, -1, -1, 18 },126 127 // may not be supported 128 { Float128x, "Float128x", "_FLDX", "_Float128x", "DF128x_", Floating, Float128xComplex, -1, -1, 18 }, 130 129 { Float128xComplex, "Float128xComplex", "_FLDXC", "_Float128x _Complex", "CDF128x_", Floating, -1, -1, -1, 18 } 131 130 }; // graph … … 159 158 // visit cost element 160 159 int col = q.top().i; 160 161 161 // skip if already set 162 162 if ( seen[col] ) { 163 163 q.pop(); 164 164 continue; 165 } else { 166 seen[col] = true; 167 } // if 165 } // if 166 seen[col] = true; 168 167 169 168 // otherwise set min-costs into matrix … … 176 175 // traverse children 177 176 int i = graph[col].left; 178 if ( i == -1 ) continue; 179 q.emplace( i, cost + 1, scost + ! (graph[col].sign & graph[i].sign) );177 if ( i == -1 ) continue; // leaf 178 q.emplace( i, cost + max(1, graph[i].rank-graph[col].rank), scost + ! (graph[col].sign & graph[i].sign) ); 180 179 181 180 i = graph[col].middle; 182 if ( i == -1 ) continue; 183 q.emplace( i, cost + 1, scost + !(graph[col].sign & graph[i].sign) );181 if ( i == -1 ) continue; // leaf 182 q.emplace( i, cost + max(1, graph[i].rank-graph[col].rank), scost + !(graph[col].sign & graph[i].sign) ); 184 183 185 184 i = graph[col].right; 186 if ( i == -1 ) continue; 187 q.emplace( i, cost + 1, scost + !(graph[col].sign & graph[i].sign) );185 if ( i == -1 ) continue; // leaf 186 q.emplace( i, cost + max(1, graph[i].rank-graph[col].rank), scost + !(graph[col].sign & graph[i].sign) ); 188 187 } while ( ! q.empty() ); 189 188 } // generateCosts -
src/CodeGen/CodeGenerator.cpp
r7d65715f rd60a4c2 1130 1130 } 1131 1131 1132 void CodeGenerator::postvisit( ast::TryStmt const * stmt ) { 1133 assertf( !options.genC, "TryStmt should not reach code generation." ); 1134 1135 output << "try "; 1136 stmt->body->accept( *visitor ); 1137 for ( ast::ptr<ast::CatchClause> const & handler : stmt->handlers ) { 1138 handler->accept( *visitor ); 1139 } 1140 if ( stmt->finally ) stmt->finally->accept( *visitor ); 1141 } 1142 1132 1143 void CodeGenerator::postvisit( ast::CatchClause const * stmt ) { 1133 1144 assertf( !options.genC, "CatchClause should not reach code generation." ); 1134 1145 1135 output << ((stmt->kind == ast::Terminate) ? " catch" : "catchResume");1146 output << ((stmt->kind == ast::Terminate) ? " catch " : " catchResume "); 1136 1147 output << "( "; 1137 1148 stmt->decl->accept( *visitor ); … … 1142 1153 output << " ) "; 1143 1154 stmt->body->accept( *visitor ); 1155 } 1156 1157 void CodeGenerator::postvisit( ast::FinallyClause const * clause ) { 1158 assertf( !options.genC, "FinallyClause should not reach code generation." ); 1159 1160 output << " finally "; 1161 clause->body->accept( *visitor ); 1144 1162 } 1145 1163 -
src/CodeGen/CodeGenerator.hpp
r7d65715f rd60a4c2 106 106 void postvisit( ast::ReturnStmt const * ); 107 107 void postvisit( ast::ThrowStmt const * ); 108 void postvisit( ast::TryStmt const * ); 108 109 void postvisit( ast::CatchClause const * ); 110 void postvisit( ast::FinallyClause const * ); 109 111 void postvisit( ast::WaitForStmt const * ); 110 112 void postvisit( ast::WithStmt const * ); -
src/ControlStruct/ExceptDecl.cpp
r7d65715f rd60a4c2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ExceptDecl.cpp -- 7 // ExceptDecl.cpp -- Translate "exception" and exception related declarations. 8 8 // 9 9 // Author : Andrew Beach 10 10 // Created On : Tue Jul 12 15:50:00 2022 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Sep 7 12:05:55 202413 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jan 10 15:35:55 2024 13 // Update Count : 2 14 14 // 15 15 … … 117 117 decl->body = true; 118 118 for ( ast::ptr<ast::TypeDecl> const & param : forallClause ) { 119 decl->params.push_back( ast::deepCopy( param ) ); 119 // Create an unsized and assertionless copy of the parameter. 120 decl->params.push_back( new ast::TypeDecl( 121 param->location, 122 param->name, 123 param->storage, 124 param->base ? ast::deepCopy( param->base ) : nullptr, 125 ast::TypeDecl::Dtype, 126 false, 127 nullptr 128 ) ); 120 129 } 121 130 return decl; … … 445 454 } 446 455 456 ast::NameExpr const * designatedName( ast::Designation const * des ) { 457 if ( des && 1 == des->designators.size() ) { 458 return des->designators.front().as<ast::NameExpr>(); 459 } 460 return nullptr; 461 } 462 447 463 ast::ObjectDecl const * ExceptDeclCore::transformVTable( 448 464 ast::ObjectDecl const * decl, ast::VTableType const * type ) { … … 467 483 createTypeIdValue( location, exceptionName, params ) ); 468 484 } 469 declsToAddBefore.push_back(470 createCopy( location, exceptionName, params ) );471 declsToAddBefore.push_back(472 createMsg( location, exceptionName, params ) );473 485 retDecl = createVirtualTable( 474 486 location, exceptionName, params, tableName ); 487 // There is quite a bit of work to pull over any initializers and 488 // decide if we want to insert the default functions. 489 bool foundCopy = false; 490 bool foundMsg = false; 491 ast::ListInit const * init = decl->init.as<ast::ListInit>(); 492 if ( init ) { 493 for ( size_t i = 0 ; i < init->initializers.size() ; ++i ) { 494 ast::Designation const * des = init->designations.at(i); 495 auto name = designatedName( des ); 496 if ( nullptr == name ) continue; 497 if ( "copy" == name->name ) { 498 foundCopy = true; 499 } else if ( "msg" == name->name ) { 500 foundMsg = true; 501 } 502 auto retInit = retDecl->init.as<ast::ListInit>(); 503 for ( size_t j = 0 ; j < retInit->initializers.size() ; ++j ) { 504 ast::Designation const * des = retInit->designations.at(j); 505 auto retName = designatedName( des ); 506 if ( retName && name->name == retName->name ) { 507 retInit = ast::mutate_field_index( retInit, 508 &ast::ListInit::initializers, j, 509 init->initializers.at(i) ); 510 } 511 } 512 retDecl->init = retInit; 513 } 514 } 515 if ( !foundCopy ) { 516 declsToAddBefore.push_back( 517 createCopy( location, exceptionName, params ) ); 518 } 519 if ( !foundMsg ) { 520 declsToAddBefore.push_back( 521 createMsg( location, exceptionName, params ) ); 522 } 475 523 } 476 524 -
src/GenPoly/Box.cpp
r7d65715f rd60a4c2 42 42 43 43 /// The layout type is used to represent sizes, alignments and offsets. 44 ast::BasicType * makeLayoutType() { 45 return new ast::BasicType( ast::BasicKind::LongUnsignedInt ); 44 const ast::Type * getLayoutType( const ast::TranslationUnit & transUnit ) { 45 assert( transUnit.global.sizeType.get() ); 46 return transUnit.global.sizeType; 46 47 } 47 48 48 49 /// Fixed version of layout type (just adding a 'C' in C++ style). 49 ast::BasicType * makeLayoutCType() { 50 return new ast::BasicType( ast::BasicKind::LongUnsignedInt, 51 ast::CV::Qualifiers( ast::CV::Const ) ); 50 const ast::Type * getLayoutCType( const ast::TranslationUnit & transUnit ) { 51 // Hack for optimization: don't want to clone every time, but don't want 52 // to hardcode a global-translation-unit assumption here either. So 53 // cache it: will be fast if there is a single translation unit, but 54 // still correct otherwise. 55 static ast::ptr<ast::Type> lastLayoutType = nullptr; 56 static ast::ptr<ast::Type> lastLayoutCType = nullptr; 57 const ast::Type * curLayoutType = getLayoutType( transUnit ); 58 if (lastLayoutType != curLayoutType ) { 59 lastLayoutCType = ast::deepCopy( curLayoutType ); 60 add_qualifiers( 61 lastLayoutCType, ast::CV::Qualifiers{ ast::CV::Const } ); 62 } 63 return lastLayoutCType; 52 64 } 53 65 … … 55 67 /// Adds layout-generation functions to polymorphic types. 56 68 struct LayoutFunctionBuilder final : 69 public ast::WithConstTranslationUnit, 57 70 public ast::WithDeclsToAdd, 58 71 public ast::WithShortCircuiting, … … 77 90 void addSTypeParams( 78 91 ast::vector<ast::DeclWithType> & params, 79 ast::vector<ast::TypeDecl> const & sizedParams ) { 92 ast::vector<ast::TypeDecl> const & sizedParams, 93 const ast::TranslationUnit & transUnit ) { 80 94 for ( ast::ptr<ast::TypeDecl> const & sizedParam : sizedParams ) { 81 95 ast::TypeInstType inst( sizedParam ); 82 96 std::string paramName = Mangle::mangleType( &inst ); 83 params.emplace_back(new ast::ObjectDecl(97 auto sizeofParam = new ast::ObjectDecl( 84 98 sizedParam->location, 85 99 sizeofName( paramName ), 86 makeLayoutCType() 87 ) ); 88 auto alignParam = new ast::ObjectDecl( 100 getLayoutCType( transUnit ) 101 ); 102 sizeofParam->attributes.push_back( new ast::Attribute( "unused" ) ); 103 params.emplace_back( sizeofParam ); 104 auto alignofParam = new ast::ObjectDecl( 89 105 sizedParam->location, 90 106 alignofName( paramName ), 91 makeLayoutCType()107 getLayoutCType( transUnit ) 92 108 ); 93 align Param->attributes.push_back( new ast::Attribute( "unused" ) );94 params.emplace_back( align Param );95 } 96 } 97 98 ast::Type * makeLayoutOutType() {99 return new ast::PointerType( makeLayoutType() );109 alignofParam->attributes.push_back( new ast::Attribute( "unused" ) ); 110 params.emplace_back( alignofParam ); 111 } 112 } 113 114 ast::Type * getLayoutOutType( const ast::TranslationUnit & transUnit ) { 115 return new ast::PointerType( getLayoutType( transUnit ) ); 100 116 } 101 117 … … 110 126 CodeLocation const & location, ast::AggregateDecl const * aggr, 111 127 ast::vector<ast::TypeDecl> const & sizedParams, 112 bool isInFunction, bool isStruct ) { 128 bool isInFunction, bool isStruct, 129 const ast::TranslationUnit & transUnit ) { 113 130 ast::ObjectDecl * sizeParam = new ast::ObjectDecl( 114 131 location, 115 132 sizeofName( aggr->name ), 116 makeLayoutOutType()133 getLayoutOutType( transUnit ) 117 134 ); 118 135 ast::ObjectDecl * alignParam = new ast::ObjectDecl( 119 136 location, 120 137 alignofName( aggr->name ), 121 makeLayoutOutType()138 getLayoutOutType( transUnit ) 122 139 ); 123 140 ast::ObjectDecl * offsetParam = nullptr; … … 127 144 location, 128 145 offsetofName( aggr->name ), 129 makeLayoutOutType()146 getLayoutOutType( transUnit ) 130 147 ); 131 148 params.push_back( offsetParam ); 132 149 } 133 addSTypeParams( params, sizedParams );150 addSTypeParams( params, sizedParams, transUnit ); 134 151 135 152 // Routines at global scope marked "static" to prevent multiple … … 218 235 // Build layout function signature. 219 236 LayoutData layout = buildLayoutFunction( 220 location, decl, sizedParams, isInFunction(), true );237 location, decl, sizedParams, isInFunction(), true, transUnit() ); 221 238 ast::FunctionDecl * layoutDecl = layout.function; 222 239 // Also return these or extract them from the parameter list? … … 292 309 // Build layout function signature. 293 310 LayoutData layout = buildLayoutFunction( 294 location, decl, sizedParams, isInFunction(), false );311 location, decl, sizedParams, isInFunction(), false, transUnit() ); 295 312 ast::FunctionDecl * layoutDecl = layout.function; 296 313 // Also return these or extract them from the parameter list? … … 1390 1407 /// * Move polymorphic returns in function types to pointer-type parameters. 1391 1408 /// * Adds type size and assertion parameters to parameter lists. 1392 struct DeclAdapter final { 1409 struct DeclAdapter final : 1410 public ast::WithConstTranslationUnit { 1393 1411 ast::FunctionDecl const * previsit( ast::FunctionDecl const * decl ); 1394 1412 ast::FunctionDecl const * postvisit( ast::FunctionDecl const * decl ); … … 1398 1416 1399 1417 ast::ObjectDecl * makeObj( 1400 CodeLocation const & location, std::string const & name ) { 1418 CodeLocation const & location, std::string const & name, 1419 const ast::TranslationUnit & transUnit ) { 1401 1420 // The size/align parameters may be unused, so add the unused attribute. 1402 1421 return new ast::ObjectDecl( location, name, 1403 makeLayoutCType(),1422 getLayoutCType( transUnit ), 1404 1423 nullptr, ast::Storage::Classes(), ast::Linkage::C, nullptr, 1405 1424 { new ast::Attribute( "unused" ) } ); … … 1441 1460 std::string paramName = Mangle::mangleType( ¶mType ); 1442 1461 1443 auto sizeParam = makeObj( typeParam->location, sizeofName( paramName ) ); 1462 auto sizeParam = makeObj( 1463 typeParam->location, sizeofName( paramName ), transUnit() ); 1444 1464 layoutParams.emplace_back( sizeParam ); 1445 1465 1446 auto alignParam = makeObj( typeParam->location, alignofName( paramName ) ); 1466 auto alignParam = makeObj( 1467 typeParam->location, alignofName( paramName ), transUnit() ); 1447 1468 layoutParams.emplace_back( alignParam ); 1448 1469 } … … 1576 1597 /// * Inserts dynamic calculation of polymorphic type layouts where needed. 1577 1598 struct PolyGenericCalculator final : 1578 public ast::WithConstTypeSubstitution, 1599 public ast::WithConstTranslationUnit, 1600 public ast::WithConstTypeSubstitution, 1579 1601 public ast::WithDeclsToAdd, 1580 1602 public ast::WithGuards, … … 1693 1715 1694 1716 ast::ObjectDecl * sizeDecl = new ast::ObjectDecl( decl->location, 1695 sizeofName( typeName ), makeLayoutCType(),1717 sizeofName( typeName ), getLayoutCType( transUnit() ), 1696 1718 new ast::SingleInit( decl->location, 1697 1719 new ast::SizeofExpr( decl->location, deepCopy( base ) ) … … 1699 1721 ); 1700 1722 ast::ObjectDecl * alignDecl = new ast::ObjectDecl( decl->location, 1701 alignofName( typeName ), makeLayoutCType(),1723 alignofName( typeName ), getLayoutCType( transUnit() ), 1702 1724 new ast::SingleInit( decl->location, 1703 1725 new ast::AlignofExpr( decl->location, deepCopy( base ) ) … … 1987 2009 auto offsetArray = makeVar( expr->location, offsetName, 1988 2010 new ast::ArrayType( 1989 makeLayoutType(),2011 getLayoutType( transUnit() ), 1990 2012 ast::ConstantExpr::from_ulong( expr->location, inits.size() ), 1991 2013 ast::FixedLen, … … 2071 2093 // All empty structures have the same layout (size 1, align 1). 2072 2094 makeVar( location, 2073 sizeofName( typeName ), makeLayoutType(),2095 sizeofName( typeName ), getLayoutType( transUnit() ), 2074 2096 new ast::SingleInit( location, 2075 2097 ast::ConstantExpr::from_ulong( location, 1 ) ) ); 2076 2098 makeVar( location, 2077 alignofName( typeName ), makeLayoutType(),2099 alignofName( typeName ), getLayoutType( transUnit() ), 2078 2100 new ast::SingleInit( location, 2079 2101 ast::ConstantExpr::from_ulong( location, 1 ) ) ); … … 2081 2103 } else { 2082 2104 ast::ObjectDecl const * sizeofVar = makeVar( location, 2083 sizeofName( typeName ), makeLayoutType(), nullptr );2105 sizeofName( typeName ), getLayoutType( transUnit() ), nullptr ); 2084 2106 ast::ObjectDecl const * alignofVar = makeVar( location, 2085 alignofName( typeName ), makeLayoutType(), nullptr );2107 alignofName( typeName ), getLayoutType( transUnit() ), nullptr ); 2086 2108 ast::ObjectDecl const * offsetofVar = makeVar( location, 2087 2109 offsetofName( typeName ), 2088 2110 new ast::ArrayType( 2089 makeLayoutType(),2111 getLayoutType( transUnit() ), 2090 2112 ast::ConstantExpr::from_int( location, memberCount ), 2091 2113 ast::FixedLen, … … 2133 2155 2134 2156 ast::ObjectDecl * sizeofVar = makeVar( location, 2135 sizeofName( typeName ), makeLayoutType() );2157 sizeofName( typeName ), getLayoutType( transUnit() ) ); 2136 2158 ast::ObjectDecl * alignofVar = makeVar( location, 2137 alignofName( typeName ), makeLayoutType() );2159 alignofName( typeName ), getLayoutType( transUnit() ) ); 2138 2160 2139 2161 ast::UntypedExpr * layoutCall = new ast::UntypedExpr( location, -
src/Makefile.am
r7d65715f rd60a4c2 11 11 ## Created On : Sun May 31 08:51:46 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Nov 20 11:28:05 202314 ## Update Count : 1 0913 ## Last Modified On : Sat Jan 11 16:27:27 2025 14 ## Update Count : 112 15 15 ############################################################################### 16 16 … … 55 55 $(addprefix $(srcdir)/, ResolvExpr/ConversionCost.cpp ResolvExpr/CommonType.cpp SymTab/ManglerCommon.cpp) : $(srcdir)/AST/BasicKind.hpp 56 56 57 .PRECIOUS: $(srcdir)/AST/BasicKind.hpp 57 58 $(srcdir)/AST/BasicKind.hpp : BasicTypes-gen.cpp 58 59 ${AM_V_GEN}${CXXCOMPILE} $< -o BasicTypes-gen -Wall -Wextra -Werror=return-type -
src/ResolvExpr/CandidateFinder.cpp
r7d65715f rd60a4c2 1225 1225 1226 1226 // return casts are eliminated (merely selecting an overload, no actual operation) 1227 candidates = std::move(finder.candidates); 1227 for (auto & cand : finder.candidates) { 1228 if (typesCompatibleIgnoreQualifiers(toType, cand->expr->result, cand->env)) { 1229 candidates.push_back (cand); 1230 } 1231 } 1232 // candidates = std::move(finder.candidates); 1228 1233 return; 1229 1234 } -
src/ResolvExpr/CommonType.cpp
r7d65715f rd60a4c2 42 42 #define BT ast::BasicKind:: 43 43 static const ast::BasicKind commonTypes[BT NUMBER_OF_BASIC_TYPES][BT NUMBER_OF_BASIC_TYPES] = { // nearest common ancestor 44 /* B C SC UC SI SUI45 I UI LI LUI LLI LLUI46 IB UIB _FH _FH_F _FC47 F FC _FX _FXC FD _FDC48 D DC F80X _FDXC F80 _FB49 _FLDC FB LD LDC _FBX _FLDXC44 /* B C SC UC SI USI 45 I UI LI ULI LLI ULLI 46 __ID __UID _FH _FHC _F _FC 47 F FC _FX _FXC _FD _FDC 48 D DC _FDX _FDXC _F80 _FLD 49 _FLDC __FLD LD LDC _FLDX _FLDXC 50 50 */ 51 51 { … … 90 90 }, 91 91 { 92 /* SUI */ BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt,92 /* USI */ BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, BT ShortUnsignedInt, 93 93 BT SignedInt, BT UnsignedInt, BT LongSignedInt, BT LongUnsignedInt, BT LongLongSignedInt, BT LongLongUnsignedInt, 94 94 BT SignedInt128, BT UnsignedInt128, BT Float16, BT Float16Complex, BT Float32, BT Float32Complex, … … 122 122 }, 123 123 { 124 /* LUI */ BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt,124 /* ULI */ BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, 125 125 BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongUnsignedInt, BT LongLongSignedInt, BT LongLongUnsignedInt, 126 126 BT SignedInt128, BT UnsignedInt128, BT Float16, BT Float16Complex, BT Float32, BT Float32Complex, … … 138 138 }, 139 139 { 140 /* LLUI */ BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt,140 /* ULLI */ BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, 141 141 BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, BT LongLongUnsignedInt, 142 142 BT SignedInt128, BT UnsignedInt128, BT Float16, BT Float16Complex, BT Float32, BT Float32Complex, … … 146 146 }, 147 147 { 148 /* IB*/ BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128,148 /* __ID */ BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, 149 149 BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, BT SignedInt128, 150 150 BT SignedInt128, BT UnsignedInt128, BT Float16, BT Float16Complex, BT Float32, BT Float32Complex, … … 154 154 }, 155 155 { 156 /* UIB*/ BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128,156 /* __UID */ BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, 157 157 BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, BT UnsignedInt128, 158 158 BT UnsignedInt128, BT UnsignedInt128, BT Float16, BT Float16Complex, BT Float32, BT Float32Complex, … … 170 170 }, 171 171 { 172 /* _FH*/ BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex,172 /* _FHC */ BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, 173 173 BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, 174 174 BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float16Complex, BT Float32Complex, BT Float32Complex, … … 226 226 }, 227 227 { 228 /* FD */ BT Float64, BT Float64, BT Float64, BT Float64, BT Float64, BT Float64,228 /* _FD */ BT Float64, BT Float64, BT Float64, BT Float64, BT Float64, BT Float64, 229 229 BT Float64, BT Float64, BT Float64, BT Float64, BT Float64, BT Float64, 230 230 BT Float64, BT Float64, BT Float64, BT Float64Complex, BT Float64, BT Float64Complex, … … 258 258 }, 259 259 { 260 /* F80X */ BT Float64x, BT Float64x, BT Float64x, BT Float64x, BT Float64x, BT Float64x,260 /* _FDX */ BT Float64x, BT Float64x, BT Float64x, BT Float64x, BT Float64x, BT Float64x, 261 261 BT Float64x, BT Float64x, BT Float64x, BT Float64x, BT Float64x, BT Float64x, 262 262 BT Float64x, BT Float64x, BT Float64x, BT Float64xComplex, BT Float64x, BT Float64xComplex, … … 274 274 }, 275 275 { 276 /* F80 */ BT Float80, BT Float80, BT Float80, BT Float80, BT Float80, BT Float80,276 /* _F80 */ BT Float80, BT Float80, BT Float80, BT Float80, BT Float80, BT Float80, 277 277 BT Float80, BT Float80, BT Float80, BT Float80, BT Float80, BT Float80, 278 278 BT Float80, BT Float80, BT Float80, BT Float64xComplex, BT Float80, BT Float64xComplex, … … 282 282 }, 283 283 { 284 /* _FB*/ BT Float128, BT Float128, BT Float128, BT Float128, BT Float128, BT Float128,284 /* _FLD */ BT Float128, BT Float128, BT Float128, BT Float128, BT Float128, BT Float128, 285 285 BT Float128, BT Float128, BT Float128, BT Float128, BT Float128, BT Float128, 286 286 BT Float128, BT Float128, BT Float128, BT Float128Complex, BT Float128, BT Float128Complex, … … 298 298 }, 299 299 { 300 /* FB*/ BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128,300 /* __FLD */ BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, 301 301 BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, BT uuFloat128, 302 302 BT uuFloat128, BT uuFloat128, BT uuFloat128, BT Float128Complex, BT uuFloat128, BT Float128Complex, … … 322 322 }, 323 323 { 324 /* _FBX */ BT Float128x, BT Float128x, BT Float128x, BT Float128x, BT Float128x, BT Float128x,324 /* _FLDX */ BT Float128x, BT Float128x, BT Float128x, BT Float128x, BT Float128x, BT Float128x, 325 325 BT Float128x, BT Float128x, BT Float128x, BT Float128x, BT Float128x, BT Float128x, 326 326 BT Float128x, BT Float128x, BT Float128x, BT Float128xComplex, BT Float128x, BT Float128xComplex, -
src/ResolvExpr/ConversionCost.cpp
r7d65715f rd60a4c2 62 62 // GENERATED BY BasicTypes-gen.cpp 63 63 static const int costMatrix[ast::BasicKind::NUMBER_OF_BASIC_TYPES][ast::BasicKind::NUMBER_OF_BASIC_TYPES] = { // path length from root to node 64 /* B C SC UC SI SUI I UI LI LUI LLI LLUI IB UIB _FH _FH _F _FC F FC _FX _FXC FD _FDC D DC F80X_FDXC F80 _FB_FLDC FB LD LDC _FBX_FLDXC */65 /* B */ { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 1 5, 16, 17, 16, 18, 17, },66 /* C */ { -1, 0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 1 4, 15, 16, 15, 17, 16, },67 /* SC */ { -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 1 4, 15, 16, 15, 17, 16, },68 /* UC */ { -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 1 4, 15, 16, 15, 17, 16, },69 /* SI */ { -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 1 3, 14, 15, 14, 16, 15, },70 /* SUI */ { -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 14, 16, 15, },71 /* I */ { -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 1 2, 13, 14, 13, 15, 14, },72 /* UI */ { -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 1 2, 13, 14, 13, 15, 14, },73 /* LI */ { -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 1 1, 12, 13, 12, 14, 13, },74 /* LUI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 12, 14, 13, },75 /* LLI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 1 0, 11, 12, 11, 13, 12, },76 /* LLUI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 11, 13, 12, },77 /* IB */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 10, 12, 11, },78 /* UIB */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 10, 12, 11, },79 /* _FH */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 9, 11, 10, },80 /* _FH */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, 6, -1, -1, 7, -1, -1, 8, -1, 9, },81 /* _F */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 8, 10, 9, },82 /* _FC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, -1, 6, -1, -1, 7, -1, 8, },83 /* F */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 7, 9, 8, },84 /* FC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, -1, 5, -1, -1, 6, -1, 7, },85 /* _FX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 6, 8, 7, },86 /* _FXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, -1, 4, -1, -1, 5, -1, 6, },87 /* FD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 5, 7, 6, },88 /* _FDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, -1, 3, -1, -1, 4, -1, 5, },89 /* D */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 5, 4, 6, 5, },90 /* DC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, -1, 2, -1, -1, 3, -1, 4, },91 /* F80X */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 4, 3, 5, 4, },92 /* _FDXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, -1, 2, -1, 3, },93 /* F80 */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, 1, 2, 2, 3, 3, 4, 4, },94 /* _FB */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, },95 /* _FLDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 1, -1, 2, },96 /* FB*/ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, 1, 2, 2, 3, },64 /* B C SC UC SI USI I UI LI ULI LLI ULLI __ID__UID _FH _FHC _F _FC F FC _FX _FXC _FD _FDC D DC _FDX_FDXC _F80 _FLD_FLDC__FLD LD LDC_FLDX_FLDXC */ 65 /* B */ { 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, }, 66 /* C */ { -1, 0, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, }, 67 /* SC */ { -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, }, 68 /* UC */ { -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, }, 69 /* SI */ { -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, }, 70 /* USI */ { -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, }, 71 /* I */ { -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, }, 72 /* UI */ { -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, }, 73 /* LI */ { -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, }, 74 /* ULI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, }, 75 /* LLI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, }, 76 /* ULLI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 11, 11, 12, 13, 13, 14, }, 77 /* __ID */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, }, 78 /* __UID */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, }, 79 /* _FH */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, }, 80 /* _FHC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, 6, -1, -1, 8, -1, -1, 10, -1, 11, }, 81 /* _F */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, }, 82 /* _FC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, 5, -1, -1, 7, -1, -1, 9, -1, 10, }, 83 /* F */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 7, 7, 8, 9, 9, 10, }, 84 /* FC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, 4, -1, -1, 6, -1, -1, 8, -1, 9, }, 85 /* _FX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, }, 86 /* _FXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, 3, -1, -1, 5, -1, -1, 7, -1, 8, }, 87 /* _FD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, }, 88 /* _FDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, 2, -1, -1, 4, -1, -1, 6, -1, 7, }, 89 /* D */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, }, 90 /* DC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, -1, -1, 3, -1, -1, 5, -1, 6, }, 91 /* _FDX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 3, 3, 4, 5, 5, 6, }, 92 /* _FDXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 2, -1, -1, 4, -1, 5, }, 93 /* _F80 */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, 1, 2, 2, 3, 4, 4, 5, }, 94 /* _FLD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, 3, 3, 4, }, 95 /* _FLDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 2, -1, 3, }, 96 /* __FLD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 0, 1, 2, 2, 3, }, 97 97 /* LD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 1, 2, }, 98 98 /* LDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 1, }, 99 /* _FBX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, },99 /* _FLDX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, }, 100 100 /* _FLDXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, }, 101 101 }; // costMatrix 102 static const int maxIntCost = 1 5;102 static const int maxIntCost = 16; 103 103 // GENERATED END 104 104 static_assert( … … 110 110 // GENERATED BY BasicTypes-gen.cpp 111 111 static const int signMatrix[ast::BasicKind::NUMBER_OF_BASIC_TYPES][ast::BasicKind::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion 112 /* B C SC UC SI SUI I UI LI LUI LLI LLUI IB UIB _FH _FH _F _FC F FC _FX _FXC FD _FDC D DC F80X_FDXC F80 _FB_FLDC FB LD LDC _FBX_FLDXC */112 /* B C SC UC SI USI I UI LI ULI LLI ULLI __ID__UID _FH _FHC _F _FC F FC _FX _FXC _FD _FDC D DC _FDX_FDXC _F80 _FLD_FLDC__FLD LD LDC_FLDX_FLDXC */ 113 113 /* B */ { 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 114 114 /* C */ { -1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, … … 116 116 /* UC */ { -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 117 117 /* SI */ { -1, -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 118 /* SUI */ { -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },118 /* USI */ { -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 119 119 /* I */ { -1, -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 120 120 /* UI */ { -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 121 121 /* LI */ { -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 122 /* LUI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },122 /* ULI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 123 123 /* LLI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 124 /* LLUI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },125 /* IB*/ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },126 /* UIB*/ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },124 /* ULLI */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 125 /* __ID */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 126 /* __UID */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 127 127 /* _FH */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 128 /* _FH*/ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, },128 /* _FHC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, }, 129 129 /* _F */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 130 130 /* _FC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, }, … … 133 133 /* _FX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 134 134 /* _FXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, }, 135 /* FD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },135 /* _FD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 136 136 /* _FDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, }, 137 137 /* D */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 138 138 /* DC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, }, 139 /* F80X */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },139 /* _FDX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 140 140 /* _FDXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 0, -1, -1, 0, -1, 0, }, 141 /* F80 */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, },142 /* _FB*/ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, },141 /* _F80 */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, 142 /* _FLD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, }, 143 143 /* _FLDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, 0, -1, 0, }, 144 /* FB*/ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, },144 /* __FLD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, }, 145 145 /* LD */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, }, 146 146 /* LDC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 0, }, 147 /* _FBX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, },147 /* _FLDX */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, }, 148 148 /* _FLDXC */ { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, }, 149 149 }; // signMatrix -
src/Virtual/ExpandCasts.cpp
r7d65715f rd60a4c2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ExpandCasts.cpp -- 7 // ExpandCasts.cpp -- Expand virtual casts into lower level code. 8 8 // 9 9 // Author : Andrew Beach -
src/Virtual/ExpandCasts.hpp
r7d65715f rd60a4c2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ExpandCasts.hpp -- 7 // ExpandCasts.hpp -- Expand virtual casts into lower level code. 8 8 // 9 9 // Author : Andrew Beach 10 10 // Created On : Mon Jul 24 13:54:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri J ul 29 14:40:00 202213 // Update Count : 112 // Last Modified On : Fri Jan 10 14:34:00 2025 13 // Update Count : 2 14 14 // 15 15 16 16 #pragma once 17 17 18 #include <list> // for list19 20 class Declaration;21 18 namespace ast { 22 19 class TranslationUnit; … … 24 21 25 22 namespace Virtual { 26 void expandCasts( std::list< Declaration * > & translationUnit );27 23 void expandCasts( ast::TranslationUnit & translationUnit ); 28 24 // Breaks all virtual cast nodes up into translatable nodes. 29 25 30 // Later this might just set some information so it can happen at CodeGen.31 32 26 }
Note:
See TracChangeset
for help on using the changeset viewer.