Skip to content

Commit df52deb

Browse files
committed
Pass &mut self to codegen_global_asm
1 parent bb0fffb commit df52deb

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
@@ -210,7 +210,7 @@ pub fn compile_codegen_unit(
210210
let f128_type_supported = target_info.supports_target_dependent_type(CType::Float128);
211211
let u128_type_supported = target_info.supports_target_dependent_type(CType::UInt128t);
212212
// TODO: improve this to avoid passing that many arguments.
213-
let cx = CodegenCx::new(
213+
let mut cx = CodegenCx::new(
214214
&context,
215215
cgu,
216216
tcx,
@@ -228,7 +228,7 @@ pub fn compile_codegen_unit(
228228

229229
// ... and now that we have everything pre-defined, fill out those definitions.
230230
for &(mono_item, item_data) in &mono_items {
231-
mono_item.define::<Builder<'_, '_, '_>>(&cx, item_data);
231+
mono_item.define::<Builder<'_, '_, '_>>(&mut cx, item_data);
232232
}
233233

234234
// 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
@@ -21,7 +21,7 @@ pub fn codegen_naked_asm<
2121
+ FnAbiOf<'tcx, FnAbiOfResult = &'tcx FnAbi<'tcx, Ty<'tcx>>>
2222
+ AsmCodegenMethods<'tcx>,
2323
>(
24-
cx: &'a Cx,
24+
cx: &'a mut Cx,
2525
instance: Instance<'tcx>,
2626
item_data: MonoItemData,
2727
) {

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)