Mercurial > projects > dang
annotate dang/compiler.d @ 88:eb5b2c719a39 new_gen
Major change to locations, tokens and expressions.
A location (now SourceLocation or SLoc) is only 32 bit in size -
disadvantage is that it can't find its own text. You have to go through the
new SourceManager to do that.
This has caused changes to a lot of stuff and removal of DataSource and the
old Location
Additionally Exp has gotten some location stuff, so we can give proper
error messages. Not in Decl and Stmt yet, but thats coming too.
author | Anders Halager <halager@gmail.com> |
---|---|
date | Sun, 04 May 2008 18:13:46 +0200 |
parents | 9a35a973175a |
children | a49bb982a7b0 |
rev | line source |
---|---|
1 | 1 module dang.compiler; |
2 | |
3 import tango.io.Stdout, | |
4 tango.core.Signal, | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
5 tango.time.StopWatch, |
1 | 6 tango.io.FilePath; |
7 | |
8 import lexer.Lexer, | |
9 parser.Parser; | |
10 | |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
11 import basic.SourceManager; |
1 | 12 |
13 import ast.Decl; | |
14 | |
15 import tools.AstPrinter, | |
16 tools.DotPrinter; | |
17 | |
51
c96cdcbdb9d6
Rearranged some stuff, and renamed LLVMGen -> CodeGen
Anders Halager <halager@gmail.com>
parents:
50
diff
changeset
|
18 import gen.CodeGen; |
1 | 19 |
13
e5caf9971207
Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
1
diff
changeset
|
20 import sema.Visitor, |
51
c96cdcbdb9d6
Rearranged some stuff, and renamed LLVMGen -> CodeGen
Anders Halager <halager@gmail.com>
parents:
50
diff
changeset
|
21 sema.AstAction, |
13
e5caf9971207
Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
1
diff
changeset
|
22 sema.SymbolTableBuilder, |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
60
diff
changeset
|
23 sema.ImplicitCast, |
13
e5caf9971207
Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
1
diff
changeset
|
24 sema.Declarations; |
1 | 25 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
26 import Opt = dang.OptParse; |
1 | 27 |
28 void checkFiles(char[][] *files) | |
29 { | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
30 bool non_existant_files = false; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
31 bool duplicate_files = false; |
1 | 32 |
33 char[][] validFiles; | |
34 | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
35 foreach (file; *files) |
1 | 36 { |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
37 scope path = new FilePath(file); |
1 | 38 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
39 if (!path.exists) |
1 | 40 { |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
41 Stderr.formatln("'{}' does not exist", file).newline; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
42 non_existant_files = true; |
1 | 43 |
44 continue; | |
45 } | |
46 | |
47 bool fileInStack = false; | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
48 foreach (vFile; validFiles) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
49 if (vFile == file) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
50 { |
1 | 51 fileInStack = true; |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
52 duplicate_files = true; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
53 } |
1 | 54 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
55 if (fileInStack) |
1 | 56 continue; |
57 | |
58 validFiles ~= file; | |
59 } | |
60 | |
61 *files = validFiles; | |
62 | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
63 if (non_existant_files) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
64 throw new Exception("All files given must exist"); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
65 if (duplicate_files) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
66 Stderr("warning: duplicate files ignored").newline; |
1 | 67 } |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
68 |
1 | 69 void main(char[][] args) |
70 { | |
71 char[][] filesToHandle; | |
72 | |
73 Signal!(char[][]*) preStart; | |
74 | |
75 Signal!(char[]) preLex; | |
76 Signal!(Lexer) postLex; | |
77 | |
78 Signal!(Lexer) preParse; | |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
79 Signal!(Decl[], SourceManager) postParse; |
1 | 80 |
81 preStart.attach(&checkFiles); | |
82 | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
83 auto argParse = new Opt.OptionParser(`Dang "D" compiler v0.0`); |
1 | 84 |
40
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
85 bool optimize = false; |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
86 bool inline = false; |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
87 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
88 argParse.addOption(["-h", "--help"], Opt.Action.Help) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
89 .help("Show this help message"); |
1 | 90 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
91 argParse.addOption(["--ast-dump-dot"], |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
92 "what-to-do", Opt.Action.StoreConst, "dot") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
93 .help("Output the AST in the dot format"); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
94 argParse.addOption(["--ast-dump-code"], |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
95 "what-to-do", Opt.Action.StoreConst, "code") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
96 .help("Output the AST as code"); |
1 | 97 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
98 argParse.addOption(["--gen-llvm"], |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
99 "what-to-do", Opt.Action.StoreConst, "gen-llvm") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
100 .help("Compile to LLVM code (default)"); |
40
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
101 |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
102 argParse.addOption( |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
103 ["-O","--optimize"], { |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
104 optimize = true; |
1 | 105 } |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
106 ).help("Tell LLVM to do its standard optimizations"); |
40
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
107 |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
108 argParse.addOption( |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
109 ["--inline"], { |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
110 inline = true; |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
111 } |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
112 ).help("Tell LLVM that its allowed to inline functions"); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
113 |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
114 argParse |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
115 .addOption(["--time"], Opt.Action.SetTrue, "time") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
116 .help("Time the various operations performed."); |
1 | 117 |
118 auto options = argParse.parse(args); | |
119 | |
120 filesToHandle ~= options.args; | |
121 | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
122 // Will throw exception if some files don't exist |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
123 preStart(&filesToHandle); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
124 |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
125 struct Measurement { char[] label; double time; } |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
126 Measurement[] timings; |
1 | 127 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
128 auto what = options["what-to-do"]; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
129 if (what == "" || what == "gen-llvm") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
130 postParse.attach( |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
131 (Decl[] decls, SourceManager sm) { |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
132 StopWatch w; w.start; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
133 auto llvmGen = new CodeGen(); |
40
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
134 llvmGen.gen(decls, optimize, inline); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
135 timings ~= Measurement("Generating LLVM bytecode", w.stop); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
136 }); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
137 else if (what == "dot") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
138 postParse.attach( |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
139 (Decl[] decls, SourceManager sm) { |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
140 StopWatch w; w.start; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
141 auto print = new DotPrinter(); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
142 print.print(decls); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
143 timings ~= Measurement("Generating dot output", w.stop); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
144 }); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
145 else if (what == "code") |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
146 postParse.attach( |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
147 (Decl[] decls, SourceManager sm) { |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
148 StopWatch w; w.start; |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
149 auto print = new AstPrinter(sm); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
150 print.print(decls); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
151 timings ~= Measurement("Converting AST to text", w.stop); |
40
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
152 }); |
9fb190ad81a4
Added -O and --inline args to Dang.
Anders Johnsen <skabet@gmail.com>
parents:
22
diff
changeset
|
153 |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
154 SourceManager src_mgr = new SourceManager; |
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
155 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
156 StopWatch total; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
157 total.start; |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
158 foreach (file; filesToHandle) |
1 | 159 { |
160 preLex(file); | |
161 | |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
162 auto start = src_mgr.addFile(file); |
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
163 Stdout(file).newline; |
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
164 auto lexer = new Lexer(start, src_mgr); |
1 | 165 postLex(lexer); |
166 | |
167 preParse(lexer); | |
168 | |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
169 StopWatch watch; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
170 watch.start; |
1 | 171 auto parser = new Parser; |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
172 auto action = new AstAction(src_mgr); |
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
173 auto decls = cast(Decl[])parser.parse(src_mgr, lexer, action); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
174 timings ~= Measurement("Lex + Parse", watch.stop); |
1 | 175 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
176 StopWatch watch2; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
177 watch.start; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
178 watch2.start; |
13
e5caf9971207
Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
1
diff
changeset
|
179 (new SymbolTableBuilder).visit(decls); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
180 auto symbol_table = watch2.stop; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
181 watch2.start; |
13
e5caf9971207
Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
1
diff
changeset
|
182 (new Declarations).visit(decls); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
183 auto declarations = watch2.stop; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
184 watch2.start; |
68
381975d76baf
A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents:
60
diff
changeset
|
185 (new ImplicitCast).visit(decls); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
186 auto implicit_casts = watch2.stop; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
187 watch2.start; |
13
e5caf9971207
Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
1
diff
changeset
|
188 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
189 foreach (decl; decls) |
56
4ae365eff712
Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
190 decl.simplify(); |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
191 auto simplify = watch2.stop; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
192 auto extra_stuff = watch.stop; |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
193 timings ~= Measurement("Extra stuff", watch.stop); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
194 timings ~= Measurement(" - Building scopes", symbol_table); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
195 timings ~= Measurement(" - Extracting declarations", declarations); |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
196 timings ~= Measurement(" - Making casts explicit", implicit_casts); |
56
4ae365eff712
Now return types works for structs... Also, simplyfing in AST have been startet - but still messy. This update is a little messy...
Anders Johnsen <skabet@gmail.com>
parents:
51
diff
changeset
|
197 |
88
eb5b2c719a39
Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents:
87
diff
changeset
|
198 postParse(decls, src_mgr); |
1 | 199 } |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
200 timings ~= Measurement("Total", total.stop); |
1 | 201 |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
202 if (options.flag("time")) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
203 foreach (m; timings) |
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
204 Stderr.formatln("{,-45} {}ms", m.label, m.time*1e3); |
1 | 205 } |
87
9a35a973175a
Some improvements to the compiler program
Anders Halager <halager@gmail.com>
parents:
68
diff
changeset
|
206 |