Upgrade to Rust 1.17.
- Remove some uses of 'static in const and static globals that are no longer needed. - Use the new struct initialization shorthand.
This commit is contained in:
@@ -451,7 +451,7 @@ def emit_recipe_names(isa, fmt):
|
||||
This is used for pretty-printing encodings.
|
||||
"""
|
||||
with fmt.indented(
|
||||
'static RECIPE_NAMES: [&\'static str; {}] = ['
|
||||
'static RECIPE_NAMES: [&str; {}] = ['
|
||||
.format(len(isa.all_recipes)), '];'):
|
||||
for r in isa.all_recipes:
|
||||
fmt.line('"{}",'.format(r.name))
|
||||
|
||||
@@ -470,7 +470,7 @@ def gen_format_constructor(iform, fmt):
|
||||
# Generate the instruction data.
|
||||
with fmt.indented(
|
||||
'let data = InstructionData::{} {{'.format(iform.name), '};'):
|
||||
fmt.line('opcode: opcode,')
|
||||
fmt.line('opcode,')
|
||||
gen_member_inits(iform, fmt)
|
||||
|
||||
fmt.line('self.build(data, ctrl_typevar)')
|
||||
@@ -489,7 +489,7 @@ def gen_member_inits(iform, fmt):
|
||||
|
||||
# Value operands.
|
||||
if iform.has_value_list:
|
||||
fmt.line('args: args,')
|
||||
fmt.line('args,')
|
||||
elif iform.num_value_operands == 1:
|
||||
fmt.line('arg: arg0,')
|
||||
elif iform.num_value_operands > 1:
|
||||
|
||||
@@ -132,7 +132,7 @@ def gen_descriptors(sgrp, fmt):
|
||||
raise AssertionError("Unknown setting kind")
|
||||
|
||||
with fmt.indented(
|
||||
'static ENUMERATORS: [&\'static str; {}] = ['
|
||||
'static ENUMERATORS: [&str; {}] = ['
|
||||
.format(len(enums.table)),
|
||||
'];'):
|
||||
for txt in enums.table:
|
||||
|
||||
@@ -56,7 +56,7 @@ impl<'c, 'fc, 'fd> InsertBuilder<'c, 'fc, 'fd> {
|
||||
pub fn new(dfg: &'fd mut DataFlowGraph,
|
||||
pos: &'c mut Cursor<'fc>)
|
||||
-> InsertBuilder<'c, 'fc, 'fd> {
|
||||
InsertBuilder { dfg: dfg, pos: pos }
|
||||
InsertBuilder { dfg, pos }
|
||||
}
|
||||
|
||||
/// Reuse result values in `reuse`.
|
||||
@@ -72,7 +72,7 @@ impl<'c, 'fc, 'fd> InsertBuilder<'c, 'fc, 'fd> {
|
||||
InsertReuseBuilder {
|
||||
dfg: self.dfg,
|
||||
pos: self.pos,
|
||||
reuse: reuse,
|
||||
reuse,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,10 +154,7 @@ pub struct ReplaceBuilder<'f> {
|
||||
impl<'f> ReplaceBuilder<'f> {
|
||||
/// Create a `ReplaceBuilder` that will overwrite `inst`.
|
||||
pub fn new(dfg: &'f mut DataFlowGraph, inst: Inst) -> ReplaceBuilder {
|
||||
ReplaceBuilder {
|
||||
dfg: dfg,
|
||||
inst: inst,
|
||||
}
|
||||
ReplaceBuilder { dfg, inst }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -240,10 +240,7 @@ impl DataFlowGraph {
|
||||
self.value_type(dest),
|
||||
ty);
|
||||
|
||||
self.values[dest] = ValueData::Alias {
|
||||
ty: ty,
|
||||
original: original,
|
||||
};
|
||||
self.values[dest] = ValueData::Alias { ty, original };
|
||||
}
|
||||
|
||||
/// Create a new value alias.
|
||||
@@ -252,10 +249,7 @@ impl DataFlowGraph {
|
||||
pub fn make_value_alias(&mut self, src: Value) -> Value {
|
||||
let ty = self.value_type(src);
|
||||
|
||||
let data = ValueData::Alias {
|
||||
ty: ty,
|
||||
original: src,
|
||||
};
|
||||
let data = ValueData::Alias { ty, original: src };
|
||||
self.make_value(data)
|
||||
}
|
||||
}
|
||||
@@ -462,9 +456,9 @@ impl DataFlowGraph {
|
||||
assert!(num <= u16::MAX as usize, "Too many result values");
|
||||
let ty = self.value_type(res);
|
||||
self.values[res] = ValueData::Inst {
|
||||
ty: ty,
|
||||
ty,
|
||||
num: num as u16,
|
||||
inst: inst,
|
||||
inst,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -474,8 +468,8 @@ impl DataFlowGraph {
|
||||
let num = self.results[inst].push(res, &mut self.value_lists);
|
||||
assert!(num <= u16::MAX as usize, "Too many result values");
|
||||
self.make_value(ValueData::Inst {
|
||||
ty: ty,
|
||||
inst: inst,
|
||||
ty,
|
||||
inst,
|
||||
num: num as u16,
|
||||
})
|
||||
}
|
||||
@@ -594,9 +588,9 @@ impl DataFlowGraph {
|
||||
let num = self.ebbs[ebb].args.push(arg, &mut self.value_lists);
|
||||
assert!(num <= u16::MAX as usize, "Too many arguments to EBB");
|
||||
self.make_value(ValueData::Arg {
|
||||
ty: ty,
|
||||
ty,
|
||||
num: num as u16,
|
||||
ebb: ebb,
|
||||
ebb,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -611,9 +605,9 @@ impl DataFlowGraph {
|
||||
assert!(num <= u16::MAX as usize, "Too many arguments to EBB");
|
||||
let ty = self.value_type(arg);
|
||||
self.values[arg] = ValueData::Arg {
|
||||
ty: ty,
|
||||
ty,
|
||||
num: num as u16,
|
||||
ebb: ebb,
|
||||
ebb,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -635,8 +629,8 @@ impl DataFlowGraph {
|
||||
};
|
||||
let new_arg = self.make_value(ValueData::Arg {
|
||||
ty: new_type,
|
||||
num: num,
|
||||
ebb: ebb,
|
||||
num,
|
||||
ebb,
|
||||
});
|
||||
|
||||
self.ebbs[ebb].args.as_mut_slice(&mut self.value_lists)[num as usize] = new_arg;
|
||||
|
||||
@@ -138,7 +138,7 @@ impl ArgumentType {
|
||||
ArgumentType {
|
||||
value_type: vt,
|
||||
extension: ArgumentExtension::None,
|
||||
purpose: purpose,
|
||||
purpose,
|
||||
location: ArgumentLoc::Reg(regunit),
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ pub enum ArgumentPurpose {
|
||||
}
|
||||
|
||||
/// Text format names of the `ArgumentPurpose` variants.
|
||||
static PURPOSE_NAMES: [&'static str; 5] = ["normal", "sret", "link", "fp", "csr"];
|
||||
static PURPOSE_NAMES: [&str; 5] = ["normal", "sret", "link", "fp", "csr"];
|
||||
|
||||
impl fmt::Display for ArgumentPurpose {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
|
||||
@@ -57,7 +57,7 @@ impl Function {
|
||||
/// Create a function with the given name and signature.
|
||||
pub fn with_name_signature(name: FunctionName, sig: Signature) -> Function {
|
||||
Function {
|
||||
name: name,
|
||||
name,
|
||||
signature: sig,
|
||||
stack_slots: EntityMap::new(),
|
||||
jump_tables: EntityMap::new(),
|
||||
|
||||
@@ -647,7 +647,7 @@ impl<'f> Cursor<'f> {
|
||||
/// The cursor holds a mutable reference to `layout` for its entire lifetime.
|
||||
pub fn new(layout: &'f mut Layout) -> Cursor {
|
||||
Cursor {
|
||||
layout: layout,
|
||||
layout,
|
||||
pos: CursorPosition::Nowhere,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ enum FlagBit {
|
||||
Aligned,
|
||||
}
|
||||
|
||||
const NAMES: [&'static str; 2] = ["notrap", "aligned"];
|
||||
const NAMES: [&str; 2] = ["notrap", "aligned"];
|
||||
|
||||
/// Flags for memory operations like load/store.
|
||||
///
|
||||
|
||||
@@ -39,7 +39,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags,
|
||||
};
|
||||
Box::new(Isa {
|
||||
isa_flags: settings::Flags::new(&shared_flags, builder),
|
||||
shared_flags: shared_flags,
|
||||
shared_flags,
|
||||
cpumode: level1,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags,
|
||||
-> Box<TargetIsa> {
|
||||
Box::new(Isa {
|
||||
isa_flags: settings::Flags::new(&shared_flags, builder),
|
||||
shared_flags: shared_flags,
|
||||
shared_flags,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,7 @@ pub struct Encoding {
|
||||
impl Encoding {
|
||||
/// Create a new `Encoding` containing `(recipe, bits)`.
|
||||
pub fn new(recipe: u16, bits: u16) -> Encoding {
|
||||
Encoding {
|
||||
recipe: recipe,
|
||||
bits: bits,
|
||||
}
|
||||
Encoding { recipe, bits }
|
||||
}
|
||||
|
||||
/// Get the recipe number in this encoding.
|
||||
|
||||
@@ -39,7 +39,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags,
|
||||
};
|
||||
Box::new(Isa {
|
||||
isa_flags: settings::Flags::new(&shared_flags, builder),
|
||||
shared_flags: shared_flags,
|
||||
shared_flags,
|
||||
cpumode: level1,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ impl RegInfo {
|
||||
/// Make a temporary object that can display a register unit.
|
||||
pub fn display_regunit(&self, regunit: RegUnit) -> DisplayRegUnit {
|
||||
DisplayRegUnit {
|
||||
regunit: regunit,
|
||||
regunit,
|
||||
reginfo: self,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ fn isa_constructor(shared_flags: shared_settings::Flags,
|
||||
};
|
||||
Box::new(Isa {
|
||||
isa_flags: settings::Flags::new(&shared_flags, builder),
|
||||
shared_flags: shared_flags,
|
||||
shared_flags,
|
||||
cpumode: level1,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -8,10 +8,7 @@ pub trait IteratorExtras: Iterator {
|
||||
Self::Item: Clone
|
||||
{
|
||||
let elem = self.next();
|
||||
AdjacentPairs {
|
||||
iter: self,
|
||||
elem: elem,
|
||||
}
|
||||
AdjacentPairs { iter: self, elem }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,11 +261,11 @@ fn add_repair(concat: Opcode,
|
||||
hi_num: usize,
|
||||
repairs: &mut Vec<Repair>) {
|
||||
repairs.push(Repair {
|
||||
concat: concat,
|
||||
split_type: split_type,
|
||||
ebb: ebb,
|
||||
num: num,
|
||||
hi_num: hi_num,
|
||||
concat,
|
||||
split_type,
|
||||
ebb,
|
||||
num,
|
||||
hi_num,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -99,8 +99,8 @@ impl Coloring {
|
||||
let mut ctx = Context {
|
||||
reginfo: isa.register_info(),
|
||||
encinfo: isa.encoding_info(),
|
||||
domtree: domtree,
|
||||
liveness: liveness,
|
||||
domtree,
|
||||
liveness,
|
||||
usable_regs: isa.allocatable_registers(func),
|
||||
};
|
||||
ctx.run(self, func, tracker)
|
||||
|
||||
@@ -70,9 +70,9 @@ impl LiveValueVec {
|
||||
fn push(&mut self, value: Value, endpoint: Inst, affinity: Affinity) {
|
||||
self.values
|
||||
.push(LiveValue {
|
||||
value: value,
|
||||
endpoint: endpoint,
|
||||
affinity: affinity,
|
||||
value,
|
||||
endpoint,
|
||||
affinity,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -208,8 +208,8 @@ impl LiveRange {
|
||||
/// The live range will be created as dead, but it can be extended with `extend_in_ebb()`.
|
||||
pub fn new(value: Value, def: ProgramPoint, affinity: Affinity) -> LiveRange {
|
||||
LiveRange {
|
||||
value: value,
|
||||
affinity: affinity,
|
||||
value,
|
||||
affinity,
|
||||
def_begin: def,
|
||||
def_end: def,
|
||||
liveins: Vec::new(),
|
||||
|
||||
@@ -27,10 +27,10 @@ pub fn verify_liveness(isa: &TargetIsa,
|
||||
liveness: &Liveness)
|
||||
-> Result {
|
||||
let verifier = LivenessVerifier {
|
||||
isa: isa,
|
||||
func: func,
|
||||
cfg: cfg,
|
||||
liveness: liveness,
|
||||
isa,
|
||||
func,
|
||||
cfg,
|
||||
liveness,
|
||||
};
|
||||
verifier.check_ebbs()?;
|
||||
verifier.check_insts()?;
|
||||
|
||||
@@ -139,10 +139,10 @@ impl<'a> Verifier<'a> {
|
||||
let cfg = ControlFlowGraph::with_function(func);
|
||||
let domtree = DominatorTree::with_function(func, &cfg);
|
||||
Verifier {
|
||||
func: func,
|
||||
cfg: cfg,
|
||||
domtree: domtree,
|
||||
isa: isa,
|
||||
func,
|
||||
cfg,
|
||||
domtree,
|
||||
isa,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ enum Directive {
|
||||
// 1. Keyword.
|
||||
// 2. Rest of line / pattern.
|
||||
//
|
||||
const DIRECTIVE_RX: &'static str = r"\b(check|sameln|nextln|unordered|not|regex):\s+(.*)";
|
||||
const DIRECTIVE_RX: &str = r"\b(check|sameln|nextln|unordered|not|regex):\s+(.*)";
|
||||
|
||||
impl Directive {
|
||||
/// Create a new directive from a `DIRECTIVE_RX` match.
|
||||
@@ -264,9 +264,9 @@ struct State<'a> {
|
||||
impl<'a> State<'a> {
|
||||
fn new(text: &'a str, env_vars: &'a VariableMap, recorder: &'a mut Recorder) -> State<'a> {
|
||||
State {
|
||||
text: text,
|
||||
env_vars: env_vars,
|
||||
recorder: recorder,
|
||||
text,
|
||||
env_vars,
|
||||
recorder,
|
||||
vars: HashMap::new(),
|
||||
last_ordered: 0,
|
||||
max_match: 0,
|
||||
|
||||
@@ -60,7 +60,7 @@ pub struct Explainer<'a> {
|
||||
impl<'a> Explainer<'a> {
|
||||
pub fn new(text: &'a str) -> Explainer {
|
||||
Explainer {
|
||||
text: text,
|
||||
text,
|
||||
directive: 0,
|
||||
matches: Vec::new(),
|
||||
vardefs: Vec::new(),
|
||||
|
||||
@@ -55,7 +55,7 @@ pub struct LocatedToken<'a> {
|
||||
/// Wrap up a `Token` with the given location.
|
||||
fn token<'a>(token: Token<'a>, loc: Location) -> Result<LocatedToken<'a>, LocatedError> {
|
||||
Ok(LocatedToken {
|
||||
token: token,
|
||||
token,
|
||||
location: loc,
|
||||
})
|
||||
}
|
||||
@@ -76,7 +76,7 @@ pub struct LocatedError {
|
||||
/// Wrap up an `Error` with the given location.
|
||||
fn error<'a>(error: Error, loc: Location) -> Result<LocatedToken<'a>, LocatedError> {
|
||||
Err(LocatedError {
|
||||
error: error,
|
||||
error,
|
||||
location: loc,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ pub fn parse_test<'a>(text: &'a str) -> Result<TestFile<'a>> {
|
||||
let functions = parser.parse_function_list(isa_spec.unique_isa())?;
|
||||
|
||||
Ok(TestFile {
|
||||
commands: commands,
|
||||
isa_spec: isa_spec,
|
||||
preamble_comments: preamble_comments,
|
||||
functions: functions,
|
||||
commands,
|
||||
isa_spec,
|
||||
preamble_comments,
|
||||
functions,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ impl<'a> Context<'a> {
|
||||
function: f,
|
||||
map: SourceMap::new(),
|
||||
aliases: HashMap::new(),
|
||||
unique_isa: unique_isa,
|
||||
unique_isa,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,11 +272,7 @@ impl<'a> Parser<'a> {
|
||||
Token::Comment(text) => {
|
||||
// Gather comments, associate them with `comment_entity`.
|
||||
if let Some(entity) = self.comment_entity {
|
||||
self.comments
|
||||
.push(Comment {
|
||||
entity: entity,
|
||||
text: text,
|
||||
});
|
||||
self.comments.push(Comment { entity, text });
|
||||
}
|
||||
}
|
||||
_ => self.lookahead = Some(token),
|
||||
@@ -676,7 +672,7 @@ impl<'a> Parser<'a> {
|
||||
ctx.rewrite_references()?;
|
||||
|
||||
let details = Details {
|
||||
location: location,
|
||||
location,
|
||||
comments: self.take_comments(),
|
||||
map: ctx.map,
|
||||
};
|
||||
@@ -924,7 +920,7 @@ impl<'a> Parser<'a> {
|
||||
.def_entity(sigref.into(), &loc)
|
||||
.expect("duplicate SigRef entities created");
|
||||
ExtFuncData {
|
||||
name: name,
|
||||
name,
|
||||
signature: sigref,
|
||||
}
|
||||
}
|
||||
@@ -933,7 +929,7 @@ impl<'a> Parser<'a> {
|
||||
self.consume();
|
||||
let name = self.parse_function_name()?;
|
||||
ExtFuncData {
|
||||
name: name,
|
||||
name,
|
||||
signature: sig,
|
||||
}
|
||||
}
|
||||
@@ -1416,28 +1412,28 @@ impl<'a> Parser<'a> {
|
||||
opcode: Opcode)
|
||||
-> Result<InstructionData> {
|
||||
let idata = match opcode.format() {
|
||||
InstructionFormat::Nullary => InstructionData::Nullary { opcode: opcode },
|
||||
InstructionFormat::Nullary => InstructionData::Nullary { opcode },
|
||||
InstructionFormat::Unary => {
|
||||
InstructionData::Unary {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
arg: self.match_value("expected SSA value operand")?,
|
||||
}
|
||||
}
|
||||
InstructionFormat::UnaryImm => {
|
||||
InstructionData::UnaryImm {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
imm: self.match_imm64("expected immediate integer operand")?,
|
||||
}
|
||||
}
|
||||
InstructionFormat::UnaryIeee32 => {
|
||||
InstructionData::UnaryIeee32 {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
imm: self.match_ieee32("expected immediate 32-bit float operand")?,
|
||||
}
|
||||
}
|
||||
InstructionFormat::UnaryIeee64 => {
|
||||
InstructionData::UnaryIeee64 {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
imm: self.match_ieee64("expected immediate 64-bit float operand")?,
|
||||
}
|
||||
}
|
||||
@@ -1446,7 +1442,7 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_value("expected SSA value second operand")?;
|
||||
InstructionData::Binary {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
@@ -1455,7 +1451,7 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_imm64("expected immediate integer second operand")?;
|
||||
InstructionData::BinaryImm {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
arg: lhs,
|
||||
imm: rhs,
|
||||
}
|
||||
@@ -1469,14 +1465,14 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let false_arg = self.match_value("expected SSA value false operand")?;
|
||||
InstructionData::Ternary {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
args: [ctrl_arg, true_arg, false_arg],
|
||||
}
|
||||
}
|
||||
InstructionFormat::MultiAry => {
|
||||
let args = self.parse_value_list()?;
|
||||
InstructionData::MultiAry {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
@@ -1485,7 +1481,7 @@ impl<'a> Parser<'a> {
|
||||
let ebb_num = self.match_ebb("expected jump destination EBB")?;
|
||||
let args = self.parse_opt_value_list()?;
|
||||
InstructionData::Jump {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
destination: ebb_num,
|
||||
args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
@@ -1496,7 +1492,7 @@ impl<'a> Parser<'a> {
|
||||
let ebb_num = self.match_ebb("expected branch destination EBB")?;
|
||||
let args = self.parse_opt_value_list()?;
|
||||
InstructionData::Branch {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
destination: ebb_num,
|
||||
args: args.into_value_list(&[ctrl_arg], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
@@ -1510,8 +1506,8 @@ impl<'a> Parser<'a> {
|
||||
let ebb_num = self.match_ebb("expected branch destination EBB")?;
|
||||
let args = self.parse_opt_value_list()?;
|
||||
InstructionData::BranchIcmp {
|
||||
opcode: opcode,
|
||||
cond: cond,
|
||||
opcode,
|
||||
cond,
|
||||
destination: ebb_num,
|
||||
args: args.into_value_list(&[lhs, rhs], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
@@ -1523,8 +1519,8 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_value("expected SSA value last operand")?;
|
||||
InstructionData::InsertLane {
|
||||
opcode: opcode,
|
||||
lane: lane,
|
||||
opcode,
|
||||
lane,
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
@@ -1532,11 +1528,7 @@ impl<'a> Parser<'a> {
|
||||
let arg = self.match_value("expected SSA value last operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let lane = self.match_uimm8("expected lane number")?;
|
||||
InstructionData::ExtractLane {
|
||||
opcode: opcode,
|
||||
lane: lane,
|
||||
arg: arg,
|
||||
}
|
||||
InstructionData::ExtractLane { opcode, lane, arg }
|
||||
}
|
||||
InstructionFormat::IntCompare => {
|
||||
let cond = self.match_enum("expected intcc condition code")?;
|
||||
@@ -1544,8 +1536,8 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_value("expected SSA value second operand")?;
|
||||
InstructionData::IntCompare {
|
||||
opcode: opcode,
|
||||
cond: cond,
|
||||
opcode,
|
||||
cond,
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
@@ -1555,8 +1547,8 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_imm64("expected immediate second operand")?;
|
||||
InstructionData::IntCompareImm {
|
||||
opcode: opcode,
|
||||
cond: cond,
|
||||
opcode,
|
||||
cond,
|
||||
arg: lhs,
|
||||
imm: rhs,
|
||||
}
|
||||
@@ -1567,8 +1559,8 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let rhs = self.match_value("expected SSA value second operand")?;
|
||||
InstructionData::FloatCompare {
|
||||
opcode: opcode,
|
||||
cond: cond,
|
||||
opcode,
|
||||
cond,
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
@@ -1579,8 +1571,8 @@ impl<'a> Parser<'a> {
|
||||
let args = self.parse_value_list()?;
|
||||
self.match_token(Token::RPar, "expected ')' after arguments")?;
|
||||
InstructionData::Call {
|
||||
opcode: opcode,
|
||||
func_ref: func_ref,
|
||||
opcode,
|
||||
func_ref,
|
||||
args: args.into_value_list(&[], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
@@ -1593,8 +1585,8 @@ impl<'a> Parser<'a> {
|
||||
let args = self.parse_value_list()?;
|
||||
self.match_token(Token::RPar, "expected ')' after arguments")?;
|
||||
InstructionData::IndirectCall {
|
||||
opcode: opcode,
|
||||
sig_ref: sig_ref,
|
||||
opcode,
|
||||
sig_ref,
|
||||
args: args.into_value_list(&[callee], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
@@ -1603,20 +1595,16 @@ impl<'a> Parser<'a> {
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let table = self.match_jt()
|
||||
.and_then(|num| ctx.get_jt(num, &self.loc))?;
|
||||
InstructionData::BranchTable {
|
||||
opcode: opcode,
|
||||
arg: arg,
|
||||
table: table,
|
||||
}
|
||||
InstructionData::BranchTable { opcode, arg, table }
|
||||
}
|
||||
InstructionFormat::StackLoad => {
|
||||
let ss = self.match_ss("expected stack slot number: ss«n»")
|
||||
.and_then(|num| ctx.get_ss(num, &self.loc))?;
|
||||
let offset = self.optional_offset32()?;
|
||||
InstructionData::StackLoad {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
stack_slot: ss,
|
||||
offset: offset,
|
||||
offset,
|
||||
}
|
||||
}
|
||||
InstructionFormat::StackStore => {
|
||||
@@ -1626,19 +1614,19 @@ impl<'a> Parser<'a> {
|
||||
.and_then(|num| ctx.get_ss(num, &self.loc))?;
|
||||
let offset = self.optional_offset32()?;
|
||||
InstructionData::StackStore {
|
||||
opcode: opcode,
|
||||
arg: arg,
|
||||
opcode,
|
||||
arg,
|
||||
stack_slot: ss,
|
||||
offset: offset,
|
||||
offset,
|
||||
}
|
||||
}
|
||||
InstructionFormat::HeapLoad => {
|
||||
let addr = self.match_value("expected SSA value address")?;
|
||||
let offset = self.optional_uoffset32()?;
|
||||
InstructionData::HeapLoad {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
arg: addr,
|
||||
offset: offset,
|
||||
offset,
|
||||
}
|
||||
}
|
||||
InstructionFormat::HeapStore => {
|
||||
@@ -1647,9 +1635,9 @@ impl<'a> Parser<'a> {
|
||||
let addr = self.match_value("expected SSA value address")?;
|
||||
let offset = self.optional_uoffset32()?;
|
||||
InstructionData::HeapStore {
|
||||
opcode: opcode,
|
||||
opcode,
|
||||
args: [arg, addr],
|
||||
offset: offset,
|
||||
offset,
|
||||
}
|
||||
}
|
||||
InstructionFormat::Load => {
|
||||
@@ -1657,10 +1645,10 @@ impl<'a> Parser<'a> {
|
||||
let addr = self.match_value("expected SSA value address")?;
|
||||
let offset = self.optional_offset32()?;
|
||||
InstructionData::Load {
|
||||
opcode: opcode,
|
||||
flags: flags,
|
||||
opcode,
|
||||
flags,
|
||||
arg: addr,
|
||||
offset: offset,
|
||||
offset,
|
||||
}
|
||||
}
|
||||
InstructionFormat::Store => {
|
||||
@@ -1670,10 +1658,10 @@ impl<'a> Parser<'a> {
|
||||
let addr = self.match_value("expected SSA value address")?;
|
||||
let offset = self.optional_offset32()?;
|
||||
InstructionData::Store {
|
||||
opcode: opcode,
|
||||
flags: flags,
|
||||
opcode,
|
||||
flags,
|
||||
args: [arg, addr],
|
||||
offset: offset,
|
||||
offset,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@ mod cat;
|
||||
mod print_cfg;
|
||||
mod rsfilecheck;
|
||||
|
||||
const USAGE: &'static str = "
|
||||
const USAGE: &str = "
|
||||
Cretonne code generator utility
|
||||
|
||||
Usage:
|
||||
|
||||
@@ -51,8 +51,8 @@ impl ConcurrentRunner {
|
||||
|
||||
ConcurrentRunner {
|
||||
request_tx: Some(request_tx),
|
||||
reply_rx: reply_rx,
|
||||
handles: handles,
|
||||
reply_rx,
|
||||
handles,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,10 +120,7 @@ fn worker_thread(thread_num: usize,
|
||||
// Tell them we're starting this job.
|
||||
// The receiver should always be present for this as long as we have jobs.
|
||||
replies
|
||||
.send(Reply::Starting {
|
||||
jobid: jobid,
|
||||
thread_num: thread_num,
|
||||
})
|
||||
.send(Reply::Starting { jobid, thread_num })
|
||||
.unwrap();
|
||||
|
||||
let result = catch_unwind(|| runone::run(path.as_path())).unwrap_or_else(|e| {
|
||||
@@ -142,12 +139,7 @@ fn worker_thread(thread_num: usize,
|
||||
dbg!("FAIL: {}", msg);
|
||||
}
|
||||
|
||||
replies
|
||||
.send(Reply::Done {
|
||||
jobid: jobid,
|
||||
result: result,
|
||||
})
|
||||
.unwrap();
|
||||
replies.send(Reply::Done { jobid, result }).unwrap();
|
||||
}
|
||||
})
|
||||
.unwrap()
|
||||
|
||||
@@ -81,7 +81,7 @@ impl TestRunner {
|
||||
/// Create a new blank TrstRunner.
|
||||
pub fn new(verbose: bool) -> TestRunner {
|
||||
TestRunner {
|
||||
verbose: verbose,
|
||||
verbose,
|
||||
dir_stack: Vec::new(),
|
||||
tests: Vec::new(),
|
||||
new_tests: 0,
|
||||
|
||||
@@ -55,9 +55,9 @@ pub fn run(path: &Path) -> TestResult {
|
||||
for (func, details) in testfile.functions {
|
||||
let mut context = Context {
|
||||
preamble_comments: &testfile.preamble_comments,
|
||||
details: details,
|
||||
details,
|
||||
verified: false,
|
||||
flags: flags,
|
||||
flags,
|
||||
isa: None,
|
||||
};
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ struct CFGPrinter<'a> {
|
||||
impl<'a> CFGPrinter<'a> {
|
||||
pub fn new(func: &'a Function) -> CFGPrinter<'a> {
|
||||
CFGPrinter {
|
||||
func: func,
|
||||
func,
|
||||
cfg: ControlFlowGraph::with_function(func),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user