Changeset 1523:833337c65fd3
- Timestamp:
- 07/06/09 18:54:02 (1 year ago)
- Files:
-
- dmd2/expression.c (modified) (2 diffs)
- gen/main.cpp (modified) (1 diff)
- gen/runtime.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
dmd2/expression.c
Revision 1465:dd72f56ad211 Revision 1523:833337c65fd3 8729 } 8729 } 8730 8730 8731 Expression *ShlAssignExp::semantic(Scope *sc) 8731 Expression *ShlAssignExp::semantic(Scope *sc) 8732 { Expression *e; 8732 { Expression *e; 8733 8733 8734 //printf("ShlAssignExp::semantic()\n"); 8734 //printf("ShlAssignExp::semantic()\n"); 8735 BinExp::semantic(sc); 8735 BinExp::semantic(sc); 8736 e2 = resolveProperties(sc, e2); 8736 e2 = resolveProperties(sc, e2); 8737 8737 8738 e = op_overload(sc); 8738 e = op_overload(sc); 8739 if (e) 8739 if (e) 8740 return e; 8740 return e; 8741 8741 8742 e1 = e1->modifiableLvalue(sc, e1); 8742 e1 = e1->modifiableLvalue(sc, e1); 8743 e1->checkScalar(); 8743 e1->checkScalar(); 8744 e1->checkNoBool(); 8744 e1->checkNoBool(); 8745 type = e1->type; 8745 type = e1->type; 8746 typeCombine(sc); 8746 typeCombine(sc); 8747 e1->checkIntegral(); 8747 e1->checkIntegral(); 8748 e2 = e2->checkIntegral(); 8748 e2 = e2->checkIntegral(); 8749 //e2 = e2->castTo(sc, Type::tshiftcnt); 8749 #if IN_DMD 8750 e2 = e2->castTo(sc, e1->type); // LDC 8750 e2 = e2->castTo(sc, Type::tshiftcnt); 8751 #elif IN_LLVM 8752 e2 = e2->castTo(sc, e1->type); 8753 #endif 8751 return this; 8754 return this; 8752 } 8755 } 8753 8756 8754 /************************************************************/ 8757 /************************************************************/ 8755 8758 8756 ShrAssignExp::ShrAssignExp(Loc loc, Expression *e1, Expression *e2) 8759 ShrAssignExp::ShrAssignExp(Loc loc, Expression *e1, Expression *e2) 8757 : BinExp(loc, TOKshrass, sizeof(ShrAssignExp), e1, e2) 8760 : BinExp(loc, TOKshrass, sizeof(ShrAssignExp), e1, e2) 8758 { 8761 { 8759 } 8762 } 8760 8763 8761 Expression *ShrAssignExp::semantic(Scope *sc) 8764 Expression *ShrAssignExp::semantic(Scope *sc) 8762 { Expression *e; 8765 { Expression *e; 8763 8766 8764 BinExp::semantic(sc); 8767 BinExp::semantic(sc); 8765 e2 = resolveProperties(sc, e2); 8768 e2 = resolveProperties(sc, e2); 8766 8769 8767 e = op_overload(sc); 8770 e = op_overload(sc); 8768 if (e) 8771 if (e) 8769 return e; 8772 return e; 8770 8773 8771 e1 = e1->modifiableLvalue(sc, e1); 8774 e1 = e1->modifiableLvalue(sc, e1); 8772 e1->checkScalar(); 8775 e1->checkScalar(); 8773 e1->checkNoBool(); 8776 e1->checkNoBool(); 8774 type = e1->type; 8777 type = e1->type; 8775 typeCombine(sc); 8778 typeCombine(sc); 8776 e1->checkIntegral(); 8779 e1->checkIntegral(); 8777 e2 = e2->checkIntegral(); 8780 e2 = e2->checkIntegral(); 8778 //e2 = e2->castTo(sc, Type::tshiftcnt); 8781 #if IN_DMD 8779 e2 = e2->castTo(sc, e1->type); // LDC 8782 e2 = e2->castTo(sc, Type::tshiftcnt); 8783 #elif IN_LLVM 8784 e2 = e2->castTo(sc, e1->type); 8785 #endif 8780 return this; 8786 return this; 8781 } 8787 } 8782 8788 8783 /************************************************************/ 8789 /************************************************************/ 8784 8790 8785 UshrAssignExp::UshrAssignExp(Loc loc, Expression *e1, Expression *e2) 8791 UshrAssignExp::UshrAssignExp(Loc loc, Expression *e1, Expression *e2) 8786 : BinExp(loc, TOKushrass, sizeof(UshrAssignExp), e1, e2) 8792 : BinExp(loc, TOKushrass, sizeof(UshrAssignExp), e1, e2) 8787 { 8793 { 8788 } 8794 } 8789 8795 8790 Expression *UshrAssignExp::semantic(Scope *sc) 8796 Expression *UshrAssignExp::semantic(Scope *sc) 8791 { Expression *e; 8797 { Expression *e; 8792 8798 8793 BinExp::semantic(sc); 8799 BinExp::semantic(sc); 8794 e2 = resolveProperties(sc, e2); 8800 e2 = resolveProperties(sc, e2); 8795 8801 8796 e = op_overload(sc); 8802 e = op_overload(sc); 8797 if (e) 8803 if (e) 8798 return e; 8804 return e; 8799 8805 … … 9326 } 9332 } 9327 9333 9328 /************************************************************/ 9334 /************************************************************/ 9329 9335 9330 ShrExp::ShrExp(Loc loc, Expression *e1, Expression *e2) 9336 ShrExp::ShrExp(Loc loc, Expression *e1, Expression *e2) 9331 : BinExp(loc, TOKshr, sizeof(ShrExp), e1, e2) 9337 : BinExp(loc, TOKshr, sizeof(ShrExp), e1, e2) 9332 { 9338 { 9333 } 9339 } 9334 9340 9335 Expression *ShrExp::semantic(Scope *sc) 9341 Expression *ShrExp::semantic(Scope *sc) 9336 { Expression *e; 9342 { Expression *e; 9337 9343 9338 if (!type) 9344 if (!type) 9339 { BinExp::semanticp(sc); 9345 { BinExp::semanticp(sc); 9340 e = op_overload(sc); 9346 e = op_overload(sc); 9341 if (e) 9347 if (e) 9342 return e; 9348 return e; 9343 e1 = e1->checkIntegral(); 9349 e1 = e1->checkIntegral(); 9344 e2 = e2->checkIntegral(); 9350 e2 = e2->checkIntegral(); 9345 e1 = e1->integralPromotions(sc); 9351 e1 = e1->integralPromotions(sc); 9346 e2 = e2->castTo(sc, Type::tshiftcnt); 9352 //e2 = e2->castTo(sc, Type::tshiftcnt); 9353 e2 = e2->castTo(sc, e1->type); // LDC 9347 type = e1->type; 9354 type = e1->type; 9348 } 9355 } 9349 return this; 9356 return this; 9350 } 9357 } 9351 9358 9352 /************************************************************/ 9359 /************************************************************/ 9353 9360 9354 UshrExp::UshrExp(Loc loc, Expression *e1, Expression *e2) 9361 UshrExp::UshrExp(Loc loc, Expression *e1, Expression *e2) 9355 : BinExp(loc, TOKushr, sizeof(UshrExp), e1, e2) 9362 : BinExp(loc, TOKushr, sizeof(UshrExp), e1, e2) 9356 { 9363 { 9357 } 9364 } 9358 9365 9359 Expression *UshrExp::semantic(Scope *sc) 9366 Expression *UshrExp::semantic(Scope *sc) 9360 { Expression *e; 9367 { Expression *e; 9361 9368 9362 if (!type) 9369 if (!type) 9363 { BinExp::semanticp(sc); 9370 { BinExp::semanticp(sc); 9364 e = op_overload(sc); 9371 e = op_overload(sc); 9365 if (e) 9372 if (e) 9366 return e; 9373 return e; 9367 e1 = e1->checkIntegral(); 9374 e1 = e1->checkIntegral(); 9368 e2 = e2->checkIntegral(); 9375 e2 = e2->checkIntegral(); 9369 e1 = e1->integralPromotions(sc); 9376 e1 = e1->integralPromotions(sc); 9370 e2 = e2->castTo(sc, Type::tshiftcnt); 9377 //e2 = e2->castTo(sc, Type::tshiftcnt); 9378 e2 = e2->castTo(sc, e1->type); // LDC 9371 type = e1->type; 9379 type = e1->type; 9372 } 9380 } 9373 return this; 9381 return this; 9374 } 9382 } 9375 9383 9376 /************************************************************/ 9384 /************************************************************/ 9377 9385 9378 AndExp::AndExp(Loc loc, Expression *e1, Expression *e2) 9386 AndExp::AndExp(Loc loc, Expression *e1, Expression *e2) 9379 : BinExp(loc, TOKand, sizeof(AndExp), e1, e2) 9387 : BinExp(loc, TOKand, sizeof(AndExp), e1, e2) 9380 { 9388 { 9381 } 9389 } 9382 9390 9383 Expression *AndExp::semantic(Scope *sc) 9391 Expression *AndExp::semantic(Scope *sc) 9384 { Expression *e; 9392 { Expression *e; 9385 9393 9386 if (!type) 9394 if (!type) 9387 { BinExp::semanticp(sc); 9395 { BinExp::semanticp(sc); 9388 e = op_overload(sc); 9396 e = op_overload(sc); 9389 if (e) 9397 if (e) 9390 return e; 9398 return e; gen/main.cpp
Revision 1484:7d3b47852a7a Revision 1523:833337c65fd3 294 { 294 { 295 libs = global.params.debuglibnames; 295 libs = global.params.debuglibnames; 296 llvm::NoFramePointerElim = true; 296 llvm::NoFramePointerElim = true; 297 } 297 } 298 else 298 else 299 libs = global.params.defaultlibnames; 299 libs = global.params.defaultlibnames; 300 300 301 if (libs) 301 if (libs) 302 { 302 { 303 for (int i = 0; i < libs->dim; i++) 303 for (int i = 0; i < libs->dim; i++) 304 { 304 { 305 char* lib = (char *)libs->data[i]; 305 char* lib = (char *)libs->data[i]; 306 char *arg = (char *)mem.malloc(strlen(lib) + 3); 306 char *arg = (char *)mem.malloc(strlen(lib) + 3); 307 strcpy(arg, "-l"); 307 strcpy(arg, "-l"); 308 strcpy(arg+2, lib); 308 strcpy(arg+2, lib); 309 global.params.linkswitches->push(arg); 309 global.params.linkswitches->push(arg); 310 } 310 } 311 } 311 } 312 else if (!noDefaultLib) 312 else if (!noDefaultLib) 313 { 313 { 314 #if !DMDV2 314 global.params.linkswitches->push(mem.strdup("-lldc-runtime")); 315 global.params.linkswitches->push(mem.strdup("-lldc-runtime")); 315 global.params.linkswitches->push(mem.strdup("-ltango-cc-tango")); 316 global.params.linkswitches->push(mem.strdup("-ltango-cc-tango")); 316 global.params.linkswitches->push(mem.strdup("-ltango-gc-basic")); 317 global.params.linkswitches->push(mem.strdup("-ltango-gc-basic")); 317 // pass the runtime again to resolve issues 318 // pass the runtime again to resolve issues 318 // with linking order 319 // with linking order 319 global.params.linkswitches->push(mem.strdup("-lldc-runtime")); 320 global.params.linkswitches->push(mem.strdup("-lldc-runtime")); 321 #endif 320 } 322 } 321 323 322 if (global.params.run) 324 if (global.params.run) 323 quiet = 1; 325 quiet = 1; 324 326 325 if (global.params.useUnitTests) 327 if (global.params.useUnitTests) 326 global.params.useAssert = 1; 328 global.params.useAssert = 1; 327 329 328 // LDC output determination 330 // LDC output determination 329 331 330 // if we don't link, autodetect target from extension 332 // if we don't link, autodetect target from extension 331 if(!global.params.link && global.params.objname) { 333 if(!global.params.link && global.params.objname) { 332 ext = FileName::ext(global.params.objname); 334 ext = FileName::ext(global.params.objname); 333 bool autofound = false; 335 bool autofound = false; 334 if (!ext) { 336 if (!ext) { 335 // keep things as they are 337 // keep things as they are 336 } else if (strcmp(ext, global.ll_ext) == 0) { 338 } else if (strcmp(ext, global.ll_ext) == 0) { 337 global.params.output_ll = OUTPUTFLAGset; 339 global.params.output_ll = OUTPUTFLAGset; 338 autofound = true; 340 autofound = true; 339 } else if (strcmp(ext, global.bc_ext) == 0) { 341 } else if (strcmp(ext, global.bc_ext) == 0) { gen/runtime.cpp
Revision 1512:09734fb929c0 Revision 1523:833337c65fd3 311 ->setAttributes(Attr_NoAlias_3_NoCapture); 311 ->setAttributes(Attr_NoAlias_3_NoCapture); 312 } 312 } 313 313 314 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) 314 // void* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) 315 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) 315 // void* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, void* pdata) 316 { 316 { 317 std::string fname("_d_arraysetlengthT"); 317 std::string fname("_d_arraysetlengthT"); 318 std::string fname2("_d_arraysetlengthiT"); 318 std::string fname2("_d_arraysetlengthiT"); 319 std::vector<const LLType*> types; 319 std::vector<const LLType*> types; 320 types.push_back(typeInfoTy); 320 types.push_back(typeInfoTy); 321 types.push_back(sizeTy); 321 types.push_back(sizeTy); 322 types.push_back(sizeTy); 322 types.push_back(sizeTy); 323 types.push_back(voidPtrTy); 323 types.push_back(voidPtrTy); 324 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 324 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 325 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 325 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 326 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 326 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname2, M); 327 } 327 } 328 328 329 // Object _d_allocclass(ClassInfo ci) 329 // Object _d_allocclass(ClassInfo ci) 330 { 330 { 331 #if DMDV2 332 std::string fname("_d_newclass"); 333 #else 331 std::string fname("_d_allocclass"); 334 std::string fname("_d_allocclass"); 335 #endif 332 std::vector<const LLType*> types; 336 std::vector<const LLType*> types; 333 types.push_back(classInfoTy); 337 types.push_back(classInfoTy); 334 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 338 const llvm::FunctionType* fty = llvm::FunctionType::get(voidPtrTy, types, false); 335 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) 339 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M) 336 ->setAttributes(Attr_NoAlias); 340 ->setAttributes(Attr_NoAlias); 337 } 341 } 338 342 339 // void _d_delarray(size_t plength, void* pdata) 343 // void _d_delarray(size_t plength, void* pdata) 340 { 344 { 341 std::string fname("_d_delarray"); 345 std::string fname("_d_delarray"); 342 std::vector<const LLType*> types; 346 std::vector<const LLType*> types; 343 types.push_back(sizeTy); 347 types.push_back(sizeTy); 344 types.push_back(voidPtrTy); 348 types.push_back(voidPtrTy); 345 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 349 const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false); 346 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 350 llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M); 347 } 351 } 348 352 349 // void _d_delmemory(void* p) 353 // void _d_delmemory(void* p) 350 // void _d_delinterface(void* p) 354 // void _d_delinterface(void* p) 351 // void _d_callfinalizer(void* p) 355 // void _d_callfinalizer(void* p)

