Skip to content

Commit 6b3415b

Browse files
committed
---
yaml --- r: 64767 b: refs/heads/snap-stage3 c: 413446c h: refs/heads/master i: 64765: 7cd1e7f 64763: 5469f59 64759: 05aa6d2 64751: 50279f6 64735: c71b195 64703: 77d2f1c 64639: f6daf75 64511: 73dd451 v: v3
1 parent 43de2f0 commit 6b3415b

File tree

13 files changed

+311
-280
lines changed

13 files changed

+311
-280
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8d654fc41d0c69eaaa78409e8d42318a478b7c83
4+
refs/heads/snap-stage3: 413446c85b44a7d9269a0723ed043e16d09e2324
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/driver/driver.rs

Lines changed: 243 additions & 224 deletions
Large diffs are not rendered by default.

branches/snap-stage3/src/librustc/middle/borrowck/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub mod doc;
4343

4444
pub mod check_loans;
4545

46+
#[path="gather_loans/mod.rs"]
4647
pub mod gather_loans;
4748

4849
pub mod move_data;

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ use back::link::{mangle_exported_name};
2828
use back::{link, abi};
2929
use driver::session;
3030
use driver::session::Session;
31-
use lib::llvm::{ContextRef, ModuleRef, ValueRef, BasicBlockRef};
31+
use driver::driver::{CrateAnalysis, CrateTranslation};
32+
use lib::llvm::{ModuleRef, ValueRef, BasicBlockRef};
3233
use lib::llvm::{llvm, True};
3334
use lib;
3435
use metadata::common::LinkMeta;
3536
use metadata::{csearch, cstore, encoder};
3637
use middle::astencode;
3738
use middle::lang_items::{LangItem, ExchangeMallocFnLangItem, StartFnLangItem};
3839
use middle::lang_items::{MallocFnLangItem, ClosureExchangeMallocFnLangItem};
39-
use middle::resolve;
4040
use middle::trans::_match;
4141
use middle::trans::adt;
4242
use middle::trans::base;
@@ -66,7 +66,7 @@ use util::ppaux::{Repr, ty_to_str};
6666
use middle::trans::type_::Type;
6767

6868
use std::hash;
69-
use std::hashmap::{HashMap, HashSet};
69+
use std::hashmap::HashMap;
7070
use std::io;
7171
use std::libc::c_uint;
7272
use std::uint;
@@ -2957,12 +2957,8 @@ pub fn write_abi_version(ccx: &mut CrateContext) {
29572957

29582958
pub fn trans_crate(sess: session::Session,
29592959
crate: &ast::Crate,
2960-
tcx: ty::ctxt,
2961-
output: &Path,
2962-
emap2: resolve::ExportMap2,
2963-
reachable_map: @mut HashSet<ast::node_id>,
2964-
maps: astencode::Maps)
2965-
-> (ContextRef, ModuleRef, LinkMeta) {
2960+
analysis: &CrateAnalysis,
2961+
output: &Path) -> CrateTranslation {
29662962
// Before we touch LLVM, make sure that multithreading is enabled.
29672963
if unsafe { !llvm::LLVMRustStartMultithreading() } {
29682964
//sess.bug("couldn't enable multi-threaded LLVM");
@@ -2983,12 +2979,12 @@ pub fn trans_crate(sess: session::Session,
29832979

29842980
let ccx = @mut CrateContext::new(sess,
29852981
llmod_id,
2986-
tcx,
2987-
emap2,
2988-
maps,
2982+
analysis.ty_cx,
2983+
analysis.exp_map2,
2984+
analysis.maps,
29892985
symbol_hasher,
29902986
link_meta,
2991-
reachable_map);
2987+
analysis.reachable);
29922988

29932989
{
29942990
let _icx = push_ctxt("data");
@@ -3043,5 +3039,9 @@ pub fn trans_crate(sess: session::Session,
30433039
let link_meta = ccx.link_meta;
30443040
let llmod = ccx.llmod;
30453041

3046-
return (llcx, llmod, link_meta);
3042+
return CrateTranslation {
3043+
context: llcx,
3044+
module: llmod,
3045+
link: link_meta
3046+
};
30473047
}

branches/snap-stage3/src/librustc/middle/typeck/infer/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ pub mod combine;
5252
pub mod glb;
5353
pub mod lattice;
5454
pub mod lub;
55+
#[path = "region_inference/mod.rs"]
5556
pub mod region_inference;
5657
pub mod resolve;
5758
pub mod sub;

branches/snap-stage3/src/librustc/middle/typeck/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ use syntax::print::pprust::*;
6666
use syntax::{ast, ast_map, abi};
6767
use syntax::opt_vec;
6868

69+
#[path = "check/mod.rs"]
6970
pub mod check;
7071
pub mod rscope;
7172
pub mod astconv;
73+
#[path = "infer/mod.rs"]
7274
pub mod infer;
7375
pub mod collect;
7476
pub mod coherence;

branches/snap-stage3/src/librustc/rustc.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@ use syntax::codemap;
4141
use syntax::diagnostic;
4242

4343
pub mod middle {
44+
#[path = "trans/mod.rs"]
4445
pub mod trans;
4546
pub mod ty;
4647
pub mod subst;
4748
pub mod resolve;
49+
#[path = "typeck/mod.rs"]
4850
pub mod typeck;
4951
pub mod check_loop;
5052
pub mod check_match;
5153
pub mod check_const;
5254
pub mod lint;
55+
#[path = "borrowck/mod.rs"]
5356
pub mod borrowck;
5457
pub mod dataflow;
5558
pub mod mem_categorization;
@@ -67,6 +70,7 @@ pub mod middle {
6770
pub mod effect;
6871
pub mod reachable;
6972
pub mod graph;
73+
#[path = "cfg/mod.rs"]
7074
pub mod cfg;
7175
}
7276

@@ -89,8 +93,10 @@ pub mod back {
8993
pub mod passes;
9094
}
9195

96+
#[path = "metadata/mod.rs"]
9297
pub mod metadata;
9398

99+
#[path = "driver/mod.rs"]
94100
pub mod driver;
95101

96102
pub mod util {

branches/snap-stage3/src/librusti/rusti.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,15 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
223223
debug!("testing with ^^^^^^ %?", (||{ println(test) })());
224224
let dinput = driver::str_input(test.to_managed());
225225
let cfg = driver::build_configuration(sess, binary, &dinput);
226-
let outputs = driver::build_output_filenames(&dinput, &None, &None, [], sess);
227-
let (crate, tcx) = driver::compile_upto(sess, cfg.clone(), &dinput,
228-
driver::cu_typeck, Some(outputs));
226+
227+
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &dinput);
228+
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
229+
let analysis = driver::phase_3_run_analysis_passes(sess, expanded_crate);
230+
229231
// Once we're typechecked, record the types of all local variables defined
230232
// in this input
231-
do find_main(crate.expect("crate after cu_typeck"), sess) |blk| {
232-
program.register_new_vars(blk, tcx.expect("tcx after cu_typeck"));
233+
do find_main(crate, sess) |blk| {
234+
program.register_new_vars(blk, analysis.ty_cx);
233235
}
234236

235237
//
@@ -242,8 +244,12 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
242244
let cfg = driver::build_configuration(sess, binary, &input);
243245
let outputs = driver::build_output_filenames(&input, &None, &None, [], sess);
244246
let sess = driver::build_session(options, diagnostic::emit);
245-
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
246-
Some(outputs));
247+
248+
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
249+
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
250+
let analysis = driver::phase_3_run_analysis_passes(sess, expanded_crate);
251+
let trans = driver::phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs);
252+
driver::phase_5_run_llvm_passes(sess, &trans, outputs);
247253

248254
//
249255
// Stage 4: Inform the program that computation is done so it can update all
@@ -265,10 +271,7 @@ fn run(mut program: ~Program, binary: ~str, lib_search_paths: ~[~str],
265271
let code = fmt!("fn main() {\n %s \n}", input);
266272
let input = driver::str_input(code.to_managed());
267273
let cfg = driver::build_configuration(sess, binary, &input);
268-
let outputs = driver::build_output_filenames(&input, &None, &None, [], sess);
269-
let (crate, _) = driver::compile_upto(sess, cfg, &input,
270-
driver::cu_parse, Some(outputs));
271-
crate.expect("parsing should return a crate")
274+
driver::phase_1_parse_input(sess, cfg.clone(), &input)
272275
}
273276

274277
fn find_main(crate: @ast::Crate, sess: session::Session,
@@ -334,9 +337,12 @@ fn compile_crate(src_filename: ~str, binary: ~str) -> Option<bool> {
334337
None => { },
335338
}
336339
if (should_compile) {
337-
printfln!("compiling %s...", src_filename);
338-
driver::compile_upto(sess, cfg, &input, driver::cu_everything,
339-
Some(outputs));
340+
println(fmt!("compiling %s...", src_filename));
341+
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
342+
let expanded_crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
343+
let analysis = driver::phase_3_run_analysis_passes(sess, expanded_crate);
344+
let trans = driver::phase_4_translate_to_llvm(sess, expanded_crate, &analysis, outputs);
345+
driver::phase_5_run_llvm_passes(sess, &trans, outputs);
340346
true
341347
} else { false }
342348
} {

branches/snap-stage3/src/librustpkg/rustpkg.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ impl<'self> PkgScript<'self> {
109109
let input = driver::file_input(script);
110110
let sess = driver::build_session(options, diagnostic::emit);
111111
let cfg = driver::build_configuration(sess, binary, &input);
112-
let (crate, _) = driver::compile_upto(sess, cfg.clone(), &input, driver::cu_parse, None);
112+
let crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
113+
let crate = driver::phase_2_configure_and_expand(sess, cfg.clone(), crate);
113114
let work_dir = build_pkg_id_in_workspace(id, workspace);
114115

115116
debug!("Returning package script with id %?", id);
@@ -119,7 +120,7 @@ impl<'self> PkgScript<'self> {
119120
input: input,
120121
sess: sess,
121122
cfg: cfg,
122-
crate: crate.unwrap(),
123+
crate: crate,
123124
build_dir: work_dir
124125
}
125126
}
@@ -142,14 +143,10 @@ impl<'self> PkgScript<'self> {
142143
let root = r.pop().pop().pop().pop(); // :-\
143144
debug!("Root is %s, calling compile_rest", root.to_str());
144145
let exe = self.build_dir.push(~"pkg" + util::exe_suffix());
145-
let binary = os::args()[0].to_managed();
146146
util::compile_crate_from_input(&self.input,
147147
&self.build_dir,
148148
sess,
149-
crate,
150-
driver::build_configuration(sess,
151-
binary, &self.input),
152-
driver::cu_parse);
149+
crate);
153150
debug!("Running program: %s %s %s %s", exe.to_str(),
154151
sysroot.to_str(), root.to_str(), "install");
155152
// FIXME #7401 should support commands besides `install`

branches/snap-stage3/src/librustpkg/util.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use syntax::ext::base::ExtCtxt;
1818
use syntax::{ast, attr, codemap, diagnostic, fold};
1919
use syntax::attr::AttrMetaMethods;
2020
use rustc::back::link::output_type_exe;
21-
use rustc::driver::driver::compile_upto;
2221
use rustc::driver::session::{lib_crate, bin_crate};
2322
use context::Ctx;
2423
use package_id::PkgId;
@@ -220,12 +219,8 @@ pub fn compile_input(ctxt: &Ctx,
220219
// Infer dependencies that rustpkg needs to build, by scanning for
221220
// `extern mod` directives.
222221
let cfg = driver::build_configuration(sess, binary, &input);
223-
let (crate_opt, _) = driver::compile_upto(sess, cfg.clone(), &input, driver::cu_expand, None);
224-
225-
let mut crate = match crate_opt {
226-
Some(c) => c,
227-
None => fail!("compile_input expected...")
228-
};
222+
let mut crate = driver::phase_1_parse_input(sess, cfg.clone(), &input);
223+
crate = driver::phase_2_configure_and_expand(sess, cfg, crate);
229224

230225
// Not really right. Should search other workspaces too, and the installed
231226
// database (which doesn't exist yet)
@@ -257,7 +252,7 @@ pub fn compile_input(ctxt: &Ctx,
257252

258253
debug!("calling compile_crate_from_input, out_dir = %s,
259254
building_library = %?", out_dir.to_str(), sess.building_library);
260-
compile_crate_from_input(&input, out_dir, sess, crate, cfg.clone(), driver::cu_expand);
255+
compile_crate_from_input(&input, out_dir, sess, crate);
261256
true
262257
}
263258

@@ -269,9 +264,7 @@ pub fn compile_input(ctxt: &Ctx,
269264
pub fn compile_crate_from_input(input: &driver::input,
270265
build_dir: &Path,
271266
sess: session::Session,
272-
crate: @ast::Crate,
273-
cfg: ast::CrateConfig,
274-
compile_from: driver::compile_phase) {
267+
crate: @ast::Crate) {
275268
debug!("Calling build_output_filenames with %s, building library? %?",
276269
build_dir.to_str(), sess.building_library);
277270

@@ -284,15 +277,13 @@ pub fn compile_crate_from_input(input: &driver::input,
284277
for sess.opts.addl_lib_search_paths.iter().advance |lib| {
285278
debug!("an additional library: %s", lib.to_str());
286279
}
287-
288-
driver::compile_rest(sess,
289-
cfg,
290-
compile_upto {
291-
from: compile_from,
292-
to: driver::cu_everything
293-
},
294-
Some(outputs),
295-
Some(crate));
280+
let analysis = driver::phase_3_run_analysis_passes(sess, crate);
281+
let translation = driver::phase_4_translate_to_llvm(sess, crate,
282+
&analysis,
283+
outputs);
284+
driver::phase_5_run_llvm_passes(sess, &translation, outputs);
285+
if driver::stop_after_phase_5(sess) { return; }
286+
driver::phase_6_link_output(sess, &translation, outputs);
296287
}
297288

298289
#[cfg(windows)]

branches/snap-stage3/src/libstd/rt/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,14 @@ mod kill;
9090
mod sched;
9191

9292
/// Synchronous I/O.
93+
#[path = "io/mod.rs"]
9394
pub mod io;
9495

9596
/// The EventLoop and internal synchronous I/O interface.
9697
mod rtio;
9798

9899
/// libuv and default rtio implementation.
100+
#[path = "uv/mod.rs"]
99101
pub mod uv;
100102

101103
/// The Local trait for types that are accessible via thread-local

branches/snap-stage3/src/libstd/std.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ pub mod trie;
162162

163163
/* Tasks and communication */
164164

165+
#[path = "task/mod.rs"]
165166
pub mod task;
166167
pub mod comm;
167168
pub mod pipes;
@@ -189,6 +190,7 @@ pub mod util;
189190
/* Unsupported interfaces */
190191

191192
// Private APIs
193+
#[path = "unstable/mod.rs"]
192194
pub mod unstable;
193195

194196
/* For internal use, not exported */
@@ -200,6 +202,7 @@ mod stackwalk;
200202

201203
// XXX: This shouldn't be pub, and it should be reexported under 'unstable'
202204
// but name resolution doesn't work without it being pub.
205+
#[path = "rt/mod.rs"]
203206
pub mod rt;
204207

205208
// A curious inner-module that's not exported that contains the binding

branches/snap-stage3/src/libsyntax/syntax.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub mod visit;
4545
pub mod fold;
4646

4747

48+
#[path = "parse/mod.rs"]
4849
pub mod parse;
4950

5051
pub mod print {
@@ -59,6 +60,7 @@ pub mod ext {
5960

6061
pub mod quote;
6162

63+
#[path = "deriving/mod.rs"]
6264
pub mod deriving;
6365

6466
pub mod build;
@@ -78,6 +80,7 @@ pub mod ext {
7880
pub mod auto_encode;
7981
pub mod source_util;
8082

83+
#[path = "pipes/mod.rs"]
8184
pub mod pipes;
8285

8386
pub mod trace_macros;

0 commit comments

Comments
 (0)