|
1 |
| -# Overview of the compiler |
2 |
| - |
3 |
| -<!-- toc --> |
| 1 | +# Compiling a Program: A Walkthrough |
4 | 2 |
|
5 | 3 | This chapter is about the overall process of compiling a program -- how
|
6 | 4 | everything fits together.
|
@@ -383,60 +381,3 @@ For more details on bootstrapping, see
|
383 | 381 | - Where do phases diverge for cross-compilation to machine code across
|
384 | 382 | different platforms?
|
385 | 383 | -->
|
386 |
| - |
387 |
| -# References |
388 |
| - |
389 |
| -- Command line parsing |
390 |
| - - Guide: [The Rustc Driver and Interface](rustc-driver.md) |
391 |
| - - Driver definition: [`rustc_driver`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_driver/) |
392 |
| - - Main entry point: [`rustc_session::config::build_session_options`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_session/config/fn.build_session_options.html) |
393 |
| -- Lexical Analysis: Lex the user program to a stream of tokens |
394 |
| - - Guide: [Lexing and Parsing](the-parser.md) |
395 |
| - - Lexer definition: [`rustc_lexer`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/index.html) |
396 |
| - - Main entry point: [`rustc_lexer::cursor::Cursor::advance_token`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_lexer/cursor/struct.Cursor.html#method.advance_token) |
397 |
| -- Parsing: Parse the stream of tokens to an Abstract Syntax Tree (AST) |
398 |
| - - Guide: [Lexing and Parsing](the-parser.md) |
399 |
| - - Guide: [Macro Expansion](macro-expansion.md) |
400 |
| - - Guide: [Name Resolution](name-resolution.md) |
401 |
| - - Parser definition: [`rustc_parse`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html) |
402 |
| - - Main entry points: |
403 |
| - - [Entry point for first file in crate](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/passes/fn.parse.html) |
404 |
| - - [Entry point for outline module parsing](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_expand/module/fn.parse_external_mod.html) |
405 |
| - - [Entry point for macro fragments][parse_nonterminal] |
406 |
| - - `AST` definition: [`rustc_ast`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/index.html) |
407 |
| - - Feature gating: **TODO** |
408 |
| - - Early linting: **TODO** |
409 |
| -- The High Level Intermediate Representation (HIR) |
410 |
| - - Guide: [The HIR](hir.md) |
411 |
| - - Guide: [Identifiers in the HIR](hir.md#identifiers-in-the-hir) |
412 |
| - - Guide: [The `HIR` Map](hir.md#the-hir-map) |
413 |
| - - Guide: [Lowering `AST` to `HIR`](ast-lowering.md) |
414 |
| - - How to view `HIR` representation for your code `cargo rustc -- -Z unpretty=hir-tree` |
415 |
| - - Rustc `HIR` definition: [`rustc_hir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/index.html) |
416 |
| - - Main entry point: **TODO** |
417 |
| - - Late linting: **TODO** |
418 |
| -- Type Inference |
419 |
| - - Guide: [Type Inference](type-inference.md) |
420 |
| - - Guide: [The ty Module: Representing Types](ty.md) (semantics) |
421 |
| - - Main entry point (type inference): [`InferCtxtBuilder::enter`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtBuilder.html#method.enter) |
422 |
| - - Main entry point (type checking bodies): [the `typeck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.typeck) |
423 |
| - - These two functions can't be decoupled. |
424 |
| -- The Mid Level Intermediate Representation (MIR) |
425 |
| - - Guide: [The `MIR` (Mid level IR)](mir/index.md) |
426 |
| - - Definition: [`rustc_middle/src/mir`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/index.html) |
427 |
| - - Definition of sources that manipulates the MIR: [`rustc_mir_build`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/index.html), [`rustc_mir_dataflow`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_dataflow/index.html), [`rustc_mir_transform`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/index.html) |
428 |
| -- The Borrow Checker |
429 |
| - - Guide: [MIR Borrow Check](borrow_check.md) |
430 |
| - - Definition: [`rustc_borrowck`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/index.html) |
431 |
| - - Main entry point: [`mir_borrowck` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/fn.mir_borrowck.html) |
432 |
| -- `MIR` Optimizations |
433 |
| - - Guide: [MIR Optimizations](mir/optimizations.md) |
434 |
| - - Definition: [`rustc_mir_transform`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/index.html) |
435 |
| - - Main entry point: [`optimized_mir` query](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_transform/fn.optimized_mir.html) |
436 |
| -- Code Generation |
437 |
| - - Guide: [Code Generation](backend/codegen.md) |
438 |
| - - Generating Machine Code from `LLVM-IR` with LLVM - **TODO: reference?** |
439 |
| - - Main entry point: [`rustc_codegen_ssa::base::codegen_crate`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/fn.codegen_crate.html) |
440 |
| - - This monomorphizes and produces `LLVM-IR` for one codegen unit. It then |
441 |
| - starts a background thread to run LLVM, which must be joined later. |
442 |
| - - Monomorphization happens lazily via [`FunctionCx::monomorphize`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/mir/struct.FunctionCx.html#method.monomorphize) and [`rustc_codegen_ssa::base::codegen_instance `](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_codegen_ssa/base/fn.codegen_instance.html) |
0 commit comments