Changeset 758:f04dde6e882c
- Timestamp:
- 11/10/08 19:38:48 (2 months ago)
- Files:
-
- CMakeLists.txt (modified) (6 diffs)
- dmd/mtype.h (modified) (1 diff)
- dmd2/access.c (added)
- dmd2/aggregate.h (added)
- dmd2/array.c (added)
- dmd2/arrayop.c (added)
- dmd2/arraytypes.h (added)
- dmd2/artistic.txt (added)
- dmd2/attrib.c (added)
- dmd2/attrib.h (added)
- dmd2/builtin.c (added)
- dmd2/cast.c (added)
- dmd2/class.c (added)
- dmd2/clone.c (added)
- dmd2/complex_t.h (added)
- dmd2/cond.c (added)
- dmd2/cond.h (added)
- dmd2/constfold.c (added)
- dmd2/dchar.c (added)
- dmd2/dchar.h (added)
- dmd2/declaration.c (added)
- dmd2/declaration.h (added)
- dmd2/delegatize.c (added)
- dmd2/doc.c (added)
- dmd2/doc.h (added)
- dmd2/dsymbol.c (added)
- dmd2/dsymbol.h (added)
- dmd2/dump.c (added)
- dmd2/e2ir.c.nolink (added)
- dmd2/entity.c (added)
- dmd2/enum.c (added)
- dmd2/enum.h (added)
- dmd2/expression.c (added)
- dmd2/expression.h (added)
- dmd2/func.c (added)
- dmd2/gnuc.c (added)
- dmd2/gnuc.h (added)
- dmd2/gpl.txt (added)
- dmd2/hdrgen.c (added)
- dmd2/hdrgen.h (added)
- dmd2/html.c (added)
- dmd2/html.h (added)
- dmd2/id.c (added)
- dmd2/id.h (added)
- dmd2/identifier.c (added)
- dmd2/identifier.h (added)
- dmd2/idgen.c (added)
- dmd2/impcnvgen.c (added)
- dmd2/impcnvtab.c (added)
- dmd2/import.c (added)
- dmd2/import.h (added)
- dmd2/inifile.c (added)
- dmd2/init.c (added)
- dmd2/init.h (added)
- dmd2/inline.c (added)
- dmd2/interpret.c (added)
- dmd2/lexer.c (added)
- dmd2/lexer.h (added)
- dmd2/link.c.nolink (added)
- dmd2/lstring.c (added)
- dmd2/lstring.h (added)
- dmd2/macro.c (added)
- dmd2/macro.h (added)
- dmd2/man.c (added)
- dmd2/mangle.c (added)
- dmd2/mars.c (added)
- dmd2/mars.h (added)
- dmd2/mem.c (added)
- dmd2/mem.h (added)
- dmd2/module.c (added)
- dmd2/module.h (added)
- dmd2/mtype.c (added)
- dmd2/mtype.h (added)
- dmd2/opover.c (added)
- dmd2/optimize.c (added)
- dmd2/parse.c (added)
- dmd2/parse.h (added)
- dmd2/port.h (added)
- dmd2/readme.txt (added)
- dmd2/root.c (added)
- dmd2/root.h (added)
- dmd2/scope.c (added)
- dmd2/scope.h (added)
- dmd2/statement.c (added)
- dmd2/statement.h (added)
- dmd2/staticassert.c (added)
- dmd2/staticassert.h (added)
- dmd2/stringtable.c (added)
- dmd2/stringtable.h (added)
- dmd2/struct.c (added)
- dmd2/template.c (added)
- dmd2/template.h (added)
- dmd2/total.h (added)
- dmd2/traits.c (added)
- dmd2/unialpha.c (added)
- dmd2/utf.c (added)
- dmd2/utf.h (added)
- dmd2/version.c (added)
- dmd2/version.h (added)
- gen/arrays.cpp (modified) (11 diffs)
- gen/asmstmt.cpp (modified) (1 diff)
- gen/classes.cpp (modified) (1 diff)
- gen/functions.cpp (modified) (8 diffs)
- gen/llvmhelpers.cpp (modified) (7 diffs)
- gen/statements.cpp (modified) (4 diffs)
- gen/tocall.cpp (modified) (4 diffs)
- gen/tocsym.cpp (modified) (1 diff)
- gen/toir.cpp (modified) (10 diffs)
- gen/tollvm.cpp (modified) (2 diffs)
- gen/toobj.cpp (modified) (2 diffs)
- gen/typinf.cpp (modified) (10 diffs)
- ir/irlandingpad.cpp (modified) (1 diff)
- llvmdc.kdevelop (modified) (1 diff)
- llvmdc.kdevelop.filelist (modified) (3 diffs)
- premake.lua (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
CMakeLists.txt
r753 r758 40 40 string(REPLACE "/bin/llvm-config" "" LLVM_INSTDIR ${LLVM_CONFIG}) 41 41 42 set(D_VERSION 1 CACHE STRING "D language version") 43 if(D_VERSION EQUAL 1) 44 set(DMDFE_PATH dmd) 45 set(LDC_EXE ldc) 46 add_definitions(-DDMDV1) 47 elseif(D_VERSION EQUAL 2) 48 set(DMDFE_PATH dmd2) 49 set(LDC_EXE ldc2) 50 add_definitions(-DDMDV2) 51 else(D_VERSION EQUAL 1) 52 message(FATAL_ERROR "unsupported D version") 53 endif(D_VERSION EQUAL 1) 54 42 55 file(MAKE_DIRECTORY 43 56 ${PROJECT_BINARY_DIR}/bin 44 ${PROJECT_BINARY_DIR}/ dmd57 ${PROJECT_BINARY_DIR}/${DMDFE_PATH} 45 58 ) 46 59 47 60 # idgen and impcnvgen 48 61 set_source_files_properties( 49 dmd/idgen.c50 dmd/impcnvgen.c62 ${DMDFE_PATH}/idgen.c 63 ${DMDFE_PATH}/impcnvgen.c 51 64 PROPERTIES LANGUAGE CXX 52 65 ) 53 add_executable(idgen dmd/idgen.c)54 add_executable(impcnvgen dmd/impcnvgen.c)66 add_executable(idgen ${DMDFE_PATH}/idgen.c) 67 add_executable(impcnvgen ${DMDFE_PATH}/impcnvgen.c) 55 68 # cmake 2.4 56 69 set_target_properties( … … 63 76 add_custom_command( 64 77 OUTPUT 65 ${PROJECT_BINARY_DIR}/ dmd/id.c66 ${PROJECT_BINARY_DIR}/ dmd/id.h78 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.c 79 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.h 67 80 # 2.4 68 81 COMMAND ${IDGEN_LOC} 69 82 #COMMAND idgen 70 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/ dmd83 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} 71 84 DEPENDS idgen 72 85 ) 73 86 add_custom_command( 74 OUTPUT ${PROJECT_BINARY_DIR}/ dmd/impcnvtab.c87 OUTPUT ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/impcnvtab.c 75 88 # 2.4 76 89 COMMAND ${IMPCNVGEN_LOC} 77 90 #COMMAND impcnvgen 78 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/ dmd91 WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/${DMDFE_PATH} 79 92 DEPENDS impcnvgen 80 93 ) 81 94 set(LDC_GENERATED 82 ${PROJECT_BINARY_DIR}/ dmd/id.c83 ${PROJECT_BINARY_DIR}/ dmd/id.h84 ${PROJECT_BINARY_DIR}/ dmd/impcnvtab.c95 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.c 96 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/id.h 97 ${PROJECT_BINARY_DIR}/${DMDFE_PATH}/impcnvtab.c 85 98 ) 86 99 # idgen and impcnvgen done … … 88 101 set(DEFAULT_TARGET ${HOST_TARGET} CACHE STRING "default target") 89 102 90 include_directories(. dmd ${PROJECT_BINARY_DIR}/dmd${LLVM_INSTDIR}/include)103 include_directories(. ${DMDFE_PATH} ${PROJECT_BINARY_DIR}/${DMDFE_PATH} ${LLVM_INSTDIR}/include) 91 104 92 file(GLOB FE_SRC dmd/*.c)105 file(GLOB FE_SRC ${DMDFE_PATH}/*.c) 93 106 file(GLOB GEN_SRC gen/*.cpp) 94 107 file(GLOB IR_SRC ir/*.cpp) 95 108 # exclude idgen and impcnvgen and generated sources, just in case 96 109 list(REMOVE_ITEM FE_SRC 97 ${PROJECT_SOURCE_DIR}/ dmd/idgen.c98 ${PROJECT_SOURCE_DIR}/ dmd/impcnvgen.c99 ${PROJECT_SOURCE_DIR}/ dmd/id.c100 ${PROJECT_SOURCE_DIR}/ dmd/impcnvtab.c110 ${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 101 114 ) 102 115 set(LDC_SOURCE_FILES … … 116 129 -DOPAQUE_VTBLS 117 130 -DUSE_BOEHM_GC=0 118 -DDMDV1119 131 -DX86_REVERSE_PARAMS 120 132 -DX86_PASS_IN_EAX … … 132 144 endif(CMAKE_MINOR_VERSION LESS 6) 133 145 134 add_executable( ldc${LDC_SOURCE_FILES})146 add_executable(${LDC_EXE} ${LDC_SOURCE_FILES}) 135 147 136 148 set_target_properties( 137 ldcPROPERTIES149 ${LDC_EXE} PROPERTIES 138 150 RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin 139 COMPILE_FLAGS "${LLVM_CXXFLAGS} -Wno-deprecated "151 COMPILE_FLAGS "${LLVM_CXXFLAGS} -Wno-deprecated -Wno-write-strings" 140 152 ) 141 153 142 154 # 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}")155 target_link_libraries(${LDC_EXE} "${LLVM_LDFLAGS} ${LLVM_LIBS}") 144 156 if(WIN32) 145 target_link_libraries( ldcpsapi)157 target_link_libraries(${LDC_EXE} psapi) 146 158 #set(CONF_SUFFIX ini) 147 159 endif(WIN32) … … 149 161 # cmake pre 2.6 doesn't support the RUNTIME_OUTPUT_DIRECTORY target property 150 162 if(CMAKE_MINOR_VERSION LESS 6) 151 get_target_property(LDC_LOC ldcLOCATION)163 get_target_property(LDC_LOC ${LDC_EXE} LOCATION) 152 164 add_custom_command( 153 TARGET ldc165 TARGET ${LDC_EXE} 154 166 POST_BUILD 155 167 COMMAND ${CMAKE_COMMAND} -E copy ${LDC_LOC} ${PROJECT_BINARY_DIR}/bin/ dmd/mtype.h
r723 r758 369 369 370 370 // Back end 371 Symbol *aaGetSymbol(c har *func, int flags);371 Symbol *aaGetSymbol(const char *func, int flags); 372 372 373 373 type *toCtype(); gen/arrays.cpp
r715 r758 21 21 const LLStructType* DtoArrayType(Type* arrayTy) 22 22 { 23 assert(arrayTy->next );24 const LLType* elemty = DtoType(arrayTy->next );23 assert(arrayTy->nextOf()); 24 const LLType* elemty = DtoType(arrayTy->nextOf()); 25 25 if (elemty == LLType::VoidTy) 26 26 elemty = LLType::Int8Ty; … … 40 40 assert(t->ty == Tsarray); 41 41 TypeSArray* tsa = (TypeSArray*)t; 42 Type* tnext = tsa->next ;42 Type* tnext = tsa->nextOf(); 43 43 44 44 const LLType* elemty = DtoType(tnext); … … 239 239 std::vector<LLConstant*> inits(tdim, NULL); 240 240 241 Type* arrnext = arrinittype->next ;242 const LLType* elemty = DtoType(arrinittype->next );241 Type* arrnext = arrinittype->nextOf(); 242 const LLType* elemty = DtoType(arrinittype->nextOf()); 243 243 244 244 assert(arrinit->index.dim == arrinit->value.dim); … … 290 290 291 291 if (!v) 292 v = DtoConstInitializer(t->next , init);292 v = DtoConstInitializer(t->nextOf(), init); 293 293 assert(v); 294 294 … … 448 448 449 449 // 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(); 451 451 452 452 // call runtime … … 584 584 585 585 // handle prefix case, eg. int~int[] 586 if (t2->next && t1 == t2->next->toBasetype())586 if (t2->nextOf() && t1 == t2->nextOf()->toBasetype()) 587 587 { 588 588 len1 = DtoArrayLen(e2); … … 734 734 if (!skip) 735 735 { 736 Type* t = l->getType()->toBasetype()->next ->toBasetype();736 Type* t = l->getType()->toBasetype()->nextOf()->toBasetype(); 737 737 if (t->ty == Tchar) 738 738 res = DtoArrayEqCmp_impl(loc, "_adCmpChar", l, r, false); … … 852 852 return s->ptr; 853 853 else if (v->isNull()) 854 return getNullPtr(getPtrToType(DtoType(t->next )));854 return getNullPtr(getPtrToType(DtoType(t->nextOf()))); 855 855 else if (v->isLVal()) 856 856 return DtoLoad(DtoGEPi(v->getLVal(), 0,1), ".ptr"); … … 897 897 898 898 const LLType* ptrty = DtoArrayType(totype)->getContainedType(1); 899 const LLType* ety = DtoTypeNotVoid(fromtype->next );899 const LLType* ety = DtoTypeNotVoid(fromtype->nextOf()); 900 900 901 901 if (DSliceValue* usl = u->isSlice()) { … … 906 906 } 907 907 rval = DtoBitCast(usl->ptr, ptrty); 908 if (fromtype->next ->size() == totype->next->size())908 if (fromtype->nextOf()->size() == totype->nextOf()->size()) 909 909 rval2 = DtoArrayLen(usl); 910 910 else … … 921 921 const LLArrayType* arrty = isaArray(uval->getType()->getContainedType(0)); 922 922 923 if(arrty->getNumElements()*fromtype->next ->size() % totype->next->size() != 0)923 if(arrty->getNumElements()*fromtype->nextOf()->size() % totype->nextOf()->size() != 0) 924 924 { 925 925 error(loc, "invalid cast from '%s' to '%s', the element sizes don't line up", fromtype->toChars(), totype->toChars()); gen/asmstmt.cpp
r756 r758 7 7 //#include "d-gcc-includes.h" 8 8 //#include "total.h" 9 #include " dmd/statement.h"10 #include " dmd/scope.h"11 #include "d md/declaration.h"12 #include "d md/dsymbol.h"9 #include "statement.h" 10 #include "scope.h" 11 #include "declaration.h" 12 #include "dsymbol.h" 13 13 14 14 #include <cassert> gen/classes.cpp
r737 r758 1499 1499 inits.push_back(c); 1500 1500 1501 #if DMDV2 1502 1503 // xgetMembers 1504 c = defc->getOperand(13); 1505 inits.push_back(c); 1506 1507 #else 1508 #endif 1509 1501 1510 /*size_t n = inits.size(); 1502 1511 for (size_t i=0; i<n; ++i) gen/functions.cpp
r752 r758 33 33 } 34 34 35 bool typesafeVararg = false;35 bool dVararg = false; 36 36 bool arrayVararg = false; 37 37 if (f->linkage == LINKd) 38 38 { 39 39 if (f->varargs == 1) 40 typesafeVararg = true;40 dVararg = true; 41 41 else if (f->varargs == 2) 42 42 arrayVararg = true; … … 97 97 } 98 98 99 if ( typesafeVararg) {99 if (dVararg) { 100 100 ClassDeclaration* ti = Type::typeinfo; 101 101 ti->toObjFile(0); // TODO: multiobj … … 120 120 // extern(D) linkage 121 121 // not a D-style vararg 122 if (n > 1 && f->linkage == LINKd && ! typesafeVararg)122 if (n > 1 && f->linkage == LINKd && !dVararg) 123 123 { 124 124 f->reverseParams = true; … … 190 190 191 191 // construct function type 192 bool isvararg = !( typesafeVararg || arrayVararg) && f->varargs;192 bool isvararg = !(dVararg || arrayVararg) && f->varargs; 193 193 llvm::FunctionType* functype = llvm::FunctionType::get(actualRettype, paramvec, isvararg); 194 194 … … 721 721 if (global.params.symdebug) 722 722 DtoDwarfLocalVariable(thismem, fd->vthis); 723 723 724 #if DMDV2 725 if (fd->vthis->nestedrefs.dim) 726 #else 724 727 if (fd->vthis->nestedref) 728 #endif 729 { 725 730 fd->nestedVars.insert(fd->vthis); 731 } 726 732 } 727 733 … … 736 742 VarDeclaration* vd = argsym->isVarDeclaration(); 737 743 assert(vd); 738 744 745 #if DMDV2 746 if (vd->nestedrefs.dim) 747 #else 739 748 if (vd->nestedref) 749 #endif 750 { 740 751 fd->nestedVars.insert(vd); 752 } 741 753 742 754 IrLocal* irloc = vd->ir.irLocal; … … 758 770 } 759 771 760 // need result variable? (nested) 772 // need result variable? (nested) 773 #if DMDV2 774 if (fd->vresult && fd->vresult->nestedrefs.dim) { 775 #else 761 776 if (fd->vresult && fd->vresult->nestedref) { 777 #endif 762 778 Logger::println("nested vresult value: %s", fd->vresult->toChars()); 763 779 fd->nestedVars.insert(fd->vresult); … … 837 853 vd->ir.irLocal->nestedIndex = idx++; 838 854 } 839 855 840 856 // fixup nested result variable 857 #if DMDV2 858 if (fd->vresult && fd->vresult->nestedrefs.dim) { 859 #else 841 860 if (fd->vresult && fd->vresult->nestedref) { 861 #endif 842 862 Logger::println("nested vresult value: %s", fd->vresult->toChars()); 843 863 LLValue* gep = DtoGEPi(nestedVars, 0, fd->vresult->ir.irLocal->nestedIndex); gen/llvmhelpers.cpp
r757 r758 411 411 DtoArrayCopySlices(s, s2); 412 412 } 413 else if (t->next ->toBasetype()->equals(t2)) {413 else if (t->nextOf()->toBasetype()->equals(t2)) { 414 414 DtoArrayInit(loc, s, rhs); 415 415 } … … 442 442 } 443 443 // T[n] = T 444 else if (t->next ->toBasetype()->equals(t2)) {444 else if (t->nextOf()->toBasetype()->equals(t2)) { 445 445 DtoArrayInit(loc, lhs, rhs); 446 446 } 447 447 // 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())) { 449 449 DtoMemCpy(lhs->getLVal(), DtoArrayPtr(rhs), DtoArrayLen(rhs)); 450 450 } else { … … 532 532 { 533 533 LLValue* len = DtoConstSize_t(0); 534 LLValue* ptr = getNullPtr(getPtrToType(DtoType(basetype->next )));534 LLValue* ptr = getNullPtr(getPtrToType(DtoType(basetype->nextOf()))); 535 535 return new DSliceValue(type, len, ptr); 536 536 } … … 744 744 Type* at = to->toBasetype(); 745 745 assert(at->ty == Tarray); 746 Type* elem = at->next ->pointerTo();746 Type* elem = at->nextOf()->pointerTo(); 747 747 if (DSliceValue* slice = val->isSlice()) 748 748 { … … 1189 1189 1190 1190 // referenced by nested delegate? 1191 #if DMDV2 1192 if (vd->nestedrefs.dim) { 1193 #else 1191 1194 if (vd->nestedref) { 1195 #endif 1192 1196 Logger::println("has nestedref set"); 1193 1197 assert(vd->ir.irLocal); … … 1331 1335 1332 1336 // referenced by nested function? 1337 #if DMDV2 1338 if (var->nestedrefs.dim) 1339 #else 1333 1340 if (var->nestedref) 1341 #endif 1334 1342 { 1335 1343 assert(var->ir.irLocal); … … 1520 1528 TypeSArray* tsa = (TypeSArray*)t; 1521 1529 dims.push_back(tsa->dim->toInteger()); 1522 assert(t->next );1523 t = t->next ->toBasetype();1530 assert(t->nextOf()); 1531 t = t->nextOf()->toBasetype(); 1524 1532 } 1525 1533 gen/statements.cpp
r747 r758 354 354 355 355 // 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 } 359 367 360 368 // conditional branch … … 676 684 { 677 685 Type* dt = e->type->toBasetype(); 678 Type* dtnext = dt->next ->toBasetype();686 Type* dtnext = dt->nextOf()->toBasetype(); 679 687 TY ty = dtnext->ty; 680 688 const char* fname; … … 1027 1035 p->scope() = IRScope(endbb,oldend); 1028 1036 } 1037 1038 ////////////////////////////////////////////////////////////////////////////// 1039 1040 #if DMDV2 1041 1042 void 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 1029 1142 1030 1143 ////////////////////////////////////////////////////////////////////////////// … … 1292 1405 //STUBST(UnrolledLoopStatement); 1293 1406 //STUBST(OnScopeStatement); 1407 1408 #if DMDV2 1409 STUBST(PragmaStatement); 1410 #endif gen/tocall.cpp
r723 r758 23 23 else if (type->ty == Tdelegate) 24 24 { 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; 27 28 } 28 29 … … 427 428 } 428 429 429 #if 0430 Logger::println("% d params passed", n);430 #if 1 431 Logger::println("%lu params passed", args.size()); 431 432 for (int i=0; i<args.size(); ++i) { 432 433 assert(args[i]); … … 440 441 varname = "tmp"; 441 442 442 //Logger::cout() << "Calling: " << *funcval<< '\n';443 Logger::cout() << "Calling: " << *callable << '\n'; 443 444 444 445 // call the function … … 452 453 { 453 454 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 455 460 if (!rbase->equals(nextbase)) 456 461 { 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()); 458 463 switch(rbase->ty) 459 464 { gen/tocsym.cpp
r96 r758 208 208 */ 209 209 210 Symbol *TypeAArray::aaGetSymbol(c har *func, int flags)211 { 212 return 0; 213 } 214 210 Symbol *TypeAArray::aaGetSymbol(const char *func, int flags) 211 { 212 return 0; 213 } 214 gen/toir.cpp
r720 r758 104 104 } 105 105 // nested variable 106 #if DMDV2 107 else if (vd->nestedrefs.dim) { 108 #else 106 109 else if (vd->nestedref) { 110 #endif 107 111 Logger::println("nested variable"); 108 112 return DtoNestedVariable(loc, type, vd); … … 330 334 331 335 Type* dtype = type->toBasetype(); 332 Type* cty = dtype->next ->toBasetype();336 Type* cty = dtype->nextOf()->toBasetype(); 333 337 334 338 const LLType* ct = DtoTypeNotVoid(cty); 335 //printf("ct = %s\n", type->next ->toChars());339 //printf("ct = %s\n", type->nextOf()->toChars()); 336 340 const LLArrayType* at = LLArrayType::get(ct,len+1); 337 341 … … 397 401 398 402 Type* t = type->toBasetype(); 399 Type* cty = t->next ->toBasetype();403 Type* cty = t->nextOf()->toBasetype(); 400 404 401 405 bool nullterm = (t->ty != Tsarray); … … 501 505 Type* t = type->toBasetype(); 502 506 Type* e1type = e1->type->toBasetype(); 503 Type* e1next = e1type->next ? e1type->next->toBasetype() : NULL;507 Type* e1next = e1type->nextOf() ? e1type->nextOf()->toBasetype() : NULL; 504 508 Type* e2type = e2->type->toBasetype(); 505 509 … … 944 948 // indexing struct pointer 945 949 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(); 948 952 arrptr = DtoIndexStruct(l->getRVal(), ts->sym, vd); 949 953 } … … 1616 1620 else if( 1617 1621 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) 1620 1624 { 1621 1625 Logger::print("calling struct invariant"); … … 2067 2071 2068 2072 Type* e1type = e1->type->toBasetype(); 2069 Type* elemtype = e1type->next ->toBasetype();2073 Type* elemtype = e1type->nextOf()->toBasetype(); 2070 2074 Type* e2type = e2->type->toBasetype(); 2071 2075 … … 2201 2205 // extract D types 2202 2206 Type* bt = type->toBasetype(); 2203 Type* elemt = bt->next ;2207 Type* elemt = bt->nextOf(); 2204 2208 2205 2209 // build llvm array type … … 2359 2363 2360 2364 Type* aatype = type->toBasetype(); 2361 Type* vtype = aatype->next ;2365 Type* vtype = aatype->nextOf(); 2362 2366 const LLType* aalltype = DtoType(type); 2363 2367 … … 2423 2427 STUB(TupleExp); 2424 2428 2429 #if DMDV2 2430 STUB(SymbolExp); 2431 #endif 2432 2425 2433 #define CONSTSTUB(x) LLConstant* x::toConstElem(IRState * p) {error("const Exp type "#x" not implemented: '%s' type: '%s'", toChars(), type->toChars()); fatal(); return NULL; } 2426 2434 CONSTSTUB(Expression); gen/tollvm.cpp
r741 r758 103 103 case Tpointer: 104 104 // getPtrToType checks for void itself 105 return getPtrToType(DtoType(t->next ));105 return getPtrToType(DtoType(t->nextOf())); 106 106 107 107 // arrays … … 228 228 assert(t->ty == Tdelegate); 229 229 const LLType* i8ptr = getVoidPtrType(); 230 const LLType* func = DtoFunctionType(t->next , NULL, i8ptr);230 const LLType* func = DtoFunctionType(t->nextOf(), NULL, i8ptr); 231 231 const LLType* funcptr = getPtrToType(func); 232 232 return LLStructType::get(i8ptr, funcptr, 0); gen/toobj.cpp
r751 r758 145 145 RegisterDwarfSymbols(ir.module); 146 146 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(); 147 157 } 148 158 … … 994 1004 else 995 1005 { 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); 997 1015 } 998 1016 Logger::println("VarDeclaration::toObjFile is done"); gen/typinf.cpp
r663 r758 62 62 { 63 63 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 65 68 break; 66 69 … … 71 74 72 75 case Tarray: 73 if (t->next->ty != Tclass) 76
