Skip to content

Commit afdd2a9

Browse files
compiler: comment on random helpers in cg_ssa
1 parent 04bb68a commit afdd2a9

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

compiler/rustc_codegen_ssa/src/traits/builder.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,19 @@ pub trait BuilderMethods<'a, 'tcx>:
555555
/// Called for `StorageDead`
556556
fn lifetime_end(&mut self, ptr: Self::Value, size: Size);
557557

558+
/// "Finally codegen the call"
559+
///
560+
/// The typical case that an argument is None is during the codegen of intrinsics,
561+
/// as they are "fake functions" that have no meaningful ABI.
562+
///
563+
/// Must return the value the function will return so it can be written to the destination,
564+
/// assuming the function does not explicitly pass the destination as an pointer in args.
558565
fn call(
559566
&mut self,
560567
llty: Self::Type,
561568
fn_attrs: Option<&CodegenFnAttrs>,
562569
fn_abi: Option<&FnAbi<'tcx, Ty<'tcx>>>,
563-
llfn: Self::Value,
570+
fn_val: Self::Value,
564571
args: &[Self::Value],
565572
funclet: Option<&Self::Funclet>,
566573
instance: Option<Instance<'tcx>>,

compiler/rustc_codegen_ssa/src/traits/intrinsic.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@ use crate::mir::operand::OperandRef;
66
use crate::mir::place::PlaceRef;
77

88
pub trait IntrinsicCallBuilderMethods<'tcx>: BackendTypes {
9+
/// Higher-level interface to emitting calls to intrinsics
10+
///
911
/// Remember to add all intrinsics here, in `compiler/rustc_hir_analysis/src/check/mod.rs`,
1012
/// and in `library/core/src/intrinsics.rs`; if you need access to any LLVM intrinsics,
1113
/// add them to `compiler/rustc_codegen_llvm/src/context.rs`.
1214
/// Returns `Err` if another instance should be called instead. This is used to invoke
1315
/// intrinsic default bodies in case an intrinsic is not implemented by the backend.
16+
///
17+
/// NOTE: allowed to call [`BuilderMethods::call`]
18+
///
19+
/// [`BuilderMethods::call`]: super::builder::BuilderMethods::call
1420
fn codegen_intrinsic_call(
1521
&mut self,
1622
instance: ty::Instance<'tcx>,
1723
args: &[OperandRef<'tcx, Self::Value>],
18-
result: PlaceRef<'tcx, Self::Value>,
24+
result_dest: PlaceRef<'tcx, Self::Value>,
1925
span: Span,
2026
) -> Result<(), ty::Instance<'tcx>>;
2127

0 commit comments

Comments
 (0)