Mercurial > projects > ddmd
annotate dmd/ShrExp.d @ 192:eb38fdcb3e62 default tip
updated to compile with dmd2.062
author | korDen |
---|---|
date | Sat, 02 Mar 2013 01:25:52 -0800 |
parents | b0d41ff5e0df |
children |
rev | line source |
---|---|
72 | 1 module dmd.ShrExp; |
2 | |
114 | 3 import dmd.common; |
72 | 4 import dmd.Expression; |
5 import dmd.Identifier; | |
6 import dmd.InterState; | |
7 import dmd.Loc; | |
8 import dmd.Scope; | |
9 import dmd.IntRange; | |
10 import dmd.IRState; | |
11 import dmd.BinExp; | |
0 | 12 import dmd.TOK; |
13 import dmd.Type; | |
72 | 14 import dmd.Id; |
15 | |
0 | 16 import dmd.backend.elem; |
17 import dmd.backend.OPER; | |
18 | |
19 import dmd.expression.shift_optimize; | |
72 | 20 import dmd.expression.Shr; |
21 | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
22 import dmd.DDMDExtensions; |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
23 |
0 | 24 class ShrExp : BinExp |
25 { | |
187
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
26 mixin insertMemberExtension!(typeof(this)); |
b0d41ff5e0df
Added expandability scheme outlined in http://www.dsource.org/forums/viewtopic.php?t=5659&sid=6f2150ff5b0bffcd47512a6a7608d218
Abscissa
parents:
178
diff
changeset
|
27 |
0 | 28 this(Loc loc, Expression e1, Expression e2) |
29 { | |
178 | 30 register(); |
0 | 31 super(loc, TOK.TOKshr, ShrExp.sizeof, e1, e2); |
32 } | |
33 | |
72 | 34 override Expression semantic(Scope sc) |
0 | 35 { |
36 Expression e; | |
37 | |
38 if (!type) | |
39 { | |
40 BinExp.semanticp(sc); | |
41 e = op_overload(sc); | |
42 | |
43 if (e) | |
44 return e; | |
45 | |
46 e1 = e1.checkIntegral(); | |
47 e2 = e2.checkIntegral(); | |
48 e1 = e1.integralPromotions(sc); | |
49 e2 = e2.castTo(sc, Type.tshiftcnt); | |
50 type = e1.type; | |
51 } | |
52 return this; | |
53 } | |
54 | |
72 | 55 override Expression optimize(int result) |
0 | 56 { |
57 //printf("ShrExp::optimize(result = %d) %s\n", result, toChars()); | |
58 return shift_optimize(result, this, &Shr); | |
59 } | |
60 | |
72 | 61 override Expression interpret(InterState istate) |
0 | 62 { |
115
6caaf0256da1
+ interpretation of (non-assign) binary expressions
Trass3r
parents:
114
diff
changeset
|
63 return interpretCommon(istate, &Shr); |
0 | 64 } |
65 | |
72 | 66 override IntRange getIntRange() |
0 | 67 { |
68 assert(false); | |
69 } | |
70 | |
72 | 71 override Identifier opId() |
0 | 72 { |
73 return Id.shr; | |
74 } | |
75 | |
72 | 76 override Identifier opId_r() |
0 | 77 { |
78 return Id.shr_r; | |
79 } | |
80 | |
72 | 81 override elem* toElem(IRState* irs) |
0 | 82 { |
130
60bb0fe4563e
dmdfe 2.037 first main iteration
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents:
115
diff
changeset
|
83 return toElemBin(irs, e1.type.isunsigned() ? OPER.OPshr : OPER.OPashr); |
0 | 84 } |
85 } | |
86 |