comparison dmd/expression.c @ 664:eef8ac26c66c

Some missed LLVMDC -> LDC.
author Christian Kamm <kamm incasoftware de>
date Mon, 06 Oct 2008 22:54:08 +0200
parents 8aebdf56c455
children a26b0c5d5942
comparison
equal deleted inserted replaced
663:6aaa3d3c1183 664:eef8ac26c66c
265 if (f->vthis) 265 if (f->vthis)
266 { 266 {
267 //printf("rewriting e1 to %s's this\n", f->toChars()); 267 //printf("rewriting e1 to %s's this\n", f->toChars());
268 n++; 268 n++;
269 269
270 // LLVMDC seems dmd misses it sometimes here :/ 270 // LDC seems dmd misses it sometimes here :/
271 f->vthis->nestedref = 1; 271 f->vthis->nestedref = 1;
272 272
273 e1 = new VarExp(loc, f->vthis); 273 e1 = new VarExp(loc, f->vthis);
274 } 274 }
275 } 275 }
3754 type = type->semantic(loc, sc); 3754 type = type->semantic(loc, sc);
3755 } 3755 }
3756 #endif 3756 #endif
3757 } 3757 }
3758 3758
3759 // LLVMDC: Fixes bug 1161, http://d.puremagic.com/issues/show_bug.cgi?id=1161 3759 // LDC: Fixes bug 1161, http://d.puremagic.com/issues/show_bug.cgi?id=1161
3760 // check access to VarDeclaration 3760 // check access to VarDeclaration
3761 accessCheck(loc, sc, NULL, var); 3761 accessCheck(loc, sc, NULL, var);
3762 3762
3763 VarDeclaration *v = var->isVarDeclaration(); 3763 VarDeclaration *v = var->isVarDeclaration();
3764 if (v) 3764 if (v)
5553 printf("DelegateExp::semantic('%s')\n", toChars()); 5553 printf("DelegateExp::semantic('%s')\n", toChars());
5554 #endif 5554 #endif
5555 if (!type) 5555 if (!type)
5556 { 5556 {
5557 e1 = e1->semantic(sc); 5557 e1 = e1->semantic(sc);
5558 // LLVMDC we need a copy as we store the LLVM tpye in TypeFunction, and delegate/members have different types for 'this' 5558 // LDC we need a copy as we store the LLVM tpye in TypeFunction, and delegate/members have different types for 'this'
5559 type = new TypeDelegate(func->type->syntaxCopy()); 5559 type = new TypeDelegate(func->type->syntaxCopy());
5560 type = type->semantic(loc, sc); 5560 type = type->semantic(loc, sc);
5561 AggregateDeclaration *ad = func->toParent()->isAggregateDeclaration(); 5561 AggregateDeclaration *ad = func->toParent()->isAggregateDeclaration();
5562 if (func->needThis()) 5562 if (func->needThis())
5563 e1 = getRightThis(loc, sc, ad, e1, func); 5563 e1 = getRightThis(loc, sc, ad, e1, func);
6221 { 6221 {
6222 VarExp *dve = (VarExp *)e1; 6222 VarExp *dve = (VarExp *)e1;
6223 FuncDeclaration *f = dve->var->isFuncDeclaration(); 6223 FuncDeclaration *f = dve->var->isFuncDeclaration();
6224 VarDeclaration *v = dve->var->isVarDeclaration(); 6224 VarDeclaration *v = dve->var->isVarDeclaration();
6225 6225
6226 // LLVMDC 6226 // LDC
6227 if (f && f->isIntrinsic()) 6227 if (f && f->isIntrinsic())
6228 { 6228 {
6229 error("cannot take the address of intrinsic function %s", e1->toChars()); 6229 error("cannot take the address of intrinsic function %s", e1->toChars());
6230 return this; 6230 return this;
6231 } 6231 }
7841 type = e1->type; 7841 type = e1->type;
7842 typeCombine(sc); 7842 typeCombine(sc);
7843 e1->checkIntegral(); 7843 e1->checkIntegral();
7844 e2 = e2->checkIntegral(); 7844 e2 = e2->checkIntegral();
7845 //e2 = e2->castTo(sc, Type::tshiftcnt); 7845 //e2 = e2->castTo(sc, Type::tshiftcnt);
7846 e2 = e2->castTo(sc, e1->type); // LLVMDC 7846 e2 = e2->castTo(sc, e1->type); // LDC
7847 return this; 7847 return this;
7848 } 7848 }
7849 7849
7850 /************************************************************/ 7850 /************************************************************/
7851 7851
7870 type = e1->type; 7870 type = e1->type;
7871 typeCombine(sc); 7871 typeCombine(sc);
7872 e1->checkIntegral(); 7872 e1->checkIntegral();
7873 e2 = e2->checkIntegral(); 7873 e2 = e2->checkIntegral();
7874 //e2 = e2->castTo(sc, Type::tshiftcnt); 7874 //e2 = e2->castTo(sc, Type::tshiftcnt);
7875 e2 = e2->castTo(sc, e1->type); // LLVMDC 7875 e2 = e2->castTo(sc, e1->type); // LDC
7876 return this; 7876 return this;
7877 } 7877 }
7878 7878
7879 /************************************************************/ 7879 /************************************************************/
7880 7880
7899 type = e1->type; 7899 type = e1->type;
7900 typeCombine(sc); 7900 typeCombine(sc);
7901 e1->checkIntegral(); 7901 e1->checkIntegral();
7902 e2 = e2->checkIntegral(); 7902 e2 = e2->checkIntegral();
7903 //e2 = e2->castTo(sc, Type::tshiftcnt); 7903 //e2 = e2->castTo(sc, Type::tshiftcnt);
7904 e2 = e2->castTo(sc, e1->type); // LLVMDC 7904 e2 = e2->castTo(sc, e1->type); // LDC
7905 return this; 7905 return this;
7906 } 7906 }
7907 7907
7908 /************************************************************/ 7908 /************************************************************/
7909 7909
8387 return e; 8387 return e;
8388 e1 = e1->checkIntegral(); 8388 e1 = e1->checkIntegral();
8389 e2 = e2->checkIntegral(); 8389 e2 = e2->checkIntegral();
8390 e1 = e1->integralPromotions(sc); 8390 e1 = e1->integralPromotions(sc);
8391 //e2 = e2->castTo(sc, Type::tshiftcnt); 8391 //e2 = e2->castTo(sc, Type::tshiftcnt);
8392 e2 = e2->castTo(sc, e1->type); // LLVMDC 8392 e2 = e2->castTo(sc, e1->type); // LDC
8393 type = e1->type; 8393 type = e1->type;
8394 } 8394 }
8395 return this; 8395 return this;
8396 } 8396 }
8397 8397
8412 return e; 8412 return e;
8413 e1 = e1->checkIntegral(); 8413 e1 = e1->checkIntegral();
8414 e2 = e2->checkIntegral(); 8414 e2 = e2->checkIntegral();
8415 e1 = e1->integralPromotions(sc); 8415 e1 = e1->integralPromotions(sc);
8416 //e2 = e2->castTo(sc, Type::tshiftcnt); 8416 //e2 = e2->castTo(sc, Type::tshiftcnt);
8417 e2 = e2->castTo(sc, e1->type); // LLVMDC 8417 e2 = e2->castTo(sc, e1->type); // LDC
8418 type = e1->type; 8418 type = e1->type;
8419 } 8419 }
8420 return this; 8420 return this;
8421 } 8421 }
8422 8422
8437 return e; 8437 return e;
8438 e1 = e1->checkIntegral(); 8438 e1 = e1->checkIntegral();
8439 e2 = e2->checkIntegral(); 8439 e2 = e2->checkIntegral();
8440 e1 = e1->integralPromotions(sc); 8440 e1 = e1->integralPromotions(sc);
8441 //e2 = e2->castTo(sc, Type::tshiftcnt); 8441 //e2 = e2->castTo(sc, Type::tshiftcnt);
8442 e2 = e2->castTo(sc, e1->type); // LLVMDC 8442 e2 = e2->castTo(sc, e1->type); // LDC
8443 type = e1->type; 8443 type = e1->type;
8444 } 8444 }
8445 return this; 8445 return this;
8446 } 8446 }
8447 8447
9090 9090
9091 /************************************************************/ 9091 /************************************************************/
9092 9092
9093 #if IN_LLVM 9093 #if IN_LLVM
9094 9094
9095 // Strictly LLVMDC specific stuff 9095 // Strictly LDC specific stuff
9096 9096
9097 GEPExp::GEPExp(Loc loc, Expression* e, Identifier* id, unsigned idx) 9097 GEPExp::GEPExp(Loc loc, Expression* e, Identifier* id, unsigned idx)
9098 : UnaExp(loc, TOKgep, sizeof(GEPExp), e) 9098 : UnaExp(loc, TOKgep, sizeof(GEPExp), e)
9099 { 9099 {
9100 index = idx; 9100 index = idx;