Skip to content

Commit 2dcb3f3

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 e69432b commit 2dcb3f3

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
@@ -107,7 +107,7 @@ fn codegen_global_asm_inner<'tcx>(
107107
InlineAsmTemplatePiece::String(ref s) => global_asm.push_str(s),
108108
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span } => {
109109
match operands[operand_idx] {
110-
GlobalAsmOperandRef::Const { ref string } => {
110+
GlobalAsmOperandRef::Interpolate { ref string } => {
111111
global_asm.push_str(string);
112112
}
113113
GlobalAsmOperandRef::SymFn { instance } => {

compiler/rustc_codegen_gcc/src/asm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
303303
}
304304
}
305305

306-
InlineAsmOperandRef::Const { ref string } => {
306+
InlineAsmOperandRef::Interpolate { ref string } => {
307307
constants_len += string.len() + att_dialect as usize;
308308
}
309309

@@ -418,7 +418,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
418418
});
419419
}
420420

421-
InlineAsmOperandRef::Const { .. } => {
421+
InlineAsmOperandRef::Interpolate { .. } => {
422422
// processed in the previous pass
423423
}
424424

@@ -511,7 +511,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
511511
template_str.push_str(name);
512512
}
513513

514-
InlineAsmOperandRef::Const { ref string } => {
514+
InlineAsmOperandRef::Interpolate { ref string } => {
515515
template_str.push_str(string);
516516
}
517517

@@ -893,7 +893,7 @@ impl<'gcc, 'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
893893
}
894894
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
895895
match operands[operand_idx] {
896-
GlobalAsmOperandRef::Const { ref string } => {
896+
GlobalAsmOperandRef::Interpolate { ref string } => {
897897
// Const operands get injected directly into the
898898
// template. Note that we don't need to escape %
899899
// 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
@@ -204,7 +204,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
204204
template_str.push_str(&format!("${{{}}}", op_idx[&operand_idx]));
205205
}
206206
}
207-
InlineAsmOperandRef::Const { ref string } => {
207+
InlineAsmOperandRef::Interpolate { ref string } => {
208208
// Const operands get injected directly into the template
209209
template_str.push_str(string);
210210
}
@@ -402,7 +402,7 @@ impl<'tcx> AsmCodegenMethods<'tcx> for CodegenCx<'_, 'tcx> {
402402
InlineAsmTemplatePiece::String(ref s) => template_str.push_str(s),
403403
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
404404
match operands[operand_idx] {
405-
GlobalAsmOperandRef::Const { ref string } => {
405+
GlobalAsmOperandRef::Interpolate { ref string } => {
406406
// Const operands get injected directly into the
407407
// template. Note that we don't need to escape $
408408
// 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
@@ -417,14 +417,14 @@ where
417417
const_value,
418418
cx.layout_of(ty),
419419
);
420-
GlobalAsmOperandRef::Const { string }
420+
GlobalAsmOperandRef::Interpolate { string }
421421
}
422422
Err(ErrorHandled::Reported { .. }) => {
423423
// An error has already been reported and
424424
// compilation is guaranteed to fail if execution
425425
// hits this path. So an empty string instead of
426426
// a stringified constant value will suffice.
427-
GlobalAsmOperandRef::Const { string: String::new() }
427+
GlobalAsmOperandRef::Interpolate { string: String::new() }
428428
}
429429
Err(ErrorHandled::TooGeneric(_)) => {
430430
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
@@ -1274,7 +1274,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
12741274
const_value,
12751275
bx.layout_of(value.ty()),
12761276
);
1277-
InlineAsmOperandRef::Const { string }
1277+
InlineAsmOperandRef::Interpolate { string }
12781278
}
12791279
mir::InlineAsmOperand::SymFn { ref value } => {
12801280
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)