Add an intital HIR and lowering step

This commit is contained in:
Nick Cameron 2015-07-31 00:04:06 -07:00
parent cfd76b364c
commit facdf2ebb1
160 changed files with 13917 additions and 4451 deletions

View file

@ -1,5 +1,3 @@
#![feature(no_std, prelude_import)]
#![no_std]
#[prelude_import]
use std::prelude::v1::*;
#[macro_use]
@ -15,7 +13,7 @@ extern crate std as std;
// except according to those terms.
// pretty-compare-only
// pretty-mode:typed
// pretty-mode:hir,typed
// pp-exact:issue-4264.pp
// #4264 fixed-length vector types

View file

@ -9,7 +9,7 @@
// except according to those terms.
// pretty-compare-only
// pretty-mode:typed
// pretty-mode:hir,typed
// pp-exact:issue-4264.pp
// #4264 fixed-length vector types

View file

@ -14,6 +14,7 @@
extern crate libc;
extern crate rustc;
extern crate rustc_driver;
extern crate rustc_front;
extern crate rustc_lint;
extern crate rustc_resolve;
extern crate syntax;
@ -23,13 +24,14 @@ use std::mem::transmute;
use std::path::PathBuf;
use std::thread::Builder;
use rustc::ast_map;
use rustc::front::map as ast_map;
use rustc::llvm;
use rustc::metadata::cstore::RequireDynamic;
use rustc::middle::ty;
use rustc::session::config::{self, basic_options, build_configuration, Input, Options};
use rustc::session::build_session;
use rustc_driver::driver;
use rustc_front::lowering::lower_crate;
use rustc_resolve::MakeGlobMap;
use libc::c_void;
@ -220,12 +222,13 @@ fn compile_program(input: &str, sysroot: PathBuf)
let krate = driver::phase_2_configure_and_expand(&sess, krate, &id, None)
.expect("phase_2 returned `None`");
let mut forest = ast_map::Forest::new(krate);
let krate = driver::assign_node_ids(&sess, krate);
let mut hir_forest = ast_map::Forest::new(lower_crate(&krate));
let arenas = ty::CtxtArenas::new();
let ast_map = driver::assign_node_ids_and_map(&sess, &mut forest);
let ast_map = driver::make_map(&sess, &mut hir_forest);
driver::phase_3_run_analysis_passes(
sess, ast_map, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
sess, ast_map, &krate, &arenas, id, MakeGlobMap::No, |tcx, analysis| {
let trans = driver::phase_4_translate_to_llvm(tcx, analysis);

View file

@ -1,9 +1,9 @@
-include ../tools.mk
all:
$(RUSTC) -o $(TMPDIR)/foo.out -Z unstable-options --pretty normal=foo input.rs
$(RUSTC) -o $(TMPDIR)/nest_foo.out -Z unstable-options --pretty normal=nest::foo input.rs
$(RUSTC) -o $(TMPDIR)/foo_method.out -Z unstable-options --pretty normal=foo_method input.rs
$(RUSTC) -o $(TMPDIR)/foo.out -Z unstable-options --unpretty hir=foo input.rs
$(RUSTC) -o $(TMPDIR)/nest_foo.out -Z unstable-options --unpretty hir=nest::foo input.rs
$(RUSTC) -o $(TMPDIR)/foo_method.out -Z unstable-options --unpretty hir=foo_method input.rs
diff -u $(TMPDIR)/foo.out foo.pp
diff -u $(TMPDIR)/nest_foo.out nest_foo.pp
diff -u $(TMPDIR)/foo_method.out foo_method.pp