comparison gen/toir.cpp @ 268:23d0d9855cad trunk

[svn r289] Fixed: right shift >> was broken for unsigned types. Fixed: debug info for classes now started.
author lindquist
date Sun, 15 Jun 2008 18:52:27 +0200
parents a9dae3da4e87
children 665b81613475
comparison
equal deleted inserted replaced
267:c43911baea21 268:23d0d9855cad
2189 2189
2190 BinBitExp(And,And); 2190 BinBitExp(And,And);
2191 BinBitExp(Or,Or); 2191 BinBitExp(Or,Or);
2192 BinBitExp(Xor,Xor); 2192 BinBitExp(Xor,Xor);
2193 BinBitExp(Shl,Shl); 2193 BinBitExp(Shl,Shl);
2194 BinBitExp(Shr,AShr); 2194 //BinBitExp(Shr,AShr);
2195 BinBitExp(Ushr,LShr); 2195 BinBitExp(Ushr,LShr);
2196
2197 DValue* ShrExp::toElem(IRState* p)
2198 {
2199 Logger::print("ShrExp::toElem: %s | %s\n", toChars(), type->toChars());
2200 LOG_SCOPE;
2201 DValue* u = e1->toElem(p);
2202 DValue* v = e2->toElem(p);
2203 LLValue* x;
2204 if (e1->type->isunsigned())
2205 x = p->ir->CreateLShr(u->getRVal(), v->getRVal(), "tmp");
2206 else
2207 x = p->ir->CreateAShr(u->getRVal(), v->getRVal(), "tmp");
2208 return new DImValue(type, x);
2209 }
2210
2211 DValue* ShrAssignExp::toElem(IRState* p)
2212 {
2213 Logger::print("ShrAssignExp::toElem: %s | %s\n", toChars(), type->toChars());
2214 LOG_SCOPE;
2215 p->exps.push_back(IRExp(e1,e2,NULL));
2216 DValue* u = e1->toElem(p);
2217 p->topexp()->v = u;
2218 DValue* v = e2->toElem(p);
2219 p->exps.pop_back();
2220 LLValue* uval = u->getRVal();
2221 LLValue* vval = v->getRVal();
2222 LLValue* tmp;
2223 if (e1->type->isunsigned())
2224 tmp = p->ir->CreateLShr(uval, vval, "tmp");
2225 else
2226 tmp = p->ir->CreateAShr(uval, vval, "tmp");
2227 DtoStore(DtoPointedType(u->getLVal(), tmp), u->getLVal());
2228 return u;
2229 }
2196 2230
2197 ////////////////////////////////////////////////////////////////////////////////////////// 2231 //////////////////////////////////////////////////////////////////////////////////////////
2198 2232
2199 DValue* HaltExp::toElem(IRState* p) 2233 DValue* HaltExp::toElem(IRState* p)
2200 { 2234 {