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
@@ -244,7 +244,8 @@ class FieldPredicate(object):
|
||||
"""
|
||||
# Prepend `field` to the predicate function arguments.
|
||||
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):
|
||||
|
||||
@@ -394,7 +394,7 @@ class XFormGroup(object):
|
||||
# table referring to it.
|
||||
return self.name
|
||||
else:
|
||||
return '::legalizer::{}'.format(self.name)
|
||||
return 'crate::legalizer::{}'.format(self.name)
|
||||
|
||||
def legalize(self, src, dst):
|
||||
# type: (Union[Def, Apply], Rtl) -> None
|
||||
|
||||
@@ -110,7 +110,7 @@ def emit_instp(instp, fmt, has_func=False):
|
||||
fields = ', '.join(sorted(fnames))
|
||||
|
||||
with fmt.indented(
|
||||
'if let ir::InstructionData::{} {{ {}, .. }} = *inst {{'
|
||||
'if let crate::ir::InstructionData::{} {{ {}, .. }} = *inst {{'
|
||||
.format(iform.name, fields), '}'):
|
||||
if has_type_check:
|
||||
# We could implement this if we need to.
|
||||
@@ -132,7 +132,8 @@ def emit_inst_predicates(instps, fmt):
|
||||
for instp, number in instps.items():
|
||||
name = 'inst_predicate_{}'.format(number)
|
||||
with fmt.indented(
|
||||
'fn {}(func: &ir::Function, inst: &ir::InstructionData)'
|
||||
'fn {}(func: &crate::ir::Function, '
|
||||
'inst: &crate::ir::InstructionData)'
|
||||
'-> bool {{'.format(name), '}'):
|
||||
emit_instp(instp, fmt, has_func=True)
|
||||
|
||||
@@ -168,7 +169,7 @@ def emit_recipe_predicates(isa, fmt):
|
||||
|
||||
# Generate the predicate function.
|
||||
with fmt.indented(
|
||||
'fn {}({}: ::settings::PredicateView, '
|
||||
'fn {}({}: crate::settings::PredicateView, '
|
||||
'{}: &ir::InstructionData) -> bool {{'
|
||||
.format(
|
||||
name,
|
||||
@@ -657,7 +658,8 @@ def emit_level2_hashtables(level2_hashtables, offt, level2_doc, fmt):
|
||||
if entry:
|
||||
fmt.line(
|
||||
'Level2Entry ' +
|
||||
'{{ opcode: Some(ir::Opcode::{}), offset: {:#08x} }},'
|
||||
'{{ opcode: Some(crate::ir::Opcode::{}), '
|
||||
'offset: {:#08x} }},'
|
||||
.format(entry.inst.camel_name, entry.offset))
|
||||
else:
|
||||
fmt.line(
|
||||
@@ -682,15 +684,15 @@ def emit_level1_hashtable(cpumode, level1, offt, fmt):
|
||||
# Empty hash table entry. Include the default legalization action.
|
||||
if not level2:
|
||||
fmt.format(
|
||||
'Level1Entry {{ ty: ir::types::INVALID, log2len: !0, '
|
||||
'offset: 0, legalize: {} }},',
|
||||
'Level1Entry {{ ty: crate::ir::types::INVALID, '
|
||||
'log2len: !0, offset: 0, legalize: {} }},',
|
||||
level1.legalize_code)
|
||||
continue
|
||||
|
||||
if level2.ty is not None:
|
||||
tyname = level2.ty.rust_name()
|
||||
else:
|
||||
tyname = 'ir::types::INVALID'
|
||||
tyname = 'crate::ir::types::INVALID'
|
||||
|
||||
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
|
||||
# possible. Otherwise, it is the first method argument.
|
||||
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]
|
||||
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)
|
||||
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):
|
||||
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):
|
||||
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):
|
||||
return "{}.and_then(|t: ir::Type| t.double_width())"\
|
||||
return "{}.and_then(|t: crate::ir::Type| t.double_width())"\
|
||||
.format(base_exp)
|
||||
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)
|
||||
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:
|
||||
assert False, "Unknown derived function {}".format(tv.derived_func)
|
||||
|
||||
@@ -174,7 +176,7 @@ def unwrap_inst(iref, node, fmt):
|
||||
arg_names = tuple(
|
||||
arg.name if isinstance(arg, Var) else '_' for arg in expr.args)
|
||||
with fmt.indented(
|
||||
'let ({}, predicate) = if let ir::InstructionData::{} {{'
|
||||
'let ({}, predicate) = if let crate::ir::InstructionData::{} {{'
|
||||
.format(', '.join(map(str, arg_names)), iform.name), '};'):
|
||||
# Fields are encoded directly.
|
||||
for f in iform.imm_fields:
|
||||
@@ -359,13 +361,13 @@ def gen_xform_group(xgrp, fmt, type_sets):
|
||||
fmt.doc_comment("Legalize `inst`.")
|
||||
fmt.line('#[allow(unused_variables,unused_assignments,non_snake_case)]')
|
||||
with fmt.indented('pub fn {}('.format(xgrp.name)):
|
||||
fmt.line('inst: ir::Inst,')
|
||||
fmt.line('func: &mut ir::Function,')
|
||||
fmt.line('cfg: &mut ::flowgraph::ControlFlowGraph,')
|
||||
fmt.line('isa: &::isa::TargetIsa,')
|
||||
fmt.line('inst: crate::ir::Inst,')
|
||||
fmt.line('func: &mut crate::ir::Function,')
|
||||
fmt.line('cfg: &mut crate::flowgraph::ControlFlowGraph,')
|
||||
fmt.line('isa: &crate::isa::TargetIsa,')
|
||||
with fmt.indented(') -> bool {', '}'):
|
||||
fmt.line('use ir::InstBuilder;')
|
||||
fmt.line('use cursor::{Cursor, FuncCursor};')
|
||||
fmt.line('use crate::ir::InstBuilder;')
|
||||
fmt.line('use crate::cursor::{Cursor, FuncCursor};')
|
||||
fmt.line('let mut pos = FuncCursor::new(func).at_inst(inst);')
|
||||
fmt.line('pos.use_srcloc(inst);')
|
||||
|
||||
|
||||
@@ -117,10 +117,10 @@ def gen_getters(sgrp, fmt):
|
||||
with fmt.indented('impl Flags {', '}'):
|
||||
fmt.doc_comment('Get a view of the boolean predicates.')
|
||||
with fmt.indented(
|
||||
'pub fn predicate_view(&self) -> ::settings::PredicateView {',
|
||||
'}'):
|
||||
'pub fn predicate_view(&self) -> '
|
||||
'crate::settings::PredicateView {', '}'):
|
||||
fmt.format(
|
||||
'::settings::PredicateView::new(&self.bytes[{}..])',
|
||||
'crate::settings::PredicateView::new(&self.bytes[{}..])',
|
||||
sgrp.boolean_offset)
|
||||
if sgrp.settings:
|
||||
fmt.doc_comment('Dynamic numbered predicate getter.')
|
||||
|
||||
@@ -1934,7 +1934,7 @@ icscc = TailRecipe(
|
||||
PUT_OP(bits, rex2(in_reg0, in_reg1), sink);
|
||||
modrm_rr(in_reg0, in_reg1, sink);
|
||||
// `setCC` instruction, no REX.
|
||||
use ir::condcodes::IntCC::*;
|
||||
use crate::ir::condcodes::IntCC::*;
|
||||
let setcc = match cond {
|
||||
Equal => 0x94,
|
||||
NotEqual => 0x95,
|
||||
@@ -1962,7 +1962,7 @@ icscc_ib = TailRecipe(
|
||||
let imm: i64 = imm.into();
|
||||
sink.put1(imm as u8);
|
||||
// `setCC` instruction, no REX.
|
||||
use ir::condcodes::IntCC::*;
|
||||
use crate::ir::condcodes::IntCC::*;
|
||||
let setcc = match cond {
|
||||
Equal => 0x94,
|
||||
NotEqual => 0x95,
|
||||
@@ -1990,7 +1990,7 @@ icscc_id = TailRecipe(
|
||||
let imm: i64 = imm.into();
|
||||
sink.put4(imm as u32);
|
||||
// `setCC` instruction, no REX.
|
||||
use ir::condcodes::IntCC::*;
|
||||
use crate::ir::condcodes::IntCC::*;
|
||||
let setcc = match cond {
|
||||
Equal => 0x94,
|
||||
NotEqual => 0x95,
|
||||
@@ -2030,7 +2030,7 @@ fcscc = TailRecipe(
|
||||
PUT_OP(bits, rex2(in_reg1, in_reg0), sink);
|
||||
modrm_rr(in_reg1, in_reg0, sink);
|
||||
// `setCC` instruction, no REX.
|
||||
use ir::condcodes::FloatCC::*;
|
||||
use crate::ir::condcodes::FloatCC::*;
|
||||
let setcc = match cond {
|
||||
Ordered => 0x9b, // EQ|LT|GT => setnp (P=0)
|
||||
Unordered => 0x9a, // UN => setp (P=1)
|
||||
|
||||
@@ -148,9 +148,9 @@ class TestRuntimeChecks(TestCase):
|
||||
self.v5 << vselect(self.v1, self.v3, self.v4),
|
||||
)
|
||||
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)
|
||||
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)
|
||||
|
||||
self.check_yo_check(
|
||||
|
||||
Reference in New Issue
Block a user