comparison gen/toir.cpp @ 363:4d7495038ae8 trunk

[svn r384] Some minor code cleanups.
author lindquist
date Mon, 14 Jul 2008 21:49:54 +0200
parents 932229a851a4
children 8014dbd24605
comparison
equal deleted inserted replaced
362:faa03bf92f0d 363:4d7495038ae8
172 172
173 // _arguments 173 // _arguments
174 if (vd->ident == Id::_arguments) 174 if (vd->ident == Id::_arguments)
175 { 175 {
176 Logger::println("Id::_arguments"); 176 Logger::println("Id::_arguments");
177 /*if (!vd->ir.getIrValue()) 177 LLValue* v = p->func()->_arguments;
178 vd->ir.getIrValue() = p->func()->decl->irFunc->_arguments;
179 assert(vd->ir.getIrValue());
180 return new DVarValue(vd, vd->ir.getIrValue(), true);*/
181 LLValue* v = p->func()->decl->ir.irFunc->_arguments;
182 assert(v); 178 assert(v);
183 return new DVarValue(vd, v, true); 179 return new DVarValue(vd, v, true);
184 } 180 }
185 // _argptr 181 // _argptr
186 else if (vd->ident == Id::_argptr) 182 else if (vd->ident == Id::_argptr)
187 { 183 {
188 Logger::println("Id::_argptr"); 184 Logger::println("Id::_argptr");
189 /*if (!vd->ir.getIrValue()) 185 LLValue* v = p->func()->_argptr;
190 vd->ir.getIrValue() = p->func()->decl->irFunc->_argptr;
191 assert(vd->ir.getIrValue());
192 return new DVarValue(vd, vd->ir.getIrValue(), true);*/
193 LLValue* v = p->func()->decl->ir.irFunc->_argptr;
194 assert(v); 186 assert(v);
195 return new DVarValue(vd, v, true); 187 return new DVarValue(vd, v, true);
196 } 188 }
197 // _dollar 189 // _dollar
198 else if (vd->ident == Id::dollar) 190 else if (vd->ident == Id::dollar)
1374 vthis2 = DtoCastInterfaceToObject(l, NULL)->getRVal(); 1366 vthis2 = DtoCastInterfaceToObject(l, NULL)->getRVal();
1375 } 1367 }
1376 } 1368 }
1377 LLValue* vthis = l->getRVal(); 1369 LLValue* vthis = l->getRVal();
1378 if (!vthis2) vthis2 = vthis; 1370 if (!vthis2) vthis2 = vthis;
1379 //unsigned cc = (unsigned)-1;
1380 1371
1381 // super call 1372 // super call
1382 if (e1->op == TOKsuper) { 1373 if (e1->op == TOKsuper) {
1383 DtoForceDeclareDsymbol(fdecl); 1374 DtoForceDeclareDsymbol(fdecl);
1384 funcval = fdecl->ir.irFunc->func; 1375 funcval = fdecl->ir.irFunc->func;
1404 // static call 1395 // static call
1405 else { 1396 else {
1406 DtoForceDeclareDsymbol(fdecl); 1397 DtoForceDeclareDsymbol(fdecl);
1407 funcval = fdecl->ir.irFunc->func; 1398 funcval = fdecl->ir.irFunc->func;
1408 assert(funcval); 1399 assert(funcval);
1409 //assert(funcval->getType() == DtoType(fdecl->type));
1410 } 1400 }
1411 return new DFuncValue(fdecl, funcval, vthis2); 1401 return new DFuncValue(fdecl, funcval, vthis2);
1412 } 1402 }
1413 else { 1403 else {
1414 printf("unsupported dotvarexp: %s\n", var->toChars()); 1404 printf("unsupported dotvarexp: %s\n", var->toChars());
2114 2104
2115 BinBitExp(And,And); 2105 BinBitExp(And,And);
2116 BinBitExp(Or,Or); 2106 BinBitExp(Or,Or);
2117 BinBitExp(Xor,Xor); 2107 BinBitExp(Xor,Xor);
2118 BinBitExp(Shl,Shl); 2108 BinBitExp(Shl,Shl);
2119 //BinBitExp(Shr,AShr);
2120 BinBitExp(Ushr,LShr); 2109 BinBitExp(Ushr,LShr);
2121 2110
2122 DValue* ShrExp::toElem(IRState* p) 2111 DValue* ShrExp::toElem(IRState* p)
2123 { 2112 {
2124 Logger::print("ShrExp::toElem: %s | %s\n", toChars(), type->toChars()); 2113 Logger::print("ShrExp::toElem: %s | %s\n", toChars(), type->toChars());
2155 DValue* HaltExp::toElem(IRState* p) 2144 DValue* HaltExp::toElem(IRState* p)
2156 { 2145 {
2157 Logger::print("HaltExp::toElem: %s\n", toChars()); 2146 Logger::print("HaltExp::toElem: %s\n", toChars());
2158 LOG_SCOPE; 2147 LOG_SCOPE;
2159 2148
2149 // FIXME: DMD inserts a trap here... we probably should as well !?!
2150
2160 #if 1 2151 #if 1
2161 DtoAssert(&loc, NULL); 2152 DtoAssert(&loc, NULL);
2162 #else 2153 #else
2163 // call the new (?) trap intrinsic 2154 // call the new (?) trap intrinsic
2164 p->ir->CreateCall(GET_INTRINSIC_DECL(trap),""); 2155 p->ir->CreateCall(GET_INTRINSIC_DECL(trap),"");