comparison gen/llvmhelpers.cpp @ 1534:8ca25bd765a3

Build fix for the latest LLVMContext changes (LLVM r75445) This shouldn't break the build with older LLVM revs. We include LLVMContext.h in gen/llvm.h now to make the transition a little bit easier.
author Benjamin Kramer <benny.kra@gmail.com>
date Mon, 13 Jul 2009 12:17:58 +0200
parents 0f08b145b878
children 61f12f4651b5
comparison
equal deleted inserted replaced
1533:d1652c8fb4f6 1534:8ca25bd765a3
462 462
463 // complex, needs to be first since complex are also floating 463 // complex, needs to be first since complex are also floating
464 if (basetype->iscomplex()) 464 if (basetype->iscomplex())
465 { 465 {
466 const LLType* basefp = DtoComplexBaseType(basetype); 466 const LLType* basefp = DtoComplexBaseType(basetype);
467 LLValue* res = DtoAggrPair(DtoType(type), LLConstant::getNullValue(basefp), LLConstant::getNullValue(basefp)); 467 LLValue* res = DtoAggrPair(DtoType(type), llvm::getGlobalContext().getNullValue(basefp), llvm::getGlobalContext().getNullValue(basefp));
468 return new DImValue(type, res); 468 return new DImValue(type, res);
469 } 469 }
470 // integer, floating, pointer and class have no special representation 470 // integer, floating, pointer and class have no special representation
471 else if (basetype->isintegral() || basetype->isfloating() || basety == Tpointer || basety == Tclass) 471 else if (basetype->isintegral() || basetype->isfloating() || basety == Tpointer || basety == Tclass)
472 { 472 {
473 return new DConstValue(type, LLConstant::getNullValue(lltype)); 473 return new DConstValue(type, llvm::getGlobalContext().getNullValue(lltype));
474 } 474 }
475 // dynamic array 475 // dynamic array
476 else if (basety == Tarray) 476 else if (basety == Tarray)
477 { 477 {
478 LLValue* len = DtoConstSize_t(0); 478 LLValue* len = DtoConstSize_t(0);
480 return new DSliceValue(type, len, ptr); 480 return new DSliceValue(type, len, ptr);
481 } 481 }
482 // delegate 482 // delegate
483 else if (basety == Tdelegate) 483 else if (basety == Tdelegate)
484 { 484 {
485 return new DNullValue(type, LLConstant::getNullValue(lltype)); 485 return new DNullValue(type, llvm::getGlobalContext().getNullValue(lltype));
486 } 486 }
487 487
488 // unknown 488 // unknown
489 llvm::cout << "unsupported: null value for " << type->toChars() << '\n'; 489 llvm::cout << "unsupported: null value for " << type->toChars() << '\n';
490 assert(0); 490 assert(0);
575 Logger::cout() << "src: " << *src << "to type: " << *tolltype << '\n'; 575 Logger::cout() << "src: " << *src << "to type: " << *tolltype << '\n';
576 rval = DtoBitCast(src, tolltype); 576 rval = DtoBitCast(src, tolltype);
577 } 577 }
578 else if (totype->ty == Tbool) { 578 else if (totype->ty == Tbool) {
579 LLValue* src = val->getRVal(); 579 LLValue* src = val->getRVal();
580 LLValue* zero = LLConstant::getNullValue(src->getType()); 580 LLValue* zero = llvm::getGlobalContext().getNullValue(src->getType());
581 rval = gIR->ir->CreateICmpNE(src, zero, "tmp"); 581 rval = gIR->ir->CreateICmpNE(src, zero, "tmp");
582 } 582 }
583 else if (totype->isintegral()) { 583 else if (totype->isintegral()) {
584 rval = new llvm::PtrToIntInst(val->getRVal(), tolltype, "tmp", gIR->scopebb()); 584 rval = new llvm::PtrToIntInst(val->getRVal(), tolltype, "tmp", gIR->scopebb());
585 } 585 }
607 607
608 LLValue* rval; 608 LLValue* rval;
609 609
610 if (totype->ty == Tbool) { 610 if (totype->ty == Tbool) {
611 rval = val->getRVal(); 611 rval = val->getRVal();
612 LLValue* zero = LLConstant::getNullValue(rval->getType()); 612 LLValue* zero = llvm::getGlobalContext().getNullValue(rval->getType());
613 rval = gIR->ir->CreateFCmpUNE(rval, zero, "tmp"); 613 rval = gIR->ir->CreateFCmpUNE(rval, zero, "tmp");
614 } 614 }
615 else if (totype->iscomplex()) { 615 else if (totype->iscomplex()) {
616 return DtoComplex(loc, to, val); 616 return DtoComplex(loc, to, val);
617 } 617 }
1122 } 1122 }
1123 else if (init->isVoidInitializer()) 1123 else if (init->isVoidInitializer())
1124 { 1124 {
1125 Logger::println("const void initializer"); 1125 Logger::println("const void initializer");
1126 const LLType* ty = DtoType(type); 1126 const LLType* ty = DtoType(type);
1127 _init = llvm::Constant::getNullValue(ty); 1127 _init = llvm::getGlobalContext().getNullValue(ty);
1128 } 1128 }
1129 else { 1129 else {
1130 Logger::println("unsupported const initializer: %s", init->toChars()); 1130 Logger::println("unsupported const initializer: %s", init->toChars());
1131 } 1131 }
1132 return _init; 1132 return _init;