[meta] Add cdsl facilities for encodings and recipes;

Co-authored-by: Benjamin Bouvier <public@benj.me>
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
This commit is contained in:
Benjamin Bouvier
2019-06-24 16:48:31 +02:00
parent 4a6b88193e
commit 21aaf0c89f
13 changed files with 608 additions and 28 deletions

View File

@@ -1,18 +1,21 @@
use std::collections::HashSet;
use std::iter::FromIterator;
use crate::cdsl::cpu_modes::CpuMode;
use crate::cdsl::instructions::InstructionGroup;
use crate::cdsl::instructions::{InstructionGroup, InstructionPredicateMap};
use crate::cdsl::recipes::Recipes;
use crate::cdsl::regs::IsaRegs;
use crate::cdsl::settings::SettingGroup;
use crate::cdsl::xform::{TransformGroupIndex, TransformGroups};
use std::collections::HashSet;
use std::iter::FromIterator;
pub struct TargetIsa {
pub name: &'static str,
pub instructions: InstructionGroup,
pub settings: SettingGroup,
pub regs: IsaRegs,
pub recipes: Recipes,
pub cpu_modes: Vec<CpuMode>,
pub encodings_predicates: InstructionPredicateMap,
/// TransformGroupIndex are global to all the ISAs, while we want to have indices into the
/// local array of transform groups that are directly used. We use this map to get this
@@ -26,7 +29,9 @@ impl TargetIsa {
instructions: InstructionGroup,
settings: SettingGroup,
regs: IsaRegs,
recipes: Recipes,
cpu_modes: Vec<CpuMode>,
encodings_predicates: InstructionPredicateMap,
) -> Self {
// Compute the local TransformGroup index.
let mut local_transform_groups = Vec::new();
@@ -49,7 +54,9 @@ impl TargetIsa {
instructions,
settings,
regs,
recipes,
cpu_modes,
encodings_predicates,
local_transform_groups,
}
}