|
|
@ -58,6 +58,13 @@ PopAST::PopAST(const std::string& n): BaseAST(n) {}
|
|
|
|
|
|
|
|
|
|
|
|
llvm::Value *PopAST::codegen(LLVMState& llvmState) const
|
|
|
|
llvm::Value *PopAST::codegen(LLVMState& llvmState) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (name == "self") {
|
|
|
|
|
|
|
|
extern std::list<ThunkAST> scope;
|
|
|
|
|
|
|
|
auto func = scope.back().func;
|
|
|
|
|
|
|
|
auto var = llvmState.createVariable(name);
|
|
|
|
|
|
|
|
llvmState.builder.CreateStore(func, var, false);
|
|
|
|
|
|
|
|
return Var::addLocal(name, var).value;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
auto gep = llvmState.createPop();
|
|
|
|
auto gep = llvmState.createPop();
|
|
|
|
auto var = llvmState.createVariable(name);
|
|
|
|
auto var = llvmState.createVariable(name);
|
|
|
|
auto load = llvmState.builder.CreateLoad(llvmState.inttype, gep);
|
|
|
|
auto load = llvmState.builder.CreateLoad(llvmState.inttype, gep);
|
|
|
@ -65,6 +72,7 @@ llvm::Value *PopAST::codegen(LLVMState& llvmState) const
|
|
|
|
|
|
|
|
|
|
|
|
return Var::addLocal(name, var).value;
|
|
|
|
return Var::addLocal(name, var).value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CallAST::CallAST(const std::string& n): BaseAST(n) {}
|
|
|
|
CallAST::CallAST(const std::string& n): BaseAST(n) {}
|
|
|
|
|
|
|
|
|
|
|
|