Update and improve rustc_codegen_{llvm,ssa}
docs
These docs were very out of date and misleading. They even said that they codegen'd the *AST*! For some reason, the `rustc_codegen_ssa::base` docs were exactly identical to the `rustc_codegen_llvm::base` docs. They didn't really make sense, because they had LLVM-specific information even though `rustc_codegen_ssa` is supposed to be somewhat generic. So I removed them as they were misleading.
This commit is contained in:
parent
969b42d8c0
commit
5b32ab671a
@ -1,17 +1,15 @@
|
|||||||
//! Codegen the completed AST to the LLVM IR.
|
//! Codegen the MIR to the LLVM IR.
|
||||||
//!
|
|
||||||
//! Some functions here, such as codegen_block and codegen_expr, return a value --
|
|
||||||
//! the result of the codegen to LLVM -- while others, such as codegen_fn
|
|
||||||
//! and mono_item, are called only for the side effect of adding a
|
|
||||||
//! particular definition to the LLVM IR output we're producing.
|
|
||||||
//!
|
//!
|
||||||
//! Hopefully useful general knowledge about codegen:
|
//! Hopefully useful general knowledge about codegen:
|
||||||
//!
|
//!
|
||||||
//! * There's no way to find out the `Ty` type of a Value. Doing so
|
//! * There's no way to find out the [`Ty`] type of a [`Value`]. Doing so
|
||||||
//! would be "trying to get the eggs out of an omelette" (credit:
|
//! would be "trying to get the eggs out of an omelette" (credit:
|
||||||
//! pcwalton). You can, instead, find out its `llvm::Type` by calling `val_ty`,
|
//! pcwalton). You can, instead, find out its [`llvm::Type`] by calling [`val_ty`],
|
||||||
//! but one `llvm::Type` corresponds to many `Ty`s; for instance, `tup(int, int,
|
//! but one [`llvm::Type`] corresponds to many [`Ty`]s; for instance, `tup(int, int,
|
||||||
//! int)` and `rec(x=int, y=int, z=int)` will have the same `llvm::Type`.
|
//! int)` and `rec(x=int, y=int, z=int)` will have the same [`llvm::Type`].
|
||||||
|
//!
|
||||||
|
//! [`Ty`]: rustc_middle::ty::Ty
|
||||||
|
//! [`val_ty`]: common::val_ty
|
||||||
|
|
||||||
use super::ModuleLlvm;
|
use super::ModuleLlvm;
|
||||||
|
|
||||||
|
@ -314,6 +314,7 @@ impl ConstMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the [LLVM type][Type] of a [`Value`].
|
||||||
pub fn val_ty(v: &Value) -> &Type {
|
pub fn val_ty(v: &Value) -> &Type {
|
||||||
unsafe { llvm::LLVMTypeOf(v) }
|
unsafe { llvm::LLVMTypeOf(v) }
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,3 @@
|
|||||||
//! Codegen the completed AST to the LLVM IR.
|
|
||||||
//!
|
|
||||||
//! Some functions here, such as `codegen_block` and `codegen_expr`, return a value --
|
|
||||||
//! the result of the codegen to LLVM -- while others, such as `codegen_fn`
|
|
||||||
//! and `mono_item`, are called only for the side effect of adding a
|
|
||||||
//! particular definition to the LLVM IR output we're producing.
|
|
||||||
//!
|
|
||||||
//! Hopefully useful general knowledge about codegen:
|
|
||||||
//!
|
|
||||||
//! * There's no way to find out the `Ty` type of a `Value`. Doing so
|
|
||||||
//! would be "trying to get the eggs out of an omelette" (credit:
|
|
||||||
//! pcwalton). You can, instead, find out its `llvm::Type` by calling `val_ty`,
|
|
||||||
//! but one `llvm::Type` corresponds to many `Ty`s; for instance, `tup(int, int,
|
|
||||||
//! int)` and `rec(x=int, y=int, z=int)` will have the same `llvm::Type`.
|
|
||||||
|
|
||||||
use crate::back::write::{
|
use crate::back::write::{
|
||||||
compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
|
compute_per_cgu_lto_type, start_async_codegen, submit_codegened_module_to_llvm,
|
||||||
submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm, ComputedLtoType, OngoingCodegen,
|
submit_post_lto_module_to_llvm, submit_pre_lto_module_to_llvm, ComputedLtoType, OngoingCodegen,
|
||||||
|
Loading…
Reference in New Issue
Block a user