Mercurial > projects > ddmd
view dmd/ShrExp.d @ 63:cab4c37afb89
A bunch of implementations
author | korDen |
---|---|
date | Mon, 23 Aug 2010 16:52:24 +0400 |
parents | 10317f0c89a5 |
children | 2e2a5c3f943a |
line wrap: on
line source
module dmd.ShrExp; import dmd.Expression; import dmd.Identifier; import dmd.InterState; import dmd.Loc; import dmd.Scope; import dmd.IntRange; import dmd.IRState; import dmd.BinExp; import dmd.TOK; import dmd.Type; import dmd.Id; import dmd.backend.elem; import dmd.backend.OPER; import dmd.expression.shift_optimize; import dmd.expression.Shr; class ShrExp : BinExp { this(Loc loc, Expression e1, Expression e2) { super(loc, TOK.TOKshr, ShrExp.sizeof, e1, e2); } Expression semantic(Scope sc) { Expression e; if (!type) { BinExp.semanticp(sc); e = op_overload(sc); if (e) return e; e1 = e1.checkIntegral(); e2 = e2.checkIntegral(); e1 = e1.integralPromotions(sc); e2 = e2.castTo(sc, Type.tshiftcnt); type = e1.type; } return this; } Expression optimize(int result) { //printf("ShrExp::optimize(result = %d) %s\n", result, toChars()); return shift_optimize(result, this, &Shr); } Expression interpret(InterState istate) { assert(false); } IntRange getIntRange() { assert(false); } Identifier opId() { return Id.shr; } Identifier opId_r() { return Id.shr_r; } elem* toElem(IRState* irs) { return toElemBin(irs, OPER.OPshr); } }