Skip to content

Commit 1447b1d

Browse files
committed
Rename *AsmOperandRef::Const to Interpolate
This is used for string interpolation currently, so rename it as so. The name `Const` will be used to denote a general CTFE constant that can either be integer or pointer.
1 parent 32d2385 commit 1447b1d

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

compiler/rustc_codegen_gcc/src/asm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
294294
}
295295
}
296296

297-
InlineAsmOperandRef::Const { ref string } => {
297+
InlineAsmOperandRef::Interpolate { ref string } => {
298298
constants_len += string.len() + att_dialect as usize;
299299
}
300300

@@ -409,7 +409,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
409409
});
410410
}
411411

412-
InlineAsmOperandRef::Const { .. } => {
412+
InlineAsmOperandRef::Interpolate { .. } => {
413413
// processed in the previous pass
414414
}
415415

@@ -502,7 +502,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
502502
template_str.push_str(name);
503503
}
504504

505-
InlineAsmOperandRef::Const { ref string } => {
505+
InlineAsmOperandRef::Interpolate { ref string } => {
506506
template_str.push_str(string);
507507
}
508508

@@ -865,7 +865,7 @@ impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
865865
}
866866
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
867867
match operands[operand_idx] {
868-
GlobalAsmOperandRef::Const { ref string } => {
868+
GlobalAsmOperandRef::Interpolate { ref string } => {
869869
// Const operands get injected directly into the
870870
// template. Note that we don't need to escape %
871871
// here unlike normal inline assembly.

compiler/rustc_codegen_llvm/src/asm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
205205
template_str.push_str(&format!("${{{}}}", op_idx[&operand_idx]));
206206
}
207207
}
208-
InlineAsmOperandRef::Const { ref string } => {
208+
InlineAsmOperandRef::Interpolate { ref string } => {
209209
// Const operands get injected directly into the template
210210
template_str.push_str(string);
211211
}
@@ -398,7 +398,7 @@ impl<'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
398398
InlineAsmTemplatePiece::String(ref s) => template_str.push_str(s),
399399
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
400400
match operands[operand_idx] {
401-
GlobalAsmOperandRef::Const { ref string } => {
401+
GlobalAsmOperandRef::Interpolate { ref string } => {
402402
// Const operands get injected directly into the
403403
// template. Note that we don't need to escape $
404404
// here unlike normal inline assembly.

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,14 @@ where
440440
const_value,
441441
cx.layout_of(ty),
442442
);
443-
GlobalAsmOperandRef::Const { string }
443+
GlobalAsmOperandRef::Interpolate { string }
444444
}
445445
Err(ErrorHandled::Reported { .. }) => {
446446
// An error has already been reported and
447447
// compilation is guaranteed to fail if execution
448448
// hits this path. So an empty string instead of
449449
// a stringified constant value will suffice.
450-
GlobalAsmOperandRef::Const { string: String::new() }
450+
GlobalAsmOperandRef::Interpolate { string: String::new() }
451451
}
452452
Err(ErrorHandled::TooGeneric(_)) => {
453453
span_bug!(*op_sp, "asm const cannot be resolved; too generic")

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
12371237
const_value,
12381238
bx.layout_of(value.ty()),
12391239
);
1240-
InlineAsmOperandRef::Const { string }
1240+
InlineAsmOperandRef::Interpolate { string }
12411241
}
12421242
mir::InlineAsmOperand::SymFn { ref value } => {
12431243
let const_ = self.monomorphize(value.const_);

compiler/rustc_codegen_ssa/src/mir/naked_asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn inline_to_global_operand<'a, 'tcx, Cx: LayoutOf<'tcx, LayoutOfResult = TyAndL
8585
cx.layout_of(mono_type),
8686
);
8787

88-
GlobalAsmOperandRef::Const { string }
88+
GlobalAsmOperandRef::Interpolate { string }
8989
}
9090
InlineAsmOperand::SymFn { value } => {
9191
let mono_type = instance.instantiate_mir_and_normalize_erasing_regions(

compiler/rustc_codegen_ssa/src/traits/asm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> {
2525
in_value: OperandRef<'tcx, B::Value>,
2626
out_place: Option<PlaceRef<'tcx, B::Value>>,
2727
},
28-
Const {
28+
Interpolate {
2929
string: String,
3030
},
3131
SymFn {
@@ -41,7 +41,7 @@ pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> {
4141

4242
#[derive(Debug)]
4343
pub enum GlobalAsmOperandRef<'tcx> {
44-
Const { string: String },
44+
Interpolate { string: String },
4545
SymFn { instance: Instance<'tcx> },
4646
SymStatic { def_id: DefId },
4747
}

0 commit comments

Comments
 (0)