Commit 8688f825 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Fixed naming of instructions when inlining

parent d3ad5e10
......@@ -337,12 +337,13 @@ impl fmt::Display for Instruction {
if self.value.is_some() {
write!(
f,
"{} = {}",
"{} = {} [{}]",
vec_utils::as_str(self.value.as_ref().unwrap()),
self.v.debug_str(ops)
self.v.debug_str(ops),
self.hdr
)
} else {
write!(f, "{}", self.v.debug_str(ops))
write!(f, "{} [{}]", self.v.debug_str(ops), self.hdr)
}
}
}
......
......@@ -813,6 +813,15 @@ impl BlockContent {
ret
}
pub fn clone_empty(&self) -> BlockContent {
BlockContent {
args: self.args.clone(),
exn_arg: self.exn_arg.clone(),
body: vec![],
keepalives: self.keepalives.clone(),
}
}
}
/// TreeNode represents a node in the AST, it could either be an instruction,
......
This diff is collapsed.
......@@ -141,9 +141,8 @@ def fncptr_from_py_script(py_fnc, heapinit_fnc, name, argtypes=[], restype=ctype
# load libmu before rffi so to load it with RTLD_GLOBAL
libmu = preload_libmu()
loglvl = os.environ.get('MU_LOG_LEVEL', 'env')
emit_dir = kwargs.get('muemitdir', os.environ.get('MU_EMIT_DIR', 'emit'))
mu = rmu.MuVM("--log-level=%(loglvl)s --aot-emit-dir=%(emit_dir)s" % locals())
mu = rmu.MuVM("--aot-emit-dir=%(emit_dir)s" % locals())
ctx = mu.new_context()
bldr = ctx.new_ir_builder()
......
......@@ -123,3 +123,24 @@ def test_stack_pass_and_return():
}
""", "test_stack_pass_and_return");
assert(execute("test_stack_pass_and_return") == 44);
def test_double_inline():
lib = load_bundle(
"""
.funcsig new_sig = ()->(ref<void>)
.funcdef new_void <new_sig>
{
entry():
//res = NEW <ref<void>>
res = CCALL #DEFAULT <ufuncptr<new_sig> new_sig> <ufuncptr<new_sig>>EXTERN "malloc"()
RET res
}
.funcdef double_inline <()->(ref<void> ref<void>)>
{
entry():
a = CALL <()->(ref<void>)> new_void()
b = CALL <()->(ref<void>)> new_void()
RET (a b)
}
""", "test_double_inline");
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment