Wiki Roadmap Timeline Tickets New Ticket Source Search Help / Guide About Trac Login

Changeset 758:f04dde6e882c

Show
Ignore:
Timestamp:
11/10/08 19:38:48 (2 months ago)
Author:
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
branch:
default
Message:

Added initial D2 support, D2 frontend and changes to codegen to make things compile.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • CMakeLists.txt

    r753 r758  
    4040string(REPLACE "/bin/llvm-config" "" LLVM_INSTDIR ${LLVM_CONFIG}) 
    4141 
     42set(D_VERSION 1 CACHE STRING "D language version") 
     43if(D_VERSION EQUAL 1) 
     44    set(DMDFE_PATH dmd) 
     45    set(LDC_EXE ldc) 
     46    add_definitions(-DDMDV1) 
     47elseif(D_VERSION EQUAL 2) 
     48    set(DMDFE_PATH dmd2) 
     49    set(LDC_EXE ldc2) 
     50    add_definitions(-DDMDV2) 
     51else(D_VERSION EQUAL 1) 
     52    message(FATAL_ERROR "unsupported D version") 
     53endif(D_VERSION EQUAL 1) 
     54 
    4255file(MAKE_DIRECTORY 
    4356    ${PROJECT_BINARY_DIR}/bin 
    44     ${PROJECT_BINARY_DIR}/dmd 
     57    ${PROJECT_BINARY_DIR}/${DMDFE_PATH} 
    4558) 
    4659 
    4760# idgen and impcnvgen 
    4861set_source_files_properties( 
    49     dmd/idgen.c 
    50     dmd/impcnvgen.c 
     62    ${DMDFE_PATH}/idgen.c 
     63    ${DMDFE_PATH}/impcnvgen.c 
    5164    PROPERTIES LANGUAGE CXX 
    5265) 
    53 add_executable(idgen dmd/idgen.c) 
    54 add_executable(impcnvgen dmd/impcnvgen.c) 
     66add_executable(idgen ${DMDFE_PATH}/idgen.c) 
     67add_executable(impcnvgen ${DMDFE_PATH}/impcnvgen.c) 
    5568# cmake 2.4 
    5669set_target_properties( 
     
    6376add_custom_command( 
    6477    OUTPUT 
    65         ${PROJECT_BINARY_DIR}/dmd/id.c 
    66         ${PROJECT_BINARY_DIR}/dmd/id.h 
     78        ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.c 
     79        ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.h 
    6780    # 2.4 
    6881    COMMAND ${IDGEN_LOC} 
    6982    #COMMAND idgen 
    70     WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/dmd 
     83    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} 
    7184    DEPENDS idgen 
    7285) 
    7386add_custom_command( 
    74     OUTPUT ${PROJECT_BINARY_DIR}/dmd/impcnvtab.c 
     87    OUTPUT ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/impcnvtab.c 
    7588    # 2.4 
    7689    COMMAND ${IMPCNVGEN_LOC} 
    7790    #COMMAND impcnvgen  
    78     WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/dmd 
     91    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} 
    7992    DEPENDS impcnvgen 
    8093) 
    8194set(LDC_GENERATED 
    82     ${PROJECT_BINARY_DIR}/dmd/id.c 
    83     ${PROJECT_BINARY_DIR}/dmd/id.h 
    84     ${PROJECT_BINARY_DIR}/dmd/impcnvtab.c 
     95    ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.c 
     96    ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.h 
     97    ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/impcnvtab.c 
    8598) 
    8699# idgen and impcnvgen done 
     
    88101set(DEFAULT_TARGET ${HOST_TARGET} CACHE STRING "default target") 
    89102 
    90 include_directories(. dmd ${PROJECT_BINARY_DIR}/dmd ${LLVM_INSTDIR}/include) 
     103include_directories(. ${DMDFE_PATH} ${PROJECT_BINARY_DIR}/${DMDFE_PATH} ${LLVM_INSTDIR}/include) 
    91104 
    92 file(GLOB FE_SRC dmd/*.c) 
     105file(GLOB FE_SRC ${DMDFE_PATH}/*.c) 
    93106file(GLOB GEN_SRC gen/*.cpp) 
    94107file(GLOB IR_SRC ir/*.cpp) 
    95108# exclude idgen and impcnvgen and generated sources, just in case 
    96109list(REMOVE_ITEM FE_SRC 
    97     ${PROJECT_SOURCE_DIR}/dmd/idgen.c 
    98     ${PROJECT_SOURCE_DIR}/dmd/impcnvgen.c 
    99     ${PROJECT_SOURCE_DIR}/dmd/id.c 
    100     ${PROJECT_SOURCE_DIR}/dmd/impcnvtab.c 
     110    ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/idgen.c 
     111    ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/impcnvgen.c 
     112    ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/id.c 
     113    ${PROJECT_SOURCE_DIR}/${DMDFE_PATH}/impcnvtab.c 
    101114) 
    102115set(LDC_SOURCE_FILES 
     
    116129    -DOPAQUE_VTBLS 
    117130    -DUSE_BOEHM_GC=0 
    118     -DDMDV1 
    119131    -DX86_REVERSE_PARAMS 
    120132    -DX86_PASS_IN_EAX 
     
    132144endif(CMAKE_MINOR_VERSION LESS 6) 
    133145 
    134 add_executable(ldc ${LDC_SOURCE_FILES}) 
     146add_executable(${LDC_EXE} ${LDC_SOURCE_FILES}) 
    135147 
    136148set_target_properties( 
    137     ldc PROPERTIES 
     149    ${LDC_EXE} PROPERTIES 
    138150    RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin 
    139     COMPILE_FLAGS "${LLVM_CXXFLAGS} -Wno-deprecated
     151    COMPILE_FLAGS "${LLVM_CXXFLAGS} -Wno-deprecated -Wno-write-strings
    140152) 
    141153 
    142154# LDFLAGS should actually be in target property LINK_FLAGS, but this works, and gets around linking problems 
    143 target_link_libraries(ldc "${LLVM_LDFLAGS} ${LLVM_LIBS}") 
     155target_link_libraries(${LDC_EXE} "${LLVM_LDFLAGS} ${LLVM_LIBS}") 
    144156if(WIN32) 
    145     target_link_libraries(ldc psapi) 
     157    target_link_libraries(${LDC_EXE} psapi) 
    146158    #set(CONF_SUFFIX ini) 
    147159endif(WIN32) 
     
    149161# cmake pre 2.6 doesn't support the RUNTIME_OUTPUT_DIRECTORY target property 
    150162if(CMAKE_MINOR_VERSION LESS 6) 
    151     get_target_property(LDC_LOC ldc LOCATION) 
     163    get_target_property(LDC_LOC ${LDC_EXE} LOCATION) 
    152164    add_custom_command( 
    153         TARGET ldc 
     165        TARGET ${LDC_EXE} 
    154166        POST_BUILD 
    155167        COMMAND ${CMAKE_COMMAND} -E copy ${LDC_LOC} ${PROJECT_BINARY_DIR}/bin/ 
  • dmd/mtype.h

    r723 r758  
    369369 
    370370    // Back end 
    371     Symbol *aaGetSymbol(char *func, int flags); 
     371    Symbol *aaGetSymbol(const char *func, int flags); 
    372372 
    373373    type *toCtype(); 
  • gen/arrays.cpp

    r715 r758  
    2121const LLStructType* DtoArrayType(Type* arrayTy) 
    2222{ 
    23     assert(arrayTy->next); 
    24     const LLType* elemty = DtoType(arrayTy->next); 
     23    assert(arrayTy->nextOf()); 
     24    const LLType* elemty = DtoType(arrayTy->nextOf()); 
    2525    if (elemty == LLType::VoidTy) 
    2626        elemty = LLType::Int8Ty; 
     
    4040    assert(t->ty == Tsarray); 
    4141    TypeSArray* tsa = (TypeSArray*)t; 
    42     Type* tnext = tsa->next
     42    Type* tnext = tsa->nextOf()
    4343 
    4444    const LLType* elemty = DtoType(tnext); 
     
    239239    std::vector<LLConstant*> inits(tdim, NULL); 
    240240 
    241     Type* arrnext = arrinittype->next
    242     const LLType* elemty = DtoType(arrinittype->next); 
     241    Type* arrnext = arrinittype->nextOf()
     242    const LLType* elemty = DtoType(arrinittype->nextOf()); 
    243243 
    244244    assert(arrinit->index.dim == arrinit->value.dim); 
     
    290290 
    291291        if (!v) 
    292             v = DtoConstInitializer(t->next, init); 
     292            v = DtoConstInitializer(t->nextOf(), init); 
    293293        assert(v); 
    294294 
     
    448448 
    449449    // decide on what runtime function to call based on whether the type is zero initialized 
    450     bool zeroInit = arrayType->toBasetype()->next->isZeroInit(); 
     450    bool zeroInit = arrayType->toBasetype()->nextOf()->isZeroInit(); 
    451451 
    452452    // call runtime 
     
    584584 
    585585    // handle prefix case, eg. int~int[] 
    586     if (t2->next && t1 == t2->next->toBasetype()) 
     586    if (t2->nextOf() && t1 == t2->nextOf()->toBasetype()) 
    587587    { 
    588588        len1 = DtoArrayLen(e2); 
     
    734734    if (!skip) 
    735735    { 
    736         Type* t = l->getType()->toBasetype()->next->toBasetype(); 
     736        Type* t = l->getType()->toBasetype()->nextOf()->toBasetype(); 
    737737        if (t->ty == Tchar) 
    738738            res = DtoArrayEqCmp_impl(loc, "_adCmpChar", l, r, false); 
     
    852852            return s->ptr; 
    853853        else if (v->isNull()) 
    854             return getNullPtr(getPtrToType(DtoType(t->next))); 
     854            return getNullPtr(getPtrToType(DtoType(t->nextOf()))); 
    855855        else if (v->isLVal()) 
    856856            return DtoLoad(DtoGEPi(v->getLVal(), 0,1), ".ptr"); 
     
    897897 
    898898        const LLType* ptrty = DtoArrayType(totype)->getContainedType(1); 
    899         const LLType* ety = DtoTypeNotVoid(fromtype->next); 
     899        const LLType* ety = DtoTypeNotVoid(fromtype->nextOf()); 
    900900 
    901901        if (DSliceValue* usl = u->isSlice()) { 
     
    906906            } 
    907907            rval = DtoBitCast(usl->ptr, ptrty); 
    908             if (fromtype->next->size() == totype->next->size()) 
     908            if (fromtype->nextOf()->size() == totype->nextOf()->size()) 
    909909                rval2 = DtoArrayLen(usl); 
    910910            else 
     
    921921                const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0)); 
    922922 
    923                 if(arrty->getNumElements()*fromtype->next->size() % totype->next->size() != 0) 
     923                if(arrty->getNumElements()*fromtype->nextOf()->size() % totype->nextOf()->size() != 0) 
    924924                { 
    925925                    error(loc, "invalid cast from '%s' to '%s', the element sizes don't line up", fromtype->toChars(), totype->toChars()); 
  • gen/asmstmt.cpp

    r756 r758  
    77//#include "d-gcc-includes.h" 
    88//#include "total.h" 
    9 #include "dmd/statement.h" 
    10 #include "dmd/scope.h" 
    11 #include "dmd/declaration.h" 
    12 #include "dmd/dsymbol.h" 
     9#include "statement.h" 
     10#include "scope.h" 
     11#include "declaration.h" 
     12#include "dsymbol.h" 
    1313 
    1414#include <cassert> 
  • gen/classes.cpp

    r737 r758  
    14991499    inits.push_back(c); 
    15001500 
     1501#if DMDV2 
     1502 
     1503    // xgetMembers 
     1504    c = defc->getOperand(13); 
     1505    inits.push_back(c); 
     1506 
     1507#else 
     1508#endif 
     1509 
    15011510    /*size_t n = inits.size(); 
    15021511    for (size_t i=0; i<n; ++i) 
  • gen/functions.cpp

    r752 r758  
    3333    } 
    3434 
    35     bool typesafeVararg = false; 
     35    bool dVararg = false; 
    3636    bool arrayVararg = false; 
    3737    if (f->linkage == LINKd) 
    3838    { 
    3939        if (f->varargs == 1) 
    40             typesafeVararg = true; 
     40            dVararg = true; 
    4141        else if (f->varargs == 2) 
    4242            arrayVararg = true; 
     
    9797    } 
    9898 
    99     if (typesafeVararg) { 
     99    if (dVararg) { 
    100100        ClassDeclaration* ti = Type::typeinfo; 
    101101        ti->toObjFile(0); // TODO: multiobj 
     
    120120        // extern(D) linkage 
    121121        // not a D-style vararg 
    122         if (n > 1 && f->linkage == LINKd && !typesafeVararg) 
     122        if (n > 1 && f->linkage == LINKd && !dVararg) 
    123123        { 
    124124            f->reverseParams = true; 
     
    190190 
    191191    // construct function type 
    192     bool isvararg = !(typesafeVararg || arrayVararg) && f->varargs; 
     192    bool isvararg = !(dVararg || arrayVararg) && f->varargs; 
    193193    llvm::FunctionType* functype = llvm::FunctionType::get(actualRettype, paramvec, isvararg); 
    194194 
     
    721721        if (global.params.symdebug) 
    722722            DtoDwarfLocalVariable(thismem, fd->vthis); 
    723          
     723 
     724    #if DMDV2 
     725        if (fd->vthis->nestedrefs.dim) 
     726    #else 
    724727        if (fd->vthis->nestedref) 
     728    #endif 
     729        { 
    725730            fd->nestedVars.insert(fd->vthis); 
     731        } 
    726732    } 
    727733 
     
    736742            VarDeclaration* vd = argsym->isVarDeclaration(); 
    737743            assert(vd); 
    738              
     744 
     745        #if DMDV2 
     746            if (vd->nestedrefs.dim) 
     747        #else 
    739748            if (vd->nestedref) 
     749        #endif 
     750            { 
    740751                fd->nestedVars.insert(vd); 
     752            } 
    741753 
    742754            IrLocal* irloc = vd->ir.irLocal; 
     
    758770    } 
    759771 
    760     // need result variable? (nested) 
     772// need result variable? (nested) 
     773#if DMDV2 
     774    if (fd->vresult && fd->vresult->nestedrefs.dim) { 
     775#else 
    761776    if (fd->vresult && fd->vresult->nestedref) { 
     777#endif 
    762778        Logger::println("nested vresult value: %s", fd->vresult->toChars()); 
    763779        fd->nestedVars.insert(fd->vresult); 
     
    837853            vd->ir.irLocal->nestedIndex = idx++; 
    838854        } 
    839          
     855 
    840856        // fixup nested result variable 
     857    #if DMDV2 
     858        if (fd->vresult && fd->vresult->nestedrefs.dim) { 
     859    #else 
    841860        if (fd->vresult && fd->vresult->nestedref) { 
     861    #endif 
    842862            Logger::println("nested vresult value: %s", fd->vresult->toChars()); 
    843863            LLValue* gep = DtoGEPi(nestedVars, 0, fd->vresult->ir.irLocal->nestedIndex); 
  • gen/llvmhelpers.cpp

    r757 r758  
    411411                DtoArrayCopySlices(s, s2); 
    412412            } 
    413             else if (t->next->toBasetype()->equals(t2)) { 
     413            else if (t->nextOf()->toBasetype()->equals(t2)) { 
    414414                DtoArrayInit(loc, s, rhs); 
    415415            } 
     
    442442        } 
    443443        // T[n] = T 
    444         else if (t->next->toBasetype()->equals(t2)) { 
     444        else if (t->nextOf()->toBasetype()->equals(t2)) { 
    445445            DtoArrayInit(loc, lhs, rhs); 
    446446        } 
    447447        // T[n] = T[] - generally only generated by frontend in rare cases 
    448         else if (t2->ty == Tarray && t->next->toBasetype()->equals(t2->next->toBasetype())) { 
     448        else if (t2->ty == Tarray && t->nextOf()->toBasetype()->equals(t2->nextOf()->toBasetype())) { 
    449449            DtoMemCpy(lhs->getLVal(), DtoArrayPtr(rhs), DtoArrayLen(rhs)); 
    450450        } else { 
     
    532532    { 
    533533        LLValue* len = DtoConstSize_t(0); 
    534         LLValue* ptr = getNullPtr(getPtrToType(DtoType(basetype->next))); 
     534        LLValue* ptr = getNullPtr(getPtrToType(DtoType(basetype->nextOf()))); 
    535535        return new DSliceValue(type, len, ptr); 
    536536    } 
     
    744744        Type* at = to->toBasetype(); 
    745745        assert(at->ty == Tarray); 
    746         Type* elem = at->next->pointerTo(); 
     746        Type* elem = at->nextOf()->pointerTo(); 
    747747        if (DSliceValue* slice = val->isSlice()) 
    748748        { 
     
    11891189 
    11901190            // referenced by nested delegate? 
     1191        #if DMDV2 
     1192            if (vd->nestedrefs.dim) { 
     1193        #else 
    11911194            if (vd->nestedref) { 
     1195        #endif 
    11921196                Logger::println("has nestedref set"); 
    11931197                assert(vd->ir.irLocal); 
     
    13311335 
    13321336    // referenced by nested function? 
     1337#if DMDV2 
     1338    if (var->nestedrefs.dim) 
     1339#else 
    13331340    if (var->nestedref) 
     1341#endif 
    13341342    { 
    13351343        assert(var->ir.irLocal); 
     
    15201528        TypeSArray* tsa = (TypeSArray*)t; 
    15211529        dims.push_back(tsa->dim->toInteger()); 
    1522         assert(t->next); 
    1523         t = t->next->toBasetype(); 
     1530        assert(t->nextOf()); 
     1531        t = t->nextOf()->toBasetype(); 
    15241532    } 
    15251533     
  • gen/statements.cpp

    r747 r758  
    354354 
    355355    // create the condition 
    356     DValue* cond_e = condition->toElem(p); 
    357     LLValue* cond_val = DtoBoolean(loc, cond_e); 
    358     delete cond_e; 
     356    LLValue* cond_val; 
     357    if (condition) 
     358    { 
     359        DValue* cond_e = condition->toElem(p); 
     360        cond_val = DtoBoolean(loc, cond_e); 
     361        delete cond_e; 
     362    } 
     363    else 
     364    { 
     365        cond_val = DtoConstBool(true); 
     366    } 
    359367 
    360368    // conditional branch 
     
    676684{ 
    677685    Type* dt = e->type->toBasetype(); 
    678     Type* dtnext = dt->next->toBasetype(); 
     686    Type* dtnext = dt->nextOf()->toBasetype(); 
    679687    TY ty = dtnext->ty; 
    680688    const char* fname; 
     
    10271035    p->scope() = IRScope(endbb,oldend); 
    10281036} 
     1037 
     1038////////////////////////////////////////////////////////////////////////////// 
     1039 
     1040#if DMDV2 
     1041 
     1042void ForeachRangeStatement::toIR(IRState* p) 
     1043{ 
     1044    Logger::println("ForeachRangeStatement::toIR(): %s", loc.toChars()); 
     1045    LOG_SCOPE; 
     1046 
     1047    if (global.params.symdebug) 
     1048        DtoDwarfStopPoint(loc.linnum); 
     1049 
     1050    // evaluate lwr/upr 
     1051    assert(lwr->type->isintegral()); 
     1052    LLValue* lower = lwr->toElem(p)->getRVal(); 
     1053    assert(upr->type->isintegral()); 
     1054    LLValue* upper = upr->toElem(p)->getRVal(); 
     1055 
     1056    // handle key 
     1057    assert(key->type->isintegral()); 
     1058    LLValue* keyval = DtoRawVarDeclaration(key); 
     1059 
     1060    // store initial value in key 
     1061    if (op == TOKforeach) 
     1062        DtoStore(lower, keyval); 
     1063    else 
     1064        DtoStore(upper, keyval); 
     1065 
     1066    // set up the block we'll need 
     1067    llvm::BasicBlock* oldend = gIR->scopeend(); 
     1068    llvm::BasicBlock* condbb = llvm::BasicBlock::Create("foreachrange_cond", p->topfunc(), oldend); 
     1069    llvm::BasicBlock* bodybb = llvm::BasicBlock::Create("foreachrange_body", p->topfunc(), oldend); 
     1070    llvm::BasicBlock* nextbb = llvm::BasicBlock::Create("foreachrange_next", p->topfunc(), oldend); 
     1071    llvm::BasicBlock* endbb = llvm::BasicBlock::Create("foreachrange_end", p->topfunc(), oldend); 
     1072 
     1073    // jump to condition 
     1074    llvm::BranchInst::Create(condbb, p->scopebb()); 
     1075 
     1076    // CONDITION 
     1077    p->scope() = IRScope(condbb,bodybb); 
     1078 
     1079    // first we test that lwr < upr 
     1080    lower = DtoLoad(keyval); 
     1081    assert(lower->getType() == upper->getType()); 
     1082    llvm::ICmpInst::Predicate cmpop; 
     1083    if (key->type->isunsigned()) 
     1084    { 
     1085        cmpop = (op == TOKforeach) 
     1086        ? llvm::ICmpInst::ICMP_ULT 
     1087        : llvm::ICmpInst::ICMP_UGT; 
     1088    } 
     1089    else 
     1090    { 
     1091        cmpop = (op == TOKforeach) 
     1092        ? llvm::ICmpInst::ICMP_SLT 
     1093        : llvm::ICmpInst::ICMP_SGT; 
     1094    } 
     1095    LLValue* cond = p->ir->CreateICmp(cmpop, lower, upper); 
     1096 
     1097    // jump to the body if range is ok, to the end if not 
     1098    llvm::BranchInst::Create(bodybb, endbb, cond, p->scopebb()); 
     1099 
     1100    // BODY 
     1101    p->scope() = IRScope(bodybb,nextbb); 
     1102 
     1103    // reverse foreach decrements here 
     1104    if (op == TOKforeach_reverse) 
     1105    { 
     1106        LLValue* v = DtoLoad(keyval); 
     1107        LLValue* one = LLConstantInt::get(v->getType(), 1, false); 
     1108        v = p->ir->CreateSub(v, one); 
     1109        DtoStore(v, keyval); 
     1110    } 
     1111 
     1112    // emit body 
     1113    p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,nextbb,endbb)); 
     1114    if (body) 
     1115        body->toIR(p); 
     1116    p->loopbbs.pop_back(); 
     1117 
     1118    // jump to next iteration 
     1119    if (!p->scopereturned()) 
     1120        llvm::BranchInst::Create(nextbb, p->scopebb()); 
     1121 
     1122    // NEXT 
     1123    p->scope() = IRScope(nextbb,endbb); 
     1124 
     1125    // forward foreach increments here 
     1126    if (op == TOKforeach) 
     1127    { 
     1128        LLValue* v = DtoLoad(keyval); 
     1129        LLValue* one = LLConstantInt::get(v->getType(), 1, false); 
     1130        v = p->ir->CreateAdd(v, one); 
     1131        DtoStore(v, keyval); 
     1132    } 
     1133 
     1134    // jump to condition 
     1135    llvm::BranchInst::Create(condbb, p->scopebb()); 
     1136 
     1137    // END 
     1138    p->scope() = IRScope(endbb,oldend); 
     1139} 
     1140 
     1141#endif // D2 
    10291142 
    10301143////////////////////////////////////////////////////////////////////////////// 
     
    12921405//STUBST(UnrolledLoopStatement); 
    12931406//STUBST(OnScopeStatement); 
     1407 
     1408#if DMDV2 
     1409STUBST(PragmaStatement); 
     1410#endif 
  • gen/tocall.cpp

    r723 r758  
    2323    else if (type->ty == Tdelegate) 
    2424    { 
    25         assert(type->next->ty == Tfunction); 
    26         return (TypeFunction*)type->next; 
     25        Type* next = type->nextOf(); 
     26        assert(next->ty == Tfunction); 
     27        return (TypeFunction*)next; 
    2728    } 
    2829 
     
    427428    } 
    428429 
    429     #if 0 
    430     Logger::println("%d params passed", n); 
     430    #if 1 
     431    Logger::println("%lu params passed", args.size()); 
    431432    for (int i=0; i<args.size(); ++i) { 
    432433        assert(args[i]); 
     
    440441        varname = "tmp"; 
    441442 
    442     //Logger::cout() << "Calling: " << *funcval << '\n'; 
     443    Logger::cout() << "Calling: " << *callable << '\n'; 
    443444 
    444445    // call the function 
     
    452453    { 
    453454        Type* rbase = resulttype->toBasetype(); 
    454         Type* nextbase = tf->next->toBasetype(); 
     455        Type* nextbase = tf->nextOf()->toBasetype(); 
     456    #if DMDV2 
     457        rbase = rbase->mutableOf(); 
     458        nextbase = nextbase->mutableOf(); 
     459    #endif 
    455460        if (!rbase->equals(nextbase)) 
    456461        { 
    457             Logger::println("repainting return value from '%s' to '%s'", tf->next->toChars(), rbase->toChars()); 
     462            Logger::println("repainting return value from '%s' to '%s'", tf->nextOf()->toChars(), rbase->toChars()); 
    458463            switch(rbase->ty) 
    459464            { 
  • gen/tocsym.cpp

    r96 r758  
    208208 */ 
    209209 
    210 Symbol *TypeAArray::aaGetSymbol(char *func, int flags) 
    211 { 
    212   return 0; 
    213 } 
    214  
     210Symbol *TypeAArray::aaGetSymbol(const char *func, int flags) 
     211{ 
     212  return 0; 
     213} 
     214 
  • gen/toir.cpp

    r720 r758  
    104104        } 
    105105        // nested variable 
     106    #if DMDV2 
     107        else if (vd->nestedrefs.dim) { 
     108    #else 
    106109        else if (vd->nestedref) { 
     110    #endif 
    107111            Logger::println("nested variable"); 
    108112            return DtoNestedVariable(loc, type, vd); 
     
    330334 
    331335    Type* dtype = type->toBasetype(); 
    332     Type* cty = dtype->next->toBasetype(); 
     336    Type* cty = dtype->nextOf()->toBasetype(); 
    333337 
    334338    const LLType* ct = DtoTypeNotVoid(cty); 
    335     //printf("ct = %s\n", type->next->toChars()); 
     339    //printf("ct = %s\n", type->nextOf()->toChars()); 
    336340    const LLArrayType* at = LLArrayType::get(ct,len+1); 
    337341 
     
    397401 
    398402    Type* t = type->toBasetype(); 
    399     Type* cty = t->next->toBasetype(); 
     403    Type* cty = t->nextOf()->toBasetype(); 
    400404 
    401405    bool nullterm = (t->ty != Tsarray); 
     
    501505    Type* t = type->toBasetype(); 
    502506    Type* e1type = e1->type->toBasetype(); 
    503     Type* e1next = e1type->next ? e1type->next->toBasetype() : NULL; 
     507    Type* e1next = e1type->nextOf() ? e1type->nextOf()->toBasetype() : NULL; 
    504508    Type* e2type = e2->type->toBasetype(); 
    505509 
     
    944948        // indexing struct pointer 
    945949        if (e1type->ty == Tpointer) { 
    946             assert(e1type->next->ty == Tstruct); 
    947             TypeStruct* ts = (TypeStruct*)e1type->next
     950            assert(e1type->nextOf()->ty == Tstruct); 
     951            TypeStruct* ts = (TypeStruct*)e1type->nextOf()
    948952            arrptr = DtoIndexStruct(l->getRVal(), ts->sym, vd); 
    949953        } 
     
    16161620    else if( 
    16171621        global.params.useInvariants &&  
    1618         condty->ty == Tpointer && condty->next->ty == Tstruct && 
    1619         (invdecl = ((TypeStruct*)condty->next)->sym->inv) != NULL) 
     1622        condty->ty == Tpointer && condty->nextOf()->ty == Tstruct && 
     1623        (invdecl = ((TypeStruct*)condty->nextOf())->sym->inv) != NULL) 
    16201624    { 
    16211625        Logger::print("calling struct invariant"); 
     
    20672071 
    20682072    Type* e1type = e1->type->toBasetype(); 
    2069     Type* elemtype = e1type->next->toBasetype(); 
     2073    Type* elemtype = e1type->nextOf()->toBasetype(); 
    20702074    Type* e2type = e2->type->toBasetype(); 
    20712075 
     
    22012205    // extract D types 
    22022206    Type* bt = type->toBasetype(); 
    2203     Type* elemt = bt->next
     2207    Type* elemt = bt->nextOf()
    22042208 
    22052209    // build llvm array type 
     
    23592363 
    23602364    Type* aatype = type->toBasetype(); 
    2361     Type* vtype = aatype->next
     2365    Type* vtype = aatype->nextOf()
    23622366    const LLType* aalltype = DtoType(type); 
    23632367 
     
    24232427STUB(TupleExp); 
    24242428 
     2429#if DMDV2 
     2430STUB(SymbolExp); 
     2431#endif 
     2432 
    24252433#define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) {error("const Exp type "#x" not implemented: '%s' type: '%s'", toChars(), type->toChars()); fatal(); return NULL; } 
    24262434CONSTSTUB(Expression); 
  • gen/tollvm.cpp

    r741 r758  
    103103    case Tpointer: 
    104104        // getPtrToType checks for void itself 
    105         return getPtrToType(DtoType(t->next)); 
     105        return getPtrToType(DtoType(t->nextOf())); 
    106106 
    107107    // arrays 
     
    228228    assert(t->ty == Tdelegate); 
    229229    const LLType* i8ptr = getVoidPtrType(); 
    230     const LLType* func = DtoFunctionType(t->next, NULL, i8ptr); 
     230    const LLType* func = DtoFunctionType(t->nextOf(), NULL, i8ptr); 
    231231    const LLType* funcptr = getPtrToType(func); 
    232232    return LLStructType::get(i8ptr, funcptr, 0); 
  • gen/toobj.cpp

    r751 r758  
    145145        RegisterDwarfSymbols(ir.module); 
    146146        DtoDwarfCompileUnit(this); 
     147    } 
     148 
     149    // handle invalid 'objectÞ module 
     150    if (!ClassDeclaration::object) { 
     151        error("is missing 'class Object'"); 
     152        fatal(); 
     153    } 
     154    if (!ClassDeclaration::classinfo) { 
     155        error("is missing 'class ClassInfo'"); 
     156        fatal(); 
    147157    } 
    148158 
     
    9941004    else 
    9951005    { 
    996         assert(ir.irField != 0); 
     1006    #if DMDV2 
     1007        if (!ir.irField) 
     1008        { 
     1009            printf("dataseg: %d\n", isDataseg()); 
     1010            printf("parent: %s %s\n", parent->kind(), parent->toPrettyChars()); 
     1011            printf("this: %s %s\n", this->kind(), this->toPrettyChars()); 
     1012        } 
     1013    #endif 
     1014//         assert(ir.irField != 0); 
    9971015    } 
    9981016    Logger::println("VarDeclaration::toObjFile is done"); 
  • gen/typinf.cpp

    r663 r758  
    6262    { 
    6363    case Tsarray: 
    64         t = t->next->arrayOf(); // convert to corresponding dynamic array type 
     64#if 0 
     65        // convert to corresponding dynamic array type 
     66        t = t->nextOf()->mutableOf()->arrayOf(); 
     67#endif 
    6568        break; 
    6669 
     
    7174 
    7275    case Tarray: 
    73         if (t->next->ty != Tclass) 
     76