Update to Rust 2018 edition (#632)
* initial cargo fix run * Upgrade cranelift-entity crate * Upgrade bforest crate * Upgrade the codegen crate * Upgrade the faerie crate * Upgrade the filetests crate * Upgrade the codegen-meta crate * Upgrade the frontend crate * Upgrade the cranelift-module crate * Upgrade the cranelift-native crate * Upgrade the cranelift-preopt crate * Upgrade the cranelift-reader crate * Upgrade the cranelift-serde crate * Upgrade the cranelift-simplejit crate * Upgrade the cranelift or cranelift-umbrella crate * Upgrade the cranelift-wasm crate * Upgrade cranelift-tools crate * Use new import style on remaining files * run format-all.sh * run test-all.sh, update Readme and travis ci configuration fixed an AssertionError also * Remove deprecated functions
This commit is contained in:
committed by
Dan Gohman
parent
e3db942b0c
commit
effe6c04e4
@@ -7,7 +7,7 @@ language: rust
|
|||||||
rust:
|
rust:
|
||||||
# The oldest version we currently support. See
|
# The oldest version we currently support. See
|
||||||
# CONTRIBUTING.md#rustc-version-support for details.
|
# CONTRIBUTING.md#rustc-version-support for details.
|
||||||
- 1.30.1
|
- 1.31.1
|
||||||
- beta
|
- beta
|
||||||
- nightly
|
- nightly
|
||||||
matrix:
|
matrix:
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ license = "Apache-2.0 WITH LLVM-exception"
|
|||||||
documentation = "https://cranelift.readthedocs.io/"
|
documentation = "https://cranelift.readthedocs.io/"
|
||||||
repository = "https://github.com/CraneStation/cranelift"
|
repository = "https://github.com/CraneStation/cranelift"
|
||||||
publish = false
|
publish = false
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "clif-util"
|
name = "clif-util"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ into executable machine code.
|
|||||||
[](https://travis-ci.org/CraneStation/cranelift)
|
[](https://travis-ci.org/CraneStation/cranelift)
|
||||||
[](https://ci.appveyor.com/project/CraneStation/cranelift)
|
[](https://ci.appveyor.com/project/CraneStation/cranelift)
|
||||||
[](https://gitter.im/CraneStation/Lobby)
|
[](https://gitter.im/CraneStation/Lobby)
|
||||||

|

|
||||||
|
|
||||||
For more information, see [the
|
For more information, see [the
|
||||||
documentation](https://cranelift.readthedocs.io/en/latest/?badge=latest).
|
documentation](https://cranelift.readthedocs.io/en/latest/?badge=latest).
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
//! Read a sequence of Cranelift IR files and print them again to stdout. This has the effect of
|
//! Read a sequence of Cranelift IR files and print them again to stdout. This has the effect of
|
||||||
//! normalizing formatting and removing comments.
|
//! normalizing formatting and removing comments.
|
||||||
|
|
||||||
|
use crate::utils::read_to_string;
|
||||||
|
use crate::CommandResult;
|
||||||
use cranelift_reader::parse_functions;
|
use cranelift_reader::parse_functions;
|
||||||
use utils::read_to_string;
|
|
||||||
use CommandResult;
|
|
||||||
|
|
||||||
pub fn run(files: &[String]) -> CommandResult {
|
pub fn run(files: &[String]) -> CommandResult {
|
||||||
for (i, f) in files.into_iter().enumerate() {
|
for (i, f) in files.into_iter().enumerate() {
|
||||||
|
|||||||
@@ -13,28 +13,13 @@
|
|||||||
)
|
)
|
||||||
)]
|
)]
|
||||||
|
|
||||||
extern crate file_per_thread_logger;
|
use cfg_if::cfg_if;
|
||||||
#[macro_use]
|
|
||||||
extern crate cfg_if;
|
|
||||||
#[cfg(feature = "disas")]
|
|
||||||
extern crate capstone;
|
|
||||||
extern crate clap;
|
|
||||||
extern crate cranelift_codegen;
|
|
||||||
#[cfg(feature = "wasm")]
|
|
||||||
extern crate cranelift_entity;
|
|
||||||
extern crate cranelift_filetests;
|
|
||||||
extern crate cranelift_reader;
|
|
||||||
extern crate pretty_env_logger;
|
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "wasm")] {
|
if #[cfg(feature = "wasm")] {
|
||||||
extern crate cranelift_wasm;
|
|
||||||
extern crate term;
|
|
||||||
extern crate wabt;
|
|
||||||
mod wasm;
|
mod wasm;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
extern crate target_lexicon;
|
|
||||||
|
|
||||||
use clap::{App, Arg, SubCommand};
|
use clap::{App, Arg, SubCommand};
|
||||||
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
|
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
//! CLI tool to read Cranelift IR files and compile them into native code.
|
//! CLI tool to read Cranelift IR files and compile them into native code.
|
||||||
|
|
||||||
|
use crate::utils::{parse_sets_and_triple, read_to_string};
|
||||||
|
use cfg_if::cfg_if;
|
||||||
use cranelift_codegen::isa::TargetIsa;
|
use cranelift_codegen::isa::TargetIsa;
|
||||||
use cranelift_codegen::print_errors::pretty_error;
|
use cranelift_codegen::print_errors::pretty_error;
|
||||||
use cranelift_codegen::settings::FlagsOrIsa;
|
use cranelift_codegen::settings::FlagsOrIsa;
|
||||||
@@ -9,7 +11,6 @@ use cranelift_codegen::{binemit, ir};
|
|||||||
use cranelift_reader::parse_test;
|
use cranelift_reader::parse_test;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use utils::{parse_sets_and_triple, read_to_string};
|
|
||||||
|
|
||||||
struct PrintRelocs {
|
struct PrintRelocs {
|
||||||
flag_print: bool,
|
flag_print: bool,
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
//! Read a series of Cranelift IR files and print their control flow graphs
|
//! Read a series of Cranelift IR files and print their control flow graphs
|
||||||
//! in graphviz format.
|
//! in graphviz format.
|
||||||
|
|
||||||
|
use crate::utils::read_to_string;
|
||||||
|
use crate::CommandResult;
|
||||||
use cranelift_codegen::cfg_printer::CFGPrinter;
|
use cranelift_codegen::cfg_printer::CFGPrinter;
|
||||||
use cranelift_reader::parse_functions;
|
use cranelift_reader::parse_functions;
|
||||||
use utils::read_to_string;
|
|
||||||
use CommandResult;
|
|
||||||
|
|
||||||
pub fn run(files: &[String]) -> CommandResult {
|
pub fn run(files: &[String]) -> CommandResult {
|
||||||
for (i, f) in files.into_iter().enumerate() {
|
for (i, f) in files.into_iter().enumerate() {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use cranelift_wasm::{
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use term;
|
use term;
|
||||||
use utils::{parse_sets_and_triple, read_to_end};
|
use crate::utils::{parse_sets_and_triple, read_to_end};
|
||||||
use wabt::wat2wasm;
|
use wabt::wat2wasm;
|
||||||
|
|
||||||
macro_rules! vprintln {
|
macro_rules! vprintln {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
extern crate cranelift_filetests;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn filetests() {
|
fn filetests() {
|
||||||
// Run all the filetests in the following directories.
|
// Run all the filetests in the following directories.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ repository = "https://github.com/CraneStation/cranelift"
|
|||||||
categories = ["no-std"]
|
categories = ["no-std"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["btree", "forest", "set", "map"]
|
keywords = ["btree", "forest", "set", "map"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cranelift-entity = { path = "../entity", version = "0.26.0", default-features = false }
|
cranelift-entity = { path = "../entity", version = "0.26.0", default-features = false }
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ mod std {
|
|||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate cranelift_entity as entity;
|
extern crate cranelift_entity as entity;
|
||||||
use entity::packed_option;
|
use crate::entity::packed_option;
|
||||||
|
|
||||||
use std::borrow::BorrowMut;
|
use std::borrow::BorrowMut;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
@@ -157,7 +157,7 @@ fn slice_shift<T: Copy>(s: &mut [T], n: usize) {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
|
|
||||||
/// An opaque reference to an extended basic block in a function.
|
/// An opaque reference to an extended basic block in a function.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Forest of maps.
|
//! Forest of maps.
|
||||||
|
|
||||||
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE};
|
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, INNER_SIZE};
|
||||||
use packed_option::PackedOption;
|
use crate::packed_option::PackedOption;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use super::Comparator;
|
use super::Comparator;
|
||||||
use super::{Forest, Node, NodeData};
|
use super::{Forest, Node, NodeData};
|
||||||
use entity::PrimaryMap;
|
use crate::entity::PrimaryMap;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
@@ -83,7 +83,7 @@ impl<F: Forest> NodePool<F> {
|
|||||||
NodeData<F>: fmt::Display,
|
NodeData<F>: fmt::Display,
|
||||||
F::Key: fmt::Display,
|
F::Key: fmt::Display,
|
||||||
{
|
{
|
||||||
use entity::SparseSet;
|
use crate::entity::SparseSet;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Forest of sets.
|
//! Forest of sets.
|
||||||
|
|
||||||
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE};
|
use super::{Comparator, Forest, Node, NodeData, NodePool, Path, SetValue, INNER_SIZE};
|
||||||
use packed_option::PackedOption;
|
use crate::packed_option::PackedOption;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ categories = ["no-std"]
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["compile", "compiler", "jit"]
|
keywords = ["compile", "compiler", "jit"]
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cranelift-entity = { path = "../entity", version = "0.26.0", default-features = false }
|
cranelift-entity = { path = "../entity", version = "0.26.0", default-features = false }
|
||||||
|
|||||||
@@ -18,9 +18,9 @@
|
|||||||
// The build script expects to be run from the directory where this build.rs file lives. The
|
// The build script expects to be run from the directory where this build.rs file lives. The
|
||||||
// current directory is used to find the sources.
|
// current directory is used to find the sources.
|
||||||
|
|
||||||
extern crate cranelift_codegen_meta as meta;
|
use cranelift_codegen_meta as meta;
|
||||||
|
|
||||||
use meta::isa::Isa;
|
use crate::meta::isa::Isa;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::process;
|
use std::process;
|
||||||
use std::time::Instant;
|
use std::time::Instant;
|
||||||
|
|||||||
@@ -244,7 +244,8 @@ class FieldPredicate(object):
|
|||||||
"""
|
"""
|
||||||
# Prepend `field` to the predicate function arguments.
|
# Prepend `field` to the predicate function arguments.
|
||||||
args = (self.field.rust_name(),) + tuple(map(str, self.args))
|
args = (self.field.rust_name(),) + tuple(map(str, self.args))
|
||||||
return '::predicates::{}({})'.format(self.function, ', '.join(args))
|
return 'crate::predicates::{}({})'\
|
||||||
|
.format(self.function, ', '.join(args))
|
||||||
|
|
||||||
|
|
||||||
class IsEqual(FieldPredicate):
|
class IsEqual(FieldPredicate):
|
||||||
|
|||||||
@@ -394,7 +394,7 @@ class XFormGroup(object):
|
|||||||
# table referring to it.
|
# table referring to it.
|
||||||
return self.name
|
return self.name
|
||||||
else:
|
else:
|
||||||
return '::legalizer::{}'.format(self.name)
|
return 'crate::legalizer::{}'.format(self.name)
|
||||||
|
|
||||||
def legalize(self, src, dst):
|
def legalize(self, src, dst):
|
||||||
# type: (Union[Def, Apply], Rtl) -> None
|
# type: (Union[Def, Apply], Rtl) -> None
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ def emit_instp(instp, fmt, has_func=False):
|
|||||||
fields = ', '.join(sorted(fnames))
|
fields = ', '.join(sorted(fnames))
|
||||||
|
|
||||||
with fmt.indented(
|
with fmt.indented(
|
||||||
'if let ir::InstructionData::{} {{ {}, .. }} = *inst {{'
|
'if let crate::ir::InstructionData::{} {{ {}, .. }} = *inst {{'
|
||||||
.format(iform.name, fields), '}'):
|
.format(iform.name, fields), '}'):
|
||||||
if has_type_check:
|
if has_type_check:
|
||||||
# We could implement this if we need to.
|
# We could implement this if we need to.
|
||||||
@@ -132,7 +132,8 @@ def emit_inst_predicates(instps, fmt):
|
|||||||
for instp, number in instps.items():
|
for instp, number in instps.items():
|
||||||
name = 'inst_predicate_{}'.format(number)
|
name = 'inst_predicate_{}'.format(number)
|
||||||
with fmt.indented(
|
with fmt.indented(
|
||||||
'fn {}(func: &ir::Function, inst: &ir::InstructionData)'
|
'fn {}(func: &crate::ir::Function, '
|
||||||
|
'inst: &crate::ir::InstructionData)'
|
||||||
'-> bool {{'.format(name), '}'):
|
'-> bool {{'.format(name), '}'):
|
||||||
emit_instp(instp, fmt, has_func=True)
|
emit_instp(instp, fmt, has_func=True)
|
||||||
|
|
||||||
@@ -168,7 +169,7 @@ def emit_recipe_predicates(isa, fmt):
|
|||||||
|
|
||||||
# Generate the predicate function.
|
# Generate the predicate function.
|
||||||
with fmt.indented(
|
with fmt.indented(
|
||||||
'fn {}({}: ::settings::PredicateView, '
|
'fn {}({}: crate::settings::PredicateView, '
|
||||||
'{}: &ir::InstructionData) -> bool {{'
|
'{}: &ir::InstructionData) -> bool {{'
|
||||||
.format(
|
.format(
|
||||||
name,
|
name,
|
||||||
@@ -657,7 +658,8 @@ def emit_level2_hashtables(level2_hashtables, offt, level2_doc, fmt):
|
|||||||
if entry:
|
if entry:
|
||||||
fmt.line(
|
fmt.line(
|
||||||
'Level2Entry ' +
|
'Level2Entry ' +
|
||||||
'{{ opcode: Some(ir::Opcode::{}), offset: {:#08x} }},'
|
'{{ opcode: Some(crate::ir::Opcode::{}), '
|
||||||
|
'offset: {:#08x} }},'
|
||||||
.format(entry.inst.camel_name, entry.offset))
|
.format(entry.inst.camel_name, entry.offset))
|
||||||
else:
|
else:
|
||||||
fmt.line(
|
fmt.line(
|
||||||
@@ -682,15 +684,15 @@ def emit_level1_hashtable(cpumode, level1, offt, fmt):
|
|||||||
# Empty hash table entry. Include the default legalization action.
|
# Empty hash table entry. Include the default legalization action.
|
||||||
if not level2:
|
if not level2:
|
||||||
fmt.format(
|
fmt.format(
|
||||||
'Level1Entry {{ ty: ir::types::INVALID, log2len: !0, '
|
'Level1Entry {{ ty: crate::ir::types::INVALID, '
|
||||||
'offset: 0, legalize: {} }},',
|
'log2len: !0, offset: 0, legalize: {} }},',
|
||||||
level1.legalize_code)
|
level1.legalize_code)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if level2.ty is not None:
|
if level2.ty is not None:
|
||||||
tyname = level2.ty.rust_name()
|
tyname = level2.ty.rust_name()
|
||||||
else:
|
else:
|
||||||
tyname = 'ir::types::INVALID'
|
tyname = 'crate::ir::types::INVALID'
|
||||||
|
|
||||||
lcode = cpumode.isa.legalize_code(level2.legalize)
|
lcode = cpumode.isa.legalize_code(level2.legalize)
|
||||||
|
|
||||||
|
|||||||
@@ -661,7 +661,7 @@ def gen_inst_builder(inst, fmt):
|
|||||||
# The controlling type variable will be inferred from the input values if
|
# The controlling type variable will be inferred from the input values if
|
||||||
# possible. Otherwise, it is the first method argument.
|
# possible. Otherwise, it is the first method argument.
|
||||||
if inst.is_polymorphic and not inst.use_typevar_operand:
|
if inst.is_polymorphic and not inst.use_typevar_operand:
|
||||||
args.append('{}: ir::Type'.format(inst.ctrl_typevar.name))
|
args.append('{}: crate::ir::Type'.format(inst.ctrl_typevar.name))
|
||||||
|
|
||||||
tmpl_types = list() # type: List[str]
|
tmpl_types = list() # type: List[str]
|
||||||
into_args = list() # type: List[str]
|
into_args = list() # type: List[str]
|
||||||
|
|||||||
@@ -103,19 +103,21 @@ def emit_runtime_typecheck(check, fmt, type_sets):
|
|||||||
|
|
||||||
base_exp = build_derived_expr(tv.base)
|
base_exp = build_derived_expr(tv.base)
|
||||||
if (tv.derived_func == TypeVar.LANEOF):
|
if (tv.derived_func == TypeVar.LANEOF):
|
||||||
return "{}.map(|t: ir::Type| t.lane_type())".format(base_exp)
|
return "{}.map(|t: crate::ir::Type| t.lane_type())"\
|
||||||
|
.format(base_exp)
|
||||||
elif (tv.derived_func == TypeVar.ASBOOL):
|
elif (tv.derived_func == TypeVar.ASBOOL):
|
||||||
return "{}.map(|t: ir::Type| t.as_bool())".format(base_exp)
|
return "{}.map(|t: crate::ir::Type| t.as_bool())".format(base_exp)
|
||||||
elif (tv.derived_func == TypeVar.HALFWIDTH):
|
elif (tv.derived_func == TypeVar.HALFWIDTH):
|
||||||
return "{}.and_then(|t: ir::Type| t.half_width())".format(base_exp)
|
return "{}.and_then(|t: crate::ir::Type| t.half_width())"\
|
||||||
|
.format(base_exp)
|
||||||
elif (tv.derived_func == TypeVar.DOUBLEWIDTH):
|
elif (tv.derived_func == TypeVar.DOUBLEWIDTH):
|
||||||
return "{}.and_then(|t: ir::Type| t.double_width())"\
|
return "{}.and_then(|t: crate::ir::Type| t.double_width())"\
|
||||||
.format(base_exp)
|
.format(base_exp)
|
||||||
elif (tv.derived_func == TypeVar.HALFVECTOR):
|
elif (tv.derived_func == TypeVar.HALFVECTOR):
|
||||||
return "{}.and_then(|t: ir::Type| t.half_vector())"\
|
return "{}.and_then(|t: crate::ir::Type| t.half_vector())"\
|
||||||
.format(base_exp)
|
.format(base_exp)
|
||||||
elif (tv.derived_func == TypeVar.DOUBLEVECTOR):
|
elif (tv.derived_func == TypeVar.DOUBLEVECTOR):
|
||||||
return "{}.and_then(|t: ir::Type| t.by(2))".format(base_exp)
|
return "{}.and_then(|t: crate::ir::Type| t.by(2))".format(base_exp)
|
||||||
else:
|
else:
|
||||||
assert False, "Unknown derived function {}".format(tv.derived_func)
|
assert False, "Unknown derived function {}".format(tv.derived_func)
|
||||||
|
|
||||||
@@ -174,7 +176,7 @@ def unwrap_inst(iref, node, fmt):
|
|||||||
arg_names = tuple(
|
arg_names = tuple(
|
||||||
arg.name if isinstance(arg, Var) else '_' for arg in expr.args)
|
arg.name if isinstance(arg, Var) else '_' for arg in expr.args)
|
||||||
with fmt.indented(
|
with fmt.indented(
|
||||||
'let ({}, predicate) = if let ir::InstructionData::{} {{'
|
'let ({}, predicate) = if let crate::ir::InstructionData::{} {{'
|
||||||
.format(', '.join(map(str, arg_names)), iform.name), '};'):
|
.format(', '.join(map(str, arg_names)), iform.name), '};'):
|
||||||
# Fields are encoded directly.
|
# Fields are encoded directly.
|
||||||
for f in iform.imm_fields:
|
for f in iform.imm_fields:
|
||||||
@@ -359,13 +361,13 @@ def gen_xform_group(xgrp, fmt, type_sets):
|
|||||||
fmt.doc_comment("Legalize `inst`.")
|
fmt.doc_comment("Legalize `inst`.")
|
||||||
fmt.line('#[allow(unused_variables,unused_assignments,non_snake_case)]')
|
fmt.line('#[allow(unused_variables,unused_assignments,non_snake_case)]')
|
||||||
with fmt.indented('pub fn {}('.format(xgrp.name)):
|
with fmt.indented('pub fn {}('.format(xgrp.name)):
|
||||||
fmt.line('inst: ir::Inst,')
|
fmt.line('inst: crate::ir::Inst,')
|
||||||
fmt.line('func: &mut ir::Function,')
|
fmt.line('func: &mut crate::ir::Function,')
|
||||||
fmt.line('cfg: &mut ::flowgraph::ControlFlowGraph,')
|
fmt.line('cfg: &mut crate::flowgraph::ControlFlowGraph,')
|
||||||
fmt.line('isa: &::isa::TargetIsa,')
|
fmt.line('isa: &crate::isa::TargetIsa,')
|
||||||
with fmt.indented(') -> bool {', '}'):
|
with fmt.indented(') -> bool {', '}'):
|
||||||
fmt.line('use ir::InstBuilder;')
|
fmt.line('use crate::ir::InstBuilder;')
|
||||||
fmt.line('use cursor::{Cursor, FuncCursor};')
|
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);')
|
||||||
|
|
||||||
|
|||||||
@@ -117,10 +117,10 @@ def gen_getters(sgrp, fmt):
|
|||||||
with fmt.indented('impl Flags {', '}'):
|
with fmt.indented('impl Flags {', '}'):
|
||||||
fmt.doc_comment('Get a view of the boolean predicates.')
|
fmt.doc_comment('Get a view of the boolean predicates.')
|
||||||
with fmt.indented(
|
with fmt.indented(
|
||||||
'pub fn predicate_view(&self) -> ::settings::PredicateView {',
|
'pub fn predicate_view(&self) -> '
|
||||||
'}'):
|
'crate::settings::PredicateView {', '}'):
|
||||||
fmt.format(
|
fmt.format(
|
||||||
'::settings::PredicateView::new(&self.bytes[{}..])',
|
'crate::settings::PredicateView::new(&self.bytes[{}..])',
|
||||||
sgrp.boolean_offset)
|
sgrp.boolean_offset)
|
||||||
if sgrp.settings:
|
if sgrp.settings:
|
||||||
fmt.doc_comment('Dynamic numbered predicate getter.')
|
fmt.doc_comment('Dynamic numbered predicate getter.')
|
||||||
|
|||||||
@@ -1934,7 +1934,7 @@ icscc = TailRecipe(
|
|||||||
PUT_OP(bits, rex2(in_reg0, in_reg1), sink);
|
PUT_OP(bits, rex2(in_reg0, in_reg1), sink);
|
||||||
modrm_rr(in_reg0, in_reg1, sink);
|
modrm_rr(in_reg0, in_reg1, sink);
|
||||||
// `setCC` instruction, no REX.
|
// `setCC` instruction, no REX.
|
||||||
use ir::condcodes::IntCC::*;
|
use crate::ir::condcodes::IntCC::*;
|
||||||
let setcc = match cond {
|
let setcc = match cond {
|
||||||
Equal => 0x94,
|
Equal => 0x94,
|
||||||
NotEqual => 0x95,
|
NotEqual => 0x95,
|
||||||
@@ -1962,7 +1962,7 @@ icscc_ib = TailRecipe(
|
|||||||
let imm: i64 = imm.into();
|
let imm: i64 = imm.into();
|
||||||
sink.put1(imm as u8);
|
sink.put1(imm as u8);
|
||||||
// `setCC` instruction, no REX.
|
// `setCC` instruction, no REX.
|
||||||
use ir::condcodes::IntCC::*;
|
use crate::ir::condcodes::IntCC::*;
|
||||||
let setcc = match cond {
|
let setcc = match cond {
|
||||||
Equal => 0x94,
|
Equal => 0x94,
|
||||||
NotEqual => 0x95,
|
NotEqual => 0x95,
|
||||||
@@ -1990,7 +1990,7 @@ icscc_id = TailRecipe(
|
|||||||
let imm: i64 = imm.into();
|
let imm: i64 = imm.into();
|
||||||
sink.put4(imm as u32);
|
sink.put4(imm as u32);
|
||||||
// `setCC` instruction, no REX.
|
// `setCC` instruction, no REX.
|
||||||
use ir::condcodes::IntCC::*;
|
use crate::ir::condcodes::IntCC::*;
|
||||||
let setcc = match cond {
|
let setcc = match cond {
|
||||||
Equal => 0x94,
|
Equal => 0x94,
|
||||||
NotEqual => 0x95,
|
NotEqual => 0x95,
|
||||||
@@ -2030,7 +2030,7 @@ fcscc = TailRecipe(
|
|||||||
PUT_OP(bits, rex2(in_reg1, in_reg0), sink);
|
PUT_OP(bits, rex2(in_reg1, in_reg0), sink);
|
||||||
modrm_rr(in_reg1, in_reg0, sink);
|
modrm_rr(in_reg1, in_reg0, sink);
|
||||||
// `setCC` instruction, no REX.
|
// `setCC` instruction, no REX.
|
||||||
use ir::condcodes::FloatCC::*;
|
use crate::ir::condcodes::FloatCC::*;
|
||||||
let setcc = match cond {
|
let setcc = match cond {
|
||||||
Ordered => 0x9b, // EQ|LT|GT => setnp (P=0)
|
Ordered => 0x9b, // EQ|LT|GT => setnp (P=0)
|
||||||
Unordered => 0x9a, // UN => setp (P=1)
|
Unordered => 0x9a, // UN => setp (P=1)
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ class TestRuntimeChecks(TestCase):
|
|||||||
self.v5 << vselect(self.v1, self.v3, self.v4),
|
self.v5 << vselect(self.v1, self.v3, self.v4),
|
||||||
)
|
)
|
||||||
x = XForm(r, r)
|
x = XForm(r, r)
|
||||||
tv2_exp = 'Some({}).map(|t: ir::Type| t.as_bool())'\
|
tv2_exp = 'Some({}).map(|t: crate::ir::Type| t.as_bool())'\
|
||||||
.format(self.v2.get_typevar().name)
|
.format(self.v2.get_typevar().name)
|
||||||
tv3_exp = 'Some({}).map(|t: ir::Type| t.as_bool())'\
|
tv3_exp = 'Some({}).map(|t: crate::ir::Type| t.as_bool())'\
|
||||||
.format(self.v3.get_typevar().name)
|
.format(self.v3.get_typevar().name)
|
||||||
|
|
||||||
self.check_yo_check(
|
self.check_yo_check(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ description = "Metaprogram for cranelift-codegen code generator library"
|
|||||||
license = "Apache-2.0 WITH LLVM-exception"
|
license = "Apache-2.0 WITH LLVM-exception"
|
||||||
repository = "https://github.com/CraneStation/cranelift"
|
repository = "https://github.com/CraneStation/cranelift"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cranelift-entity = { path = "../../entity", version = "0.26.0" }
|
cranelift-entity = { path = "../../entity", version = "0.26.0" }
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
use cdsl::settings::{SettingGroup, SettingGroupBuilder};
|
use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder};
|
||||||
|
|
||||||
pub fn generate() -> SettingGroup {
|
pub fn generate() -> SettingGroup {
|
||||||
let mut settings = SettingGroupBuilder::new("shared");
|
let mut settings = SettingGroupBuilder::new("shared");
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
use cranelift_entity::entity_impl;
|
||||||
use cranelift_entity::EntityRef;
|
use cranelift_entity::EntityRef;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
use base::types as base_types;
|
use crate::base::types as base_types;
|
||||||
|
|
||||||
// Numbering scheme for value types:
|
// Numbering scheme for value types:
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use cdsl::isa::TargetIsa;
|
use crate::cdsl::isa::TargetIsa;
|
||||||
use cdsl::regs::{RegBank, RegClass};
|
use crate::cdsl::regs::{RegBank, RegClass};
|
||||||
|
use crate::error;
|
||||||
|
use crate::srcgen::Formatter;
|
||||||
use cranelift_entity::EntityRef;
|
use cranelift_entity::EntityRef;
|
||||||
use error;
|
|
||||||
use srcgen::Formatter;
|
|
||||||
|
|
||||||
fn gen_regbank(fmt: &mut Formatter, reg_bank: &RegBank) {
|
fn gen_regbank(fmt: &mut Formatter, reg_bank: &RegBank) {
|
||||||
let names = if reg_bank.names.len() > 0 {
|
let names = if reg_bank.names.len() > 0 {
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
use base;
|
use crate::base;
|
||||||
use cdsl::camel_case;
|
use crate::cdsl::camel_case;
|
||||||
use cdsl::isa::TargetIsa;
|
use crate::cdsl::isa::TargetIsa;
|
||||||
use cdsl::settings::{BoolSetting, Predicate, Preset, Setting, SettingGroup, SpecificSetting};
|
use crate::cdsl::settings::{
|
||||||
use constant_hash::{generate_table, simple_hash};
|
BoolSetting, Predicate, Preset, Setting, SettingGroup, SpecificSetting,
|
||||||
use error;
|
};
|
||||||
use srcgen::{Formatter, Match};
|
use crate::constant_hash::{generate_table, simple_hash};
|
||||||
|
use crate::error;
|
||||||
|
use crate::srcgen::{Formatter, Match};
|
||||||
|
use crate::unique_table::UniqueTable;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use unique_table::UniqueTable;
|
|
||||||
|
|
||||||
enum ParentGroup {
|
enum ParentGroup {
|
||||||
None,
|
None,
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
//! This ensures that the metaprogram and the generated program see the same
|
//! This ensures that the metaprogram and the generated program see the same
|
||||||
//! type numbering.
|
//! type numbering.
|
||||||
|
|
||||||
use cdsl::types as cdsl_types;
|
use crate::cdsl::types as cdsl_types;
|
||||||
use error;
|
use crate::error;
|
||||||
use srcgen;
|
use crate::srcgen;
|
||||||
|
|
||||||
/// Emit a constant definition of a single value type.
|
/// Emit a constant definition of a single value type.
|
||||||
fn emit_type(ty: &cdsl_types::ValueType, fmt: &mut srcgen::Formatter) -> Result<(), error::Error> {
|
fn emit_type(ty: &cdsl_types::ValueType, fmt: &mut srcgen::Formatter) -> Result<(), error::Error> {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
||||||
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
||||||
use cdsl::settings::{SettingGroup, SettingGroupBuilder};
|
use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder};
|
||||||
|
|
||||||
fn define_settings(_shared: &SettingGroup) -> SettingGroup {
|
fn define_settings(_shared: &SettingGroup) -> SettingGroup {
|
||||||
let setting = SettingGroupBuilder::new("arm32");
|
let setting = SettingGroupBuilder::new("arm32");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
||||||
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
||||||
use cdsl::settings::{SettingGroup, SettingGroupBuilder};
|
use crate::cdsl::settings::{SettingGroup, SettingGroupBuilder};
|
||||||
|
|
||||||
fn define_settings(_shared: &SettingGroup) -> SettingGroup {
|
fn define_settings(_shared: &SettingGroup) -> SettingGroup {
|
||||||
let setting = SettingGroupBuilder::new("arm64");
|
let setting = SettingGroupBuilder::new("arm64");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use cdsl::isa::TargetIsa;
|
use crate::cdsl::isa::TargetIsa;
|
||||||
use cdsl::settings::SettingGroup;
|
use crate::cdsl::settings::SettingGroup;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
mod arm32;
|
mod arm32;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
||||||
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
||||||
use cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
|
use crate::cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
|
||||||
|
|
||||||
fn define_settings(shared: &SettingGroup) -> SettingGroup {
|
fn define_settings(shared: &SettingGroup) -> SettingGroup {
|
||||||
let mut setting = SettingGroupBuilder::new("riscv");
|
let mut setting = SettingGroupBuilder::new("riscv");
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
use crate::cdsl::isa::{TargetIsa, TargetIsaBuilder};
|
||||||
use cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
use crate::cdsl::regs::{RegBankBuilder, RegClassBuilder};
|
||||||
use cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
|
use crate::cdsl::settings::{PredicateNode, SettingGroup, SettingGroupBuilder};
|
||||||
|
|
||||||
pub fn define_settings(_shared: &SettingGroup) -> SettingGroup {
|
pub fn define_settings(_shared: &SettingGroup) -> SettingGroup {
|
||||||
let mut settings = SettingGroupBuilder::new("x86");
|
let mut settings = SettingGroupBuilder::new("x86");
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
#[macro_use]
|
|
||||||
extern crate cranelift_entity;
|
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
mod cdsl;
|
mod cdsl;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use std::fs;
|
|||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::path;
|
use std::path;
|
||||||
|
|
||||||
use error;
|
use crate::error;
|
||||||
|
|
||||||
static SHIFTWIDTH: usize = 4;
|
static SHIFTWIDTH: usize = 4;
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ fn _indent(s: &str) -> Option<usize> {
|
|||||||
if s.is_empty() {
|
if s.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
let t = s.trim_left();
|
let t = s.trim_start();
|
||||||
Some(s.len() - t.len())
|
Some(s.len() - t.len())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@ fn parse_multiline(s: &str) -> Vec<String> {
|
|||||||
.iter()
|
.iter()
|
||||||
.skip(1)
|
.skip(1)
|
||||||
.filter(|l| !l.trim().is_empty())
|
.filter(|l| !l.trim().is_empty())
|
||||||
.map(|l| l.len() - l.trim_left().len())
|
.map(|l| l.len() - l.trim_start().len())
|
||||||
.min();
|
.min();
|
||||||
|
|
||||||
// Strip off leading blank lines.
|
// Strip off leading blank lines.
|
||||||
@@ -186,12 +186,12 @@ fn parse_multiline(s: &str) -> Vec<String> {
|
|||||||
// Note that empty lines may have fewer than `indent` chars.
|
// Note that empty lines may have fewer than `indent` chars.
|
||||||
lines_iter
|
lines_iter
|
||||||
.map(|l| &l[cmp::min(indent, l.len())..])
|
.map(|l| &l[cmp::min(indent, l.len())..])
|
||||||
.map(|l| l.trim_right())
|
.map(|l| l.trim_end())
|
||||||
.map(|l| l.to_string())
|
.map(|l| l.to_string())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
} else {
|
} else {
|
||||||
lines_iter
|
lines_iter
|
||||||
.map(|l| l.trim_right())
|
.map(|l| l.trim_end())
|
||||||
.map(|l| l.to_string())
|
.map(|l| l.to_string())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//! This module provides functions and data structures that are useful for implementing the
|
//! This module provides functions and data structures that are useful for implementing the
|
||||||
//! `TargetIsa::legalize_signature()` method.
|
//! `TargetIsa::legalize_signature()` method.
|
||||||
|
|
||||||
use ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type};
|
use crate::ir::{AbiParam, ArgumentExtension, ArgumentLoc, Type};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
@@ -182,8 +182,8 @@ pub fn legalize_abi_value(have: Type, arg: &AbiParam) -> ValueConversion {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ir::types;
|
use crate::ir::types;
|
||||||
use ir::AbiParam;
|
use crate::ir::AbiParam;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn legalize() {
|
fn legalize() {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
//! `CodeSink::put*` methods, so the performance impact of the virtual callbacks is less severe.
|
//! `CodeSink::put*` methods, so the performance impact of the virtual callbacks is less severe.
|
||||||
|
|
||||||
use super::{Addend, CodeOffset, CodeSink, Reloc};
|
use super::{Addend, CodeOffset, CodeSink, Reloc};
|
||||||
use ir::{ExternalName, JumpTable, SourceLoc, TrapCode};
|
use crate::ir::{ExternalName, JumpTable, SourceLoc, TrapCode};
|
||||||
use std::ptr::write_unaligned;
|
use std::ptr::write_unaligned;
|
||||||
|
|
||||||
/// A `CodeSink` that writes binary machine code directly into memory.
|
/// A `CodeSink` that writes binary machine code directly into memory.
|
||||||
@@ -57,13 +57,13 @@ impl<'a> MemoryCodeSink<'a> {
|
|||||||
/// A trait for receiving relocations for code that is emitted directly into memory.
|
/// A trait for receiving relocations for code that is emitted directly into memory.
|
||||||
pub trait RelocSink {
|
pub trait RelocSink {
|
||||||
/// Add a relocation referencing an EBB at the current offset.
|
/// Add a relocation referencing an EBB at the current offset.
|
||||||
fn reloc_ebb(&mut self, CodeOffset, Reloc, CodeOffset);
|
fn reloc_ebb(&mut self, _: CodeOffset, _: Reloc, _: CodeOffset);
|
||||||
|
|
||||||
/// Add a relocation referencing an external symbol at the current offset.
|
/// Add a relocation referencing an external symbol at the current offset.
|
||||||
fn reloc_external(&mut self, CodeOffset, Reloc, &ExternalName, Addend);
|
fn reloc_external(&mut self, _: CodeOffset, _: Reloc, _: &ExternalName, _: Addend);
|
||||||
|
|
||||||
/// Add a relocation referencing a jump table.
|
/// Add a relocation referencing a jump table.
|
||||||
fn reloc_jt(&mut self, CodeOffset, Reloc, JumpTable);
|
fn reloc_jt(&mut self, _: CodeOffset, _: Reloc, _: JumpTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait for receiving trap codes and offsets.
|
/// A trait for receiving trap codes and offsets.
|
||||||
@@ -72,7 +72,7 @@ pub trait RelocSink {
|
|||||||
/// [`NullTrapSink`](binemit/trait.TrapSink.html) implementation.
|
/// [`NullTrapSink`](binemit/trait.TrapSink.html) implementation.
|
||||||
pub trait TrapSink {
|
pub trait TrapSink {
|
||||||
/// Add trap information for a specific offset.
|
/// Add trap information for a specific offset.
|
||||||
fn trap(&mut self, CodeOffset, SourceLoc, TrapCode);
|
fn trap(&mut self, _: CodeOffset, _: SourceLoc, _: TrapCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> CodeSink for MemoryCodeSink<'a> {
|
impl<'a> CodeSink for MemoryCodeSink<'a> {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ mod shrink;
|
|||||||
pub use self::memorysink::{MemoryCodeSink, NullTrapSink, RelocSink, TrapSink};
|
pub use self::memorysink::{MemoryCodeSink, NullTrapSink, RelocSink, TrapSink};
|
||||||
pub use self::relaxation::relax_branches;
|
pub use self::relaxation::relax_branches;
|
||||||
pub use self::shrink::shrink_instructions;
|
pub use self::shrink::shrink_instructions;
|
||||||
pub use regalloc::RegDiversions;
|
pub use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
use ir::{ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode};
|
use crate::ir::{ExternalName, Function, Inst, JumpTable, SourceLoc, TrapCode};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Offset in bytes from the beginning of the function.
|
/// Offset in bytes from the beginning of the function.
|
||||||
@@ -72,28 +72,28 @@ pub trait CodeSink {
|
|||||||
fn offset(&self) -> CodeOffset;
|
fn offset(&self) -> CodeOffset;
|
||||||
|
|
||||||
/// Add 1 byte to the code section.
|
/// Add 1 byte to the code section.
|
||||||
fn put1(&mut self, u8);
|
fn put1(&mut self, _: u8);
|
||||||
|
|
||||||
/// Add 2 bytes to the code section.
|
/// Add 2 bytes to the code section.
|
||||||
fn put2(&mut self, u16);
|
fn put2(&mut self, _: u16);
|
||||||
|
|
||||||
/// Add 4 bytes to the code section.
|
/// Add 4 bytes to the code section.
|
||||||
fn put4(&mut self, u32);
|
fn put4(&mut self, _: u32);
|
||||||
|
|
||||||
/// Add 8 bytes to the code section.
|
/// Add 8 bytes to the code section.
|
||||||
fn put8(&mut self, u64);
|
fn put8(&mut self, _: u64);
|
||||||
|
|
||||||
/// Add a relocation referencing an EBB at the current offset.
|
/// Add a relocation referencing an EBB at the current offset.
|
||||||
fn reloc_ebb(&mut self, Reloc, CodeOffset);
|
fn reloc_ebb(&mut self, _: Reloc, _: CodeOffset);
|
||||||
|
|
||||||
/// Add a relocation referencing an external symbol plus the addend at the current offset.
|
/// Add a relocation referencing an external symbol plus the addend at the current offset.
|
||||||
fn reloc_external(&mut self, Reloc, &ExternalName, Addend);
|
fn reloc_external(&mut self, _: Reloc, _: &ExternalName, _: Addend);
|
||||||
|
|
||||||
/// Add a relocation referencing a jump table.
|
/// Add a relocation referencing a jump table.
|
||||||
fn reloc_jt(&mut self, Reloc, JumpTable);
|
fn reloc_jt(&mut self, _: Reloc, _: JumpTable);
|
||||||
|
|
||||||
/// Add trap information for the current offset.
|
/// Add trap information for the current offset.
|
||||||
fn trap(&mut self, TrapCode, SourceLoc);
|
fn trap(&mut self, _: TrapCode, _: SourceLoc);
|
||||||
|
|
||||||
/// Code output is complete, read-only data may follow.
|
/// Code output is complete, read-only data may follow.
|
||||||
fn begin_rodata(&mut self);
|
fn begin_rodata(&mut self);
|
||||||
|
|||||||
@@ -27,14 +27,15 @@
|
|||||||
//! ebb23:
|
//! ebb23:
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
use binemit::CodeOffset;
|
use crate::binemit::CodeOffset;
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use ir::{Function, InstructionData, Opcode};
|
use crate::ir::{Function, InstructionData, Opcode};
|
||||||
use isa::{EncInfo, TargetIsa};
|
use crate::isa::{EncInfo, TargetIsa};
|
||||||
use iterators::IteratorExtras;
|
use crate::iterators::IteratorExtras;
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
use timing;
|
use crate::timing;
|
||||||
use CodegenResult;
|
use crate::CodegenResult;
|
||||||
|
use log::debug;
|
||||||
|
|
||||||
/// Relax branches and compute the final layout of EBB headers in `func`.
|
/// Relax branches and compute the final layout of EBB headers in `func`.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
//! flexibility. However, once register allocation is done, this is no longer important, and we
|
//! flexibility. However, once register allocation is done, this is no longer important, and we
|
||||||
//! can switch to smaller encodings when possible.
|
//! can switch to smaller encodings when possible.
|
||||||
|
|
||||||
use ir::instructions::InstructionData;
|
use crate::ir::instructions::InstructionData;
|
||||||
use ir::Function;
|
use crate::ir::Function;
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
use timing;
|
use crate::timing;
|
||||||
|
use log::debug;
|
||||||
|
|
||||||
/// Pick the smallest valid encodings for instructions.
|
/// Pick the smallest valid encodings for instructions.
|
||||||
pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {
|
pub fn shrink_instructions(func: &mut Function, isa: &TargetIsa) {
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
use std::fmt::{Display, Formatter, Result, Write};
|
use std::fmt::{Display, Formatter, Result, Write};
|
||||||
|
|
||||||
use flowgraph::{BasicBlock, ControlFlowGraph};
|
use crate::flowgraph::{BasicBlock, ControlFlowGraph};
|
||||||
use ir::instructions::BranchInfo;
|
use crate::ir::instructions::BranchInfo;
|
||||||
use ir::Function;
|
use crate::ir::Function;
|
||||||
|
|
||||||
/// A utility for pretty-printing the CFG of a `Function`.
|
/// A utility for pretty-printing the CFG of a `Function`.
|
||||||
pub struct CFGPrinter<'a> {
|
pub struct CFGPrinter<'a> {
|
||||||
|
|||||||
@@ -9,28 +9,28 @@
|
|||||||
//! contexts concurrently. Typically, you would have one context per compilation thread and only a
|
//! contexts concurrently. Typically, you would have one context per compilation thread and only a
|
||||||
//! single ISA instance.
|
//! single ISA instance.
|
||||||
|
|
||||||
use binemit::{
|
use crate::binemit::{
|
||||||
relax_branches, shrink_instructions, CodeOffset, MemoryCodeSink, RelocSink, TrapSink,
|
relax_branches, shrink_instructions, CodeOffset, MemoryCodeSink, RelocSink, TrapSink,
|
||||||
};
|
};
|
||||||
use dce::do_dce;
|
use crate::dce::do_dce;
|
||||||
use dominator_tree::DominatorTree;
|
use crate::dominator_tree::DominatorTree;
|
||||||
use flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use ir::Function;
|
use crate::ir::Function;
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
use legalize_function;
|
use crate::legalize_function;
|
||||||
use licm::do_licm;
|
use crate::licm::do_licm;
|
||||||
use loop_analysis::LoopAnalysis;
|
use crate::loop_analysis::LoopAnalysis;
|
||||||
use nan_canonicalization::do_nan_canonicalization;
|
use crate::nan_canonicalization::do_nan_canonicalization;
|
||||||
use postopt::do_postopt;
|
use crate::postopt::do_postopt;
|
||||||
use regalloc;
|
use crate::regalloc;
|
||||||
use result::CodegenResult;
|
use crate::result::CodegenResult;
|
||||||
use settings::{FlagsOrIsa, OptLevel};
|
use crate::settings::{FlagsOrIsa, OptLevel};
|
||||||
use simple_gvn::do_simple_gvn;
|
use crate::simple_gvn::do_simple_gvn;
|
||||||
use simple_preopt::do_preopt;
|
use crate::simple_preopt::do_preopt;
|
||||||
|
use crate::timing;
|
||||||
|
use crate::unreachable_code::eliminate_unreachable_code;
|
||||||
|
use crate::verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use timing;
|
|
||||||
use unreachable_code::eliminate_unreachable_code;
|
|
||||||
use verifier::{verify_context, verify_locations, VerifierErrors, VerifierResult};
|
|
||||||
|
|
||||||
/// Persistent data structures and compilation pipeline.
|
/// Persistent data structures and compilation pipeline.
|
||||||
pub struct Context {
|
pub struct Context {
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! This module defines cursor data types that can be used for inserting instructions.
|
//! This module defines cursor data types that can be used for inserting instructions.
|
||||||
|
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
|
|
||||||
/// The possible positions of a cursor.
|
/// The possible positions of a cursor.
|
||||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
//! Dead code here means instructions that have no side effects and have no
|
//! Dead code here means instructions that have no side effects and have no
|
||||||
//! result values used by other instructions.
|
//! result values used by other instructions.
|
||||||
|
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use dominator_tree::DominatorTree;
|
use crate::dominator_tree::DominatorTree;
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
use ir::instructions::InstructionData;
|
use crate::ir::instructions::InstructionData;
|
||||||
use ir::{DataFlowGraph, Function, Inst, Opcode};
|
use crate::ir::{DataFlowGraph, Function, Inst, Opcode};
|
||||||
|
use crate::timing;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use timing;
|
|
||||||
|
|
||||||
/// Test whether the given opcode is unsafe to even consider for DCE.
|
/// Test whether the given opcode is unsafe to even consider for DCE.
|
||||||
fn trivially_unsafe_for_dce(opcode: Opcode) -> bool {
|
fn trivially_unsafe_for_dce(opcode: Opcode) -> bool {
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
//! A Dominator Tree represented as mappings of Ebbs to their immediate dominator.
|
//! A Dominator Tree represented as mappings of Ebbs to their immediate dominator.
|
||||||
|
|
||||||
use entity::SecondaryMap;
|
use crate::entity::SecondaryMap;
|
||||||
use flowgraph::{BasicBlock, ControlFlowGraph};
|
use crate::flowgraph::{BasicBlock, ControlFlowGraph};
|
||||||
use ir::instructions::BranchInfo;
|
use crate::ir::instructions::BranchInfo;
|
||||||
use ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value};
|
use crate::ir::{Ebb, ExpandedProgramPoint, Function, Inst, Layout, ProgramOrder, Value};
|
||||||
use packed_option::PackedOption;
|
use crate::packed_option::PackedOption;
|
||||||
|
use crate::timing;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use timing;
|
|
||||||
|
|
||||||
/// RPO numbers are not first assigned in a contiguous way but as multiples of STRIDE, to leave
|
/// RPO numbers are not first assigned in a contiguous way but as multiples of STRIDE, to leave
|
||||||
/// room for modifications of the dominator tree.
|
/// room for modifications of the dominator tree.
|
||||||
@@ -671,12 +671,12 @@ impl DominatorTreePreorder {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use ir::types::*;
|
use crate::ir::types::*;
|
||||||
use ir::{Function, InstBuilder, TrapCode};
|
use crate::ir::{Function, InstBuilder, TrapCode};
|
||||||
use settings;
|
use crate::settings;
|
||||||
use verifier::{verify_context, VerifierErrors};
|
use crate::verifier::{verify_context, VerifierErrors};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn empty() {
|
fn empty() {
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
//! Here `Ebb1` and `Ebb2` would each have a single predecessor denoted as `(Ebb0, brz)`
|
//! Here `Ebb1` and `Ebb2` would each have a single predecessor denoted as `(Ebb0, brz)`
|
||||||
//! and `(Ebb0, jmp Ebb2)` respectively.
|
//! and `(Ebb0, jmp Ebb2)` respectively.
|
||||||
|
|
||||||
use bforest;
|
use crate::bforest;
|
||||||
use entity::SecondaryMap;
|
use crate::entity::SecondaryMap;
|
||||||
use ir::instructions::BranchInfo;
|
use crate::ir::instructions::BranchInfo;
|
||||||
use ir::{Ebb, Function, Inst};
|
use crate::ir::{Ebb, Function, Inst};
|
||||||
|
use crate::timing;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use timing;
|
|
||||||
|
|
||||||
/// A basic block denoted by its enclosing Ebb and last instruction.
|
/// A basic block denoted by its enclosing Ebb and last instruction.
|
||||||
#[derive(PartialEq, Eq)]
|
#[derive(PartialEq, Eq)]
|
||||||
@@ -212,8 +212,8 @@ pub type SuccIter<'a> = bforest::SetIter<'a, Ebb>;
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use ir::{types, Function, InstBuilder};
|
use crate::ir::{types, Function, InstBuilder};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -3,11 +3,11 @@
|
|||||||
//! A `Builder` provides a convenient interface for inserting instructions into a Cranelift
|
//! A `Builder` provides a convenient interface for inserting instructions into a Cranelift
|
||||||
//! function. Many of its methods are generated from the meta language instruction definitions.
|
//! function. Many of its methods are generated from the meta language instruction definitions.
|
||||||
|
|
||||||
use ir;
|
use crate::ir;
|
||||||
use ir::types;
|
use crate::ir::types;
|
||||||
use ir::{DataFlowGraph, InstructionData};
|
use crate::ir::{DataFlowGraph, InstructionData};
|
||||||
use ir::{Inst, Opcode, Type, Value};
|
use crate::ir::{Inst, Opcode, Type, Value};
|
||||||
use isa;
|
use crate::isa;
|
||||||
|
|
||||||
/// Base trait for instruction builders.
|
/// Base trait for instruction builders.
|
||||||
///
|
///
|
||||||
@@ -215,10 +215,10 @@ impl<'f> InstBuilderBase<'f> for ReplaceBuilder<'f> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use ir::condcodes::*;
|
use crate::ir::condcodes::*;
|
||||||
use ir::types::*;
|
use crate::ir::types::*;
|
||||||
use ir::{Function, InstBuilder, ValueDef};
|
use crate::ir::{Function, InstBuilder, ValueDef};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn types() {
|
fn types() {
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
//! Data flow graph tracking Instructions, Values, and EBBs.
|
//! Data flow graph tracking Instructions, Values, and EBBs.
|
||||||
|
|
||||||
use entity::{self, PrimaryMap, SecondaryMap};
|
use crate::entity::{self, PrimaryMap, SecondaryMap};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use ir::builder::ReplaceBuilder;
|
use crate::ir::builder::ReplaceBuilder;
|
||||||
use ir::extfunc::ExtFuncData;
|
use crate::ir::extfunc::ExtFuncData;
|
||||||
use ir::instructions::{BranchInfo, CallInfo, InstructionData};
|
use crate::ir::instructions::{BranchInfo, CallInfo, InstructionData};
|
||||||
use ir::types;
|
use crate::ir::types;
|
||||||
use ir::{Ebb, FuncRef, Inst, SigRef, Signature, Type, Value, ValueList, ValueListPool};
|
use crate::ir::{Ebb, FuncRef, Inst, SigRef, Signature, Type, Value, ValueList, ValueListPool};
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
use packed_option::ReservedValue;
|
use crate::packed_option::ReservedValue;
|
||||||
|
use crate::write::write_operands;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
use std::u16;
|
use std::u16;
|
||||||
use write::write_operands;
|
|
||||||
|
|
||||||
/// A data flow graph defines all instructions and extended basic blocks in a function as well as
|
/// A data flow graph defines all instructions and extended basic blocks in a function as well as
|
||||||
/// the data flow dependencies between them. The DFG also tracks values which can be either
|
/// the data flow dependencies between them. The DFG also tracks values which can be either
|
||||||
@@ -1063,9 +1063,9 @@ impl DataFlowGraph {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use ir::types;
|
use crate::ir::types;
|
||||||
use ir::{Function, InstructionData, Opcode, TrapCode};
|
use crate::ir::{Function, InstructionData, Opcode, TrapCode};
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -1218,8 +1218,8 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn aliases() {
|
fn aliases() {
|
||||||
use ir::condcodes::IntCC;
|
use crate::ir::condcodes::IntCC;
|
||||||
use ir::InstBuilder;
|
use crate::ir::InstBuilder;
|
||||||
|
|
||||||
let mut func = Function::new();
|
let mut func = Function::new();
|
||||||
let ebb0 = func.dfg.make_ebb();
|
let ebb0 = func.dfg.make_ebb();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
//! The entity references all implement the `Display` trait in a way that matches the textual IR
|
//! The entity references all implement the `Display` trait in a way that matches the textual IR
|
||||||
//! format.
|
//! format.
|
||||||
|
|
||||||
|
use crate::entity::entity_impl;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
|
|
||||||
@@ -318,7 +319,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn memory() {
|
fn memory() {
|
||||||
use packed_option::PackedOption;
|
use crate::packed_option::PackedOption;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
// This is the whole point of `PackedOption`.
|
// This is the whole point of `PackedOption`.
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
//!
|
//!
|
||||||
//! This module declares the data types used to represent external functions and call signatures.
|
//! This module declares the data types used to represent external functions and call signatures.
|
||||||
|
|
||||||
use ir::{ArgumentLoc, ExternalName, SigRef, Type};
|
use crate::ir::{ArgumentLoc, ExternalName, SigRef, Type};
|
||||||
use isa::{CallConv, RegInfo, RegUnit};
|
use crate::isa::{CallConv, RegInfo, RegUnit};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
@@ -334,7 +334,7 @@ impl fmt::Display for ExtFuncData {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ir::types::{B8, F32, I32};
|
use crate::ir::types::{B8, F32, I32};
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//! function. The name of an external declaration doesn't have any meaning to
|
//! function. The name of an external declaration doesn't have any meaning to
|
||||||
//! Cranelift, which compiles functions independently.
|
//! Cranelift, which compiles functions independently.
|
||||||
|
|
||||||
use ir::LibCall;
|
use crate::ir::LibCall;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::fmt::{self, Write};
|
use std::fmt::{self, Write};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
@@ -119,7 +119,7 @@ impl FromStr for ExternalName {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::ExternalName;
|
use super::ExternalName;
|
||||||
use ir::LibCall;
|
use crate::ir::LibCall;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
|
|
||||||
|
|||||||
@@ -3,20 +3,20 @@
|
|||||||
//! The `Function` struct defined in this module owns all of its extended basic blocks and
|
//! The `Function` struct defined in this module owns all of its extended basic blocks and
|
||||||
//! instructions.
|
//! instructions.
|
||||||
|
|
||||||
use binemit::CodeOffset;
|
use crate::binemit::CodeOffset;
|
||||||
use entity::{PrimaryMap, SecondaryMap};
|
use crate::entity::{PrimaryMap, SecondaryMap};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use ir::{DataFlowGraph, ExternalName, Layout, Signature};
|
use crate::ir::{DataFlowGraph, ExternalName, Layout, Signature};
|
||||||
use ir::{
|
use crate::ir::{
|
||||||
Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable,
|
Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, JumpTable,
|
||||||
JumpTableData, SigRef, StackSlot, StackSlotData, Table, TableData,
|
JumpTableData, SigRef, StackSlot, StackSlotData, Table, TableData,
|
||||||
};
|
};
|
||||||
use ir::{EbbOffsets, InstEncodings, SourceLocs, StackSlots, ValueLocations};
|
use crate::ir::{EbbOffsets, InstEncodings, SourceLocs, StackSlots, ValueLocations};
|
||||||
use ir::{JumpTableOffsets, JumpTables};
|
use crate::ir::{JumpTableOffsets, JumpTables};
|
||||||
use isa::{CallConv, EncInfo, Encoding, Legalize, TargetIsa};
|
use crate::isa::{CallConv, EncInfo, Encoding, Legalize, TargetIsa};
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
use crate::write::write_function;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use write::write_function;
|
|
||||||
|
|
||||||
/// A function.
|
/// A function.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
//! Global values.
|
//! Global values.
|
||||||
|
|
||||||
use ir::immediates::{Imm64, Offset32};
|
use crate::ir::immediates::{Imm64, Offset32};
|
||||||
use ir::{ExternalName, GlobalValue, Type};
|
use crate::ir::{ExternalName, GlobalValue, Type};
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Information about a global value declaration.
|
/// Information about a global value declaration.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Heaps.
|
//! Heaps.
|
||||||
|
|
||||||
use ir::immediates::Uimm64;
|
use crate::ir::immediates::Uimm64;
|
||||||
use ir::{GlobalValue, Type};
|
use crate::ir::{GlobalValue, Type};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Information about a heap declaration.
|
/// Information about a heap declaration.
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ use std::ops::{Deref, DerefMut};
|
|||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
use ir;
|
use crate::ir;
|
||||||
use ir::types;
|
use crate::ir::types;
|
||||||
use ir::{Ebb, FuncRef, JumpTable, SigRef, Type, Value};
|
use crate::ir::{Ebb, FuncRef, JumpTable, SigRef, Type, Value};
|
||||||
use isa;
|
use crate::isa;
|
||||||
|
|
||||||
use bitset::BitSet;
|
use crate::bitset::BitSet;
|
||||||
use entity;
|
use crate::entity;
|
||||||
use ref_slice::{ref_slice, ref_slice_mut};
|
use crate::ref_slice::{ref_slice, ref_slice_mut};
|
||||||
|
|
||||||
/// Some instructions use an external list of argument values because there is not enough space in
|
/// Some instructions use an external list of argument values because there is not enough space in
|
||||||
/// the 16-byte `InstructionData` struct. These value lists are stored in a memory pool in
|
/// the 16-byte `InstructionData` struct. These value lists are stored in a memory pool in
|
||||||
@@ -73,7 +73,7 @@ impl FromStr for Opcode {
|
|||||||
|
|
||||||
/// Parse an Opcode name from a string.
|
/// Parse an Opcode name from a string.
|
||||||
fn from_str(s: &str) -> Result<Self, &'static str> {
|
fn from_str(s: &str) -> Result<Self, &'static str> {
|
||||||
use constant_hash::{probe, simple_hash, Table};
|
use crate::constant_hash::{probe, simple_hash, Table};
|
||||||
|
|
||||||
impl<'a> Table<&'a str> for [Option<Opcode>] {
|
impl<'a> Table<&'a str> for [Option<Opcode>] {
|
||||||
fn len(&self) -> usize {
|
fn len(&self) -> usize {
|
||||||
@@ -645,7 +645,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn value_set() {
|
fn value_set() {
|
||||||
use ir::types::*;
|
use crate::ir::types::*;
|
||||||
|
|
||||||
let vts = ValueTypeSet {
|
let vts = ValueTypeSet {
|
||||||
lanes: BitSet16::from_range(0, 8),
|
lanes: BitSet16::from_range(0, 8),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
//! Jump tables are declared in the preamble and assigned an `ir::entities::JumpTable` reference.
|
//! Jump tables are declared in the preamble and assigned an `ir::entities::JumpTable` reference.
|
||||||
//! The actual table of destinations is stored in a `JumpTableData` struct defined in this module.
|
//! The actual table of destinations is stored in a `JumpTableData` struct defined in this module.
|
||||||
|
|
||||||
use ir::entities::Ebb;
|
use crate::ir::entities::Ebb;
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
use std::slice::{Iter, IterMut};
|
use std::slice::{Iter, IterMut};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
@@ -83,8 +83,8 @@ impl Display for JumpTableData {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::JumpTableData;
|
use super::JumpTableData;
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
use ir::Ebb;
|
use crate::ir::Ebb;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -3,13 +3,14 @@
|
|||||||
//! The order of extended basic blocks in a function and the order of instructions in an EBB is
|
//! The order of extended basic blocks in a function and the order of instructions in an EBB is
|
||||||
//! determined by the `Layout` data structure defined in this module.
|
//! determined by the `Layout` data structure defined in this module.
|
||||||
|
|
||||||
use entity::SecondaryMap;
|
use crate::entity::SecondaryMap;
|
||||||
use ir::progpoint::{ExpandedProgramPoint, ProgramOrder};
|
use crate::ir::progpoint::{ExpandedProgramPoint, ProgramOrder};
|
||||||
use ir::{Ebb, Inst};
|
use crate::ir::{Ebb, Inst};
|
||||||
use packed_option::PackedOption;
|
use crate::packed_option::PackedOption;
|
||||||
|
use crate::timing;
|
||||||
|
use log::debug;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::iter::{IntoIterator, Iterator};
|
use std::iter::{IntoIterator, Iterator};
|
||||||
use timing;
|
|
||||||
|
|
||||||
/// The `Layout` struct determines the layout of EBBs and instructions in a function. It does not
|
/// 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
|
/// contain definitions of instructions or EBBs, but depends on `Inst` and `Ebb` entity references
|
||||||
@@ -741,9 +742,9 @@ impl<'f> DoubleEndedIterator for Insts<'f> {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::Layout;
|
use super::Layout;
|
||||||
use cursor::{Cursor, CursorPosition};
|
use crate::cursor::{Cursor, CursorPosition};
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
use ir::{Ebb, Inst, ProgramOrder, SourceLoc};
|
use crate::ir::{Ebb, Inst, ProgramOrder, SourceLoc};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! Naming well-known routines in the runtime library.
|
//! Naming well-known routines in the runtime library.
|
||||||
|
|
||||||
use ir::{
|
use crate::ir::{
|
||||||
types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, Opcode,
|
types, AbiParam, ArgumentPurpose, ExtFuncData, ExternalName, FuncRef, Function, Inst, Opcode,
|
||||||
Signature, Type,
|
Signature, Type,
|
||||||
};
|
};
|
||||||
use isa::{CallConv, RegUnit, TargetIsa};
|
use crate::isa::{CallConv, RegUnit, TargetIsa};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
|||||||
@@ -23,32 +23,36 @@ mod trapcode;
|
|||||||
pub mod types;
|
pub mod types;
|
||||||
mod valueloc;
|
mod valueloc;
|
||||||
|
|
||||||
pub use ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase};
|
pub use crate::ir::builder::{InsertBuilder, InstBuilder, InstBuilderBase, InstInserterBase};
|
||||||
pub use ir::dfg::{DataFlowGraph, ValueDef};
|
pub use crate::ir::dfg::{DataFlowGraph, ValueDef};
|
||||||
pub use ir::entities::{
|
pub use crate::ir::entities::{
|
||||||
Ebb, FuncRef, GlobalValue, Heap, Inst, JumpTable, SigRef, StackSlot, Table, Value,
|
Ebb, FuncRef, GlobalValue, Heap, Inst, JumpTable, SigRef, StackSlot, Table, Value,
|
||||||
};
|
};
|
||||||
pub use ir::extfunc::{AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature};
|
pub use crate::ir::extfunc::{
|
||||||
pub use ir::extname::ExternalName;
|
AbiParam, ArgumentExtension, ArgumentPurpose, ExtFuncData, Signature,
|
||||||
pub use ir::function::Function;
|
};
|
||||||
pub use ir::globalvalue::GlobalValueData;
|
pub use crate::ir::extname::ExternalName;
|
||||||
pub use ir::heap::{HeapData, HeapStyle};
|
pub use crate::ir::function::Function;
|
||||||
pub use ir::instructions::{InstructionData, Opcode, ValueList, ValueListPool, VariableArgs};
|
pub use crate::ir::globalvalue::GlobalValueData;
|
||||||
pub use ir::jumptable::JumpTableData;
|
pub use crate::ir::heap::{HeapData, HeapStyle};
|
||||||
pub use ir::layout::Layout;
|
pub use crate::ir::instructions::{
|
||||||
pub use ir::libcall::{get_libcall_funcref, get_probestack_funcref, LibCall};
|
InstructionData, Opcode, ValueList, ValueListPool, VariableArgs,
|
||||||
pub use ir::memflags::MemFlags;
|
};
|
||||||
pub use ir::progpoint::{ExpandedProgramPoint, ProgramOrder, ProgramPoint};
|
pub use crate::ir::jumptable::JumpTableData;
|
||||||
pub use ir::sourceloc::SourceLoc;
|
pub use crate::ir::layout::Layout;
|
||||||
pub use ir::stackslot::{StackSlotData, StackSlotKind, StackSlots};
|
pub use crate::ir::libcall::{get_libcall_funcref, get_probestack_funcref, LibCall};
|
||||||
pub use ir::table::TableData;
|
pub use crate::ir::memflags::MemFlags;
|
||||||
pub use ir::trapcode::TrapCode;
|
pub use crate::ir::progpoint::{ExpandedProgramPoint, ProgramOrder, ProgramPoint};
|
||||||
pub use ir::types::Type;
|
pub use crate::ir::sourceloc::SourceLoc;
|
||||||
pub use ir::valueloc::{ArgumentLoc, ValueLoc};
|
pub use crate::ir::stackslot::{StackSlotData, StackSlotKind, StackSlots};
|
||||||
|
pub use crate::ir::table::TableData;
|
||||||
|
pub use crate::ir::trapcode::TrapCode;
|
||||||
|
pub use crate::ir::types::Type;
|
||||||
|
pub use crate::ir::valueloc::{ArgumentLoc, ValueLoc};
|
||||||
|
|
||||||
use binemit;
|
use crate::binemit;
|
||||||
use entity::{PrimaryMap, SecondaryMap};
|
use crate::entity::{PrimaryMap, SecondaryMap};
|
||||||
use isa;
|
use crate::isa;
|
||||||
|
|
||||||
/// Map of value locations.
|
/// Map of value locations.
|
||||||
pub type ValueLocations = SecondaryMap<Value, ValueLoc>;
|
pub type ValueLocations = SecondaryMap<Value, ValueLoc>;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Program points.
|
//! Program points.
|
||||||
|
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
use ir::{Ebb, Inst, ValueDef};
|
use crate::ir::{Ebb, Inst, ValueDef};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
@@ -146,8 +146,8 @@ pub trait ProgramOrder {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
use ir::{Ebb, Inst};
|
use crate::ir::{Ebb, Inst};
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ impl fmt::Display for SourceLoc {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ir::SourceLoc;
|
use crate::ir::SourceLoc;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
//! The `StackSlotData` struct keeps track of a single stack slot in a function.
|
//! The `StackSlotData` struct keeps track of a single stack slot in a function.
|
||||||
//!
|
//!
|
||||||
|
|
||||||
use entity::{Iter, IterMut, Keys, PrimaryMap};
|
use crate::entity::{Iter, IterMut, Keys, PrimaryMap};
|
||||||
use ir::{StackSlot, Type};
|
use crate::ir::{StackSlot, Type};
|
||||||
use packed_option::PackedOption;
|
use crate::packed_option::PackedOption;
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::ops::{Index, IndexMut};
|
use std::ops::{Index, IndexMut};
|
||||||
@@ -340,8 +340,8 @@ impl StackSlots {
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use ir::types;
|
use crate::ir::types;
|
||||||
use ir::Function;
|
use crate::ir::Function;
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Tables.
|
//! Tables.
|
||||||
|
|
||||||
use ir::immediates::Uimm64;
|
use crate::ir::immediates::Uimm64;
|
||||||
use ir::{GlobalValue, Type};
|
use crate::ir::{GlobalValue, Type};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Information about a table declaration.
|
/// Information about a table declaration.
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
//! The register allocator assigns every SSA value to either a register or a stack slot. This
|
//! The register allocator assigns every SSA value to either a register or a stack slot. This
|
||||||
//! assignment is represented by a `ValueLoc` object.
|
//! assignment is represented by a `ValueLoc` object.
|
||||||
|
|
||||||
use ir::StackSlot;
|
use crate::ir::StackSlot;
|
||||||
use isa::{RegInfo, RegUnit};
|
use crate::isa::{RegInfo, RegUnit};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Value location.
|
/// Value location.
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! ARM ABI implementation.
|
//! ARM ABI implementation.
|
||||||
|
|
||||||
use super::registers::{D, GPR, Q, S};
|
use super::registers::{D, GPR, Q, S};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::RegClass;
|
use crate::isa::RegClass;
|
||||||
use regalloc::RegisterSet;
|
use crate::regalloc::RegisterSet;
|
||||||
use settings as shared_settings;
|
use crate::settings as shared_settings;
|
||||||
|
|
||||||
/// Legalize `sig`.
|
/// Legalize `sig`.
|
||||||
pub fn legalize_signature(
|
pub fn legalize_signature(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Emitting binary ARM32 machine code.
|
//! Emitting binary ARM32 machine code.
|
||||||
|
|
||||||
use binemit::{bad_encoding, CodeSink};
|
use crate::binemit::{bad_encoding, CodeSink};
|
||||||
use ir::{Function, Inst};
|
use crate::ir::{Function, Inst};
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/binemit-arm32.rs"));
|
include!(concat!(env!("OUT_DIR"), "/binemit-arm32.rs"));
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
//! Encoding tables for ARM32 ISA.
|
//! Encoding tables for ARM32 ISA.
|
||||||
|
|
||||||
use ir;
|
use crate::isa;
|
||||||
use isa;
|
use crate::isa::constraints::*;
|
||||||
use isa::constraints::*;
|
use crate::isa::enc_tables::*;
|
||||||
use isa::enc_tables::*;
|
use crate::isa::encoding::RecipeSizing;
|
||||||
use isa::encoding::RecipeSizing;
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/encoding-arm32.rs"));
|
include!(concat!(env!("OUT_DIR"), "/encoding-arm32.rs"));
|
||||||
include!(concat!(env!("OUT_DIR"), "/legalize-arm32.rs"));
|
include!(concat!(env!("OUT_DIR"), "/legalize-arm32.rs"));
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ pub mod settings;
|
|||||||
|
|
||||||
use super::super::settings as shared_settings;
|
use super::super::settings as shared_settings;
|
||||||
#[cfg(feature = "testing_hooks")]
|
#[cfg(feature = "testing_hooks")]
|
||||||
use binemit::CodeSink;
|
use crate::binemit::CodeSink;
|
||||||
use binemit::{emit_function, MemoryCodeSink};
|
use crate::binemit::{emit_function, MemoryCodeSink};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
|
use crate::isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
|
||||||
use isa::Builder as IsaBuilder;
|
use crate::isa::Builder as IsaBuilder;
|
||||||
use isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
||||||
use regalloc;
|
use crate::regalloc;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use target_lexicon::{Architecture, Triple};
|
use target_lexicon::{Architecture, Triple};
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
//! ARM32 register descriptions.
|
//! ARM32 register descriptions.
|
||||||
|
|
||||||
use isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
use crate::isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/registers-arm32.rs"));
|
include!(concat!(env!("OUT_DIR"), "/registers-arm32.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{D, GPR, INFO, S};
|
use super::{D, GPR, INFO, S};
|
||||||
use isa::RegUnit;
|
use crate::isa::RegUnit;
|
||||||
use std::string::{String, ToString};
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -34,7 +34,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn overlaps() {
|
fn overlaps() {
|
||||||
// arm32 has the most interesting register geometries, so test `regs_overlap()` here.
|
// arm32 has the most interesting register geometries, so test `regs_overlap()` here.
|
||||||
use isa::regs_overlap;
|
use crate::isa::regs_overlap;
|
||||||
|
|
||||||
let r0 = GPR.unit(0);
|
let r0 = GPR.unit(0);
|
||||||
let r1 = GPR.unit(1);
|
let r1 = GPR.unit(1);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! ARM32 Settings.
|
//! ARM32 Settings.
|
||||||
|
|
||||||
use settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! ARM 64 ABI implementation.
|
//! ARM 64 ABI implementation.
|
||||||
|
|
||||||
use super::registers::{FPR, GPR};
|
use super::registers::{FPR, GPR};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::RegClass;
|
use crate::isa::RegClass;
|
||||||
use regalloc::RegisterSet;
|
use crate::regalloc::RegisterSet;
|
||||||
use settings as shared_settings;
|
use crate::settings as shared_settings;
|
||||||
|
|
||||||
/// Legalize `sig`.
|
/// Legalize `sig`.
|
||||||
pub fn legalize_signature(
|
pub fn legalize_signature(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
//! Emitting binary ARM64 machine code.
|
//! Emitting binary ARM64 machine code.
|
||||||
|
|
||||||
use binemit::{bad_encoding, CodeSink};
|
use crate::binemit::{bad_encoding, CodeSink};
|
||||||
use ir::{Function, Inst};
|
use crate::ir::{Function, Inst};
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/binemit-arm64.rs"));
|
include!(concat!(env!("OUT_DIR"), "/binemit-arm64.rs"));
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
//! Encoding tables for ARM64 ISA.
|
//! Encoding tables for ARM64 ISA.
|
||||||
|
|
||||||
use ir;
|
use crate::isa;
|
||||||
use isa;
|
use crate::isa::constraints::*;
|
||||||
use isa::constraints::*;
|
use crate::isa::enc_tables::*;
|
||||||
use isa::enc_tables::*;
|
use crate::isa::encoding::RecipeSizing;
|
||||||
use isa::encoding::RecipeSizing;
|
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/encoding-arm64.rs"));
|
include!(concat!(env!("OUT_DIR"), "/encoding-arm64.rs"));
|
||||||
include!(concat!(env!("OUT_DIR"), "/legalize-arm64.rs"));
|
include!(concat!(env!("OUT_DIR"), "/legalize-arm64.rs"));
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ pub mod settings;
|
|||||||
|
|
||||||
use super::super::settings as shared_settings;
|
use super::super::settings as shared_settings;
|
||||||
#[cfg(feature = "testing_hooks")]
|
#[cfg(feature = "testing_hooks")]
|
||||||
use binemit::CodeSink;
|
use crate::binemit::CodeSink;
|
||||||
use binemit::{emit_function, MemoryCodeSink};
|
use crate::binemit::{emit_function, MemoryCodeSink};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::enc_tables::{lookup_enclist, Encodings};
|
use crate::isa::enc_tables::{lookup_enclist, Encodings};
|
||||||
use isa::Builder as IsaBuilder;
|
use crate::isa::Builder as IsaBuilder;
|
||||||
use isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
||||||
use regalloc;
|
use crate::regalloc;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
//! ARM64 register descriptions.
|
//! ARM64 register descriptions.
|
||||||
|
|
||||||
use isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
use crate::isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/registers-arm64.rs"));
|
include!(concat!(env!("OUT_DIR"), "/registers-arm64.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::INFO;
|
use super::INFO;
|
||||||
use isa::RegUnit;
|
use crate::isa::RegUnit;
|
||||||
use std::string::{String, ToString};
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! ARM64 Settings.
|
//! ARM64 Settings.
|
||||||
|
|
||||||
use settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
//! It is the register allocator's job to make sure that the register constraints on value operands
|
//! It is the register allocator's job to make sure that the register constraints on value operands
|
||||||
//! are satisfied.
|
//! are satisfied.
|
||||||
|
|
||||||
use binemit::CodeOffset;
|
use crate::binemit::CodeOffset;
|
||||||
use ir::{Function, Inst, ValueLoc};
|
use crate::ir::{Function, Inst, ValueLoc};
|
||||||
use isa::{RegClass, RegUnit};
|
use crate::isa::{RegClass, RegUnit};
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
/// Register constraint for a single value operand or instruction result.
|
/// Register constraint for a single value operand or instruction result.
|
||||||
#[derive(PartialEq, Debug)]
|
#[derive(PartialEq, Debug)]
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
//! This module contains types and functions for working with the encoding tables generated by
|
//! This module contains types and functions for working with the encoding tables generated by
|
||||||
//! `lib/codegen/meta-python/gen_encoding.py`.
|
//! `lib/codegen/meta-python/gen_encoding.py`.
|
||||||
|
|
||||||
use constant_hash::{probe, Table};
|
use crate::constant_hash::{probe, Table};
|
||||||
use ir::{Function, InstructionData, Opcode, Type};
|
use crate::ir::{Function, InstructionData, Opcode, Type};
|
||||||
use isa::{Encoding, Legalize};
|
use crate::isa::{Encoding, Legalize};
|
||||||
use settings::PredicateView;
|
use crate::settings::PredicateView;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
||||||
/// A recipe predicate.
|
/// A recipe predicate.
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
//! The `Encoding` struct.
|
//! The `Encoding` struct.
|
||||||
|
|
||||||
use binemit::CodeOffset;
|
use crate::binemit::CodeOffset;
|
||||||
use ir::{Function, Inst};
|
use crate::ir::{Function, Inst};
|
||||||
use isa::constraints::{BranchRange, RecipeConstraints};
|
use crate::isa::constraints::{BranchRange, RecipeConstraints};
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Bits needed to encode an instruction as binary machine code.
|
/// Bits needed to encode an instruction as binary machine code.
|
||||||
|
|||||||
@@ -46,24 +46,27 @@
|
|||||||
//! The configured target ISA trait object is a `Box<TargetIsa>` which can be used for multiple
|
//! The configured target ISA trait object is a `Box<TargetIsa>` which can be used for multiple
|
||||||
//! concurrent function compilations.
|
//! concurrent function compilations.
|
||||||
|
|
||||||
pub use isa::call_conv::CallConv;
|
pub use crate::isa::call_conv::CallConv;
|
||||||
pub use isa::constraints::{BranchRange, ConstraintKind, OperandConstraint, RecipeConstraints};
|
pub use crate::isa::constraints::{
|
||||||
pub use isa::encoding::{base_size, EncInfo, Encoding};
|
BranchRange, ConstraintKind, OperandConstraint, RecipeConstraints,
|
||||||
pub use isa::registers::{regs_overlap, RegClass, RegClassIndex, RegInfo, RegUnit};
|
};
|
||||||
pub use isa::stack::{StackBase, StackBaseMask, StackRef};
|
pub use crate::isa::encoding::{base_size, EncInfo, Encoding};
|
||||||
|
pub use crate::isa::registers::{regs_overlap, RegClass, RegClassIndex, RegInfo, RegUnit};
|
||||||
|
pub use crate::isa::stack::{StackBase, StackBaseMask, StackRef};
|
||||||
|
|
||||||
use binemit;
|
use crate::binemit;
|
||||||
use flowgraph;
|
use crate::flowgraph;
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::enc_tables::Encodings;
|
use crate::isa::enc_tables::Encodings;
|
||||||
use regalloc;
|
use crate::regalloc;
|
||||||
use result::CodegenResult;
|
use crate::result::CodegenResult;
|
||||||
use settings;
|
use crate::settings;
|
||||||
use settings::SetResult;
|
use crate::settings::SetResult;
|
||||||
|
use crate::timing;
|
||||||
|
use failure_derive::Fail;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use target_lexicon::{Architecture, PointerWidth, Triple};
|
use target_lexicon::{Architecture, PointerWidth, Triple};
|
||||||
use timing;
|
|
||||||
|
|
||||||
#[cfg(build_riscv)]
|
#[cfg(build_riscv)]
|
||||||
mod riscv;
|
mod riscv;
|
||||||
@@ -334,8 +337,8 @@ pub trait TargetIsa: fmt::Display + Sync {
|
|||||||
fn prologue_epilogue(&self, func: &mut ir::Function) -> CodegenResult<()> {
|
fn prologue_epilogue(&self, func: &mut ir::Function) -> CodegenResult<()> {
|
||||||
let _tt = timing::prologue_epilogue();
|
let _tt = timing::prologue_epilogue();
|
||||||
// This default implementation is unlikely to be good enough.
|
// This default implementation is unlikely to be good enough.
|
||||||
use ir::stackslot::{StackOffset, StackSize};
|
use crate::ir::stackslot::{StackOffset, StackSize};
|
||||||
use stack_layout::layout_stack;
|
use crate::stack_layout::layout_stack;
|
||||||
|
|
||||||
let word_size = StackSize::from(self.pointer_bytes());
|
let word_size = StackSize::from(self.pointer_bytes());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! Data structures describing the registers in an ISA.
|
//! Data structures describing the registers in an ISA.
|
||||||
|
|
||||||
use entity::EntityRef;
|
use crate::entity::EntityRef;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
/// Register units are the smallest units of register allocation.
|
/// Register units are the smallest units of register allocation.
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
use super::registers::{FPR, GPR};
|
use super::registers::{FPR, GPR};
|
||||||
use super::settings;
|
use super::settings;
|
||||||
use abi::{legalize_args, ArgAction, ArgAssigner, ValueConversion};
|
use crate::abi::{legalize_args, ArgAction, ArgAssigner, ValueConversion};
|
||||||
use ir::{self, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, Type};
|
use crate::ir::{self, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, Type};
|
||||||
use isa::RegClass;
|
use crate::isa::RegClass;
|
||||||
use regalloc::RegisterSet;
|
use crate::regalloc::RegisterSet;
|
||||||
use std::i32;
|
use std::i32;
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
//! Emitting binary RISC-V machine code.
|
//! Emitting binary RISC-V machine code.
|
||||||
|
|
||||||
use binemit::{bad_encoding, CodeSink, Reloc};
|
use crate::binemit::{bad_encoding, CodeSink, Reloc};
|
||||||
use ir::{Function, Inst, InstructionData};
|
use crate::ir::{Function, Inst, InstructionData};
|
||||||
use isa::{RegUnit, StackBaseMask, StackRef};
|
use crate::isa::{RegUnit, StackBaseMask, StackRef};
|
||||||
use predicates::is_signed_int;
|
use crate::predicates::is_signed_int;
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
use std::u32;
|
use std::u32;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/binemit-riscv.rs"));
|
include!(concat!(env!("OUT_DIR"), "/binemit-riscv.rs"));
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
//! Encoding tables for RISC-V.
|
//! Encoding tables for RISC-V.
|
||||||
|
|
||||||
use super::registers::*;
|
use super::registers::*;
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa;
|
use crate::isa;
|
||||||
use isa::constraints::*;
|
use crate::isa::constraints::*;
|
||||||
use isa::enc_tables::*;
|
use crate::isa::enc_tables::*;
|
||||||
use isa::encoding::{base_size, RecipeSizing};
|
use crate::isa::encoding::{base_size, RecipeSizing};
|
||||||
|
|
||||||
// Include the generated encoding tables:
|
// Include the generated encoding tables:
|
||||||
// - `LEVEL1_RV32`
|
// - `LEVEL1_RV32`
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ pub mod settings;
|
|||||||
|
|
||||||
use super::super::settings as shared_settings;
|
use super::super::settings as shared_settings;
|
||||||
#[cfg(feature = "testing_hooks")]
|
#[cfg(feature = "testing_hooks")]
|
||||||
use binemit::CodeSink;
|
use crate::binemit::CodeSink;
|
||||||
use binemit::{emit_function, MemoryCodeSink};
|
use crate::binemit::{emit_function, MemoryCodeSink};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
|
use crate::isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
|
||||||
use isa::Builder as IsaBuilder;
|
use crate::isa::Builder as IsaBuilder;
|
||||||
use isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
||||||
use regalloc;
|
use crate::regalloc;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use target_lexicon::{PointerWidth, Triple};
|
use target_lexicon::{PointerWidth, Triple};
|
||||||
@@ -125,13 +125,13 @@ impl TargetIsa for Isa {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use ir::{immediates, types};
|
use crate::ir::{immediates, types};
|
||||||
use ir::{Function, InstructionData, Opcode};
|
use crate::ir::{Function, InstructionData, Opcode};
|
||||||
use isa;
|
use crate::isa;
|
||||||
use settings::{self, Configurable};
|
use crate::settings::{self, Configurable};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::string::{String, ToString};
|
use std::string::{String, ToString};
|
||||||
use target_lexicon;
|
use target_lexicon::triple;
|
||||||
|
|
||||||
fn encstr(isa: &isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {
|
fn encstr(isa: &isa::TargetIsa, enc: Result<isa::Encoding, isa::Legalize>) -> String {
|
||||||
match enc {
|
match enc {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
//! RISC-V register descriptions.
|
//! RISC-V register descriptions.
|
||||||
|
|
||||||
use isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
use crate::isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/registers-riscv.rs"));
|
include!(concat!(env!("OUT_DIR"), "/registers-riscv.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{FPR, GPR, INFO};
|
use super::{FPR, GPR, INFO};
|
||||||
use isa::RegUnit;
|
use crate::isa::RegUnit;
|
||||||
use std::string::{String, ToString};
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! RISC-V Settings.
|
//! RISC-V Settings.
|
||||||
|
|
||||||
use settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
@@ -11,7 +11,7 @@ include!(concat!(env!("OUT_DIR"), "/settings-riscv.rs"));
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{builder, Flags};
|
use super::{builder, Flags};
|
||||||
use settings::{self, Configurable};
|
use crate::settings::{self, Configurable};
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
//! defined in this module expresses the low-level details of accessing a stack slot from an
|
//! defined in this module expresses the low-level details of accessing a stack slot from an
|
||||||
//! encoded instruction.
|
//! encoded instruction.
|
||||||
|
|
||||||
use ir::stackslot::{StackOffset, StackSlotKind, StackSlots};
|
use crate::ir::stackslot::{StackOffset, StackSlotKind, StackSlots};
|
||||||
use ir::StackSlot;
|
use crate::ir::StackSlot;
|
||||||
|
|
||||||
/// A method for referencing a stack slot in the current stack frame.
|
/// A method for referencing a stack slot in the current stack frame.
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
//! x86 ABI implementation.
|
//! x86 ABI implementation.
|
||||||
|
|
||||||
use super::registers::{FPR, GPR, RU};
|
use super::registers::{FPR, GPR, RU};
|
||||||
use abi::{legalize_args, ArgAction, ArgAssigner, ValueConversion};
|
use crate::abi::{legalize_args, ArgAction, ArgAssigner, ValueConversion};
|
||||||
use cursor::{Cursor, CursorPosition, EncCursor};
|
use crate::cursor::{Cursor, CursorPosition, EncCursor};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use ir::immediates::Imm64;
|
use crate::ir::immediates::Imm64;
|
||||||
use ir::stackslot::{StackOffset, StackSize};
|
use crate::ir::stackslot::{StackOffset, StackSize};
|
||||||
use ir::{
|
use crate::ir::{
|
||||||
get_probestack_funcref, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, InstBuilder,
|
get_probestack_funcref, AbiParam, ArgumentExtension, ArgumentLoc, ArgumentPurpose, InstBuilder,
|
||||||
ValueLoc,
|
ValueLoc,
|
||||||
};
|
};
|
||||||
use isa::{CallConv, RegClass, RegUnit, TargetIsa};
|
use crate::isa::{CallConv, RegClass, RegUnit, TargetIsa};
|
||||||
use regalloc::RegisterSet;
|
use crate::regalloc::RegisterSet;
|
||||||
use result::CodegenResult;
|
use crate::result::CodegenResult;
|
||||||
use stack_layout::layout_stack;
|
use crate::stack_layout::layout_stack;
|
||||||
use std::i32;
|
use std::i32;
|
||||||
use target_lexicon::{PointerWidth, Triple};
|
use target_lexicon::{PointerWidth, Triple};
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ fn insert_common_prologue(
|
|||||||
/// Insert a check that generates a trap if the stack pointer goes
|
/// Insert a check that generates a trap if the stack pointer goes
|
||||||
/// below a value in `stack_limit_arg`.
|
/// below a value in `stack_limit_arg`.
|
||||||
fn insert_stack_check(pos: &mut EncCursor, stack_size: i64, stack_limit_arg: ir::Value) {
|
fn insert_stack_check(pos: &mut EncCursor, stack_size: i64, stack_limit_arg: ir::Value) {
|
||||||
use ir::condcodes::IntCC;
|
use crate::ir::condcodes::IntCC;
|
||||||
|
|
||||||
// Copy `stack_limit_arg` into a %rax and use it for calculating
|
// Copy `stack_limit_arg` into a %rax and use it for calculating
|
||||||
// a SP threshold.
|
// a SP threshold.
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
use super::enc_tables::{needs_offset, needs_sib_byte};
|
use super::enc_tables::{needs_offset, needs_sib_byte};
|
||||||
use super::registers::RU;
|
use super::registers::RU;
|
||||||
use binemit::{bad_encoding, CodeSink, Reloc};
|
use crate::binemit::{bad_encoding, CodeSink, Reloc};
|
||||||
use ir::condcodes::{CondCode, FloatCC, IntCC};
|
use crate::ir::condcodes::{CondCode, FloatCC, IntCC};
|
||||||
use ir::{Ebb, Function, Inst, InstructionData, JumpTable, Opcode, TrapCode};
|
use crate::ir::{Ebb, Function, Inst, InstructionData, JumpTable, Opcode, TrapCode};
|
||||||
use isa::{RegUnit, StackBase, StackBaseMask, StackRef};
|
use crate::isa::{RegUnit, StackBase, StackBaseMask, StackRef};
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/binemit-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/binemit-x86.rs"));
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ fn sib<CS: CodeSink + ?Sized>(scale: u8, index: RegUnit, base: RegUnit, sink: &m
|
|||||||
/// 0x0f 0x90: SetCC.
|
/// 0x0f 0x90: SetCC.
|
||||||
///
|
///
|
||||||
fn icc2opc(cond: IntCC) -> u16 {
|
fn icc2opc(cond: IntCC) -> u16 {
|
||||||
use ir::condcodes::IntCC::*;
|
use crate::ir::condcodes::IntCC::*;
|
||||||
match cond {
|
match cond {
|
||||||
// 0x0 = Overflow.
|
// 0x0 = Overflow.
|
||||||
// 0x1 = !Overflow.
|
// 0x1 = !Overflow.
|
||||||
@@ -303,7 +303,7 @@ fn icc2opc(cond: IntCC) -> u16 {
|
|||||||
///
|
///
|
||||||
/// Not all floating point condition codes are supported.
|
/// Not all floating point condition codes are supported.
|
||||||
fn fcc2opc(cond: FloatCC) -> u16 {
|
fn fcc2opc(cond: FloatCC) -> u16 {
|
||||||
use ir::condcodes::FloatCC::*;
|
use crate::ir::condcodes::FloatCC::*;
|
||||||
match cond {
|
match cond {
|
||||||
Ordered => 0xb, // EQ|LT|GT => *np (P=0)
|
Ordered => 0xb, // EQ|LT|GT => *np (P=0)
|
||||||
Unordered => 0xa, // UN => *p (P=1)
|
Unordered => 0xa, // UN => *p (P=1)
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
//! Encoding tables for x86 ISAs.
|
//! Encoding tables for x86 ISAs.
|
||||||
|
|
||||||
use super::registers::*;
|
use super::registers::*;
|
||||||
use bitset::BitSet;
|
use crate::bitset::BitSet;
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use ir::condcodes::IntCC;
|
use crate::ir::condcodes::IntCC;
|
||||||
use ir::{self, Function, Inst, InstBuilder};
|
use crate::ir::{self, Function, Inst, InstBuilder};
|
||||||
use isa;
|
use crate::isa;
|
||||||
use isa::constraints::*;
|
use crate::isa::constraints::*;
|
||||||
use isa::enc_tables::*;
|
use crate::isa::enc_tables::*;
|
||||||
use isa::encoding::base_size;
|
use crate::isa::encoding::base_size;
|
||||||
use isa::encoding::RecipeSizing;
|
use crate::isa::encoding::RecipeSizing;
|
||||||
use isa::RegUnit;
|
use crate::isa::RegUnit;
|
||||||
use regalloc::RegDiversions;
|
use crate::regalloc::RegDiversions;
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/encoding-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/encoding-x86.rs"));
|
||||||
include!(concat!(env!("OUT_DIR"), "/legalize-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/legalize-x86.rs"));
|
||||||
@@ -228,7 +228,7 @@ fn expand_minmax(
|
|||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &isa::TargetIsa,
|
_isa: &isa::TargetIsa,
|
||||||
) {
|
) {
|
||||||
use ir::condcodes::FloatCC;
|
use crate::ir::condcodes::FloatCC;
|
||||||
|
|
||||||
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 {
|
||||||
@@ -322,7 +322,7 @@ fn expand_fcvt_from_uint(
|
|||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &isa::TargetIsa,
|
_isa: &isa::TargetIsa,
|
||||||
) {
|
) {
|
||||||
use ir::condcodes::IntCC;
|
use crate::ir::condcodes::IntCC;
|
||||||
|
|
||||||
let x;
|
let x;
|
||||||
match func.dfg[inst] {
|
match func.dfg[inst] {
|
||||||
@@ -395,8 +395,8 @@ fn expand_fcvt_to_sint(
|
|||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &isa::TargetIsa,
|
_isa: &isa::TargetIsa,
|
||||||
) {
|
) {
|
||||||
use ir::condcodes::{FloatCC, IntCC};
|
use crate::ir::condcodes::{FloatCC, IntCC};
|
||||||
use ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
let x = match func.dfg[inst] {
|
let x = match func.dfg[inst] {
|
||||||
ir::InstructionData::Unary {
|
ir::InstructionData::Unary {
|
||||||
@@ -491,8 +491,8 @@ fn expand_fcvt_to_sint_sat(
|
|||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &isa::TargetIsa,
|
_isa: &isa::TargetIsa,
|
||||||
) {
|
) {
|
||||||
use ir::condcodes::{FloatCC, IntCC};
|
use crate::ir::condcodes::{FloatCC, IntCC};
|
||||||
use ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
let x = match func.dfg[inst] {
|
let x = match func.dfg[inst] {
|
||||||
ir::InstructionData::Unary {
|
ir::InstructionData::Unary {
|
||||||
@@ -611,8 +611,8 @@ fn expand_fcvt_to_uint(
|
|||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &isa::TargetIsa,
|
_isa: &isa::TargetIsa,
|
||||||
) {
|
) {
|
||||||
use ir::condcodes::{FloatCC, IntCC};
|
use crate::ir::condcodes::{FloatCC, IntCC};
|
||||||
use ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
let x = match func.dfg[inst] {
|
let x = match func.dfg[inst] {
|
||||||
ir::InstructionData::Unary {
|
ir::InstructionData::Unary {
|
||||||
@@ -693,8 +693,8 @@ fn expand_fcvt_to_uint_sat(
|
|||||||
cfg: &mut ControlFlowGraph,
|
cfg: &mut ControlFlowGraph,
|
||||||
_isa: &isa::TargetIsa,
|
_isa: &isa::TargetIsa,
|
||||||
) {
|
) {
|
||||||
use ir::condcodes::{FloatCC, IntCC};
|
use crate::ir::condcodes::{FloatCC, IntCC};
|
||||||
use ir::immediates::{Ieee32, Ieee64};
|
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||||
|
|
||||||
let x = match func.dfg[inst] {
|
let x = match func.dfg[inst] {
|
||||||
ir::InstructionData::Unary {
|
ir::InstructionData::Unary {
|
||||||
|
|||||||
@@ -8,18 +8,18 @@ pub mod settings;
|
|||||||
|
|
||||||
use super::super::settings as shared_settings;
|
use super::super::settings as shared_settings;
|
||||||
#[cfg(feature = "testing_hooks")]
|
#[cfg(feature = "testing_hooks")]
|
||||||
use binemit::CodeSink;
|
use crate::binemit::CodeSink;
|
||||||
use binemit::{emit_function, MemoryCodeSink};
|
use crate::binemit::{emit_function, MemoryCodeSink};
|
||||||
use ir;
|
use crate::ir;
|
||||||
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
|
use crate::isa::enc_tables::{self as shared_enc_tables, lookup_enclist, Encodings};
|
||||||
use isa::Builder as IsaBuilder;
|
use crate::isa::Builder as IsaBuilder;
|
||||||
use isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
use crate::isa::{EncInfo, RegClass, RegInfo, TargetIsa};
|
||||||
use regalloc;
|
use crate::regalloc;
|
||||||
use result::CodegenResult;
|
use crate::result::CodegenResult;
|
||||||
|
use crate::timing;
|
||||||
use std::boxed::Box;
|
use std::boxed::Box;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use target_lexicon::{PointerWidth, Triple};
|
use target_lexicon::{PointerWidth, Triple};
|
||||||
use timing;
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
struct Isa {
|
struct Isa {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
//! x86 register descriptions.
|
//! x86 register descriptions.
|
||||||
|
|
||||||
use isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
use crate::isa::registers::{RegBank, RegClass, RegClassData, RegInfo, RegUnit};
|
||||||
|
|
||||||
include!(concat!(env!("OUT_DIR"), "/registers-x86.rs"));
|
include!(concat!(env!("OUT_DIR"), "/registers-x86.rs"));
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use isa::RegUnit;
|
use crate::isa::RegUnit;
|
||||||
use std::string::{String, ToString};
|
use std::string::{String, ToString};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
//! x86 Settings.
|
//! x86 Settings.
|
||||||
|
|
||||||
use settings::{self, detail, Builder};
|
use crate::settings::{self, detail, Builder};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
|
||||||
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
// Include code generated by `lib/codegen/meta-python/gen_settings.py`. This file contains a public
|
||||||
@@ -11,7 +11,7 @@ include!(concat!(env!("OUT_DIR"), "/settings-x86.rs"));
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::{builder, Flags};
|
use super::{builder, Flags};
|
||||||
use settings::{self, Configurable};
|
use crate::settings::{self, Configurable};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn presets() {
|
fn presets() {
|
||||||
|
|||||||
@@ -17,16 +17,17 @@
|
|||||||
//! Between the two phases, preamble signatures and call/return arguments don't match. This
|
//! Between the two phases, preamble signatures and call/return arguments don't match. This
|
||||||
//! intermediate state doesn't type check.
|
//! intermediate state doesn't type check.
|
||||||
|
|
||||||
use abi::{legalize_abi_value, ValueConversion};
|
use crate::abi::{legalize_abi_value, ValueConversion};
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use ir::instructions::CallInfo;
|
use crate::ir::instructions::CallInfo;
|
||||||
use ir::{
|
use crate::ir::{
|
||||||
AbiParam, ArgumentLoc, ArgumentPurpose, DataFlowGraph, Ebb, Function, Inst, InstBuilder,
|
AbiParam, ArgumentLoc, ArgumentPurpose, DataFlowGraph, Ebb, Function, Inst, InstBuilder,
|
||||||
SigRef, Signature, Type, Value, ValueLoc,
|
SigRef, Signature, Type, Value, ValueLoc,
|
||||||
};
|
};
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
use legalizer::split::{isplit, vsplit};
|
use crate::legalizer::split::{isplit, vsplit};
|
||||||
|
use log::debug;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
/// Legalize all the function signatures in `func`.
|
/// Legalize all the function signatures in `func`.
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
//! This module exports the `expand_call` function which transforms a `call`
|
//! This module exports the `expand_call` function which transforms a `call`
|
||||||
//! instruction into `func_addr` and `call_indirect` instructions.
|
//! instruction into `func_addr` and `call_indirect` instructions.
|
||||||
|
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use ir::{self, InstBuilder};
|
use crate::ir::{self, InstBuilder};
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
|
|
||||||
/// Expand a `call` instruction. This lowers it to a `call_indirect`, which
|
/// Expand a `call` instruction. This lowers it to a `call_indirect`, which
|
||||||
/// is only done if the ABI doesn't support direct calls.
|
/// is only done if the ABI doesn't support direct calls.
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
//! This module exports the `expand_global_value` function which transforms a `global_value`
|
//! This module exports the `expand_global_value` function which transforms a `global_value`
|
||||||
//! instruction into code that depends on the kind of global value referenced.
|
//! instruction into code that depends on the kind of global value referenced.
|
||||||
|
|
||||||
use cursor::{Cursor, FuncCursor};
|
use crate::cursor::{Cursor, FuncCursor};
|
||||||
use flowgraph::ControlFlowGraph;
|
use crate::flowgraph::ControlFlowGraph;
|
||||||
use ir::{self, InstBuilder};
|
use crate::ir::{self, InstBuilder};
|
||||||
use isa::TargetIsa;
|
use crate::isa::TargetIsa;
|
||||||
|
|
||||||
/// Expand a `global_value` instruction according to the definition of the global value.
|
/// Expand a `global_value` instruction according to the definition of the global value.
|
||||||
pub fn expand_global_value(
|
pub fn expand_global_value(
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user