diff options
author | Damien George <damien.p.george@gmail.com> | 2014-02-01 23:04:09 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-02-01 23:04:09 +0000 |
commit | 9aa2a527b532e31c77592cede3b38c018c83ac64 (patch) | |
tree | ea2c5431a7b645f4aba7d573086ada1109cbcdd1 /py/runtime0.h | |
parent | 7e5fb24e3bdd8a07e2c7f317ad44b62e85082547 (diff) | |
download | micropython-9aa2a527b532e31c77592cede3b38c018c83ac64.tar.gz micropython-9aa2a527b532e31c77592cede3b38c018c83ac64.zip |
py: Tidy up BINARY_OPs; negation done by special NOT bytecode.
IS_NOT and NOT_IN are now compiled to IS + NOT and IN + NOT, with a new
special NOT bytecode.
Diffstat (limited to 'py/runtime0.h')
-rw-r--r-- | py/runtime0.h | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/py/runtime0.h b/py/runtime0.h index a0f553a896..9edf7ec0e7 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -4,7 +4,7 @@ typedef enum { RT_UNARY_OP_POSITIVE, RT_UNARY_OP_NEGATIVE, RT_UNARY_OP_INVERT, - // Used only for CPython-compatible codegeneration + // these are not supported by the runtime and must be synthesised by the emitter RT_UNARY_OP_NOT, } rt_unary_op_t; @@ -34,18 +34,19 @@ typedef enum { RT_BINARY_OP_INPLACE_TRUE_DIVIDE, RT_BINARY_OP_INPLACE_MODULO, RT_BINARY_OP_INPLACE_POWER, - // TODO probably should rename these COMPARE->BINARY - RT_COMPARE_OP_LESS, - RT_COMPARE_OP_MORE, - RT_COMPARE_OP_EQUAL, - RT_COMPARE_OP_LESS_EQUAL, - RT_COMPARE_OP_MORE_EQUAL, - RT_COMPARE_OP_NOT_EQUAL, - RT_COMPARE_OP_IN, - RT_COMPARE_OP_NOT_IN, - RT_COMPARE_OP_IS, - RT_COMPARE_OP_IS_NOT, - RT_COMPARE_OP_EXCEPTION_MATCH, + // these should return a bool + RT_BINARY_OP_LESS, + RT_BINARY_OP_MORE, + RT_BINARY_OP_EQUAL, + RT_BINARY_OP_LESS_EQUAL, + RT_BINARY_OP_MORE_EQUAL, + RT_BINARY_OP_NOT_EQUAL, + RT_BINARY_OP_IN, + RT_BINARY_OP_IS, + RT_BINARY_OP_EXCEPTION_MATCH, + // these are not supported by the runtime and must be synthesised by the emitter + RT_BINARY_OP_NOT_IN, + RT_BINARY_OP_IS_NOT, } rt_binary_op_t; typedef enum { |