diff options
author | David Robillard <d@drobilla.net> | 2011-05-14 02:20:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-05-14 02:20:53 +0000 |
commit | a0367d144bb30ac0eb422b05a962b694602fc601 (patch) | |
tree | e4263176eb7955c684d3d9ac438c4acf5a139159 /src/compile.cpp | |
parent | 76228727db6a807452338d098afc4dc85806eb50 (diff) | |
download | resp-a0367d144bb30ac0eb422b05a962b694602fc601.tar.gz resp-a0367d144bb30ac0eb422b05a962b694602fc601.tar.bz2 resp-a0367d144bb30ac0eb422b05a962b694602fc601.zip |
More granular if compilation API (towards assembly-like IR stage and simpler backends)
git-svn-id: http://svn.drobilla.net/resp/trunk@412 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src/compile.cpp')
-rw-r--r-- | src/compile.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/compile.cpp b/src/compile.cpp index 44017ec..ba8cc5e 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -167,11 +167,18 @@ compile_fn(CEnv& cenv, const ATuple* fn) throw() static CVal compile_if(CEnv& cenv, const ATuple* aif) throw() { + const AST* cond = aif->list_ref(1); + const AST* then = aif->list_ref(2); const AST* aelse = NULL; if (*aif->list_last() != *cenv.penv.sym("__unreachable")) aelse = aif->list_ref(3); - return cenv.engine()->compileIf(cenv, aif->list_ref(1), aif->list_ref(2), aelse); + const AST* type = cenv.type(then); + + cenv.engine()->compileIfStart(cenv, cond, type); + cenv.engine()->compileIfThen(cenv, resp_compile(cenv, then)); + cenv.engine()->compileIfElse(cenv, resp_compile(cenv, aelse)); + return cenv.engine()->compileIfEnd(cenv); } static CVal @@ -214,6 +221,9 @@ compile_call(CEnv& cenv, const ATuple* call) throw() CVal resp_compile(CEnv& cenv, const AST* ast) throw() { + if (!ast) + return NULL; + switch (ast->tag()) { case T_UNKNOWN: return NULL; |