Update skeleton

This commit is contained in:
Chunmyong Park
2020-06-12 14:44:49 +00:00
parent 45de57cef7
commit e8a69a3276
3 changed files with 7 additions and 4 deletions

4
Jenkinsfile vendored
View File

@@ -40,8 +40,8 @@ pipeline {
// can cause `stack-overflow` error when testing stack-intensive code.
// For this reason, we need to increase the default size of stack to `8 MiB`.
// TODO: delete `--skip test_examples_asmgen`
sh "RUST_MIN_STACK=8388608 cargo test -- --skip test_examples_asmgen --skip test_examples_end_to_end"
sh "RUST_MIN_STACK=8388608 cargo test --release -- --skip test_examples_asmgen --skip test_examples_end_to_end"
sh "RUST_MIN_STACK=8388608 cargo test -- --skip test_examples_asmgen"
sh "RUST_MIN_STACK=8388608 cargo test --release -- --skip test_examples_asmgen"
}
}
}

View File

@@ -79,6 +79,8 @@ impl Block {
/// https://github.com/rv8-io/rv8-io.github.io/blob/master/asm.md#assembler-directives
#[derive(Debug, Clone, PartialEq)]
pub enum Directive {
/// .align integer
Align(usize),
/// .globl symbol
Globl(Label),
/// .section section_type

View File

@@ -77,6 +77,7 @@ impl WriteLine for Block {
impl WriteString for Directive {
fn write_string(&self) -> String {
match self {
Self::Align(value) => format!(".align\t{}", value),
Self::Globl(label) => format!(".globl\t{}", label.0),
Self::Type(symbol, symbol_type) => {
format!(".type\t{}, {}", symbol.0, symbol_type.write_string())
@@ -381,7 +382,7 @@ impl WriteString for UType {
impl WriteString for Pseudo {
fn write_string(&self) -> String {
match self {
Self::Li { rd, imm } => format!("li\t{},{:#x?}", rd.write_string(), imm),
Self::Li { rd, imm } => format!("li\t{},{}", rd.write_string(), *imm as i64),
Self::Mv { rd, rs } => format!("mv\t{},{}", rd.write_string(), rs.write_string()),
Self::Neg { data_size, rd, rs } => format!(
"neg{}\t{},{}",
@@ -412,7 +413,7 @@ impl WriteString for Pseudo {
impl WriteString for Immediate {
fn write_string(&self) -> String {
match self {
Self::Value(value) => format!("{:#x?}", value),
Self::Value(value) => format!("{}", *value as i64),
Self::Relocation { relocation, symbol } => {
format!("{}({})", relocation.write_string(), symbol.0)
}