Skip to content

Commit e8d65e5

Browse files
committed
Pass &mut self to codegen_global_asm
1 parent bea35cc commit e8d65e5

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

compiler/rustc_codegen_gcc/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ fn dummy_output_type<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, reg: InlineAsmRegCl
794794

795795
impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
796796
fn codegen_global_asm(
797-
&self,
797+
&mut self,
798798
template: &[InlineAsmTemplatePiece],
799799
operands: &[GlobalAsmOperandRef<'tcx>],
800800
options: InlineAsmOptions,

compiler/rustc_codegen_gcc/src/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ pub fn compile_codegen_unit(
200200
let f64_type_supported = target_info.supports_target_dependent_type(CType::Float64);
201201
let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128);
202202
// TODO: improve this to avoid passing that many arguments.
203-
let cx = CodegenCx::new(
203+
let mut cx = CodegenCx::new(
204204
&context,
205205
cgu,
206206
tcx,
@@ -218,7 +218,7 @@ pub fn compile_codegen_unit(
218218

219219
// ... and now that we have everything pre-defined, fill out those definitions.
220220
for &(mono_item, item_data) in &mono_items {
221-
mono_item.define::<Builder<'_, '_, '_>>(&cx, item_data);
221+
mono_item.define::<Builder<'_, '_, '_>>(&mut cx, item_data);
222222
}
223223

224224
// If this codegen unit contains the main function, also create the

compiler/rustc_codegen_gcc/src/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ enum ExtremumOperation {
4545
Min,
4646
}
4747

48-
pub struct Builder<'a: 'gcc, 'gcc, 'tcx> {
48+
pub struct Builder<'a, 'gcc, 'tcx> {
4949
pub cx: &'a CodegenCx<'gcc, 'tcx>,
5050
pub block: Block<'gcc>,
5151
pub location: Option<Location<'gcc>>,

compiler/rustc_codegen_llvm/src/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
375375

376376
impl<'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
377377
fn codegen_global_asm(
378-
&self,
378+
&mut self,
379379
template: &[InlineAsmTemplatePiece],
380380
operands: &[GlobalAsmOperandRef<'tcx>],
381381
options: InlineAsmOptions,

compiler/rustc_codegen_llvm/src/base.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ pub(crate) fn compile_codegen_unit(
8383
// Instantiate monomorphizations without filling out definitions yet...
8484
let llvm_module = ModuleLlvm::new(tcx, cgu_name.as_str());
8585
{
86-
let cx = CodegenCx::new(tcx, cgu, &llvm_module);
86+
let mut cx = CodegenCx::new(tcx, cgu, &llvm_module);
8787
let mono_items = cx.codegen_unit.items_in_deterministic_order(cx.tcx);
8888
for &(mono_item, data) in &mono_items {
8989
mono_item.predefine::<Builder<'_, '_, '_>>(&cx, data.linkage, data.visibility);
9090
}
9191

9292
// ... and now that we have everything pre-defined, fill out those definitions.
9393
for &(mono_item, item_data) in &mono_items {
94-
mono_item.define::<Builder<'_, '_, '_>>(&cx, item_data);
94+
mono_item.define::<Builder<'_, '_, '_>>(&mut cx, item_data);
9595
}
9696

9797
// If this codegen unit contains the main function, also create the

compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn codegen_naked_asm<
1515
'tcx,
1616
Cx: LayoutOf<'tcx, LayoutOfResult = TyAndLayout<'tcx>> + AsmCodegenMethods<'tcx>,
1717
>(
18-
cx: &'a Cx,
18+
cx: &'a mut Cx,
1919
instance: Instance<'tcx>,
2020
item_data: MonoItemData,
2121
) {

compiler/rustc_codegen_ssa/src/mono_item.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ use crate::traits::*;
1212
use crate::{base, common};
1313

1414
pub trait MonoItemExt<'a, 'tcx> {
15-
fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx, item_data: MonoItemData);
15+
fn define<Bx: BuilderMethods<'a, 'tcx>>(
16+
&self,
17+
cx: &'a mut Bx::CodegenCx,
18+
item_data: MonoItemData,
19+
);
1620
fn predefine<Bx: BuilderMethods<'a, 'tcx>>(
1721
&self,
1822
cx: &'a Bx::CodegenCx,
@@ -23,7 +27,11 @@ pub trait MonoItemExt<'a, 'tcx> {
2327
}
2428

2529
impl<'a, 'tcx: 'a> MonoItemExt<'a, 'tcx> for MonoItem<'tcx> {
26-
fn define<Bx: BuilderMethods<'a, 'tcx>>(&self, cx: &'a Bx::CodegenCx, item_data: MonoItemData) {
30+
fn define<Bx: BuilderMethods<'a, 'tcx>>(
31+
&self,
32+
cx: &'a mut Bx::CodegenCx,
33+
item_data: MonoItemData,
34+
) {
2735
debug!(
2836
"BEGIN IMPLEMENTING '{} ({})' in cgu {}",
2937
self,

compiler/rustc_codegen_ssa/src/traits/asm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub trait AsmBuilderMethods<'tcx>: BackendTypes {
6262

6363
pub trait AsmCodegenMethods<'tcx> {
6464
fn codegen_global_asm(
65-
&self,
65+
&mut self,
6666
template: &[InlineAsmTemplatePiece],
6767
operands: &[GlobalAsmOperandRef<'tcx>],
6868
options: InlineAsmOptions,

0 commit comments

Comments
 (0)