Skip to content

Commit e47eb32

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 6b3ae3f commit e47eb32

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

compiler/rustc_codegen_cranelift/src/global_asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn codegen_global_asm_inner<'tcx>(
104104
InlineAsmTemplatePiece::String(ref s) => global_asm.push_str(s),
105105
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span } => {
106106
match operands[operand_idx] {
107-
GlobalAsmOperandRef::Const { ref string } => {
107+
GlobalAsmOperandRef::Interpolate { ref string } => {
108108
global_asm.push_str(string);
109109
}
110110
GlobalAsmOperandRef::SymFn { instance } => {

compiler/rustc_codegen_gcc/src/asm.rs

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

299-
InlineAsmOperandRef::Const { ref string } => {
299+
InlineAsmOperandRef::Interpolate { ref string } => {
300300
constants_len += string.len() + att_dialect as usize;
301301
}
302302

@@ -411,7 +411,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
411411
});
412412
}
413413

414-
InlineAsmOperandRef::Const { .. } => {
414+
InlineAsmOperandRef::Interpolate { .. } => {
415415
// processed in the previous pass
416416
}
417417

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

507-
InlineAsmOperandRef::Const { ref string } => {
507+
InlineAsmOperandRef::Interpolate { ref string } => {
508508
template_str.push_str(string);
509509
}
510510

@@ -868,7 +868,7 @@ impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
868868
}
869869
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
870870
match operands[operand_idx] {
871-
GlobalAsmOperandRef::Const { ref string } => {
871+
GlobalAsmOperandRef::Interpolate { ref string } => {
872872
// Const operands get injected directly into the
873873
// template. Note that we don't need to escape %
874874
// 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
@@ -415,14 +415,14 @@ where
415415
const_value,
416416
cx.layout_of(ty),
417417
);
418-
GlobalAsmOperandRef::Const { string }
418+
GlobalAsmOperandRef::Interpolate { string }
419419
}
420420
Err(ErrorHandled::Reported { .. }) => {
421421
// An error has already been reported and
422422
// compilation is guaranteed to fail if execution
423423
// hits this path. So an empty string instead of
424424
// a stringified constant value will suffice.
425-
GlobalAsmOperandRef::Const { string: String::new() }
425+
GlobalAsmOperandRef::Interpolate { string: String::new() }
426426
}
427427
Err(ErrorHandled::TooGeneric(_)) => {
428428
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
@@ -1193,7 +1193,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11931193
const_value,
11941194
bx.layout_of(value.ty()),
11951195
);
1196-
InlineAsmOperandRef::Const { string }
1196+
InlineAsmOperandRef::Interpolate { string }
11971197
}
11981198
mir::InlineAsmOperand::SymFn { ref value } => {
11991199
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
@@ -84,7 +84,7 @@ fn inline_to_global_operand<'a, 'tcx, Cx: LayoutOf<'tcx, LayoutOfResult = TyAndL
8484
cx.layout_of(mono_type),
8585
);
8686

87-
GlobalAsmOperandRef::Const { string }
87+
GlobalAsmOperandRef::Interpolate { string }
8888
}
8989
InlineAsmOperand::SymFn { value } => {
9090
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)