annotate dmd/UshrExp.d @ 72:2e2a5c3f943a

reduced warnings by adding override to the methods think this also normalizes different line endings used all over the place
author Trass3r
date Sat, 28 Aug 2010 16:19:48 +0200
parents cab4c37afb89
children e28b18c23469
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
1 module dmd.UshrExp;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
2
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
3 import dmd.Expression;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
4 import dmd.Identifier;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
5 import dmd.InterState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
6 import dmd.Loc;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 import dmd.Scope;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
8 import dmd.Id;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
9 import dmd.IntRange;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
10 import dmd.IRState;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
11 import dmd.BinExp;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 import dmd.TOK;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
13 import dmd.Type;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
14
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 import dmd.backend.elem;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16 import dmd.backend.OPER;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
17 import dmd.backend.TYFL;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 import dmd.backend.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 import dmd.expression.Util;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20 import dmd.expression.Ushr;
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
21 import dmd.expression.shift_optimize;
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
22
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
23 class UshrExp : BinExp
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 this(Loc loc, Expression e1, Expression e2)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 super(loc, TOK.TOKushr, UshrExp.sizeof, e1, e2);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
30 override Expression semantic(Scope sc)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
31 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
32 Expression e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
33
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
34 if (!type)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
35 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
36 BinExp.semanticp(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
37 e = op_overload(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
38 if (e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
39 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
40 e1 = e1.checkIntegral();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
41 e2 = e2.checkIntegral();
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
42 e1 = e1.integralPromotions(sc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
43 e2 = e2.castTo(sc, Type.tshiftcnt);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
44 type = e1.type;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
45 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
46 return this;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
47 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
48
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
49 override Expression optimize(int result)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
50 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
51 //printf("UshrExp.optimize(result = %d) %s\n", result, toChars());
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
52 return shift_optimize(result, this, &Ushr);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
53 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
54
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
55 override Expression interpret(InterState istate)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
56 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
57 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
58 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
59
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
60 override IntRange getIntRange()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
61 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
62 assert(false);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
63 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
64
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
65 override Identifier opId()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
66 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
67 return Id.ushr;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
68 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
69
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
70 override Identifier opId_r()
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
71 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
72 return Id.ushr_r;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
73 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
74
72
2e2a5c3f943a reduced warnings by adding override to the methods
Trass3r
parents: 63
diff changeset
75 override elem* toElem(IRState* irs)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
76 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
77 elem *eleft = e1.toElem(irs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
78 eleft.Ety = touns(eleft.Ety);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
79 elem *eright = e2.toElem(irs);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
80 elem *e = el_bin(OPshr, type.totym(), eleft, eright);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
81 el_setLoc(e, loc);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
82 return e;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
83 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
84 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
85