annotate dmd/InlineCostState.d @ 192:eb38fdcb3e62 default tip

updated to compile with dmd2.062
author korDen
date Sat, 02 Mar 2013 01:25:52 -0800
parents e28b18c23469
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
1 module dmd.InlineCostState;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
2
114
e28b18c23469 added a module dmd.common for commonly used stuff
Trass3r
parents: 84
diff changeset
3 import dmd.common;
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
4 import dmd.FuncDeclaration;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
5 import dmd.Expression;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
6
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
7 struct InlineCostState
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
8 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
9 int nested;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
10 int hasthis;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
11 int hdrscan; // !=0 if inline scan for 'header' content
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
12 FuncDeclaration fd;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
13 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
14
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
15 const int COST_MAX = 250;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
16
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 0
diff changeset
17 int arrayInlineCost(InlineCostState* ics, Expressions arguments)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
18 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
19 int cost = 0;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
20
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
21 if (arguments)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
22 {
84
be2ab491772e Expressions -> Vector!Expression
Eldar Insafutdinov <e.insafutdinov@gmail.com>
parents: 0
diff changeset
23 foreach (e; arguments)
0
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
24 {
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
25 if (e)
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
26 cost += e.inlineCost(ics);
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
27 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
28 }
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
29 return cost;
10317f0c89a5 Initial commit
korDen
parents:
diff changeset
30 }