Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login
Show
Ignore:
Timestamp:
05/19/10 06:42:32 (2 years ago)
Author:
Tomas Lindquist Olsen
branch:
default
Message:

Update to work with LLVM 2.7.

Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).

Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.

Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gen/llvmhelpers.cpp

    r1643 r1650  
    161161    gIR->CreateCallOrInvoke(fn, args.begin(), args.end()); 
    162162 
     163    #ifndef DISABLE_DEBUG_INFO 
    163164    // end debug info 
    164165    if (global.params.symdebug) 
    165166        DtoDwarfFuncEnd(gIR->func()->decl); 
     167    #endif 
    166168 
    167169    // after assert is always unreachable 
     
    269271    // labels are a special case: they are not required to enclose the current scope 
    270272    // for them we use the enclosing scope handler as a reference point 
    271     LabelStatement* lblstmt = dynamic_cast<LabelStatement*>(target)
     273    LabelStatement* lblstmt = target ? target->isLabelStatement() : 0
    272274    if (lblstmt) 
    273275        target = lblstmt->enclosingScopeExit; 
     
    486488 
    487489    // unknown 
    488     llvm::cout << "unsupported: null value for " << type->toChars() << '\n'
     490    error("unsupported: null value for %s", type->toChars())
    489491    assert(0); 
    490492    return 0; 
     
    855857        gvar->setInitializer(initVal); 
    856858 
     859        #ifndef DISABLE_DEBUG_INFO 
    857860        // do debug info 
    858861        if (global.params.symdebug) 
     
    862865            gIR->usedArray.push_back(llvm::ConstantExpr::getBitCast(gv, getVoidPtrType())); 
    863866        } 
     867        #endif 
    864868    } 
    865869} 
     
    907911                assert(ex && "ref vars must have expression initializer"); 
    908912                assert(ex->exp); 
    909                 AssignExp* as = dynamic_cast<AssignExp*>(ex->exp); 
     913                AssignExp* as = ex->exp->isAssignExp(); 
    910914                assert(as && "ref vars must be initialized by an assign exp"); 
    911915                vd->ir.irLocal->value = as->e2->toElem(gIR)->getLVal(); 
    912916            } 
    913              
     917 
    914918            // referenced by nested delegate? 
    915919        #if DMDV2 
     
    920924                Logger::println("has nestedref set"); 
    921925                assert(vd->ir.irLocal); 
    922                  
     926 
    923927                DtoNestedInit(vd); 
    924928            } 
     
    938942                vd->ir.irLocal->value = allocainst; 
    939943 
     944                #ifndef DISABLE_DEBUG_INFO 
    940945                if (global.params.symdebug) 
    941                 { 
    942946                    DtoDwarfLocalVariable(allocainst, vd); 
    943                 } 
     947                #endif 
    944948            } 
    945949            else 
     
    10471051    // we don't handle aliases either 
    10481052    assert(!var->aliassym); 
    1049      
     1053 
    10501054    // alloca if necessary 
    10511055    LLValue* allocaval = NULL; 
     
    10531057    { 
    10541058        addr = DtoAlloca(var->type, var->toChars()); 
    1055          
     1059 
     1060        #ifndef DISABLE_DEBUG_INFO 
    10561061        // add debug info 
    10571062        if (global.params.symdebug) 
    10581063            DtoDwarfLocalVariable(addr, var); 
    1059     } 
    1060          
     1064        #endif 
     1065    } 
     1066 
    10611067    // referenced by nested function? 
    10621068#if DMDV2 
     
    12951301    Logger::println("template declaration: %s", td->toChars()); 
    12961302    Logger::println("intrinsic name: %s", td->intrinsicName.c_str()); 
    1297      
     1303 
    12981304    // for now use the size in bits of the first template param in the instance 
    12991305    assert(ti->tdtypes.dim == 1); 
     
    13081314    char tmp[21]; // probably excessive, but covers a uint64_t 
    13091315    sprintf(tmp, "%lu", (unsigned long) gTargetData->getTypeSizeInBits(DtoType(T))); 
    1310      
     1316 
    13111317    // replace # in name with bitsize 
    13121318    name = td->intrinsicName; 
     
    13311337        } 
    13321338    } 
    1333      
     1339 
    13341340    Logger::println("final intrinsic name: %s", name.c_str()); 
    13351341} 
     
    13411347    if (FuncDeclaration* fd = s->isFuncDeclaration()) 
    13421348    { 
    1343         // we can't (and probably shouldn't?) define functions  
     1349        // we can't (and probably shouldn't?) define functions 
    13441350        // that weren't semantic3'ed 
    13451351        if (fd->semanticRun < 4) 
     
    13531359            // These will get available_externally linkage, 
    13541360            // so they shouldn't end up in object code. 
    1355              
     1361 
    13561362            assert(fd->type->ty == Tfunction); 
    13571363            TypeFunction* tf = (TypeFunction*) fd->type; 
     
    13721378                return true; 
    13731379            } 
    1374              
     1380 
    13751381            // This was only semantic'ed for inlining checks. 
    13761382            // We won't be inlining this, so we only need to emit a declaration. 
     
    13971403        if (!opts::singleObj) 
    13981404            return true; 
    1399      
     1405 
    14001406        if (!tinst->emittedInModule) 
    14011407        { 
     
    14051411        return tinst->emittedInModule == gIR->dmodule; 
    14061412    } 
    1407      
     1413 
    14081414    return s->getModule() == gIR->dmodule; 
    14091415} 
Copyright © 2008, LDC Development Team.