Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
63c471e
rustc: Tweak filenames encoded into metadata
alexcrichton Sep 27, 2018
f81d1dd
Rewrite the `UnconditionalRecursion` lint to use MIR
wesleywiser Sep 12, 2018
7d3d835
replace escape-rust-expr test with dont-show-const-contents
Munksgaard Oct 4, 2018
f97e094
Add compile flags to playground-empty test
Munksgaard Oct 4, 2018
46ccce0
Remove duplicate test line
Munksgaard Oct 5, 2018
5f8dc0d
Fix unneeded-trait-implementations-title test
Munksgaard Oct 5, 2018
a9a26de
Fix redirect.rs test
Munksgaard Oct 5, 2018
28596ad
Fix empty-section.rs test
Munksgaard Oct 5, 2018
e961d39
Add line numbers option to rustdoc
GuillaumeGomez Oct 8, 2018
e8bc04e
Use XPATH notation to match against flattened nodes
Munksgaard Oct 10, 2018
9dbe902
Fix issue-46767 test
Munksgaard Oct 10, 2018
df79da9
Fix typo in deprecated_impls
Munksgaard Oct 10, 2018
a9217e3
Fix typo in issue-13698.rs
Munksgaard Oct 10, 2018
a75f781
AST-borrowck: add separate mem category for thread-locals, as they ar…
pnkfelix Oct 17, 2018
e6e4fe6
Update existing tests and .stderr files to reflect introduction of th…
pnkfelix Oct 17, 2018
1d46ce5
Add regression test for issue 47215.
pnkfelix Oct 17, 2018
9696882
Remove all jemalloc-related content
alexcrichton Oct 21, 2018
94cb105
Use `jemalloc-sys` on Linux and OSX compilers
alexcrichton Oct 21, 2018
b375728
Don't emit cannot move errors twice in migrate mode
matthewjasper Oct 20, 2018
412ad9b
Allow extern statics with an extern type
mjbshaw Oct 22, 2018
5b84550
Keep an obligation for both sized and unsized types
mjbshaw Oct 22, 2018
b5336c0
Add a cheap mode for `compute_missing_ctors`.
nnethercote Oct 17, 2018
8a3bb9a
Add template parameter debuginfo to generic types
tromey Oct 12, 2018
37e1d29
Don't rerun Mir passes when inlining
nikomatsakis Oct 20, 2018
895a4b2
Remove the `suite_index` parameter of the `run_passes!()` macro
wesleywiser Oct 21, 2018
c535147
Replace the `run_passes!` macro with a regular function
wesleywiser Oct 23, 2018
569228a
Fix link to macros chapter
steveklabnik Oct 24, 2018
4655866
Fix CR feedback
wesleywiser Oct 25, 2018
ee26e8e
Update RELEASES.md
frewsxcv Oct 25, 2018
2cfd790
List allowed tokens after macro fragments
estebank Oct 24, 2018
8ed2028
Rollup merge of #54490 - wesleywiser:rewrite_it_in_mir, r=oli-obk
pietroalbini Oct 25, 2018
5703243
Rollup merge of #54626 - alexcrichton:dwarf-generics, r=michaelwoerister
pietroalbini Oct 25, 2018
b5596fa
Rollup merge of #54824 - Munksgaard:fix-49713, r=QuietMisdreavus
pietroalbini Oct 25, 2018
eed093c
Rollup merge of #54921 - GuillaumeGomez:line-numbers, r=QuietMisdreavus
pietroalbini Oct 25, 2018
e75a203
Rollup merge of #55010 - tromey:Bug-9224-generic-parameters, r=michae…
pietroalbini Oct 25, 2018
ec906cc
Rollup merge of #55150 - pnkfelix:issues-47215-54797-fix-ice-from-mov…
pietroalbini Oct 25, 2018
9f59c45
Rollup merge of #55167 - nnethercote:is_missing_ctors_empty, r=varkor
pietroalbini Oct 25, 2018
5f1fd68
Rollup merge of #55221 - matthewjasper:fewer-duplicate-migrate-messag…
pietroalbini Oct 25, 2018
298dcd5
Rollup merge of #55238 - alexcrichton:rm-jemalloc, r=estebank
pietroalbini Oct 25, 2018
cdc3d6d
Rollup merge of #55244 - wesleywiser:issue-50411, r=nikomatsakis
pietroalbini Oct 25, 2018
691c00c
Rollup merge of #55257 - mjbshaw:static, r=oli-obk
pietroalbini Oct 25, 2018
c7ca552
Rollup merge of #55301 - estebank:macro-allowed, r=petrochenkov
pietroalbini Oct 25, 2018
aec920b
Rollup merge of #55325 - rust-lang:steveklabnik-patch-1, r=frewsxcv
pietroalbini Oct 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace the run_passes! macro with a regular function
As suggested in the feedback for #55244.

When I replaced the macro with a function, rustc started complaining
that there were two unused functions so I also removed those.
  • Loading branch information
wesleywiser committed Oct 23, 2018
commit c535147f291fee0c79553eabcd520156707cd0d4
1 change: 0 additions & 1 deletion src/librustc_mir/dataflow/impls/borrows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
}

crate fn borrows(&self) -> &IndexVec<BorrowIndex, BorrowData<'tcx>> { &self.borrow_set.borrows }
pub fn scope_tree(&self) -> &Lrc<region::ScopeTree> { &self.scope_tree }

pub fn location(&self, idx: BorrowIndex) -> &Location {
&self.borrow_set.borrows[idx].reserve_location
Expand Down
14 changes: 0 additions & 14 deletions src/librustc_mir/dataflow/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,20 +724,6 @@ impl<'a, 'tcx, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
}
}
}

pub fn new_from_sets(mir: &'a Mir<'tcx>,
dead_unwinds: &'a BitSet<mir::BasicBlock>,
sets: AllSets<D::Idx>,
denotation: D) -> Self {
DataflowAnalysis {
mir,
dead_unwinds,
flow_state: DataflowState {
sets: sets,
operator: denotation,
}
}
}
}

impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> where D: BitDenotation
Expand Down
134 changes: 67 additions & 67 deletions src/librustc_mir/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,68 +155,68 @@ pub trait MirPass {
mir: &mut Mir<'tcx>);
}

pub macro run_passes(
$tcx:ident,
$mir:ident,
$def_id:ident,
$mir_phase:expr;
$($pass:expr,)*
) {{
let phase_index = $mir_phase.phase_index();

let run_passes = |mir: &mut _, promoted| {
let mir: &mut Mir<'_> = mir;

if mir.phase >= $mir_phase {
pub fn run_passes(
tcx: TyCtxt<'a, 'tcx, 'tcx>,
mir: &mut Mir<'tcx>,
def_id: DefId,
mir_phase: MirPhase,
passes: &[&dyn MirPass]) {
let phase_index = mir_phase.phase_index();

let run_passes = |mir: &mut Mir<'tcx>, promoted| {
if mir.phase >= mir_phase {
return;
}

let source = MirSource {
def_id: $def_id,
promoted
def_id,
promoted,
};
let mut index = 0;
let mut run_pass = |pass: &dyn MirPass| {
let run_hooks = |mir: &_, index, is_after| {
dump_mir::on_mir_pass($tcx, &format_args!("{:03}-{:03}", phase_index, index),
dump_mir::on_mir_pass(tcx, &format_args!("{:03}-{:03}", phase_index, index),
&pass.name(), source, mir, is_after);
};
run_hooks(mir, index, false);
pass.run_pass($tcx, source, mir);
pass.run_pass(tcx, source, mir);
run_hooks(mir, index, true);

index += 1;
};
$(run_pass(&$pass);)*

mir.phase = $mir_phase;
for pass in passes {
run_pass(*pass);
}

mir.phase = mir_phase;
};

run_passes(&mut $mir, None);
run_passes(mir, None);

for (index, promoted_mir) in $mir.promoted.iter_enumerated_mut() {
for (index, promoted_mir) in mir.promoted.iter_enumerated_mut() {
run_passes(promoted_mir, Some(index));

// Let's make sure we don't miss any nested instances
assert!(promoted_mir.promoted.is_empty());
//Let's make sure we don't miss any nested instances
assert!(promoted_mir.promoted.is_empty())
}
}}
}

fn mir_const<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal<Mir<'tcx>> {
// Unsafety check uses the raw mir, so make sure it is run
let _ = tcx.unsafety_check_result(def_id);

let mut mir = tcx.mir_built(def_id).steal();
run_passes![tcx, mir, def_id, MirPhase::Const;
run_passes(tcx, &mut mir, def_id, MirPhase::Const, &[
// Remove all `EndRegion` statements that are not involved in borrows.
cleanup_post_borrowck::CleanEndRegions,
&cleanup_post_borrowck::CleanEndRegions,

// What we need to do constant evaluation.
simplify::SimplifyCfg::new("initial"),
type_check::TypeckMir,
rustc_peek::SanityCheck,
uniform_array_move_out::UniformArrayMoveOut,
];
&simplify::SimplifyCfg::new("initial"),
&type_check::TypeckMir,
&rustc_peek::SanityCheck,
&uniform_array_move_out::UniformArrayMoveOut,
]);
tcx.alloc_steal_mir(mir)
}

Expand All @@ -229,11 +229,11 @@ fn mir_validated<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
}

let mut mir = tcx.mir_const(def_id).steal();
run_passes![tcx, mir, def_id, MirPhase::Validated;
run_passes(tcx, &mut mir, def_id, MirPhase::Validated, &[
// What we need to run borrowck etc.
qualify_consts::QualifyAndPromoteConstants,
simplify::SimplifyCfg::new("qualify-consts"),
];
&qualify_consts::QualifyAndPromoteConstants,
&simplify::SimplifyCfg::new("qualify-consts"),
]);
tcx.alloc_steal_mir(mir)
}

Expand All @@ -247,59 +247,59 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
}

let mut mir = tcx.mir_validated(def_id).steal();
run_passes![tcx, mir, def_id, MirPhase::Optimized;
run_passes(tcx, &mut mir, def_id, MirPhase::Optimized, &[
// Remove all things not needed by analysis
no_landing_pads::NoLandingPads,
simplify_branches::SimplifyBranches::new("initial"),
remove_noop_landing_pads::RemoveNoopLandingPads,
&no_landing_pads::NoLandingPads,
&simplify_branches::SimplifyBranches::new("initial"),
&remove_noop_landing_pads::RemoveNoopLandingPads,
// Remove all `AscribeUserType` statements.
cleanup_post_borrowck::CleanAscribeUserType,
&cleanup_post_borrowck::CleanAscribeUserType,
// Remove all `FakeRead` statements and the borrows that are only
// used for checking matches
cleanup_post_borrowck::CleanFakeReadsAndBorrows,
simplify::SimplifyCfg::new("early-opt"),
&cleanup_post_borrowck::CleanFakeReadsAndBorrows,
&simplify::SimplifyCfg::new("early-opt"),

// These next passes must be executed together
add_call_guards::CriticalCallEdges,
elaborate_drops::ElaborateDrops,
no_landing_pads::NoLandingPads,
&add_call_guards::CriticalCallEdges,
&elaborate_drops::ElaborateDrops,
&no_landing_pads::NoLandingPads,
// AddValidation needs to run after ElaborateDrops and before EraseRegions, and it needs
// an AllCallEdges pass right before it.
add_call_guards::AllCallEdges,
add_validation::AddValidation,
&add_call_guards::AllCallEdges,
&add_validation::AddValidation,
// AddMovesForPackedDrops needs to run after drop
// elaboration.
add_moves_for_packed_drops::AddMovesForPackedDrops,
&add_moves_for_packed_drops::AddMovesForPackedDrops,

simplify::SimplifyCfg::new("elaborate-drops"),
&simplify::SimplifyCfg::new("elaborate-drops"),

// No lifetime analysis based on borrowing can be done from here on out.

// From here on out, regions are gone.
erase_regions::EraseRegions,
&erase_regions::EraseRegions,

lower_128bit::Lower128Bit,
&lower_128bit::Lower128Bit,


// Optimizations begin.
uniform_array_move_out::RestoreSubsliceArrayMoveOut,
inline::Inline,
&uniform_array_move_out::RestoreSubsliceArrayMoveOut,
&inline::Inline,

// Lowering generator control-flow and variables
// has to happen before we do anything else to them.
generator::StateTransform,

instcombine::InstCombine,
const_prop::ConstProp,
simplify_branches::SimplifyBranches::new("after-const-prop"),
deaggregator::Deaggregator,
copy_prop::CopyPropagation,
remove_noop_landing_pads::RemoveNoopLandingPads,
simplify::SimplifyCfg::new("final"),
simplify::SimplifyLocals,

add_call_guards::CriticalCallEdges,
dump_mir::Marker("PreCodegen"),
];
&generator::StateTransform,

&instcombine::InstCombine,
&const_prop::ConstProp,
&simplify_branches::SimplifyBranches::new("after-const-prop"),
&deaggregator::Deaggregator,
&copy_prop::CopyPropagation,
&remove_noop_landing_pads::RemoveNoopLandingPads,
&simplify::SimplifyCfg::new("final"),
&simplify::SimplifyLocals,

&add_call_guards::CriticalCallEdges,
&dump_mir::Marker("PreCodegen"),
]);
tcx.alloc_mir(mir)
}