Changeset 7d55e4d for src/BasicTypes-gen.cc
- Timestamp:
- Oct 30, 2023, 4:59:34 PM (17 months ago)
- Branches:
- master
- Children:
- 4ac402d
- Parents:
- 36e6f10
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/BasicTypes-gen.cc
r36e6f10 r7d55e4d 117 117 // { LongDoubleImaginary, "LongDoubleImaginary", "LDI", "long double _Imaginary", "Ie", false, LongDoubleComplex, -1, -1, 17 }, 118 118 119 { uFloat128x, "uFloat128x", "_FBX", "_Float128x", "DF128x_", Floating, uFloat128xComplex, -1, -1, 18 }, 119 { uFloat128x, "uFloat128x", "_FBX", "_Float128x", "DF128x_", Floating, uFloat128xComplex, -1, -1, 18 }, 120 120 { uFloat128xComplex, "uFloat128xComplex", "_FLDXC", "_Float128x _Complex", "CDF128x_", Floating, -1, -1, -1, 18 } 121 121 }; // graph … … 127 127 void generateCosts( int row ) { 128 128 bool seen[NUMBER_OF_BASIC_TYPES] = { false /*, ... */ }; 129 129 130 130 struct el_cost { 131 131 int i; 132 132 int path; 133 133 int sign; 134 134 135 135 el_cost( int i = 0, int p = 0, int s = 0 ) : i(i), path(p), sign(s) {} 136 136 137 137 // reverse the sense for use in largest-on-top priority queue 138 138 bool operator< (const el_cost& o) const { … … 195 195 return; 196 196 } // if 197 197 198 198 i = graph[col].middle; 199 199 if ( i == -1 ) assert("invalid ancestor assumption"); … … 284 284 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 285 285 code << "\t\t" << graph[r].name << "," << endl; 286 } // for 286 } // for 287 287 code << "\t\tNUMBER_OF_BASIC_TYPES" << endl; 288 288 code << "\t} kind;" << endl; … … 307 307 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 308 308 code << "\t\"" << graph[r].type << "\"," << endl; 309 } // for 309 } // for 310 310 code << "};" << endl; 311 311 … … 329 329 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 330 330 code << "\t\t" << graph[r].name << "," << endl; 331 } // for 331 } // for 332 332 code << "\t\tNUMBER_OF_BASIC_TYPES" << endl; 333 333 code << "\t} kind;" << endl; … … 352 352 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 353 353 code << "\t\"" << graph[r].type << "\"," << endl; 354 } // for 354 } // for 355 355 code << "};" << endl; 356 356 … … 391 391 end += sizeof( STARTMK ); 392 392 code << str.substr( start, end - start ); 393 393 394 394 code << "\t" << BYMK << endl; 395 code << "\tstatic const int costMatrix[ BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node" << endl395 code << "\tstatic const int costMatrix[ast::BasicType::NUMBER_OF_BASIC_TYPES][ast::BasicType::NUMBER_OF_BASIC_TYPES] = { // path length from root to node" << endl 396 396 << "\t\t/* "; 397 397 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles … … 411 411 code << "\tstatic const int maxIntCost = " << *max_element(costMatrix[SignedInt], costMatrix[SignedInt] + NUMBER_OF_BASIC_TYPES) << ";" << endl; 412 412 code << "\t"; // indentation for end marker 413 413 414 414 if ( (start = str.find( ENDMK, start + 1 )) == string::npos ) Abort( "end", ConversionCost ); 415 415 if ( (end = str.find( STARTMK, start + 1 )) == string::npos ) Abort( "start", ConversionCost ); … … 418 418 419 419 code << "\t" << BYMK << endl; 420 code << "\tstatic const int signMatrix[ BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion" << endl420 code << "\tstatic const int signMatrix[ast::BasicType::NUMBER_OF_BASIC_TYPES][ast::BasicType::NUMBER_OF_BASIC_TYPES] = { // number of sign changes in safe conversion" << endl 421 421 << "\t\t/* "; 422 422 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles … … 450 450 enum { PER_ROW = 6 }; 451 451 code << "\t" << BYMK << endl; 452 code << "\t#define BT BasicType::" << endl;453 code << "\tstatic const B asicType::Kind commonTypes[BasicType::NUMBER_OF_BASIC_TYPES][BasicType::NUMBER_OF_BASIC_TYPES] = { // nearest common ancestor" << endl452 code << "\t#define BT ast::BasicType::" << endl; 453 code << "\tstatic const BT Kind commonTypes[BT NUMBER_OF_BASIC_TYPES][BT NUMBER_OF_BASIC_TYPES] = { // nearest common ancestor" << endl 454 454 << "\t\t/*\t\t "; 455 455 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { // titles … … 505 505 "\t\t\t// - \"Di\" char32_t\n" 506 506 "\t\t\t// - \"Ds\" char16_t\n"; 507 508 code << "\t\t\tconst std::string basicTypes[ BasicType::NUMBER_OF_BASIC_TYPES] = {" << endl;507 508 code << "\t\t\tconst std::string basicTypes[ast::BasicType::NUMBER_OF_BASIC_TYPES] = {" << endl; 509 509 for ( int r = 0; r < NUMBER_OF_BASIC_TYPES; r += 1 ) { 510 510 code << "\t\t\t\t\"" << graph[r].mangled << "\"," << setw(9 - strlen(graph[r].mangled)) << ' ' << "// " << graph[r].type << endl; 511 } // for 511 } // for 512 512 code << "\t\t\t}; // basicTypes" << endl; 513 513 code << "\t\t\t"; // indentation for end marker
Note: See TracChangeset
for help on using the changeset viewer.