Fix a dead code warning from the new Rust compiler.

On ISAs with no instruction predicates, just emit an unimplemented!()
stub for the check_instp() function. It is unlikely that a finished ISA
will not have any instruction predicates.
This commit is contained in:
Jakob Stoklund Olesen
2017-02-03 11:25:27 -08:00
parent dab96d8ea2
commit 933dfc70c1
5 changed files with 10 additions and 6 deletions

View File

@@ -75,7 +75,7 @@ def emit_instp(instp, fmt):
""" """
iform = instp.predicate_context() iform = instp.predicate_context()
# Which fiels do we need in the InstructionData pattern match? # Which fields do we need in the InstructionData pattern match?
if iform.boxed_storage: if iform.boxed_storage:
fields = 'ref data' fields = 'ref data'
else: else:
@@ -99,10 +99,18 @@ def emit_instps(instps, fmt):
""" """
if not instps: if not instps:
fmt.line('#[allow(unused_variables)]') # If the ISA has no predicates, just emit a stub.
with fmt.indented(
'pub fn check_instp(_: &InstructionData, _: u16) ' +
'-> bool {', '}'):
fmt.line('unimplemented!()')
return
with fmt.indented( with fmt.indented(
'pub fn check_instp(inst: &InstructionData, instp_idx: u16) ' + 'pub fn check_instp(inst: &InstructionData, instp_idx: u16) ' +
'-> bool {', '}'): '-> bool {', '}'):
# The matches emitted by `emit_instp` need this.
fmt.line('use ir::instructions::InstructionFormat;')
with fmt.indented('match instp_idx {', '}'): with fmt.indented('match instp_idx {', '}'):
for instp in instps: for instp in instps:
emit_instp(instp, fmt) emit_instp(instp, fmt)

View File

@@ -1,7 +1,6 @@
//! Encoding tables for ARM32 ISA. //! Encoding tables for ARM32 ISA.
use ir::InstructionData; use ir::InstructionData;
use ir::instructions::InstructionFormat;
use ir::types; use ir::types;
use isa::enc_tables::{Level1Entry, Level2Entry}; use isa::enc_tables::{Level1Entry, Level2Entry};
use isa::constraints::*; use isa::constraints::*;

View File

@@ -1,7 +1,6 @@
//! Encoding tables for ARM64 ISA. //! Encoding tables for ARM64 ISA.
use ir::InstructionData; use ir::InstructionData;
use ir::instructions::InstructionFormat;
use ir::types; use ir::types;
use isa::enc_tables::{Level1Entry, Level2Entry}; use isa::enc_tables::{Level1Entry, Level2Entry};
use isa::constraints::*; use isa::constraints::*;

View File

@@ -1,7 +1,6 @@
//! Encoding tables for Intel ISAs. //! Encoding tables for Intel ISAs.
use ir::InstructionData; use ir::InstructionData;
use ir::instructions::InstructionFormat;
use ir::types; use ir::types;
use isa::enc_tables::{Level1Entry, Level2Entry}; use isa::enc_tables::{Level1Entry, Level2Entry};
use isa::constraints::*; use isa::constraints::*;

View File

@@ -1,7 +1,6 @@
//! Encoding tables for RISC-V. //! Encoding tables for RISC-V.
use ir::{Opcode, InstructionData}; use ir::{Opcode, InstructionData};
use ir::instructions::InstructionFormat;
use ir::types; use ir::types;
use predicates; use predicates;
use isa::enc_tables::{Level1Entry, Level2Entry}; use isa::enc_tables::{Level1Entry, Level2Entry};