diff options
author | David Robillard <d@drobilla.net> | 2010-12-09 01:11:41 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-12-09 01:11:41 +0000 |
commit | 152c910f89e078099a5aba6d7d6f7fa28ceea2c3 (patch) | |
tree | 380b2ad500a05a48e8e378c280941d2f3497983b /src | |
parent | e78acdecac3611299db12705c36bbc882efd42fe (diff) | |
download | resp-152c910f89e078099a5aba6d7d6f7fa28ceea2c3.tar.gz resp-152c910f89e078099a5aba6d7d6f7fa28ceea2c3.tar.bz2 resp-152c910f89e078099a5aba6d7d6f7fa28ceea2c3.zip |
Consistent engine global[Set|Get] interface.
git-svn-id: http://svn.drobilla.net/resp/resp@321 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'src')
-rw-r--r-- | src/c.cpp | 6 | ||||
-rw-r--r-- | src/compile.cpp | 4 | ||||
-rw-r--r-- | src/llvm.cpp | 6 | ||||
-rw-r--r-- | src/resp.hpp | 4 |
4 files changed, 10 insertions, 10 deletions
@@ -45,8 +45,8 @@ struct CEngine : public Engine { CVal compileCall(CEnv& cenv, CFunc f, const AType* funcT, const vector<CVal>& args); CVal compileCons(CEnv& cenv, const AType* type, CVal rtti, const vector<CVal>& fields); CVal compileDot(CEnv& cenv, CVal tup, int32_t index); - CVal compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val); - CVal compileGlobalGet(CEnv& cenv, const string& sym, CVal val); + CVal compileGlobalSet(CEnv& cenv, const string& s, CVal v, const AType* t); + CVal compileGlobalGet(CEnv& cenv, const string& s, CVal v); IfState compileIfStart(CEnv& cenv); void compileIfBranch(CEnv& cenv, IfState state, CVal condV, const AST* then); CVal compileIfEnd(CEnv& cenv, IfState state, CVal elseV, const AType* type); @@ -312,7 +312,7 @@ CEngine::compilePrimitive(CEnv& cenv, const ATuple* prim) } CVal -CEngine::compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val) +CEngine::compileGlobalSet(CEnv& cenv, const string& sym, CVal val, const AType* type) { return NULL; } diff --git a/src/compile.cpp b/src/compile.cpp index 6a6eb06..8cde2e8 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -101,8 +101,8 @@ compile_def(CEnv& cenv, const ATuple* def) throw() cenv.def(sym, body, cenv.type(body), NULL); // define stub first for recursion CVal val = resp_compile(cenv, body); if (cenv.vals.size() == 1 && cenv.type(body)->head()->str() != "Fn") { - val = cenv.engine()->compileGlobal( - cenv, cenv.type(body), sym->str(), val); + val = cenv.engine()->compileGlobalSet( + cenv, sym->str(), val, cenv.type(body)); cenv.lock(def); } cenv.vals.def(sym, val); diff --git a/src/llvm.cpp b/src/llvm.cpp index 81d2fe8..be57e25 100644 --- a/src/llvm.cpp +++ b/src/llvm.cpp @@ -59,8 +59,8 @@ struct LLVMEngine : public Engine { CVal compileCall(CEnv& cenv, CFunc f, const AType* funcT, const vector<CVal>& args); CVal compileCons(CEnv& cenv, const AType* type, CVal rtti, const vector<CVal>& fields); CVal compileDot(CEnv& cenv, CVal tup, int32_t index); - CVal compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val); - CVal compileGlobalGet(CEnv& cenv, const string& sym, CVal val); + CVal compileGlobalSet(CEnv& cenv, const string& s, CVal v, const AType* t); + CVal compileGlobalGet(CEnv& cenv, const string& s, CVal v); IfState compileIfStart(CEnv& cenv); void compileIfBranch(CEnv& cenv, IfState state, CVal condV, const AST* then); CVal compileIfEnd(CEnv& cenv, IfState state, CVal elseV, const AType* type); @@ -439,7 +439,7 @@ LLVMEngine::compilePrimitive(CEnv& cenv, const ATuple* prim) } CVal -LLVMEngine::compileGlobal(CEnv& cenv, const AType* type, const string& sym, CVal val) +LLVMEngine::compileGlobalSet(CEnv& cenv, const string& sym, CVal val, const AType* type) { LLVMEngine* engine = reinterpret_cast<LLVMEngine*>(cenv.engine()); GlobalVariable* global = new GlobalVariable(*module, llType(type), false, diff --git a/src/resp.hpp b/src/resp.hpp index 5f0899c..1d889e8 100644 --- a/src/resp.hpp +++ b/src/resp.hpp @@ -718,8 +718,8 @@ struct Engine { virtual CVal compileCall(CEnv& cenv, CFunc f, const AType* fT, ValVec& args) = 0; virtual CVal compileCons(CEnv& cenv, const AType* t, CVal rtti, ValVec& f) = 0; virtual CVal compileDot(CEnv& cenv, CVal tup, int32_t index) = 0; - virtual CVal compileGlobal(CEnv& cenv, const AType* t, const string& sym, CVal val) = 0; - virtual CVal compileGlobalGet(CEnv& cenv, const string& sym, CVal val) = 0; + virtual CVal compileGlobalSet(CEnv& cenv, const string& s, CVal v, const AType* t) = 0; + virtual CVal compileGlobalGet(CEnv& cenv, const string& s, CVal v) = 0; virtual IfState compileIfStart(CEnv& cenv) = 0; virtual void compileIfBranch(CEnv& cenv, IfState state, CVal condV, const AST* then) = 0; virtual CVal compileIfEnd(CEnv& cenv, IfState state, CVal elseV, const AType* type) = 0; |