aboutsummaryrefslogtreecommitdiffstats
path: root/llvm.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-06-18 03:55:17 +0000
committerDavid Robillard <d@drobilla.net>2009-06-18 03:55:17 +0000
commit4e34e229beb12164ea49b1121785dc71eb7c3566 (patch)
tree3951bb94748289698cba24cc220be5323938e645 /llvm.cpp
parent815991c906f912c4eb52e1d3646a6110d472a8ec (diff)
downloadresp-4e34e229beb12164ea49b1121785dc71eb7c3566.tar.gz
resp-4e34e229beb12164ea49b1121785dc71eb7c3566.tar.bz2
resp-4e34e229beb12164ea49b1121785dc71eb7c3566.zip
Strip trailing whitespace.
git-svn-id: http://svn.drobilla.net/resp/tuplr@118 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'llvm.cpp')
-rw-r--r--llvm.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/llvm.cpp b/llvm.cpp
index 4585a7c..e2b5992 100644
--- a/llvm.cpp
+++ b/llvm.cpp
@@ -173,7 +173,7 @@ compileFunction(CEnv& cenv, const std::string& name, const Type* retT, const ATu
if (!argNames.empty())
for (size_t i = 0; i != protT.size(); ++a, ++i)
a->setName(argNames.at(i));
-
+
BasicBlock* bb = BasicBlock::Create("entry", f);
llengine(cenv)->builder.SetInsertPoint(bb);
@@ -232,7 +232,7 @@ AClosure::liftCall(CEnv& cenv, const vector<AType*>& argsT)
return;
ATuple* protT = thisType->at(1)->as<ATuple*>();
-
+
// Write function declaration
string name = this->name == "" ? cenv.gensym("_fn") : this->name;
Function* f = compileFunction(cenv, name,
@@ -286,9 +286,9 @@ ACall::lift(CEnv& cenv)
at(i)->lift(cenv);
argsT.push_back(cenv.type(at(i)));
}
-
+
if (!c) return; // Primitive
-
+
if (c->prot()->size() < size() - 1)
throw Error((format("too many arguments to function `%1%'") % at(0)->str()).str(), loc);
if (c->prot()->size() > size() - 1)
@@ -301,7 +301,7 @@ CValue
ACall::compile(CEnv& cenv)
{
AClosure* c = cenv.tenv.resolve(at(0))->to<AClosure*>();
-
+
if (!c) return NULL; // Primitive
AType* protT = new AType(loc, NULL);
@@ -425,7 +425,7 @@ APrimitive::compile(CEnv& cenv)
else
return llengine(cenv)->builder.CreateICmp(pred, a, b);
}
-
+
throw Error("unknown primitive", loc);
}
@@ -444,9 +444,9 @@ AConsCall::lift(CEnv& cenv)
AType* funcType = functionType(cenv);
if (funcs.find(functionType(cenv)))
return;
-
+
ACall::lift(cenv);
-
+
ATuple* protT = new ATuple(loc, cenv.type(at(1)), cenv.type(at(2)), 0);
vector<const Type*> types;
@@ -457,12 +457,12 @@ AConsCall::lift(CEnv& cenv)
sz += t->getPrimitiveSizeInBits();
}
sz = (sz % 8 == 0) ? sz / 8 : sz / 8 + 1;
-
+
llvm::IRBuilder<>& builder = llengine(cenv)->builder;
StructType* sT = StructType::get(types, false);
Type* pT = PointerType::get(sT, 0);
-
+
// Write function declaration
vector<string> argNames;
argNames.push_back("car");
@@ -474,14 +474,14 @@ AConsCall::lift(CEnv& cenv)
Value* s = builder.CreateGEP(cell, ConstantInt::get(Type::Int32Ty, 0), "pair");
Value* carP = builder.CreateStructGEP(s, 0, "car");
Value* cdrP = builder.CreateStructGEP(s, 1, "cdr");
-
+
Function::arg_iterator ai = func->arg_begin();
Value& carArg = *ai++;
Value& cdrArg = *ai++;
builder.CreateStore(&carArg, carP);
builder.CreateStore(&cdrArg, cdrP);
builder.CreateRet(cell);
-
+
cenv.optimise(func);
funcs.push_back(make_pair(funcType, func));
}
@@ -599,7 +599,7 @@ repl(CEnv& cenv)
AST* body = cenv.penv.parse(exp); // Parse input
Constraints c;
body->constrain(cenv.tenv, c); // Constrain types
-
+
Subst oldSubst = cenv.tsubst;
cenv.tsubst = Subst::compose(cenv.tsubst, TEnv::unify(c)); // Solve type constraints
@@ -607,7 +607,7 @@ repl(CEnv& cenv)
if (!bodyT) throw Error("call to untyped body", cursor);
body->lift(cenv);
-
+
if (lltype(bodyT)) {
// Create anonymous function to insert code into
Function* f = compileFunction(cenv, cenv.gensym("_repl"), lltype(bodyT), ATuple(cursor));
@@ -637,7 +637,7 @@ newCenv(PEnv& penv, TEnv& tenv)
{
LLVMEngine* engine = new LLVMEngine();
CEnv* cenv = new CEnv(penv, tenv, engine);
-
+
// Host provided allocation primitive prototypes
std::vector<const Type*> argsT(1, Type::Int32Ty);
FunctionType* funcT = FunctionType::get(PointerType::get(Type::Int8Ty, 0), argsT, false);