Mercurial > projects > ldc
comparison gen/classes.cpp @ 821:8f0b24bc55f0
Added CMake option to disable generation of ClassInfo.offTi arrays, defaults to OFF.
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 02 Dec 2008 01:44:17 +0100 |
parents | 7d16ce7ad19d |
children | a70ddd449e7d |
comparison
equal
deleted
inserted
replaced
820:bb4a81e68ddb | 821:8f0b24bc55f0 |
---|---|
1310 irstruct->classInfo = new llvm::GlobalVariable(irstruct->classInfoOpaque.get(), false, DtoLinkage(cd), NULL, gname, gIR->module); | 1310 irstruct->classInfo = new llvm::GlobalVariable(irstruct->classInfoOpaque.get(), false, DtoLinkage(cd), NULL, gname, gIR->module); |
1311 } | 1311 } |
1312 | 1312 |
1313 ////////////////////////////////////////////////////////////////////////////////////////// | 1313 ////////////////////////////////////////////////////////////////////////////////////////// |
1314 | 1314 |
1315 #if GENERATE_OFFTI | |
1316 | |
1315 // build a single element for the OffsetInfo[] of ClassInfo | 1317 // build a single element for the OffsetInfo[] of ClassInfo |
1316 static LLConstant* build_offti_entry(ClassDeclaration* cd, VarDeclaration* vd) | 1318 static LLConstant* build_offti_entry(ClassDeclaration* cd, VarDeclaration* vd) |
1317 { | 1319 { |
1318 std::vector<LLConstant*> inits(2); | 1320 std::vector<LLConstant*> inits(2); |
1319 | 1321 |
1368 llvm::GlobalVariable* gvar = new llvm::GlobalVariable(arrTy,true,DtoInternalLinkage(cd),arrInit,name,gIR->module); | 1370 llvm::GlobalVariable* gvar = new llvm::GlobalVariable(arrTy,true,DtoInternalLinkage(cd),arrInit,name,gIR->module); |
1369 ptr = DtoBitCast(gvar, getPtrToType(arrTy->getElementType())); | 1371 ptr = DtoBitCast(gvar, getPtrToType(arrTy->getElementType())); |
1370 | 1372 |
1371 return DtoConstSlice(size, ptr); | 1373 return DtoConstSlice(size, ptr); |
1372 } | 1374 } |
1375 | |
1376 #endif // GENERATE_OFFTI | |
1373 | 1377 |
1374 static LLConstant* build_class_dtor(ClassDeclaration* cd) | 1378 static LLConstant* build_class_dtor(ClassDeclaration* cd) |
1375 { | 1379 { |
1376 FuncDeclaration* dtor = cd->dtor; | 1380 FuncDeclaration* dtor = cd->dtor; |
1377 | 1381 |
1579 inits.push_back(c); | 1583 inits.push_back(c); |
1580 | 1584 |
1581 // offset typeinfo | 1585 // offset typeinfo |
1582 VarDeclaration* offTiVar = (VarDeclaration*)cinfo->fields.data[9]; | 1586 VarDeclaration* offTiVar = (VarDeclaration*)cinfo->fields.data[9]; |
1583 const LLType* offTiTy = DtoType(offTiVar->type); | 1587 const LLType* offTiTy = DtoType(offTiVar->type); |
1588 | |
1589 #if GENERATE_OFFTI | |
1590 | |
1584 if (cd->isInterfaceDeclaration()) | 1591 if (cd->isInterfaceDeclaration()) |
1585 c = LLConstant::getNullValue(offTiTy); | 1592 c = LLConstant::getNullValue(offTiTy); |
1586 else | 1593 else |
1587 c = build_offti_array(cd, offTiTy); | 1594 c = build_offti_array(cd, offTiTy); |
1595 | |
1596 #else // GENERATE_OFFTI | |
1597 | |
1598 c = LLConstant::getNullValue(offTiTy); | |
1599 | |
1600 #endif // GENERATE_OFFTI | |
1601 | |
1588 inits.push_back(c); | 1602 inits.push_back(c); |
1589 | 1603 |
1590 // default constructor | 1604 // default constructor |
1591 if (cd->defaultCtor) | 1605 if (cd->defaultCtor) |
1592 { | 1606 { |
1604 VarDeclaration* xgetVar = (VarDeclaration*)cinfo->fields.data[11]; | 1618 VarDeclaration* xgetVar = (VarDeclaration*)cinfo->fields.data[11]; |
1605 const LLType* xgetTy = DtoType(xgetVar->type); | 1619 const LLType* xgetTy = DtoType(xgetVar->type); |
1606 | 1620 |
1607 // FIXME: fill it out! | 1621 // FIXME: fill it out! |
1608 inits.push_back( LLConstant::getNullValue(xgetTy) ); | 1622 inits.push_back( LLConstant::getNullValue(xgetTy) ); |
1609 | |
1610 #else | |
1611 #endif | 1623 #endif |
1612 | 1624 |
1613 /*size_t n = inits.size(); | 1625 /*size_t n = inits.size(); |
1614 for (size_t i=0; i<n; ++i) | 1626 for (size_t i=0; i<n; ++i) |
1615 { | 1627 { |