[meta] Legalization: Unprefix some module paths to make code neater;
This commit is contained in:
@@ -654,36 +654,32 @@ impl FormatPredicateNode {
|
|||||||
fn rust_predicate(&self) -> String {
|
fn rust_predicate(&self) -> String {
|
||||||
match &self.kind {
|
match &self.kind {
|
||||||
FormatPredicateKind::IsEqual(arg) => {
|
FormatPredicateKind::IsEqual(arg) => {
|
||||||
format!("crate::predicates::is_equal({}, {})", self.member_name, arg)
|
format!("predicates::is_equal({}, {})", self.member_name, arg)
|
||||||
}
|
}
|
||||||
FormatPredicateKind::IsSignedInt(width, scale) => format!(
|
FormatPredicateKind::IsSignedInt(width, scale) => format!(
|
||||||
"crate::predicates::is_signed_int({}, {}, {})",
|
"predicates::is_signed_int({}, {}, {})",
|
||||||
self.member_name, width, scale
|
self.member_name, width, scale
|
||||||
),
|
),
|
||||||
FormatPredicateKind::IsUnsignedInt(width, scale) => format!(
|
FormatPredicateKind::IsUnsignedInt(width, scale) => format!(
|
||||||
"crate::predicates::is_unsigned_int({}, {}, {})",
|
"predicates::is_unsigned_int({}, {}, {})",
|
||||||
self.member_name, width, scale
|
self.member_name, width, scale
|
||||||
),
|
),
|
||||||
FormatPredicateKind::IsZero32BitFloat => format!(
|
FormatPredicateKind::IsZero32BitFloat => {
|
||||||
"crate::predicates::is_zero_32_bit_float({})",
|
format!("predicates::is_zero_32_bit_float({})", self.member_name)
|
||||||
self.member_name
|
}
|
||||||
),
|
FormatPredicateKind::IsZero64BitFloat => {
|
||||||
FormatPredicateKind::IsZero64BitFloat => format!(
|
format!("predicates::is_zero_64_bit_float({})", self.member_name)
|
||||||
"crate::predicates::is_zero_64_bit_float({})",
|
}
|
||||||
self.member_name
|
|
||||||
),
|
|
||||||
FormatPredicateKind::LengthEquals(num) => format!(
|
FormatPredicateKind::LengthEquals(num) => format!(
|
||||||
"crate::predicates::has_length_of({}, {}, func)",
|
"predicates::has_length_of({}, {}, func)",
|
||||||
self.member_name, num
|
self.member_name, num
|
||||||
),
|
),
|
||||||
FormatPredicateKind::IsColocatedFunc => format!(
|
FormatPredicateKind::IsColocatedFunc => {
|
||||||
"crate::predicates::is_colocated_func({}, func)",
|
format!("predicates::is_colocated_func({}, func)", self.member_name,)
|
||||||
self.member_name,
|
}
|
||||||
),
|
FormatPredicateKind::IsColocatedData => {
|
||||||
FormatPredicateKind::IsColocatedData => format!(
|
format!("predicates::is_colocated_data({}, func)", self.member_name)
|
||||||
"crate::predicates::is_colocated_data({}, func)",
|
}
|
||||||
self.member_name
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ fn unwrap_inst(
|
|||||||
|
|
||||||
fmtln!(
|
fmtln!(
|
||||||
fmt,
|
fmt,
|
||||||
"let ({}, predicate) = if let crate::ir::InstructionData::{} {{",
|
"let ({}, predicate) = if let ir::InstructionData::{} {{",
|
||||||
arg_names,
|
arg_names,
|
||||||
iform.name
|
iform.name
|
||||||
);
|
);
|
||||||
@@ -407,17 +407,16 @@ fn gen_transform_group<'a>(
|
|||||||
// Function arguments.
|
// Function arguments.
|
||||||
fmtln!(fmt, "pub fn {}(", group.name);
|
fmtln!(fmt, "pub fn {}(", group.name);
|
||||||
fmt.indent(|fmt| {
|
fmt.indent(|fmt| {
|
||||||
fmt.line("inst: crate::ir::Inst,");
|
fmt.line("inst: ir::Inst,");
|
||||||
fmt.line("func: &mut crate::ir::Function,");
|
fmt.line("func: &mut ir::Function,");
|
||||||
fmt.line("cfg: &mut crate::flowgraph::ControlFlowGraph,");
|
fmt.line("cfg: &mut ControlFlowGraph,");
|
||||||
fmt.line("isa: &dyn crate::isa::TargetIsa,");
|
fmt.line("isa: &dyn TargetIsa,");
|
||||||
});
|
});
|
||||||
fmtln!(fmt, ") -> bool {");
|
fmtln!(fmt, ") -> bool {");
|
||||||
|
|
||||||
// Function body.
|
// Function body.
|
||||||
fmt.indent(|fmt| {
|
fmt.indent(|fmt| {
|
||||||
fmt.line("use crate::ir::InstBuilder;");
|
fmt.line("use ir::InstBuilder;");
|
||||||
fmt.line("use crate::cursor::{Cursor, FuncCursor};");
|
|
||||||
fmt.line("let mut pos = FuncCursor::new(func).at_inst(inst);");
|
fmt.line("let mut pos = FuncCursor::new(func).at_inst(inst);");
|
||||||
fmt.line("pos.use_srcloc(inst);");
|
fmt.line("pos.use_srcloc(inst);");
|
||||||
|
|
||||||
|
|||||||
@@ -6,12 +6,13 @@ use crate::cursor::{Cursor, FuncCursor};
|
|||||||
use crate::flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use crate::ir::condcodes::{FloatCC, IntCC};
|
use crate::ir::condcodes::{FloatCC, IntCC};
|
||||||
use crate::ir::{self, Function, Inst, InstBuilder};
|
use crate::ir::{self, Function, Inst, InstBuilder};
|
||||||
use crate::isa;
|
|
||||||
use crate::isa::constraints::*;
|
use crate::isa::constraints::*;
|
||||||
use crate::isa::enc_tables::*;
|
use crate::isa::enc_tables::*;
|
||||||
use crate::isa::encoding::base_size;
|
use crate::isa::encoding::base_size;
|
||||||
use crate::isa::encoding::RecipeSizing;
|
use crate::isa::encoding::RecipeSizing;
|
||||||
use crate::isa::RegUnit;
|
use crate::isa::RegUnit;
|
||||||
|
use crate::isa::{self, TargetIsa};
|
||||||
|
use crate::predicates;
|
||||||
use crate::regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/encoding-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/encoding-x86.rs"));
|
||||||
@@ -115,7 +116,7 @@ fn expand_sdivrem(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
isa: &dyn isa::TargetIsa,
|
isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
let (x, y, is_srem) = match func.dfg[inst] {
|
let (x, y, is_srem) = match func.dfg[inst] {
|
||||||
ir::InstructionData::Binary {
|
ir::InstructionData::Binary {
|
||||||
@@ -225,7 +226,7 @@ fn expand_udivrem(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
_cfg: &mut ControlFlowGraph,
|
_cfg: &mut ControlFlowGraph,
|
||||||
isa: &dyn isa::TargetIsa,
|
isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
let (x, y, is_urem) = match func.dfg[inst] {
|
let (x, y, is_urem) = match func.dfg[inst] {
|
||||||
ir::InstructionData::Binary {
|
ir::InstructionData::Binary {
|
||||||
@@ -278,7 +279,7 @@ fn expand_minmax(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &dyn isa::TargetIsa,
|
_isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
let (x, y, x86_opc, bitwise_opc) = match func.dfg[inst] {
|
let (x, y, x86_opc, bitwise_opc) = match func.dfg[inst] {
|
||||||
ir::InstructionData::Binary {
|
ir::InstructionData::Binary {
|
||||||
@@ -370,7 +371,7 @@ fn expand_fcvt_from_uint(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &dyn isa::TargetIsa,
|
_isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
let x;
|
let x;
|
||||||
match func.dfg[inst] {
|
match func.dfg[inst] {
|
||||||
@@ -441,7 +442,7 @@ fn expand_fcvt_to_sint(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &dyn isa::TargetIsa,
|
_isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
@@ -536,7 +537,7 @@ fn expand_fcvt_to_sint_sat(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &dyn isa::TargetIsa,
|
_isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
@@ -655,7 +656,7 @@ fn expand_fcvt_to_uint(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &dyn isa::TargetIsa,
|
_isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
@@ -736,7 +737,7 @@ fn expand_fcvt_to_uint_sat(
|
|||||||
inst: ir::Inst,
|
inst: ir::Inst,
|
||||||
func: &mut ir::Function,
|
func: &mut ir::Function,
|
||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &dyn isa::TargetIsa,
|
_isa: &dyn TargetIsa,
|
||||||
) {
|
) {
|
||||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ use crate::flowgraph::ControlFlowGraph;
|
|||||||
use crate::ir::types::I32;
|
use crate::ir::types::I32;
|
||||||
use crate::ir::{self, InstBuilder, MemFlags};
|
use crate::ir::{self, InstBuilder, MemFlags};
|
||||||
use crate::isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
|
use crate::predicates;
|
||||||
use crate::timing;
|
use crate::timing;
|
||||||
|
|
||||||
mod boundary;
|
mod boundary;
|
||||||
|
|||||||
Reference in New Issue
Block a user