Compile a simple function (#2)
* Implement basics. * Execute code * Add wasm2wat test cases. * abi_loc_for_arg for stack. * Assert that sp_depth is 0 at the epilogue * Do 32bit add. * Assert that RAX can be used as a scratch register * Reuse assembler. * Align stack slots.
This commit is contained in:
committed by
Dan Gohman
parent
d3bc26bc93
commit
08240761d5
@@ -7,6 +7,7 @@ use wasmparser::{
|
||||
GlobalSectionReader, GlobalType, Import, ImportSectionEntryType, ImportSectionReader,
|
||||
MemorySectionReader, MemoryType, Operator, TableSectionReader, Type, TypeSectionReader,
|
||||
};
|
||||
use backend::{CodeGenSession, TranslatedCodeSection};
|
||||
|
||||
/// Parses the Type section of the wasm module.
|
||||
pub fn type_(types: TypeSectionReader) -> Result<(), Error> {
|
||||
@@ -79,11 +80,12 @@ pub fn element(elements: ElementSectionReader) -> Result<(), Error> {
|
||||
}
|
||||
|
||||
/// Parses the Code section of the wasm module.
|
||||
pub fn code(code: CodeSectionReader) -> Result<(), Error> {
|
||||
pub fn code(code: CodeSectionReader) -> Result<TranslatedCodeSection, Error> {
|
||||
let mut session = CodeGenSession::new();
|
||||
for body in code {
|
||||
function_body::translate(&body?)?;
|
||||
function_body::translate(&mut session, &body?)?;
|
||||
}
|
||||
Ok(())
|
||||
Ok(session.into_translated_code_section()?)
|
||||
}
|
||||
|
||||
/// Parses the Data section of the wasm module.
|
||||
|
||||
Reference in New Issue
Block a user