aboutsummaryrefslogtreecommitdiffstats
path: root/src/llvm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/llvm.cpp')
-rw-r--r--src/llvm.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/llvm.cpp b/src/llvm.cpp
index c798d24..d6d29ce 100644
--- a/src/llvm.cpp
+++ b/src/llvm.cpp
@@ -39,8 +39,8 @@ using namespace llvm;
using namespace std;
using boost::format;
-static inline Value* llVal(CValue v) { return static_cast<Value*>(v); }
-static inline Function* llFunc(CFunction f) { return static_cast<Function*>(f); }
+static inline Value* llVal(CVal v) { return static_cast<Value*>(v); }
+static inline Function* llFunc(CFunc f) { return static_cast<Function*>(f); }
static const Type*
llType(const AType* t)
@@ -100,7 +100,7 @@ struct LLVMEngine : public Engine {
"tuplr_gc_allocate", module);
}
- CFunction startFunction(CEnv& cenv,
+ CFunc startFunction(CEnv& cenv,
const std::string& name, const AType* retT, const ATuple& argsT,
const vector<string> argNames)
{
@@ -133,7 +133,7 @@ struct LLVMEngine : public Engine {
return f;
}
- void finishFunction(CEnv& cenv, CFunction f, const AType* retT, CValue ret) {
+ void finishFunction(CEnv& cenv, CFunc f, const AType* retT, CVal ret) {
if (retT->concrete())
builder.CreateRet(llVal(ret));
else
@@ -144,28 +144,28 @@ struct LLVMEngine : public Engine {
opt.run(*static_cast<Function*>(f));
}
- void eraseFunction(CEnv& cenv, CFunction f) {
+ void eraseFunction(CEnv& cenv, CFunc f) {
if (f)
llFunc(f)->eraseFromParent();
}
- CValue compileCall(CEnv& cenv, CFunction f, const vector<CValue>& args) {
+ CVal compileCall(CEnv& cenv, CFunc f, const vector<CVal>& args) {
const vector<Value*>& llArgs = *reinterpret_cast<const vector<Value*>*>(&args);
return builder.CreateCall(llFunc(f), llArgs.begin(), llArgs.end());
}
- CFunction compileFunction(CEnv& cenv, AFn* fn, const AType& argsT);
+ CFunc compileFunction(CEnv& cenv, AFn* fn, const AType& argsT);
- CValue compileLiteral(CEnv& cenv, AST* lit);
- CValue compilePrimitive(CEnv& cenv, APrimitive* prim);
- CValue compileIf(CEnv& cenv, AIf* aif);
+ CVal compileLiteral(CEnv& cenv, AST* lit);
+ CVal compilePrimitive(CEnv& cenv, APrimitive* prim);
+ CVal compileIf(CEnv& cenv, AIf* aif);
void writeModule(CEnv& cenv, std::ostream& os) {
AssemblyAnnotationWriter writer;
module->print(os, &writer);
}
- const string call(CEnv& cenv, CFunction f, AType* retT) {
+ const string call(CEnv& cenv, CFunc f, AType* retT) {
void* fp = engine->getPointerToFunction(llFunc(f));
const Type* t = llType(retT);
THROW_IF(!fp, Cursor(), "unable to get function pointer");
@@ -201,7 +201,7 @@ tuplr_new_llvm_engine()
* Code Generation *
***************************************************************************/
-CValue
+CVal
LLVMEngine::compileLiteral(CEnv& cenv, AST* lit)
{
ALiteral<int32_t>* ilit = dynamic_cast<ALiteral<int32_t>*>(lit);
@@ -219,7 +219,7 @@ LLVMEngine::compileLiteral(CEnv& cenv, AST* lit)
throw Error(lit->loc, "Unknown literal type");
}
-CFunction
+CFunc
LLVMEngine::compileFunction(CEnv& cenv, AFn* fn, const AType& argsT)
{
TEnv::GenericTypes::const_iterator gt = cenv.tenv.genericTypes.find(fn);
@@ -317,7 +317,7 @@ LLVMEngine::compileFunction(CEnv& cenv, AFn* fn, const AType& argsT)
// Define value first for recursion
cenv.precompile(fn, f);
fn->impls.push_back(make_pair(thisType, f));
- CValue retVal = NULL;
+ CVal retVal = NULL;
for (size_t i = 2; i < fn->size(); ++i)
retVal = cenv.compile(fn->at(i));
cenv.engine()->finishFunction(cenv, f, cenv.type(fn->at(fn->size() - 1)), retVal);
@@ -331,7 +331,7 @@ LLVMEngine::compileFunction(CEnv& cenv, AFn* fn, const AType& argsT)
return f;
}
-CValue
+CVal
LLVMEngine::compileIf(CEnv& cenv, AIf* aif)
{
typedef vector< pair<Value*, BasicBlock*> > Branches;
@@ -376,7 +376,7 @@ LLVMEngine::compileIf(CEnv& cenv, AIf* aif)
return pn;
}
-CValue
+CVal
LLVMEngine::compilePrimitive(CEnv& cenv, APrimitive* prim)
{
LLVMEngine* engine = reinterpret_cast<LLVMEngine*>(cenv.engine());