Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0692db1

Browse files
committedSep 19, 2023
Auto merge of #115865 - RalfJung:mir-mod, r=oli-obk
move things out of mir/mod.rs This moves a bunch of things out of `mir/mod.rs`: - all const-related stuff to a new file consts.rs - all statement/place/operand-related stuff to a new file statement.rs - all pretty-printing related stuff to pretty.rs `mod.rs` started out with 3100 lines and ends up with 1600. :) Also there was some pretty-printing stuff in terminator.rs, that also got moved to pretty.rs, and I reordered things in pretty.rs so that it can be grouped by functionality. Only the commit "use pretty_print_const_value from MIR constant 'extra' printing" has any behavior changes; it resolves the issue of having a fancy and a very crude pretty-printer for `ConstValue`. r? `@oli-obk`
2 parents 8769c26 + d14e601 commit 0692db1

File tree

41 files changed

+2269
-2214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2269
-2214
lines changed
 

‎compiler/rustc_codegen_cranelift/src/constant.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
33
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
44
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
5-
use rustc_middle::mir::interpret::{read_target_uint, AllocId, ConstValue, GlobalAlloc, Scalar};
5+
use rustc_middle::mir::interpret::{read_target_uint, AllocId, GlobalAlloc, Scalar};
6+
use rustc_middle::mir::ConstValue;
67

78
use cranelift_module::*;
89

‎compiler/rustc_codegen_ssa/src/common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![allow(non_camel_case_types)]
22

33
use rustc_hir::LangItem;
4-
use rustc_middle::mir::interpret::ConstValue;
4+
use rustc_middle::mir;
55
use rustc_middle::ty::{self, layout::TyAndLayout, Ty, TyCtxt};
66
use rustc_span::Span;
77

@@ -194,10 +194,10 @@ pub fn shift_mask_val<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
194194
pub fn asm_const_to_str<'tcx>(
195195
tcx: TyCtxt<'tcx>,
196196
sp: Span,
197-
const_value: ConstValue<'tcx>,
197+
const_value: mir::ConstValue<'tcx>,
198198
ty_and_layout: TyAndLayout<'tcx>,
199199
) -> String {
200-
let ConstValue::Scalar(scalar) = const_value else {
200+
let mir::ConstValue::Scalar(scalar) = const_value else {
201201
span_bug!(sp, "expected Scalar for promoted asm const, but got {:#?}", const_value)
202202
};
203203
let value = scalar.assert_bits(ty_and_layout.size);

0 commit comments

Comments
 (0)
Please sign in to comment.