From b9bf131ff01948811ad01895ea5145a25d495675 Mon Sep 17 00:00:00 2001 From: rarbore2 <rarbore2@illinois.edu> Date: Sun, 12 Jan 2025 23:48:47 -0600 Subject: [PATCH] Misc. clean-up --- hercules_cg/Cargo.toml | 1 + hercules_cg/src/cpu.rs | 7 +----- hercules_cg/src/device.rs | 4 +--- hercules_cg/src/lib.rs | 4 +--- hercules_cg/src/rt.rs | 7 +----- hercules_ir/Cargo.toml | 3 ++- hercules_ir/src/dataflow.rs | 6 ++--- hercules_ir/src/dot.rs | 4 +--- hercules_ir/src/fork_join_analysis.rs | 4 +--- hercules_ir/src/ir.rs | 23 ++++++++----------- hercules_ir/src/loops.rs | 4 +--- hercules_ir/src/parse.rs | 2 -- hercules_ir/src/subgraph.rs | 4 +--- hercules_ir/src/verify.rs | 4 +--- hercules_opt/Cargo.toml | 1 + hercules_opt/src/ccp.rs | 12 ++++------ hercules_opt/src/dce.rs | 6 ++--- hercules_opt/src/delete_uncalled.rs | 8 +++---- hercules_opt/src/editor.rs | 19 ++++++--------- hercules_opt/src/float_collections.rs | 4 +--- hercules_opt/src/fork_concat_split.rs | 4 +--- hercules_opt/src/fork_guard_elim.rs | 8 +++---- hercules_opt/src/forkify.rs | 8 +++---- hercules_opt/src/gcm.rs | 15 ++++-------- hercules_opt/src/gvn.rs | 4 +--- hercules_opt/src/inline.rs | 8 +++---- hercules_opt/src/interprocedural_sroa.rs | 6 ++--- hercules_opt/src/outline.rs | 12 ++++------ hercules_opt/src/pass.rs | 22 +++++------------- hercules_opt/src/phi_elim.rs | 7 ++---- hercules_opt/src/pred.rs | 11 ++++----- hercules_opt/src/schedule.rs | 6 ++--- hercules_opt/src/sroa.rs | 4 +--- hercules_opt/src/unforkify.rs | 4 +--- hercules_opt/src/utils.rs | 6 ++--- hercules_rt/Cargo.toml | 1 + hercules_samples/call/build.rs | 1 - hercules_samples/call/src/main.rs | 3 --- hercules_samples/ccp/build.rs | 1 - hercules_samples/ccp/src/main.rs | 3 --- hercules_samples/dot/build.rs | 1 - hercules_samples/dot/src/main.rs | 4 ---- hercules_samples/fac/build.rs | 1 - hercules_samples/fac/src/main.rs | 4 ---- hercules_samples/matmul/build.rs | 1 - hercules_samples/matmul/src/main.rs | 5 ---- .../hercules_interpreter/src/interpreter.rs | 13 ++++------- .../hercules_interpreter/src/main.rs | 15 ++++-------- .../hercules_interpreter/src/value.rs | 11 +++------ .../hercules_tests/tests/opt_tests.rs | 7 +++--- hercules_tools/hercules_driver/Cargo.toml | 1 + hercules_tools/hercules_driver/src/main.rs | 3 --- juno_build/src/lib.rs | 2 -- juno_frontend/src/lib.rs | 2 -- juno_frontend/src/main.rs | 2 -- juno_frontend/src/semant.rs | 2 -- juno_frontend/src/ssa.rs | 5 ++-- juno_frontend/src/types.rs | 5 ++-- juno_samples/antideps/build.rs | 1 - juno_samples/antideps/src/main.rs | 3 --- juno_samples/casts_and_intrinsics/build.rs | 1 - juno_samples/casts_and_intrinsics/src/main.rs | 3 --- juno_samples/implicit_clone/build.rs | 1 - juno_samples/implicit_clone/src/main.rs | 3 --- juno_samples/matmul/build.rs | 1 - juno_samples/matmul/src/main.rs | 5 ---- juno_samples/nested_ccp/build.rs | 1 - juno_samples/nested_ccp/src/main.rs | 4 ---- juno_samples/simple3/build.rs | 1 - juno_samples/simple3/src/main.rs | 4 ---- juno_scheduler/src/lib.rs | 4 +--- reports/technical1/main.tex | 3 --- 72 files changed, 107 insertions(+), 273 deletions(-) diff --git a/hercules_cg/Cargo.toml b/hercules_cg/Cargo.toml index 8a60956b..cf0767de 100644 --- a/hercules_cg/Cargo.toml +++ b/hercules_cg/Cargo.toml @@ -2,6 +2,7 @@ name = "hercules_cg" version = "0.1.0" authors = ["Russel Arbore <rarbore2@illinois.edu>"] +edition = "2021" [dependencies] rand = "*" diff --git a/hercules_cg/src/cpu.rs b/hercules_cg/src/cpu.rs index 41524404..3f600fc0 100644 --- a/hercules_cg/src/cpu.rs +++ b/hercules_cg/src/cpu.rs @@ -1,11 +1,9 @@ -extern crate hercules_ir; - use std::collections::BTreeMap; use std::fmt::{Error, Write}; use std::iter::zip; use std::sync::atomic::{AtomicUsize, Ordering}; -use self::hercules_ir::*; +use hercules_ir::*; use crate::*; @@ -21,7 +19,6 @@ pub fn cpu_codegen<W: Write>( types: &Vec<Type>, constants: &Vec<Constant>, dynamic_constants: &Vec<DynamicConstant>, - reverse_postorder: &Vec<NodeID>, typing: &Vec<TypeID>, control_subgraph: &Subgraph, bbs: &BasicBlocks, @@ -32,7 +29,6 @@ pub fn cpu_codegen<W: Write>( types, constants, dynamic_constants, - reverse_postorder, typing, control_subgraph, bbs, @@ -45,7 +41,6 @@ struct CPUContext<'a> { types: &'a Vec<Type>, constants: &'a Vec<Constant>, dynamic_constants: &'a Vec<DynamicConstant>, - reverse_postorder: &'a Vec<NodeID>, typing: &'a Vec<TypeID>, control_subgraph: &'a Subgraph, bbs: &'a BasicBlocks, diff --git a/hercules_cg/src/device.rs b/hercules_cg/src/device.rs index 7dbeeeda..866fa6ad 100644 --- a/hercules_cg/src/device.rs +++ b/hercules_cg/src/device.rs @@ -1,6 +1,4 @@ -extern crate hercules_ir; - -use self::hercules_ir::*; +use hercules_ir::*; /* * Top level function to definitively place functions onto devices. A function diff --git a/hercules_cg/src/lib.rs b/hercules_cg/src/lib.rs index 77cfa540..a70effb5 100644 --- a/hercules_cg/src/lib.rs +++ b/hercules_cg/src/lib.rs @@ -8,9 +8,7 @@ pub use crate::cpu::*; pub use crate::device::*; pub use crate::rt::*; -extern crate hercules_ir; - -use self::hercules_ir::*; +use hercules_ir::*; /* * Basic block info consists of two things: diff --git a/hercules_cg/src/rt.rs b/hercules_cg/src/rt.rs index 6278b790..65f71215 100644 --- a/hercules_cg/src/rt.rs +++ b/hercules_cg/src/rt.rs @@ -1,10 +1,8 @@ -extern crate hercules_ir; - use std::collections::BTreeMap; use std::fmt::{Error, Write}; use std::iter::zip; -use self::hercules_ir::*; +use hercules_ir::*; use crate::*; @@ -16,7 +14,6 @@ use crate::*; pub fn rt_codegen<W: Write>( func_id: FunctionID, module: &Module, - reverse_postorder: &Vec<NodeID>, typing: &Vec<TypeID>, control_subgraph: &Subgraph, bbs: &BasicBlocks, @@ -28,7 +25,6 @@ pub fn rt_codegen<W: Write>( let ctx = RTContext { func_id, module, - reverse_postorder, typing, control_subgraph, bbs, @@ -42,7 +38,6 @@ pub fn rt_codegen<W: Write>( struct RTContext<'a> { func_id: FunctionID, module: &'a Module, - reverse_postorder: &'a Vec<NodeID>, typing: &'a Vec<TypeID>, control_subgraph: &'a Subgraph, bbs: &'a BasicBlocks, diff --git a/hercules_ir/Cargo.toml b/hercules_ir/Cargo.toml index 44648c11..deda9cc5 100644 --- a/hercules_ir/Cargo.toml +++ b/hercules_ir/Cargo.toml @@ -2,10 +2,11 @@ name = "hercules_ir" version = "0.1.0" authors = ["Russel Arbore <rarbore2@illinois.edu>, Aaron Councilman <aaronjc4@illinois.edu>"] +edition = "2021" [dependencies] rand = "*" nom = "*" ordered-float = { version = "*", features = ["serde"] } bitvec = "*" -serde = { version = "*", features = ["derive"] } \ No newline at end of file +serde = { version = "*", features = ["derive"] } diff --git a/hercules_ir/src/dataflow.rs b/hercules_ir/src/dataflow.rs index 6df19d14..ced77d0b 100644 --- a/hercules_ir/src/dataflow.rs +++ b/hercules_ir/src/dataflow.rs @@ -1,7 +1,5 @@ -extern crate bitvec; - -use self::bitvec::prelude::*; -use self::bitvec::slice::*; +use bitvec::prelude::*; +use bitvec::slice::*; use crate::*; diff --git a/hercules_ir/src/dot.rs b/hercules_ir/src/dot.rs index c05f2606..4d526366 100644 --- a/hercules_ir/src/dot.rs +++ b/hercules_ir/src/dot.rs @@ -1,5 +1,3 @@ -extern crate rand; - use std::collections::HashMap; use std::env::temp_dir; use std::fmt::Write; @@ -7,7 +5,7 @@ use std::fs::File; use std::io::Write as _; use std::process::Command; -use self::rand::Rng; +use rand::Rng; use crate::*; diff --git a/hercules_ir/src/fork_join_analysis.rs b/hercules_ir/src/fork_join_analysis.rs index 5fe6b132..130bc2ed 100644 --- a/hercules_ir/src/fork_join_analysis.rs +++ b/hercules_ir/src/fork_join_analysis.rs @@ -1,8 +1,6 @@ -extern crate bitvec; - use std::collections::{HashMap, HashSet}; -use self::bitvec::prelude::*; +use bitvec::prelude::*; use crate::*; diff --git a/hercules_ir/src/ir.rs b/hercules_ir/src/ir.rs index 8bb8e4ef..3c5ed0bd 100644 --- a/hercules_ir/src/ir.rs +++ b/hercules_ir/src/ir.rs @@ -1,15 +1,12 @@ -extern crate bitvec; -extern crate ordered_float; -extern crate serde; - use std::fmt::Write; use std::ops::Coroutine; use std::ops::CoroutineState; use std::pin::Pin; -use self::bitvec::prelude::*; -use self::serde::Deserialize; -use self::serde::Serialize; +use bitvec::prelude::*; +use ordered_float::OrderedFloat; +use serde::Deserialize; +use serde::Serialize; use crate::*; @@ -93,8 +90,8 @@ pub enum Constant { UnsignedInteger16(u16), UnsignedInteger32(u32), UnsignedInteger64(u64), - Float32(ordered_float::OrderedFloat<f32>), - Float64(ordered_float::OrderedFloat<f64>), + Float32(OrderedFloat<f32>), + Float64(OrderedFloat<f64>), Product(TypeID, Box<[ConstantID]>), Summation(TypeID, u32, ConstantID), // Array constants are always zero. @@ -938,8 +935,8 @@ impl Constant { Constant::UnsignedInteger16(0) => true, Constant::UnsignedInteger32(0) => true, Constant::UnsignedInteger64(0) => true, - Constant::Float32(ord) => *ord == ordered_float::OrderedFloat::<f32>(0.0), - Constant::Float64(ord) => *ord == ordered_float::OrderedFloat::<f64>(0.0), + Constant::Float32(ord) => *ord == OrderedFloat::<f32>(0.0), + Constant::Float64(ord) => *ord == OrderedFloat::<f64>(0.0), _ => false, } } @@ -954,8 +951,8 @@ impl Constant { Constant::UnsignedInteger16(1) => true, Constant::UnsignedInteger32(1) => true, Constant::UnsignedInteger64(1) => true, - Constant::Float32(ord) => *ord == ordered_float::OrderedFloat::<f32>(1.0), - Constant::Float64(ord) => *ord == ordered_float::OrderedFloat::<f64>(1.0), + Constant::Float32(ord) => *ord == OrderedFloat::<f32>(1.0), + Constant::Float64(ord) => *ord == OrderedFloat::<f64>(1.0), _ => false, } } diff --git a/hercules_ir/src/loops.rs b/hercules_ir/src/loops.rs index 3ab3313f..13e935e0 100644 --- a/hercules_ir/src/loops.rs +++ b/hercules_ir/src/loops.rs @@ -1,10 +1,8 @@ -extern crate bitvec; - use std::collections::hash_map; use std::collections::VecDeque; use std::collections::{HashMap, HashSet}; -use self::bitvec::prelude::*; +use bitvec::prelude::*; use crate::*; diff --git a/hercules_ir/src/parse.rs b/hercules_ir/src/parse.rs index 5e4b1217..21eb325a 100644 --- a/hercules_ir/src/parse.rs +++ b/hercules_ir/src/parse.rs @@ -1,5 +1,3 @@ -extern crate nom; - use std::cell::RefCell; use std::collections::HashMap; use std::str::FromStr; diff --git a/hercules_ir/src/subgraph.rs b/hercules_ir/src/subgraph.rs index a4948016..908011d3 100644 --- a/hercules_ir/src/subgraph.rs +++ b/hercules_ir/src/subgraph.rs @@ -1,9 +1,7 @@ -extern crate bitvec; - use std::collections::{HashMap, HashSet}; use std::mem::take; -use self::bitvec::prelude::*; +use bitvec::prelude::*; use crate::*; diff --git a/hercules_ir/src/verify.rs b/hercules_ir/src/verify.rs index 18ad92c3..572bb9d1 100644 --- a/hercules_ir/src/verify.rs +++ b/hercules_ir/src/verify.rs @@ -1,9 +1,7 @@ -extern crate bitvec; - use std::collections::HashMap; use std::iter::zip; -use self::bitvec::prelude::*; +use bitvec::prelude::*; use crate::*; diff --git a/hercules_opt/Cargo.toml b/hercules_opt/Cargo.toml index e1936a97..20d73402 100644 --- a/hercules_opt/Cargo.toml +++ b/hercules_opt/Cargo.toml @@ -2,6 +2,7 @@ name = "hercules_opt" version = "0.1.0" authors = ["Russel Arbore <rarbore2@illinois.edu>, Aaron Councilman <aaronjc4@illinois.edu>"] +edition = "2021" [dependencies] ordered-float = "*" diff --git a/hercules_opt/src/ccp.rs b/hercules_opt/src/ccp.rs index a66bf633..39fab9da 100644 --- a/hercules_opt/src/ccp.rs +++ b/hercules_opt/src/ccp.rs @@ -1,12 +1,10 @@ -extern crate hercules_ir; - use std::cmp::{max, min}; use std::collections::HashSet; use std::iter::zip; -use self::hercules_ir::dataflow::*; -use self::hercules_ir::def_use::get_uses; -use self::hercules_ir::ir::*; +use hercules_ir::dataflow::*; +use hercules_ir::def_use::get_uses; +use hercules_ir::ir::*; use crate::*; @@ -415,8 +413,8 @@ fn ccp_flow_function( }), // If node has only one output, if doesn't directly handle crossover of // reachability and constant propagation. Read handles that. - Node::If { control, cond } => inputs[control.idx()].clone(), - Node::Match { control, sum } => inputs[control.idx()].clone(), + Node::If { control, cond: _ } => inputs[control.idx()].clone(), + Node::Match { control, sum: _ } => inputs[control.idx()].clone(), Node::Fork { control, factors: _, diff --git a/hercules_opt/src/dce.rs b/hercules_opt/src/dce.rs index 839e9ad1..026672a3 100644 --- a/hercules_opt/src/dce.rs +++ b/hercules_opt/src/dce.rs @@ -1,7 +1,5 @@ -extern crate hercules_ir; - -use self::hercules_ir::def_use::*; -use self::hercules_ir::ir::*; +use hercules_ir::def_use::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/delete_uncalled.rs b/hercules_opt/src/delete_uncalled.rs index 78ab4285..1a19ee01 100644 --- a/hercules_opt/src/delete_uncalled.rs +++ b/hercules_opt/src/delete_uncalled.rs @@ -1,9 +1,7 @@ -extern crate bitvec; -extern crate hercules_ir; -use self::bitvec::prelude::*; +use bitvec::prelude::*; -use self::hercules_ir::callgraph::*; -use self::hercules_ir::ir::*; +use hercules_ir::callgraph::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/editor.rs b/hercules_opt/src/editor.rs index 31359651..1318f032 100644 --- a/hercules_opt/src/editor.rs +++ b/hercules_opt/src/editor.rs @@ -1,18 +1,13 @@ -extern crate bitvec; -extern crate either; -extern crate hercules_ir; -extern crate itertools; - use std::cell::{Ref, RefCell}; use std::collections::{BTreeMap, HashSet}; use std::mem::take; use std::ops::Deref; -use self::bitvec::prelude::*; -use self::either::Either; +use bitvec::prelude::*; +use either::Either; -use self::hercules_ir::def_use::*; -use self::hercules_ir::ir::*; +use hercules_ir::def_use::*; +use hercules_ir::ir::*; /* * Helper object for editing Hercules functions in a trackable manner. Edits @@ -125,7 +120,7 @@ impl<'a: 'b, 'b> FunctionEditor<'a> { let FunctionEdit { editor, deleted_nodeids, - added_nodeids, + added_nodeids: _, added_and_updated_nodes, added_and_updated_schedules, added_constants, @@ -604,8 +599,8 @@ mod editor_tests { use std::mem::replace; - use self::hercules_ir::dataflow::reverse_postorder; - use self::hercules_ir::parse::parse; + use hercules_ir::dataflow::reverse_postorder; + use hercules_ir::parse::parse; fn canonicalize(function: &mut Function) -> Vec<Option<NodeID>> { // The reverse postorder traversal from the Start node is a map from new diff --git a/hercules_opt/src/float_collections.rs b/hercules_opt/src/float_collections.rs index 30df3875..faa38375 100644 --- a/hercules_opt/src/float_collections.rs +++ b/hercules_opt/src/float_collections.rs @@ -1,6 +1,4 @@ -extern crate hercules_ir; - -use self::hercules_ir::*; +use hercules_ir::*; use crate::*; diff --git a/hercules_opt/src/fork_concat_split.rs b/hercules_opt/src/fork_concat_split.rs index 232b43f7..186cd6a6 100644 --- a/hercules_opt/src/fork_concat_split.rs +++ b/hercules_opt/src/fork_concat_split.rs @@ -1,9 +1,7 @@ -extern crate hercules_ir; - use std::collections::{HashMap, HashSet}; use std::iter::zip; -use self::hercules_ir::ir::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/fork_guard_elim.rs b/hercules_opt/src/fork_guard_elim.rs index cfa2a6ff..842c8308 100644 --- a/hercules_opt/src/fork_guard_elim.rs +++ b/hercules_opt/src/fork_guard_elim.rs @@ -1,10 +1,8 @@ -extern crate hercules_ir; - use std::collections::{HashMap, HashSet}; -use self::hercules_ir::get_uses_mut; -use self::hercules_ir::ir::*; -use self::hercules_ir::ImmutableDefUseMap; +use hercules_ir::get_uses_mut; +use hercules_ir::ir::*; +use hercules_ir::ImmutableDefUseMap; /* * This is a Hercules IR transformation that: diff --git a/hercules_opt/src/forkify.rs b/hercules_opt/src/forkify.rs index e32bef38..fb53a5e4 100644 --- a/hercules_opt/src/forkify.rs +++ b/hercules_opt/src/forkify.rs @@ -1,10 +1,8 @@ -extern crate hercules_ir; - use std::iter::zip; -use self::hercules_ir::def_use::*; -use self::hercules_ir::ir::*; -use self::hercules_ir::loops::*; +use hercules_ir::def_use::*; +use hercules_ir::ir::*; +use hercules_ir::loops::*; /* * Top level function to convert natural loops with simple induction variables diff --git a/hercules_opt/src/gcm.rs b/hercules_opt/src/gcm.rs index 76ce3fdf..a7df9bd9 100644 --- a/hercules_opt/src/gcm.rs +++ b/hercules_opt/src/gcm.rs @@ -1,16 +1,11 @@ -extern crate bitvec; -extern crate either; -extern crate hercules_cg; -extern crate hercules_ir; - use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque}; use std::iter::{empty, once, zip, FromIterator}; -use self::bitvec::prelude::*; -use self::either::Either; +use bitvec::prelude::*; +use either::Either; -use self::hercules_cg::*; -use self::hercules_ir::*; +use hercules_cg::*; +use hercules_ir::*; use crate::*; @@ -59,7 +54,6 @@ pub fn gcm( editor.func_id(), def_use, reverse_postorder, - control_subgraph, dom, loops, fork_join_map, @@ -86,7 +80,6 @@ fn basic_blocks( func_id: FunctionID, def_use: &ImmutableDefUseMap, reverse_postorder: &Vec<NodeID>, - control_subgraph: &Subgraph, dom: &DomTree, loops: &LoopTree, fork_join_map: &HashMap<NodeID, NodeID>, diff --git a/hercules_opt/src/gvn.rs b/hercules_opt/src/gvn.rs index 69ed8e4a..42835e85 100644 --- a/hercules_opt/src/gvn.rs +++ b/hercules_opt/src/gvn.rs @@ -1,8 +1,6 @@ -extern crate hercules_ir; - use std::collections::HashMap; -use self::hercules_ir::ir::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/inline.rs b/hercules_opt/src/inline.rs index 9ab15874..63a05b0c 100644 --- a/hercules_opt/src/inline.rs +++ b/hercules_opt/src/inline.rs @@ -1,11 +1,9 @@ -extern crate hercules_ir; - use std::collections::HashMap; use std::iter::zip; -use self::hercules_ir::callgraph::*; -use self::hercules_ir::def_use::*; -use self::hercules_ir::ir::*; +use hercules_ir::callgraph::*; +use hercules_ir::def_use::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/interprocedural_sroa.rs b/hercules_opt/src/interprocedural_sroa.rs index c6cf448b..9edb4d02 100644 --- a/hercules_opt/src/interprocedural_sroa.rs +++ b/hercules_opt/src/interprocedural_sroa.rs @@ -1,9 +1,9 @@ -extern crate hercules_ir; use std::collections::HashMap; +use std::iter::zip; + +use hercules_ir::ir::*; -use self::hercules_ir::ir::*; use crate::*; -use std::iter::zip; /** * Given an editor for each function in a module, return V s.t. diff --git a/hercules_opt/src/outline.rs b/hercules_opt/src/outline.rs index 23983833..80f97c7f 100644 --- a/hercules_opt/src/outline.rs +++ b/hercules_opt/src/outline.rs @@ -1,14 +1,12 @@ -extern crate hercules_ir; - use std::collections::{BTreeMap, BTreeSet}; use std::iter::zip; use std::sync::atomic::{AtomicUsize, Ordering}; -use self::hercules_ir::def_use::*; -use self::hercules_ir::dom::*; -use self::hercules_ir::fork_join_analysis::*; -use self::hercules_ir::ir::*; -use self::hercules_ir::subgraph::*; +use hercules_ir::def_use::*; +use hercules_ir::dom::*; +use hercules_ir::fork_join_analysis::*; +use hercules_ir::ir::*; +use hercules_ir::subgraph::*; use crate::*; diff --git a/hercules_opt/src/pass.rs b/hercules_opt/src/pass.rs index 57fd464d..7685d304 100644 --- a/hercules_opt/src/pass.rs +++ b/hercules_opt/src/pass.rs @@ -1,9 +1,3 @@ -extern crate hercules_cg; -extern crate hercules_ir; -extern crate postcard; -extern crate serde; -extern crate take_mut; - use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use std::env::temp_dir; @@ -12,10 +6,10 @@ use std::io::Write; use std::iter::zip; use std::process::{Command, Stdio}; -use self::serde::Deserialize; +use serde::Deserialize; -use self::hercules_cg::*; -use self::hercules_ir::*; +use hercules_cg::*; +use hercules_ir::*; use crate::*; @@ -920,12 +914,10 @@ impl PassManager { ); } Pass::Codegen(output_dir, module_name) => { - self.make_reverse_postorders(); self.make_typing(); self.make_control_subgraphs(); self.make_collection_objects(); self.make_callgraph(); - let reverse_postorders = self.reverse_postorders.as_ref().unwrap(); let typing = self.typing.as_ref().unwrap(); let control_subgraphs = self.control_subgraphs.as_ref().unwrap(); let bbs = self.bbs.as_ref().unwrap(); @@ -943,7 +935,6 @@ impl PassManager { &self.module.types, &self.module.constants, &self.module.dynamic_constants, - &reverse_postorders[idx], &typing[idx], &control_subgraphs[idx], &bbs[idx], @@ -953,7 +944,6 @@ impl PassManager { Device::AsyncRust => rt_codegen( FunctionID::new(idx), &self.module, - &reverse_postorders[idx], &typing[idx], &control_subgraphs[idx], &bbs[idx], @@ -972,14 +962,15 @@ impl PassManager { // Write the LLVM IR into a temporary file. let mut tmp_path = temp_dir(); tmp_path.push(format!("{}.ll", module_name)); + println!("{}", tmp_path.display()); let mut file = File::create(&tmp_path) .expect("PANIC: Unable to open output LLVM IR file."); file.write_all(llvm_ir.as_bytes()) .expect("PANIC: Unable to write output LLVM IR file contents."); - println!("{}", tmp_path.display()); // Compile LLVM IR into an ELF object file. let output_archive = format!("{}/lib{}.a", output_dir, module_name); + println!("{}", output_archive); let mut clang_process = Command::new("clang") .arg(&tmp_path) .arg("--emit-static-lib") @@ -992,15 +983,14 @@ impl PassManager { .spawn() .expect("Error running clang. Is it installed?"); assert!(clang_process.wait().unwrap().success()); - println!("{}", output_archive); // Write the Rust runtime into a file. let output_rt = format!("{}/rt_{}.hrt", output_dir, module_name); + println!("{}", output_rt); let mut file = File::create(&output_rt) .expect("PANIC: Unable to open output Rust runtime file."); file.write_all(rust_rt.as_bytes()) .expect("PANIC: Unable to write output Rust runtime file contents."); - println!("{}", output_rt); } Pass::Serialize(output_file) => { let module_contents: Vec<u8> = postcard::to_allocvec(&self.module).unwrap(); diff --git a/hercules_opt/src/phi_elim.rs b/hercules_opt/src/phi_elim.rs index 2788e56a..a79b43d3 100644 --- a/hercules_opt/src/phi_elim.rs +++ b/hercules_opt/src/phi_elim.rs @@ -1,12 +1,9 @@ -extern crate bitvec; -extern crate hercules_ir; - use std::collections::VecDeque; use std::iter::FromIterator; -use self::bitvec::prelude::*; +use bitvec::prelude::*; -use self::hercules_ir::ir::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/pred.rs b/hercules_opt/src/pred.rs index 09d9753d..be1b4a0b 100644 --- a/hercules_opt/src/pred.rs +++ b/hercules_opt/src/pred.rs @@ -1,15 +1,12 @@ -extern crate bitvec; -extern crate hercules_ir; - use std::collections::HashMap; use std::collections::HashSet; use std::collections::VecDeque; -use self::bitvec::prelude::*; +use bitvec::prelude::*; -use self::hercules_ir::def_use::*; -use self::hercules_ir::dom::*; -use self::hercules_ir::ir::*; +use hercules_ir::def_use::*; +use hercules_ir::dom::*; +use hercules_ir::ir::*; /* * Top level function to convert acyclic control flow in vectorized fork-joins diff --git a/hercules_opt/src/schedule.rs b/hercules_opt/src/schedule.rs index ff895b16..2c8209aa 100644 --- a/hercules_opt/src/schedule.rs +++ b/hercules_opt/src/schedule.rs @@ -1,9 +1,7 @@ -extern crate hercules_ir; - use std::collections::{HashMap, HashSet}; -use self::hercules_ir::def_use::*; -use self::hercules_ir::ir::*; +use hercules_ir::def_use::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/sroa.rs b/hercules_opt/src/sroa.rs index a73ecb2b..6461ad71 100644 --- a/hercules_opt/src/sroa.rs +++ b/hercules_opt/src/sroa.rs @@ -1,8 +1,6 @@ -extern crate hercules_ir; - use std::collections::{BTreeMap, HashMap, VecDeque}; -use self::hercules_ir::ir::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/unforkify.rs b/hercules_opt/src/unforkify.rs index 61c86a27..a5df7a7c 100644 --- a/hercules_opt/src/unforkify.rs +++ b/hercules_opt/src/unforkify.rs @@ -1,9 +1,7 @@ -extern crate hercules_ir; - use std::collections::HashMap; use std::iter::zip; -use self::hercules_ir::ir::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_opt/src/utils.rs b/hercules_opt/src/utils.rs index c32225b5..77fa1ff6 100644 --- a/hercules_opt/src/utils.rs +++ b/hercules_opt/src/utils.rs @@ -1,7 +1,5 @@ -extern crate hercules_ir; - -use self::hercules_ir::def_use::*; -use self::hercules_ir::ir::*; +use hercules_ir::def_use::*; +use hercules_ir::ir::*; use crate::*; diff --git a/hercules_rt/Cargo.toml b/hercules_rt/Cargo.toml index 0bf19adf..7201f411 100644 --- a/hercules_rt/Cargo.toml +++ b/hercules_rt/Cargo.toml @@ -2,6 +2,7 @@ name = "hercules_rt" version = "0.1.0" authors = ["Russel Arbore <rarbore2@illinois.edu>"] +edition = "2021" [dependencies] diff --git a/hercules_samples/call/build.rs b/hercules_samples/call/build.rs index dbefe008..af48fe64 100644 --- a/hercules_samples/call/build.rs +++ b/hercules_samples/call/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/hercules_samples/call/src/main.rs b/hercules_samples/call/src/main.rs index b5c999fd..0b657dd8 100644 --- a/hercules_samples/call/src/main.rs +++ b/hercules_samples/call/src/main.rs @@ -1,8 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate juno_build; - juno_build::juno!("call"); fn main() { diff --git a/hercules_samples/ccp/build.rs b/hercules_samples/ccp/build.rs index 650b51b8..f04d48c7 100644 --- a/hercules_samples/ccp/build.rs +++ b/hercules_samples/ccp/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/hercules_samples/ccp/src/main.rs b/hercules_samples/ccp/src/main.rs index 9e2aced9..7f6459a0 100644 --- a/hercules_samples/ccp/src/main.rs +++ b/hercules_samples/ccp/src/main.rs @@ -1,8 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate juno_build; - juno_build::juno!("ccp"); fn main() { diff --git a/hercules_samples/dot/build.rs b/hercules_samples/dot/build.rs index cfa03fd3..2a239bc6 100644 --- a/hercules_samples/dot/build.rs +++ b/hercules_samples/dot/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/hercules_samples/dot/src/main.rs b/hercules_samples/dot/src/main.rs index 34d397ef..0b5c6a93 100644 --- a/hercules_samples/dot/src/main.rs +++ b/hercules_samples/dot/src/main.rs @@ -1,9 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate hercules_rt; -extern crate juno_build; - use hercules_rt::HerculesBox; juno_build::juno!("dot"); diff --git a/hercules_samples/fac/build.rs b/hercules_samples/fac/build.rs index 49a60248..4d8226f1 100644 --- a/hercules_samples/fac/build.rs +++ b/hercules_samples/fac/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/hercules_samples/fac/src/main.rs b/hercules_samples/fac/src/main.rs index 7071fd2c..b6e0257b 100644 --- a/hercules_samples/fac/src/main.rs +++ b/hercules_samples/fac/src/main.rs @@ -1,7 +1,3 @@ -extern crate async_std; -extern crate clap; -extern crate juno_build; - juno_build::juno!("fac"); fn main() { diff --git a/hercules_samples/matmul/build.rs b/hercules_samples/matmul/build.rs index ec6eb892..08478dea 100644 --- a/hercules_samples/matmul/build.rs +++ b/hercules_samples/matmul/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/hercules_samples/matmul/src/main.rs b/hercules_samples/matmul/src/main.rs index 34612801..587109f8 100644 --- a/hercules_samples/matmul/src/main.rs +++ b/hercules_samples/matmul/src/main.rs @@ -1,10 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate hercules_rt; -extern crate juno_build; -extern crate rand; - use rand::random; use hercules_rt::HerculesBox; diff --git a/hercules_test/hercules_interpreter/src/interpreter.rs b/hercules_test/hercules_interpreter/src/interpreter.rs index a166427f..621260e5 100644 --- a/hercules_test/hercules_interpreter/src/interpreter.rs +++ b/hercules_test/hercules_interpreter/src/interpreter.rs @@ -1,19 +1,14 @@ -extern crate itertools; -extern crate ordered_float; -use crate::value; - -use self::itertools::Itertools; use std::collections::HashMap; use std::panic; use std::collections::hash_map::Entry::Occupied; -use value::*; +use itertools::Itertools; -extern crate hercules_ir; -extern crate hercules_opt; +use hercules_ir::*; -use self::hercules_ir::*; +use crate::value; +use value::*; /* High level design details / discussion for this: * diff --git a/hercules_test/hercules_interpreter/src/main.rs b/hercules_test/hercules_interpreter/src/main.rs index 4d2ebd31..5db31cd7 100644 --- a/hercules_test/hercules_interpreter/src/main.rs +++ b/hercules_test/hercules_interpreter/src/main.rs @@ -1,18 +1,13 @@ -extern crate clap; -extern crate hercules_ir; -extern crate hercules_opt; -extern crate rand; +use std::fs::File; +use std::io::prelude::*; +use clap::Parser; + +use hercules_ir::*; use hercules_interpreter::interpreter::*; use hercules_interpreter::*; use hercules_interpreter::value; -use std::fs::File; -use std::io::prelude::*; - -use self::hercules_ir::*; - -use clap::Parser; #[derive(Parser, Debug)] #[command(author, version, about, long_about = None)] diff --git a/hercules_test/hercules_interpreter/src/value.rs b/hercules_test/hercules_interpreter/src/value.rs index d236145c..e032bd5b 100644 --- a/hercules_test/hercules_interpreter/src/value.rs +++ b/hercules_test/hercules_interpreter/src/value.rs @@ -1,23 +1,18 @@ #![allow(unused)] -extern crate derive_more; use derive_more::From; /* Defines semantic meaning of IR operations. */ -extern crate itertools; use crate::dyn_const_value; -use self::itertools::Itertools; +use itertools::Itertools; use std::clone; use std::convert::TryInto; use std::panic; -extern crate hercules_ir; -extern crate hercules_opt; - -use self::hercules_ir::*; -use self::hercules_opt::*; +use hercules_ir::*; +use hercules_opt::*; #[derive(PartialEq, Debug, Clone, Eq)] pub enum InterpreterVal { diff --git a/hercules_test/hercules_tests/tests/opt_tests.rs b/hercules_test/hercules_tests/tests/opt_tests.rs index c14d4db5..388dfedd 100644 --- a/hercules_test/hercules_tests/tests/opt_tests.rs +++ b/hercules_test/hercules_tests/tests/opt_tests.rs @@ -1,11 +1,10 @@ use std::env; +use rand::Rng; + use hercules_interpreter::*; use hercules_opt::pass::Pass; -extern crate rand; -use rand::Rng; - #[test] fn matmul_int() { let module = parse_file("../test_inputs/matmul_int.hir"); @@ -198,4 +197,4 @@ fn sum_int2_smaller() { Pass::DCE, ], vec![1; 100]); -} \ No newline at end of file +} diff --git a/hercules_tools/hercules_driver/Cargo.toml b/hercules_tools/hercules_driver/Cargo.toml index 9236c34a..ad9397b1 100644 --- a/hercules_tools/hercules_driver/Cargo.toml +++ b/hercules_tools/hercules_driver/Cargo.toml @@ -2,6 +2,7 @@ name = "hercules_driver" version = "0.1.0" authors = ["Russel Arbore <rarbore2@illinois.edu>"] +edition = "2021" [dependencies] clap = { version = "*", features = ["derive"] } diff --git a/hercules_tools/hercules_driver/src/main.rs b/hercules_tools/hercules_driver/src/main.rs index 97c9fe2e..a2550022 100644 --- a/hercules_tools/hercules_driver/src/main.rs +++ b/hercules_tools/hercules_driver/src/main.rs @@ -1,6 +1,3 @@ -extern crate clap; -extern crate postcard; - use std::fs::File; use std::io::prelude::*; use std::path::Path; diff --git a/juno_build/src/lib.rs b/juno_build/src/lib.rs index fdaf4d27..0c676e4c 100644 --- a/juno_build/src/lib.rs +++ b/juno_build/src/lib.rs @@ -1,5 +1,3 @@ -extern crate hercules_ir; - use juno_compiler::*; use std::env::{current_dir, var}; diff --git a/juno_frontend/src/lib.rs b/juno_frontend/src/lib.rs index 9297173d..906d7805 100644 --- a/juno_frontend/src/lib.rs +++ b/juno_frontend/src/lib.rs @@ -9,8 +9,6 @@ mod semant; mod ssa; mod types; -extern crate hercules_ir; - use std::fmt; use std::path::Path; diff --git a/juno_frontend/src/main.rs b/juno_frontend/src/main.rs index 4624e716..d98c1e29 100644 --- a/juno_frontend/src/main.rs +++ b/juno_frontend/src/main.rs @@ -1,5 +1,3 @@ -extern crate clap; - use juno_compiler::*; use clap::{ArgGroup, Parser}; diff --git a/juno_frontend/src/semant.rs b/juno_frontend/src/semant.rs index 1ccdf3ed..660d8afe 100644 --- a/juno_frontend/src/semant.rs +++ b/juno_frontend/src/semant.rs @@ -1,5 +1,3 @@ -extern crate hercules_ir; - use std::collections::{HashMap, LinkedList}; use std::fmt; use std::fs::File; diff --git a/juno_frontend/src/ssa.rs b/juno_frontend/src/ssa.rs index f5e1d830..578f7a9a 100644 --- a/juno_frontend/src/ssa.rs +++ b/juno_frontend/src/ssa.rs @@ -4,12 +4,11 @@ * Compiler Construction. CC 2013. Lecture Notes in Computer Science, vol 7791. Springer, Berlin, * Heidelberg. https://doi.org/10.1007/978-3-642-37051-9_6 */ -extern crate hercules_ir; use std::collections::{HashMap, HashSet}; -use self::hercules_ir::build::*; -use self::hercules_ir::ir::*; +use hercules_ir::build::*; +use hercules_ir::ir::*; use crate::labeled_builder::LabeledBuilder; pub struct SSA { diff --git a/juno_frontend/src/types.rs b/juno_frontend/src/types.rs index 582e7cfd..5f907cd9 100644 --- a/juno_frontend/src/types.rs +++ b/juno_frontend/src/types.rs @@ -1,11 +1,12 @@ use std::collections::{HashMap, HashSet, VecDeque}; use crate::dynconst::DynConst; -use crate::hercules_ir::build::*; -use crate::hercules_ir::ir::*; use crate::locs::Location; use crate::parser; +use hercules_ir::build::*; +use hercules_ir::ir::*; + #[derive(Copy, Clone, PartialEq, Eq, Debug)] pub enum Either<A, B> { Left(A), diff --git a/juno_samples/antideps/build.rs b/juno_samples/antideps/build.rs index 757243b8..7ed716a4 100644 --- a/juno_samples/antideps/build.rs +++ b/juno_samples/antideps/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/juno_samples/antideps/src/main.rs b/juno_samples/antideps/src/main.rs index a9c225b2..0b065cba 100644 --- a/juno_samples/antideps/src/main.rs +++ b/juno_samples/antideps/src/main.rs @@ -1,8 +1,5 @@ #![feature(future_join, box_as_ptr)] -extern crate async_std; -extern crate juno_build; - juno_build::juno!("antideps"); fn main() { diff --git a/juno_samples/casts_and_intrinsics/build.rs b/juno_samples/casts_and_intrinsics/build.rs index fafa97bb..16d5c7a4 100644 --- a/juno_samples/casts_and_intrinsics/build.rs +++ b/juno_samples/casts_and_intrinsics/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/juno_samples/casts_and_intrinsics/src/main.rs b/juno_samples/casts_and_intrinsics/src/main.rs index 037d4c40..8ee509bf 100644 --- a/juno_samples/casts_and_intrinsics/src/main.rs +++ b/juno_samples/casts_and_intrinsics/src/main.rs @@ -1,8 +1,5 @@ #![feature(future_join)] -extern crate async_std; -extern crate juno_build; - juno_build::juno!("casts_and_intrinsics"); fn main() { diff --git a/juno_samples/implicit_clone/build.rs b/juno_samples/implicit_clone/build.rs index 3378966b..75c1afc4 100644 --- a/juno_samples/implicit_clone/build.rs +++ b/juno_samples/implicit_clone/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/juno_samples/implicit_clone/src/main.rs b/juno_samples/implicit_clone/src/main.rs index a92e4e2d..bc687ed3 100644 --- a/juno_samples/implicit_clone/src/main.rs +++ b/juno_samples/implicit_clone/src/main.rs @@ -1,8 +1,5 @@ #![feature(future_join, box_as_ptr)] -extern crate async_std; -extern crate juno_build; - juno_build::juno!("implicit_clone"); fn main() { diff --git a/juno_samples/matmul/build.rs b/juno_samples/matmul/build.rs index 81f645e0..926fbc33 100644 --- a/juno_samples/matmul/build.rs +++ b/juno_samples/matmul/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/juno_samples/matmul/src/main.rs b/juno_samples/matmul/src/main.rs index 11066e8b..e6fb2543 100644 --- a/juno_samples/matmul/src/main.rs +++ b/juno_samples/matmul/src/main.rs @@ -1,10 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate hercules_rt; -extern crate juno_build; -extern crate rand; - use rand::random; use hercules_rt::HerculesBox; diff --git a/juno_samples/nested_ccp/build.rs b/juno_samples/nested_ccp/build.rs index 0fb54be3..c5c7ca6a 100644 --- a/juno_samples/nested_ccp/build.rs +++ b/juno_samples/nested_ccp/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/juno_samples/nested_ccp/src/main.rs b/juno_samples/nested_ccp/src/main.rs index 11561eb8..974a488c 100644 --- a/juno_samples/nested_ccp/src/main.rs +++ b/juno_samples/nested_ccp/src/main.rs @@ -1,9 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate hercules_rt; -extern crate juno_build; - use hercules_rt::HerculesBox; juno_build::juno!("nested_ccp"); diff --git a/juno_samples/simple3/build.rs b/juno_samples/simple3/build.rs index 0e476e8d..94760025 100644 --- a/juno_samples/simple3/build.rs +++ b/juno_samples/simple3/build.rs @@ -1,4 +1,3 @@ -extern crate juno_build; use juno_build::JunoCompiler; fn main() { diff --git a/juno_samples/simple3/src/main.rs b/juno_samples/simple3/src/main.rs index 8ca54344..1f6e213c 100644 --- a/juno_samples/simple3/src/main.rs +++ b/juno_samples/simple3/src/main.rs @@ -1,9 +1,5 @@ #![feature(box_as_ptr, let_chains)] -extern crate async_std; -extern crate hercules_rt; -extern crate juno_build; - use hercules_rt::HerculesBox; juno_build::juno!("simple3"); diff --git a/juno_scheduler/src/lib.rs b/juno_scheduler/src/lib.rs index 7e558d6b..d515633e 100644 --- a/juno_scheduler/src/lib.rs +++ b/juno_scheduler/src/lib.rs @@ -1,5 +1,3 @@ -extern crate hercules_ir; - use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::Read; @@ -7,7 +5,7 @@ use std::io::Read; use lrlex::DefaultLexerTypes; use lrpar::NonStreamingLexer; -use self::hercules_ir::ir::*; +use hercules_ir::ir::*; mod parser; use crate::parser::lexer; diff --git a/reports/technical1/main.tex b/reports/technical1/main.tex index 4743d206..e70625d4 100644 --- a/reports/technical1/main.tex +++ b/reports/technical1/main.tex @@ -502,9 +502,6 @@ The manifest plus the Hercules module itself are loaded from a \texttt{.hbin} fi Here's an example host code written in Rust: \begin{lstlisting}[style=colouredRust] -extern crate async_std; -extern crate hercules_rt; - hercules_rt::use_hbin!("my_module.hbin"); fn main() { -- GitLab