Proptest testing!
This commit is contained in:
@@ -11,8 +11,8 @@ use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext, Variable};
|
||||
use cranelift_module::{FuncId, Linkage, Module, ModuleError};
|
||||
use internment::ArcIntern;
|
||||
|
||||
use crate::backend::Backend;
|
||||
use crate::backend::error::BackendError;
|
||||
use crate::backend::Backend;
|
||||
|
||||
type StringTable = HashMap<ArcIntern<String>, GlobalValue>;
|
||||
|
||||
@@ -21,15 +21,16 @@ impl<M: Module> Backend<M> {
|
||||
&mut self,
|
||||
function_name: &str,
|
||||
mut program: Program,
|
||||
) -> Result<FuncId, BackendError>
|
||||
{
|
||||
) -> Result<FuncId, BackendError> {
|
||||
let basic_signature = Signature {
|
||||
params: vec![],
|
||||
returns: vec![],
|
||||
call_conv: CallConv::SystemV,
|
||||
};
|
||||
|
||||
let func_id = self.module.declare_function(function_name, Linkage::Export, &basic_signature)?;
|
||||
let func_id =
|
||||
self.module
|
||||
.declare_function(function_name, Linkage::Export, &basic_signature)?;
|
||||
let mut ctx = Context::new();
|
||||
ctx.func =
|
||||
Function::with_name_signature(UserFuncName::user(0, func_id.as_u32()), basic_signature);
|
||||
@@ -37,7 +38,11 @@ impl<M: Module> Backend<M> {
|
||||
let string_table = self.build_string_table(&mut ctx.func, &program)?;
|
||||
let mut variable_table = HashMap::new();
|
||||
let mut next_var_num = 1;
|
||||
let print_func_ref = self.runtime_functions.include_runtime_function("print", &mut self.module, &mut ctx.func)?;
|
||||
let print_func_ref = self.runtime_functions.include_runtime_function(
|
||||
"print",
|
||||
&mut self.module,
|
||||
&mut ctx.func,
|
||||
)?;
|
||||
let pre_defined_symbols: HashMap<String, GlobalValue> = self
|
||||
.defined_symbols
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user