diff options
author | Damien <damien.p.george@gmail.com> | 2013-10-06 00:14:13 +0100 |
---|---|---|
committer | Damien <damien.p.george@gmail.com> | 2013-10-06 00:14:13 +0100 |
commit | a2f2f7db1f42f9229df9d4f353689f24685e5dc4 (patch) | |
tree | 3ffdfd417d142c5379942269701f510cb153b3b4 /py/compile.c | |
parent | 5fa5ae40beb9d07f6715d8902e102a507ec37b75 (diff) |
Almost supports arguments for inline asm functions.
Diffstat (limited to 'py/compile.c')
-rw-r--r-- | py/compile.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/py/compile.c b/py/compile.c index 6a3a66946..8adfcd2a0 100644 --- a/py/compile.c +++ b/py/compile.c @@ -2507,25 +2507,30 @@ void compile_scope_inline_asm(compiler_t *comp, scope_t *scope, pass_kind_t pass return; } + if (comp->pass > PASS_1) { + EMIT_INLINE_ASM(start_pass, comp->pass, comp->scope_cur); + } + // get the function definition parse node assert(PY_PARSE_NODE_IS_STRUCT(scope->pn)); py_parse_node_struct_t *pns = (py_parse_node_struct_t*)scope->pn; assert(PY_PARSE_NODE_STRUCT_KIND(pns) == PN_funcdef); - //qstr f_id = PY_PARSE_NODE_LEAF_ARG(pns->nodes[0]); // name + //qstr f_id = PY_PARSE_NODE_LEAF_ARG(pns->nodes[0]); // function name + + // parameters are in pns->nodes[1] + if (comp->pass == PASS_2) { + py_parse_node_t *pn_params; + int n_params = list_get(&pns->nodes[1], PN_typedargslist, &pn_params); + scope->num_params = EMIT_INLINE_ASM(count_params, n_params, pn_params); + } - scope->num_params = 0; - assert(PY_PARSE_NODE_IS_NULL(pns->nodes[1])); // arguments assert(PY_PARSE_NODE_IS_NULL(pns->nodes[2])); // type py_parse_node_t pn_body = pns->nodes[3]; // body py_parse_node_t *nodes; int num = list_get(&pn_body, PN_suite_block_stmts, &nodes); - if (comp->pass > PASS_1) { - EMIT_INLINE_ASM(start_pass, comp->pass, comp->scope_cur); - } - if (comp->pass == PASS_3) { //printf("----\n"); scope_print_info(scope); |