Rename 'encoding' modules to 'enc_tables'.

These modules contain encoding tables, not the 'Encoding' struct.
This commit is contained in:
Jakob Stoklund Olesen
2016-09-19 13:00:16 -07:00
parent 622006ecc5
commit ce6a463267
4 changed files with 13 additions and 14 deletions

View File

@@ -41,7 +41,7 @@
//! concurrent function compilations.
pub mod riscv;
mod encoding;
mod enc_tables;
use settings;
use ir::{InstructionData, DataFlowGraph};

View File

@@ -4,7 +4,7 @@ use ir::{Opcode, InstructionData};
use ir::instructions::InstructionFormat;
use ir::types;
use predicates;
use isa::encoding::{Level1Entry, Level2Entry};
use isa::enc_tables::{Level1Entry, Level2Entry};
// Include the generated encoding tables:
// - `LEVEL1_RV32`

View File

@@ -1,19 +1,19 @@
//! RISC-V Instruction Set Architecture.
pub mod settings;
mod encoding;
mod enc_tables;
use super::super::settings as shared_settings;
use isa::encoding as shared_encoding;
use super::Builder as IsaBuilder;
use super::{TargetIsa, Encoding};
use isa::enc_tables::{self as shared_enc_tables, lookup_enclist, general_encoding};
use isa::Builder as IsaBuilder;
use isa::{TargetIsa, Encoding};
use ir::{InstructionData, DataFlowGraph};
#[allow(dead_code)]
struct Isa {
shared_flags: shared_settings::Flags,
isa_flags: settings::Flags,
cpumode: &'static [shared_encoding::Level1Entry<u16>],
cpumode: &'static [shared_enc_tables::Level1Entry<u16>],
}
pub fn isa_builder() -> IsaBuilder {
@@ -27,9 +27,9 @@ fn isa_constructor(shared_flags: shared_settings::Flags,
builder: shared_settings::Builder)
-> Box<TargetIsa> {
let level1 = if shared_flags.is_64bit() {
&encoding::LEVEL1_RV64[..]
&enc_tables::LEVEL1_RV64[..]
} else {
&encoding::LEVEL1_RV32[..]
&enc_tables::LEVEL1_RV32[..]
};
Box::new(Isa {
isa_flags: settings::Flags::new(&shared_flags, builder),
@@ -40,21 +40,20 @@ fn isa_constructor(shared_flags: shared_settings::Flags,
impl TargetIsa for Isa {
fn encode(&self, _: &DataFlowGraph, inst: &InstructionData) -> Option<Encoding> {
use isa::encoding::{lookup_enclist, general_encoding};
lookup_enclist(inst.first_type(),
inst.opcode(),
self.cpumode,
&encoding::LEVEL2[..])
&enc_tables::LEVEL2[..])
.and_then(|enclist_offset| {
general_encoding(enclist_offset,
&encoding::ENCLISTS[..],
|instp| encoding::check_instp(inst, instp),
&enc_tables::ENCLISTS[..],
|instp| enc_tables::check_instp(inst, instp),
|isap| self.isa_flags.numbered_predicate(isap as usize))
})
}
fn recipe_names(&self) -> &'static [&'static str] {
&encoding::RECIPE_NAMES[..]
&enc_tables::RECIPE_NAMES[..]
}
}