Skip to content

Commit 5c6760f

Browse files
committed
Add initial version of value analysis and dataflow constant propagation
1 parent b96fa1a commit 5c6760f

27 files changed

+1949
-3
lines changed

compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
113113
}
114114

115115
pub fn misc_cast(
116-
&mut self,
116+
&self,
117117
src: &ImmTy<'tcx, M::Provenance>,
118118
cast_ty: Ty<'tcx>,
119119
) -> InterpResult<'tcx, Immediate<M::Provenance>> {

compiler/rustc_graphviz/src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,11 @@ pub trait Labeller<'a> {
471471
/// Escape tags in such a way that it is suitable for inclusion in a
472472
/// Graphviz HTML label.
473473
pub fn escape_html(s: &str) -> String {
474-
s.replace('&', "&amp;").replace('\"', "&quot;").replace('<', "&lt;").replace('>', "&gt;")
474+
s.replace('&', "&amp;")
475+
.replace('\"', "&quot;")
476+
.replace('<', "&lt;")
477+
.replace('>', "&gt;")
478+
.replace('\n', "<br align=\"left\"/>")
475479
}
476480

477481
impl<'a> LabelText<'a> {

compiler/rustc_mir_dataflow/src/framework/graphviz.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,10 @@ where
475475
r#"<td colspan="{colspan}" {fmt} align="left">{state}</td>"#,
476476
colspan = this.style.num_state_columns(),
477477
fmt = fmt,
478-
state = format!("{:?}", DebugWithAdapter { this: state, ctxt: analysis }),
478+
state = dot::escape_html(&format!(
479+
"{:?}",
480+
DebugWithAdapter { this: state, ctxt: analysis }
481+
)),
479482
)
480483
})
481484
}

compiler/rustc_mir_dataflow/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ pub mod move_paths;
4242
pub mod rustc_peek;
4343
pub mod storage;
4444
pub mod un_derefer;
45+
pub mod value_analysis;
4546

4647
pub(crate) mod indexes {
4748
pub(crate) use super::move_paths::MovePathIndex;

0 commit comments

Comments
 (0)