Update skeleton

This commit is contained in:
Jeehoon Kang
2020-06-21 21:38:51 +09:00
parent f4611c6eef
commit 98505a6179
3 changed files with 16 additions and 11 deletions

View File

@@ -208,7 +208,7 @@ impl WriteString for RType {
Self::Sub(data_size) => format!("sub{}", data_size.write_string()),
Self::Sll(data_size) => format!("sll{}", data_size.write_string()),
Self::Srl(data_size) => format!("srl{}", data_size.write_string()),
Self::Sra(data_size) => format!("sra{}", data_size.write_string()),
Self::Sra(data_size) => format!("srl{}", data_size.write_string()),
Self::Mul(data_size) => format!("mul{}", data_size.write_string()),
Self::Div {
data_size,

View File

@@ -131,7 +131,7 @@ impl HasDtype for Declaration {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct FunctionSignature {
pub ret: Dtype,
pub params: Vec<Dtype>,
@@ -155,7 +155,7 @@ impl HasDtype for FunctionSignature {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct FunctionDefinition {
/// Memory allocations for local variables. The allocation is performed at the beginning of a
/// function invocation.
@@ -168,7 +168,7 @@ pub struct FunctionDefinition {
pub bid_init: BlockId,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy)]
pub struct BlockId(pub usize);
impl fmt::Display for BlockId {
@@ -177,14 +177,14 @@ impl fmt::Display for BlockId {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct Block {
pub phinodes: Vec<Named<Dtype>>,
pub instructions: Vec<Named<Instruction>>,
pub exit: BlockExit,
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
#[allow(clippy::large_enum_variant)]
pub enum Instruction {
Nop,
@@ -255,7 +255,7 @@ impl Instruction {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub enum BlockExit {
Jump {
arg: JumpArg,
@@ -300,7 +300,7 @@ impl BlockExit {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, PartialEq, Clone)]
pub struct JumpArg {
pub bid: BlockId,
pub args: Vec<Operand>,
@@ -327,7 +327,7 @@ impl fmt::Display for JumpArg {
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, PartialEq, Clone)]
pub enum Operand {
Constant(Constant),
Register { rid: RegisterId, dtype: Dtype },
@@ -849,7 +849,7 @@ impl HasDtype for Constant {
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
pub struct Named<T> {
name: Option<String>,
inner: T,

View File

@@ -216,7 +216,12 @@ pub fn test_opt<P1: AsRef<Path>, P2: AsRef<Path>, O: Optimize<ir::TranslationUni
pub fn test_asmgen(path: &Path) {
// TODO: delete ignore list in the future
let ignore_list = vec!["examples/asmgen/struct3.ir"];
let ignore_list = vec![
"examples/asmgen/struct.ir",
"examples/asmgen/struct2.ir",
"examples/asmgen/struct3.ir",
"examples/asmgen/temp2.ir",
];
if ignore_list.contains(&path.to_str().expect("`path` must be transformed to `&str`")) {
println!("skip test");
return;