diff --git a/src/libcretonne/cfg.rs b/src/libcretonne/cfg.rs index c018ab4671..970af69afd 100644 --- a/src/libcretonne/cfg.rs +++ b/src/libcretonne/cfg.rs @@ -22,9 +22,9 @@ //! Here Ebb1 and Ebb2 would each have a single predecessor denoted as (Ebb0, `brz vx, Ebb1`) //! and (Ebb0, `jmp Ebb2`) respectively. -use repr::Function; -use repr::entities::{Inst, Ebb}; -use repr::instructions::InstructionData; +use ir::Function; +use ir::entities::{Inst, Ebb}; +use ir::instructions::InstructionData; use entity_map::EntityMap; /// A basic block denoted by its enclosing Ebb and last instruction. @@ -158,7 +158,7 @@ impl<'a> Iterator for CFGPredecessorsIter<'a> { #[cfg(test)] mod tests { use super::*; - use repr::Function; + use ir::Function; use test_utils::make_inst; diff --git a/src/libcretonne/repr/condcodes.rs b/src/libcretonne/ir/condcodes.rs similarity index 100% rename from src/libcretonne/repr/condcodes.rs rename to src/libcretonne/ir/condcodes.rs diff --git a/src/libcretonne/repr/dfg.rs b/src/libcretonne/ir/dfg.rs similarity index 97% rename from src/libcretonne/repr/dfg.rs rename to src/libcretonne/ir/dfg.rs index 29a462f73e..d377813544 100644 --- a/src/libcretonne/repr/dfg.rs +++ b/src/libcretonne/ir/dfg.rs @@ -1,9 +1,9 @@ //! Data flow graph tracking Instructions, Values, and EBBs. use entity_map::EntityMap; -use repr::entities::{Ebb, Inst, Value, NO_VALUE, ExpandedValue}; -use repr::instructions::InstructionData; -use repr::types::Type; +use ir::entities::{Ebb, Inst, Value, NO_VALUE, ExpandedValue}; +use ir::instructions::InstructionData; +use ir::types::Type; use std::ops::{Index, IndexMut}; use std::u16; @@ -57,7 +57,7 @@ impl DataFlowGraph { /// Get the type of a value. pub fn value_type(&self, v: Value) -> Type { - use repr::entities::ExpandedValue::*; + use ir::entities::ExpandedValue::*; match v.expand() { Direct(i) => self.insts[i].first_type(), Table(i) => { @@ -75,7 +75,7 @@ impl DataFlowGraph { /// This is either the instruction that defined it or the Ebb that has the value as an /// argument. pub fn value_def(&self, v: Value) -> ValueDef { - use repr::entities::ExpandedValue::*; + use ir::entities::ExpandedValue::*; match v.expand() { Direct(inst) => ValueDef::Res(inst, 0), Table(idx) => { @@ -339,8 +339,8 @@ impl EbbData { #[cfg(test)] mod tests { use super::*; - use repr::types; - use repr::instructions::{Opcode, InstructionData}; + use ir::types; + use ir::instructions::{Opcode, InstructionData}; #[test] fn make_inst() { diff --git a/src/libcretonne/repr/entities.rs b/src/libcretonne/ir/entities.rs similarity index 100% rename from src/libcretonne/repr/entities.rs rename to src/libcretonne/ir/entities.rs diff --git a/src/libcretonne/repr/immediates.rs b/src/libcretonne/ir/immediates.rs similarity index 100% rename from src/libcretonne/repr/immediates.rs rename to src/libcretonne/ir/immediates.rs diff --git a/src/libcretonne/repr/instructions.rs b/src/libcretonne/ir/instructions.rs similarity index 99% rename from src/libcretonne/repr/instructions.rs rename to src/libcretonne/ir/instructions.rs index 7ebb71bbf4..a6c7bd03f1 100644 --- a/src/libcretonne/repr/instructions.rs +++ b/src/libcretonne/ir/instructions.rs @@ -10,10 +10,10 @@ use std::fmt::{self, Display, Formatter}; use std::str::FromStr; use std::ops::{Deref, DerefMut}; -use repr::entities::*; -use repr::immediates::*; -use repr::condcodes::*; -use repr::types::{self, Type}; +use ir::entities::*; +use ir::immediates::*; +use ir::condcodes::*; +use ir::types::{self, Type}; // Include code generated by `meta/gen_instr.py`. This file contains: // @@ -560,7 +560,7 @@ mod tests { #[test] fn value_set() { - use repr::types::*; + use ir::types::*; let vts = ValueTypeSet { allow_scalars: true, diff --git a/src/libcretonne/repr/layout.rs b/src/libcretonne/ir/layout.rs similarity index 99% rename from src/libcretonne/repr/layout.rs rename to src/libcretonne/ir/layout.rs index 36ee2dacf8..a01d49ef53 100644 --- a/src/libcretonne/repr/layout.rs +++ b/src/libcretonne/ir/layout.rs @@ -5,7 +5,7 @@ use std::iter::{Iterator, IntoIterator}; use entity_map::{EntityMap, EntityRef}; -use repr::entities::{Ebb, NO_EBB, Inst, NO_INST}; +use ir::entities::{Ebb, NO_EBB, Inst, NO_INST}; /// The `Layout` struct determines the layout of EBBs and instructions in a function. It does not /// contain definitions of instructions or EBBs, but depends on `Inst` and `Ebb` entity references @@ -242,7 +242,7 @@ impl<'a> Iterator for Insts<'a> { mod tests { use super::Layout; use entity_map::EntityRef; - use repr::entities::{Ebb, Inst}; + use ir::entities::{Ebb, Inst}; #[test] fn append_ebb() { diff --git a/src/libcretonne/repr/mod.rs b/src/libcretonne/ir/mod.rs similarity index 96% rename from src/libcretonne/repr/mod.rs rename to src/libcretonne/ir/mod.rs index a62527ccbe..fb93e9ec99 100644 --- a/src/libcretonne/repr/mod.rs +++ b/src/libcretonne/ir/mod.rs @@ -8,11 +8,11 @@ pub mod instructions; pub mod dfg; pub mod layout; -use repr::types::{FunctionName, Signature}; +use ir::types::{FunctionName, Signature}; use entity_map::EntityRef; -use repr::entities::{Ebb, NO_EBB, StackSlot}; -use repr::dfg::DataFlowGraph; -use repr::layout::Layout; +use ir::entities::{Ebb, NO_EBB, StackSlot}; +use ir::dfg::DataFlowGraph; +use ir::layout::Layout; use std::fmt::{self, Debug, Display, Formatter}; use std::ops::Index; diff --git a/src/libcretonne/repr/types.rs b/src/libcretonne/ir/types.rs similarity index 100% rename from src/libcretonne/repr/types.rs rename to src/libcretonne/ir/types.rs diff --git a/src/libcretonne/lib.rs b/src/libcretonne/lib.rs index 0b1ac8678e..f81bfb5720 100644 --- a/src/libcretonne/lib.rs +++ b/src/libcretonne/lib.rs @@ -7,7 +7,7 @@ pub const VERSION: &'static str = env!("CARGO_PKG_VERSION"); -pub mod repr; +pub mod ir; pub mod write; pub mod cfg; diff --git a/src/libcretonne/test_utils/make_inst.rs b/src/libcretonne/test_utils/make_inst.rs index 00955a5be5..adc45cdb67 100644 --- a/src/libcretonne/test_utils/make_inst.rs +++ b/src/libcretonne/test_utils/make_inst.rs @@ -1,9 +1,9 @@ //! Helper functions for generating dummy instructions. -use repr::Function; -use repr::entities::{Ebb, Inst, NO_VALUE}; -use repr::instructions::{InstructionData, Opcode, VariableArgs, JumpData, BranchData}; -use repr::types; +use ir::Function; +use ir::entities::{Ebb, Inst, NO_VALUE}; +use ir::instructions::{InstructionData, Opcode, VariableArgs, JumpData, BranchData}; +use ir::types; pub fn jump(func: &mut Function, dest: Ebb) -> Inst { func.dfg.make_inst(InstructionData::Jump { diff --git a/src/libcretonne/write.rs b/src/libcretonne/write.rs index 5b66b81065..b42fdf02fd 100644 --- a/src/libcretonne/write.rs +++ b/src/libcretonne/write.rs @@ -5,9 +5,9 @@ //! `cretonne-reader` crate. use std::io::{self, Write}; -use repr::Function; -use repr::entities::{Inst, Ebb, Value}; -use repr::types::Type; +use ir::Function; +use ir::entities::{Inst, Ebb, Value}; +use ir::types::Type; pub type Result = io::Result<()>; @@ -182,7 +182,7 @@ pub fn write_instruction(w: &mut Write, func: &Function, inst: Inst) -> Result { } // Then the operands, depending on format. - use repr::instructions::InstructionData::*; + use ir::instructions::InstructionData::*; match func.dfg[inst] { Nullary { .. } => writeln!(w, ""), Unary { arg, .. } => writeln!(w, " {}", arg), @@ -217,8 +217,8 @@ pub fn write_instruction(w: &mut Write, func: &Function, inst: Inst) -> Result { mod tests { use super::*; use super::{needs_quotes, escaped}; - use repr::{Function, StackSlotData}; - use repr::types; + use ir::{Function, StackSlotData}; + use ir::types; #[test] fn quoting() { diff --git a/src/libreader/lexer.rs b/src/libreader/lexer.rs index 87c7482589..3803260c05 100644 --- a/src/libreader/lexer.rs +++ b/src/libreader/lexer.rs @@ -6,8 +6,8 @@ // ====--------------------------------------------------------------------------------------====// use std::str::CharIndices; -use cretonne::repr::types; -use cretonne::repr::entities::{Value, Ebb}; +use cretonne::ir::types; +use cretonne::ir::entities::{Value, Ebb}; /// The location of a `Token` or `Error`. #[derive(Debug, Clone, Copy, PartialEq, Eq)] @@ -373,8 +373,8 @@ impl<'a> Lexer<'a> { #[cfg(test)] mod tests { use super::*; - use cretonne::repr::types; - use cretonne::repr::entities::{Value, Ebb}; + use cretonne::ir::types; + use cretonne::ir::entities::{Value, Ebb}; fn token<'a>(token: Token<'a>, line: usize) -> Option, LocatedError>> { Some(super::token(token, Location { line_number: line })) diff --git a/src/libreader/parser.rs b/src/libreader/parser.rs index 0c573558c7..e333c0d3e9 100644 --- a/src/libreader/parser.rs +++ b/src/libreader/parser.rs @@ -11,12 +11,12 @@ use std::fmt::{self, Display, Formatter}; use std::str::FromStr; use std::u32; use lexer::{self, Lexer, Token}; -use cretonne::repr::types::{Type, VOID, FunctionName, Signature, ArgumentType, ArgumentExtension}; -use cretonne::repr::immediates::{Imm64, Ieee32, Ieee64}; -use cretonne::repr::entities::*; -use cretonne::repr::instructions::{Opcode, InstructionFormat, InstructionData, VariableArgs, +use cretonne::ir::types::{Type, VOID, FunctionName, Signature, ArgumentType, ArgumentExtension}; +use cretonne::ir::immediates::{Imm64, Ieee32, Ieee64}; +use cretonne::ir::entities::*; +use cretonne::ir::instructions::{Opcode, InstructionFormat, InstructionData, VariableArgs, JumpData, BranchData, ReturnData}; -use cretonne::repr::{Function, StackSlotData}; +use cretonne::ir::{Function, StackSlotData}; pub use lexer::Location; @@ -1039,7 +1039,7 @@ impl<'a> Parser<'a> { #[cfg(test)] mod tests { use super::*; - use cretonne::repr::types::{self, ArgumentType, ArgumentExtension}; + use cretonne::ir::types::{self, ArgumentType, ArgumentExtension}; #[test] fn argument_type() { diff --git a/src/tools/print_cfg.rs b/src/tools/print_cfg.rs index dfa0113fee..9a08c0287e 100644 --- a/src/tools/print_cfg.rs +++ b/src/tools/print_cfg.rs @@ -6,9 +6,9 @@ use std::fs::File; use std::io::{Read, Write, stdout}; use CommandResult; -use cretonne::repr::Function; +use cretonne::ir::Function; use cretonne::cfg::ControlFlowGraph; -use cretonne::repr::instructions::InstructionData; +use cretonne::ir::instructions::InstructionData; use cton_reader::parser::Parser; pub fn run(files: Vec) -> CommandResult {